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
|
package gregtech.common.tileentities.storage;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
public class MTEQuantumChest extends MTEDigitalChestBase {
public int mItemCount = 0;
public ItemStack mItemStack = null;
NBTTagList mInvData = null;
public MTEQuantumChest(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier);
}
public MTEQuantumChest(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
public MTEQuantumChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, aDescription, aTextures);
}
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTEQuantumChest(mName, mTier, mDescriptionArray, mTextures);
}
@Override
public void setItemNBT(NBTTagCompound aNBT) {
mInvData = new NBTTagList();
for (int i = 0; i < 3; i++) {
if (mInventory[i] != null) {
NBTTagCompound tNBT = new NBTTagCompound();
tNBT.setByte("Count", (byte) mInventory[i].stackSize);
tNBT.setShort("Damage", (short) mInventory[i].getItemDamage());
tNBT.setShort("id", (short) Item.getIdFromItem(mInventory[i].getItem()));
tNBT.setInteger("IntSlot", i);
if (mInventory[i].hasTagCompound()) {
tNBT.setTag("tag", mInventory[i].getTagCompound());
}
mInvData.appendTag(tNBT);
}
}
if (mItemStack != null) aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound()));
aNBT.setTag("Inventory", mInvData);
aNBT.setInteger("mItemCount", getItemCount());
aNBT.setBoolean("mVoidOverflow", mVoidOverflow);
super.setItemNBT(aNBT);
}
@Override
protected String chestName() {
return "Quantum Chest";
}
@Override
protected int getItemCount() {
return mItemCount;
}
@Override
public void setItemCount(int aCount) {
mItemCount = aCount;
}
@Override
protected ItemStack getItemStack() {
return mItemStack;
}
@Override
protected void setItemStack(ItemStack s) {
mItemStack = s;
}
@Nullable
@Override
public List<ItemStack> getItemsForHoloGlasses() {
List<ItemStack> ret = new ArrayList<>();
ret.add(getStackInSlot(0));
ret.add(getStackInSlot(1));
if (mItemStack != null) {
ItemStack copy = mItemStack.copy();
copy.stackSize = mItemCount;
ret.add(copy);
}
return ret;
}
}
|