-
Notifications
You must be signed in to change notification settings - Fork 755
/
GolemCoreLogic.java
117 lines (97 loc) · 2.39 KB
/
GolemCoreLogic.java
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package tconstruct.blocks.logic;
import tconstruct.library.blocks.InventoryLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
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.world.World;
public class GolemCoreLogic extends InventoryLogic implements IInventory
{
public GolemCoreLogic()
{
super(1);
}
public ItemStack getKey ()
{
return inventory[0];
}
public void setKey (ItemStack itemstack)
{
inventory[0] = itemstack;
onInventoryChanged();
}
public void clear ()
{
inventory[0] = null;
}
public int getSizeInventory ()
{
return 1;
}
public ItemStack getStackInSlot (int slot)
{
return inventory[0];
}
public int getInventoryStackLimit ()
{
return 1;
}
public boolean canInteractWith (EntityPlayer entityplayer)
{
return true;
}
public void openChest ()
{
}
public void closeChest ()
{
}
public boolean isUseableByPlayer (EntityPlayer entityplayer)
{
return true;
}
@Override
public ItemStack getStackInSlotOnClosing (int i)
{
return null;
}
@Override
public boolean isInvNameLocalized ()
{
return false;
}
@Override
public boolean isItemValidForSlot (int i, ItemStack itemstack)
{
return true;
}
@Override
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
{
return null;
}
@Override
protected String getDefaultName ()
{
return "golems.core";
}
/* Packets */
@Override
public Packet getDescriptionPacket ()
{
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
{
readFromNBT(packet.data);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
}