InventoryItemAlignment

This commit is contained in:
2022-10-02 16:58:52 +02:00
parent 4bdb3f94d5
commit 18db3514e3
14 changed files with 56 additions and 23 deletions

View File

@@ -31,12 +31,12 @@ public class InventoryItemAlignment {
if(x * y < size) throw new RuntimeException("Not enough space for Item alignment");
}
public Vec2d next() {
public ItemOffset next() {
counter++;
if(this.size < 9) return new Vec2d(this.row(this.size).get(counter), y/2);
if(this.size < 9) return new ItemOffset(this.row(this.size).get(counter), y > 1 ? 1 : 0);
//TODO more items?
return new Vec2d(0,0);
return new ItemOffset(0,0);
}
@@ -132,4 +132,26 @@ public class InventoryItemAlignment {
}
}.get(count);
}
public class ItemOffset {
private int x;
private int z;
public ItemOffset(int x, int z) {
this.x = x;
this.z = z;
}
public int getX() {
return x;
}
public int getZ() {
return z;
}
public int get() {
return x + (z * 9);
}
}
}