OSDN Git Service

d4c8257223d6d650ac3a35438cdaa42f82659380
[chemicraft/chemicraft.git] / common / chemicraft / tileentity / TileEntityChemicalCombinationTable.java
1 package chemicraft.tileentity;
2
3 import chemicraft.inventory.InventoryChemicalCombinationTableMaterial;
4 import chemicraft.inventory.InventoryChemicalCombinationTableResult;
5 import net.minecraft.src.ItemStack;
6 import net.minecraft.src.NBTTagCompound;
7 import net.minecraft.src.NBTTagList;
8 import net.minecraft.src.TileEntity;
9
10 public class TileEntityChemicalCombinationTable extends TileEntity {
11
12         private InventoryChemicalCombinationTableMaterial invm = new InventoryChemicalCombinationTableMaterial();
13         private InventoryChemicalCombinationTableResult invr = new InventoryChemicalCombinationTableResult();
14
15         @Override
16         public void readFromNBT(NBTTagCompound par1){
17                 super.readFromNBT(par1);
18                 NBTTagList var2 = par1.getTagList("Items");
19                 for (int var3 = 0; var3 < var2.tagCount(); ++var3)
20                 {
21                         NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
22                         int var5 = var4.getByte("Slot") & 255;
23
24                         if (var5 >= 0 && var5 < this.invm.getSizeInventory())
25                         {
26                                 this.invm.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4));
27                         }
28                 }
29
30                 NBTTagList var6 = par1.getTagList("Items2");
31                 for (int var3 = 0; var3 < var6.tagCount(); ++var3)
32                 {
33                         NBTTagCompound var7 = (NBTTagCompound)var6.tagAt(var3);
34                         int var8 = var7.getByte("Slot2") & 255;
35
36                         if (var8 >= 0 && var8 < this.invr.getSizeInventory())
37                         {
38                                 this.invr.setInventorySlotContents(var8, ItemStack.loadItemStackFromNBT(var7));
39                         }
40                 }
41         }
42
43         @Override
44         public void writeToNBT(NBTTagCompound par1){
45                 super.writeToNBT(par1);
46         }
47
48         public InventoryChemicalCombinationTableMaterial getInvMaterial(){
49                 return this.invm;
50         }
51
52         public InventoryChemicalCombinationTableResult getInvResult(){
53                 return this.invr;
54         }
55
56 }