1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package darkknight.jewelrycraft.tileentity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.tileentity.TileEntity;
public class TileEntityJewelrsCraftingTable extends TileEntity
{
public boolean hasJewel, hasModifier;
public ItemStack jewel, modifier;
public TileEntityJewelrsCraftingTable()
{
this.jewel = new ItemStack(0, 0, 0);
this.modifier = new ItemStack(0, 0, 0);
this.hasJewel = false;
this.hasModifier = false;
}
@Override
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
nbt.setBoolean("hasJewel", hasJewel);
nbt.setBoolean("hasModifier", hasModifier);
NBTTagCompound tag = new NBTTagCompound();
NBTTagCompound tag1 = new NBTTagCompound();
this.jewel.writeToNBT(tag);
nbt.setCompoundTag("jewel", tag);
this.modifier.writeToNBT(tag1);
nbt.setCompoundTag("modifier", tag1);
}
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
this.hasJewel = nbt.getBoolean("hasJewel");
this.hasModifier = nbt.getBoolean("hasModifier");
this.jewel = new ItemStack(0, 0, 0);
this.jewel.readFromNBT(nbt.getCompoundTag("jewel"));
this.modifier = new ItemStack(0, 0, 0);
this.modifier.readFromNBT(nbt.getCompoundTag("modifier"));
}
public void updateEntity()
{
super.updateEntity();
}
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
readFromNBT(pkt.data);
}
public Packet getDescriptionPacket()
{
NBTTagCompound nbtTag = new NBTTagCompound();
this.writeToNBT(nbtTag);
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbtTag);
}
}
|