fix items voiding under certain circumstances

This commit is contained in:
PrototypeTrousers
2022-11-22 19:04:42 -03:00
parent bd4f03652e
commit 225a4d5ab6
4 changed files with 15 additions and 3 deletions
@@ -311,7 +311,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
if (!is.isEmpty()) { if (!is.isEmpty()) {
is.writeToNBT(itemNBT); is.writeToNBT(itemNBT);
if (is.getCount() > is.getMaxStackSize()) { if (is.getCount() > Byte.MAX_VALUE) {
itemNBT.setInteger("stackSize", is.getCount()); itemNBT.setInteger("stackSize", is.getCount());
} }
} }
@@ -527,7 +527,7 @@ public abstract class ContainerPatternEncoder extends ContainerMEMonitorable imp
if (!i.isEmpty()) { if (!i.isEmpty()) {
i.writeToNBT(c); i.writeToNBT(c);
if (i.getCount() > i.getMaxStackSize()) { if (i.getCount() > Byte.MAX_VALUE) {
c.setInteger("stackSize", i.getCount()); c.setInteger("stackSize", i.getCount());
} }
} }
@@ -210,6 +210,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
for (final ItemStack is : this.waitingToSend) { for (final ItemStack is : this.waitingToSend) {
final NBTTagCompound item = new NBTTagCompound(); final NBTTagCompound item = new NBTTagCompound();
is.writeToNBT(item); is.writeToNBT(item);
if (is.getCount() > Byte.MAX_VALUE) {
item.setInteger("stackSize", is.getCount());
}
waitingToSend.appendTag(item); waitingToSend.appendTag(item);
} }
} }
@@ -224,6 +227,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
for (final ItemStack is : this.waitingToSendFacing.get(s)) { for (final ItemStack is : this.waitingToSendFacing.get(s)) {
final NBTTagCompound item = new NBTTagCompound(); final NBTTagCompound item = new NBTTagCompound();
is.writeToNBT(item); is.writeToNBT(item);
if (is.getCount() > Byte.MAX_VALUE) {
item.setInteger("stackSize", is.getCount());
}
waitingListSided.appendTag(item); waitingListSided.appendTag(item);
} }
sidedWaitList.setTag(s.name(), waitingListSided); sidedWaitList.setTag(s.name(), waitingListSided);
@@ -241,6 +247,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final NBTTagCompound c = waitingList.getCompoundTagAt(x); final NBTTagCompound c = waitingList.getCompoundTagAt(x);
if (c != null) { if (c != null) {
final ItemStack is = new ItemStack(c); final ItemStack is = new ItemStack(c);
if (c.hasKey("stackSize")) {
is.setCount(c.getInteger("stackSize"));
}
this.addToSendList(is); this.addToSendList(is);
} }
} }
@@ -256,6 +265,9 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final NBTTagCompound c = w.getCompoundTagAt(x); final NBTTagCompound c = w.getCompoundTagAt(x);
if (c != null) { if (c != null) {
final ItemStack is = new ItemStack(c); final ItemStack is = new ItemStack(c);
if (c.hasKey("stackSize")) {
is.setCount(c.getInteger("stackSize"));
}
this.addToSendListFacing(is, EnumFacing.getFront(s.getIndex())); this.addToSendListFacing(is, EnumFacing.getFront(s.getIndex()));
} }
} }
@@ -164,7 +164,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements Iterabl
if (!is.isEmpty()) { if (!is.isEmpty()) {
NBTTagCompound itemTag = new NBTTagCompound(); NBTTagCompound itemTag = new NBTTagCompound();
itemTag.setInteger("Slot", i); itemTag.setInteger("Slot", i);
if (is.getCount() > is.getMaxStackSize()) { if (is.getCount() > Byte.MAX_VALUE) {
itemTag.setInteger("stackSize", stacks.get(i).getCount()); itemTag.setInteger("stackSize", stacks.get(i).getCount());
} }
stacks.get(i).writeToNBT(itemTag); stacks.get(i).writeToNBT(itemTag);