InventoryItemAlignment
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user