|
@@ -8,15 +8,17 @@ import net.minecraft.item.ItemStack;
|
|
|
public class InventoryBase extends InventoryBasic
|
|
|
{
|
|
|
private final Entity owner;
|
|
|
+ private final int allSlots;
|
|
|
private final int rows;
|
|
|
private final byte[] data;
|
|
|
private final byte[] smallData;
|
|
|
|
|
|
- public InventoryBase(String title, byte[] data, int slots, Entity owner)
|
|
|
+ public InventoryBase(String title, byte[] data, int slots, int allSlots, Entity owner)
|
|
|
{
|
|
|
super(title, true, slots);
|
|
|
this.owner = owner;
|
|
|
- this.rows = slots / 9 + (slots % 9 == 0 ? 0 : 1);
|
|
|
+ this.allSlots = allSlots;
|
|
|
+ this.rows = allSlots / 9 + (allSlots % 9 == 0 ? 0 : 1);
|
|
|
this.data = data;
|
|
|
this.smallData = deleteZeros(data);
|
|
|
}
|
|
@@ -75,13 +77,13 @@ public class InventoryBase extends InventoryBasic
|
|
|
super(title, true, Math.min(54, slots.length() - countZeros(slots)));
|
|
|
this.owner = owner;
|
|
|
|
|
|
- int slotAmount = Math.min(54, slots.length());
|
|
|
- this.rows = slotAmount / 9 + (slotAmount % 9 == 0 ? 0 : 1);
|
|
|
-
|
|
|
+ allSlots = Math.min(54, slots.length());
|
|
|
+ this.rows = allSlots / 9 + (allSlots % 9 == 0 ? 0 : 1);
|
|
|
+
|
|
|
this.data = new byte[14];
|
|
|
|
|
|
int id;
|
|
|
- for(int i = 0; i < slotAmount; i++)
|
|
|
+ for(int i = 0; i < allSlots; i++)
|
|
|
{
|
|
|
id = Character.getNumericValue(slots.charAt(i));
|
|
|
if(id > 3 || id < 0)
|
|
@@ -104,6 +106,7 @@ public class InventoryBase extends InventoryBasic
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
this.smallData = deleteZeros(data);
|
|
|
}
|
|
|
|
|
@@ -111,7 +114,8 @@ public class InventoryBase extends InventoryBasic
|
|
|
{
|
|
|
super(title, true, Math.max(9, Math.min(54, ((slots / 9) + ((slots % 9) == 0 ? 0 : 1)) * 9)));
|
|
|
this.owner = owner;
|
|
|
- this.rows = super.getSizeInventory() / 9;
|
|
|
+ this.allSlots = super.getSizeInventory();
|
|
|
+ this.rows = allSlots / 9;
|
|
|
this.data = new byte[14];
|
|
|
// default is 3 to every 2 bits
|
|
|
Arrays.fill(this.data, (byte) 0xFF);
|
|
@@ -235,4 +239,9 @@ public class InventoryBase extends InventoryBasic
|
|
|
|
|
|
return stack;
|
|
|
}
|
|
|
+
|
|
|
+ public int getAllSlots()
|
|
|
+ {
|
|
|
+ return allSlots;
|
|
|
+ }
|
|
|
}
|