Item Crate can add items to Block Crate
If you have a crate, with items in it, clicking on a create that is empty or contains the same item will result in the held crate giving some of its items to the block crate. So far now bugs but futhur testing will be need to make sure that the max limit is held as well as the item crate can still be used. Also not sure why the two computer craft api files think there new.
This commit is contained in:
parent
6419ced007
commit
a445890fcc
2 changed files with 19 additions and 2 deletions
|
@ -49,7 +49,7 @@ public class BlockCrate extends BlockMachine
|
|||
}
|
||||
|
||||
tileEntity.prevClickTime = world.getWorldTime();
|
||||
|
||||
// add items
|
||||
if (side == 1 || (side > 1 && hitY > 0.5))
|
||||
{
|
||||
if (allMode)
|
||||
|
@ -61,6 +61,7 @@ public class BlockCrate extends BlockMachine
|
|||
this.insertCurrentItem(tileEntity, player);
|
||||
}
|
||||
}
|
||||
// remove items
|
||||
else if (side == 0 || (side > 1 && hitY <= 0.5))
|
||||
{
|
||||
if (allMode)
|
||||
|
@ -100,6 +101,18 @@ public class BlockCrate extends BlockMachine
|
|||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, this.putIn(tileEntity, currentStack));
|
||||
return true;
|
||||
}// if the item being used is a create then try to merge the items inside
|
||||
else if (currentStack.getItem().itemID == AssemblyLine.blockCrate.blockID)
|
||||
{
|
||||
ItemStack containedStack = ItemBlockCrate.getContainingItemStack(currentStack);
|
||||
ItemStack crateStack = tileEntity.getStackInSlot(0);
|
||||
if (containedStack != null && (crateStack == null || (crateStack != null && containedStack.getItem().itemID == crateStack.getItem().itemID && containedStack.getItemDamage() == crateStack.getItemDamage())))
|
||||
{
|
||||
ItemStack returned = this.putIn(tileEntity, containedStack);
|
||||
ItemBlockCrate.setContainingItemStack(currentStack, returned );
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,10 @@ public class ItemBlockCrate extends ItemBlock
|
|||
itemStack.getTagCompound().setTag("Item", itemTagCompound);
|
||||
|
||||
itemStack.getTagCompound().setInteger("Count", containingStack.stackSize);
|
||||
}else
|
||||
{
|
||||
itemStack.getTagCompound().setTag("Item", new NBTTagCompound());
|
||||
itemStack.getTagCompound().setInteger("Count", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue