diff --git a/src/com/jaquadro/minecraft/storagedrawers/inventory/ItemStackHelper.java b/src/com/jaquadro/minecraft/storagedrawers/inventory/ItemStackHelper.java index 3adf24d30..ba269b526 100644 --- a/src/com/jaquadro/minecraft/storagedrawers/inventory/ItemStackHelper.java +++ b/src/com/jaquadro/minecraft/storagedrawers/inventory/ItemStackHelper.java @@ -4,6 +4,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.capabilities.CapabilityDispatcher; +import net.minecraftforge.fml.relauncher.ReflectionHelper; import javax.annotation.Nonnull; import java.lang.reflect.Field; @@ -123,10 +124,10 @@ public static boolean isStackEncoded (@Nonnull ItemStack stack) { static { try { - itemField = ItemStack.class.getDeclaredField("item"); - itemDamageField = ItemStack.class.getDeclaredField("itemDamage"); - stackTagCompoundField = ItemStack.class.getDeclaredField("stackTagCompound"); - capabilitiesField = ItemStack.class.getDeclaredField("capabilities"); + itemField = ReflectionHelper.findField(ItemStack.class, "item", "field_151002_e"); + itemDamageField = ReflectionHelper.findField(ItemStack.class,"itemDamage", "field_77991_e"); + stackTagCompoundField = ReflectionHelper.findField(ItemStack.class,"stackTagCompound", "field_77990_d"); + capabilitiesField = ReflectionHelper.findField(ItemStack.class,"capabilities"); itemField.setAccessible(true); itemDamageField.setAccessible(true); @@ -134,7 +135,7 @@ public static boolean isStackEncoded (@Nonnull ItemStack stack) { capabilitiesField.setAccessible(true); initialized = true; - } catch (NoSuchFieldException e) { + } catch (ReflectionHelper.UnableToFindFieldException e) { initialized = false; } }