From 32ad5325d5154ec003dd6fb950309f9cc6845dc3 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Mon, 12 Feb 2024 20:19:40 +0100 Subject: [PATCH 1/6] dissolution tank --- .../common/tileentity/DissolutionTank.java | 59 +++++++++++-------- .../assets/gtnhlanth/lang/en_US.lang | 2 + 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java b/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java index 2432ead..f6a8876 100644 --- a/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java +++ b/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java @@ -19,11 +19,15 @@ import java.util.List; +import javax.annotation.Nonnull; + import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.NotNull; + import com.elisis.gtnhlanth.api.recipe.LanthanidesRecipeMaps; import com.elisis.gtnhlanth.util.DescTextLocalization; import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; @@ -37,8 +41,12 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import gregtech.api.recipe.check.SimpleCheckRecipeResult; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -96,36 +104,39 @@ public RecipeMap getRecipeMap() { } @Override - public boolean checkRecipe(ItemStack itemStack) { - // GT_Log.out.print("in checkRecipe"); - - List tFluidInputs = this.getStoredFluids(); - FluidStack[] tFluidInputArray = tFluidInputs.toArray(new FluidStack[0]); - ItemStack[] tItems = this.getStoredInputs().toArray(new ItemStack[0]); - long tVoltage = this.getMaxInputVoltage(); - - GT_Recipe tRecipe = LanthanidesRecipeMaps.dissolutionTankRecipes - .findRecipe(getBaseMetaTileEntity(), false, tVoltage, tFluidInputArray, tItems); + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { - if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluidInputArray, tItems)) return false; - // GT_Log.out.print("Recipe not null\n"); + @NotNull + @Override + protected CheckRecipeResult validateRecipe(@Nonnull GT_Recipe recipe) { + List fluidInputs = DissolutionTank.this.getStoredFluids(); + if (!checkRatio(recipe, fluidInputs)) { + return SimpleCheckRecipeResult.ofFailure("dissolution_ratio"); + } + return CheckRecipeResultRegistry.SUCCESSFUL; + } - this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - this.calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); + }; + } - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; - if (this.mEUt > 0) this.mEUt = (-this.mEUt); + @Override + public boolean supportsVoidProtection() { + return true; + } - this.updateSlots(); + @Override + public boolean supportsInputSeparation() { + return true; + } - if (!checkRatio(tRecipe, tFluidInputs)) { - stopMachine(); - return false; - } + @Override + public boolean supportsBatchMode() { + return true; + } - this.mOutputFluids = new FluidStack[] { tRecipe.getFluidOutput(0) }; - this.mOutputItems = tRecipe.mOutputs; + @Override + public boolean supportsSingleRecipeLocking() { return true; } diff --git a/src/main/resources/assets/gtnhlanth/lang/en_US.lang b/src/main/resources/assets/gtnhlanth/lang/en_US.lang index 5b944ee..5aeb987 100644 --- a/src/main/resources/assets/gtnhlanth/lang/en_US.lang +++ b/src/main/resources/assets/gtnhlanth/lang/en_US.lang @@ -51,3 +51,5 @@ fluid.Dinitrotoluene=Dinitrotoluene fluid.Diaminotoluene=Diaminotoluene fluid.Toluene Tetramethyl Diisocyanate=Toluene Tetramethyl Diisocyanate fluid.Diluted Acetone=Diluted Acetone + +GT5U.gui.text.dissolution_ratio=ยง7Wrong fluid input ratio From 194f1b3e220993f182d03db3e71560f0e36f37d7 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Mon, 12 Feb 2024 20:23:17 +0100 Subject: [PATCH 2/6] digester --- .../gtnhlanth/common/tileentity/Digester.java | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/elisis/gtnhlanth/common/tileentity/Digester.java b/src/main/java/com/elisis/gtnhlanth/common/tileentity/Digester.java index 3af6499..7cd4605 100644 --- a/src/main/java/com/elisis/gtnhlanth/common/tileentity/Digester.java +++ b/src/main/java/com/elisis/gtnhlanth/common/tileentity/Digester.java @@ -18,11 +18,10 @@ import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.ofCoil; -import java.util.ArrayList; +import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; import com.elisis.gtnhlanth.api.recipe.LanthanidesRecipeMaps; import com.elisis.gtnhlanth.util.DescTextLocalization; @@ -36,10 +35,14 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMultiBlockBase; 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.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_OverclockCalculator; import gregtech.api.util.GT_Recipe; public class Digester extends GT_MetaTileEntity_EnhancedMultiBlockBase implements ISurvivalConstructable { @@ -101,37 +104,42 @@ public RecipeMap getRecipeMap() { } @Override - public boolean checkRecipe(ItemStack itemStack) { - // GT_Log.out.print("Digester: in checkRecipe\n"); + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { - ArrayList tFluidInputs = this.getStoredFluids(); - FluidStack[] tFluidInputArray = tFluidInputs.toArray(new FluidStack[0]); - ItemStack[] tItems = this.getStoredInputs().toArray(new ItemStack[0]); - long tVoltage = this.getMaxInputVoltage(); + @Nonnull + @Override + protected GT_OverclockCalculator createOverclockCalculator(@Nonnull GT_Recipe recipe) { + return super.createOverclockCalculator(recipe).enablePerfectOC(); + } - // GT_Log.out.print("Digester: " + Arrays.toString(mInventory)); + @Override + protected @Nonnull CheckRecipeResult validateRecipe(@Nonnull GT_Recipe recipe) { + return recipe.mSpecialValue <= Digester.this.getCoilLevel().getHeat() + ? CheckRecipeResultRegistry.SUCCESSFUL + : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); + } - GT_Recipe tRecipe = LanthanidesRecipeMaps.digesterRecipes - .findRecipe(getBaseMetaTileEntity(), false, tVoltage, tFluidInputArray, tItems); - - if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, tFluidInputArray, tItems)) return false; - // GT_Log.out.print("Recipe not null\n"); + }; + } - this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - this.calculateOverclockedNessMultiInternal(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage, true); + @Override + public boolean supportsVoidProtection() { + return true; + } - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; + @Override + public boolean supportsInputSeparation() { + return true; + } - if (this.mEUt > 0) this.mEUt = (-this.mEUt); - // GT_Log.out.print("valid values"); + @Override + public boolean supportsBatchMode() { + return true; + } - if (tRecipe.mSpecialValue > this.getCoilLevel().getHeat()) return false; - // GT_Log.out.print("Coils good\n"); - // GT_Log.out.print(tRecipe.getFluidOutput(0).getLocalizedName()); - this.mOutputFluids = tRecipe.mFluidOutputs; - this.mOutputItems = tRecipe.mOutputs; - this.updateSlots(); + @Override + public boolean supportsSingleRecipeLocking() { return true; } From 0cb95f1258fcaa7f30e36db8aeca1be19ffe7ec9 Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Wed, 14 Feb 2024 01:39:56 +0100 Subject: [PATCH 3/6] update --- dependencies.gradle | 6 +++--- gradle.properties | 10 ++++++---- settings.gradle | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 7351ed9..94335c8 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.43:dev') - implementation('com.github.GTNewHorizons:GTplusplus:1.11.19:dev') - implementation('com.github.GTNewHorizons:GoodGenerator:0.8.4:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.64:dev') + implementation('com.github.GTNewHorizons:GTplusplus:1.11.23:dev') + implementation('com.github.GTNewHorizons:GoodGenerator:0.8.10:dev') } diff --git a/gradle.properties b/gradle.properties index 6c22227..60451a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ gtnh.settings.blowdryerTag = 0.2.0 # Human-readable mod name, available for mcmod.info population. -modName = GTNH: Lanthanides +modName = GTNH\: Lanthanides # Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation. # Conventionally lowercase. @@ -33,7 +33,7 @@ channel = stable mappingsVersion = 12 # Defines other MCP mappings for dependency deobfuscation. -remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ +remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ # Select a default username for testing your mod. You can always override this per-run by running # `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. @@ -61,6 +61,9 @@ gradleTokenModId = GRADLETOKEN_MODID # [DEPRECATED] Mod name replacement token. gradleTokenModName = GRADLETOKEN_MODNAME +# [DEPRECATED] Mod Group replacement token. +gradleTokenGroupName = GRADLETOKEN_GROUPNAME + # [DEPRECATED] # Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java # public static final String VERSION = "GRADLETOKEN_VERSION"; @@ -123,7 +126,7 @@ includeWellKnownRepositories = true usesMavenPublishing = true # Maven repository to publish the mod to. -# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/ +# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/ # Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token. # @@ -188,6 +191,5 @@ curseForgeRelations = # ideaCheckSpotlessOnBuild = true # Non-GTNH properties -gradleTokenGroupName = GRADLETOKEN_GROUPNAME systemProp.org.gradle.internal.http.connectionTimeout = 180000 systemProp.org.gradle.internal.http.socketTimeout = 180000 diff --git a/settings.gradle b/settings.gradle index e8946ad..16a5b4c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8' + id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.14' } From 433f1b73c20c590c16b992dae9fd862ec5f3c4e3 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Wed, 14 Feb 2024 15:49:17 +0100 Subject: [PATCH 4/6] address review --- .../elisis/gtnhlanth/common/tileentity/DissolutionTank.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java b/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java index f6a8876..09b69f1 100644 --- a/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java +++ b/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java @@ -17,6 +17,7 @@ import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; +import java.util.Arrays; import java.util.List; import javax.annotation.Nonnull; @@ -110,8 +111,7 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override protected CheckRecipeResult validateRecipe(@Nonnull GT_Recipe recipe) { - List fluidInputs = DissolutionTank.this.getStoredFluids(); - if (!checkRatio(recipe, fluidInputs)) { + if (!checkRatio(recipe, Arrays.asList(inputFluids))) { return SimpleCheckRecipeResult.ofFailure("dissolution_ratio"); } return CheckRecipeResultRegistry.SUCCESSFUL; From 2ec86de60275f0bf150d05b106427b2e8104a805 Mon Sep 17 00:00:00 2001 From: GDCloud Date: Sat, 17 Feb 2024 18:54:53 +0100 Subject: [PATCH 5/6] make dissolution tank void and stop if the input ratio is wrong --- .../elisis/gtnhlanth/common/tileentity/DissolutionTank.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java b/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java index 09b69f1..080fdc8 100644 --- a/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java +++ b/src/main/java/com/elisis/gtnhlanth/common/tileentity/DissolutionTank.java @@ -110,9 +110,10 @@ protected ProcessingLogic createProcessingLogic() { @NotNull @Override - protected CheckRecipeResult validateRecipe(@Nonnull GT_Recipe recipe) { + protected CheckRecipeResult onRecipeStart(@Nonnull GT_Recipe recipe) { if (!checkRatio(recipe, Arrays.asList(inputFluids))) { - return SimpleCheckRecipeResult.ofFailure("dissolution_ratio"); + criticalStopMachine(); + return SimpleCheckRecipeResult.ofFailurePersistOnShutdown("dissolution_ratio"); } return CheckRecipeResultRegistry.SUCCESSFUL; } From b670de6178520e93016fde800af738734de131ac Mon Sep 17 00:00:00 2001 From: Martin Robertz Date: Sun, 18 Feb 2024 10:30:23 +0100 Subject: [PATCH 6/6] update --- dependencies.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 94335c8..7e0a2b4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,7 +1,7 @@ // Add your dependencies here dependencies { - api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.64:dev') - implementation('com.github.GTNewHorizons:GTplusplus:1.11.23:dev') + api('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.71:dev') + implementation('com.github.GTNewHorizons:GTplusplus:1.11.25:dev') implementation('com.github.GTNewHorizons:GoodGenerator:0.8.10:dev') }