diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-08-13 21:12:11 +0100 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2015-08-13 21:12:11 +0100 |
| commit | 0ef6a00aa79f022e5bd56b3f77e6861bbecf6d94 (patch) | |
| tree | 03966c83cd16d1912ec1596d83f89f251cc35f83 /src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java | |
| parent | 921f1ba6f30e66c80c803618ebff496778e78970 (diff) | |
Added a new structure, a new curse, achievements, challenges, curses
entry in the guide; reworked liquids to be tile entities, cleaned the
structures code, potion code and... you know what? I improved and
changed so much stuff that I literally forgot what I did...
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java')
| -rw-r--r-- | src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java new file mode 100644 index 0000000..5da722a --- /dev/null +++ b/src/main/java/darkknight/jewelrycraft/tileentity/TileEntityMoltenMetal.java @@ -0,0 +1,66 @@ +/**
+ *
+ */
+package darkknight.jewelrycraft.tileentity;
+
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.network.NetworkManager;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * @author Sorin
+ */
+public class TileEntityMoltenMetal extends TileEntity {
+ private ItemStack metal;
+
+ public TileEntityMoltenMetal() {
+ metal = null;
+ }
+
+ public boolean canUpdate() {
+ return false;
+ }
+
+ public void setMetal(ItemStack metal) {
+ if(metal != null) this.metal = metal.copy();
+ else this.metal = null;
+ }
+
+ public ItemStack getMetal() {
+ return metal;
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ if (metal != null) {
+ NBTTagCompound tag = new NBTTagCompound();
+ metal.writeToNBT(tag);
+ nbt.setTag("metal", tag);
+ }
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ if (nbt.hasKey("metal")) setMetal(ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("metal")));
+ else metal = null;
+ }
+
+ @Override
+ public Packet getDescriptionPacket() {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+ writeToNBT(nbttagcompound);
+ return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, nbttagcompound);
+ }
+
+ @Override
+ public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
+ readFromNBT(packet.func_148857_g());
+ worldObj.func_147479_m(xCoord, yCoord, zCoord);
+ }
+}
|
