From c8b84bd799863bc1b151fe8c6a98070a587c8cc2 Mon Sep 17 00:00:00 2001 From: Yoshy <60155833+Yoshy2002@users.noreply.github.com> Date: Sat, 4 Jan 2025 16:12:00 +0100 Subject: [PATCH 1/4] Multiblock Tooltip fixes (#3748) Co-authored-by: Martin Robertz --- .../multis/mega/MTEMegaChemicalReactor.java | 8 ++++---- .../multis/mega/MTEMegaOilCracker.java | 5 ++++- .../tileEntity/MTEComponentAssemblyLine.java | 10 +++++++++- .../blocks/tileEntity/MTECoolantTower.java | 4 +++- .../tileEntity/MTEFuelRefineFactory.java | 4 ++++ .../blocks/tileEntity/MTEMultiNqGenerator.java | 4 ++++ .../blocks/tileEntity/MTENeutronActivator.java | 10 +++++----- .../MTEUniversalChemicalFuelEngine.java | 6 ++++++ .../multi/MTEIntegratedOreFactory.java | 12 ++++++------ .../multi/MTETranscendentPlasmaMixer.java | 18 +++++++++++++----- .../machines/multi/MTEWormholeGenerator.java | 1 + .../purification/MTEPurificationPlant.java | 2 +- .../MTEPurificationUnitBaryonicPerfection.java | 2 +- .../MTEPurificationUnitClarifier.java | 2 +- .../MTEPurificationUnitDegasser.java | 2 +- .../MTEPurificationUnitFlocculation.java | 2 +- .../MTEPurificationUnitOzonation.java | 1 + .../MTEPurificationUnitPhAdjustment.java | 2 +- .../MTEPurificationUnitPlasmaHeater.java | 2 +- .../MTEPurificationUnitUVTreatment.java | 2 +- .../advanced/MTEAdvDistillationTower.java | 2 ++ .../mega/MTEMegaAlloyBlastSmelter.java | 5 +++++ .../common/tileentity/MTEDigester.java | 5 +++++ .../common/tileentity/MTEDissolutionTank.java | 4 ++++ .../metaTileEntity/multi/MTEDataBank.java | 4 ++++ 25 files changed, 88 insertions(+), 31 deletions(-) diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java index 14e59081604..71d2c88b691 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java @@ -86,10 +86,10 @@ public MultiblockTooltipBuilder createTooltip() { + " Laser Hatches.") .beginStructureBlock(5, 5, 9, false) .addController("Front center") - .addStructureInfo("46x Chemically Inert Machine Casing (minimum)") - .addStructureInfo("7x Fusion Coil Block") - .addStructureInfo("28x PTFE Pipe Casing") - .addStructureInfo("64x Borosilicate Glass Block (any tier)") + .addCasingInfoMin("Chemically Inert Machine Casing", 46, false) + .addCasingInfoExactly("Fusion Coil Block", 7, false) + .addCasingInfoExactly("PTFE Pipe Casing", 28, false) + .addCasingInfoExactly("Borosilicate Glass", 64, true) .addStructureInfo("The glass tier limits the Energy Input tier") .addEnergyHatch("Hint block ", 3) .addMaintenanceHatch("Hint block ", 2) diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java index 30beb268d07..a9e34e91bb7 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java @@ -169,10 +169,13 @@ public MultiblockTooltipBuilder createTooltip() { + "Tech" + EnumChatFormatting.GRAY + " Laser Hatches.") + .addInfo("Gets 10% EU/t reduction per coil tier, up to a maximum of 50%") .beginStructureBlock(13, 7, 9, true) .addController("Front bottom") + .addCasingInfoExactly("Clean Stainless Steel Machine Casing", 197, false) + .addCasingInfoExactly("Coil", 92, true) + .addCasingInfoExactly("Borosilicate Glass", 196, true) .addStructureInfo("The glass tier limits the Energy Input tier") - .addInfo("Gets 10% EU/t reduction per coil tier, up to a maximum of 50%") .addEnergyHatch("Hint block", 1) .addMaintenanceHatch("Hint block", 1) .addInputHatch("Hint block", 2, 3) diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java index 041e8f4bcff..3755d2b4ad2 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java @@ -234,7 +234,15 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo(EnumChatFormatting.ITALIC + "Much more efficient than other competing brands!") .addTecTechHatchInfo() .beginStructureBlock(9, 10, 33, false) - .addOtherStructurePart("Borosilicate Glass", "Can be UV tier or higher") + .addController("Mid of the eighth layer") + .addCasingInfoExactly("Advanced Iridium Plated Machine Casing", 644, false) + .addCasingInfoExactly("Advanced Filter Casing", 124, false) + .addCasingInfoExactly("Borosilicate Glass (UV+)", 280, false) + .addCasingInfoExactly("Assembler Machine Casing", 30, false) + .addCasingInfoExactly("Component Assembly Line Casing", 43, true) + .addCasingInfoExactly("PBI Pipe Casing", 126, false) + .addCasingInfoExactly("Tungstensteel Frame Box", 4, false) + .addCasingInfoExactly("Assembly Line Casing", 55, false) .addInputBus("Start of conveyor belt", 1) .addOutputBus("End of conveyor belt", 2) .addEnergyHatch("Second-top layer", 3) diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java b/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java index 82747e895dd..68ece26daa9 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTECoolantTower.java @@ -107,7 +107,9 @@ protected MultiblockTooltipBuilder createTooltip() { final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); tt.addMachineType("Coolant Tower") .addInfo("Turn Steam back to Distilled Water.") - .addController("Mid of the second layer.") + .addController("Mid of the second layer") + .addCasingInfoExactly("Light Concrete", 277, false) + .addCasingInfoExactly("Tungstencarbide Frame Box", 28, false) .addInputHatch("Input Hatch", 1) .addOutputHatch("Output Hatch", 1) .toolTipFinisher(); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java index 6b4e4f42829..f675e5e455a 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java @@ -165,6 +165,10 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("Performs perfect overclocks.") .addTecTechHatchInfo() .beginStructureBlock(3, 15, 15, false) + .addController("Mid of the third layer") + .addCasingInfoExactly("Naquadah Fuel Refinery Casing", 114, false) + .addCasingInfoExactly("Field Restriction Coil", 32, true) + .addCasingInfoExactly("Field Restriction Glass", 8, false) .addInputHatch("The casings adjacent to field restriction glass.") .addInputBus("The casings adjacent to field restriction glass.", 1) .addOutputHatch("The casings adjacent to field restriction glass.", 1) diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java index 277a85e3937..0d41722d0a5 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEMultiNqGenerator.java @@ -426,6 +426,10 @@ protected MultiblockTooltipBuilder createTooltip() { .addTecTechHatchInfo() .beginStructureBlock(7, 8, 7, true) .addController("Front bottom") + .addCasingInfoExactly("Field Restriction Casing", 48, false) + .addCasingInfoExactly("Radiation Proof Steel Frame Box", 36, false) + .addCasingInfoExactly("Tungstensteel Pipe Casing", 6, false) + .addCasingInfoExactly("Radiation Proof Machine Casing", 121, false) .addDynamoHatch("Any bottom layer casing, only accept ONE!") .addInputHatch("Any bottom layer casing") .addOutputHatch("Any bottom layer casing") diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java b/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java index 2058188445b..0d77b5cd555 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTENeutronActivator.java @@ -192,6 +192,11 @@ protected MultiblockTooltipBuilder createTooltip() { + ".") .addInfo("Inputting Graphite/Beryllium dust can reduce 10MeV per dust immediately.") .addController("Front bottom") + .addCasingInfoRange("Clean Stainless Steel Machine Casing", 7, 31, false) + .addCasingInfoExactly("Processor Machine Casing", 18, false) + .addCasingInfoMin("Steel Frame Box", 16, false) + .addCasingInfoMin("Speeding Pipe Casing", 4, false) + .addCasingInfoMin("EV+ Glass", 32, false) .addInputHatch("Hint block with dot 1") .addInputBus("Hint block with dot 1") .addOutputHatch("Hint block with dot 2") @@ -199,11 +204,6 @@ protected MultiblockTooltipBuilder createTooltip() { .addMaintenanceHatch("Hint block with dot 2") .addOtherStructurePart("Neutron Accelerator", "Hint block with dot 2") .addOtherStructurePart("Neutron Sensor", "Hint block with dot 2") - .addCasingInfoRange("Clean Stainless Steel Machine Casing", 7, 31, false) - .addCasingInfoExactly("Processor Machine Casing", 18, false) - .addCasingInfoMin("Steel Frame Box", 16, false) - .addCasingInfoMin("Speeding Pipe Casing", 4, false) - .addCasingInfoMin("EV+ Glass", 32, false) .toolTipFinisher(); return tt; } diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java index e39aa2e69ef..b64b2356ddf 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java @@ -200,6 +200,12 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("The efficiency is up to 150%.") .addTecTechHatchInfo() .beginStructureBlock(5, 4, 9, false) + .addController("Mid of the second layer") + .addCasingInfoExactly("Stable Titanium Machine Casing", 93, false) + .addCasingInfoExactly("Titanium Gear Box Casing", 14, false) + .addCasingInfoExactly("Engine Intake Casing", 14, false) + .addCasingInfoExactly("Titanium Plated Cylinder", 14, false) + .addCasingInfoExactly("Titanium Pipe Casing", 93, false) .addMaintenanceHatch("Hint block with dot 1") .addMufflerHatch("Hint block with dot 2 (fill all slots with mufflers)") .addInputHatch("Hint block with dot 3 (fill all slots with input hatches)") diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java index 40a960fb7dd..5fdc88cf88c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIntegratedOreFactory.java @@ -197,12 +197,12 @@ protected MultiblockTooltipBuilder createTooltip() { .addPollutionAmount(getPollutionPerSecond(null)) .beginStructureBlock(6, 12, 11, false) .addController("The third layer") - .addStructureInfo("128 Advanced Iridium Plated Machine Casing") - .addStructureInfo("105 Clean Stainless Steel Machine Casing") - .addStructureInfo("48 Reinforced Glass") - .addStructureInfo("30 Tungstensteel Pipe Casing") - .addStructureInfo("16 Tungstensteel Frame Box") - .addStructureInfo("16 Steel Gear Box Casing") + .addCasingInfoExactly("Advanced Iridium Plated Machine Casing", 128, false) + .addCasingInfoExactly("Clean Stainless Steel Machine Casing", 105, false) + .addCasingInfoExactly("Reinforced Glass", 48, false) + .addCasingInfoExactly("Tungstensteel Pipe Casing", 30, false) + .addCasingInfoExactly("Tungstensteel Frame Box", 16, false) + .addCasingInfoExactly("Steel Gear Box Casing", 16, false) .addEnergyHatch("Any bottom Casing", 1) .addMaintenanceHatch("Any bottom Casing", 1) .addInputBus("Input ore/crushed ore", 2) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTETranscendentPlasmaMixer.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTETranscendentPlasmaMixer.java index daaf772ae54..52186e1d7d3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTETranscendentPlasmaMixer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTETranscendentPlasmaMixer.java @@ -20,8 +20,6 @@ import static gregtech.common.tileentities.machines.multi.MTEPlasmaForge.DIM_INJECTION_CASING; import static gregtech.common.tileentities.machines.multi.MTEPlasmaForge.DIM_TRANS_CASING; import static kekztech.util.Util.toStandardForm; -import static net.minecraft.util.EnumChatFormatting.GOLD; -import static net.minecraft.util.EnumChatFormatting.GRAY; import static net.minecraft.util.StatCollector.translateToLocal; import java.math.BigInteger; @@ -123,9 +121,19 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("in the parallel menu. All inputs will scale, except time.") .addInfo("All EU is deducted from wireless EU networks only.") .beginStructureBlock(5, 7, 5, false) - .addStructureInfo(GOLD + "1+ " + GRAY + "Input Hatch") - .addStructureInfo(GOLD + "1+ " + GRAY + "Output Hatch") - .addStructureInfo(GOLD + "1+ " + GRAY + "Input Bus") + .addController("Front Center") + .addCasingInfoExactly("Dimensionally Transcendent Casing", 48, false) + .addCasingInfoExactly("Dimensional Bridge", 16, false) + .addCasingInfoRangeColored( + "Dimensional Injection Casing", + EnumChatFormatting.GRAY, + 0, + 33, + EnumChatFormatting.GOLD, + false) + .addInputBus("Any Dimensional Injection Casing", 1) + .addInputHatch("Any Dimensional Injection Casing", 1) + .addOutputHatch("Any Dimensional Injection Casing", 1) .toolTipFinisher(AuthorColen); return tt; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java index 022dd14d2d0..7b20dc9f77c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEWormholeGenerator.java @@ -1001,6 +1001,7 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("Right click the controller with a screwdriver to disable overclocking.") .addTecTechHatchInfo() .beginStructureBlock(7, 9, 7, false) + .addController("Front center") .addCasingInfoExactly("Molecular Casing", 2 * 12, false) .addCasingInfoExactly("Europium Reinforced Radiation Proof Machine Casing", 4, false) .addCasingInfoExactly("Fusion Coil Block", 3 * 4 + 5 * 2, false) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java index b5385ff5a10..c271f4a8d88 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationPlant.java @@ -241,6 +241,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "purification processes, and this multiblock is the heart of the operation.") .beginStructureBlock(7, 9, 8, false) + .addController("Front center") .addCasingInfoExactlyColored( "Superplasticizer-Treated High Strength Concrete", EnumChatFormatting.GRAY, @@ -272,7 +273,6 @@ protected MultiblockTooltipBuilder createTooltip() { 6, EnumChatFormatting.GOLD, false) - .addController("Front center") .addEnergyHatch(EnumChatFormatting.GOLD + "1", 1) .addMaintenanceHatch(EnumChatFormatting.GOLD + "1", 1) .addStructureInfo("Requires water to be placed in the tank.") diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBaryonicPerfection.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBaryonicPerfection.java index b510b4a3414..d6a3621d33e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBaryonicPerfection.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitBaryonicPerfection.java @@ -354,6 +354,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "This ultimately creates both Stabilised Baryonic Matter and, most importantly, absolutely perfectly purified water.") .beginStructureBlock(17, 17, 17, false) + .addController("Front center") .addCasingInfoMinColored( "Quark Exclusion Casing", EnumChatFormatting.GRAY, @@ -384,7 +385,6 @@ protected MultiblockTooltipBuilder createTooltip() { 108, EnumChatFormatting.GOLD, false) - .addController("Front Center") .addInputBus("Any Quark Exclusion Casing. Stocking bus is blacklisted.", 1) .addInputHatch("Any Quark Exclusion Casing", 1) .addOutputBus("Any Quark Exclusion Casing", 1) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitClarifier.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitClarifier.java index bfb3f497fd5..2a237ad1652 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitClarifier.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitClarifier.java @@ -206,6 +206,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "decreases so continual replacements must be supplied to maintain full function of the Clarifier.") .beginStructureBlock(11, 4, 11, false) + .addController("Front center") .addCasingInfoRangeColored( "Reinforced Sterile Water Plant Casing", EnumChatFormatting.GRAY, @@ -232,7 +233,6 @@ protected MultiblockTooltipBuilder createTooltip() { EnumChatFormatting.GOLD, false) .addCasingInfoExactlyColored("PTFE Pipe Casing", EnumChatFormatting.GRAY, 3, EnumChatFormatting.GOLD, false) - .addController("Front center") .addInputBus(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) .addOutputBus(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) .addInputHatch(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java index bf503ed6a34..5227f17d172 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java @@ -460,6 +460,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "detects in the water, it will request various materials to complete the processes listed above.") .beginStructureBlock(17, 25, 17, false) + .addController("Front center") .addCasingInfoRangeColored( "Heat-Resistant Trinium Plated Casing", EnumChatFormatting.GRAY, @@ -479,7 +480,6 @@ protected MultiblockTooltipBuilder createTooltip() { 124, EnumChatFormatting.GOLD, false) - .addController("Front center") .addOutputHatch(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+, Any Trinium Casing", 1) .addInputHatch(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+, Any Trinium Casing", 1) .addOtherStructurePart( diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitFlocculation.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitFlocculation.java index 2f5974880a6..32a7c5a1756 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitFlocculation.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitFlocculation.java @@ -320,6 +320,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "of aggregating dispersed suspended particles from a solution into larger clumps for further filtration.") .beginStructureBlock(7, 4, 7, false) + .addController("Front center") .addCasingInfoRangeColored( "Slick Sterile Flocculation Casing", EnumChatFormatting.GRAY, @@ -357,7 +358,6 @@ protected MultiblockTooltipBuilder createTooltip() { 9, EnumChatFormatting.GOLD, false) - .addController("Front center") .addOutputBus(EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "+", 1) .addInputHatch( EnumChatFormatting.GOLD + "1" + EnumChatFormatting.GRAY + "-" + EnumChatFormatting.GOLD + "2", diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitOzonation.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitOzonation.java index 9ceb4f89581..1f26cd4c5fc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitOzonation.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitOzonation.java @@ -213,6 +213,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "sulfur, iron and manganese, creating insoluble oxide compounds which are then filtered out.") .beginStructureBlock(9, 10, 5, false) + .addController("Front center") .addCasingInfoRangeColored( "Inert Filtration Casing", EnumChatFormatting.GRAY, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPhAdjustment.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPhAdjustment.java index 169266b8284..6fcc7258026 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPhAdjustment.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPhAdjustment.java @@ -405,6 +405,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "materials. This necessitates the use of the corresponding neutralizing agents to pH balance the water.") .beginStructureBlock(7, 4, 7, false) + .addController("Front center") .addCasingInfoExactlyColored( "Stabilized Naquadah Water Plant Casing", EnumChatFormatting.GRAY, @@ -429,7 +430,6 @@ protected MultiblockTooltipBuilder createTooltip() { 67 * 2, EnumChatFormatting.GOLD, false) - .addController("Front center") .addOtherStructurePart("Input Hatch (Water)", EnumChatFormatting.GOLD + "1+", 1) .addOtherStructurePart("Output Hatch", EnumChatFormatting.GOLD + "1", 1) .addOtherStructurePart("pH Sensor Hatch", EnumChatFormatting.GOLD + "2", 2) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java index b8a45b810af..68d3f3bd865 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitPlasmaHeater.java @@ -363,6 +363,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "supercritical while evaporating any remaining contaminants, ready for filtration.") .beginStructureBlock(23, 15, 15, false) + .addController("Front center") .addCasingInfoExactlyColored( "Reinforced Sterile Water Plant Casing", EnumChatFormatting.GRAY, @@ -394,7 +395,6 @@ protected MultiblockTooltipBuilder createTooltip() { 9, EnumChatFormatting.GOLD, false) - .addController("Front center") .addOtherStructurePart("Input Hatch (Water)", EnumChatFormatting.GOLD + "1+", 1) .addOtherStructurePart("Output Hatch", EnumChatFormatting.GOLD + "1", 1) .addOtherStructurePart("Input Hatch (Coolant)", EnumChatFormatting.GOLD + "1", 2) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitUVTreatment.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitUVTreatment.java index 28c5c82c91a..25a31e90d7b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitUVTreatment.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitUVTreatment.java @@ -272,6 +272,7 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.ITALIC + "atoms themselves and pass through the walls of the tank, ensuring the water is perfectly electrically polar.") .beginStructureBlock(13, 9, 9, true) + .addController("Front center") .addCasingInfoRangeColored( "Naquadria-Reinforced Water Plant Casing", EnumChatFormatting.GRAY, @@ -297,7 +298,6 @@ protected MultiblockTooltipBuilder createTooltip() { 56, EnumChatFormatting.GOLD, false) - .addController("Front center") .addOtherStructurePart("Input Hatch, Output Hatch", EnumChatFormatting.GOLD + "1+", 1) .addOtherStructurePart("Lens Housing", EnumChatFormatting.GOLD + "1", 2) .addOtherStructurePart("Lens Indicator", EnumChatFormatting.GOLD + "1", 3) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java index 2adf1d1dd72..3719d02bd17 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvDistillationTower.java @@ -183,6 +183,8 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("Distillery Mode: Tower Tier * (4*InputTier)") .addInfo("Distillery Mode require a full height tower") .addPollutionAmount(getPollutionPerSecond(null)) + .beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true) + .addController("Front bottom") .addCasingInfoMin("Clean Stainless Steel Machine Casing", 7, false) .addInputBus("Bottom Casing", 1) .addOutputBus("Bottom Casing", 1) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java index 0d57fb78a95..9b0b2dac92f 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java @@ -306,6 +306,11 @@ protected MultiblockTooltipBuilder createTooltip() { + EnumChatFormatting.GRAY) .addPollutionAmount(getPollutionPerSecond(null)) .beginStructureBlock(11, 20, 11, false) + .addController("Mid of the fourth layer") + .addCasingInfoExactly("Blast Smelter Casing Block", 218, false) + .addCasingInfoExactly("Blast Smelter Heat Containment Coil", 56, false) + .addCasingInfoExactly("Coil", 360, true) + .addCasingInfoExactly("Borosilicate Glass", 339, true) .addMaintenanceHatch("Around the controller", 2) .addOtherStructurePart("Input Bus, Output Bus, Input Hatch, Output Bus, Energy Hatch", "Bottom Casing", 1) .addMufflerHatch("1 in the center of the top layer", 3) diff --git a/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java b/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java index e8d673debe0..fce9adffcf2 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java @@ -209,7 +209,12 @@ protected MultiblockTooltipBuilder createTooltip() { .addInfo("Input ores and fluid, output water.") .addInfo("Performs perfect overclocks") .addPollutionAmount(getPollutionPerSecond(null)) + .beginStructureBlock(7, 7, 4, true) .addController("Front bottom") + .addCasingInfoExactly("Robust Tungstensteel Machine Casing", 52, false) + .addCasingInfoExactly("Heat Proof Machine Casing", 16, false) + .addCasingInfoExactly("Clean Stainless Steel Machine Casing", 9, false) + .addCasingInfoExactly("Coil", 16, true) .addInputHatch("Hint block with dot 1") .addInputBus("Hint block with dot 1") .addOutputHatch("Hint block with dot 1") diff --git a/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java b/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java index 59b76c502ba..d6964edcf33 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java @@ -239,7 +239,11 @@ protected MultiblockTooltipBuilder createTooltip() { tt.addMachineType("Dissolution Tank") .addInfo("Input Water and Fluid, output Fluid") .addInfo("You must input the Fluids at the correct Ratio") + .beginStructureBlock(5, 5, 5, true) .addController("Front bottom") + .addCasingInfoExactly("Clean Stainless Steel Machine Casing", 42, false) + .addCasingInfoExactly("Titanium Reinforced Borosilicate Glass", 24, false) + .addCasingInfoExactly("Heat Proof Machine Casing", 9, false) .addInputHatch("Hint block with dot 1") .addInputBus("Hint block with dot 1") .addOutputHatch("Hint block with dot 1") diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/MTEDataBank.java b/src/main/java/tectech/thing/metaTileEntity/multi/MTEDataBank.java index 87c77e4afbe..a53d8271c71 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/MTEDataBank.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/MTEDataBank.java @@ -132,6 +132,10 @@ public MultiblockTooltipBuilder createTooltip() { // wireless mode .addTecTechHatchInfo() .beginStructureBlock(5, 3, 3, false) + .addController("Front center") + .addCasingInfoExactly("Computer Heat Vent", 18, false) + .addCasingInfoExactly("High Power Casing", 7, false) + .addCasingInfoMin("Computer Casing", 3, false) .addOtherStructurePart( translateToLocal("tt.keyword.Structure.DataAccessHatch"), translateToLocal("tt.keyword.Structure.AnyComputerCasing"), From 8107f169856467a3455d8a26605f308a29cc4648 Mon Sep 17 00:00:00 2001 From: Maya <10861407+serenibyss@users.noreply.github.com> Date: Sat, 4 Jan 2025 08:53:44 -0700 Subject: [PATCH 2/4] Clean up some deprecation usages (#3698) Co-authored-by: Martin Robertz Co-authored-by: PureBluez Co-authored-by: Crystie <50521339+CrystieColon3@users.noreply.github.com> --- .../common/tileentities/multis/MTEBioVat.java | 2 +- .../multis/MTECircuitAssemblyLine.java | 5 +- .../MTEElectricImplosionCompressor.java | 39 +++-- .../multis/MTEHighTempGasCooledReactor.java | 24 ++-- .../common/tileentities/multis/MTELESU.java | 13 +- .../tileentities/multis/MTEManualTrafo.java | 50 +++---- .../multis/MTEThoriumHighTempReactor.java | 134 +++++++++--------- .../tileentities/multis/MTEWindmill.java | 40 +++--- .../multis/mega/MTEMegaBlastFurnace.java | 9 +- .../multis/mega/MTEMegaChemicalReactor.java | 10 +- .../multis/mega/MTEMegaDistillTower.java | 16 +-- .../multis/mega/MTEMegaOilCracker.java | 10 +- src/main/java/ggfab/mte/MTEAdvAssLine.java | 7 +- .../tileEntity/MTEComponentAssemblyLine.java | 2 +- .../tileEntity/MTEFuelRefineFactory.java | 51 +------ .../tileEntity/MTELargeEssentiaSmeltery.java | 55 ++----- .../MTEUniversalChemicalFuelEngine.java | 43 +----- .../MTEEnhancedMultiBlockBase.java | 4 +- .../machines/multi/MTEDrillerBase.java | 4 +- ...MTEIndustrialElectromagneticSeparator.java | 2 +- .../multi/MTELargeChemicalReactor.java | 2 +- .../multi/MTELargeFluidExtractor.java | 2 +- .../machines/multi/MTEResearchCompleter.java | 15 +- .../base/GTPPMultiBlockBase.java | 6 +- .../mega/MTEMegaAlloyBlastSmelter.java | 2 +- .../gtnhlanth/common/tileentity/MTELINAC.java | 36 ++--- .../common/tileentity/MTESourceChamber.java | 26 ++-- .../common/tileentity/MTESynchrotron.java | 44 +++--- .../common/tileentity/MTETargetChamber.java | 27 ++-- .../MTELapotronicSuperCapacitor.java | 17 ++- .../common/tileentities/MTETankTFFT.java | 14 +- .../multiblock/MTEExtremeEntityCrusher.java | 4 +- .../metaTileEntity/multi/MTEMicrowave.java | 59 ++++---- .../multi/base/TTMultiblockBase.java | 2 +- .../resources/assets/gregtech/lang/en_US.lang | 1 + 35 files changed, 324 insertions(+), 453 deletions(-) diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java index e61650e4923..f65b9d61bfc 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java @@ -818,7 +818,7 @@ public boolean supportsBatchMode() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (aPlayer.isSneaking()) { batchMode = !batchMode; if (batchMode) { diff --git a/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java b/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java index 17aade3cf28..744e0c0f68c 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTECircuitAssemblyLine.java @@ -588,14 +588,13 @@ protected boolean supportsSlotAutomation(int aSlot) { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (!aPlayer.isSneaking()) { if (mode == 0) return false; inputSeparation = !inputSeparation; GTUtility.sendChatToPlayer( aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + inputSeparation); - return true; } else { batchMode = !batchMode; if (batchMode) { @@ -603,8 +602,8 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench } else { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOff")); } - return true; } + return true; } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java b/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java index 4eb7e37edc5..dd74cfc8364 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEElectricImplosionCompressor.java @@ -50,6 +50,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.NotNull; +import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -89,6 +90,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; +import gregtech.api.util.shutdown.ShutDownReason; public class MTEElectricImplosionCompressor extends MTEExtendedPowerMultiBlockBase implements ISurvivalConstructable { @@ -198,21 +200,15 @@ public PlaceResult survivalPlaceBlock(MTEElectricImplosionCompressor t, World wo .build(); public static List> getAllBlockTiers() { - return new ArrayList<>() { - - private static final long serialVersionUID = 8171991663102417651L; - - { - this.add(Pair.of(GregTechAPI.sBlockMetal5, 2)); - if (Mods.Avaritia.isModLoaded()) { - this.add(Pair.of(LudicrousBlocks.resource_block, 1)); - } - this.add(Pair.of(GregTechAPI.sBlockMetal9, 4)); - this.add(Pair.of(GregTechAPI.sBlockMetal9, 3)); - this.add(Pair.of(GregTechAPI.sBlockMetal9, 8)); - } - - }; + ImmutableList.Builder> b = new ImmutableList.Builder<>(); + b.add(Pair.of(GregTechAPI.sBlockMetal5, 2)); + if (Mods.Avaritia.isModLoaded()) { + b.add(Pair.of(LudicrousBlocks.resource_block, 1)); + } + b.add(Pair.of(GregTechAPI.sBlockMetal9, 4)); + b.add(Pair.of(GregTechAPI.sBlockMetal9, 3)); + b.add(Pair.of(GregTechAPI.sBlockMetal9, 8)); + return b.build(); } public static ITierConverter tieredBlockConverter() { @@ -374,9 +370,9 @@ public boolean isCorrectMachinePart(ItemStack itemStack) { } @Override - public void stopMachine() { + public void stopMachine(@NotNull ShutDownReason reason) { this.resetPiston(this.mBlockTier); - super.stopMachine(); + super.stopMachine(reason); } private void resetPiston(int tier) { @@ -427,13 +423,12 @@ private void animatePiston(IGregTechTileEntity aBaseMetaTileEntity) { aBaseMetaTileEntity.getWorld(), this.chunkCoordinates.get(2).posX, this.chunkCoordinates.get(2).posY, - this.chunkCoordinates.get(2).posZ, - 10); + this.chunkCoordinates.get(2).posZ); } @SideOnly(Side.CLIENT) - private void spawnVisualPistonBlocks(World world, int x, int y, int z, int age) { - EICPistonVisualizer pistonVisualizer = new EICPistonVisualizer(world, x, y, z, age); + private void spawnVisualPistonBlocks(World world, int x, int y, int z) { + EICPistonVisualizer pistonVisualizer = new EICPistonVisualizer(world, x, y, z, 10); Minecraft.getMinecraft().effectRenderer.addEffect(pistonVisualizer); } @@ -536,7 +531,7 @@ public boolean supportsBatchMode() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (aPlayer.isSneaking()) { batchMode = !batchMode; if (batchMode) { diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEHighTempGasCooledReactor.java b/src/main/java/bartworks/common/tileentities/multis/MTEHighTempGasCooledReactor.java index 7261876bfbf..8f1fef97e4a 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEHighTempGasCooledReactor.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEHighTempGasCooledReactor.java @@ -30,6 +30,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; @@ -51,10 +53,14 @@ import gregtech.api.metatileentity.implementations.MTEHatchInput; import gregtech.api.metatileentity.implementations.MTEHatchOutputBus; import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTLanguageManager; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReasonRegistry; +import gregtech.api.util.shutdown.SimpleShutDownReason; public class MTEHighTempGasCooledReactor extends MTEEnhancedMultiBlockBase { @@ -257,23 +263,23 @@ protected boolean filtersFluid() { } @Override - public boolean checkRecipe(ItemStack controllerStack) { + public @NotNull CheckRecipeResult checkProcessing() { if (this.empty) { if (this.HeliumSupply > 0 || this.fuelsupply > 0) { this.mEfficiency = 10000; this.mMaxProgresstime = 100; - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } if (this.HeliumSupply < MTEHighTempGasCooledReactor.HELIUM_NEEDED || this.fuelsupply < mincapacity) - return false; + return CheckRecipeResultRegistry.NO_RECIPE; double eff = Math.min(Math.pow((double) this.fuelsupply / (double) mincapacity, 2D), 100D) / 100D - (this.getIdealStatus() - this.getRepairStatus()) / 10D; - if (eff <= 0) return false; + if (eff <= 0) return CheckRecipeResultRegistry.NO_RECIPE; int toReduce = MathUtils.floorInt(this.fuelsupply * 0.025D * eff); @@ -285,7 +291,7 @@ public boolean checkRecipe(ItemStack controllerStack) { ItemStack[] toOutput = { new ItemStack(HTGRMaterials.aHTGR_Materials, burnedballs, meta), new ItemStack(HTGRMaterials.aHTGR_Materials, toReduce, meta + 1) }; - if (!this.canOutputAll(toOutput)) return false; + if (!this.canOutputAll(toOutput)) return CheckRecipeResultRegistry.NO_RECIPE; this.fuelsupply -= originalToReduce; this.mOutputItems = toOutput; @@ -298,7 +304,7 @@ public boolean checkRecipe(ItemStack controllerStack) { this.mEfficiencyIncrease = 0; this.mEUt = -powerUsage; this.mMaxProgresstime = (int) (72000 * (1d - eff / 2d)); - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } private int runningtick = 0; @@ -344,7 +350,7 @@ public boolean onRunningTick(ItemStack aStack) { } // USE DA POWAH if (!this.drainEnergyInput(-this.mEUt)) { - this.criticalStopMachine(); + this.stopMachine(ShutDownReasonRegistry.POWER_LOSS); return false; } @@ -366,7 +372,7 @@ public boolean onRunningTick(ItemStack aStack) { this.updateSlots(); - if (takecoolant > 0) this.stopMachine(); + if (takecoolant > 0) this.stopMachine(SimpleShutDownReason.ofNormal("no_coolant")); } return true; diff --git a/src/main/java/bartworks/common/tileentities/multis/MTELESU.java b/src/main/java/bartworks/common/tileentities/multis/MTELESU.java index 4d91348abb3..0320ecfcd0f 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTELESU.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTELESU.java @@ -28,6 +28,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizons.modularui.api.NumberFormatMUI; import com.gtnewhorizons.modularui.api.drawable.Text; import com.gtnewhorizons.modularui.api.forge.ItemStackHandler; @@ -59,6 +61,8 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEMultiBlockBase; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; @@ -140,11 +144,6 @@ public long maxEUOutput() { return Math.min(Math.max(this.mStorage / Configuration.multiblocks.energyPerCell, 1L), 32768L); } - @Override - public int rechargerSlotStartIndex() { - return 0; - } - @Override public int rechargerSlotCount() { return 1; @@ -312,8 +311,8 @@ public boolean isCorrectMachinePart(ItemStack itemStack) { } @Override - public boolean checkRecipe(ItemStack itemStack) { - return true; + public @NotNull CheckRecipeResult checkProcessing() { + return CheckRecipeResultRegistry.SUCCESSFUL; } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEManualTrafo.java b/src/main/java/bartworks/common/tileentities/multis/MTEManualTrafo.java index 69fe99e45fb..2c9a22dd9b6 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEManualTrafo.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEManualTrafo.java @@ -17,7 +17,6 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; -import static gregtech.api.enums.GTValues.V; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW; @@ -31,6 +30,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElementNoPlacement; @@ -45,9 +46,12 @@ import gregtech.api.metatileentity.implementations.MTEHatchDynamo; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTETieredMachineBlock; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReasonRegistry; public class MTEManualTrafo extends MTEEnhancedMultiBlockBase { @@ -158,7 +162,7 @@ public boolean isCorrectMachinePart(ItemStack itemStack) { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (!this.getBaseMetaTileEntity() - .isAllowedToWork()) this.stopMachine(); + .isAllowedToWork()) this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE); super.onPostTick(aBaseMetaTileEntity, aTick); } @@ -166,7 +170,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { public boolean onRunningTick(ItemStack aStack) { if (!this.getBaseMetaTileEntity() .isAllowedToWork()) { - this.stopMachine(); + this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE); return false; } @@ -185,25 +189,6 @@ public boolean onRunningTick(ItemStack aStack) { this.getInputTier() * 2 * this.mEnergyHatches.size() * this.mEfficiency / this.getMaxEfficiency(null)); } - public boolean onRunningTickTabbedMode() { - boolean ret = false; - for (MTEHatchDynamo E : this.mDynamoHatches) { - for (MTEHatchEnergy I : this.mEnergyHatches) { - - long vtt = I.getEUVar() >= V[E.mTier] / 2 && E.getEUVar() < E.maxEUStore() ? I.getEUVar() : 0; - - if (vtt == 0) continue; - - long vtp = E.getEUVar() + vtt; - long avt = Math.min(vtp, E.maxEUStore()); - E.setEUVar(avt); - I.setEUVar(I.getEUVar() - vtt); - ret = true; - } - } - return ret; - } - @Override public long getInputTier() { if (!this.mEnergyHatches.isEmpty()) return GTUtility.getTier( @@ -223,13 +208,15 @@ public long getOutputTier() { } @Override - public boolean checkRecipe(ItemStack itemStack) { + public @NotNull CheckRecipeResult checkProcessing() { if (!this.getBaseMetaTileEntity() .isAllowedToWork()) { - this.stopMachine(); - return false; + this.stopMachine(ShutDownReasonRegistry.CRITICAL_NONE); + return CheckRecipeResultRegistry.NONE; } + + ItemStack itemStack = getControllerSlot(); if (itemStack == null || !itemStack.getUnlocalizedName() .startsWith("gt.integrated_circuit")) this.mode = 0; else this.mode = (byte) Math.min(3, itemStack.getItemDamage()); @@ -237,8 +224,17 @@ public boolean checkRecipe(ItemStack itemStack) { this.mProgresstime = 0; this.mMaxProgresstime = 1; this.mEfficiency = Math.max(this.mEfficiency, 100); - return this.upstep ? this.getOutputTier() - this.getInputTier() == this.mTiers - : this.getInputTier() - this.getOutputTier() == this.mTiers; + + if (this.upstep) { + if (this.getOutputTier() - this.getInputTier() == this.mTiers) { + return CheckRecipeResultRegistry.SUCCESSFUL; + } + } else { + if (this.getInputTier() - this.getOutputTier() == this.mTiers) { + return CheckRecipeResultRegistry.SUCCESSFUL; + } + } + return CheckRecipeResultRegistry.NO_RECIPE; } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEThoriumHighTempReactor.java b/src/main/java/bartworks/common/tileentities/multis/MTEThoriumHighTempReactor.java index 21ed72cf4cf..75f1b3f7f3a 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEThoriumHighTempReactor.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEThoriumHighTempReactor.java @@ -27,6 +27,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; @@ -43,6 +45,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; import gregtech.api.metatileentity.implementations.MTEHatchInput; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; @@ -50,6 +54,16 @@ public class MTEThoriumHighTempReactor extends MTEEnhancedMultiBlockBase { private static final int BASECASINGINDEX = 44; + private int mCasingAmount = 0; + + private static final int HELIUM_NEEDED = 730000; + private static final int powerUsage = (int) TierEU.RECIPE_IV / 2; + private static final int maxCapacity = 675000; + private static final int minCapacityToStart = 100000; + private int HeliumSupply; + private int fuelSupply; + private boolean emptyingMode; + private int coolingPerTick = 0; private static final String STRUCTURE_PIECE_MAIN = "main"; private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition @@ -82,33 +96,23 @@ public class MTEThoriumHighTempReactor extends MTEEnhancedMultiBlockBase x.mCasing++, ofBlock(GregTechAPI.sBlockCasings3, 12))) + .addElement('c', onElementPass(x -> x.mCasingAmount++, ofBlock(GregTechAPI.sBlockCasings3, 12))) .addElement( 'b', ofChain( ofHatchAdder(MTEThoriumHighTempReactor::addOutputToMachineList, BASECASINGINDEX, 1), ofHatchAdder(MTEThoriumHighTempReactor::addMaintenanceToMachineList, BASECASINGINDEX, 1), ofHatchAdder(MTEThoriumHighTempReactor::addEnergyInputToMachineList, BASECASINGINDEX, 1), - onElementPass(x -> x.mCasing++, ofBlock(GregTechAPI.sBlockCasings3, 12)))) + onElementPass(x -> x.mCasingAmount++, ofBlock(GregTechAPI.sBlockCasings3, 12)))) .addElement( 'B', ofChain( ofHatchAdder(MTEThoriumHighTempReactor::addInputToMachineList, BASECASINGINDEX, 2), - onElementPass(x -> x.mCasing++, ofBlock(GregTechAPI.sBlockCasings3, 12)))) + onElementPass(x -> x.mCasingAmount++, ofBlock(GregTechAPI.sBlockCasings3, 12)))) // ofHatchAdderOptional(GT_TileEntity_THTR::addInputToMachineList, BASECASINGINDEX, 2, // GregTechAPI.sBlockCasings3, 12)) .build(); - private static final int HELIUM_NEEDED = 730000; - private static final int powerUsage = (int) TierEU.RECIPE_IV / 2; - private static final int maxcapacity = 675000; - private static final int mincapacity = 100000; - private int HeliumSupply; - private int fuelsupply; - private boolean empty; - private int coolanttaking = 0; - private int mCasing = 0; - public MTEThoriumHighTempReactor(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -165,8 +169,8 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack itemStack) { - this.mCasing = 0; - return this.checkPiece(STRUCTURE_PIECE_MAIN, 5, 11, 0) && this.mCasing >= 500 + this.mCasingAmount = 0; + return this.checkPiece(STRUCTURE_PIECE_MAIN, 5, 11, 0) && this.mCasingAmount >= 500 && this.mMaintenanceHatches.size() == 1 && !this.mInputHatches.isEmpty() && !this.mOutputHatches.isEmpty() @@ -179,24 +183,24 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack i public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.HeliumSupply = aNBT.getInteger("HeliumSupply"); - this.fuelsupply = aNBT.getInteger("fuelsupply"); - this.coolanttaking = aNBT.getInteger("coolanttaking"); - this.empty = aNBT.getBoolean("EmptyMode"); + this.fuelSupply = aNBT.getInteger("fuelsupply"); + this.coolingPerTick = aNBT.getInteger("coolanttaking"); + this.emptyingMode = aNBT.getBoolean("EmptyMode"); } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("HeliumSupply", this.HeliumSupply); - aNBT.setInteger("fuelsupply", this.fuelsupply); - aNBT.setInteger("coolanttaking", this.coolanttaking); - aNBT.setBoolean("EmptyMode", this.empty); + aNBT.setInteger("fuelsupply", this.fuelSupply); + aNBT.setInteger("coolanttaking", this.coolingPerTick); + aNBT.setBoolean("EmptyMode", this.emptyingMode); } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide() && !this.empty) { + if (aBaseMetaTileEntity.isServerSide() && !this.emptyingMode) { if (this.HeliumSupply < MTEThoriumHighTempReactor.HELIUM_NEEDED) { for (FluidStack fluidStack : this.getStoredFluids()) { if (fluidStack.isFluidEqual(Materials.Helium.getGas(1))) { @@ -207,16 +211,16 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { } } } - if (this.fuelsupply < maxcapacity) { + if (this.fuelSupply < maxCapacity) { this.startRecipeProcessing(); for (ItemStack itemStack : this.getStoredInputs()) { if (GTUtility.areStacksEqual( itemStack, new ItemStack(THTRMaterials.aTHTR_Materials, 1, THTRMaterials.MATERIAL_FUEL_INDEX))) { - int toget = Math.min(maxcapacity - this.fuelsupply, itemStack.stackSize); + int toget = Math.min(maxCapacity - this.fuelSupply, itemStack.stackSize); if (toget == 0) continue; itemStack.stackSize -= toget; - this.fuelsupply += toget; + this.fuelSupply += toget; } } this.endRecipeProcessing(); @@ -225,64 +229,64 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { } } - @Override - public boolean checkRecipe(ItemStack controllerStack) { - - if (this.empty) { - if (this.HeliumSupply > 0 || this.fuelsupply > 0) { - this.mEfficiency = 10000; - this.mMaxProgresstime = 100; - return true; - } - return false; - } - if (this.HeliumSupply < MTEThoriumHighTempReactor.HELIUM_NEEDED || this.fuelsupply < mincapacity) return false; + private double getEfficiency() { + return Math.min( + Math.pow((this.fuelSupply - minCapacityToStart) / ((maxCapacity - minCapacityToStart) / 10D), 2D) + 1, + 100D) / 100D - (this.getIdealStatus() - this.getRepairStatus()) / 10D; + } - double eff = Math - .min(Math.pow((this.fuelsupply - mincapacity) / ((maxcapacity - mincapacity) / 10D), 2D) + 1, 100D) / 100D - - (this.getIdealStatus() - this.getRepairStatus()) / 10D; - if (eff <= 0D) return false; + @Override + public @NotNull CheckRecipeResult checkProcessing() { + if (emptyingMode) { + if (!(HeliumSupply > 0 || fuelSupply > 0)) return CheckRecipeResultRegistry.NO_RECIPE; + this.mEfficiency = 10000; + this.mMaxProgresstime = 100; + } else { + if (this.HeliumSupply < MTEThoriumHighTempReactor.HELIUM_NEEDED || this.fuelSupply < minCapacityToStart) + return CheckRecipeResultRegistry.NO_RECIPE; - int toReduce = MathUtils.floorInt(this.fuelsupply * 0.005D * eff); + double efficiency = getEfficiency(); + if (efficiency <= 0.0) return CheckRecipeResultRegistry.NO_RECIPE; - final int originalToReduce = toReduce; - int burnedballs = toReduce / 64; - if (burnedballs > 0) toReduce -= burnedballs * 64; + int toReduce = MathUtils.floorInt(this.fuelSupply * 0.005D * efficiency); - int meta = THTRMaterials.MATERIAL_USED_FUEL_INDEX; + final int originalToReduce = toReduce; + int burnedBalls = toReduce / 64; + if (burnedBalls > 0) toReduce -= burnedBalls * 64; - ItemStack[] toOutput = { new ItemStack(THTRMaterials.aTHTR_Materials, burnedballs, meta), - new ItemStack(THTRMaterials.aTHTR_Materials, toReduce, meta + 1) }; - if (!this.canOutputAll(toOutput)) return false; + int meta = THTRMaterials.MATERIAL_USED_FUEL_INDEX; - this.fuelsupply -= originalToReduce; - this.mOutputItems = toOutput; + ItemStack[] toOutput = { new ItemStack(THTRMaterials.aTHTR_Materials, burnedBalls, meta), + new ItemStack(THTRMaterials.aTHTR_Materials, toReduce, meta + 1) }; + if (!this.canOutputAll(toOutput)) return CheckRecipeResultRegistry.NO_RECIPE; - // this.updateSlots(); not needed ? + this.fuelSupply -= originalToReduce; + this.mOutputItems = toOutput; - this.coolanttaking = (int) (4800D * eff); - this.mEfficiency = (int) (eff * 10000D); - this.mEUt = -powerUsage; - this.mMaxProgresstime = 648000; - return true; + this.coolingPerTick = (int) (4800.0 * efficiency); + this.mEfficiency = (int) (efficiency * 10000.0); + this.mEUt = -powerUsage; + this.mMaxProgresstime = 648000; + } + return CheckRecipeResultRegistry.SUCCESSFUL; } @Override public boolean onRunningTick(ItemStack aStack) { - if (this.empty) { + if (this.emptyingMode) { this.addOutput(Materials.Helium.getGas(this.HeliumSupply)); this.addOutput( - new ItemStack(THTRMaterials.aTHTR_Materials, this.fuelsupply, THTRMaterials.MATERIAL_FUEL_INDEX)); + new ItemStack(THTRMaterials.aTHTR_Materials, this.fuelSupply, THTRMaterials.MATERIAL_FUEL_INDEX)); this.HeliumSupply = 0; - this.fuelsupply = 0; + this.fuelSupply = 0; this.updateSlots(); return true; } if (!super.onRunningTick(aStack)) return false; - int takecoolant = this.coolanttaking; + int takecoolant = this.coolingPerTick; int drainedamount = 0; for (MTEHatchInput tHatch : validMTEList(mInputHatches)) { @@ -329,12 +333,12 @@ public String[] getInfoData() { + GTUtility.formatNumbers(this.mMaxProgresstime / 20) + "secs", "TRISO-Pebbles:", - GTUtility.formatNumbers(this.fuelsupply) + "pcs. / " + GTUtility.formatNumbers(this.fuelsupply) + "psc.", + GTUtility.formatNumbers(this.fuelSupply) + "pcs. / " + GTUtility.formatNumbers(this.fuelSupply) + "psc.", "Helium-Level:", GTUtility.formatNumbers(this.HeliumSupply) + "L / " + GTUtility.formatNumbers(MTEThoriumHighTempReactor.HELIUM_NEEDED) + "L", - "Coolant/t:", GTUtility.formatNumbers(this.mProgresstime == 0 ? 0 : this.coolanttaking) + "L/t", + "Coolant/t:", GTUtility.formatNumbers(this.mProgresstime == 0 ? 0 : this.coolingPerTick) + "L/t", "Problems:", String.valueOf(this.getIdealStatus() - this.getRepairStatus()) }; } @@ -374,10 +378,10 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f GTUtility.sendChatToPlayer(aPlayer, "THTR mode cannot be changed while the machine is running."); return; } - this.empty = !this.empty; + this.emptyingMode = !this.emptyingMode; GTUtility.sendChatToPlayer( aPlayer, - "THTR is now running in " + (this.empty ? "emptying mode." : "normal Operation")); + "THTR is now running in " + (this.emptyingMode ? "emptying mode." : "normal Operation")); } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java b/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java index 40a7aba420b..c3cbb73be39 100644 --- a/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java +++ b/src/main/java/bartworks/common/tileentities/multis/MTEWindmill.java @@ -40,6 +40,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -77,11 +79,14 @@ import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; import gregtech.api.objects.ItemData; import gregtech.api.recipe.RecipeMaps; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTOreDictUnificator; import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReason; import gregtech.common.items.IDMetaTool01; import gregtech.common.items.MetaGeneratedTool01; @@ -283,8 +288,9 @@ private float[] multiplierRecipe(ItemStack itemStack) { } @Override - public boolean checkRecipe(ItemStack itemStack) { - if (itemStack == null || itemStack.getItem() == null) return false; + public @NotNull CheckRecipeResult checkProcessing() { + ItemStack itemStack = getControllerSlot(); + if (itemStack == null || itemStack.getItem() == null) return CheckRecipeResultRegistry.NO_RECIPE; if (this.mOutputItems == null) this.mOutputItems = new ItemStack[2]; @@ -293,7 +299,7 @@ public boolean checkRecipe(ItemStack itemStack) { .voltage(V[1]) .find(); if (tRecipe == null) { - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } if (tRecipe.getOutput(0) != null) { @@ -331,11 +337,11 @@ public boolean checkRecipe(ItemStack itemStack) { } this.mMaxProgresstime = tRecipe.mDuration * 2 * 100 * this.mMulti / this.getSpeed(this.rotorBlock); this.mMulti = 16; - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } @Override - public void stopMachine() { + public void stopMachine(@NotNull ShutDownReason reason) { this.getBaseMetaTileEntity() .disableWorking(); } @@ -524,30 +530,28 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu } public float OutputMultiplier(TileEntityRotorBlock rotorBlock) { - try { - return ((ItemStonageRotors) rotorBlock.rotorSlot.get() - .getItem()).getmRotor(); - } catch (Exception e) { - return 1f; + ItemStack stack = rotorBlock.rotorSlot.get(); + if (stack == null || !(stack.getItem() instanceof ItemStonageRotors rotor)) { + return 1; } + return rotor.getmRotor(); } public int getSpeed(TileEntityRotorBlock rotorBlock) { - try { - return ((ItemStonageRotors) rotorBlock.rotorSlot.get() - .getItem()).getSpeed(); - } catch (Exception e) { + ItemStack stack = rotorBlock.rotorSlot.get(); + if (stack == null || !(stack.getItem() instanceof ItemStonageRotors rotor)) { return 1; } + return rotor.getSpeed(); } public void setRotorDamage(TileEntityRotorBlock rotorBlock, int damage) { - try { - ((ItemStonageRotors) rotorBlock.rotorSlot.get() - .getItem()).damageItemStack(rotorBlock.rotorSlot.get(), damage); - } catch (Exception e) { + ItemStack stack = rotorBlock.rotorSlot.get(); + if (stack == null || !(stack.getItem() instanceof ItemStonageRotors rotor)) { rotorBlock.rotorSlot.damage(damage, false); + return; } + rotor.damageItemStack(stack, damage); } @Override diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java index fa6d5455366..8e3dda55aad 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaBlastFurnace.java @@ -30,7 +30,6 @@ import javax.annotation.Nonnull; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -39,8 +38,8 @@ import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import bartworks.API.BorosilicateGlass; @@ -222,7 +221,7 @@ public void loadNBTData(NBTTagCompound aNBT) { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (!aPlayer.isSneaking()) { this.inputSeparation = !this.inputSeparation; GTUtility.sendChatToPlayer( @@ -329,12 +328,12 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { } @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { if (this.mMachine) return -1; int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5); this.glassTier = 0; this.setCoilLevel(HeatingCoilLevel.None); - return this.survivialBuildPiece("main", stackSize, 7, 17, 0, realBudget, source, actor, false, true); + return this.survivialBuildPiece("main", stackSize, 7, 17, 0, realBudget, env, false, true); } public void setCoilLevel(HeatingCoilLevel aCoilLevel) { diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java index 71d2c88b691..9cc18de9b31 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaChemicalReactor.java @@ -25,7 +25,6 @@ import static gregtech.api.util.GTStructureUtility.buildHatchAdder; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; @@ -33,8 +32,8 @@ import net.minecraftforge.common.util.ForgeDirection; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import bartworks.API.BorosilicateGlass; @@ -160,7 +159,7 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (aPlayer.isSneaking()) { this.batchMode = !this.batchMode; if (this.batchMode) { @@ -185,11 +184,10 @@ public void construct(ItemStack aStack, boolean aHintsOnly) { } @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { if (this.mMachine) return -1; int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5); - return this - .survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 2, 2, 0, realBudget, source, actor, false, true); + return this.survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 2, 2, 0, realBudget, env, false, true); } // -------------- TEC TECH COMPAT ---------------- diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java index 95ddef6b8af..62697dcb8fd 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaDistillTower.java @@ -27,7 +27,6 @@ import java.util.List; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -36,9 +35,9 @@ import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureElementCheckOnly; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import bartworks.common.configs.Configuration; @@ -327,12 +326,11 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { } @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { if (this.mMachine) return -1; int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5); this.mHeight = 0; - int built = this - .survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 7, 0, 0, realBudget, source, actor, false, true); + int built = this.survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 7, 0, 0, realBudget, env, false, true); if (built >= 0) return built; int tTotalHeight = Math.min(12, stackSize.stackSize + 2); // min 2 output layer, so at least 1 + 2 height for (int i = 1; i < tTotalHeight - 1; i++) { @@ -344,8 +342,7 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource 5 * this.mHeight, 0, realBudget, - source, - actor, + env, false, true); if (built >= 0) return built; @@ -358,8 +355,7 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource 5 * this.mHeight, 0, realBudget, - source, - actor, + env, false, true); } @@ -374,7 +370,7 @@ public void loadNBTData(NBTTagCompound aNBT) { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (aPlayer.isSneaking()) { this.batchMode = !this.batchMode; if (this.batchMode) { diff --git a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java index a9e34e91bb7..51d8d5ada3b 100644 --- a/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java +++ b/src/main/java/bartworks/common/tileentities/multis/mega/MTEMegaOilCracker.java @@ -34,7 +34,6 @@ import javax.annotation.Nonnull; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; @@ -43,8 +42,8 @@ import net.minecraftforge.fluids.FluidStack; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IItemSource; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import bartworks.API.BorosilicateGlass; @@ -249,11 +248,10 @@ public void construct(ItemStack aStack, boolean aHintsOnly) { } @Override - public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) { + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { if (this.mMachine) return -1; int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5); - return this - .survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 6, 6, 0, realBudget, source, actor, false, true); + return this.survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 6, 6, 0, realBudget, env, false, true); } // -------------- TEC TECH COMPAT ---------------- @@ -432,7 +430,7 @@ public boolean supportsBatchMode() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (aPlayer.isSneaking()) { batchMode = !batchMode; if (batchMode) { diff --git a/src/main/java/ggfab/mte/MTEAdvAssLine.java b/src/main/java/ggfab/mte/MTEAdvAssLine.java index a4c913207ce..ae0d4c8d306 100644 --- a/src/main/java/ggfab/mte/MTEAdvAssLine.java +++ b/src/main/java/ggfab/mte/MTEAdvAssLine.java @@ -96,6 +96,7 @@ import gregtech.api.util.OverclockCalculator; import gregtech.api.util.VoidProtectionHelper; import gregtech.api.util.shutdown.ShutDownReason; +import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gregtech.common.tileentities.machines.MTEHatchInputBusME; import gregtech.common.tileentities.machines.MTEHatchInputME; import mcp.mobius.waila.api.IWailaConfigHandler; @@ -432,12 +433,12 @@ public void loadNBTData(NBTTagCompound aNBT) { } /** - * roughly the same as {@link #criticalStopMachine()}, but does not attempt to send a halting sound if world is not + * Does a critical shutdown of the machine, but does not attempt to send a halting sound if world is not * loaded. also supports setting a stop reason */ private void criticalStopMachine(String reason) { int oMaxProgresstime = mMaxProgresstime; - stopMachine(); + stopMachine(ShutDownReasonRegistry.NONE); // don't do these at all if the machine wasn't working before anyway if (oMaxProgresstime > 0) { if (getBaseMetaTileEntity().getWorld() != null) sendSound(INTERRUPT_SOUND_INDEX); @@ -993,7 +994,7 @@ public boolean supportsBatchMode() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java index 3755d2b4ad2..fed08f8e0d3 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEComponentAssemblyLine.java @@ -353,7 +353,7 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java index f675e5e455a..0c025d68db7 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEFuelRefineFactory.java @@ -34,11 +34,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; -import gregtech.api.metatileentity.implementations.MTEHatch; -import gregtech.api.metatileentity.implementations.MTEHatchEnergy; -import gregtech.api.metatileentity.implementations.MTEHatchInput; -import gregtech.api.metatileentity.implementations.MTEHatchInputBus; -import gregtech.api.metatileentity.implementations.MTEHatchOutput; import gregtech.api.objects.GTRenderedTexture; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; @@ -48,7 +43,6 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import tectech.thing.metaTileEntity.hatch.MTEHatchEnergyMulti; public class MTEFuelRefineFactory extends MTETooltipMultiBlockBaseEM implements IConstructable, ISurvivalConstructable { @@ -233,59 +227,16 @@ protected void setProcessingLogicPower(ProcessingLogic logic) { logic.setAvailableAmperage(1); } - public final boolean addToFRFList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } else { - if (aMetaTileEntity instanceof MTEHatch) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - } - if (aMetaTileEntity instanceof MTEHatchInput) { - return this.mInputHatches.add((MTEHatchInput) aMetaTileEntity); - } else if (aMetaTileEntity instanceof MTEHatchOutput) { - return this.mOutputHatches.add((MTEHatchOutput) aMetaTileEntity); - } else if (aMetaTileEntity instanceof MTEHatchInputBus) { - return this.mInputBusses.add((MTEHatchInputBus) aMetaTileEntity); - } else if (aMetaTileEntity instanceof MTEHatchEnergy) { - return this.mEnergyHatches.add((MTEHatchEnergy) aMetaTileEntity); - } else if (aMetaTileEntity instanceof MTEHatchEnergyMulti) { - return this.eEnergyMulti.add((MTEHatchEnergyMulti) aMetaTileEntity); - } else { - return false; - } - } - } - } - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new MTEFuelRefineFactory(this.mName); } - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return true; } - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - @Override public String[] getInfoData() { String[] infoData = new String[super.getInfoData().length + 1]; @@ -296,7 +247,7 @@ public String[] getInfoData() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java b/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java index 161108d74b6..8c30e1ef677 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTELargeEssentiaSmeltery.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Map; +import java.util.Objects; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -37,7 +38,6 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTEHatchMuffler; import gregtech.api.objects.XSTR; import gregtech.api.recipe.check.CheckRecipeResult; @@ -46,7 +46,7 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.OverclockCalculator; -import tectech.thing.metaTileEntity.hatch.MTEHatchEnergyMulti; +import gregtech.api.util.shutdown.ShutDownReason; import tectech.thing.metaTileEntity.multi.base.TTMultiblockBase; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; @@ -161,7 +161,8 @@ public IStructureDefinition getStructure_EM() { .addElement('D', ofBlock(ConfigBlocks.blockCosmeticOpaque, 2)) .addElement( 'F', - ThaumicBases.isModLoaded() ? ofBlock(Block.getBlockFromName("thaumicbases:advAlchFurnace"), 0) + ThaumicBases.isModLoaded() + ? ofBlock(Objects.requireNonNull(Block.getBlockFromName("thaumicbases:advAlchFurnace")), 0) : ofBlock(ConfigBlocks.blockStoneDevice, 0)) .addElement( 'E', @@ -272,28 +273,8 @@ protected void onEssentiaCellFound(int tier) { this.pTier = tier; } - private boolean addEnergyHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } else if (aMetaTileEntity instanceof MTEHatchEnergy) { - if (((MTEHatchEnergy) aMetaTileEntity).mTier < 3) return false; - ((MTEHatchEnergy) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.mEnergyHatches.add((MTEHatchEnergy) aMetaTileEntity); - } else if (aMetaTileEntity instanceof MTEHatchEnergyMulti) { - ((MTEHatchEnergyMulti) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.eEnergyMulti.add(((MTEHatchEnergyMulti) aMetaTileEntity)); - } else { - return false; - } - } - } - private boolean addEssentiaOutputHatchToMachineList(MTEEssentiaOutputHatch aTileEntity) { - if (aTileEntity instanceof MTEEssentiaOutputHatch) { + if (aTileEntity != null) { return this.mEssentiaOutputHatches.add(aTileEntity); } return false; @@ -416,7 +397,7 @@ private AspectList getEssentia(ItemStack itemStack, int amount) { } AspectList aspects = ThaumcraftCraftingManager.getObjectTags(itemStack); aspects = ThaumcraftCraftingManager.getBonusTags(itemStack, aspects); - if (aspects != null && aspects.size() != 0 && aspects.getAspects()[0] != null) { + if (aspects.size() != 0 && aspects.getAspects()[0] != null) { for (int i = 0; i < amount; i++) aspectList.add(aspects); } else aspectList.add(Aspect.ENTROPY, amount); return aspectList; @@ -498,8 +479,8 @@ protected void addClassicOutputs_EM() { } @Override - public void stopMachine() { - super.stopMachine(); + public void stopMachine(@NotNull ShutDownReason reason) { + super.stopMachine(reason); this.mOutputAspects.aspects.clear(); } @@ -577,31 +558,11 @@ public boolean onRunningTick(ItemStack aStack) { return super.onRunningTick(aStack); } - @Override - public boolean isCorrectMachinePart(ItemStack itemStack) { - return true; - } - @Override public int getPollutionPerSecond(ItemStack aStack) { return 22 * (100 - this.nodePurificationEfficiency); } - @Override - public int getMaxEfficiency(ItemStack itemStack) { - return 10000; - } - - @Override - public int getDamageToComponent(ItemStack itemStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack itemStack) { - return false; - } - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { return new MTELargeEssentiaSmeltery(this.mName); diff --git a/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java b/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java index b64b2356ddf..31ac4554e71 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/MTEUniversalChemicalFuelEngine.java @@ -32,8 +32,6 @@ import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.metatileentity.implementations.MTEHatchDynamo; import gregtech.api.metatileentity.implementations.MTEHatchInput; -import gregtech.api.metatileentity.implementations.MTEHatchMaintenance; -import gregtech.api.metatileentity.implementations.MTEHatchMuffler; import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.RecipeMaps; import gregtech.api.recipe.check.CheckRecipeResult; @@ -43,6 +41,8 @@ import gregtech.api.util.GTRecipe; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReason; +import gregtech.api.util.shutdown.ShutDownReasonRegistry; import gtPlusPlus.api.recipe.GTPPRecipeMaps; import tectech.thing.metaTileEntity.hatch.MTEHatchDynamoMulti; @@ -71,32 +71,6 @@ public MTEUniversalChemicalFuelEngine(int id, String name, String nameRegional) super.useLongPower = true; } - public final boolean addMaintenance(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof MTEHatchMaintenance) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.mMaintenanceHatches.add((MTEHatchMaintenance) aMetaTileEntity); - } - } - return false; - } - - public final boolean addMuffler(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } else { - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity instanceof MTEHatchMuffler) { - ((MTEHatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return this.mMufflerHatches.add((MTEHatchMuffler) aMetaTileEntity); - } - } - return false; - } - public final boolean addInputHatch(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; @@ -167,11 +141,6 @@ public String[] getStructureDescription(ItemStack itemStack) { return DescTextLocalization.addText("UniversalChemicalFuelEngine.hint", 11); } - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - @Override public int getPollutionPerSecond(ItemStack aStack) { return (int) Math.sqrt(this.getPowerFlow()); @@ -254,10 +223,10 @@ protected CheckRecipeResult processFuel(ArrayList tFluids, RecipeMap } @Override - public void stopMachine() { + public void stopMachine(@NotNull ShutDownReason reason) { // Reset the counter for heating, so that it works again when the machine restarts heatingTicks = 0; - super.stopMachine(); + super.stopMachine(reason); } @Override @@ -307,7 +276,7 @@ void addAutoEnergy() { tHatch.getBaseMetaTileEntity() .getStoredEU() + exEU)); } else if (!isStoppingSafe) { - stopMachine(); + stopMachine(ShutDownReasonRegistry.NONE); } } if (!eDynamoMulti.isEmpty()) { @@ -319,7 +288,7 @@ void addAutoEnergy() { tHatch.getBaseMetaTileEntity() .getStoredEU() + exEU)); } else if (!isStoppingSafe) { - stopMachine(); + stopMachine(ShutDownReasonRegistry.NONE); } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/MTEEnhancedMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/MTEEnhancedMultiBlockBase.java index 345ce96dbc2..090ef47cadc 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/MTEEnhancedMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/MTEEnhancedMultiBlockBase.java @@ -83,9 +83,9 @@ public final boolean isFacingValid(ForgeDirection facing) { @Override public boolean onWrenchRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer entityPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (wrenchingSide != getBaseMetaTileEntity().getFrontFacing()) - return super.onWrenchRightClick(side, wrenchingSide, entityPlayer, aX, aY, aZ); + return super.onWrenchRightClick(side, wrenchingSide, entityPlayer, aX, aY, aZ, aTool); if (entityPlayer.isSneaking()) { if (isFlipChangeAllowed()) { toolSetFlip(getFlip().isHorizontallyFlipped() ? Flip.NONE : Flip.HORIZONTAL); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java index a729edeaeff..54575725d56 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEDrillerBase.java @@ -261,7 +261,7 @@ public void loadNBTData(NBTTagCompound aNBT) { @Override public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, - EntityPlayer entityPlayer, float aX, float aY, float aZ) { + EntityPlayer entityPlayer, float aX, float aY, float aZ, ItemStack aTool) { if (side == getBaseMetaTileEntity().getFrontFacing()) { mChunkLoadingEnabled = !mChunkLoadingEnabled; GTUtility.sendChatToPlayer( @@ -270,7 +270,7 @@ public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wre : GTUtility.trans("503", "Mining chunk loading disabled")); return true; } - return super.onSolderingToolRightClick(side, wrenchingSide, entityPlayer, aX, aY, aZ); + return super.onSolderingToolRightClick(side, wrenchingSide, entityPlayer, aX, aY, aZ, aTool); } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java index 8d9b265190e..b2954f15e05 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEIndustrialElectromagneticSeparator.java @@ -456,7 +456,7 @@ private boolean addMagHatch(IGregTechTileEntity aTileEntity, int aBaseCasingInde @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java index 1d4026aff66..544900066ae 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeChemicalReactor.java @@ -304,7 +304,7 @@ public boolean supportsBatchMode() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java index 14452c623f4..d0f807c173f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTELargeFluidExtractor.java @@ -422,7 +422,7 @@ public float getEUMultiplier() { @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEResearchCompleter.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEResearchCompleter.java index 65e65c664ab..4b69a930099 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEResearchCompleter.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEResearchCompleter.java @@ -11,6 +11,8 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.StructureDefinition; @@ -23,6 +25,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; import gregtech.api.net.GTPacketNodeInfo; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; @@ -169,8 +173,7 @@ public boolean onRunningTick(ItemStack aStack) { TileEntity tileEntity = aBaseMetaTileEntity.getWorld() .getTileEntity(nodeX, nodeY, nodeZ); - if (tileEntity instanceof TileNode) { - TileNode aNode = (TileNode) tileEntity; + if (tileEntity instanceof TileNode aNode) { AspectList aspectsBase = aNode.getAspectsBase(); for (Aspect aspect : aspectsBase.getAspects()) { @@ -227,7 +230,7 @@ public boolean isCorrectMachinePart(ItemStack itemStack) { } @Override - public boolean checkRecipe(ItemStack itemStack) { + public @NotNull CheckRecipeResult checkProcessing() { ArrayList tInputList = this.getStoredInputs(); for (ItemStack stack : tInputList) { @@ -248,7 +251,7 @@ public boolean checkRecipe(ItemStack itemStack) { this.getMaxInputVoltage(), false); if (this.mMaxProgresstime == 2147483646 && this.mEUt == 2147483646) { - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } if (this.mEUt > 0) { this.mEUt = -this.mEUt; @@ -267,12 +270,12 @@ public boolean checkRecipe(ItemStack itemStack) { this.sendLoopStart((byte) 20); this.updateSlots(); - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } } } - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java index 22f0ec2701c..94def08fabd 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GTPPMultiBlockBase.java @@ -987,7 +987,7 @@ public boolean onPlungerRightClick(EntityPlayer aPlayer, ForgeDirection side, fl @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (aPlayer.isSneaking()) { batchMode = !batchMode; if (batchMode) { @@ -1002,7 +1002,7 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench @Override public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (supportsVoidProtection() && wrenchingSide == getBaseMetaTileEntity().getFrontFacing()) { Set allowed = getAllowedVoidingModes(); setVoidingMode(getVoidingMode().nextInCollection(allowed)); @@ -1011,7 +1011,7 @@ public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wre StatCollector.translateToLocal("GT5U.gui.button.voiding_mode") + " " + StatCollector.translateToLocal(getVoidingMode().getTransKey())); return true; - } else return super.onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ); + } else return super.onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, aTool); } // Only support to use meta to tier diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java index 9b0b2dac92f..af25a0feed5 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/mega/MTEMegaAlloyBlastSmelter.java @@ -444,7 +444,7 @@ public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPla @Override public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { batchMode = !batchMode; if (batchMode) { GTUtility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("misc.BatchModeTextOn")); diff --git a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java index 8fb3a54e921..fa760dda9df 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java @@ -25,6 +25,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.StructureLib; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -40,6 +42,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; @@ -246,8 +250,9 @@ private boolean addBeamLineOutputHatch(IGregTechTileEntity te, int casingIndex) return false; } + @NotNull @Override - public boolean checkRecipe(ItemStack itemStack) { + public CheckRecipeResult checkProcessing() { float tempFactor = 0; // Focus as determined by multi properties @@ -277,7 +282,7 @@ public boolean checkRecipe(ItemStack itemStack) { if (tFluidInputs.isEmpty()) { this.doRandomMaintenanceDamage(); // Penalise letting coolant run dry this.stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.nocoolant")); - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } // Coolant input @@ -291,12 +296,12 @@ public boolean checkRecipe(ItemStack itemStack) { this.mEfficiencyIncrease = 10000; if (this.getInputInformation() == null) { - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } if (this.getInputInformation() .getEnergy() == 0) { - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } particleId = this.getInputInformation() @@ -305,7 +310,7 @@ public boolean checkRecipe(ItemStack itemStack) { if (!inputParticle.canAccelerate()) { stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.noaccel")); - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } mMaxProgresstime = 1 * TickTime.SECOND; @@ -364,7 +369,7 @@ public boolean checkRecipe(ItemStack itemStack) { if (Util.coolantFluidCheck(primFluid, fluidConsumed)) { this.stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.inscoolant")); - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } @@ -374,17 +379,17 @@ public boolean checkRecipe(ItemStack itemStack) { primFluid.getFluid() .getName()); - if (Objects.isNull(fluidOutput)) return false; + if (Objects.isNull(fluidOutput)) return CheckRecipeResultRegistry.NO_RECIPE; FluidStack fluidOutputStack = new FluidStack(fluidOutput, fluidConsumed); - if (Objects.isNull(fluidOutputStack)) return false; + if (Objects.isNull(fluidOutputStack)) return CheckRecipeResultRegistry.NO_RECIPE; this.addFluidOutputs(new FluidStack[] { fluidOutputStack }); outputAfterRecipe(); - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } private void outputAfterRecipe() { @@ -402,18 +407,7 @@ private void outputAfterRecipe() { } @Override - public void stopMachine() { - - outputFocus = 0; - outputEnergy = 0; - outputParticle = 0; - outputRate = 0; - machineTemp = 0; - super.stopMachine(); - } - - @Override - public void stopMachine(ShutDownReason reason) { + public void stopMachine(@NotNull ShutDownReason reason) { outputFocus = 0; outputEnergy = 0; diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java index 5c69bae5a8f..4e05e4220ea 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java @@ -22,6 +22,8 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; @@ -35,9 +37,12 @@ import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReason; import gregtech.api.util.shutdown.SimpleShutDownReason; import gtnhlanth.common.beamline.BeamInformation; import gtnhlanth.common.beamline.BeamLinePacket; @@ -155,8 +160,9 @@ private boolean addBeamLineOutputHatch(IGregTechTileEntity te, int casingIndex) return false; } + @NotNull @Override - public boolean checkRecipe(ItemStack itemStack) { + public CheckRecipeResult checkProcessing() { // No input particle, so no input quantities @@ -176,15 +182,17 @@ public boolean checkRecipe(ItemStack itemStack) { .voltage(tVoltageActual) .find(); - if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, new FluidStack[] {}, tItems)) return false; // Consumes - // input - // item + if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, new FluidStack[] {}, tItems)) { + return CheckRecipeResultRegistry.NO_RECIPE; // Consumes input item + } this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; this.mMaxProgresstime = tRecipe.mDuration; - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) { + return CheckRecipeResultRegistry.NO_RECIPE; + } mEUt = (int) -tVoltageActual; if (this.mEUt > 0) this.mEUt = (-this.mEUt); @@ -203,7 +211,7 @@ public boolean checkRecipe(ItemStack itemStack) { if (outputEnergy <= 0) { stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.scerror")); - return false; + return CheckRecipeResultRegistry.NO_RECIPE; } outputFocus = tRecipe.focus; @@ -214,7 +222,7 @@ public boolean checkRecipe(ItemStack itemStack) { outputAfterRecipe(); - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } @Override @@ -238,12 +246,12 @@ private void outputAfterRecipe() { } @Override - public void stopMachine() { + public void stopMachine(@NotNull ShutDownReason reason) { outputFocus = 0; outputEnergy = 0; outputParticle = 0; outputRate = 0; - super.stopMachine(); + super.stopMachine(reason); } @Override diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java b/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java index 2d8f0c2f08f..c9e0cf75b96 100644 --- a/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java +++ b/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java @@ -28,6 +28,8 @@ import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import com.google.common.collect.ImmutableMap; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -44,6 +46,8 @@ import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase; import gregtech.api.metatileentity.implementations.MTEHatch; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.ExoticEnergyInputHelper; import gregtech.api.util.GTUtility; @@ -445,7 +449,7 @@ public class MTESynchrotron extends MTEExtendedPowerMultiBlockBase getRecipeMap() { return BeamlineRecipeAdder2.instance.TargetChamberRecipes; } + @NotNull @Override - public boolean checkRecipe(ItemStack itemStack) { + public CheckRecipeResult checkProcessing() { inputEnergy = 0; inputRate = 0; @@ -274,25 +279,26 @@ public boolean checkRecipe(ItemStack itemStack) { .cachedRecipe(this.lastRecipe) .find(); - if (tRecipe == null) return false; + if (tRecipe == null) return CheckRecipeResultRegistry.NO_RECIPE; BeamInformation inputInfo = this.getInputInformation(); - if (inputInfo == null) return false; + if (inputInfo == null) return CheckRecipeResultRegistry.NO_RECIPE; inputEnergy = inputInfo.getEnergy(); inputRate = inputInfo.getRate(); inputParticle = inputInfo.getParticleId(); inputFocus = inputInfo.getFocus(); - if (inputEnergy < tRecipe.minEnergy || inputEnergy > tRecipe.maxEnergy) return false; + if (inputEnergy < tRecipe.minEnergy || inputEnergy > tRecipe.maxEnergy) + return CheckRecipeResultRegistry.NO_RECIPE; - if (inputFocus < tRecipe.minFocus) return false; + if (inputFocus < tRecipe.minFocus) return CheckRecipeResultRegistry.NO_RECIPE; - if (inputParticle != tRecipe.particleId) return false; + if (inputParticle != tRecipe.particleId) return CheckRecipeResultRegistry.NO_RECIPE; if (tRecipe.focusItem != null) { - if (tRecipe.focusItem.getItem() != tFocusItem.getItem()) return false; + if (tRecipe.focusItem.getItem() != tFocusItem.getItem()) return CheckRecipeResultRegistry.NO_RECIPE; } int focusDurabilityDepletion = 1; @@ -323,13 +329,14 @@ public boolean checkRecipe(ItemStack itemStack) { // over the rate. E.g., 100a, 10r // would equal 50 seconds - if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; + if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) + return CheckRecipeResultRegistry.NO_RECIPE; double maxParallel = tRecipe .maxParallelCalculatedByInputs(batchAmount, new FluidStack[] {}, tItemsWithFocusItemArray); if (maxParallel < 1) // Insufficient items - return false; + return CheckRecipeResultRegistry.NO_RECIPE; if (!tRecipe.equals(this.lastRecipe)) this.lastRecipe = tRecipe; @@ -362,7 +369,7 @@ public boolean checkRecipe(ItemStack itemStack) { this.updateSlots(); - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } private BeamInformation getInputInformation() { diff --git a/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java b/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java index 4ae99ac3638..4c2da0c2a22 100644 --- a/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java +++ b/src/main/java/kekztech/common/tileentities/MTELapotronicSuperCapacitor.java @@ -42,6 +42,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; +import org.jetbrains.annotations.NotNull; + import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; @@ -77,6 +79,8 @@ import gregtech.api.metatileentity.implementations.MTEHatchDynamo; import gregtech.api.metatileentity.implementations.MTEHatchEnergy; import gregtech.api.metatileentity.implementations.MTEHatchMaintenance; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.IGTHatchAdder; @@ -552,12 +556,12 @@ public boolean isCorrectMachinePart(ItemStack stack) { } @Override - public boolean checkRecipe(ItemStack stack) { + public @NotNull CheckRecipeResult checkProcessing() { this.mProgresstime = 1; this.mMaxProgresstime = 1; this.mEUt = 0; this.mEfficiencyIncrease = 10000; - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } @Override @@ -1155,7 +1159,7 @@ && getBaseMetaTileEntity().wasShutdown())) .setTextAlignment(Alignment.CenterLeft) .setDefaultColor(COLOR_TEXT_WHITE.get()) .setEnabled(widget -> isActiveCache)) - .widget(new FakeSyncWidget.LongSyncer(() -> energyInputValues.avgLong(), val -> avgInCache = val)) + .widget(new FakeSyncWidget.LongSyncer(energyInputValues::avgLong, val -> avgInCache = val)) .widget( new TextWidget() .setStringSupplier( @@ -1167,7 +1171,7 @@ && getBaseMetaTileEntity().wasShutdown())) .setTextAlignment(Alignment.CenterLeft) .setDefaultColor(COLOR_TEXT_WHITE.get()) .setEnabled(widget -> isActiveCache)) - .widget(new FakeSyncWidget.LongSyncer(() -> energyOutputValues.avgLong(), val -> avgOutCache = val)) + .widget(new FakeSyncWidget.LongSyncer(energyOutputValues::avgLong, val -> avgOutCache = val)) .widget( new TextWidget().setStringSupplier(() -> EnumChatFormatting.WHITE + timeToCache) .setTextAlignment(Alignment.CenterLeft) @@ -1229,11 +1233,6 @@ public void loadNBTData(NBTTagCompound nbt) { super.loadNBTData(nbt); } - @Override - public boolean isGivingInformation() { - return true; - } - @Override public int getMaxEfficiency(ItemStack stack) { return 10000; diff --git a/src/main/java/kekztech/common/tileentities/MTETankTFFT.java b/src/main/java/kekztech/common/tileentities/MTETankTFFT.java index f19cd5fabfd..e9be7ea069f 100644 --- a/src/main/java/kekztech/common/tileentities/MTETankTFFT.java +++ b/src/main/java/kekztech/common/tileentities/MTETankTFFT.java @@ -33,6 +33,8 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; +import org.jetbrains.annotations.NotNull; + import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; @@ -52,6 +54,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; import gregtech.api.metatileentity.implementations.MTEHatchOutput; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; import gregtech.api.render.TextureFactory; import gregtech.api.util.GTUtility; import gregtech.api.util.IGTHatchAdder; @@ -439,12 +443,13 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a } @Override - public boolean checkRecipe(ItemStack itemStack) { + public @NotNull CheckRecipeResult checkProcessing() { mEfficiency = getCurrentEfficiency(null); mEfficiencyIncrease = 10000; mEUt = this.runningCost; mMaxProgresstime = 20; + ItemStack itemStack = getControllerSlot(); this.fluidSelector = (itemStack != null && itemStack.getItem() instanceof ItemIntegratedCircuit) ? (byte) itemStack.getItemDamage() : -1; @@ -511,7 +516,7 @@ public boolean checkRecipe(ItemStack itemStack) { if (this.mEUt > 0) this.mEUt = -this.mEUt; - return true; + return CheckRecipeResultRegistry.SUCCESSFUL; } @Override @@ -589,11 +594,6 @@ public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); } - @Override - public boolean isGivingInformation() { - return true; - } - @Override public int getMaxEfficiency(ItemStack stack) { return 10000; diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/MTEExtremeEntityCrusher.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/MTEExtremeEntityCrusher.java index 4d1a31929c4..2a6e8600348 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/MTEExtremeEntityCrusher.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/MTEExtremeEntityCrusher.java @@ -410,12 +410,12 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f @Override public boolean onSolderingToolRightClick(ForgeDirection side, ForgeDirection wrenchingSide, EntityPlayer aPlayer, - float aX, float aY, float aZ) { + float aX, float aY, float aZ, ItemStack aTool) { if (wrenchingSide == getBaseMetaTileEntity().getFrontFacing()) { mAnimationEnabled = !mAnimationEnabled; GTUtility.sendChatToPlayer(aPlayer, "Animations are " + (mAnimationEnabled ? "enabled" : "disabled")); return true; - } else return super.onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ); + } else return super.onSolderingToolRightClick(side, wrenchingSide, aPlayer, aX, aY, aZ, aTool); } @SuppressWarnings("unused") diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java b/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java index 63be95eaa52..c6b225b976a 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/MTEMicrowave.java @@ -37,6 +37,7 @@ import gregtech.api.util.GTUtility; import gregtech.api.util.MultiblockTooltipBuilder; import gregtech.api.util.shutdown.ShutDownReason; +import gregtech.api.util.shutdown.ShutDownReasonRegistry; import tectech.Reference; import tectech.loader.MainLoader; import tectech.recipe.TTRecipeAdder; @@ -167,34 +168,34 @@ public void outputAfterRecipe_EM() { boolean inside = true; do { - for (Object entity : mte.getWorld() + for (Entity entity : mte.getWorld() .getEntitiesWithinAABBExcludingEntity(null, aabb)) { - if (entity instanceof Entity) { - if (tickedStuff.add((Entity) entity)) { - if (inside && entity instanceof EntityItem) { - GTRecipe tRecipe = RecipeMaps.microwaveRecipes.findRecipeQuery() - .items(((EntityItem) entity).getEntityItem()) - .voltage(128) - .notUnificated(true) - .find(); - if (tRecipe == null || tRecipe.mInputs.length == 0 || tRecipe.mInputs[0].stackSize != 1) { - itemsToOutput.add(((EntityItem) entity).getEntityItem()); - } else { - ItemStack newStuff = tRecipe.getOutput(0) - .copy(); - newStuff.stackSize = ((EntityItem) entity).getEntityItem().stackSize; - itemsToOutput.add(newStuff); - } - ((EntityItem) entity).delayBeforeCanPickup = 2; - ((EntityItem) entity).setDead(); - } else if (entity instanceof EntityLivingBase) { - if (!GTUtility.isWearingFullElectroHazmat((EntityLivingBase) entity)) { - ((EntityLivingBase) entity).attackEntityFrom(MainLoader.microwaving, damagingFactor); - } + + if (tickedStuff.add(entity)) { + if (inside && entity instanceof EntityItem) { + GTRecipe tRecipe = RecipeMaps.microwaveRecipes.findRecipeQuery() + .items(((EntityItem) entity).getEntityItem()) + .voltage(128) + .notUnificated(true) + .find(); + if (tRecipe == null || tRecipe.mInputs.length == 0 || tRecipe.mInputs[0].stackSize != 1) { + itemsToOutput.add(((EntityItem) entity).getEntityItem()); + } else { + ItemStack newStuff = tRecipe.getOutput(0) + .copy(); + newStuff.stackSize = ((EntityItem) entity).getEntityItem().stackSize; + itemsToOutput.add(newStuff); + } + ((EntityItem) entity).delayBeforeCanPickup = 2; + entity.setDead(); + } else if (entity instanceof EntityLivingBase) { + if (!GTUtility.isWearingFullElectroHazmat((EntityLivingBase) entity)) { + entity.attackEntityFrom(MainLoader.microwaving, damagingFactor); } } } } + aabb.offset(xyzOffsets.get0(), xyzOffsets.get1(), xyzOffsets.get2()); aabb = aabb.expand(xyzExpansion.get0() * 1.5, xyzExpansion.get1() * 1.5, xyzExpansion.get2() * 1.5); inside = false; @@ -206,7 +207,7 @@ public void outputAfterRecipe_EM() { if (remainingTime.get() <= 0) { mte.getWorld() .playSoundEffect(xPos, yPos, zPos, Reference.MODID + ":microwave_ding", 1, 1); - stopMachine(); + stopMachine(ShutDownReasonRegistry.NONE); } } @@ -320,18 +321,8 @@ public String[] getStructureDescription(ItemStack stackSize) { return description; } - @Override - public boolean isPowerPassButtonEnabled() { - return true; - } - @Override public boolean isSafeVoidButtonEnabled() { return false; } - - @Override - public boolean isAllowedToWorkButtonEnabled() { - return true; - } } diff --git a/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java b/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java index 911ae722aaf..aaf223479c4 100644 --- a/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java +++ b/src/main/java/tectech/thing/metaTileEntity/multi/base/TTMultiblockBase.java @@ -671,7 +671,7 @@ public float getExcessMassPerTick_EM(ItemStack itemStack) { * should do it */ protected void notAllowedToWork_stopMachine_EM() { - stopMachine(); + stopMachine(ShutDownReasonRegistry.NONE); } /** diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index 6ba4af90132..e81b5f5cc2f 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -561,6 +561,7 @@ GT5U.gui.text.crash=§4Machine turned off due to crash. Refer to the log for mor GT5U.gui.text.no_fuel=§7No valid fuel found GT5U.gui.text.no_turbine=§7No valid turbine found GT5U.gui.text.no_lubricant=§7No lubricant found +GT5U.gui.text.no_coolant=§7No coolant found GT5U.gui.text.cycle_idle=§6Waiting for cycle to start GT5U.gui.text.fuel_quality_too_high=§7Fuel quality too high to run without boost GT5U.gui.text.no_data_sticks=§7No Data Sticks found From 11a3d9b41eb64a2346f97a141c35e96132f0b156 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Sat, 4 Jan 2025 17:15:08 +0100 Subject: [PATCH 3/4] update --- dependencies.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 85af8326bbc..af19720871b 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -43,7 +43,7 @@ dependencies { api("com.github.GTNewHorizons:ModularUI2:2.2.0-1.7.10:dev") api("com.github.GTNewHorizons:waila:1.8.2:dev") api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-518-GTNH:dev") - api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.10-gtnh:dev") + api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.12-gtnh:dev") api('com.github.GTNewHorizons:Yamcl:0.6.0:dev') api("com.github.GTNewHorizons:Postea:1.0.13:dev") @@ -60,7 +60,7 @@ dependencies { compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta28:api') { transitive = false } compileOnlyApi("com.github.GTNewHorizons:AppleCore:3.3.4:dev") { transitive = false } - compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.41:dev") { transitive = false } + compileOnlyApi("com.github.GTNewHorizons:BuildCraft:7.1.42:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:EnderIO:2.9.2:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:ForestryMC:4.10.1:dev") { transitive = false } compileOnlyApi("com.github.GTNewHorizons:ProjectRed:4.11.0-GTNH:dev") { transitive = false } From fa061293d6260d6124f6f368a67c5b6986326669 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Sun, 5 Jan 2025 02:10:24 +0100 Subject: [PATCH 4/4] Make degasser not form without control hatch (#3750) --- .../multi/purification/MTEPurificationUnitDegasser.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java index 5227f17d172..417b7af59b1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/purification/MTEPurificationUnitDegasser.java @@ -722,6 +722,8 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a this.controlHatch = null; if (!checkPiece(STRUCTURE_PIECE_MAIN, STRUCTURE_X_OFFSET, STRUCTURE_Y_OFFSET, STRUCTURE_Z_OFFSET)) return false; if (casingCount < MIN_CASING) return false; + // Do not form without a valid control hatch + if (this.controlHatch == null || !this.controlHatch.isValid()) return false; return super.checkMachine(aBaseMetaTileEntity, aStack); }