Better Null checks for Crate Containers

This commit is contained in:
Kam committed 2024-03-29 13:54:03 -04:00
1 parent 024b917930
commit bc98642b95
1 file changed
+22 -19
@@ -16,31 +16,34 @@ public class ContainerCrate extends Container
{
this.lowerChestInventory = par2IInventory;
this.upperChestInventory = par1IInventory;
this.numRows = par2IInventory.getSizeInventory() / 9;
par2IInventory.openInventory();
int i = (this.numRows - 4) * 18;
int j;
int k;
this.numRows = 0;
if(par2IInventory != null && par1IInventory != null){
this.numRows = par2IInventory.getSizeInventory() / 9;
par2IInventory.openInventory();
int i = (this.numRows - 4) * 18;
int j;
int k;
for (j = 0; j < this.numRows; ++j)
{
for (k = 0; k < 9; ++k)
for (j = 0; j < this.numRows; ++j)
{
this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18));
for (k = 0; k < 9; ++k)
{
this.addSlotToContainer(new Slot(par2IInventory, k + j * 9, 8 + k * 18, 18 + j * 18));
}
}
}
for (j = 0; j < 3; ++j)
{
for (k = 0; k < 9; ++k)
for (j = 0; j < 3; ++j)
{
this.addSlotToContainer(new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
for (k = 0; k < 9; ++k)
{
this.addSlotToContainer(new Slot(par1IInventory, k + j * 9 + 9, 8 + k * 18, 103 + j * 18 + i));
}
}
}
for (j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i));
for (j = 0; j < 9; ++j)
{
this.addSlotToContainer(new Slot(par1IInventory, j, 8 + j * 18, 161 + i));
}
}
}
@@ -103,4 +106,4 @@ public class ContainerCrate extends Container
{
return this.lowerChestInventory;
}
}
}