fix inventory
This commit is contained in:
parent
030268bfc3
commit
593e10c3cc
19 changed files with 52 additions and 121 deletions
|
@ -19,8 +19,8 @@ public class ContainerChest extends Container
|
|||
BlockChest block = BlockChest.getChest(this.chestSize);
|
||||
this.width = block.getInventoryWidth();
|
||||
this.height = block.getInventoryHeight();
|
||||
int xOffset = (this.width - 9) * 18 / 2;
|
||||
int yoffset = (this.height - 4) * 18;
|
||||
int xOffset = this.width < 12 ? 0 : (this.width - 12) * 18 / 2;
|
||||
int yOffset = (this.height - 3) * 18;
|
||||
|
||||
for (int j = 0; j < this.height; ++j)
|
||||
{
|
||||
|
@ -30,17 +30,9 @@ public class ContainerChest extends Container
|
|||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < 3; ++l)
|
||||
for (int l = 0; l < player.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int j1 = 0; j1 < 9; ++j1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, j1 + l * 9 + 9, 8 + j1 * 18 + xOffset, 103 + l * 18 + yoffset));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 9; ++i1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, i1, 8 + i1 * 18 + xOffset, 161 + yoffset));
|
||||
this.addSlotToContainer(new Slot(player, l, 8 + (l % 12) * 18 + xOffset, 85 + (l / 12) * 18 + yOffset));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,17 +63,9 @@ public class ContainerEnchantment extends Container
|
|||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int l = 0; l < playerInv.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 9; ++k)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInv, k, 8 + k * 18, 142));
|
||||
this.addSlotToContainer(new Slot(playerInv, l, 8 + (l % 12) * 18, 84 + (l / 12) * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,17 +49,9 @@ public class ContainerEntityInventory extends Container
|
|||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 3; ++i1)
|
||||
for (int l = 0; l < player.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int k1 = 0; k1 < 9; ++k1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, k1 + i1 * 9 + 9, 8 + k1 * 18, 102 + i1 * 18 + j));
|
||||
}
|
||||
}
|
||||
|
||||
for (int j1 = 0; j1 < 9; ++j1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, j1, 8 + j1 * 18, 160 + j));
|
||||
this.addSlotToContainer(new Slot(player, l, 8 + (l % 12) * 18, 84 + (l / 12) * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,17 +28,9 @@ public class ContainerMerchant extends Container
|
|||
});
|
||||
this.addSlotToContainer(new SlotMerchantResult(playerInventory, this.merchantInventory, 2, 120, 53));
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int l = 0; l < playerInventory.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 9; ++k)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
|
||||
this.addSlotToContainer(new Slot(playerInventory, l, 8 + (l % 12) * 18, 84 + (l / 12) * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ContainerPlayer extends Container {
|
|||
for (Equipment slot : Equipment.ARMOR)
|
||||
{
|
||||
final Equipment type = slot;
|
||||
this.addSlotToContainer(new Slot(player, 27 + 9 + slot.getIndex(), 8 + (slot.getIndex() / 4) * 18, 8 + (slot.getIndex() % 4) * 18)
|
||||
this.addSlotToContainer(new Slot(player, player.getInventoryCapacity() + slot.getIndex(), 8 + (slot.getIndex() / 4) * 18, 8 + (slot.getIndex() % 4) * 18)
|
||||
{
|
||||
public boolean canStackItems()
|
||||
{
|
||||
|
@ -52,17 +52,9 @@ public class ContainerPlayer extends Container {
|
|||
});
|
||||
}
|
||||
|
||||
for (int l = 0; l < 3; ++l)
|
||||
for (int l = 0; l < player.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int j1 = 0; j1 < 9; ++j1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, j1 + (l + 1) * 9, 8 + j1 * 18, 84 + l * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 9; ++i1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, i1, 8 + i1 * 18, 142));
|
||||
this.addSlotToContainer(new Slot(player, l, 8 + (l % 12) * 18, 84 + (l / 12) * 18));
|
||||
}
|
||||
|
||||
this.onCraftMatrixChanged(this.craftMatrix);
|
||||
|
@ -137,7 +129,7 @@ public class ContainerPlayer extends Container {
|
|||
|
||||
if (index == 0)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + 27 + 9, true))
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + playerIn.getInventoryCapacity(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -146,14 +138,14 @@ public class ContainerPlayer extends Container {
|
|||
}
|
||||
else if (index >= 1 && index < 5)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + 27 + 9, false))
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + playerIn.getInventoryCapacity(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (index >= 5 && index < 5 + Equipment.ARMOR_SLOTS)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + 27 + 9, false))
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + playerIn.getInventoryCapacity(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -165,21 +157,11 @@ public class ContainerPlayer extends Container {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
else if (index >= 5 + Equipment.ARMOR_SLOTS && index < 5 + Equipment.ARMOR_SLOTS + 27)
|
||||
else if (index >= 5 + Equipment.ARMOR_SLOTS && index < 5 + Equipment.ARMOR_SLOTS + playerIn.getInventoryCapacity())
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS + 27, 5 + Equipment.ARMOR_SLOTS + 27 + 9, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else if (index >= 5 + Equipment.ARMOR_SLOTS + 27 && index < 5 + Equipment.ARMOR_SLOTS + 27 + 9)
|
||||
{
|
||||
if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + 27, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + 27 + 9, false))
|
||||
else if (!this.mergeItemStack(itemstack1, 5 + Equipment.ARMOR_SLOTS, 5 + Equipment.ARMOR_SLOTS + playerIn.getInventoryCapacity(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -121,17 +121,9 @@ public class ContainerRepair extends Container
|
|||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int l = 0; l < playerInventory.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int j = 0; j < 9; ++j)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 9; ++k)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInventory, k, 8 + k * 18, 142));
|
||||
this.addSlotToContainer(new Slot(playerInventory, l, 8 + (l % 12) * 18, 84 + (l / 12) * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ public class ContainerTile extends Container
|
|||
this.resourceOvercharges = new int[tile.getNumResources()];
|
||||
this.resourceUndercharges = new int[tile.getNumResources()];
|
||||
this.resourceEntropies = new int[tile.getNumResources()];
|
||||
int i = 112;
|
||||
|
||||
int input = 0;
|
||||
int output = 0;
|
||||
|
@ -52,17 +51,9 @@ public class ContainerTile extends Container
|
|||
++output;
|
||||
}
|
||||
|
||||
for (int l = 0; l < 3; ++l)
|
||||
for (int l = 0; l < player.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int k = 0; k < 9; ++k)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, k + l * 9 + 9, 8 + k * 18, l * 18 + i));
|
||||
}
|
||||
}
|
||||
|
||||
for (int i1 = 0; i1 < 9; ++i1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(player, i1, 8 + i1 * 18, 58 + i));
|
||||
this.addSlotToContainer(new Slot(player, l, 8 + (l % 12) * 18, 112 + (l / 12) * 18));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,17 +38,9 @@ public class ContainerWorkbench extends Container
|
|||
}
|
||||
}
|
||||
|
||||
for (int k = 0; k < 3; ++k)
|
||||
for (int l = 0; l < playerInventory.getInventoryCapacity(); ++l)
|
||||
{
|
||||
for (int i1 = 0; i1 < 9; ++i1)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 30 + size * 18 + k * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int l = 0; l < 9; ++l)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 88 + size * 18));
|
||||
this.addSlotToContainer(new Slot(playerInventory, l, 8 + (l % 12) * 18, 30 + size * 18 + (l / 12) * 18));
|
||||
}
|
||||
|
||||
this.onCraftMatrixChanged(this.craftMatrix);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue