Start on the update

This commit is contained in:
modmuss50 2016-11-19 12:50:08 +00:00
parent c8d8ce0241
commit a0e6a2dc34
No known key found for this signature in database
GPG key ID: 773D17BE8BF49C82
112 changed files with 522 additions and 503 deletions

View file

@ -33,14 +33,14 @@ public class TileQuantumChest extends TileLegacyMachineBase
@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);
@ -51,25 +51,25 @@ public class TileQuantumChest extends TileLegacyMachineBase
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;
}
}
@ -78,7 +78,7 @@ public class TileQuantumChest extends TileLegacyMachineBase
@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());
}
@ -98,7 +98,7 @@ public class TileQuantumChest extends TileLegacyMachineBase
}
if (storedItem != null) {
storedItem.stackSize = tagCompound.getInteger("storedQuantity");
storedItem.getCount() = tagCompound.getInteger("storedQuantity");
}
}
@ -112,7 +112,7 @@ public class TileQuantumChest extends TileLegacyMachineBase
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);
}
@ -161,15 +161,15 @@ public class TileQuantumChest extends TileLegacyMachineBase
@Override
public void setStoredItemCount(int amount) {
this.storedItem.stackSize = 0;
this.storedItem.stackSize += (amount);
this.storedItem.getCount() = 0;
this.storedItem.getCount() += (amount);
this.markDirty();
}
@Override
public void setStoredItemType(ItemStack type, int amount) {
this.storedItem = type;
this.storedItem.stackSize = amount;
this.storedItem.getCount() = amount;
this.markDirty();
}
@ -185,11 +185,11 @@ public class TileQuantumChest extends TileLegacyMachineBase
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);
}