diff --git a/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java b/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java index d61958dcb..081b1a946 100644 --- a/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java +++ b/src/main/java/com/glodblock/github/common/tile/TileLevelMaintainer.java @@ -18,6 +18,7 @@ import com.glodblock.github.inventory.AeItemStackHandler; import com.glodblock.github.inventory.AeStackInventory; import com.glodblock.github.inventory.AeStackInventoryImpl; +import com.glodblock.github.util.ModAndClassUtil; import com.google.common.collect.ImmutableSet; import appeng.api.AEApi; @@ -171,16 +172,20 @@ private TickRateModulation doWork() { if (batchSize > 0) { IAEItemStack craftItem = requests.getCraftItem(i); - if (craftItem != null && ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) { - craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem); + if (ModAndClassUtil.ThE) { + if (craftItem != null && ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) { + craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem); + } } IAEItemStack aeItem = inv.findPrecise(craftItem); long stackSize = aeItem == null ? 0 : aeItem.getStackSize(); - if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) { - stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(aeItem, grid); + if (ModAndClassUtil.ThE) { + if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) { + stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(aeItem, grid); + } } boolean isDone = requests.isDone(i); diff --git a/src/main/java/com/glodblock/github/crossmod/thaumcraft/ThaumicEnergisticsCrafting.java b/src/main/java/com/glodblock/github/crossmod/thaumcraft/ThaumicEnergisticsCrafting.java index 958705da8..7e2510d94 100644 --- a/src/main/java/com/glodblock/github/crossmod/thaumcraft/ThaumicEnergisticsCrafting.java +++ b/src/main/java/com/glodblock/github/crossmod/thaumcraft/ThaumicEnergisticsCrafting.java @@ -9,6 +9,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; +import com.glodblock.github.util.ModAndClassUtil; + import appeng.api.networking.IGrid; import appeng.api.storage.data.IAEItemStack; import appeng.util.item.AEItemStack; @@ -32,14 +34,13 @@ public static void postInit() { * an aspect. */ public static boolean isAspectStack(ItemStack stack) { - if (stack == null) return false; + if (!ModAndClassUtil.ThE || stack == null) return false; return stack.getItem() == neiAddonAspect || stack.getItem() == thaumicEnergisticsAspect; } - @Nullable @Method(modid = "thaumicenergistics") - public static String getAspectName(ItemStack stack) { + private static @Nullable Aspect getAspect(ItemStack stack) { if (stack == null) return null; if (stack.getItem() == neiAddonAspect) { @@ -49,28 +50,37 @@ public static String getAspectName(ItemStack stack) { String aspect = aspects.getCompoundTagAt(0).getString("key"); if (aspect.isEmpty()) return null; - return aspect; + return Aspect.getAspect(aspect); } if (stack.getItem() == thaumicEnergisticsAspect) { - return ItemCraftingAspect.getAspect(stack).getTag(); + return Aspect.getAspect(ItemCraftingAspect.getAspect(stack).getTag()); } return null; } @Method(modid = "thaumicenergistics") - public static ItemStack getAspectStack(String aspectName, int stackSize) { - return ItemCraftingAspect.createStackForAspect(Aspect.getAspect(aspectName), stackSize); + private static ItemStack getAspectStack(Aspect aspect, int stackSize) { + return ItemCraftingAspect.createStackForAspect(aspect, stackSize); } /** * Converts an aspect stack into a thaumic energistics stack. */ public static IAEItemStack convertAspectStack(IAEItemStack stack) { + if (ModAndClassUtil.ThE) { + return convertAspectStackImpl(stack); + } else { + return stack; + } + } + + @Method(modid = "thaumicenergistics") + private static IAEItemStack convertAspectStackImpl(IAEItemStack stack) { if (stack == null) return null; - String aspect = getAspectName(stack.getItemStack()); + Aspect aspect = getAspect(stack.getItemStack()); if (aspect == null) return stack; @@ -80,13 +90,17 @@ public static IAEItemStack convertAspectStack(IAEItemStack stack) { /** * Gets the amount of essentia stored in a grid for a given aspect preview. */ - @Method(modid = "thaumicenergistics") public static long getEssentiaAmount(IAEItemStack stack, IGrid grid) { - String aspectName = getAspectName(stack.getItemStack()); - - if (aspectName == null) return 0; + if (ModAndClassUtil.ThE) { + return getEssentiaAmountImpl(stack, grid); + } else { + return 0; + } + } - Aspect aspect = Aspect.getAspect(aspectName); + @Method(modid = "thaumicenergistics") + private static long getEssentiaAmountImpl(IAEItemStack stack, IGrid grid) { + Aspect aspect = getAspect(stack.getItemStack()); if (aspect == null) return 0;