diff options
Diffstat (limited to 'src/main')
15 files changed, 206 insertions, 256 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 6875769e95..8d4652c1d8 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -493,18 +493,16 @@ public class GT_Mod implements IGT_Mod { GT_Forestry_Compat.transferCentrifugeRecipes(); GT_Forestry_Compat.transferSqueezerRecipes(); } - if (GregTech_API.mAE2) { - GT_MetaTileEntity_DigitalChestBase.registerAEIntegration(); - ItemStack facade = AEApi.instance() - .definitions() - .items() - .facade() - .maybeItem() - .transform(i -> new ItemStack(i, 1, GT_Values.W)) - .orNull(); - if (facade != null) { - GregTech_API.registerCover(facade, null, new GT_Cover_FacadeAE()); - } + GT_MetaTileEntity_DigitalChestBase.registerAEIntegration(); + ItemStack facade = AEApi.instance() + .definitions() + .items() + .facade() + .maybeItem() + .transform(i -> new ItemStack(i, 1, GT_Values.W)) + .orNull(); + if (facade != null) { + GregTech_API.registerCover(facade, null, new GT_Cover_FacadeAE()); } Arrays diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index d25fde3047..ded3a6c9d7 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -279,8 +279,13 @@ public class GregTech_API { sMachineRainExplosions = true, sMachineThunderExplosions = true, sMachineFireExplosions = true, sMachineWireFire = true, mOutputRF = false, mInputRF = false, meIOLoaded = false, mRFExplosions = false, mServerStarted = false, mIC2Classic = false, mMagneticraft = false, mImmersiveEngineering = false, - mGTPlusPlus = false, mTranslocator = false, mTConstruct = false, mGalacticraft = false, mAE2 = false, - mHodgepodge = false, mAvaritia = false; + mGTPlusPlus = false, mTranslocator = false, mTConstruct = false, mGalacticraft = false, mHodgepodge = false, + mAvaritia = false; + /** + * This is always set to true + */ + @Deprecated + public boolean mAE2 = true; public static int mEUtoRF = 360, mRFtoEU = 20; diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index af1fbace15..c67648df9c 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -972,7 +972,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity tileEntityInvalid = false; leaveEnet(); if (canAccessData()) { - if (GregTech_API.mAE2) invalidateAE(); + invalidateAE(); mMetaTileEntity.onRemoval(); mMetaTileEntity.setBaseMetaTileEntity(null); } @@ -982,7 +982,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity @Override public void onChunkUnload() { super.onChunkUnload(); - if (GregTech_API.mAE2) onChunkUnloadAE(); + onChunkUnloadAE(); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index 9d51f6f37e..9c9bdd0078 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -359,10 +359,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile if (GalacticraftCore.isModLoaded() && GT_GC_Compat.canConnect(tileEntity, oppositeSide)) return true; // AE2-p2p Compat - if (GT_Mod.gregtechproxy.mAE2Integration) { - if (tileEntity instanceof appeng.tile.powersink.IC2 ic2sink - && ic2sink.acceptsEnergyFrom((TileEntity) baseMetaTile, oppositeSide)) return true; - } + if (tileEntity instanceof appeng.tile.powersink.IC2 ic2sink + && ic2sink.acceptsEnergyFrom((TileEntity) baseMetaTile, oppositeSide)) return true; // IC2 Compat { diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index e92d9ffae9..d853ea5f0a 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -546,7 +546,6 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler, IG public boolean mIgnoreTcon = true; public boolean mDisableIC2Cables = false; public boolean mAchievements = true; - public boolean mAE2Integration = true; public boolean mArcSmeltIntoAnnealed = true; public boolean mMagneticraftRecipes = false; public boolean mImmersiveEngineeringRecipes = false; diff --git a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java index f71ef2ee30..957d446a51 100644 --- a/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java +++ b/src/main/java/gregtech/common/covers/GT_Cover_ItemMeter.java @@ -17,7 +17,6 @@ import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.common.widget.TextWidget; import com.gtnewhorizons.modularui.common.widget.textfield.BaseTextFieldWidget; -import gregtech.api.GregTech_API; import gregtech.api.gui.modularui.GT_CoverUIBuildContext; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -85,7 +84,7 @@ public class GT_Cover_ItemMeter extends GT_CoverBehaviorBase<GT_Cover_ItemMeter. if (mte instanceof GT_MetaTileEntity_DigitalChestBase dc) { max = dc.getMaxItemCount(); used = dc.getProgresstime(); - } else if (GregTech_API.mAE2 && mte instanceof GT_MetaTileEntity_Hatch_OutputBus_ME) { + } else if (mte instanceof GT_MetaTileEntity_Hatch_OutputBus_ME) { if (((GT_MetaTileEntity_Hatch_OutputBus_ME) mte).isLastOutputFailed()) { max = 64; used = 64; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_CraftingInput_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_CraftingInput_ME.java index 6c4fcf40e2..83a5789430 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_CraftingInput_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_CraftingInput_ME.java @@ -67,7 +67,6 @@ import appeng.util.IWideReadableNumberConverter; import appeng.util.Platform; import appeng.util.ReadableNumberConverter; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.IConfigurationCircuitSupport; @@ -485,9 +484,7 @@ public class GT_MetaTileEntity_Hatch_CraftingInput_ME extends GT_MetaTileEntity_ } aNBT.setTag("internalInventory", internalInventoryNBT); if (customName != null) aNBT.setString("customName", customName); - if (GregTech_API.mAE2) { - getProxy().writeToNBT(aNBT); - } + getProxy().writeToNBT(aNBT); } @Override @@ -537,9 +534,7 @@ public class GT_MetaTileEntity_Hatch_CraftingInput_ME extends GT_MetaTileEntity_ if (aNBT.hasKey("customName")) customName = aNBT.getString("customName"); - if (GregTech_API.mAE2) { - getProxy().readFromNBT(aNBT); - } + getProxy().readFromNBT(aNBT); } @Override @@ -557,44 +552,42 @@ public class GT_MetaTileEntity_Hatch_CraftingInput_ME extends GT_MetaTileEntity_ @Override public String[] getInfoData() { - if (GregTech_API.mAE2) { - var ret = new ArrayList<String>(); + var ret = new ArrayList<String>(); + ret.add( + "The bus is " + ((getProxy() != null && getProxy().isActive()) ? EnumChatFormatting.GREEN + "online" + : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) + EnumChatFormatting.RESET); + ret.add("Internal Inventory: "); + var i = 0; + for (var slot : internalInventory) { + if (slot == null) continue; + IWideReadableNumberConverter nc = ReadableNumberConverter.INSTANCE; + + i += 1; ret.add( - "The bus is " + ((getProxy() != null && getProxy().isActive()) ? EnumChatFormatting.GREEN + "online" - : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) + EnumChatFormatting.RESET); - ret.add("Internal Inventory: "); - var i = 0; - for (var slot : internalInventory) { - if (slot == null) continue; - IWideReadableNumberConverter nc = ReadableNumberConverter.INSTANCE; - - i += 1; + "Slot " + i + + " " + + EnumChatFormatting.BLUE + + describePattern(slot.patternDetails) + + EnumChatFormatting.RESET); + for (var item : slot.itemInventory) { + if (item == null || item.stackSize == 0) continue; + ret.add( + item.getItem() + .getItemStackDisplayName(item) + ": " + + EnumChatFormatting.GOLD + + nc.toWideReadableForm(item.stackSize) + + EnumChatFormatting.RESET); + } + for (var fluid : slot.fluidInventory) { + if (fluid == null || fluid.amount == 0) continue; ret.add( - "Slot " + i - + " " - + EnumChatFormatting.BLUE - + describePattern(slot.patternDetails) + fluid.getLocalizedName() + ": " + + EnumChatFormatting.AQUA + + nc.toWideReadableForm(fluid.amount) + EnumChatFormatting.RESET); - for (var item : slot.itemInventory) { - if (item == null || item.stackSize == 0) continue; - ret.add( - item.getItem() - .getItemStackDisplayName(item) + ": " - + EnumChatFormatting.GOLD - + nc.toWideReadableForm(item.stackSize) - + EnumChatFormatting.RESET); - } - for (var fluid : slot.fluidInventory) { - if (fluid == null || fluid.amount == 0) continue; - ret.add( - fluid.getLocalizedName() + ": " - + EnumChatFormatting.AQUA - + nc.toWideReadableForm(fluid.amount) - + EnumChatFormatting.RESET); - } } - return ret.toArray(new String[0]); - } else return new String[] {}; + } + return ret.toArray(new String[0]); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java index 801bff1c4c..39fd457647 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_InputBus_ME.java @@ -50,7 +50,6 @@ import appeng.me.GridAccessException; import appeng.me.helpers.AENetworkProxy; import appeng.me.helpers.IGridProxyable; import appeng.util.item.AEItemStack; -import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.gui.modularui.GT_UITextures; import gregtech.api.interfaces.IConfigurationCircuitSupport; @@ -174,9 +173,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch aNBT.setIntArray("sizes", sizes); aNBT.setBoolean("autoStock", autoPullItemList); aNBT.setInteger("minAutoPullStackSize", minAutoPullStackSize); - if (GregTech_API.mAE2) { - getProxy().writeToNBT(aNBT); - } + getProxy().writeToNBT(aNBT); } private void setAutoPullItemList(boolean pullItemList) { @@ -208,9 +205,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch } autoPullItemList = aNBT.getBoolean("autoStock"); minAutoPullStackSize = aNBT.getInteger("minAutoPullStackSize"); - if (GregTech_API.mAE2) { - getProxy().readFromNBT(aNBT); - } + getProxy().readFromNBT(aNBT); } @Override @@ -220,11 +215,9 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch @Override public String[] getInfoData() { - if (GregTech_API.mAE2) { - return new String[] { - "The bus is " + ((getProxy() != null && getProxy().isActive()) ? EnumChatFormatting.GREEN + "online" - : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) + EnumChatFormatting.RESET }; - } else return new String[] {}; + return new String[] { + "The bus is " + ((getProxy() != null && getProxy().isActive()) ? EnumChatFormatting.GREEN + "online" + : EnumChatFormatting.RED + "offline" + getAEDiagnostics()) + EnumChatFormatting.RESET }; } @Override @@ -337,7 +330,7 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch // Display slots return null; if (aIndex == getCircuitSlot() || aIndex == getManualSlot()) return mInventory[aIndex]; - if (GregTech_API.mAE2 && mInventory[aIndex] != null) { + if (mInventory[aIndex] != null) { AENetworkProxy proxy = getProxy(); if (proxy == null) { return null; @@ -385,28 +378,26 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch } private void refreshItemList() { - if (GregTech_API.mAE2) { - AENetworkProxy proxy = getProxy(); - try { - IMEMonitor<IAEItemStack> sg = proxy.getStorage() - .getItemInventory(); - Iterator<IAEItemStack> iterator = sg.getStorageList() - .iterator(); - int index = 0; - while (iterator.hasNext() && index < SLOT_COUNT) { - IAEItemStack currItem = iterator.next(); - if (currItem.getStackSize() >= minAutoPullStackSize) { - ItemStack itemstack = GT_Utility.copyAmount(1, currItem.getItemStack()); - this.mInventory[index] = itemstack; - index++; - } - } - for (int i = index; i < SLOT_COUNT; i++) { - mInventory[i] = null; + AENetworkProxy proxy = getProxy(); + try { + IMEMonitor<IAEItemStack> sg = proxy.getStorage() + .getItemInventory(); + Iterator<IAEItemStack> iterator = sg.getStorageList() + .iterator(); + int index = 0; + while (iterator.hasNext() && index < SLOT_COUNT) { + IAEItemStack currItem = iterator.next(); + if (currItem.getStackSize() >= minAutoPullStackSize) { + ItemStack itemstack = GT_Utility.copyAmount(1, currItem.getItemStack()); + this.mInventory[index] = itemstack; + index++; } + } + for (int i = index; i < SLOT_COUNT; i++) { + mInventory[i] = null; + } - } catch (final GridAccessException ignored) {} - } + } catch (final GridAccessException ignored) {} } private void updateAllInformationSlots() { @@ -417,33 +408,31 @@ public class GT_MetaTileEntity_Hatch_InputBus_ME extends GT_MetaTileEntity_Hatch @Override public void endRecipeProcessing() { - if (GregTech_API.mAE2) { - for (int i = 0; i < SLOT_COUNT; ++i) { - if (savedStackSizes[i] != 0) { - ItemStack oldStack = shadowInventory[i]; - if (oldStack == null || oldStack.stackSize < savedStackSizes[i]) { - AENetworkProxy proxy = getProxy(); - try { - IMEMonitor<IAEItemStack> sg = proxy.getStorage() - .getItemInventory(); - IAEItemStack request = AEItemStack.create(mInventory[i]); - request.setStackSize(savedStackSizes[i] - (oldStack == null ? 0 : oldStack.stackSize)); - sg.extractItems(request, Actionable.MODULATE, getRequestSource()); - proxy.getEnergy() - .extractAEPower(request.getStackSize(), Actionable.MODULATE, PowerMultiplier.CONFIG); - setInventorySlotContents(i + SLOT_COUNT, oldStack); - } catch (final GridAccessException ignored) {} - } - savedStackSizes[i] = 0; - shadowInventory[i] = null; + for (int i = 0; i < SLOT_COUNT; ++i) { + if (savedStackSizes[i] != 0) { + ItemStack oldStack = shadowInventory[i]; + if (oldStack == null || oldStack.stackSize < savedStackSizes[i]) { + AENetworkProxy proxy = getProxy(); + try { + IMEMonitor<IAEItemStack> sg = proxy.getStorage() + .getItemInventory(); + IAEItemStack request = AEItemStack.create(mInventory[i]); + request.setStackSize(savedStackSizes[i] - (oldStack == null ? 0 : oldStack.stackSize)); + sg.extractItems(request, Actionable.MODULATE, getRequestSource()); + proxy.getEnergy() + .extractAEPower(request.getStackSize(), Actionable.MODULATE, PowerMultiplier.CONFIG); + setInventorySlotContents(i + SLOT_COUNT, oldStack); + } catch (final GridAccessException ignored) {} } + savedStackSizes[i] = 0; + shadowInventory[i] = null; } } processingRecipe = false; } public ItemStack updateInformationSlot(int aIndex, ItemStack aStack) { - if (GregTech_API.mAE2 && aIndex >= 0 && aIndex < SLOT_COUNT) { + if (aIndex >= 0 && aIndex < SLOT_COUNT) { if (aStack == null) { super.setInventorySlotContents(aIndex + SLOT_COUNT, null); } else { diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index 086cbf0b96..ff284015ea 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -34,7 +34,6 @@ import appeng.util.IWideReadableNumberConverter; import appeng.util.Platform; import appeng.util.ReadableNumberConverter; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; @@ -49,9 +48,9 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc private BaseActionSource requestSource = null; private @Nullable AENetworkProxy gridProxy = null; - final IItemList<IAEItemStack> itemCache = GregTech_API.mAE2 ? AEApi.instance() + final IItemList<IAEItemStack> itemCache = AEApi.instance() .storage() - .createItemList() : null; + .createItemList(); long lastOutputTick = 0; long tickCounter = 0; boolean lastOutputFailed = false; @@ -96,7 +95,6 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public boolean storeAll(ItemStack aStack) { - if (!GregTech_API.mAE2) return false; aStack.stackSize = store(aStack); return aStack.stackSize == 0; } @@ -210,57 +208,53 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - if (GregTech_API.mAE2) { - NBTTagList items = new NBTTagList(); - for (IAEItemStack s : itemCache) { - if (s.getStackSize() == 0) continue; - NBTTagCompound tag = new NBTTagCompound(); - tag.setTag("itemStack", GT_Utility.saveItem(s.getItemStack())); - tag.setLong("size", s.getStackSize()); - items.appendTag(tag); - } - aNBT.setTag("cachedItems", items); - getProxy().writeToNBT(aNBT); + NBTTagList items = new NBTTagList(); + for (IAEItemStack s : itemCache) { + if (s.getStackSize() == 0) continue; + NBTTagCompound tag = new NBTTagCompound(); + tag.setTag("itemStack", GT_Utility.saveItem(s.getItemStack())); + tag.setLong("size", s.getStackSize()); + items.appendTag(tag); } + aNBT.setTag("cachedItems", items); + getProxy().writeToNBT(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - if (GregTech_API.mAE2) { - NBTBase t = aNBT.getTag("cachedStack"); // legacy - if (t instanceof NBTTagCompound) itemCache.add( - AEApi.instance() + NBTBase t = aNBT.getTag("cachedStack"); // legacy + if (t instanceof NBTTagCompound) itemCache.add( + AEApi.instance() + .storage() + .createItemStack(GT_Utility.loadItem((NBTTagCompound) t))); + t = aNBT.getTag("cachedItems"); + if (t instanceof NBTTagList l) { + for (int i = 0; i < l.tagCount(); ++i) { + NBTTagCompound tag = l.getCompoundTagAt(i); + if (!tag.hasKey("itemStack")) { // legacy #868 + itemCache.add( + AEApi.instance() + .storage() + .createItemStack(GT_Utility.loadItem(l.getCompoundTagAt(i)))); + continue; + } + NBTTagCompound tagItemStack = tag.getCompoundTag("itemStack"); + final IAEItemStack s = AEApi.instance() .storage() - .createItemStack(GT_Utility.loadItem((NBTTagCompound) t))); - t = aNBT.getTag("cachedItems"); - if (t instanceof NBTTagList l) { - for (int i = 0; i < l.tagCount(); ++i) { - NBTTagCompound tag = l.getCompoundTagAt(i); - if (!tag.hasKey("itemStack")) { // legacy #868 - itemCache.add( - AEApi.instance() - .storage() - .createItemStack(GT_Utility.loadItem(l.getCompoundTagAt(i)))); - continue; - } - NBTTagCompound tagItemStack = tag.getCompoundTag("itemStack"); - final IAEItemStack s = AEApi.instance() - .storage() - .createItemStack(GT_Utility.loadItem(tagItemStack)); - if (s != null) { - s.setStackSize(tag.getLong("size")); - itemCache.add(s); - } else { - GT_Mod.GT_FML_LOGGER.warn( - "An error occurred while loading contents of ME Output Bus. This item has been voided: " - + tagItemStack); - } + .createItemStack(GT_Utility.loadItem(tagItemStack)); + if (s != null) { + s.setStackSize(tag.getLong("size")); + itemCache.add(s); + } else { + GT_Mod.GT_FML_LOGGER.warn( + "An error occurred while loading contents of ME Output Bus. This item has been voided: " + + tagItemStack); } } - getProxy().readFromNBT(aNBT); } + getProxy().readFromNBT(aNBT); } public boolean isLastOutputFailed() { @@ -274,7 +268,6 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public String[] getInfoData() { - if (!GregTech_API.mAE2) return new String[] {}; List<String> ss = new ArrayList<>(); ss.add( "The bus is " + ((getProxy() != null && getProxy().isActive()) ? EnumChatFormatting.GREEN + "online" diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java index 6deff3edcb..000af7c8de 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_Output_ME.java @@ -39,7 +39,6 @@ import appeng.me.helpers.IGridProxyable; import appeng.util.IWideReadableNumberConverter; import appeng.util.ReadableNumberConverter; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.ITexture; @@ -53,9 +52,9 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O private BaseActionSource requestSource = null; private @Nullable AENetworkProxy gridProxy = null; - final IItemList<IAEFluidStack> fluidCache = GregTech_API.mAE2 ? AEApi.instance() + final IItemList<IAEFluidStack> fluidCache = AEApi.instance() .storage() - .createFluidList() : null; + .createFluidList(); long lastOutputTick = 0; long tickCounter = 0; boolean lastOutputFailed = false; @@ -104,7 +103,6 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O @Override public int fill(FluidStack aFluid, boolean doFill) { - if (!GregTech_API.mAE2) return 0; if (doFill) { return tryFillAE(aFluid); } else { @@ -234,47 +232,43 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - if (GregTech_API.mAE2) { - NBTTagList fluids = new NBTTagList(); - for (IAEFluidStack s : fluidCache) { - if (s.getStackSize() == 0) continue; - NBTTagCompound tag = new NBTTagCompound(); - NBTTagCompound tagFluidStack = new NBTTagCompound(); - s.getFluidStack() - .writeToNBT(tagFluidStack); - tag.setTag("fluidStack", tagFluidStack); - tag.setLong("size", s.getStackSize()); - fluids.appendTag(tag); - } - aNBT.setTag("cachedFluids", fluids); - getProxy().writeToNBT(aNBT); + NBTTagList fluids = new NBTTagList(); + for (IAEFluidStack s : fluidCache) { + if (s.getStackSize() == 0) continue; + NBTTagCompound tag = new NBTTagCompound(); + NBTTagCompound tagFluidStack = new NBTTagCompound(); + s.getFluidStack() + .writeToNBT(tagFluidStack); + tag.setTag("fluidStack", tagFluidStack); + tag.setLong("size", s.getStackSize()); + fluids.appendTag(tag); } + aNBT.setTag("cachedFluids", fluids); + getProxy().writeToNBT(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - if (GregTech_API.mAE2) { - NBTBase t = aNBT.getTag("cachedFluids"); - if (t instanceof NBTTagList l) { - for (int i = 0; i < l.tagCount(); ++i) { - NBTTagCompound tag = l.getCompoundTagAt(i); - NBTTagCompound tagFluidStack = tag.getCompoundTag("fluidStack"); - final IAEFluidStack s = AEApi.instance() - .storage() - .createFluidStack(GT_Utility.loadFluid(tagFluidStack)); - if (s != null) { - s.setStackSize(tag.getLong("size")); - fluidCache.add(s); - } else { - GT_Mod.GT_FML_LOGGER.warn( - "An error occurred while loading contents of ME Output Hatch. This fluid has been voided: " - + tagFluidStack); - } + NBTBase t = aNBT.getTag("cachedFluids"); + if (t instanceof NBTTagList l) { + for (int i = 0; i < l.tagCount(); ++i) { + NBTTagCompound tag = l.getCompoundTagAt(i); + NBTTagCompound tagFluidStack = tag.getCompoundTag("fluidStack"); + final IAEFluidStack s = AEApi.instance() + .storage() + .createFluidStack(GT_Utility.loadFluid(tagFluidStack)); + if (s != null) { + s.setStackSize(tag.getLong("size")); + fluidCache.add(s); + } else { + GT_Mod.GT_FML_LOGGER.warn( + "An error occurred while loading contents of ME Output Hatch. This fluid has been voided: " + + tagFluidStack); } } - getProxy().readFromNBT(aNBT); } + getProxy().readFromNBT(aNBT); } public boolean isLastOutputFailed() { @@ -288,7 +282,6 @@ public class GT_MetaTileEntity_Hatch_Output_ME extends GT_MetaTileEntity_Hatch_O @Override public String[] getInfoData() { - if (!GregTech_API.mAE2) return new String[] {}; List<String> ss = new ArrayList<>(); ss.add( "The hatch is " + ((getProxy() != null && getProxy().isActive()) ? EnumChatFormatting.GREEN + "online" diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java index d8d4483cb9..5f3ed20c07 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -342,7 +342,7 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti mInventory[2] = null; } - if (GregTech_API.mAE2) notifyListeners(count - savedCount, stack); + notifyListeners(count - savedCount, stack); if (count != savedCount) getBaseMetaTileEntity().markDirty(); } } @@ -468,14 +468,14 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; + if (GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; return aIndex == 1; } @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, ItemStack aStack) { - if (GregTech_API.mAE2 && GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; + if (GT_Values.disableDigitalChestsExternalAccess && hasActiveMEConnection()) return false; if (aIndex != 0) return false; if ((mInventory[0] != null && !GT_Utility.areStacksEqual(mInventory[0], aStack))) return false; if (mDisableFilter) return true; diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingRound.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingRound.java index a3b0f02d89..d164c60f3f 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingRound.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingRound.java @@ -6,7 +6,6 @@ import static gregtech.api.util.GT_RecipeBuilder.TICKS; import net.minecraft.item.ItemStack; import appeng.core.Api; -import gregtech.GT_Mod; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -46,10 +45,8 @@ public class ProcessingRound implements gregtech.api.interfaces.IOreRecipeRegist new Object[] { "fXh", 'X', OrePrefixes.ingot.get(aMaterial) }); } } - if (GT_Mod.gregtechproxy.mAE2Integration) { - Api.INSTANCE.registries() - .matterCannon() - .registerAmmo(GT_OreDictUnificator.get(OrePrefixes.round, aMaterial, 1L), aMaterial.getMass()); - } + Api.INSTANCE.registries() + .matterCannon() + .registerAmmo(GT_OreDictUnificator.get(OrePrefixes.round, aMaterial, 1L), aMaterial.getMass()); } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java index 84440609e4..62ffb2e84b 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingWire.java @@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack; import appeng.api.config.TunnelType; import appeng.core.Api; -import gregtech.GT_Mod; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -47,13 +46,11 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr @Override public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - if (GT_Mod.gregtechproxy.mAE2Integration) { - if (tt == TunnelType.ME) { - try { - tt = TunnelType.valueOf("GT_POWER"); - } catch (IllegalArgumentException ignored) { - tt = TunnelType.IC2_POWER; - } + if (tt == TunnelType.ME) { + try { + tt = TunnelType.valueOf("GT_POWER"); + } catch (IllegalArgumentException ignored) { + tt = TunnelType.IC2_POWER; } } @@ -223,9 +220,7 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr new Object[] { OrePrefixes.wireGt12.get(aMaterial), OrePrefixes.wireGt04.get(aMaterial) }); } - if (GT_Mod.gregtechproxy.mAE2Integration) { - AE2addNewAttunement(aStack); - } + AE2addNewAttunement(aStack); } } default -> { @@ -479,15 +474,14 @@ public class ProcessingWire implements gregtech.api.interfaces.IOreRecipeRegistr .addTo(sUnboxinatorRecipes); } - if (GT_Mod.gregtechproxy.mAE2Integration - && GT_OreDictUnificator.get(correspondingCable, aMaterial, 1L) != null) { + if (GT_OreDictUnificator.get(correspondingCable, aMaterial, 1L) != null) { AE2AddNetAttunementCable(aStack, correspondingCable, aMaterial); } } // region AE2 compat static { - if (GT_Mod.gregtechproxy.mAE2Integration) setAE2Field(); + setAE2Field(); } private static void setAE2Field() { diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index 5e72c6421c..3d7f5774db 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -1862,36 +1862,32 @@ public class GT_Loader_MetaTileEntities implements Runnable { // TODO CHECK CIRC } private static void registerAE2Hatches() { - if (GregTech_API.mAE2) { - ItemList.Hatch_Output_Bus_ME.set( - new GT_MetaTileEntity_Hatch_OutputBus_ME(OUTPUT_BUS_ME.ID, "hatch.output_bus.me", "Output Bus (ME)") - .getStackForm(1L)); - ItemList.Hatch_Input_Bus_ME.set( - new GT_MetaTileEntity_Hatch_InputBus_ME( - INPUT_BUS_ME.ID, - "hatch.input_bus.me", - "Stocking Input Bus (ME)").getStackForm(1L)); - ItemList.Hatch_Output_ME.set( - new GT_MetaTileEntity_Hatch_Output_ME(OUTPUT_HATCH_ME.ID, "hatch.output.me", "Output Hatch (ME)") - .getStackForm(1L)); - ItemList.Hatch_CraftingInput_Bus_ME.set( - new GT_MetaTileEntity_Hatch_CraftingInput_ME( - CRAFTING_INPUT_ME.ID, - "hatch.crafting_input.me", - "Crafting Input Buffer (ME)", - true).getStackForm(1L)); - ItemList.Hatch_CraftingInput_Bus_ME_ItemOnly.set( - new GT_MetaTileEntity_Hatch_CraftingInput_ME( - CRAFTING_INPUT_ME_BUS.ID, - "hatch.crafting_input.me.item_only", - "Crafting Input Bus (ME)", - false).getStackForm(1L)); - ItemList.Hatch_CraftingInput_Bus_Slave.set( - new GT_MetaTileEntity_Hatch_CraftingInput_Slave( - CRAFTING_INPUT_SLAVE.ID, - "hatch.crafting_input.slave", - "Crafting Input Slave").getStackForm(1L)); - } + ItemList.Hatch_Output_Bus_ME.set( + new GT_MetaTileEntity_Hatch_OutputBus_ME(OUTPUT_BUS_ME.ID, "hatch.output_bus.me", "Output Bus (ME)") + .getStackForm(1L)); + ItemList.Hatch_Input_Bus_ME.set( + new GT_MetaTileEntity_Hatch_InputBus_ME(INPUT_BUS_ME.ID, "hatch.input_bus.me", "Stocking Input Bus (ME)") + .getStackForm(1L)); + ItemList.Hatch_Output_ME.set( + new GT_MetaTileEntity_Hatch_Output_ME(OUTPUT_HATCH_ME.ID, "hatch.output.me", "Output Hatch (ME)") + .getStackForm(1L)); + ItemList.Hatch_CraftingInput_Bus_ME.set( + new GT_MetaTileEntity_Hatch_CraftingInput_ME( + CRAFTING_INPUT_ME.ID, + "hatch.crafting_input.me", + "Crafting Input Buffer (ME)", + true).getStackForm(1L)); + ItemList.Hatch_CraftingInput_Bus_ME_ItemOnly.set( + new GT_MetaTileEntity_Hatch_CraftingInput_ME( + CRAFTING_INPUT_ME_BUS.ID, + "hatch.crafting_input.me.item_only", + "Crafting Input Bus (ME)", + false).getStackForm(1L)); + ItemList.Hatch_CraftingInput_Bus_Slave.set( + new GT_MetaTileEntity_Hatch_CraftingInput_Slave( + CRAFTING_INPUT_SLAVE.ID, + "hatch.crafting_input.slave", + "Crafting Input Slave").getStackForm(1L)); } private static void registerInputBus() { diff --git a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java index e1ac1c7346..730aba52a0 100644 --- a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java +++ b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java @@ -1,7 +1,6 @@ package gregtech.loaders.preload; import static gregtech.GT_Mod.GT_FML_LOGGER; -import static gregtech.api.enums.Mods.AppliedEnergistics2; import static gregtech.api.enums.Mods.Avaritia; import static gregtech.api.enums.Mods.CraftTweaker; import static gregtech.api.enums.Mods.EnderIO; @@ -137,7 +136,6 @@ public class GT_PreLoad { GregTech_API.mTranslocator = Translocator.isModLoaded(); GregTech_API.mTConstruct = TinkerConstruct.isModLoaded(); GregTech_API.mGalacticraft = GalacticraftCore.isModLoaded(); - GregTech_API.mAE2 = AppliedEnergistics2.isModLoaded(); GregTech_API.mHodgepodge = HodgePodge.isModLoaded(); GregTech_API.mAvaritia = Avaritia.isModLoaded(); } @@ -513,8 +511,6 @@ public class GT_PreLoad { .getBoolean(true); GT_Mod.gregtechproxy.mAchievements = tMainConfig.get(GT_Mod.aTextGeneral, "EnableAchievements", true) .getBoolean(true); - GT_Mod.gregtechproxy.mAE2Integration = GregTech_API.sSpecialFile - .get(ConfigCategories.general, "EnableAE2Integration", GregTech_API.mAE2); GT_Mod.gregtechproxy.mNerfedCombs = tMainConfig.get(GT_Mod.aTextGeneral, "NerfCombs", true) .getBoolean(true); GT_Mod.gregtechproxy.mNerfedCrops = tMainConfig.get(GT_Mod.aTextGeneral, "NerfCrops", true) |