OSDN Git Service

文字化け用
[chemicraft/chemicraft.git] / common / chemicraft / InventoryDecomposition.java
1 package chemicraft;
2
3 import net.minecraft.src.Container;
4 import net.minecraft.src.EntityPlayer;
5 import net.minecraft.src.IInventory;
6 import net.minecraft.src.ItemStack;
7
8 public class InventoryDecomposition implements IInventory {
9
10         private ItemStack[] inventory = new ItemStack[16+1];
11
12         private Container eventHandler;
13
14         private boolean flag;
15
16         public void setEventHandler(Container par1Container){
17                 this.eventHandler = par1Container;
18                 this.flag = true;
19         }
20
21         public void setFlag(boolean par1){
22                 this.flag = par1;
23         }
24
25         @Override
26         public int getSizeInventory() {
27                 return inventory.length;
28         }
29
30         @Override
31         public ItemStack getStackInSlot(int var1) {
32                 return inventory[var1];
33         }
34
35         @Override
36         public ItemStack decrStackSize(int par1, int par2)
37         {
38                 if (this.inventory[par1] != null)
39                 {
40                         ItemStack var3 = this.inventory[par1];
41                         this.inventory[par1] = null;
42                         return var3;
43                 }
44                 else
45                 {
46                         return null;
47                 }
48         }
49
50         @Override
51         public ItemStack getStackInSlotOnClosing(int par1)
52         {
53                 if (this.inventory[par1] != null)
54                 {
55                         ItemStack var2 = this.inventory[par1];
56                         this.inventory[par1] = null;
57                         return var2;
58                 }
59                 else
60                 {
61                         return null;
62                 }
63         }
64
65         @Override
66         public void setInventorySlotContents(int var1, ItemStack var2) {
67                 inventory[var1] = var2;
68                 if(flag){
69                         this.eventHandler.onCraftMatrixChanged(this);
70                 }
71         }
72
73         @Override
74         public String getInvName() {
75                 return "DecompositionInventory";
76         }
77
78         @Override
79         public int getInventoryStackLimit() {
80                 return 64;
81         }
82
83         @Override
84         public void onInventoryChanged() {
85                 if(flag){
86                         this.eventHandler.onCraftMatrixChanged(this);
87                 }
88         }
89
90         @Override
91         public boolean isUseableByPlayer(EntityPlayer var1) {
92                 return true;
93         }
94
95         @Override
96         public void openChest() {
97
98         }
99
100         @Override
101         public void closeChest() {
102
103         }
104
105 }