OSDN Git Service

428b675a57c11aaa17b05b26be7a3b333a2f8645
[chemicraft/chemicraft.git] / common / chemicraft / TileEntityScienceCraftingTable.java
1 package chemicraft;
2
3 import cpw.mods.fml.common.network.PacketDispatcher;
4 import net.minecraft.src.EntityPlayer;
5 import net.minecraft.src.IInventory;
6 import net.minecraft.src.ItemStack;
7 import net.minecraft.src.NBTTagCompound;
8 import net.minecraft.src.Packet;
9 import net.minecraft.src.TileEntity;
10 import net.minecraftforge.common.ForgeDirection;
11 import net.minecraftforge.common.ISidedInventory;
12
13 public class TileEntityScienceCraftingTable extends TileEntity implements IInventory, ISidedInventory {
14
15         /**
16          * InventorySlotのItemStack配列
17          */
18         private ItemStack[] inventory = new ItemStack[17];
19
20
21         /**
22          * ActiveなTabの名前
23          */
24         private String activeTab;
25
26
27
28         public TileEntityScienceCraftingTable() {
29                 super();
30                 //ActiveTabのデフォルトを設定
31                 this.activeTab = "Decomposition";
32         }
33
34
35         @Override
36         public void updateEntity() {
37                 super.updateEntity();
38                 System.out.println(this.activeTab);
39         }
40
41
42         @Override
43         public void readFromNBT(NBTTagCompound par1) {
44                 super.readFromNBT(par1);
45                 this.activeTab = par1.getString("activeTab");
46         }
47
48
49         @Override
50         public void writeToNBT(NBTTagCompound par1) {
51                 super.writeToNBT(par1);
52                 par1.setString("activeTab", this.activeTab);
53         }
54
55
56         public String getActiveTab(){
57                 return this.activeTab;
58         }
59
60
61         public void setActiveTab(String activeTab){
62                 PacketDispatcher.sendPacketToServer(this.getDescriptionPacket());
63                 this.activeTab = activeTab;
64         }
65
66
67         @Override
68         public int getSizeInventory() {
69                 return inventory.length;
70         }
71
72
73         @Override
74         public ItemStack getStackInSlot(int var1) {
75                 return inventory[var1];
76         }
77
78
79         @Override
80         public ItemStack decrStackSize(int var1, int var2) {
81                 return null;
82         }
83
84
85         @Override
86         public ItemStack getStackInSlotOnClosing(int var1) {
87                 return null;
88         }
89
90
91         @Override
92         public void setInventorySlotContents(int var1, ItemStack var2) {
93         }
94
95
96         @Override
97         public String getInvName() {
98                 return null;
99         }
100
101
102         @Override
103         public int getInventoryStackLimit() {
104                 return 64;
105         }
106
107
108         @Override
109         public boolean isUseableByPlayer(EntityPlayer var1) {
110                 return false;
111         }
112
113
114         @Override
115         public void openChest() {
116         }
117
118
119         @Override
120         public void closeChest() {
121         }
122
123
124         @Override
125         public Packet getDescriptionPacket() {
126                 return PacketHandler.getPacket(this);
127         }
128
129
130 <<<<<<< HEAD
131 =======
132         public void handlePacket(Object[] data) {
133             this.activeTab = (String) data[0];
134         }
135
136 >>>>>>> 820e884ca2933199d4be03f7de49a491a7f9e93e
137
138         @Override
139         public int getStartInventorySide(ForgeDirection side) {
140                 return 0;
141         }
142
143
144         @Override
145         public int getSizeInventorySide(ForgeDirection side) {
146                 return 0;
147         }
148 }