From 516d32d8fa8523e74f83160292cb4fccdc32385c Mon Sep 17 00:00:00 2001 From: Allison-Rodrigo <95299389+Nockyx@users.noreply.github.com> Date: Tue, 14 Jan 2025 17:45:19 -0300 Subject: [PATCH 1/3] qft --- .../MTEQuantumForceTransformer.java | 170 ++++-------------- 1 file changed, 35 insertions(+), 135 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java index 3c226c33c73..5fd19818257 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java @@ -63,9 +63,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; -import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.metatileentity.implementations.MTEHatchBulkCatalystHousing; -import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; @@ -96,89 +94,29 @@ public class MTEQuantumForceTransformer extends MTEExtendedPowerMultiBlockBase catalystHounsings = new ArrayList<>(); private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition .builder() .addShape( MAIN_PIECE, new String[][] { // A - 142, B - 234, C - 177, D - 96, E - 224, H - 36, M - 21 - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " ", " BAB ", " BBBBABBBB ", - " BAAAAAAAB ", " BABBABBAB ", " BA AB ", " A A ", " A A ", - " A A " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", - "B B", "A A", "A A", "A A", "A A", - "A A" }, - { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", - " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", - " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", - "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", - " Z~X " }, - { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", - " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", - " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", - "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", - " HHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", - "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " AAEC CEAA ", " A EC CE A ", "AB EC CE BA", "AA D D AA", - "A EC CE A", "A D D A", " EC CE ", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", - " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", - " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", - "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", - " HHHHHHH " }, - { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", - " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", - " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", - "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", - " HHHHH " }, - { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", - " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", - " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", - "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", - " HHH " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", - "B B", "A A", "A A", "A A", "A A", - "A A" }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", - " B B ", " A A ", " A A ", " ", " ", - " " }, - { " ", " ", " ", " ", " ", - " ", " ", " ", " ", " ", - " ", " ", " ", " BAB ", " BBBBABBBB ", - " BBBAAABBB ", " ABBAAABBA ", " A BA AB A ", " A A ", " A A ", - " A A " }, }) + // spotless:off + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " BBBBABBBB ", " BAAAAAAAB ", " BABBABBAB ", " BA AB ", " A A ", " A A ", " A A " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", "B B", "A A", "A A", "A A", "A A", "A A" }, + { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", " H~H " }, + { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", " HHHHH " }, + { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", " HHHHHHH " }, + { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", " D D ", " AAEC CEAA ", " A EC CE A ", "AB EC CE BA", "AA D D AA", "A EC CE A", "A D D A", " EC CE ", " EC CE ", " EC CE ", " HHHHHHH " }, + { " TTTTTTT ", " ECCCCCE ", " EC CE ", " EC CE ", " D D ", " EC CE ", " D D ", " EC CE ", " EC CE ", " EC CE ", " D D ", " BAEC CEAB ", " B EC CE B ", "BB EC CE BB", "BA D D AB", "A EC CE A", "A D D A", "A EC CE A", " EC CE ", " EC CE ", " HHHHHHH " }, + { " TTTTT ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " ECCCE ", " D D ", " ECCCE ", " ECCCE ", " ECCCE ", " D D ", " BAECCCEAB ", " A ECCCE A ", " A ECCCE A ", "BA D D AB", "B ECCCE B", "B D D B", "B ECCCE B", " ECCCE ", " ECCCE ", " HHHHH " }, + { " TTT ", " EEE ", " EEE ", " EEE ", " DDD ", " EEE ", " DDD ", " EEE ", " EEE ", " EEE ", " DDD ", " BAEEEAB ", " AA EEE AA ", " A EEE A ", "BA DDD AB", "B EEE B", "B DDD B", " EEE ", " EEE ", " EEE ", " HHH " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAAAB ", " AA AA ", " AA AA ", "BAA AAB", "B B", "A A", "A A", "A A", "A A", "A A" }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AA AA ", " AA AA ", " BAA AAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " AAABBBAAA ", " BAAAAAAAAAB ", " B B ", " A A ", " A A ", " ", " ", " " }, + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " BAB ", " BBBBABBBB ", " BBBAAABBB ", " ABBAAABBA ", " A BA AB A ", " A A ", " A A ", " A A " }, }) + // spotless:on .addElement( 'A', withChannel( @@ -220,20 +158,6 @@ public class MTEQuantumForceTransformer extends MTEExtendedPowerMultiBlockBase ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'Z', - buildHatchAdder(MTEQuantumForceTransformer.class).hatchClass(MTEHatchInput.class) - .adder(MTEQuantumForceTransformer::addNeptuniumHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) - .addElement( - 'X', - buildHatchAdder(MTEQuantumForceTransformer.class).hatchClass(MTEHatchInput.class) - .adder(MTEQuantumForceTransformer::addFermiumHatch) - .casingIndex(TAE.getIndexFromPage(0, 10)) - .dot(5) - .buildAndChain(onElementPass(x -> ++x.mCasing, ofBlock(ModBlocks.blockCasings2Misc, 12)))) .build(); public MTEQuantumForceTransformer(final int aID, final String aName, final String aNameRegional) { @@ -292,15 +216,15 @@ protected MultiblockTooltipBuilder createTooltip() { .addStructureInfo( EnumChatFormatting.WHITE + "Neptunium Plasma Hatch: " + EnumChatFormatting.GREEN - + "Left" + + "Bottom" + EnumChatFormatting.GRAY - + " side of Controller") + + " Layer") .addStructureInfo( EnumChatFormatting.WHITE + "Fermium Plasma Hatch: " + EnumChatFormatting.DARK_GREEN - + "Right" + + "Bottom" + EnumChatFormatting.GRAY - + " side of Controller") + + " Layer") .toolTipFinisher(GTValues.AuthorBlueWeabo, EnumChatFormatting.GREEN + "Steelux"); return tt; } @@ -487,12 +411,17 @@ protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) { doFermium = false; doNeptunium = false; - if (recipe.mSpecialValue <= getFocusingTier()) { - if (drain(mFermiumHatch, new FluidStack(mFermium, 1), false)) { - doFermium = true; - } - if (drain(mNeptuniumHatch, new FluidStack(mNeptunium, 1), false)) { - doNeptunium = true; + if (recipe.getMetadataOrDefault(GTRecipeConstants.QFT_FOCUS_TIER, 1) <= getFocusingTier()) { + List fluids = getStoredFluids(); + for (FluidStack fluid : fluids) { + if (fluid.getFluid() + .equals(mNeptunium)) { + doNeptunium = true; + } + if (fluid.getFluid() + .equals(mFermium)) { + doFermium = true; + } } } @@ -605,21 +534,18 @@ public boolean onRunningTick(ItemStack aStack) { if (runningTick % 20 == 0) { int amount = (int) (getFocusingTier() * 4 * Math.sqrt(Math.min(mMaxParallel, processingLogic.getCurrentParallels()))); + if (doFermium) { FluidStack fermiumToConsume = new FluidStack(mFermium, amount); - if (!drain(mFermiumHatch, fermiumToConsume, true)) { - doFermium = false; + if (!this.depleteInput(fermiumToConsume)) { stopMachine(ShutDownReasonRegistry.outOfFluid(fermiumToConsume)); - return false; } } if (doNeptunium) { FluidStack neptuniumToConsume = new FluidStack(mNeptunium, amount); - if (!drain(mNeptuniumHatch, neptuniumToConsume, true)) { - doNeptunium = false; + if (!this.depleteInput(neptuniumToConsume)) { stopMachine(ShutDownReasonRegistry.outOfFluid(neptuniumToConsume)); - return false; } } @@ -731,32 +657,6 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f StatCollector.translateToLocal("miscutils.machines.QFTFluidMode") + " " + mFluidMode); } - public boolean addNeptuniumHatch(IGregTechTileEntity aTileEntity, short aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof MTEHatchInput) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((MTEHatchInput) aMetaTileEntity).mRecipeMap = null; - mNeptuniumHatch = (MTEHatchInput) aMetaTileEntity; - return true; - } - return false; - } - - public boolean addFermiumHatch(IGregTechTileEntity aTileEntity, short aBaseCasingIndex) { - if (aTileEntity == null) return false; - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) return false; - if (aMetaTileEntity instanceof MTEHatchInput) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - ((MTEHatchInput) aMetaTileEntity).mRecipeMap = null; - mFermiumHatch = (MTEHatchInput) aMetaTileEntity; - return true; - } - return false; - } - public boolean addCatalystHousingToMachineList(IGregTechTileEntity tileEntity, int baseCasingIndex) { if (tileEntity == null) return false; IMetaTileEntity metaTileEntity = tileEntity.getMetaTileEntity(); From 36ae0582480848e7831c5cdecc91b66eccd60de8 Mon Sep 17 00:00:00 2001 From: Allison-Rodrigo <95299389+Nockyx@users.noreply.github.com> Date: Tue, 14 Jan 2025 20:14:57 -0300 Subject: [PATCH 2/3] Change the Crashing Behaviour --- .../MTEQuantumForceTransformer.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java index 5fd19818257..0b35f40db68 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java @@ -76,7 +76,6 @@ import gregtech.api.util.IGTHatchAdder; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.ParallelHelper; -import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.material.MaterialsElements; @@ -535,17 +534,29 @@ public boolean onRunningTick(ItemStack aStack) { int amount = (int) (getFocusingTier() * 4 * Math.sqrt(Math.min(mMaxParallel, processingLogic.getCurrentParallels()))); - if (doFermium) { - FluidStack fermiumToConsume = new FluidStack(mFermium, amount); - if (!this.depleteInput(fermiumToConsume)) { - stopMachine(ShutDownReasonRegistry.outOfFluid(fermiumToConsume)); - } - } - - if (doNeptunium) { - FluidStack neptuniumToConsume = new FluidStack(mNeptunium, amount); - if (!this.depleteInput(neptuniumToConsume)) { - stopMachine(ShutDownReasonRegistry.outOfFluid(neptuniumToConsume)); + if (doNeptunium || doFermium) { + List fluids = getStoredFluids(); + for (FluidStack fluid : fluids) { + if (doNeptunium) { + FluidStack neptuniumToConsume = new FluidStack(mNeptunium, amount); + if (!this.depleteInput(neptuniumToConsume)) { + this.depleteInput(fluid); + doNeptunium = false; + mOutputItems = null; + mOutputFluids = null; + mProgresstime = mMaxProgresstime; + } + } + if (doFermium) { + FluidStack fermiumToConsume = new FluidStack(mFermium, amount); + if (!this.depleteInput(fermiumToConsume)) { + this.depleteInput(fluid); + doFermium = false; + mOutputItems = null; + mOutputFluids = null; + mProgresstime = mMaxProgresstime; + } + } } } From 42cfb4d4c8de7ffdce4d79198e03013abf019174 Mon Sep 17 00:00:00 2001 From: Allison-Rodrigo <95299389+Nockyx@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:23:13 -0300 Subject: [PATCH 3/3] remove info --- .../multi/production/MTEQuantumForceTransformer.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java index 0b35f40db68..2fafe606294 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/MTEQuantumForceTransformer.java @@ -212,18 +212,6 @@ protected MultiblockTooltipBuilder createTooltip() { + "Bottom" + EnumChatFormatting.GRAY + " Layer") - .addStructureInfo( - EnumChatFormatting.WHITE + "Neptunium Plasma Hatch: " - + EnumChatFormatting.GREEN - + "Bottom" - + EnumChatFormatting.GRAY - + " Layer") - .addStructureInfo( - EnumChatFormatting.WHITE + "Fermium Plasma Hatch: " - + EnumChatFormatting.DARK_GREEN - + "Bottom" - + EnumChatFormatting.GRAY - + " Layer") .toolTipFinisher(GTValues.AuthorBlueWeabo, EnumChatFormatting.GREEN + "Steelux"); return tt; }