diff options
author | Maxim <maxim235@gmx.de> | 2023-02-26 18:26:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-26 18:26:39 +0100 |
commit | 2a5f9fbd9b8a994a081d358681924eee4cb6934c (patch) | |
tree | db4522aa5e7c64a78161aa3f226e76e1ae83e0a1 /src/main/java | |
parent | a185ab1351ff7b35f0624f2a32e78da5283e178a (diff) | |
download | GT5-Unofficial-2a5f9fbd9b8a994a081d358681924eee4cb6934c.tar.gz GT5-Unofficial-2a5f9fbd9b8a994a081d358681924eee4cb6934c.tar.bz2 GT5-Unofficial-2a5f9fbd9b8a994a081d358681924eee4cb6934c.zip |
Implemented enhanced multiblock GUI (#291)
* Implemented enhanced multiblock GUI
* Added override to show that a CAL has been imprinted
* Update dependencies.gradle
* Fix Cubic zirconia recipe (#292) (#293)
Co-authored-by: LewisSaber <39595617+LewisSaber@users.noreply.github.com>
---------
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: LewisSaber <39595617+LewisSaber@users.noreply.github.com>
Former-commit-id: 286ef64ddde387ee10114caf0cf52cdab1ecf22c
Diffstat (limited to 'src/main/java')
5 files changed, 81 insertions, 58 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java index 01cf3bd854..6f2e501995 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_CircuitAssemblyLine.java @@ -39,6 +39,9 @@ import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructa import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; @@ -63,6 +66,8 @@ public class GT_TileEntity_CircuitAssemblyLine extends private static final String STRUCTURE_PIECE_FIRST = "first"; private static final String STRUCTURE_PIECE_NEXT = "next"; + private String imprintedItemName; + private static final IStructureDefinition<GT_TileEntity_CircuitAssemblyLine> STRUCTURE_DEFINITION = StructureDefinition .<GT_TileEntity_CircuitAssemblyLine>builder() .addShape( @@ -167,6 +172,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends @Override public void loadNBTData(NBTTagCompound aNBT) { this.type = aNBT.getCompoundTag("Type"); + imprintedItemName = GT_LanguageManager.getTranslateableItemStackName(ItemStack.loadItemStackFromNBT(this.type)); super.loadNBTData(aNBT); } @@ -198,6 +204,7 @@ public class GT_TileEntity_CircuitAssemblyLine extends } ItemStack stack = ItemStack.loadItemStackFromNBT(this.type); + imprintedItemName = GT_LanguageManager.getTranslateableItemStackName(stack); if (stack == null) return false; @@ -394,4 +401,15 @@ public class GT_TileEntity_CircuitAssemblyLine extends } return -1; } + + @Override + public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { + super.addUIWidgets(builder, buildContext); + builder.widget(new FakeSyncWidget.StringSyncer(() -> imprintedItemName, val -> imprintedItemName = val)); + } + + @Override + protected boolean isRecipeLockingEnabled() { + return imprintedItemName != null && !imprintedItemName.equals(""); + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java index bb00ef8063..084af4fae7 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaBlastFurnace.java @@ -200,13 +200,15 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock super.loadNBTData(aNBT); this.circuitMode = aNBT.getByte("circuitMode"); this.glasTier = aNBT.getByte("glasTier"); - this.isBussesSeparate = aNBT.getBoolean("isBussesSeparate"); - this.mUseMultiparallelMode = aNBT.getBoolean("mUseMultiparallelMode"); + if (!aNBT.hasKey(INPUT_SEPARATION_NBT_KEY)) { + inputSeparation = aNBT.getBoolean("isBussesSeparate"); + } + if (!aNBT.hasKey(BATCH_MODE_NBT_KEY)) { + batchMode = aNBT.getBoolean("mUseMultiparallelMode"); + } } private byte circuitMode = 0; - private boolean isBussesSeparate = false; - private boolean mUseMultiparallelMode = false; @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { @@ -227,18 +229,18 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { - mUseMultiparallelMode = !mUseMultiparallelMode; - if (mUseMultiparallelMode) { + batchMode = !batchMode; + if (batchMode) { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); } else { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff")); } return true; } else { - isBussesSeparate = !isBussesSeparate; + inputSeparation = !inputSeparation; GT_Utility.sendChatToPlayer( aPlayer, - StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + isBussesSeparate); + StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation); return true; } } @@ -264,8 +266,6 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock super.saveNBTData(aNBT); aNBT.setByte("glasTier", glasTier); aNBT.setByte("circuitMode", circuitMode); - aNBT.setBoolean("isBussesSeparate", isBussesSeparate); - aNBT.setBoolean("mUseMultiparallelMode", mUseMultiparallelMode); } @Override @@ -310,7 +310,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock byte tTier = (byte) Math.max(1, Math.min(GT_Utility.getTier(nominalV), V.length - 1)); GT_Recipe tRecipe = null; - if (isBussesSeparate) { + if (inputSeparation) { for (GT_MetaTileEntity_Hatch_InputBus tBus : mInputBusses) { ArrayList<ItemStack> tInputList = new ArrayList<>(); tBus.mRecipeMap = getRecipeMap(); @@ -366,15 +366,13 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock long precutRecipeVoltage = (long) (tRecipe.mEUt * Math.pow(0.95, tHeatCapacityDivTiers)); long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / precutRecipeVoltage); - if (mUseMultiparallelMode && tMaxPara == ConfigHandler.megaMachinesMax) { + if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) { tMaxPara *= 128; } float tBatchMultiplier = 1.0f; if (this.mHeatingCapacity >= tRecipe.mSpecialValue) { int tCurrentPara = handleParallelRecipe(tRecipe, tFluids, tInputs, (int) tMaxPara); - tBatchMultiplier = mUseMultiparallelMode - ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) - : 1.0f; + tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f; this.updateSlots(); if (tCurrentPara <= 0) return false; processed = Math.min(tCurrentPara, ConfigHandler.megaMachinesMax); @@ -401,7 +399,7 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock if (this.lEUt > 0) this.lEUt = (-this.lEUt); - if (mUseMultiparallelMode) { + if (batchMode) { this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier); } @@ -524,4 +522,14 @@ public class GT_TileEntity_MegaBlastFurnace extends GT_TileEntity_MegaMultiBlock public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sBlastRecipes; } + + @Override + protected boolean isInputSeparationButtonEnabled() { + return true; + } + + @Override + protected boolean isBatchModeButtonEnabled() { + return true; + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java index b8dda555e6..5f25c28018 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaChemicalReactor.java @@ -117,26 +117,25 @@ public class GT_TileEntity_MegaChemicalReactor return false; } // TO IMPLEMENT - private boolean mUseMultiparallelMode = false; - @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("mUseMultiparallelMode", mUseMultiparallelMode); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - this.mUseMultiparallelMode = aNBT.getBoolean("mUseMultiparallelMode"); + if (!aNBT.hasKey(BATCH_MODE_NBT_KEY)) { + batchMode = aNBT.getBoolean("mUseMultiparallelMode"); + } } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { - mUseMultiparallelMode = !mUseMultiparallelMode; - if (mUseMultiparallelMode) { + batchMode = !batchMode; + if (batchMode) { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); } else { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff")); @@ -167,14 +166,12 @@ public class GT_TileEntity_MegaChemicalReactor if (tRecipe != null) { found_Recipe = true; long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt); - if (mUseMultiparallelMode && tMaxPara == ConfigHandler.megaMachinesMax) { + if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) { tMaxPara *= 128; } int tCurrentPara = handleParallelRecipe(tRecipe, tInputFluids, tInputs, (int) tMaxPara); - tBatchMultiplier = mUseMultiparallelMode - ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) - : 1.0f; + tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f; this.updateSlots(); if (tCurrentPara <= 0) { @@ -202,7 +199,7 @@ public class GT_TileEntity_MegaChemicalReactor return false; } - if (mUseMultiparallelMode) { + if (batchMode) { this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier); } @@ -306,4 +303,9 @@ public class GT_TileEntity_MegaChemicalReactor if (((GT_MetaTileEntity_TieredMachineBlock) tecTechEnergyMulti).mTier > this.glasTier) return true; return false; } + + @Override + protected boolean isBatchModeButtonEnabled() { + return true; + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java index 2cc880e4b0..a45fd705c4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaDistillTower.java @@ -368,26 +368,20 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock true); } - private boolean mUseMultiparallelMode = false; - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mUseMultiparallelMode", mUseMultiparallelMode); - } - @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - this.mUseMultiparallelMode = aNBT.getBoolean("mUseMultiparallelMode"); + if (!aNBT.hasKey(BATCH_MODE_NBT_KEY)) { + batchMode = aNBT.getBoolean("mUseMultiparallelMode"); + } } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { - mUseMultiparallelMode = !mUseMultiparallelMode; - if (mUseMultiparallelMode) { + batchMode = !batchMode; + if (batchMode) { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); } else { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff")); @@ -438,12 +432,11 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock if (tRecipe != null) { found_Recipe = true; long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt); - if (mUseMultiparallelMode && tMaxPara == ConfigHandler.megaMachinesMax) { + if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) { tMaxPara *= 128; } int tCurrentPara = handleParallelRecipe(tRecipe, new FluidStack[] { tFluid }, null, (int) tMaxPara); - tBatchMultiplier = mUseMultiparallelMode - ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) + tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f; this.updateSlots(); processed = Math.min(tCurrentPara, ConfigHandler.megaMachinesMax); @@ -468,7 +461,7 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock this.lEUt = (-this.lEUt); } - if (mUseMultiparallelMode) { + if (batchMode) { this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier); } @@ -490,4 +483,9 @@ public class GT_TileEntity_MegaDistillTower extends GT_TileEntity_MegaMultiBlock dumpFluid(mOutputHatchesByLayer.get(i), tStack, false); } } + + @Override + protected boolean isBatchModeButtonEnabled() { + return true; + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java index 9ea2d56114..e691ea8f95 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/mega/GT_TileEntity_MegaVacuumFreezer.java @@ -189,26 +189,20 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc return GT_Recipe.GT_Recipe_Map.sVacuumRecipes; } - private boolean mUseMultiparallelMode = false; - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mUseMultiparallelMode", mUseMultiparallelMode); - } - @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - this.mUseMultiparallelMode = aNBT.getBoolean("mUseMultiparallelMode"); + if (!aNBT.hasKey(BATCH_MODE_NBT_KEY)) { + batchMode = aNBT.getBoolean("mUseMultiparallelMode"); + } } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aPlayer.isSneaking()) { - mUseMultiparallelMode = !mUseMultiparallelMode; - if (mUseMultiparallelMode) { + batchMode = !batchMode; + if (batchMode) { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); } else { GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff")); @@ -240,14 +234,12 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc found_Recipe = true; long tMaxPara = Math.min(ConfigHandler.megaMachinesMax, nominalV / tRecipe.mEUt); - if (mUseMultiparallelMode && tMaxPara == ConfigHandler.megaMachinesMax) { + if (batchMode && tMaxPara == ConfigHandler.megaMachinesMax) { tMaxPara *= 128; } int tCurrentPara = handleParallelRecipe(tRecipe, tInputFluids, tInputs, (int) tMaxPara); - tBatchMultiplier = mUseMultiparallelMode - ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) - : 1.0f; + tBatchMultiplier = batchMode ? (float) Math.max(tCurrentPara / ConfigHandler.megaMachinesMax, 1.0f) : 1.0f; this.updateSlots(); if (tCurrentPara <= 0) return false; @@ -273,7 +265,7 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc this.lEUt = (-this.lEUt); } - if (mUseMultiparallelMode) { + if (batchMode) { this.mMaxProgresstime = (int) Math.ceil(this.mMaxProgresstime * tBatchMultiplier); } @@ -326,4 +318,9 @@ public class GT_TileEntity_MegaVacuumFreezer extends GT_TileEntity_MegaMultiBloc } return rTexture; } + + @Override + protected boolean isBatchModeButtonEnabled() { + return true; + } } |