Attempted to fix sync issues
This commit is contained in:
parent
fc82d9aa56
commit
18c2ec19cf
2 changed files with 48 additions and 44 deletions
|
@ -1 +1,3 @@
|
|||
# TechReborn
|
||||
|
||||
[![Build Status](http://modmuss50.me:8080/buildStatus/icon?job=TechReborn)](http://modmuss50.me:8080/job/TechReborn/)
|
||||
|
|
|
@ -33,53 +33,55 @@ public class TileQuantumChest extends TileMachineBase implements IInventory,
|
|||
@Override
|
||||
public void updateEntity()
|
||||
{
|
||||
if (storedItem != null)
|
||||
{
|
||||
ItemStack fakeStack = storedItem.copy();
|
||||
fakeStack.stackSize = 1;
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else
|
||||
{
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
|
||||
if (getStackInSlot(0) != null)
|
||||
{
|
||||
if (storedItem == null)
|
||||
if(!worldObj.isRemote){
|
||||
if (storedItem != null)
|
||||
{
|
||||
storedItem = getStackInSlot(0);
|
||||
setInventorySlotContents(0, null);
|
||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0),
|
||||
true, true))
|
||||
{
|
||||
if (storedItem.stackSize <= Integer.MAX_VALUE
|
||||
- getStackInSlot(0).stackSize)
|
||||
{
|
||||
storedItem.stackSize += getStackInSlot(0).stackSize;
|
||||
decrStackSize(0, getStackInSlot(0).stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storedItem != null && getStackInSlot(1) == null)
|
||||
{
|
||||
ItemStack itemStack = storedItem.copy();
|
||||
itemStack.stackSize = itemStack.getMaxStackSize();
|
||||
setInventorySlotContents(1, itemStack);
|
||||
storedItem.stackSize -= itemStack.getMaxStackSize();
|
||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true,
|
||||
true))
|
||||
{
|
||||
int wanted = getStackInSlot(1).getMaxStackSize()
|
||||
- getStackInSlot(1).stackSize;
|
||||
if (storedItem.stackSize >= wanted)
|
||||
{
|
||||
decrStackSize(1, -wanted);
|
||||
storedItem.stackSize -= wanted;
|
||||
ItemStack fakeStack = storedItem.copy();
|
||||
fakeStack.stackSize = 1;
|
||||
setInventorySlotContents(2, fakeStack);
|
||||
} else
|
||||
{
|
||||
decrStackSize(1, -storedItem.stackSize);
|
||||
storedItem = null;
|
||||
setInventorySlotContents(2, null);
|
||||
}
|
||||
|
||||
if (getStackInSlot(0) != null)
|
||||
{
|
||||
if (storedItem == null)
|
||||
{
|
||||
storedItem = getStackInSlot(0);
|
||||
setInventorySlotContents(0, null);
|
||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0),
|
||||
true, true))
|
||||
{
|
||||
if (storedItem.stackSize <= Integer.MAX_VALUE
|
||||
- getStackInSlot(0).stackSize)
|
||||
{
|
||||
storedItem.stackSize += getStackInSlot(0).stackSize;
|
||||
decrStackSize(0, getStackInSlot(0).stackSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (storedItem != null && getStackInSlot(1) == null)
|
||||
{
|
||||
ItemStack itemStack = storedItem.copy();
|
||||
itemStack.stackSize = itemStack.getMaxStackSize();
|
||||
setInventorySlotContents(1, itemStack);
|
||||
storedItem.stackSize -= itemStack.getMaxStackSize();
|
||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true,
|
||||
true))
|
||||
{
|
||||
int wanted = getStackInSlot(1).getMaxStackSize()
|
||||
- getStackInSlot(1).stackSize;
|
||||
if (storedItem.stackSize >= wanted)
|
||||
{
|
||||
decrStackSize(1, -wanted);
|
||||
storedItem.stackSize -= wanted;
|
||||
} else
|
||||
{
|
||||
decrStackSize(1, -storedItem.stackSize);
|
||||
storedItem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
syncWithAll();
|
||||
|
|
Loading…
Reference in a new issue