2016-08-14 18:53:25 +00:00
|
|
|
package WayofTime.bloodmagic.tile;
|
|
|
|
|
2016-08-14 23:14:08 +00:00
|
|
|
import net.minecraft.inventory.InventoryHelper;
|
2016-08-14 18:53:25 +00:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
|
|
|
public class TileMimic extends TileInventory
|
|
|
|
{
|
2016-08-14 23:14:08 +00:00
|
|
|
public boolean dropItemsOnBreak = true;
|
|
|
|
|
2016-08-14 18:53:25 +00:00
|
|
|
public TileMimic()
|
|
|
|
{
|
|
|
|
super(1, "mimic");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-08-14 23:14:08 +00:00
|
|
|
public void readFromNBT(NBTTagCompound tag)
|
2016-08-14 18:53:25 +00:00
|
|
|
{
|
2016-08-14 23:14:08 +00:00
|
|
|
super.readFromNBT(tag);
|
|
|
|
|
|
|
|
dropItemsOnBreak = tag.getBoolean("dropItemsOnBreak");
|
2016-08-14 18:53:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-08-14 23:14:08 +00:00
|
|
|
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
2016-08-14 18:53:25 +00:00
|
|
|
{
|
2016-08-14 23:14:08 +00:00
|
|
|
super.writeToNBT(tag);
|
2016-08-14 18:53:25 +00:00
|
|
|
|
2016-08-14 23:14:08 +00:00
|
|
|
tag.setBoolean("dropItemsOnBreak", dropItemsOnBreak);
|
|
|
|
|
|
|
|
return tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void dropItems()
|
|
|
|
{
|
|
|
|
if (dropItemsOnBreak)
|
|
|
|
{
|
|
|
|
InventoryHelper.dropInventoryItems(getWorld(), getPos(), this);
|
|
|
|
}
|
2016-08-14 18:53:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
|
|
|
{
|
2016-08-14 23:14:08 +00:00
|
|
|
return slot == 0 && dropItemsOnBreak;
|
2016-08-14 18:53:25 +00:00
|
|
|
}
|
|
|
|
}
|