2013-09-16 19:43:32 +02:00
|
|
|
package cpw.mods.ironchest;
|
|
|
|
|
2013-09-16 23:04:09 +02:00
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2014-02-05 19:06:35 +01:00
|
|
|
import net.minecraft.init.Items;
|
2013-09-16 19:43:32 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTTagList;
|
|
|
|
import net.minecraft.nbt.NBTTagString;
|
2016-03-21 17:44:27 +01:00
|
|
|
import net.minecraft.util.text.translation.I18n;
|
2013-09-16 19:43:32 +02:00
|
|
|
|
2016-03-21 17:44:27 +01:00
|
|
|
public class TileEntityDirtChest extends TileEntityIronChest
|
|
|
|
{
|
2016-04-21 20:29:22 +02:00
|
|
|
private static ItemStack dirtChest9000GuideBook = new ItemStack(Items.WRITTEN_BOOK);
|
2016-03-21 17:44:27 +01:00
|
|
|
|
|
|
|
static
|
|
|
|
{
|
2014-02-05 19:06:35 +01:00
|
|
|
dirtChest9000GuideBook.setTagInfo("author", new NBTTagString("cpw"));
|
2016-03-21 17:44:27 +01:00
|
|
|
dirtChest9000GuideBook.setTagInfo("title", new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.title")));
|
2013-09-16 19:43:32 +02:00
|
|
|
NBTTagList pages = new NBTTagList();
|
2016-03-21 17:44:27 +01:00
|
|
|
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page1")));
|
|
|
|
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page2")));
|
|
|
|
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page3")));
|
|
|
|
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page4")));
|
|
|
|
pages.appendTag(new NBTTagString(I18n.translateToLocal("book.ironchest:dirtchest9000.page5")));
|
2013-09-16 19:43:32 +02:00
|
|
|
dirtChest9000GuideBook.setTagInfo("pages", pages);
|
|
|
|
}
|
2016-03-21 17:44:27 +01:00
|
|
|
|
|
|
|
public TileEntityDirtChest()
|
|
|
|
{
|
2013-09-16 19:43:32 +02:00
|
|
|
super(IronChestType.DIRTCHEST9000);
|
2013-09-16 23:04:09 +02:00
|
|
|
}
|
2014-02-05 19:06:35 +01:00
|
|
|
|
2013-09-16 23:04:09 +02:00
|
|
|
@Override
|
|
|
|
public void wasPlaced(EntityLivingBase entityliving, ItemStack itemStack)
|
|
|
|
{
|
2016-03-21 17:44:27 +01:00
|
|
|
if (!(itemStack.hasTagCompound() && itemStack.getTagCompound().getBoolean("dirtchest")))
|
|
|
|
{
|
|
|
|
this.setInventorySlotContents(0, dirtChest9000GuideBook.copy());
|
2013-09-16 23:04:09 +02:00
|
|
|
}
|
|
|
|
}
|
2014-02-05 19:06:35 +01:00
|
|
|
|
2013-09-16 23:04:09 +02:00
|
|
|
@Override
|
|
|
|
public void removeAdornments()
|
|
|
|
{
|
2016-03-21 17:44:27 +01:00
|
|
|
if (this.chestContents[0] != null && this.chestContents[0].isItemEqual(dirtChest9000GuideBook))
|
|
|
|
{
|
|
|
|
this.chestContents[0] = null;
|
2013-09-16 23:04:09 +02:00
|
|
|
}
|
2013-09-16 19:43:32 +02:00
|
|
|
}
|
|
|
|
}
|