Fix a few Cardboard Box bugs

This commit is contained in:
Aidan C. Brady 2014-02-01 19:20:10 -05:00
parent 8f68bf8d3e
commit 9b1c605131
3 changed files with 15 additions and 6 deletions

View file

@ -1271,6 +1271,7 @@ public class Mekanism
@ForgeSubscribe
public void onBlacklistUpdate(BoxBlacklistEvent event)
{
MekanismAPI.addBoxBlacklist(CardboardBox.blockID, OreDictionary.WILDCARD_VALUE);
MekanismAPI.addBoxBlacklist(BoundingBlock.blockID, OreDictionary.WILDCARD_VALUE);
MekanismAPI.addBoxBlacklist(Block.bedrock.blockID, 0);
MekanismAPI.addBoxBlacklist(Block.portal.blockID, OreDictionary.WILDCARD_VALUE);

View file

@ -130,12 +130,16 @@ public class BlockCardboardBox extends BlockContainer
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
{
TileEntityCardboardBox tileEntity = (TileEntityCardboardBox)world.getBlockTileEntity(x, y, z);
ItemStack itemStack = new ItemStack(Mekanism.CardboardBox, 1, world.getBlockMetadata(x, y, z));
if(itemStack.getItemDamage() == 1)
{
if(tileEntity.storedData != null)
{
((ItemBlockCardboardBox)itemStack.getItem()).setBlockData(itemStack, tileEntity.storedData);
}
}
return itemStack;
}

View file

@ -11,6 +11,8 @@ public class TileEntityCardboardBox extends TileEntity
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{
super.readFromNBT(nbtTags);
if(nbtTags.hasKey("storedData"))
{
storedData = BlockData.read(nbtTags.getCompoundTag("storedData"));
@ -20,6 +22,8 @@ public class TileEntityCardboardBox extends TileEntity
@Override
public void writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
if(storedData != null)
{
nbtTags.setCompoundTag("storedData", storedData.write(new NBTTagCompound()));