blob: 1e9ea49dbf86f2b8f0e5eebbc2994b1d62ecbd73 (
plain)
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
|
package gtPlusPlus.api.objects.minecraft;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.common.lib.crafting.ThaumcraftCraftingManager;
public class ThaumcraftItemStackData {
protected final Item mItem;
protected final int mDamage;
protected final int mStackSize;
protected final NBTTagCompound mNBT;
protected final String mUniqueDataTag;
private final AspectList mAspectList;
public ThaumcraftItemStackData (ItemStack aStack) {
mItem = aStack.getItem();
mDamage = aStack.getItemDamage();
mStackSize = aStack.stackSize;
mNBT = (aStack.getTagCompound() != null ? aStack.getTagCompound() : new NBTTagCompound());
mUniqueDataTag = ""+Item.getIdFromItem(mItem)+""+mDamage+""+mNBT.getId();
mAspectList = ThaumcraftCraftingManager.getObjectTags(aStack);
}
public String getUniqueDataIdentifier() {
return this.mUniqueDataTag;
}
public ItemStack getStack() {
ItemStack aTemp = ItemUtils.simpleMetaStack(mItem, mDamage, mStackSize);
aTemp.setTagCompound(mNBT);
return aTemp;
}
public AspectList getAspectList() {
return mAspectList;
}
public boolean doesItemStackDataMatch(ItemStack aStack) {
if (aStack == null) {
return false;
}
Item aItem = aStack.getItem();
int aMeta = aStack.getItemDamage();
if (aItem != null) {
if (aItem == mItem && aMeta == mDamage) {
return true;
}
}
return false;
}
}
|