Start on the update
This commit is contained in:
parent
c8d8ce0241
commit
a0e6a2dc34
112 changed files with 522 additions and 503 deletions
|
@ -31,14 +31,14 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote) {
|
||||
if (!world.isRemote) {
|
||||
if (storedItem != null) {
|
||||
ItemStack fakeStack = storedItem.copy();
|
||||
fakeStack.stackSize = 1;
|
||||
fakeStack.getCount() = 1;
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else if (storedItem == null && getStackInSlot(1) != null) {
|
||||
ItemStack fakeStack = getStackInSlot(1).copy();
|
||||
fakeStack.stackSize = 1;
|
||||
fakeStack.getCount() = 1;
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else {
|
||||
setInventorySlotContents(2, null);
|
||||
|
@ -49,25 +49,25 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
storedItem = getStackInSlot(0);
|
||||
setInventorySlotContents(0, null);
|
||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)) {
|
||||
if (storedItem.stackSize <= storage - getStackInSlot(0).stackSize) {
|
||||
storedItem.stackSize += getStackInSlot(0).stackSize;
|
||||
decrStackSize(0, getStackInSlot(0).stackSize);
|
||||
if (storedItem.getCount() <= storage - getStackInSlot(0).getCount()) {
|
||||
storedItem.getCount() += getStackInSlot(0).getCount();
|
||||
decrStackSize(0, getStackInSlot(0).getCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storedItem != null && getStackInSlot(1) == null) {
|
||||
ItemStack itemStack = storedItem.copy();
|
||||
itemStack.stackSize = itemStack.getMaxStackSize();
|
||||
itemStack.getCount() = itemStack.getMaxStackSize();
|
||||
setInventorySlotContents(1, itemStack);
|
||||
storedItem.stackSize -= itemStack.getMaxStackSize();
|
||||
storedItem.getCount() -= itemStack.getMaxStackSize();
|
||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) {
|
||||
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize;
|
||||
if (storedItem.stackSize >= wanted) {
|
||||
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).getCount();
|
||||
if (storedItem.getCount() >= wanted) {
|
||||
decrStackSize(1, -wanted);
|
||||
storedItem.stackSize -= wanted;
|
||||
storedItem.getCount() -= wanted;
|
||||
} else {
|
||||
decrStackSize(1, -storedItem.stackSize);
|
||||
decrStackSize(1, -storedItem.getCount());
|
||||
storedItem = null;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
world.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||
getPos().getY(), getPos().getZ());
|
||||
readFromNBT(packet.getNbtCompound());
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
}
|
||||
|
||||
if (storedItem != null) {
|
||||
storedItem.stackSize = tagCompound.getInteger("storedQuantity");
|
||||
storedItem.getCount() = tagCompound.getInteger("storedQuantity");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||
if (storedItem != null) {
|
||||
tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound()));
|
||||
tagCompound.setInteger("storedQuantity", storedItem.stackSize);
|
||||
tagCompound.setInteger("storedQuantity", storedItem.getCount());
|
||||
} else
|
||||
tagCompound.setInteger("storedQuantity", 0);
|
||||
return tagCompound;
|
||||
|
@ -156,11 +156,11 @@ public class TileDigitalChest extends TileLegacyMachineBase implements IInventor
|
|||
String name = "of nothing";
|
||||
if (storedItem != null) {
|
||||
name = storedItem.getDisplayName();
|
||||
size += storedItem.stackSize;
|
||||
size += storedItem.getCount();
|
||||
}
|
||||
if (getStackInSlot(1) != null) {
|
||||
name = getStackInSlot(1).getDisplayName();
|
||||
size += getStackInSlot(1).stackSize;
|
||||
size += getStackInSlot(1).getCount();
|
||||
}
|
||||
info.add(size + " " + name);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue