setContents method, remove applyUpgradeItem

applyUpgradeItem is no longer needed because it's now being completely done from ItemChestChanger
setContents added for ItemChestChanger
This commit is contained in:
Mitchell 2015-01-28 19:24:09 -04:00
parent b4dd5d1a67
commit a29c12ab84
1 changed files with 11 additions and 22 deletions

View File

@ -60,6 +60,16 @@ public class TileEntityIronChest extends TileEntityLockable implements IUpdatePl
return chestContents;
}
public void setContents(ItemStack[] contents) {
chestContents = new ItemStack[getSizeInventory()];
for (int i = 0; i < contents.length; i ++) {
if (i < chestContents.length) {
chestContents[i] = contents[i];
}
}
inventoryTouched = true;
}
@Override
public int getSizeInventory()
{
@ -402,27 +412,6 @@ public class TileEntityIronChest extends TileEntityLockable implements IUpdatePl
this.facing = facing2;
}
public TileEntityIronChest applyUpgradeItem(ItemChestChanger itemChestChanger)
{
if (numUsingPlayers > 0)
{
return null;
}
if (!itemChestChanger.getType().canUpgrade(this.getType()))
{
return null;
}
TileEntityIronChest newEntity = IronChestType.makeEntity(itemChestChanger.getTargetChestOrdinal(getType().ordinal()));
int newSize = newEntity.chestContents.length;
System.arraycopy(chestContents, 0, newEntity.chestContents, 0, Math.min(newSize, chestContents.length));
BlockIronChest block = IronChest.ironChestBlock;
block.dropContent(newSize, this, this.worldObj, pos);
newEntity.setFacing(facing);
newEntity.sortTopStacks();
newEntity.ticksSinceSync = -1;
return newEntity;
}
public ItemStack[] getTopItemStacks()
{
return topStacks;