Made it so blocks placed inside mimics from someone in Creative do not drop.
This commit is contained in:
parent
e3bb9f20bf
commit
a2f89687be
2 changed files with 51 additions and 9 deletions
|
@ -1,32 +1,48 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class TileMimic extends TileInventory
|
||||
{
|
||||
public boolean dropItemsOnBreak = true;
|
||||
|
||||
public TileMimic()
|
||||
{
|
||||
super(1, "mimic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound tagCompound)
|
||||
public void readFromNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.readFromNBT(tagCompound);
|
||||
super.readFromNBT(tag);
|
||||
|
||||
dropItemsOnBreak = tag.getBoolean("dropItemsOnBreak");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
||||
{
|
||||
super.writeToNBT(tagCompound);
|
||||
super.writeToNBT(tag);
|
||||
|
||||
return tagCompound;
|
||||
tag.setBoolean("dropItemsOnBreak", dropItemsOnBreak);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropItems()
|
||||
{
|
||||
if (dropItemsOnBreak)
|
||||
{
|
||||
InventoryHelper.dropInventoryItems(getWorld(), getPos(), this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack)
|
||||
{
|
||||
return slot == 0;
|
||||
return slot == 0 && dropItemsOnBreak;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue