From 94b612901996dd7bea7cbb35a43b58b4d76f4a2c Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Thu, 18 Sep 2025 16:01:24 +0300 Subject: [PATCH 01/13] Check if module exists before applying Pyrotech recipe registry. - Fixes #318 --- .../compat/mods/pyrotech/Anvil.java | 3 +- .../compat/mods/pyrotech/Barrel.java | 3 +- .../compat/mods/pyrotech/BrickKiln.java | 3 +- .../compat/mods/pyrotech/BrickOven.java | 3 +- .../compat/mods/pyrotech/Campfire.java | 3 +- .../compat/mods/pyrotech/ChoppingBlock.java | 3 +- .../compat/mods/pyrotech/CompactingBin.java | 3 +- .../compat/mods/pyrotech/CompostBin.java | 5 +- .../compat/mods/pyrotech/CrudeDryingRack.java | 3 +- .../compat/mods/pyrotech/DryingRack.java | 3 +- .../compat/mods/pyrotech/PitKiln.java | 3 +- .../compat/mods/pyrotech/PyroTech.java | 59 ++++++++++++++----- .../compat/mods/pyrotech/SoakingPot.java | 3 +- .../compat/mods/pyrotech/StoneKiln.java | 3 +- .../compat/mods/pyrotech/StoneOven.java | 3 +- .../compat/mods/pyrotech/TanningRack.java | 3 +- 16 files changed, 75 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index c495e06d0..207280603 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.EnumHelper; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -152,7 +153,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; AnvilRecipe recipe = new AnvilRecipe(output.get(0), input.get(0).toMcIngredient(), hits, type, tier).setRegistryName(super.name); - PyroTech.anvil.add(recipe); + ModSupport.PYROTECH.get().anvil.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java index 24fa76931..31349397d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -97,7 +98,7 @@ public void validate(GroovyLog.Msg msg) { Ingredient[] inputIngredient = input.stream().map(IIngredient::toMcIngredient).toArray(Ingredient[]::new); BarrelRecipe recipe = new BarrelRecipe(fluidOutput.get(0), inputIngredient, fluidInput.get(0), duration).setRegistryName(super.name); - PyroTech.barrel.add(recipe); + ModSupport.PYROTECH.get().barrel.add(recipe); return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java index 4a5ed7ccc..be353d280 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -131,7 +132,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable BrickKilnRecipe register() { if (!validate()) return null; BrickKilnRecipe recipe = new BrickKilnRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); - PyroTech.brickKiln.add(recipe); + ModSupport.PYROTECH.get().brickKiln.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index 6a105eb61..5f5ad6b01 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -100,7 +101,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable BrickOvenRecipe register() { if (!validate()) return null; BrickOvenRecipe recipe = new BrickOvenRecipe(output.get(0), input.get(0).toMcIngredient(), duration).setRegistryName(super.name); - PyroTech.brickOven.add(recipe); + ModSupport.PYROTECH.get().brickOven.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java index 03380321a..03035e808 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -101,7 +102,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable CampfireRecipe register() { if (!validate()) return null; CampfireRecipe recipe = new CampfireRecipe(output.get(0), input.get(0).toMcIngredient(), duration).setRegistryName(super.name); - PyroTech.campfire.add(recipe); + ModSupport.PYROTECH.get().campfire.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java index 48b256733..22ecb644c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -99,7 +100,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable ChoppingBlockRecipe register() { if (!validate()) return null; ChoppingBlockRecipe recipe = new ChoppingBlockRecipe(output.get(0), input.get(0).toMcIngredient(), chops.toIntArray(), quantities.toIntArray()).setRegistryName(super.name); - PyroTech.choppingBlock.add(recipe); + ModSupport.PYROTECH.get().choppingBlock.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index 472700397..d0396d460 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -96,7 +97,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable CompactingBinRecipe register() { if (!validate()) return null; CompactingBinRecipe recipe = new CompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), toolUses).setRegistryName(super.name); - PyroTech.compactingBin.add(recipe); + ModSupport.PYROTECH.get().compactingBin.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index ef26472c2..1ac0d002d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -108,12 +109,12 @@ public void validate(GroovyLog.Msg msg) { for (ItemStack i : in) { ResourceLocation rl = new ResourceLocation(super.name.getNamespace(), super.name.getPath() + "_" + (j++)); CompostBinRecipe recipe = new CompostBinRecipe(output.get(0), i, compostValue).setRegistryName(rl); - PyroTech.compostBin.add(recipe); + ModSupport.PYROTECH.get().compostBin.add(recipe); } return null; } CompostBinRecipe recipe = new CompostBinRecipe(output.get(0), in[0], compostValue).setRegistryName(super.name); - PyroTech.compostBin.add(recipe); + ModSupport.PYROTECH.get().compostBin.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index eb626fe7e..fc0ca5057 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -102,7 +103,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable CrudeDryingRackRecipe register() { if (!validate()) return null; CrudeDryingRackRecipe recipe = new CrudeDryingRackRecipe(output.get(0), input.get(0).toMcIngredient(), dryTime).setRegistryName(super.name); - PyroTech.crudeDryingRack.add(recipe); + ModSupport.PYROTECH.get().crudeDryingRack.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java index 24fba6e76..81b419f2e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -102,7 +103,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable DryingRackRecipe register() { if (!validate()) return null; DryingRackRecipe recipe = new DryingRackRecipe(output.get(0), input.get(0).toMcIngredient(), dryTime).setRegistryName(super.name); - PyroTech.dryingRack.add(recipe); + ModSupport.PYROTECH.get().dryingRack.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index 89ead0c33..fd98a38c8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; @@ -137,7 +138,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable KilnPitRecipe register() { if (!validate()) return null; KilnPitRecipe recipe = new KilnPitRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); - PyroTech.pitKiln.add(recipe); + ModSupport.PYROTECH.get().pitKiln.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java index 0df399e31..344bdd7cb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java @@ -1,22 +1,51 @@ package com.cleanroommc.groovyscript.compat.mods.pyrotech; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; +import com.codetaylor.mc.pyrotech.ModPyrotechConfig; +import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; + +import java.util.function.Supplier; public class PyroTech extends GroovyPropertyContainer { - public static final Barrel barrel = new Barrel(); - public static final Campfire campfire = new Campfire(); - public static final StoneOven stoneOven = new StoneOven(); - public static final BrickOven brickOven = new BrickOven(); - public static final ChoppingBlock choppingBlock = new ChoppingBlock(); - public static final CompactingBin compactingBin = new CompactingBin(); - public static final CompostBin compostBin = new CompostBin(); - public static final CrudeDryingRack crudeDryingRack = new CrudeDryingRack(); - public static final DryingRack dryingRack = new DryingRack(); - public static final PitKiln pitKiln = new PitKiln(); - public static final StoneKiln stoneKiln = new StoneKiln(); - public static final BrickKiln brickKiln = new BrickKiln(); - public static final Anvil anvil = new Anvil(); - public static final SoakingPot soakingPot = new SoakingPot(); - public static final TanningRack tanningRack = new TanningRack(); + public final Barrel barrel; + public final Campfire campfire; + public final StoneOven stoneOven; + public final BrickOven brickOven; + public final ChoppingBlock choppingBlock; + public final CompactingBin compactingBin; + public final CompostBin compostBin; + public final CrudeDryingRack crudeDryingRack; + public final DryingRack dryingRack; + public final PitKiln pitKiln; + public final StoneKiln stoneKiln; + public final BrickKiln brickKiln; + public final Anvil anvil; + public final SoakingPot soakingPot; + public final TanningRack tanningRack; + + public PyroTech() { + this.barrel = register(ModuleTechBasic.MODULE_ID, Barrel::new); + this.campfire = register(ModuleTechBasic.MODULE_ID, Campfire::new); + this.stoneOven = register(ModuleTechMachine.MODULE_ID, StoneOven::new); + this.brickOven = register(ModuleTechMachine.MODULE_ID, BrickOven::new); + this.choppingBlock = register(ModuleTechBasic.MODULE_ID, ChoppingBlock::new); + this.compactingBin = register(ModuleTechBasic.MODULE_ID, CompactingBin::new); + this.compostBin = register(ModuleTechBasic.MODULE_ID, CompostBin::new); + this.crudeDryingRack = register(ModuleTechBasic.MODULE_ID, CrudeDryingRack::new); + this.dryingRack = register(ModuleTechBasic.MODULE_ID, DryingRack::new); + this.pitKiln = register(ModuleTechBasic.MODULE_ID, PitKiln::new); + this.stoneKiln = register(ModuleTechMachine.MODULE_ID, StoneKiln::new); + this.brickKiln = register(ModuleTechMachine.MODULE_ID, BrickKiln::new); + this.anvil = register(ModuleTechBasic.MODULE_ID, Anvil::new); + this.soakingPot = register(ModuleTechBasic.MODULE_ID, SoakingPot::new); + this.tanningRack = register(ModuleTechBasic.MODULE_ID, TanningRack::new); + } + + private static T register(String moduleName, Supplier supplier) { + Boolean bool = ModPyrotechConfig.MODULES.get(moduleName); + if (bool != null && bool) return supplier.get(); + return null; + } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java index fd742bc58..acf34c862 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -112,7 +113,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable SoakingPotRecipe register() { if (!validate()) return null; SoakingPotRecipe recipe = new SoakingPotRecipe(output.get(0), input.get(0).toMcIngredient(), fluidInput.get(0), campfireRequired, time).setRegistryName(super.name); - PyroTech.soakingPot.add(recipe); + ModSupport.PYROTECH.get().soakingPot.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java index bcbad0dbb..ca002e33e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; @@ -131,7 +132,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable StoneKilnRecipe register() { if (!validate()) return null; StoneKilnRecipe recipe = new StoneKilnRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); - PyroTech.stoneKiln.add(recipe); + ModSupport.PYROTECH.get().stoneKiln.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java index 4f5eeabbf..a6b2cec2b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -100,7 +101,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable StoneOvenRecipe register() { if (!validate()) return null; StoneOvenRecipe recipe = new StoneOvenRecipe(output.get(0), input.get(0).toMcIngredient(), duration).setRegistryName(super.name); - PyroTech.stoneOven.add(recipe); + ModSupport.PYROTECH.get().stoneOven.add(recipe); return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java index 101be6bd6..8af541037 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java @@ -3,6 +3,7 @@ import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; @@ -112,7 +113,7 @@ public void validate(GroovyLog.Msg msg) { public @Nullable TanningRackRecipe register() { if (!validate()) return null; TanningRackRecipe recipe = new TanningRackRecipe(output.get(0), input.get(0).toMcIngredient(), failureItem, dryTime).setRegistryName(super.name); - PyroTech.tanningRack.add(recipe); + ModSupport.PYROTECH.get().tanningRack.add(recipe); return recipe; } } From bbfcabaedbd8f1ee1be7fef57a0c69617292578a Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Thu, 18 Sep 2025 16:24:54 +0300 Subject: [PATCH 02/13] Fix Pyrotech examples. Some machines can't have inputs with stack sizes larger than one. --- .../postInit/generated/pyrotech_generated.groovy | 14 +++++++------- .../groovyscript/compat/mods/pyrotech/Anvil.java | 6 +++--- .../compat/mods/pyrotech/CompostBin.java | 2 +- .../groovyscript/compat/mods/pyrotech/PitKiln.java | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/postInit/generated/pyrotech_generated.groovy b/examples/postInit/generated/pyrotech_generated.groovy index 192d26f13..a5486ee58 100644 --- a/examples/postInit/generated/pyrotech_generated.groovy +++ b/examples/postInit/generated/pyrotech_generated.groovy @@ -11,7 +11,7 @@ mods.pyrotech.anvil.removeByOutput(item('minecraft:stone_slab', 3)) // mods.pyrotech.anvil.removeAll() mods.pyrotech.anvil.recipeBuilder() - .input(item('minecraft:diamond') * 4) + .input(item('minecraft:diamond')) .output(item('minecraft:emerald') * 2) .hits(5) .typeHammer() @@ -20,21 +20,21 @@ mods.pyrotech.anvil.recipeBuilder() .register() mods.pyrotech.anvil.recipeBuilder() - .input(item('minecraft:diamond') * 8) + .input(item('minecraft:bedrock')) .output(item('minecraft:nether_star') * 1) .hits(10) .typePickaxe() .tierIronclad() - .name('diamond_to_nether_star_ironclad_anvil') + .name('bedrock_to_nether_star_ironclad_anvil') .register() mods.pyrotech.anvil.recipeBuilder() - .input(item('minecraft:diamond') * 4) + .input(item('minecraft:gold_block')) .output(item('minecraft:gold_ingot') * 16) .hits(5) .typePickaxe() .tierObsidian() - .name('diamond_to_gold_obsidian_anvil') + .name('gold_block_to_gold_obsidian_anvil') .register() @@ -158,7 +158,7 @@ mods.pyrotech.compost_bin.recipeBuilder() .register() -mods.pyrotech.compost_bin.add('iron_to_clay2', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, 2) +mods.pyrotech.compost_bin.add('iron_to_clay2', ore('ingotIron'), item('minecraft:clay_ball') * 20, 2) // Crude Drying Rack: // Converts an item over time into a new one. @@ -208,7 +208,7 @@ mods.pyrotech.pit_kiln.recipeBuilder() .register() -mods.pyrotech.pit_kiln.add('clay_to_iron', item('minecraft:clay_ball') * 5, item('minecraft:iron_ingot'), 1200, 0.5f, [item('minecraft:dirt'), item('minecraft:cobblestone')]) +mods.pyrotech.pit_kiln.add('brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, 0.5f, [item('minecraft:dirt'), item('minecraft:cobblestone')]) // Soaking Pot: // Converts an item into a new one by soaking it in a liquid. Can require a campfire. diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index 207280603..19c0e650b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -23,9 +23,9 @@ public Anvil() { } @RecipeBuilderDescription(example = { - @Example(".input(item('minecraft:diamond') * 4).output(item('minecraft:emerald') * 2).hits(5).typeHammer().tierGranite().name('diamond_to_emerald_granite_anvil')"), - @Example(".input(item('minecraft:diamond') * 8).output(item('minecraft:nether_star') * 1).hits(10).typePickaxe().tierIronclad().name('diamond_to_nether_star_ironclad_anvil')"), - @Example(".input(item('minecraft:diamond') * 4).output(item('minecraft:gold_ingot') * 16).hits(5).typePickaxe().tierObsidian().name('diamond_to_gold_obsidian_anvil')") + @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald') * 2).hits(5).typeHammer().tierGranite().name('diamond_to_emerald_granite_anvil')"), + @Example(".input(item('minecraft:bedrock')).output(item('minecraft:nether_star') * 1).hits(10).typePickaxe().tierIronclad().name('bedrock_to_nether_star_ironclad_anvil')"), + @Example(".input(item('minecraft:gold_block')).output(item('minecraft:gold_ingot') * 16).hits(5).typePickaxe().tierObsidian().name('gold_block_to_gold_obsidian_anvil')") }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index 1ac0d002d..37856a897 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -26,7 +26,7 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'iron_to_clay2', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, 2")) + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'iron_to_clay2', ore('ingotIron'), item('minecraft:clay_ball') * 20, 2")) public CompostBinRecipe add(String name, IIngredient input, ItemStack output, int compostValue) { return recipeBuilder() .compostValue(compostValue) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index fd98a38c8..8d9ea20c4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -26,7 +26,7 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'clay_to_iron', item('minecraft:clay_ball') * 5, item('minecraft:iron_ingot'), 1200, 0.5f, [item('minecraft:dirt'), item('minecraft:cobblestone')]")) + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, 0.5f, [item('minecraft:dirt'), item('minecraft:cobblestone')]")) public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, Iterable failureOutput) { return recipeBuilder() .burnTime(burnTime) From 0a62e58a94b7d59706c3a34b5fa7c456e29709b1 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Fri, 19 Sep 2025 21:07:21 +0300 Subject: [PATCH 03/13] Update examples, add inheritance and add support for missing machines. - Update examples to show inheritance. - Add inheritance. Inherited recipe will be added to the machines more advanced than the machine. - Add support for missing machines: sawmills, crucibles and Mechanical Compacting Bin. --- .../generated/pyrotech_generated.groovy | 183 +++++++++++++++--- .../compat/mods/pyrotech/Anvil.java | 68 +++++-- .../compat/mods/pyrotech/Barrel.java | 2 +- .../compat/mods/pyrotech/BrickCrucible.java | 109 +++++++++++ .../compat/mods/pyrotech/BrickKiln.java | 11 +- .../compat/mods/pyrotech/BrickOven.java | 8 +- .../compat/mods/pyrotech/BrickSawmill.java | 146 ++++++++++++++ .../compat/mods/pyrotech/Campfire.java | 4 +- .../compat/mods/pyrotech/ChoppingBlock.java | 59 +++++- .../compat/mods/pyrotech/CompactingBin.java | 52 +++-- .../compat/mods/pyrotech/CompostBin.java | 4 +- .../compat/mods/pyrotech/CrudeDryingRack.java | 38 +++- .../compat/mods/pyrotech/DryingRack.java | 36 +++- .../pyrotech/MechanicalCompactingBin.java | 115 +++++++++++ .../compat/mods/pyrotech/PitKiln.java | 41 +++- .../compat/mods/pyrotech/PyroTech.java | 50 +++-- .../compat/mods/pyrotech/SoakingPot.java | 5 +- .../compat/mods/pyrotech/StoneCrucible.java | 115 +++++++++++ .../compat/mods/pyrotech/StoneKiln.java | 40 +++- .../compat/mods/pyrotech/StoneOven.java | 29 ++- .../compat/mods/pyrotech/StoneSawmill.java | 172 ++++++++++++++++ .../compat/mods/pyrotech/TanningRack.java | 4 +- 22 files changed, 1168 insertions(+), 123 deletions(-) create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java diff --git a/examples/postInit/generated/pyrotech_generated.groovy b/examples/postInit/generated/pyrotech_generated.groovy index a5486ee58..c19de0851 100644 --- a/examples/postInit/generated/pyrotech_generated.groovy +++ b/examples/postInit/generated/pyrotech_generated.groovy @@ -7,13 +7,14 @@ log 'mod \'pyrotech\' detected, running script' // Anvil: // When using hammer or pickaxe it can convert items. -mods.pyrotech.anvil.removeByOutput(item('minecraft:stone_slab', 3)) +mods.pyrotech.anvil.removeByInput(item('pyrotech:material:37')) +mods.pyrotech.anvil.removeByOutput(item('minecraft:stone_slab:3') * 2) // mods.pyrotech.anvil.removeAll() mods.pyrotech.anvil.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:emerald') * 2) - .hits(5) + .hits(8) .typeHammer() .tierGranite() .name('diamond_to_emerald_granite_anvil') @@ -25,7 +26,8 @@ mods.pyrotech.anvil.recipeBuilder() .hits(10) .typePickaxe() .tierIronclad() - .name('bedrock_to_nether_star_ironclad_anvil') + .inherit(true) + .name('bedrock_to_nether_star') .register() mods.pyrotech.anvil.recipeBuilder() @@ -38,7 +40,7 @@ mods.pyrotech.anvil.recipeBuilder() .register() -mods.pyrotech.anvil.add('iron_to_clay', ore('ingotIron'), item('minecraft:clay_ball'), 9, 'granite', 'hammer') +mods.pyrotech.anvil.add('flint_from_gravel', ore('gravel'), item('minecraft:flint'), 5, 'granite', 'pickaxe', true) // Barrel: // Over time converts a fluid with four items into a new fluid. @@ -60,20 +62,21 @@ mods.pyrotech.barrel.add('iron_dirt_water_to_lava', ore('ingotIron'), ore('ingot // Refractory Kiln: // Converts an item into a new one by burning it. Has a chance to fail. +mods.pyrotech.brick_kiln.removeByInput(item('minecraft:cobblestone')) mods.pyrotech.brick_kiln.removeByOutput(item('pyrotech:bucket_clay')) // mods.pyrotech.brick_kiln.removeAll() mods.pyrotech.brick_kiln.recipeBuilder() - .input(item('minecraft:iron_ingot')) - .output(item('minecraft:gold_ingot')) - .burnTime(400) - .failureChance(1f) - .failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')) - .name('iron_to_gold_kiln_with_failure_items_brick') + .input(item('minecraft:fish')) + .output(item('minecraft:cooked_fish')) + .burnTime(200000) + .failureChance(0.99f) + .failureOutput(item('minecraft:dragon_egg'), item('minecraft:dragon_breath')) + .name('meaning_of_life') .register() -mods.pyrotech.brick_kiln.add('clay_to_iron_brick', item('minecraft:clay_ball') * 5, item('minecraft:iron_ingot'), 1200, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')) +mods.pyrotech.brick_kiln.add('beetroot_soup', item('minecraft:beetroot'), item('minecraft:beetroot_soup'), 1200, 0.1f, item('minecraft:beetroot_seeds')) // Refractory Oven: // When powered by burning fuel can convert items. @@ -83,14 +86,33 @@ mods.pyrotech.brick_oven.removeByOutput(item('minecraft:cooked_porkchop')) // mods.pyrotech.brick_oven.removeAll() mods.pyrotech.brick_oven.recipeBuilder() - .input(item('minecraft:diamond')) - .output(item('minecraft:emerald')) - .duration(400) - .name('diamond_campfire_to_emerald_brick') + .input(item('minecraft:chorus_fruit')) + .output(item('minecraft:chorus_fruit_popped')) + .duration(800) + .name('chorus_fruit_whats_popping') + .register() + + +mods.pyrotech.brick_oven.add('lead_poisoning', item('minecraft:slime_ball'), item('minecraft:lead') * 16, 1000) + +// groovyscript.wiki.pyrotech.brick_sawmill.title: +// groovyscript.wiki.pyrotech.brick_sawmill.description. + +mods.pyrotech.brick_sawmill.removeByInput(item('minecraft:planks:1')) +mods.pyrotech.brick_sawmill.removeByOutput(item('pyrotech:material:23')) +// mods.pyrotech.brick_sawmill.removeAll() + +mods.pyrotech.brick_sawmill.recipeBuilder() + .input(item('minecraft:golden_helmet')) + .output(item('minecraft:gold_ingot') * 2) + .duration(1500) + .woodChips(5) + .name('golden_helmet_recycling') .register() -mods.pyrotech.brick_oven.add('apple_to_dirt_brick', item('minecraft:apple'), item('minecraft:dirt'), 1000) +mods.pyrotech.brick_sawmill.add('glowstone_to_dust', item('minecraft:glowstone'), item('pyrotech:sawmill_blade_stone'), item('minecraft:glowstone_dust'), 200, 0) +mods.pyrotech.brick_sawmill.add('bed_to_wool', item('minecraft:bed'), item('minecraft:wool') * 3, 500, 3) // Campfire: // When powered by burning logs can convert items. @@ -126,6 +148,13 @@ mods.pyrotech.chopping_block.recipeBuilder() .name('diamond_to_emerald_chopping_block') .register() +mods.pyrotech.chopping_block.recipeBuilder() + .input(item('minecraft:iron_ingot')) + .output(item('minecraft:gold_ingot')) + .inherit(true) + .name('iron_to_gold_chopping_block') + .register() + // Compacting Bin: // When using a shovel it can convert items. @@ -137,17 +166,25 @@ mods.pyrotech.compacting_bin.removeByOutput(item('minecraft:bone_block')) mods.pyrotech.compacting_bin.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:emerald')) - .toolUses(5) - .name('diamond_to_emerald_compacting_bin') + .hits(5, 4, 3, 2) + .inherit(true) + .name('diamond_to_emerald') + .register() + +mods.pyrotech.compacting_bin.recipeBuilder() + .input(item('minecraft:slime_ball') * 9) + .output(item('minecraft:slime')) + .name('slime_compacting') .register() -mods.pyrotech.compacting_bin.add('iron_to_clay', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, 9) +mods.pyrotech.compacting_bin.add('iron_to_clay', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, false, 9, 7, 6, 6) // Compost Bin: // Can convert multiple items into a new one when its full. mods.pyrotech.compost_bin.removeByInput(item('minecraft:golden_carrot')) +// mods.pyrotech.compost_bin.removeByOutput(item('pyrotech:mulch') * 4) // mods.pyrotech.compost_bin.removeAll() mods.pyrotech.compost_bin.recipeBuilder() @@ -164,6 +201,7 @@ mods.pyrotech.compost_bin.add('iron_to_clay2', ore('ingotIron'), item('minecraft // Converts an item over time into a new one. mods.pyrotech.crude_drying_rack.removeByInput(item('minecraft:wheat')) +mods.pyrotech.crude_drying_rack.removeByOutput(item('minecraft:paper')) // mods.pyrotech.crude_drying_rack.removeAll() mods.pyrotech.crude_drying_rack.recipeBuilder() @@ -173,13 +211,22 @@ mods.pyrotech.crude_drying_rack.recipeBuilder() .name('diamond_to_emerald_crude_drying_rack') .register() +mods.pyrotech.crude_drying_rack.recipeBuilder() + .input(item('minecraft:glowstone_dust')) + .output(item('minecraft:redstone')) + .dryTime(1000) + .inherit(true) + .name('glowstone_to_redstone') + .register() -mods.pyrotech.crude_drying_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200) + +mods.pyrotech.crude_drying_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true) // Drying Rack: // Converts an item over time into a new one. mods.pyrotech.drying_rack.removeByInput(item('minecraft:wheat')) +mods.pyrotech.drying_rack.removeByOutput(item('minecraft:sponge')) // mods.pyrotech.drying_rack.removeAll() mods.pyrotech.drying_rack.recipeBuilder() @@ -189,12 +236,39 @@ mods.pyrotech.drying_rack.recipeBuilder() .name('iron_to_gold_drying_rack') .register() +mods.pyrotech.drying_rack.recipeBuilder() + .input(item('minecraft:ender_eye')) + .output(item('minecraft:ender_pearl')) + .dryTime(500) + .inherit(true) + .name('ender_eye_to_ender_pearl') + .register() + + +mods.pyrotech.drying_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true) + +// groovyscript.wiki.pyrotech.mechanical_compacting_bin.title: +// groovyscript.wiki.pyrotech.mechanical_compacting_bin.description. + +mods.pyrotech.mechanical_compacting_bin.removeByInput(item('minecraft:snowball')) +mods.pyrotech.mechanical_compacting_bin.removeByOutput(item('minecraft:bone_block')) +// mods.pyrotech.mechanical_compacting_bin.removeAll() + +mods.pyrotech.mechanical_compacting_bin.recipeBuilder() + .hits(2, 2, 1, 1) + .input(item('minecraft:melon') * 8) + .output(item('minecraft:melon_block')) + .name('melon_compacting') + .register() + -mods.pyrotech.drying_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200) +mods.pyrotech.mechanical_compacting_bin.add('wheat_to_hay_block', ore('cropWheat') * 9, item('minecraft:hay_block')) +mods.pyrotech.mechanical_compacting_bin.add('gold_to_wheat', ore('ingotGold') * 4, item('minecraft:wheat') * 64, 4, 4, 3, 2) // Pit Kiln: // Converts an item into a new one by burning it. Has a chance to fail. +mods.pyrotech.pit_kiln.removeByInput(item('pyrotech:bucket_refractory_unfired')) mods.pyrotech.pit_kiln.removeByOutput(item('pyrotech:bucket_clay')) // mods.pyrotech.pit_kiln.removeAll() @@ -207,12 +281,22 @@ mods.pyrotech.pit_kiln.recipeBuilder() .name('iron_to_gold_kiln_with_failure_items') .register() +mods.pyrotech.pit_kiln.recipeBuilder() + .input(item('minecraft:record_11')) + .output(item('minecraft:record_13')) + .burnTime(200) + .failureChance(0f) + .inherit(true) + .name('record_11_to_record_13') + .register() -mods.pyrotech.pit_kiln.add('brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, 0.5f, [item('minecraft:dirt'), item('minecraft:cobblestone')]) + +mods.pyrotech.pit_kiln.add('brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')) // Soaking Pot: // Converts an item into a new one by soaking it in a liquid. Can require a campfire. +mods.pyrotech.soaking_pot.removeByInput(item('pyrotech:hide_washed')) mods.pyrotech.soaking_pot.removeByOutput(item('pyrotech:material', 54)) // mods.pyrotech.soaking_pot.removeAll() @@ -231,20 +315,30 @@ mods.pyrotech.soaking_pot.add('dirt_to_apple', item('minecraft:dirt'), fluid('wa // Stone Kiln: // Converts an item into a new one by burning it. Has a chance to fail. +mods.pyrotech.stone_kiln.removeByInput(item('minecraft:sand')) mods.pyrotech.stone_kiln.removeByOutput(item('pyrotech:bucket_clay')) // mods.pyrotech.stone_kiln.removeAll() mods.pyrotech.stone_kiln.recipeBuilder() - .input(item('minecraft:iron_ingot')) - .output(item('minecraft:gold_ingot')) - .burnTime(400) - .failureChance(1f) - .failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')) - .name('iron_to_gold_kiln_with_failure_items_stone') + .input(item('minecraft:diamond')) + .output(item('minecraft:emerald')) + .burnTime(800) + .failureChance(0.6f) + .failureOutput(item('minecraft:egg'), item('minecraft:fish')) + .name('diamond_to_emerald_with_failure_outputs') + .register() + +mods.pyrotech.stone_kiln.recipeBuilder() + .input(item('minecraft:compass')) + .output(item('minecraft:clock')) + .burnTime(1200) + .failureChance(0f) + .inherit(true) + .name('compass_to_clock') .register() -mods.pyrotech.stone_kiln.add('clay_to_iron_stone', item('minecraft:clay_ball') * 5, item('minecraft:iron_ingot'), 1200, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')) +mods.pyrotech.stone_kiln.add('clay_to_iron_stone', item('minecraft:clay_ball'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')) // Stone Oven: // When powered by burning fuel can convert items. @@ -257,16 +351,45 @@ mods.pyrotech.stone_oven.recipeBuilder() .input(item('minecraft:diamond')) .output(item('minecraft:emerald')) .duration(400) + .inherit(true) .name('diamond_campfire_to_emerald_stone') .register() -mods.pyrotech.stone_oven.add('apple_to_dirt_stone', item('minecraft:apple'), item('minecraft:dirt'), 1000) +mods.pyrotech.stone_oven.add('sand_to_dirt', item('minecraft:sand'), item('minecraft:dirt'), 1000, true) + +// groovyscript.wiki.pyrotech.stone_sawmill.title: +// groovyscript.wiki.pyrotech.stone_sawmill.description. + +mods.pyrotech.stone_sawmill.removeByInput(item('minecraft:planks:1')) +mods.pyrotech.stone_sawmill.removeByOutput(item('pyrotech:material:23')) +// mods.pyrotech.stone_sawmill.removeAll() + +mods.pyrotech.stone_sawmill.recipeBuilder() + .input(item('minecraft:sign')) + .output(item('minecraft:planks:0') * 2) + .duration(200) + .woodChips(5) + .inherit(true) + .name('wood_from_sign') + .register() + +mods.pyrotech.stone_sawmill.recipeBuilder() + .input(item('minecraft:stone_pickaxe'), ore('blockIron')) + .output(item('minecraft:iron_pickaxe')) + .duration(5000) + .name('stone_pickaxe_upgrade') + .register() + + +mods.pyrotech.stone_sawmill.add('apple_to_gapple_with_golden_blade', item('minecraft:apple'), item('pyrotech:sawmill_blade_bone'), item('minecraft:golden_apple'), 2000, 0, false) +mods.pyrotech.stone_sawmill.add('stone_to_cobblestone', ore('stone'), item('minecraft:cobblestone'), 500, 0, true) // Tanning Rack: // Converts an item over time into a new one. mods.pyrotech.tanning_rack.removeByInput(item('minecraft:wheat')) +mods.pyrotech.tanning_rack.removeByOutput(item('minecraft:leather')) // mods.pyrotech.tanning_rack.removeAll() mods.pyrotech.tanning_rack.recipeBuilder() diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index 19c0e650b..69ff54319 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -9,11 +9,15 @@ import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; +import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.AnvilIroncladRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.AnvilObsidianRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.AnvilRecipe; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.Nullable; import java.util.Arrays; +import java.util.Locale; @RegistryDescription public class Anvil extends ForgeRegistryWrapper { @@ -23,16 +27,20 @@ public Anvil() { } @RecipeBuilderDescription(example = { - @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald') * 2).hits(5).typeHammer().tierGranite().name('diamond_to_emerald_granite_anvil')"), - @Example(".input(item('minecraft:bedrock')).output(item('minecraft:nether_star') * 1).hits(10).typePickaxe().tierIronclad().name('bedrock_to_nether_star_ironclad_anvil')"), + @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald') * 2).hits(8).typeHammer().tierGranite().name('diamond_to_emerald_granite_anvil')"), + @Example(".input(item('minecraft:bedrock')).output(item('minecraft:nether_star') * 1).hits(10).typePickaxe().tierIronclad().inherit(true).name('bedrock_to_nether_star')"), @Example(".input(item('minecraft:gold_block')).output(item('minecraft:gold_ingot') * 16).hits(5).typePickaxe().tierObsidian().name('gold_block_to_gold_obsidian_anvil')") }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'iron_to_clay', ore('ingotIron'), item('minecraft:clay_ball'), 9, 'granite', 'hammer'")) public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hits, String tier, String type) { + return add(name, input, output, hits, tier, type, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'flint_from_gravel', ore('gravel'), item('minecraft:flint'), 5, 'granite', 'pickaxe', true")) + public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hits, String tier, String type, boolean inherit) { AnvilRecipe.EnumTier enumTier = EnumHelper.valueOfNullable(AnvilRecipe.EnumTier.class, tier, false); AnvilRecipe.EnumType enumType = EnumHelper.valueOfNullable(AnvilRecipe.EnumType.class, type, false); if (enumTier == null || enumType == null) { @@ -47,14 +55,30 @@ public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hit .hits(hits) .tier(enumTier) .type(enumType) + .inherit(inherit) .name(name) .input(input) .output(output) .register(); } - @MethodDescription(example = @Example("item('minecraft:stone_slab', 3)")) - public void removeByOutput(ItemStack output) { + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:material:37')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing pyrotech anvil recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (AnvilRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:stone_slab:3') * 2")) + public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing pyrotech anvil recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") .error() @@ -62,7 +86,7 @@ public void removeByOutput(ItemStack output) { return; } for (AnvilRecipe recipe : getRegistry()) { - if (recipe.getOutput().isItemEqual(output)) { + if (output.test(recipe.getOutput())) { remove(recipe); } } @@ -75,13 +99,12 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { @Property(comp = @Comp(gt = 0)) private int hits; - @Property private AnvilRecipe.EnumType type; - @Property private AnvilRecipe.EnumTier tier; - + @Property + private boolean inherit; @RecipeBuilderMethodDescription public RecipeBuilder hits(int hits) { @@ -105,7 +128,6 @@ public RecipeBuilder typePickaxe() { return type(AnvilRecipe.EnumType.PICKAXE); } - @RecipeBuilderMethodDescription public RecipeBuilder tier(AnvilRecipe.EnumTier tier) { this.tier = tier; return this; @@ -126,6 +148,12 @@ public RecipeBuilder tierObsidian() { return tier(AnvilRecipe.EnumTier.OBSIDIAN); } + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; + return this; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Anvil Recipe"; @@ -141,19 +169,33 @@ protected int getMaxItemInput() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); msg.add(hits < 0, "duration must be a non negative integer, yet it was {}", hits); - msg.add(type == null, "type cannot be null. "); + msg.add(type == null, "type cannot be null."); msg.add(tier == null, "tier cannot be null."); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.ANVIL_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + msg.add(tier == AnvilRecipe.EnumTier.OBSIDIAN && inherit, "nothing can inherit from obsidian anvil."); } - @Override @RecipeBuilderRegistrationMethod + @Override public @Nullable AnvilRecipe register() { if (!validate()) return null; - AnvilRecipe recipe = new AnvilRecipe(output.get(0), input.get(0).toMcIngredient(), hits, type, tier).setRegistryName(super.name); ModSupport.PYROTECH.get().anvil.add(recipe); + if (inherit) { + String name = null; + if (tier.ordinal() < 2) { + name = tier.name().toLowerCase(Locale.US) + "_anvil"; + AnvilRecipe obsidianRecipe = AnvilObsidianRecipesAdd.INHERIT_TRANSFORMER.apply(recipe); + obsidianRecipe.setRegistryName(new ResourceLocation(super.name.getNamespace(), name + "/" + super.name.getPath())); + ModSupport.PYROTECH.get().anvil.add(obsidianRecipe); + } + if (tier.ordinal() < 1) { + AnvilRecipe ironcladRecipe = AnvilIroncladRecipesAdd.INHERIT_TRANSFORMER.apply(recipe); + ironcladRecipe.setRegistryName(new ResourceLocation(super.name.getNamespace(), name + "/" + super.name.getPath())); + ModSupport.PYROTECH.get().anvil.add(ironcladRecipe); + } + } return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java index 31349397d..fd9bf9b18 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java @@ -39,7 +39,7 @@ public BarrelRecipe add(String name, IIngredient input1, IIngredient input2, IIn .register(); } - @MethodDescription(example = @Example("fluid('freckleberry_wine') * 1000")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("fluid('freckleberry_wine') * 1000")) public void removeByOutput(FluidStack output) { if (GroovyLog.msg("Error removing barrel recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java new file mode 100644 index 000000000..374688b79 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java @@ -0,0 +1,109 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickCrucibleRecipe; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +import org.jetbrains.annotations.Nullable; + +public class BrickCrucible extends ForgeRegistryWrapper { + + public BrickCrucible() { + super(ModuleTechMachine.Registries.BRICK_CRUCIBLE_RECIPES); + } + + @RecipeBuilderDescription(example = @Example("input(item('minecraft:vine')).fluidOutput(fluid('water') * 250).burnTime(60).name('water_from_vine')")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'lava_from_obsidian', ore('obsidian'), fluid('lava') * 1000, 2000")) + public BrickCrucibleRecipe add(String name, IIngredient input, FluidStack output, int burnTime) { + return recipeBuilder() + .burnTime(burnTime) + .name(name) + .input(input) + .fluidOutput(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:gravel')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing refractory crucible recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (BrickCrucibleRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("fluid('water') * 125")) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing refractory crucible recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (BrickCrucibleRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "fluidOutput", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int burnTime; + + @RecipeBuilderMethodDescription + public RecipeBuilder burnTime(int burnTime) { + this.burnTime = burnTime; + return this; + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Refractory Crucible Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 0, 0); + validateFluids(msg, 0, 0, 1, 1); + msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(super.name == null, "name cannot be null"); + msg.add(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable BrickCrucibleRecipe register() { + if (!validate()) return null; + BrickCrucibleRecipe recipe = new BrickCrucibleRecipe(fluidOutput.get(0), input.get(0).toMcIngredient(), burnTime).setRegistryName(super.name); + ModSupport.PYROTECH.get().brickCrucible.add(recipe); + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java index be353d280..fadd269aa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java @@ -20,12 +20,12 @@ public BrickKiln() { super(ModuleTechMachine.Registries.BRICK_KILN_RECIPES); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).burnTime(400).failureChance(1f).failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')).name('iron_to_gold_kiln_with_failure_items_brick')")) + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:fish')).output(item('minecraft:cooked_fish')).burnTime(200000).failureChance(0.99f).failureOutput(item('minecraft:dragon_egg'), item('minecraft:dragon_breath')).name('meaning_of_life')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'clay_to_iron_brick', item('minecraft:clay_ball') * 5, item('minecraft:iron_ingot'), 1200, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'beetroot_soup', item('minecraft:beetroot'), item('minecraft:beetroot_soup'), 1200, 0.1f, item('minecraft:beetroot_seeds')")) public BrickKilnRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, ItemStack... failureOutput) { return recipeBuilder() .burnTime(burnTime) @@ -37,7 +37,7 @@ public BrickKilnRecipe add(String name, IIngredient input, ItemStack output, int .register(); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:cobblestone')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing refractory oven recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -107,7 +107,9 @@ public RecipeBuilder failureOutput(ItemStack... failureOutputs) { @RecipeBuilderMethodDescription public RecipeBuilder failureOutput(Iterable failureOutputs) { - for (ItemStack itemStack : failureOutputs) failureOutput(itemStack); + for (ItemStack itemStack : failureOutputs) { + failureOutput(itemStack); + } return this; } @@ -120,7 +122,6 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); - validateCustom(msg, failureOutput, 1, 100, "failure output"); msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); msg.add(super.name == null, "name cannot be null."); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index 5f5ad6b01..41f672366 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -24,12 +24,12 @@ public BrickOven() { super(ModuleTechMachine.Registries.BRICK_OVEN_RECIPES); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).duration(400).name('diamond_campfire_to_emerald_brick')")) + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:chorus_fruit')).output(item('minecraft:chorus_fruit_popped')).duration(800).name('chorus_fruit_whats_popping')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_dirt_brick', item('minecraft:apple'), item('minecraft:dirt'), 1000")) + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'lead_poisoning', item('minecraft:slime_ball'), item('minecraft:lead') * 16, 1000")) public BrickOvenRecipe add(String name, IIngredient input, ItemStack output, int duration) { return recipeBuilder() .duration(duration) @@ -39,7 +39,7 @@ public BrickOvenRecipe add(String name, IIngredient input, ItemStack output, int .register(); } - @MethodDescription(example = @Example("item('minecraft:porkchop')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:porkchop')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing brick oven recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -54,7 +54,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('minecraft:cooked_porkchop')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:cooked_porkchop')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing brick oven recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java new file mode 100644 index 000000000..b44cdd32f --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java @@ -0,0 +1,146 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickSawmillRecipe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.oredict.OreDictionary; +import org.jetbrains.annotations.Nullable; + +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.sawmill.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true)) +public class BrickSawmill extends ForgeRegistryWrapper { + + public BrickSawmill() { + super(ModuleTechMachine.Registries.BRICK_SAWMILL_RECIPES); + } + + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:golden_helmet')).output(item('minecraft:gold_ingot') * 2).duration(1500).woodChips(5).name('golden_helmet_recycling')")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'bed_to_wool', item('minecraft:bed'), item('minecraft:wool') * 3, 500, 3")) + public BrickSawmillRecipe add(String name, IIngredient input, ItemStack output, int duration, int woodChips) { + return recipeBuilder() + .duration(duration) + .woodChips(woodChips) + .name(name) + .input(input) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'glowstone_to_dust', item('minecraft:glowstone'), item('pyrotech:sawmill_blade_stone'), item('minecraft:glowstone_dust'), 200, 0")) + public BrickSawmillRecipe add(String name, IIngredient input, IIngredient blade, ItemStack output, int duration, int woodChips) { + return recipeBuilder() + .duration(duration) + .woodChips(woodChips) + .name(name) + .input(input, blade) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:planks:1')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing refractory sawmill recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (BrickSawmillRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:material:23')")) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing refractory sawmill recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (BrickSawmillRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(gte = 1, lt = 3)) + @Property(property = "output", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int duration; + @Property(comp = @Comp(gte = 0)) + private int woodChips; + + @RecipeBuilderMethodDescription + public RecipeBuilder duration(int time) { + this.duration = time; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder woodChips(int woodChips) { + this.woodChips = woodChips; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Refractory Sawmill Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 2, 1, 1); + msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(super.name == null, "name cannot be null."); + msg.add(ModuleTechMachine.Registries.BRICK_SAWMILL_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable BrickSawmillRecipe register() { + if (!validate()) return null; + if (input.size() > 1) { + return this.addRecipe(1, 1, input.get(1).toMcIngredient(), 1, ""); + } + else { + BrickSawmillRecipe recipe = this.addRecipe(1, 1, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 1, ""); + this.addRecipe(2, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 2, "_flint_blade"); + this.addRecipe(2, 0.5, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_iron_blade"); + this.addRecipe(3, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_diamond_blade"); + return recipe; + } + } + + private BrickSawmillRecipe addRecipe(int outputMultiplier, double durationMultiplier, Ingredient blade, int woodChipsDivisor, String name) { + ItemStack out = output.get(0).copy(); + out.setCount(Math.min(output.get(0).getCount() * outputMultiplier, 64)); + BrickSawmillRecipe recipe = new BrickSawmillRecipe(out, input.get(0).toMcIngredient(), (int) ((double) duration * durationMultiplier), blade, woodChips / woodChipsDivisor).setRegistryName(new ResourceLocation(super.name.getNamespace(), super.name.getPath() + name)); + ModSupport.PYROTECH.get().brickSawmill.add(recipe); + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java index 03035e808..750a144eb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java @@ -34,7 +34,7 @@ public CampfireRecipe add(String name, IIngredient input, ItemStack output, int .register(); } - @MethodDescription(example = @Example("item('minecraft:porkchop')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:porkchop')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing campfire recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -49,7 +49,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('minecraft:cooked_porkchop')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:cooked_porkchop')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing campfire recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java index 22ecb644c..cd4734571 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java @@ -7,11 +7,18 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.ChoppingBlockRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachineConfig; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickSawmillRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneSawmillRecipe; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.Nullable; @RegistryDescription @@ -21,13 +28,15 @@ public ChoppingBlock() { super(ModuleTechBasic.Registries.CHOPPING_BLOCK_RECIPE); } - - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).chops(25, 1).chops(20, 1).chops(15, 1).chops(10, 2).name('diamond_to_emerald_chopping_block')")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).chops(25, 1).chops(20, 1).chops(15, 1).chops(10, 2).name('diamond_to_emerald_chopping_block')"), + @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).inherit(true).name('iron_to_gold_chopping_block')") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(example = @Example("item('minecraft:log2')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:log2')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing chopping block recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -42,7 +51,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('minecraft:planks', 4)")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:planks', 4)")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing chopping block recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -66,6 +75,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder i <= 0) || quantities.stream().anyMatch(i -> i <= 0), "chops and quantities must not have a negative integer value or zero"); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.CHOPPING_BLOCK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + msg.add(chops.size() != quantities.size(), "Size of chops and quantities should be equal"); } @RecipeBuilderRegistrationMethod @@ -101,7 +119,38 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; ChoppingBlockRecipe recipe = new ChoppingBlockRecipe(output.get(0), input.get(0).toMcIngredient(), chops.toIntArray(), quantities.toIntArray()).setRegistryName(super.name); ModSupport.PYROTECH.get().choppingBlock.add(recipe); + if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + addSawmillRecipes(ModuleTechMachineConfig.STONE_SAWMILL.INHERITED_CHOPPING_BLOCK_RECIPE_DURATION_MODIFIER); + } return recipe; } + + private void addSawmillRecipes(double durationModifier) { + ItemStack out = output.get(0).copy(); + Ingredient in = input.get(0).toMcIngredient(); + out.setCount(!quantities.isEmpty() ? quantities.get(0) : 1); + ResourceLocation registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_0"); + StoneSawmillRecipe recipe = (new StoneSawmillRecipe(out, in, (int)((!chops.isEmpty() ? chops.getInt(0) * 40.0 : 240.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, 32767)), 4)).setRegistryName(registryName); + ModSupport.PYROTECH.get().stoneSawmill.add(recipe); + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); + out = output.get(0).copy(); + out.setCount(quantities.size() > 1 ? quantities.get(1) : 2); + registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_1"); + recipe = (new StoneSawmillRecipe(out, in, (int)((chops.size() > 1 ? chops.getInt(1) * 40.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, 32767)), 2)).setRegistryName(registryName); + ModSupport.PYROTECH.get().stoneSawmill.add(recipe); + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); + out = output.get(0).copy(); + registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_2"); + out.setCount(quantities.size() > 2 ? quantities.get(2) : quantities.size() > 1 ? quantities.get(1) : 2); + recipe = (new StoneSawmillRecipe(out, in, (int)((chops.size() > 2 ? chops.getInt(2) * 60.0 : 120.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.OBSIDIAN_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); + ModSupport.PYROTECH.get().stoneSawmill.add(recipe); + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); + out = output.get(0).copy(); + out.setCount(quantities.size() > 3 ? quantities.get(3) : 3); + new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_3"); + recipe = (new StoneSawmillRecipe(out, in, (int)((chops.size() > 3 ? chops.getInt(3) * 80.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); + ModSupport.PYROTECH.get().stoneSawmill.add(recipe); + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); + } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index d0396d460..5a0051461 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -8,7 +8,12 @@ import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; +import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasicConfig; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CompactingBinRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.MechanicalCompactingBinRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.MechanicalCompactingBinRecipe; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; @@ -20,22 +25,30 @@ public CompactingBin() { super(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).toolUses(5).name('diamond_to_emerald_compacting_bin')")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).hits(5, 4, 3, 2).inherit(true).name('diamond_to_emerald')"), + @Example(".input(item('minecraft:slime_ball') * 9).output(item('minecraft:slime')).name('slime_compacting')") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'iron_to_clay', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, 9")) - public CompactingBinRecipe add(String name, IIngredient input, ItemStack output, int hits) { + public CompactingBinRecipe add(String name, IIngredient input, ItemStack output, int... hits) { + return add(name, input, output, false, hits); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'iron_to_clay', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, false, 9, 7, 6, 6")) + public CompactingBinRecipe add(String name, IIngredient input, ItemStack output, boolean inherit, int... hits) { return recipeBuilder() - .toolUses(hits) + .inherit(inherit) + .hits(hits) .name(name) .input(input) .output(output) .register(); } - @MethodDescription(example = @Example("item('minecraft:snowball')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:snowball')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing compacting bin recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -50,7 +63,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('minecraft:bone_block')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:bone_block')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing compacting bin recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -70,12 +83,22 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) - private int toolUses; + @Property + private final IntList hits = new IntArrayList(); + @Property + private boolean inherit; + + @RecipeBuilderMethodDescription + public RecipeBuilder hits(int... hits) { + for (int use : hits) { + this.hits.add(use); + } + return this; + } @RecipeBuilderMethodDescription - public RecipeBuilder toolUses(int toolUses) { - this.toolUses = toolUses; + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; return this; } @@ -87,7 +110,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(toolUses < 0, "toolUses must be a non negative integer, yet it was {}", toolUses); + msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that's larger than 0"); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -96,8 +119,13 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable CompactingBinRecipe register() { if (!validate()) return null; - CompactingBinRecipe recipe = new CompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), toolUses).setRegistryName(super.name); + CompactingBinRecipe recipe = new CompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), input.get(0).getAmount(), hits.isEmpty() ? ModuleTechBasicConfig.COMPACTING_BIN.TOOL_USES_REQUIRED_PER_HARVEST_LEVEL : hits.toIntArray()).setRegistryName(super.name); + input.get(0).setAmount(1); ModSupport.PYROTECH.get().compactingBin.add(recipe); + if (inherit) { + MechanicalCompactingBinRecipe mechanicalCompactingBinRecipe = MechanicalCompactingBinRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(super.name.getNamespace(), "compacting_bin/" + super.name.getPath()); + ModSupport.PYROTECH.get().mechanicalCompactingBin.add(mechanicalCompactingBinRecipe); + } return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index 37856a897..fd99ab62a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -36,7 +36,7 @@ public CompostBinRecipe add(String name, IIngredient input, ItemStack output, in .register(); } - @MethodDescription(example = @Example("item('minecraft:golden_carrot')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:golden_carrot')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing compost bin recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -51,7 +51,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example(value = "item('pyrotech:mulch') * 4", commented = true)) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing compost bin recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index fc0ca5057..d61810e14 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -8,8 +8,15 @@ import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; +import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.DryingRackRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CrudeDryingRackRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.DryingRackRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneOvenRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneOvenRecipe; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.Nullable; @RegistryDescription @@ -20,14 +27,22 @@ public CrudeDryingRack() { super(ModuleTechBasic.Registries.CRUDE_DRYING_RACK_RECIPE); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).dryTime(260).name('diamond_to_emerald_crude_drying_rack')")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).dryTime(260).name('diamond_to_emerald_crude_drying_rack')"), + @Example(".input(item('minecraft:glowstone_dust')).output(item('minecraft:redstone')).dryTime(1000).inherit(true).name('glowstone_to_redstone')") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200")) public CrudeDryingRackRecipe add(String name, IIngredient input, ItemStack output, int dryTime) { + return add(name, input, output, dryTime, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true")) + public CrudeDryingRackRecipe add(String name, IIngredient input, ItemStack output, int dryTime, boolean inherit) { return recipeBuilder() + .inherit(inherit) .dryTime(dryTime) .name(name) .input(input) @@ -50,7 +65,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:paper')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing crude drying rack recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -72,6 +87,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder "Input 1 must not be empty") @@ -50,7 +63,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:sponge')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing drying rack recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -72,6 +85,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { + + public MechanicalCompactingBin() { + super(ModuleTechMachine.Registries.MECHANICAL_COMPACTING_BIN_RECIPES); + } + + @RecipeBuilderDescription(example = { + @Example(".hits(2, 2, 1, 1).input(item('minecraft:melon') * 8).output(item('minecraft:melon_block')).name('melon_compacting')") + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = { + @Example("'gold_to_wheat', ore('ingotGold') * 4, item('minecraft:wheat') * 64, 4, 4, 3, 2"), + @Example("'wheat_to_hay_block', ore('cropWheat') * 9, item('minecraft:hay_block')") + }) + public MechanicalCompactingBinRecipe add(String name, IIngredient input, ItemStack output, int... hits) { + return recipeBuilder() + .hits(hits) + .name(name) + .input(input) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:snowball')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing compacting bin recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (MechanicalCompactingBinRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:bone_block')")) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing compacting bin recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (MechanicalCompactingBinRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property + private final IntList hits = new IntArrayList(); + + @RecipeBuilderMethodDescription + public RecipeBuilder hits(int... hits) { + for (int hit : hits) { + this.hits.add(hit); + } + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Compacting Bin Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 1, 1); + msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that's larger than 0"); + msg.add(super.name == null, "name cannot be null."); + msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable MechanicalCompactingBinRecipe register() { + if (!validate()) return null; + MechanicalCompactingBinRecipe recipe = new MechanicalCompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), input.get(0).getAmount(), hits.isEmpty() ? ModuleTechBasicConfig.COMPACTING_BIN.TOOL_USES_REQUIRED_PER_HARVEST_LEVEL : hits.toIntArray()).setRegistryName(super.name); + input.get(0).setAmount(1); + ModSupport.PYROTECH.get().mechanicalCompactingBin.add(recipe); + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index 8d9ea20c4..40dfaffd5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -11,7 +11,11 @@ import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.KilnPitRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickKilnRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneKilnRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneKilnRecipe; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.Nullable; @RegistryDescription @@ -21,14 +25,22 @@ public PitKiln() { super(ModuleTechBasic.Registries.KILN_PIT_RECIPE, Alias.generateOfClass(PitKiln.class).andGenerate("Kiln")); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).burnTime(400).failureChance(1f).failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')).name('iron_to_gold_kiln_with_failure_items')")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).burnTime(400).failureChance(1f).failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')).name('iron_to_gold_kiln_with_failure_items')"), + @Example(".input(item('minecraft:record_11')).output(item('minecraft:record_13')).burnTime(200).failureChance(0f).inherit(true).name('record_11_to_record_13')") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, 0.5f, [item('minecraft:dirt'), item('minecraft:cobblestone')]")) - public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, Iterable failureOutput) { + public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, ItemStack... failureOutput) { + return add(name, input, output, burnTime, false, failureChance, failureOutput); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) + public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int burnTime, boolean inherit, float failureChance, ItemStack... failureOutput) { return recipeBuilder() + .inherit(inherit) .burnTime(burnTime) .failureChance(failureChance) .failureOutput(failureOutput) @@ -38,7 +50,7 @@ public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int b .register(); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:bucket_refractory_unfired')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing pit kiln recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -53,7 +65,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('pyrotech:bucket_clay')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:bucket_clay')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing pit kiln recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -79,6 +91,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { private int burnTime; @Property(comp = @Comp(gte = 0)) private float failureChance; + @Property + private boolean inherit; @RecipeBuilderMethodDescription public RecipeBuilder burnTime(int time) { @@ -108,7 +122,15 @@ public RecipeBuilder failureOutput(ItemStack... failureOutputs) { @RecipeBuilderMethodDescription public RecipeBuilder failureOutput(Iterable failureOutputs) { - for (ItemStack itemStack : failureOutputs) failureOutput(itemStack); + for (ItemStack itemStack : failureOutputs) { + failureOutput(itemStack); + } + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; return this; } @@ -126,7 +148,6 @@ protected int getMaxItemInput() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); - validateCustom(msg, failureOutput, 1, 100, "failure output"); msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); msg.add(super.name == null, "name cannot be null."); @@ -139,6 +160,12 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; KilnPitRecipe recipe = new KilnPitRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); ModSupport.PYROTECH.get().pitKiln.add(recipe); + if (inherit) { + ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "pit_kiln/" + super.name.getPath()); + StoneKilnRecipe stoneKilnRecipe = StoneKilnRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); + ModSupport.PYROTECH.get().stoneKiln.add(stoneKilnRecipe); + ModSupport.PYROTECH.get().brickKiln.add(BrickKilnRecipesAdd.INHERIT_TRANSFORMER.apply(stoneKilnRecipe).setRegistryName(location)); + } return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java index 344bdd7cb..e8e8c59ba 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java @@ -1,7 +1,8 @@ package com.cleanroommc.groovyscript.compat.mods.pyrotech; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; -import com.codetaylor.mc.pyrotech.ModPyrotechConfig; +import com.codetaylor.mc.athenaeum.module.ModuleBase; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; @@ -14,7 +15,10 @@ public class PyroTech extends GroovyPropertyContainer { public final StoneOven stoneOven; public final BrickOven brickOven; public final ChoppingBlock choppingBlock; + public final StoneSawmill stoneSawmill; + public final BrickSawmill brickSawmill; public final CompactingBin compactingBin; + public final MechanicalCompactingBin mechanicalCompactingBin; public final CompostBin compostBin; public final CrudeDryingRack crudeDryingRack; public final DryingRack dryingRack; @@ -24,28 +28,36 @@ public class PyroTech extends GroovyPropertyContainer { public final Anvil anvil; public final SoakingPot soakingPot; public final TanningRack tanningRack; + public final StoneCrucible stoneCrucible; + public final BrickCrucible brickCrucible; public PyroTech() { - this.barrel = register(ModuleTechBasic.MODULE_ID, Barrel::new); - this.campfire = register(ModuleTechBasic.MODULE_ID, Campfire::new); - this.stoneOven = register(ModuleTechMachine.MODULE_ID, StoneOven::new); - this.brickOven = register(ModuleTechMachine.MODULE_ID, BrickOven::new); - this.choppingBlock = register(ModuleTechBasic.MODULE_ID, ChoppingBlock::new); - this.compactingBin = register(ModuleTechBasic.MODULE_ID, CompactingBin::new); - this.compostBin = register(ModuleTechBasic.MODULE_ID, CompostBin::new); - this.crudeDryingRack = register(ModuleTechBasic.MODULE_ID, CrudeDryingRack::new); - this.dryingRack = register(ModuleTechBasic.MODULE_ID, DryingRack::new); - this.pitKiln = register(ModuleTechBasic.MODULE_ID, PitKiln::new); - this.stoneKiln = register(ModuleTechMachine.MODULE_ID, StoneKiln::new); - this.brickKiln = register(ModuleTechMachine.MODULE_ID, BrickKiln::new); - this.anvil = register(ModuleTechBasic.MODULE_ID, Anvil::new); - this.soakingPot = register(ModuleTechBasic.MODULE_ID, SoakingPot::new); - this.tanningRack = register(ModuleTechBasic.MODULE_ID, TanningRack::new); + this.barrel = register(ModuleTechBasic.class, Barrel::new); + this.campfire = register(ModuleTechBasic.class, Campfire::new); + this.stoneOven = register(ModuleTechMachine.class, StoneOven::new); + this.brickOven = register(ModuleTechMachine.class, BrickOven::new); + this.choppingBlock = register(ModuleTechBasic.class, ChoppingBlock::new); + this.stoneSawmill = register(ModuleTechMachine.class, StoneSawmill::new); + this.brickSawmill = register(ModuleTechMachine.class, BrickSawmill::new); + this.compactingBin = register(ModuleTechBasic.class, CompactingBin::new); + this.mechanicalCompactingBin = register(ModuleTechMachine.class, MechanicalCompactingBin::new); + this.compostBin = register(ModuleTechBasic.class, CompostBin::new); + this.crudeDryingRack = register(ModuleTechBasic.class, CrudeDryingRack::new); + this.dryingRack = register(ModuleTechBasic.class, DryingRack::new); + this.pitKiln = register(ModuleTechBasic.class, PitKiln::new); + this.stoneKiln = register(ModuleTechMachine.class, StoneKiln::new); + this.brickKiln = register(ModuleTechMachine.class, BrickKiln::new); + this.anvil = register(ModuleTechBasic.class, Anvil::new); + this.soakingPot = register(ModuleTechBasic.class, SoakingPot::new); + this.tanningRack = register(ModuleTechBasic.class, TanningRack::new); + this.stoneCrucible = register(ModuleTechMachine.class, StoneCrucible::new); + this.brickCrucible = register(ModuleTechMachine.class, BrickCrucible::new); } - private static T register(String moduleName, Supplier supplier) { - Boolean bool = ModPyrotechConfig.MODULES.get(moduleName); - if (bool != null && bool) return supplier.get(); + private static T register(Class moduleClass, Supplier supplier) { + if (ModPyrotech.INSTANCE.isModuleEnabled(moduleClass)) { + return supplier.get(); + } return null; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java index acf34c862..c6ef085dc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java @@ -36,7 +36,7 @@ public SoakingPotRecipe add(String name, IIngredient input, FluidStack fluidInpu .register(); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:hide_washed')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing soaking pot recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -51,7 +51,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('pyrotech:material', 54)")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:material', 54)")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing soaking pot recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -74,7 +74,6 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { + + public StoneCrucible() { + super(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES); + } + + @RecipeBuilderDescription(example = @Example(".input(ore('sugarcane')).output(fluid('water') * 500).burnTime(1000).inherit(true).name('water_from_sugarcane')")) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + public StoneCrucibleRecipe add(String name, IIngredient input, FluidStack output, int burnTime) { + return add(name, input, output, burnTime, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'water_from_cactus', ore('blockCactus'), fluid('water') * 1000, 600, true")) + public StoneCrucibleRecipe add(String name, IIngredient input, FluidStack output, int burnTime, boolean inherit) { + return recipeBuilder() + .inherit(inherit) + .burnTime(burnTime) + .name(name) + .input(input) + .fluidOutput(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:ice')")) + public void removeByInput(ItemStack input) { + for (StoneCrucibleRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("fluid('water') * 500")) + public void removeByOutput(IIngredient output) { + for (StoneCrucibleRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "fluidOutput", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int burnTime; + @Property + private boolean inherit; + + @RecipeBuilderMethodDescription + public RecipeBuilder burnTime(int burnTime) { + this.burnTime = burnTime; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Stone Crucible Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 1, 0, 0); + validateFluids(msg, 0, 0, 1, 1); + msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(super.name == null, "name cannot be null"); + msg.add(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public @Nullable StoneCrucibleRecipe register() { + if (!validate()) return null; + StoneCrucibleRecipe recipe = new StoneCrucibleRecipe(fluidOutput.get(0), input.get(0).toMcIngredient(), burnTime).setRegistryName(super.name); + ModSupport.PYROTECH.get().stoneCrucible.add(recipe); + if (inherit) { + BrickCrucibleRecipe brickCrucibleRecipe = BrickCrucibleRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(new ResourceLocation(super.name.getNamespace(), "stone_crucible/" + super.name.getPath())); + ModSupport.PYROTECH.get().brickCrucible.add(brickCrucibleRecipe); + } + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java index ca002e33e..7f3e74fa9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java @@ -9,6 +9,7 @@ import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickKilnRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneKilnRecipe; import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; @@ -20,14 +21,22 @@ public StoneKiln() { super(ModuleTechMachine.Registries.STONE_KILN_RECIPES); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).burnTime(400).failureChance(1f).failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')).name('iron_to_gold_kiln_with_failure_items_stone')")) + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).burnTime(800).failureChance(0.6f).failureOutput(item('minecraft:egg'), item('minecraft:fish')).name('diamond_to_emerald_with_failure_outputs')"), + @Example(".input(item('minecraft:compass')).output(item('minecraft:clock')).burnTime(1200).failureChance(0f).inherit(true).name('compass_to_clock')") + }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'clay_to_iron_stone', item('minecraft:clay_ball') * 5, item('minecraft:iron_ingot'), 1200, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) - public StoneKilnRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, ItemStack... failureOutput) { + public StoneKilnRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, ItemStack failureOutput) { + return add(name, input, output, burnTime, false, failureChance, failureOutput); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'clay_to_iron_stone', item('minecraft:clay_ball'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) + public StoneKilnRecipe add(String name, IIngredient input, ItemStack output, int burnTime, boolean inherit, float failureChance, ItemStack... failureOutput) { return recipeBuilder() + .inherit(inherit) .burnTime(burnTime) .failureChance(failureChance) .failureOutput(failureOutput) @@ -37,7 +46,7 @@ public StoneKilnRecipe add(String name, IIngredient input, ItemStack output, int .register(); } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:sand')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing stone kiln recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -52,7 +61,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('pyrotech:bucket_clay')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:bucket_clay')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing stone iln recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -78,6 +87,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder private int burnTime; @Property(comp = @Comp(gte = 0)) private float failureChance; + @Property + private boolean inherit; @RecipeBuilderMethodDescription public RecipeBuilder burnTime(int time) { @@ -107,10 +118,23 @@ public RecipeBuilder failureOutput(ItemStack... failureOutputs) { @RecipeBuilderMethodDescription public RecipeBuilder failureOutput(Iterable failureOutputs) { - for (ItemStack itemStack : failureOutputs) failureOutput(itemStack); + for (ItemStack itemStack : failureOutputs) { + failureOutput(itemStack); + } + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Stone Kiln Recipe"; @@ -120,7 +144,6 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); - validateCustom(msg, failureOutput, 1, 100, "failure output"); msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); msg.add(super.name == null, "name cannot be null."); @@ -133,6 +156,9 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; StoneKilnRecipe recipe = new StoneKilnRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); ModSupport.PYROTECH.get().stoneKiln.add(recipe); + if (inherit) { + ModSupport.PYROTECH.get().brickKiln.add(BrickKilnRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(super.name.getNamespace(), "stone_kiln/" + super.name.getPath())); + } return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java index a6b2cec2b..1d5b79f76 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java @@ -8,8 +8,11 @@ import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneOvenRecipe; import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; import org.jetbrains.annotations.Nullable; @RegistryDescription( @@ -24,14 +27,19 @@ public StoneOven() { super(ModuleTechMachine.Registries.STONE_OVEN_RECIPES); } - @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).duration(400).name('diamond_campfire_to_emerald_stone')")) + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).duration(400).inherit(true).name('diamond_campfire_to_emerald_stone')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_dirt_stone', item('minecraft:apple'), item('minecraft:dirt'), 1000")) public StoneOvenRecipe add(String name, IIngredient input, ItemStack output, int duration) { + return add(name, input, output, duration, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'sand_to_dirt', item('minecraft:sand'), item('minecraft:dirt'), 1000, true")) + public StoneOvenRecipe add(String name, IIngredient input, ItemStack output, int duration, boolean inherit) { return recipeBuilder() + .inherit(inherit) .duration(duration) .name(name) .input(input) @@ -39,7 +47,7 @@ public StoneOvenRecipe add(String name, IIngredient input, ItemStack output, int .register(); } - @MethodDescription(example = @Example("item('minecraft:porkchop')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:porkchop')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing stone oven recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -54,7 +62,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription(example = @Example("item('minecraft:cooked_porkchop')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:cooked_porkchop')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing stone oven recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") @@ -76,6 +84,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder @Property(comp = @Comp(gte = 1)) private int duration; + @Property + private boolean inherit; @RecipeBuilderMethodDescription public RecipeBuilder duration(int time) { @@ -83,6 +93,12 @@ public RecipeBuilder duration(int time) { return this; } + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; + return this; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Stone Oven Recipe"; @@ -102,6 +118,11 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; StoneOvenRecipe recipe = new StoneOvenRecipe(output.get(0), input.get(0).toMcIngredient(), duration).setRegistryName(super.name); ModSupport.PYROTECH.get().stoneOven.add(recipe); + if (inherit) { + ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "stone_oven/" + super.name.getPath()); + BrickOvenRecipe brickOvenRecipe = BrickOvenRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); + ModSupport.PYROTECH.get().brickOven.add(brickOvenRecipe); + } return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java new file mode 100644 index 000000000..fc15a272b --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java @@ -0,0 +1,172 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickSawmillRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneSawmillRecipe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.oredict.OreDictionary; +import org.jetbrains.annotations.Nullable; + +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.sawmill.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true)) +public class StoneSawmill extends ForgeRegistryWrapper { + + public StoneSawmill() { + super(ModuleTechMachine.Registries.STONE_SAWMILL_RECIPES); + } + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:sign')).output(item('minecraft:planks:0') * 2).duration(200).woodChips(5).inherit(true).name('wood_from_sign')"), + @Example(".input(item('minecraft:stone_pickaxe'), ore('blockIron')).output(item('minecraft:iron_pickaxe')).duration(5000).name('stone_pickaxe_upgrade')") + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + public StoneSawmillRecipe add(String name, IIngredient input, ItemStack output, int duration, int woodChips) { + return add(name, input, output, duration, woodChips, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'stone_to_cobblestone', ore('stone'), item('minecraft:cobblestone'), 500, 0, true")) + public StoneSawmillRecipe add(String name, IIngredient input, ItemStack output, int duration, int woodChips, boolean inherit) { + return recipeBuilder() + .duration(duration) + .woodChips(woodChips) + .inherit(inherit) + .name(name) + .input(input) + .output(output) + .register(); + } + + public StoneSawmillRecipe add(String name, IIngredient input, IIngredient blade, ItemStack output, int duration, int woodChips) { + return add(name, input, blade, output, duration, woodChips, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_gapple_with_golden_blade', item('minecraft:apple'), item('pyrotech:sawmill_blade_bone'), item('minecraft:golden_apple'), 2000, 0, false")) + public StoneSawmillRecipe add(String name, IIngredient input, IIngredient blade, ItemStack output, int duration, int woodChips, boolean inherit) { + return recipeBuilder() + .duration(duration) + .woodChips(woodChips) + .inherit(inherit) + .name(name) + .input(input, blade) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:planks:1')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing stone sawmill recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (StoneSawmillRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:material:23')")) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing stone sawmill recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (StoneSawmillRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(gte = 1, lt = 3)) + @Property(property = "output", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(comp = @Comp(gte = 1)) + private int duration; + @Property(comp = @Comp(gte = 0)) + private int woodChips; + @Property + private boolean inherit; + + @RecipeBuilderMethodDescription + public RecipeBuilder duration(int time) { + this.duration = time; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder woodChips(int woodChips) { + this.woodChips = woodChips; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; + return this; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Stone Sawmill Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + validateItems(msg, 1, 2, 1, 1); + msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(super.name == null, "name cannot be null."); + msg.add(ModuleTechMachine.Registries.STONE_SAWMILL_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable StoneSawmillRecipe register() { + if (!validate()) return null; + if (input.size() > 1) { + return this.addRecipe(1, 1, input.get(1).toMcIngredient(), 1, ""); + } + else { + StoneSawmillRecipe recipe = this.addRecipe(1, 1, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 1, ""); + this.addRecipe(2, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 2, "_flint_blade"); + this.addRecipe(2, 0.5, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_iron_blade"); + this.addRecipe(3, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_diamond_blade"); + return recipe; + } + } + + private StoneSawmillRecipe addRecipe(int outputMultiplier, double durationMultiplier, Ingredient blade, int woodChipsDivisor, String name) { + ItemStack out = output.get(0).copy(); + out.setCount(Math.min(output.get(0).getCount() * outputMultiplier, 64)); + ResourceLocation registryName = new ResourceLocation(super.name.getNamespace(), super.name.getPath() + name); + StoneSawmillRecipe recipe = new StoneSawmillRecipe(out, input.get(0).toMcIngredient(), (int) ((double) duration * durationMultiplier), blade, woodChips / woodChipsDivisor).setRegistryName(registryName); + ModSupport.PYROTECH.get().stoneSawmill.add(recipe); + if (inherit) { + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(new ResourceLocation(registryName.getNamespace(), "stone_sawmill/" + registryName.getPath()))); + } + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java index 8af541037..ce5596bf2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java @@ -36,7 +36,7 @@ public TanningRackRecipe add(String name, IIngredient input, ItemStack output, i .register(); } - @MethodDescription(example = @Example("item('minecraft:wheat')")) + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:wheat')")) public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing tanning rack recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") @@ -51,7 +51,7 @@ public void removeByInput(ItemStack input) { } } - @MethodDescription + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:leather')")) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing tanning rack recipe") .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") From db99d3835f7b7bece1a6f251b190bbacb97440d5 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Fri, 19 Sep 2025 21:11:40 +0300 Subject: [PATCH 04/13] Check modules before adding inherited recipes. --- .../compat/mods/pyrotech/CompactingBin.java | 4 +++- .../compat/mods/pyrotech/CrudeDryingRack.java | 12 ++++++++---- .../compat/mods/pyrotech/DryingRack.java | 4 +++- .../groovyscript/compat/mods/pyrotech/PitKiln.java | 4 +++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index 5a0051461..78546a1ed 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -7,9 +7,11 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasicConfig; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CompactingBinRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.MechanicalCompactingBinRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.MechanicalCompactingBinRecipe; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -122,7 +124,7 @@ public void validate(GroovyLog.Msg msg) { CompactingBinRecipe recipe = new CompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), input.get(0).getAmount(), hits.isEmpty() ? ModuleTechBasicConfig.COMPACTING_BIN.TOOL_USES_REQUIRED_PER_HARVEST_LEVEL : hits.toIntArray()).setRegistryName(super.name); input.get(0).setAmount(1); ModSupport.PYROTECH.get().compactingBin.add(recipe); - if (inherit) { + if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { MechanicalCompactingBinRecipe mechanicalCompactingBinRecipe = MechanicalCompactingBinRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(super.name.getNamespace(), "compacting_bin/" + super.name.getPath()); ModSupport.PYROTECH.get().mechanicalCompactingBin.add(mechanicalCompactingBinRecipe); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index d61810e14..c8e857875 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -7,10 +7,12 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.DryingRackRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CrudeDryingRackRecipe; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.DryingRackRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; @@ -131,10 +133,12 @@ public void validate(GroovyLog.Msg msg) { ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "crude_drying_rack/" + super.name.getPath()); DryingRackRecipe dryingRackRecipe = DryingRackRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); ModSupport.PYROTECH.get().dryingRack.add(dryingRackRecipe); - StoneOvenRecipe stoneOvenRecipe = StoneOvenRecipesAdd.INHERIT_TRANSFORMER.apply(dryingRackRecipe).setRegistryName(location); - ModSupport.PYROTECH.get().stoneOven.add(stoneOvenRecipe); - BrickOvenRecipe brickOvenRecipe = BrickOvenRecipesAdd.INHERIT_TRANSFORMER.apply(stoneOvenRecipe).setRegistryName(location); - ModSupport.PYROTECH.get().brickOven.add(brickOvenRecipe); + if (ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + StoneOvenRecipe stoneOvenRecipe = StoneOvenRecipesAdd.INHERIT_TRANSFORMER.apply(dryingRackRecipe).setRegistryName(location); + ModSupport.PYROTECH.get().stoneOven.add(stoneOvenRecipe); + BrickOvenRecipe brickOvenRecipe = BrickOvenRecipesAdd.INHERIT_TRANSFORMER.apply(stoneOvenRecipe).setRegistryName(location); + ModSupport.PYROTECH.get().brickOven.add(brickOvenRecipe); + } } return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java index ca2a479dc..3c90a9d38 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java @@ -7,8 +7,10 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.DryingRackRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; @@ -125,7 +127,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; DryingRackRecipe recipe = new DryingRackRecipe(output.get(0), input.get(0).toMcIngredient(), dryTime).setRegistryName(super.name); ModSupport.PYROTECH.get().dryingRack.add(recipe); - if (inherit) { + if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "drying_rack/" + super.name.getPath()); StoneOvenRecipe stoneOvenRecipe = StoneOvenRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); ModSupport.PYROTECH.get().stoneOven.add(stoneOvenRecipe); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index 40dfaffd5..dcdceffdd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -9,8 +9,10 @@ import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.KilnPitRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickKilnRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneKilnRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneKilnRecipe; @@ -160,7 +162,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; KilnPitRecipe recipe = new KilnPitRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); ModSupport.PYROTECH.get().pitKiln.add(recipe); - if (inherit) { + if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "pit_kiln/" + super.name.getPath()); StoneKilnRecipe stoneKilnRecipe = StoneKilnRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); ModSupport.PYROTECH.get().stoneKiln.add(stoneKilnRecipe); From e9f67548b8c9879233f5d73060e34f835f1c0bf0 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Sat, 20 Sep 2025 14:11:53 +0300 Subject: [PATCH 05/13] Check for 0 in Pyrotech recipe builder properties. --- gradle.properties | 2 +- .../groovyscript/compat/mods/pyrotech/Anvil.java | 2 +- .../groovyscript/compat/mods/pyrotech/Barrel.java | 7 ++----- .../groovyscript/compat/mods/pyrotech/BrickCrucible.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/BrickKiln.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/BrickOven.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/BrickSawmill.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/Campfire.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/CompactingBin.java | 2 +- .../groovyscript/compat/mods/pyrotech/CompostBin.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/CrudeDryingRack.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/DryingRack.java | 4 ++-- .../compat/mods/pyrotech/MechanicalCompactingBin.java | 2 +- .../groovyscript/compat/mods/pyrotech/PitKiln.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/SoakingPot.java | 3 ++- .../groovyscript/compat/mods/pyrotech/StoneCrucible.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/StoneKiln.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/StoneOven.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/StoneSawmill.java | 4 ++-- .../groovyscript/compat/mods/pyrotech/TanningRack.java | 4 ++-- 20 files changed, 36 insertions(+), 38 deletions(-) diff --git a/gradle.properties b/gradle.properties index b78dc633e..cb1203043 100644 --- a/gradle.properties +++ b/gradle.properties @@ -95,7 +95,7 @@ debug_pneumaticcraft = false debug_primal_tech = false debug_prodigytech = false debug_projecte = false -debug_pyrotech = false +debug_pyrotech = true debug_random_things = false debug_roots = false diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index 69ff54319..2dad09160 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -168,7 +168,7 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(hits < 0, "duration must be a non negative integer, yet it was {}", hits); + msg.add(hits <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", hits); msg.add(type == null, "type cannot be null."); msg.add(tier == null, "tier cannot be null."); msg.add(super.name == null, "name cannot be null."); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java index fd9bf9b18..5bdda4007 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java @@ -60,7 +60,7 @@ public void removeByOutput(FluidStack output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int duration; @RecipeBuilderMethodDescription @@ -84,7 +84,7 @@ protected int getMaxItemInput() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 4, 4, 0, 0); validateFluids(msg, 1, 1, 1, 1); - msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.BARREL_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -93,13 +93,10 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable BarrelRecipe register() { if (!validate()) return null; - // Because you need Ingredient[] to register a recipe Ingredient[] inputIngredient = input.stream().map(IIngredient::toMcIngredient).toArray(Ingredient[]::new); - BarrelRecipe recipe = new BarrelRecipe(fluidOutput.get(0), inputIngredient, fluidInput.get(0), duration).setRegistryName(super.name); ModSupport.PYROTECH.get().barrel.add(recipe); - return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java index 374688b79..f9b59eb79 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java @@ -69,7 +69,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int burnTime; @RecipeBuilderMethodDescription @@ -92,7 +92,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 0); validateFluids(msg, 0, 0, 1, 1); - msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(super.name == null, "name cannot be null"); msg.add(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java index fadd269aa..cf1cc4dc9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java @@ -74,7 +74,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder @Property private final ItemStackList failureOutput = new ItemStackList(); - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int burnTime; @Property(comp = @Comp(gte = 0)) private float failureChance; @@ -122,7 +122,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); - msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.BRICK_KILN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index 41f672366..f60b92d50 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -74,7 +74,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int duration; @RecipeBuilderMethodDescription @@ -91,7 +91,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.BRICK_OVEN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java index b44cdd32f..92aa84879 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java @@ -89,7 +89,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int duration; @Property(comp = @Comp(gte = 0)) private int woodChips; @@ -114,7 +114,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 2, 1, 1); - msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.BRICK_SAWMILL_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java index 750a144eb..32364372c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java @@ -69,7 +69,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int duration; @RecipeBuilderMethodDescription @@ -92,7 +92,7 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.CAMPFIRE_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index 78546a1ed..58933444c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -112,7 +112,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that's larger than 0"); + msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that is larger than 0"); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index fd99ab62a..fb5b282ee 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -71,7 +71,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int compostValue; @RecipeBuilderMethodDescription @@ -94,7 +94,7 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(compostValue < 0, "compostValue must be a non negative integer, yet it was {}", compostValue); + msg.add(compostValue <= 0, "compostValue must be a non negative integer that is larger than 0, yet it was {}", compostValue); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index c8e857875..c2f42d954 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -87,7 +87,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int dryTime; @Property private boolean inherit; @@ -118,7 +118,7 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(dryTime < 0, "dryTime must be a non negative integer, yet it was {}", dryTime); + msg.add(dryTime <= 0, "dryTime must be a non negative integer that is larger than 0, yet it was {}", dryTime); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.CRUDE_DRYING_RACK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java index 3c90a9d38..0f30d13d5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java @@ -85,7 +85,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int dryTime; @Property private boolean inherit; @@ -116,7 +116,7 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(dryTime < 0, "dryTime must be a non negative integer, yet it was {}", dryTime); + msg.add(dryTime <= 0, "dryTime must be a non negative integer that is larger than 0, yet it was {}", dryTime); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.DRYING_RACK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java index d1ea700ef..5f165d9ce 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java @@ -97,7 +97,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that's larger than 0"); + msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that is larger than 0"); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index dcdceffdd..c51c6b2a6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -89,7 +89,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { @Property private final ItemStackList failureOutput = new ItemStackList(); - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int burnTime; @Property(comp = @Comp(gte = 0)) private float failureChance; @@ -150,7 +150,7 @@ protected int getMaxItemInput() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); - msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.KILN_PIT_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java index c6ef085dc..52446e966 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java @@ -74,7 +74,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int burnTime; @Property private boolean inherit; @@ -90,7 +90,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 0); validateFluids(msg, 0, 0, 1, 1); - msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(super.name == null, "name cannot be null"); msg.add(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java index 7f3e74fa9..069b66d76 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java @@ -83,7 +83,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder @Property private final ItemStackList failureOutput = new ItemStackList(); - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int burnTime; @Property(comp = @Comp(gte = 0)) private float failureChance; @@ -144,7 +144,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); - msg.add(burnTime < 0, "burnTime must be a non negative integer, yet it was {}", burnTime); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.STONE_KILN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java index 1d5b79f76..e77177610 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java @@ -82,7 +82,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int duration; @Property private boolean inherit; @@ -107,7 +107,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.STONE_OVEN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java index fc15a272b..a1d77a2ff 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java @@ -103,7 +103,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int duration; @Property(comp = @Comp(gte = 0)) private int woodChips; @@ -136,7 +136,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 2, 1, 1); - msg.add(duration < 0, "duration must be a non negative integer, yet it was {}", duration); + msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.STONE_SAWMILL_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java index ce5596bf2..6f605dc42 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java @@ -71,7 +71,7 @@ public void removeByOutput(IIngredient output) { @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(comp = @Comp(gte = 1)) + @Property(comp = @Comp(gt = 0)) private int dryTime; @Property private ItemStack failureItem; @@ -102,7 +102,7 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); - msg.add(dryTime < 0, "dryTime must be a non negative integer, yet it was {}", dryTime); + msg.add(dryTime <= 0, "dryTime must be a non negative integer that is larger than 0, yet it was {}", dryTime); msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.TANNING_RACK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } From 8b2eb4de800b37811cfea20c4e56b6105e919400 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Sat, 20 Sep 2025 14:15:07 +0300 Subject: [PATCH 06/13] Remove unnecessary input amount sets. --- .../groovyscript/compat/mods/pyrotech/CompactingBin.java | 1 - .../compat/mods/pyrotech/MechanicalCompactingBin.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index 58933444c..649e23ab6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -122,7 +122,6 @@ public void validate(GroovyLog.Msg msg) { public @Nullable CompactingBinRecipe register() { if (!validate()) return null; CompactingBinRecipe recipe = new CompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), input.get(0).getAmount(), hits.isEmpty() ? ModuleTechBasicConfig.COMPACTING_BIN.TOOL_USES_REQUIRED_PER_HARVEST_LEVEL : hits.toIntArray()).setRegistryName(super.name); - input.get(0).setAmount(1); ModSupport.PYROTECH.get().compactingBin.add(recipe); if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { MechanicalCompactingBinRecipe mechanicalCompactingBinRecipe = MechanicalCompactingBinRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(super.name.getNamespace(), "compacting_bin/" + super.name.getPath()); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java index 5f165d9ce..2f2780d1c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java @@ -107,7 +107,6 @@ public void validate(GroovyLog.Msg msg) { public @Nullable MechanicalCompactingBinRecipe register() { if (!validate()) return null; MechanicalCompactingBinRecipe recipe = new MechanicalCompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), input.get(0).getAmount(), hits.isEmpty() ? ModuleTechBasicConfig.COMPACTING_BIN.TOOL_USES_REQUIRED_PER_HARVEST_LEVEL : hits.toIntArray()).setRegistryName(super.name); - input.get(0).setAmount(1); ModSupport.PYROTECH.get().mechanicalCompactingBin.add(recipe); return recipe; } From 393a0a6d2e3d420b3e769131add370f969c01452 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Sat, 20 Sep 2025 15:00:04 +0300 Subject: [PATCH 07/13] Change ForgeRegistryWrapper for checking disabled modules. --- .../compat/mods/pyrotech/Anvil.java | 6 +++ .../compat/mods/pyrotech/Barrel.java | 6 +++ .../compat/mods/pyrotech/BrickCrucible.java | 6 +++ .../compat/mods/pyrotech/BrickKiln.java | 6 +++ .../compat/mods/pyrotech/BrickOven.java | 6 +++ .../compat/mods/pyrotech/BrickSawmill.java | 6 +++ .../compat/mods/pyrotech/Campfire.java | 6 +++ .../compat/mods/pyrotech/ChoppingBlock.java | 5 ++ .../compat/mods/pyrotech/CompactingBin.java | 6 ++- .../compat/mods/pyrotech/CompostBin.java | 7 ++- .../compat/mods/pyrotech/CrudeDryingRack.java | 6 ++- .../compat/mods/pyrotech/DryingRack.java | 6 ++- .../pyrotech/MechanicalCompactingBin.java | 6 +++ .../compat/mods/pyrotech/PitKiln.java | 5 ++ .../compat/mods/pyrotech/PyroTech.java | 53 +++++++------------ .../compat/mods/pyrotech/SoakingPot.java | 6 +++ .../compat/mods/pyrotech/StoneCrucible.java | 6 +++ .../compat/mods/pyrotech/StoneKiln.java | 6 +++ .../compat/mods/pyrotech/StoneOven.java | 6 +++ .../compat/mods/pyrotech/StoneSawmill.java | 6 +++ .../compat/mods/pyrotech/TanningRack.java | 7 ++- .../registry/ForgeRegistryWrapper.java | 2 +- 22 files changed, 136 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index 2dad09160..de1ffd456 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -8,6 +8,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.AnvilIroncladRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.AnvilObsidianRecipesAdd; @@ -26,6 +27,11 @@ public Anvil() { super(ModuleTechBasic.Registries.ANVIL_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald') * 2).hits(8).typeHammer().tierGranite().name('diamond_to_emerald_granite_anvil')"), @Example(".input(item('minecraft:bedrock')).output(item('minecraft:nether_star') * 1).hits(10).typePickaxe().tierIronclad().inherit(true).name('bedrock_to_nether_star')"), diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java index 5bdda4007..fd95f04a7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.BarrelRecipe; import net.minecraft.item.crafting.Ingredient; @@ -20,6 +21,11 @@ public Barrel() { super(ModuleTechBasic.Registries.BARREL_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription( example = @Example( ".input(item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:diamond'), item('minecraft:emerald')).fluidInput(fluid('water') * 1000).fluidOutput(fluid('amongium') * 1000).duration(1000).name('diamond_emerald_and_water_to_amongium')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java index f9b59eb79..a6c14eedc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickCrucibleRecipe; import net.minecraft.item.ItemStack; @@ -19,6 +20,11 @@ public BrickCrucible() { super(ModuleTechMachine.Registries.BRICK_CRUCIBLE_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = @Example("input(item('minecraft:vine')).fluidOutput(fluid('water') * 250).burnTime(60).name('water_from_vine')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java index cf1cc4dc9..9d8e899d2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java @@ -8,6 +8,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickKilnRecipe; import net.minecraft.item.ItemStack; @@ -20,6 +21,11 @@ public BrickKiln() { super(ModuleTechMachine.Registries.BRICK_KILN_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:fish')).output(item('minecraft:cooked_fish')).burnTime(200000).failureChance(0.99f).failureOutput(item('minecraft:dragon_egg'), item('minecraft:dragon_breath')).name('meaning_of_life')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index f60b92d50..cead9ee5a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; import net.minecraft.item.ItemStack; @@ -24,6 +25,11 @@ public BrickOven() { super(ModuleTechMachine.Registries.BRICK_OVEN_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:chorus_fruit')).output(item('minecraft:chorus_fruit_popped')).duration(800).name('chorus_fruit_whats_popping')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java index 92aa84879..4af8228b4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickSawmillRecipe; import net.minecraft.item.ItemStack; @@ -27,6 +28,11 @@ public BrickSawmill() { super(ModuleTechMachine.Registries.BRICK_SAWMILL_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:golden_helmet')).output(item('minecraft:gold_ingot') * 2).duration(1500).woodChips(5).name('golden_helmet_recycling')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java index 32364372c..ba71a9041 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CampfireRecipe; import net.minecraft.item.ItemStack; @@ -19,6 +20,11 @@ public Campfire() { super(ModuleTechBasic.Registries.CAMPFIRE_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).duration(400).name('diamond_campfire_to_emerald')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java index cd4734571..a1bfb8e39 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java @@ -28,6 +28,11 @@ public ChoppingBlock() { super(ModuleTechBasic.Registries.CHOPPING_BLOCK_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).chops(25, 1).chops(20, 1).chops(15, 1).chops(10, 2).name('diamond_to_emerald_chopping_block')"), @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).inherit(true).name('iron_to_gold_chopping_block')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index 649e23ab6..f514511ca 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -22,11 +22,15 @@ @RegistryDescription public class CompactingBin extends ForgeRegistryWrapper { - public CompactingBin() { super(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).hits(5, 4, 3, 2).inherit(true).name('diamond_to_emerald')"), @Example(".input(item('minecraft:slime_ball') * 9).output(item('minecraft:slime')).name('slime_compacting')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index fb5b282ee..8be8ec115 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CompostBinRecipe; import net.minecraft.item.ItemStack; @@ -16,11 +17,15 @@ @RegistryDescription public class CompostBin extends ForgeRegistryWrapper { - public CompostBin() { super(ModuleTechBasic.Registries.COMPOST_BIN_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald') * 4).compostValue(25).name('diamond_to_emerald_compost_bin')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index c2f42d954..88afb5066 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -24,11 +24,15 @@ @RegistryDescription public class CrudeDryingRack extends ForgeRegistryWrapper { - public CrudeDryingRack() { super(ModuleTechBasic.Registries.CRUDE_DRYING_RACK_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).dryTime(260).name('diamond_to_emerald_crude_drying_rack')"), @Example(".input(item('minecraft:glowstone_dust')).output(item('minecraft:redstone')).dryTime(1000).inherit(true).name('glowstone_to_redstone')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java index 0f30d13d5..6b4a397c3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java @@ -22,11 +22,15 @@ @RegistryDescription public class DryingRack extends ForgeRegistryWrapper { - public DryingRack() { super(ModuleTechBasic.Registries.DRYING_RACK_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).dryTime(260).name('iron_to_gold_drying_rack')"), @Example(".input(item('minecraft:ender_eye')).output(item('minecraft:ender_pearl')).dryTime(500).inherit(true).name('ender_eye_to_ender_pearl')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java index 2f2780d1c..ec11e5a71 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasicConfig; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; @@ -23,6 +24,11 @@ public MechanicalCompactingBin() { super(ModuleTechMachine.Registries.MECHANICAL_COMPACTING_BIN_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = { @Example(".hits(2, 2, 1, 1).input(item('minecraft:melon') * 8).output(item('minecraft:melon_block')).name('melon_compacting')") }) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index c51c6b2a6..ab178930c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -27,6 +27,11 @@ public PitKiln() { super(ModuleTechBasic.Registries.KILN_PIT_RECIPE, Alias.generateOfClass(PitKiln.class).andGenerate("Kiln")); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).burnTime(400).failureChance(1f).failureOutput(item('minecraft:wheat'), item('minecraft:carrot'), item('minecraft:sponge')).name('iron_to_gold_kiln_with_failure_items')"), @Example(".input(item('minecraft:record_11')).output(item('minecraft:record_13')).burnTime(200).failureChance(0f).inherit(true).name('record_11_to_record_13')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java index e8e8c59ba..3b89b776c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java @@ -1,12 +1,6 @@ package com.cleanroommc.groovyscript.compat.mods.pyrotech; import com.cleanroommc.groovyscript.compat.mods.GroovyPropertyContainer; -import com.codetaylor.mc.athenaeum.module.ModuleBase; -import com.codetaylor.mc.pyrotech.ModPyrotech; -import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; -import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; - -import java.util.function.Supplier; public class PyroTech extends GroovyPropertyContainer { @@ -32,32 +26,25 @@ public class PyroTech extends GroovyPropertyContainer { public final BrickCrucible brickCrucible; public PyroTech() { - this.barrel = register(ModuleTechBasic.class, Barrel::new); - this.campfire = register(ModuleTechBasic.class, Campfire::new); - this.stoneOven = register(ModuleTechMachine.class, StoneOven::new); - this.brickOven = register(ModuleTechMachine.class, BrickOven::new); - this.choppingBlock = register(ModuleTechBasic.class, ChoppingBlock::new); - this.stoneSawmill = register(ModuleTechMachine.class, StoneSawmill::new); - this.brickSawmill = register(ModuleTechMachine.class, BrickSawmill::new); - this.compactingBin = register(ModuleTechBasic.class, CompactingBin::new); - this.mechanicalCompactingBin = register(ModuleTechMachine.class, MechanicalCompactingBin::new); - this.compostBin = register(ModuleTechBasic.class, CompostBin::new); - this.crudeDryingRack = register(ModuleTechBasic.class, CrudeDryingRack::new); - this.dryingRack = register(ModuleTechBasic.class, DryingRack::new); - this.pitKiln = register(ModuleTechBasic.class, PitKiln::new); - this.stoneKiln = register(ModuleTechMachine.class, StoneKiln::new); - this.brickKiln = register(ModuleTechMachine.class, BrickKiln::new); - this.anvil = register(ModuleTechBasic.class, Anvil::new); - this.soakingPot = register(ModuleTechBasic.class, SoakingPot::new); - this.tanningRack = register(ModuleTechBasic.class, TanningRack::new); - this.stoneCrucible = register(ModuleTechMachine.class, StoneCrucible::new); - this.brickCrucible = register(ModuleTechMachine.class, BrickCrucible::new); - } - - private static T register(Class moduleClass, Supplier supplier) { - if (ModPyrotech.INSTANCE.isModuleEnabled(moduleClass)) { - return supplier.get(); - } - return null; + this.barrel = new Barrel(); + this.campfire = new Campfire(); + this.stoneOven = new StoneOven(); + this.brickOven = new BrickOven(); + this.choppingBlock = new ChoppingBlock(); + this.stoneSawmill = new StoneSawmill(); + this.brickSawmill = new BrickSawmill(); + this.compactingBin = new CompactingBin(); + this.mechanicalCompactingBin = new MechanicalCompactingBin(); + this.compostBin = new CompostBin(); + this.crudeDryingRack = new CrudeDryingRack(); + this.dryingRack = new DryingRack(); + this.pitKiln = new PitKiln(); + this.stoneKiln = new StoneKiln(); + this.brickKiln = new BrickKiln(); + this.anvil = new Anvil(); + this.soakingPot = new SoakingPot(); + this.tanningRack = new TanningRack(); + this.stoneCrucible = new StoneCrucible(); + this.brickCrucible = new BrickCrucible(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java index 52446e966..508b9ab18 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.SoakingPotRecipe; import net.minecraft.item.ItemStack; @@ -20,6 +21,11 @@ public SoakingPot() { super(ModuleTechBasic.Registries.SOAKING_POT_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).fluidInput(fluid('amongium') * 125).output(item('minecraft:emerald')).time(400).campfireRequired(true).name('diamond_to_emerald_with_amongium_soaking_pot')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java index 3d29288f9..6cff96f34 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java @@ -6,6 +6,7 @@ import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickCrucibleRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickCrucibleRecipe; @@ -21,6 +22,11 @@ public StoneCrucible() { super(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = @Example(".input(ore('sugarcane')).output(fluid('water') * 500).burnTime(1000).inherit(true).name('water_from_sugarcane')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java index 069b66d76..796228841 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java @@ -8,6 +8,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickKilnRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneKilnRecipe; @@ -21,6 +22,11 @@ public StoneKiln() { super(ModuleTechMachine.Registries.STONE_KILN_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).burnTime(800).failureChance(0.6f).failureOutput(item('minecraft:egg'), item('minecraft:fish')).name('diamond_to_emerald_with_failure_outputs')"), @Example(".input(item('minecraft:compass')).output(item('minecraft:clock')).burnTime(1200).failureChance(0f).inherit(true).name('compass_to_clock')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java index e77177610..031684d77 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; @@ -27,6 +28,11 @@ public StoneOven() { super(ModuleTechMachine.Registries.STONE_OVEN_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:diamond')).output(item('minecraft:emerald')).duration(400).inherit(true).name('diamond_campfire_to_emerald_stone')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java index a1d77a2ff..4c3cc3e08 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickSawmillRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneSawmillRecipe; @@ -28,6 +29,11 @@ public StoneSawmill() { super(ModuleTechMachine.Registries.STONE_SAWMILL_RECIPES); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); + } + @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:sign')).output(item('minecraft:planks:0') * 2).duration(200).woodChips(5).inherit(true).name('wood_from_sign')"), @Example(".input(item('minecraft:stone_pickaxe'), ore('blockIron')).output(item('minecraft:iron_pickaxe')).duration(5000).name('stone_pickaxe_upgrade')") diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java index 6f605dc42..6a82dfc5c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.TanningRackRecipe; import net.minecraft.item.ItemStack; @@ -15,11 +16,15 @@ @RegistryDescription public class TanningRack extends ForgeRegistryWrapper { - public TanningRack() { super(ModuleTechBasic.Registries.TANNING_RACK_RECIPE); } + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:iron_ingot')).output(item('minecraft:gold_ingot')).dryTime(260).name('iron_to_gold_drying_rack')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java b/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java index 3fa6b1def..6f7d8d9f7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/ForgeRegistryWrapper.java @@ -35,7 +35,7 @@ public ForgeRegistryWrapper(IForgeRegistry registry) { public ForgeRegistryWrapper(IForgeRegistry registry, Collection aliases) { super(aliases); - this.registry = Objects.requireNonNull(registry); + this.registry = isEnabled() ? Objects.requireNonNull(registry) : null; } @GroovyBlacklist From 1b48a38000d3c07c2f8a8d31fd76ce4222eac333 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Sat, 20 Sep 2025 16:40:16 +0300 Subject: [PATCH 08/13] Add missing wiki pages and translations. Add notes for inheritance. --- .../compat/mods/pyrotech/BrickCrucible.java | 5 ++ .../compat/mods/pyrotech/BrickKiln.java | 6 +- .../compat/mods/pyrotech/BrickOven.java | 17 +++-- .../compat/mods/pyrotech/BrickSawmill.java | 19 ++++-- .../compat/mods/pyrotech/DryingRack.java | 6 +- .../pyrotech/MechanicalCompactingBin.java | 6 +- .../compat/mods/pyrotech/StoneCrucible.java | 1 + .../compat/mods/pyrotech/StoneKiln.java | 6 +- .../compat/mods/pyrotech/StoneOven.java | 17 +++-- .../compat/mods/pyrotech/StoneSawmill.java | 20 ++++-- .../assets/groovyscript/lang/en_us.lang | 67 ++++++++++++++++--- 11 files changed, 136 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java index a6c14eedc..cc7cb31e4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java @@ -14,6 +14,11 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.brick_crucible.note0", + format = Admonition.Format.STANDARD, + hasTitle = true)) public class BrickCrucible extends ForgeRegistryWrapper { public BrickCrucible() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java index 9d8e899d2..d3c9fa5cf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java @@ -14,7 +14,11 @@ import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; -@RegistryDescription +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.brick_kiln.note0", + format = Admonition.Format.STANDARD, + hasTitle = true)) public class BrickKiln extends ForgeRegistryWrapper { public BrickKiln() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index cead9ee5a..d96ccfb84 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -14,11 +14,18 @@ import org.jetbrains.annotations.Nullable; @RegistryDescription( - admonition = @Admonition( - value = "groovyscript.wiki.pyrotech.oven.note0", - type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD, - hasTitle = true)) + admonition = { + @Admonition( + value = "groovyscript.wiki.pyrotech.brick_oven.note0", + format = Admonition.Format.STANDARD, + hasTitle = true + ), + @Admonition( + value = "groovyscript.wiki.pyrotech.oven.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true) + }) public class BrickOven extends ForgeRegistryWrapper { public BrickOven() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java index 4af8228b4..b765b5d7d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java @@ -17,11 +17,18 @@ import org.jetbrains.annotations.Nullable; @RegistryDescription( - admonition = @Admonition( - value = "groovyscript.wiki.pyrotech.sawmill.note0", - type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD, - hasTitle = true)) + admonition = { + @Admonition( + value = "groovyscript.wiki.pyrotech.brick_sawmill.note0", + format = Admonition.Format.STANDARD, + hasTitle = true + ), + @Admonition( + value = "groovyscript.wiki.pyrotech.sawmill.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true) + }) public class BrickSawmill extends ForgeRegistryWrapper { public BrickSawmill() { @@ -97,7 +104,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { public DryingRack() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java index ec11e5a71..78860ac41 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java @@ -17,7 +17,11 @@ import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; -@RegistryDescription +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.mechanical_compacting_bin.note0", + format = Admonition.Format.STANDARD, + hasTitle = true)) public class MechanicalCompactingBin extends ForgeRegistryWrapper { public MechanicalCompactingBin() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java index 6cff96f34..a41f59cbf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java @@ -16,6 +16,7 @@ import net.minecraftforge.fluids.FluidStack; import org.jetbrains.annotations.Nullable; +@RegistryDescription public class StoneCrucible extends ForgeRegistryWrapper { public StoneCrucible() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java index 796228841..0059d6a37 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java @@ -15,7 +15,11 @@ import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; -@RegistryDescription +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.stone_kiln.note0", + format = Admonition.Format.STANDARD, + hasTitle = true)) public class StoneKiln extends ForgeRegistryWrapper { public StoneKiln() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java index 031684d77..8453dfa23 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java @@ -17,11 +17,18 @@ import org.jetbrains.annotations.Nullable; @RegistryDescription( - admonition = @Admonition( - value = "groovyscript.wiki.pyrotech.oven.note0", - type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD, - hasTitle = true)) + admonition = { + @Admonition( + value = "groovyscript.wiki.pyrotech.stone_oven.note0", + format = Admonition.Format.STANDARD, + hasTitle = true + ), + @Admonition( + value = "groovyscript.wiki.pyrotech.oven.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true) + }) public class StoneOven extends ForgeRegistryWrapper { public StoneOven() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java index 4c3cc3e08..5a3d81f5e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java @@ -18,11 +18,19 @@ import org.jetbrains.annotations.Nullable; @RegistryDescription( - admonition = @Admonition( - value = "groovyscript.wiki.pyrotech.sawmill.note0", - type = Admonition.Type.WARNING, - format = Admonition.Format.STANDARD, - hasTitle = true)) + admonition = { + @Admonition( + value = "groovyscript.wiki.pyrotech.stone_sawmill.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true + ), + @Admonition( + value = "groovyscript.wiki.pyrotech.sawmill.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true) + }) public class StoneSawmill extends ForgeRegistryWrapper { public StoneSawmill() { @@ -111,7 +119,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder Date: Tue, 23 Sep 2025 01:47:51 +0300 Subject: [PATCH 09/13] Add support for Bloomery, Wither Forge, Worktable and Pit Burning. --- .../generated/pyrotech_generated.groovy | 370 ++++++++++++- .../compat/mods/pyrotech/Anvil.java | 2 +- .../compat/mods/pyrotech/Bloomery.java | 370 +++++++++++++ .../compat/mods/pyrotech/BrickCrucible.java | 2 +- .../compat/mods/pyrotech/PitBurn.java | 277 ++++++++++ .../compat/mods/pyrotech/PyroTech.java | 8 + .../compat/mods/pyrotech/StoneCrucible.java | 15 +- .../compat/mods/pyrotech/WitherForge.java | 336 ++++++++++++ .../compat/mods/pyrotech/Worktable.java | 500 ++++++++++++++++++ .../pyrotech/BloomeryRecipeBaseAccessor.java | 16 + .../JEIRecipeWrapperPitBurnMixin.java | 28 + .../JEIRecipeWrapperRefractoryBurnMixin.java | 28 + .../assets/groovyscript/lang/en_us.lang | 43 ++ .../mixin.groovyscript.pyrotech.json | 3 + 14 files changed, 1989 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/BloomeryRecipeBaseAccessor.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperPitBurnMixin.java create mode 100644 src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperRefractoryBurnMixin.java diff --git a/examples/postInit/generated/pyrotech_generated.groovy b/examples/postInit/generated/pyrotech_generated.groovy index c19de0851..16c616885 100644 --- a/examples/postInit/generated/pyrotech_generated.groovy +++ b/examples/postInit/generated/pyrotech_generated.groovy @@ -59,6 +59,95 @@ mods.pyrotech.barrel.recipeBuilder() mods.pyrotech.barrel.add('iron_dirt_water_to_lava', ore('ingotIron'), ore('ingotIron'), item('minecraft:dirt'), item('minecraft:dirt'), fluid('water'), fluid('lava'), 1000) +// Bloomery: +// Converts item to bloom or a different item by burning it. + +mods.pyrotech.bloomery.removeByInput(item('minecraft:gold_ore')) +// mods.pyrotech.bloomery.removeByOutput(item('minecraft:iron_nugget')) +// mods.pyrotech.bloomery.removeAll() + +mods.pyrotech.bloomery.recipeBuilder() + .input(item('minecraft:iron_block')) + .bloom(item('minecraft:apple')) + .failureChance(0.0F) + .slag(item('minecraft:carrot')) + .inherit(true) + .name('metal_vegetation') + .register() + +mods.pyrotech.bloomery.recipeBuilder() + .input(item('minecraft:noteblock')) + .output(item('minecraft:record_13')) + .experience(0.25F) + .tierIronclad(true) + .bloomYield(1, 1) + .burnTime(2000) + .failureChance(0.5F) + .failureOutput(item('minecraft:record_11'), 1) + .inherit(true) + .name('recipe_for_soundphiles') + .register() + +mods.pyrotech.bloomery.recipeBuilder() + .input(item('minecraft:sponge')) + .output(item('minecraft:sponge')) + .bloomYield(2, 5) + .typePickaxe() + .langKey(item('minecraft:stick').getTranslationKey()) + .inherit(true) + .name('sponge_duplication') + .register() + +mods.pyrotech.bloomery.recipeBuilder() + .input(item('minecraft:birch_boat')) + .bloom(item('minecraft:dark_oak_boat')) + .tierObsidian() + .failureChance(0.1) + .failureOutput(item('minecraft:spruce_boat'), 5) + .failureOutput(item('minecraft:jungle_boat'), 2) + .failureOutput(item('minecraft:boat'), 1) + .name('boat_smelting') + .register() + +mods.pyrotech.bloomery.recipeBuilder() + .input(item('minecraft:sand')) + .output(item('minecraft:glass')) + .bloomYield(3, 5) + .experience(0.1F) + .burnTime(4000) + .tierGranite() + .tierObsidian() + .anvilHit(2) + .typePickaxe() + .failureChance(0.05) + .failureOutput(item('minecraft:nether_star'), 1) + .failureOutput(item('minecraft:gold_ingot'), 10) + .name('glasswork') + .register() + + +mods.pyrotech.bloomery.add('loreming_the_ipsum', item('minecraft:redstone'), item('minecraft:lava_bucket'), false) +mods.pyrotech.bloomery.add('cooking_a_story', item('minecraft:written_book'), item('minecraft:book'), 200, true) +mods.pyrotech.bloomery.addBloom('cyanide', item('minecraft:poisonous_potato'), item('minecraft:potato'), true) +mods.pyrotech.bloomery.addBloom('good_name', item('minecraft:blaze_powder'), 2, 3, ore('cropCarrot'), 500, 0.3F, true, 0.0F) + +// Refractory Crucible: +// Melts an item into liquid. + +mods.pyrotech.brick_crucible.removeByInput(item('minecraft:gravel')) +mods.pyrotech.brick_crucible.removeByOutput(fluid('water') * 125) +// mods.pyrotech.brick_crucible.removeAll() + +mods.pyrotech.brick_crucible.recipeBuilder() + .input(item('minecraft:vine')) + .fluidOutput(fluid('water') * 250) + .burnTime(60) + .name('water_from_vine') + .register() + + +mods.pyrotech.brick_crucible.add('lava_from_obsidian', ore('obsidian'), fluid('lava') * 1000, 2000) + // Refractory Kiln: // Converts an item into a new one by burning it. Has a chance to fail. @@ -95,8 +184,8 @@ mods.pyrotech.brick_oven.recipeBuilder() mods.pyrotech.brick_oven.add('lead_poisoning', item('minecraft:slime_ball'), item('minecraft:lead') * 16, 1000) -// groovyscript.wiki.pyrotech.brick_sawmill.title: -// groovyscript.wiki.pyrotech.brick_sawmill.description. +// Refractory Sawmill: +// Converts an item, likely wood, by cutting it to a smaller item and drops wood chips. mods.pyrotech.brick_sawmill.removeByInput(item('minecraft:planks:1')) mods.pyrotech.brick_sawmill.removeByOutput(item('pyrotech:material:23')) @@ -247,8 +336,8 @@ mods.pyrotech.drying_rack.recipeBuilder() mods.pyrotech.drying_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true) -// groovyscript.wiki.pyrotech.mechanical_compacting_bin.title: -// groovyscript.wiki.pyrotech.mechanical_compacting_bin.description. +// Mechanical Compacting Bin: +// Compacting Bin but automatic. mods.pyrotech.mechanical_compacting_bin.removeByInput(item('minecraft:snowball')) mods.pyrotech.mechanical_compacting_bin.removeByOutput(item('minecraft:bone_block')) @@ -265,6 +354,58 @@ mods.pyrotech.mechanical_compacting_bin.recipeBuilder() mods.pyrotech.mechanical_compacting_bin.add('wheat_to_hay_block', ore('cropWheat') * 9, item('minecraft:hay_block')) mods.pyrotech.mechanical_compacting_bin.add('gold_to_wheat', ore('ingotGold') * 4, item('minecraft:wheat') * 64, 4, 4, 3, 2) +// Pit Burning: +// Converts a block in world to an item and fluid by burning. + +mods.pyrotech.pit_burn.removeByInput(item('minecraft:coal_block')) +mods.pyrotech.pit_burn.removeByOutput(item('minecraft:coal', 1) * 10) +// mods.pyrotech.pit_burn.removeAll() + +mods.pyrotech.pit_burn.recipeBuilder() + .input(item('minecraft:cauldron')) + .output(item('minecraft:cobblestone')) + .fluidOutput(fluid('water') * 50) + .burnStages(6) + .burnTime(1200) + .name('water_from_cauldron') + .register() + +mods.pyrotech.pit_burn.recipeBuilder() + .input(item('minecraft:soul_sand')) + .output(item('minecraft:sand')) + .fluidOutput(fluid('lava') * 200) + .requiresRefractoryBlocks(true) + .burnStages(2) + .burnTime(600) + .failureChance(0.25F) + .failureOutput(item('minecraft:gravel') * 2) + .failureOutput(item('minecraft:dirt') * 3) + .name('lava_to_sand') + .register() + +mods.pyrotech.pit_burn.recipeBuilder() + .input(blockstate('minecraft:sponge', + 'wet=true')) + .output(item('minecraft:sponge')) + .fluidOutput(fluid('water') * 25) + .fluidLevelAffectsFailureChance(true) + .burnStages(10) + .burnTime(500) + .name('sponge_dehydrating') + .register() + +mods.pyrotech.pit_burn.recipeBuilder() + .input(item('minecraft:chest')) + .output(item('minecraft:ender_chest')) + .fluidOutput(fluid('lava') * 125) + .fluidLevelAffectsFailureChance(true) + .requiresRefractoryBlocks(true) + .burnStages(4) + .burnTime(2000) + .name('chest_burning') + .register() + + // Pit Kiln: // Converts an item into a new one by burning it. Has a chance to fail. @@ -312,6 +453,24 @@ mods.pyrotech.soaking_pot.recipeBuilder() mods.pyrotech.soaking_pot.add('dirt_to_apple', item('minecraft:dirt'), fluid('water'), item('minecraft:apple'), 1200) +// Stone Crucible: +// Melts an item into liquid. + +mods.pyrotech.stone_crucible.removeByInput(item('minecraft:ice')) +mods.pyrotech.stone_crucible.removeByOutput(fluid('water') * 500) +// mods.pyrotech.stone_crucible.removeAll() + +mods.pyrotech.stone_crucible.recipeBuilder() + .input(ore('sugarcane')) + .fluidOutput(fluid('water') * 500) + .burnTime(1000) + .inherit(true) + .name('water_from_sugarcane') + + + +mods.pyrotech.stone_crucible.add('water_from_cactus', ore('blockCactus'), fluid('water') * 1000, 600, true) + // Stone Kiln: // Converts an item into a new one by burning it. Has a chance to fail. @@ -358,8 +517,8 @@ mods.pyrotech.stone_oven.recipeBuilder() mods.pyrotech.stone_oven.add('sand_to_dirt', item('minecraft:sand'), item('minecraft:dirt'), 1000, true) -// groovyscript.wiki.pyrotech.stone_sawmill.title: -// groovyscript.wiki.pyrotech.stone_sawmill.description. +// Stone Sawmill: +// Converts an item, likely wood, by cutting it to a smaller item and drops wood chips. mods.pyrotech.stone_sawmill.removeByInput(item('minecraft:planks:1')) mods.pyrotech.stone_sawmill.removeByOutput(item('pyrotech:material:23')) @@ -401,3 +560,202 @@ mods.pyrotech.tanning_rack.recipeBuilder() mods.pyrotech.tanning_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, item('minecraft:clay_ball')) + +// Wither Forge: +// Converts item to bloom or a different item by burning it. + +mods.pyrotech.wither_forge.removeByInput(item('minecraft:gold_ore')) +// mods.pyrotech.wither_forge.removeByOutput(item('minecraft:iron_nugget')) +// mods.pyrotech.wither_forge.removeAll() + +mods.pyrotech.wither_forge.recipeBuilder() + .input(item('minecraft:minecart')) + .output(item('minecraft:furnace_minecart')) + .slag(item('minecraft:iron_ingot')) + .experience(0.8F) + .bloomYield(1, 1) + .burnTime(2000) + .failureChance(0.5F) + .failureOutput(item('minecraft:tnt_minecart'), 1) + .name('minecart_smelting') + .register() + +mods.pyrotech.wither_forge.recipeBuilder() + .input(item('minecraft:fishing_rod') | item('minecraft:carrot_on_a_stick')) + .output(item('minecraft:cooked_fish')) + .bloomYield(5, 8) + .langKey(item('minecraft:fishing_rod').getTranslationKey()) + .name('fishing') + .register() + +mods.pyrotech.wither_forge.recipeBuilder() + .input(item('minecraft:paper')) + .bloom(item('minecraft:book')) + .tierGranite() + .tierObsidian() + .failureChance(0.1F) + .failureOutput(item('minecraft:milk_bucket'), 5) + .failureOutput(item('minecraft:bone'), 2) + .name('knowledge') + .register() + +mods.pyrotech.wither_forge.recipeBuilder() + .input(item('minecraft:comparator')) + .output(item('minecraft:redstone')) + .bloomYield(12, 15) + .experience(0.6F) + .burnTime(4000) + .tierIronclad(true) + .anvilHit(5) + .typePickaxe() + .failureChance(0.15F) + .failureOutput(item('minecraft:glowstone_dust'), 5) + .failureOutput(item('minecraft:sugar'), 4) + .name('comparator_melting') + .register() + + +mods.pyrotech.wither_forge.add('flower_pot', item('minecraft:flower_pot'), item('minecraft:clay_ball')) +mods.pyrotech.wither_forge.add('hoopify', item('minecraft:hopper') * 4, item('minecraft:chest'), 60) +mods.pyrotech.wither_forge.addBloom('quartz_recipe', item('minecraft:quartz') * 3, ore('oreQuartz')) +mods.pyrotech.wither_forge.addBloom('feathery', item('minecraft:feather'), 10, 15, item('minecraft:chicken'), 200, 0.1F, 0.25F, item('minecraft:cooked_chicken')) + +// Worktable: +// Crafting table with where you hit it with a tool to craft stuff. + +mods.pyrotech.worktable.remove(resource('minecraft:stonebrick')) +mods.pyrotech.worktable.remove('minecraft:mossy_stonebrick') +mods.pyrotech.worktable.removeByOutput(item('pyrotech:iron_hunters_knife')) +// mods.pyrotech.worktable.removeAll() + +mods.pyrotech.worktable.shapedBuilder() + .name('irons_to_dirts') + .output(item('minecraft:dirt') * 8) + .shape([[item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')], + [item('minecraft:iron_ingot'),null,item('minecraft:iron_ingot')], + [item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')]]) + .replaceByName() + .register() + +mods.pyrotech.worktable.shapedBuilder() + .name(resource('minecraft:sea_lantern')) + .output(item('minecraft:clay')) + .shape([[ore('blockRedstone')], + [ore('blockRedstone')], + [ore('blockRedstone')]]) + .replaceByName() + .register() + +mods.pyrotech.worktable.shapedBuilder() + .output(item('minecraft:nether_star')) + .row('TXT') + .row('X X') + .row('!X!') + .key('T', item('minecraft:gravel')) + .key('X', item('minecraft:clay').reuse()) + .key('!', item('minecraft:gunpowder').transform({ _ -> item('minecraft:diamond') })) + .tool(item('minecraft:diamond_sword'), 5) + .register() + +mods.pyrotech.worktable.shapedBuilder() + .output(item('minecraft:clay_ball') * 3) + .shape('S S', + ' G ', + 'SWS') + .key([S: ore('ingotIron').reuse(), G: ore('gemDiamond'), W: fluid('water') * 1000]) + .tool(item('minecraft:diamond_axe'), 3) + .register() + +mods.pyrotech.worktable.shapedBuilder() + .name('gold_duplication_with_tnt') + .output(item('minecraft:gold_block')) + .row('!!!') + .row('!S!') + .row('!!!') + .key([S: ore('blockGold').reuse(), '!': item('minecraft:tnt').transform(item('minecraft:diamond'))]) + .tool(item('minecraft:iron_shovel'), 2) + .register() + +mods.pyrotech.worktable.shapedBuilder() + .output(item('minecraft:clay')) + .row(' B') + .key('B', item('minecraft:glass_bottle')) + .tool(item('minecraft:stone_sword'), 3) + .register() + +mods.pyrotech.worktable.shapedBuilder() + .output(item('minecraft:clay')) + .row(' 1 ') + .row(' 0 ') + .row(' 1 ') + .key('1', item('minecraft:iron_sword')) + .key('0', item('minecraft:diamond_sword').withNbt([display:[Name:'Sword with Specific NBT data']])) + .tool(item('minecraft:iron_axe'), 4) + .register() + +mods.pyrotech.worktable.shapelessBuilder() + .output(item('minecraft:string')) + .input([item('minecraft:cobblestone'),item('minecraft:feather'),item('minecraft:gold_ingot')]) + .register() + +mods.pyrotech.worktable.shapelessBuilder() + .name('precious_to_clay') + .output(item('minecraft:clay')) + .input([item('minecraft:emerald'),item('minecraft:iron_ore'),item('minecraft:gold_ingot')]) + .register() + +mods.pyrotech.worktable.shapelessBuilder() + .name(resource('example:resource_location2')) + .output(item('minecraft:stone')) + .input([item('minecraft:gold_ore'), item('minecraft:gold_ingot')]) + .register() + +mods.pyrotech.worktable.shapelessBuilder() + .output(item('minecraft:ender_eye')) + .input([item('minecraft:ender_pearl'),item('minecraft:bowl')]) + .replace() + .tool(item('minecraft:iron_sword'), 4) + .register() + +mods.pyrotech.worktable.shapelessBuilder() + .name('minecraft:pink_dye_from_pink_tulp') + .output(item('minecraft:clay')) + .input([item('minecraft:stick')]) + .replaceByName() + .tool(item('minecraft:iron_pickaxe'), 2) + .register() + +mods.pyrotech.worktable.shapelessBuilder() + .name(resource('minecraft:pink_dye_from_peony')) + .output(item('minecraft:coal')) + .input([item('minecraft:stone'), item('minecraft:iron_ingot')]) + .replaceByName() + .tool(item('minecraft:stone_axe'), 2) + .register() + + +// mods.pyrotech.worktable.addShaped(item('minecraft:gold_block'), item('minecraft:diamond_pickaxe'), 2, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.pyrotech.worktable.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.pyrotech.worktable.addShaped(resource('example:resource_location'), item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) +// mods.pyrotech.worktable.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) +// mods.pyrotech.worktable.addShaped('gold_v_to_clay', item('minecraft:clay'), item('minecraft:iron_pickaxe'), 3, [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) +// mods.pyrotech.worktable.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) +// mods.pyrotech.worktable.addShapeless(item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless('precious_to_clay', item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.replaceShaped(item('minecraft:chest'), item('minecraft:iron_axe') | item('minecraft:stone_axe'), 3, [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) +// mods.pyrotech.worktable.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) +// mods.pyrotech.worktable.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:diamond_pickaxe'), 3, item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) +// mods.pyrotech.worktable.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) +// mods.pyrotech.worktable.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, item('minecraft:diamond_pickaxe'), 4, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.pyrotech.worktable.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.pyrotech.worktable.replaceShapeless(item('minecraft:ender_eye'), item('minecraft:shears'), 3, [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) +// mods.pyrotech.worktable.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) +// mods.pyrotech.worktable.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), item('minecraft:stone_axe'), 2, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:iron_axe'), 2, item('minecraft:clay'), [item('minecraft:nether_star')]) +// mods.pyrotech.worktable.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) + diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index de1ffd456..c2aa08805 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -191,7 +191,7 @@ public void validate(GroovyLog.Msg msg) { if (inherit) { String name = null; if (tier.ordinal() < 2) { - name = tier.name().toLowerCase(Locale.US) + "_anvil"; + name = tier.name().toLowerCase(Locale.ENGLISH) + "_anvil"; AnvilRecipe obsidianRecipe = AnvilObsidianRecipesAdd.INHERIT_TRANSFORMER.apply(recipe); obsidianRecipe.setRegistryName(new ResourceLocation(super.name.getNamespace(), name + "/" + super.name.getPath())); ModSupport.PYROTECH.get().anvil.add(obsidianRecipe); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java new file mode 100644 index 000000000..2a7cf07e3 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java @@ -0,0 +1,370 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.core.mixin.pyrotech.BloomeryRecipeBaseAccessor; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; +import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.AnvilRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.ModuleTechBloomery; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.ModuleTechBloomeryConfig; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.init.recipe.WitherForgeRecipesAdd; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.recipe.*; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.List; + +@RegistryDescription +public class Bloomery extends ForgeRegistryWrapper { + + public Bloomery() { + super(ModuleTechBloomery.Registries.BLOOMERY_RECIPE); + } + + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBloomery.class); + } + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:iron_block')).bloom(item('minecraft:apple')).failureChance(0.0F).slag(item('minecraft:carrot')).inherit(true).name('metal_vegetation')"), + @Example(".input(item('minecraft:noteblock')).output(item('minecraft:record_13')).experience(0.25F).tierIronclad(true).bloomYield(1, 1).burnTime(2000).failureChance(0.5F).failureOutput(item('minecraft:record_11'), 1).inherit(true).name('recipe_for_soundphiles')"), + @Example(".input(item('minecraft:sponge')).output(item('minecraft:sponge')).bloomYield(2, 5).typePickaxe().langKey(item('minecraft:stick').getTranslationKey()).inherit(true).name('sponge_duplication')"), + @Example(".input(item('minecraft:birch_boat')).bloom(item('minecraft:dark_oak_boat')).tierObsidian().failureChance(0.1).failureOutput(item('minecraft:spruce_boat'), 5).failureOutput(item('minecraft:jungle_boat'), 2).failureOutput(item('minecraft:boat'), 1).name('boat_smelting')"), + @Example(".input(item('minecraft:sand')).output(item('minecraft:glass')).bloomYield(3, 5).experience(0.1F).burnTime(4000).tierGranite().tierObsidian().anvilHit(2).typePickaxe().failureChance(0.05).failureOutput(item('minecraft:nether_star'), 1).failureOutput(item('minecraft:gold_ingot'), 10).name('glasswork')") + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + public BloomeryRecipe add(String name, ItemStack output, IIngredient input) { + return add(name, output, input, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add0", example = @Example("'loreming_the_ipsum', item('minecraft:redstone'), item('minecraft:lava_bucket'), false")) + public BloomeryRecipe add(String name, ItemStack output, IIngredient input, boolean inherit) { + return recipeBuilder() + .inherit(inherit) + .bloom(output) + .input(input) + .name(name) + .register(); + } + + public BloomeryRecipe add(String name, ItemStack output, IIngredient input, int burnTime) { + return add(name, output, input, burnTime, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add1", example = @Example("'cooking_a_story', item('minecraft:written_book'), item('minecraft:book'), 200, true")) + public BloomeryRecipe add(String name, ItemStack output, IIngredient input, int burnTime, boolean inherit) { + return recipeBuilder() + .inherit(inherit) + .bloom(output) + .burnTime(burnTime) + .input(input) + .name(name) + .register(); + } + + public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, IIngredient input) { + return addBloom(name, bloomOutput, input, false); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.addBloom0", example = @Example("'cyanide', item('minecraft:poisonous_potato'), item('minecraft:potato'), true")) + public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, IIngredient input, boolean inherit) { + return recipeBuilder() + .inherit(inherit) + .output(bloomOutput) + .input(input) + .name(name) + .register(); + } + + public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, int minYield, int maxYield, IIngredient input, int burnTime, float experience, float failureChance, ItemStack... failureItems) { + return addBloom(name, bloomOutput, minYield, maxYield, input, burnTime, experience, false, failureChance, failureItems); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.addBloom1", example = @Example("'good_name', item('minecraft:blaze_powder'), 2, 3, ore('cropCarrot'), 500, 0.3F, true, 0.0F")) + public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, int minYield, int maxYield, IIngredient input, int burnTime, float experience, boolean inherit, float failureChance, ItemStack... failureItems) { + RecipeBuilder builder = recipeBuilder().inherit(inherit); + builder.bloomYield(minYield, maxYield) + .input(input) + .output(bloomOutput) + .name(name); + for (ItemStack stack : failureItems) { + builder.failureOutput(stack, 1); + } + return builder + .burnTime(burnTime) + .experience(experience) + .failureChance(failureChance) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example(value = "item('minecraft:iron_nugget')", commented = true)) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing bloomery recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (BloomeryRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:gold_ore')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing bloomery recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (BloomeryRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property + private ItemStack bloom = ItemStack.EMPTY; + @Property + private ItemStack slag = null; + @Property(comp = @Comp(gt = 0)) + private int burnTime = 21600; + @Property(comp = @Comp(gte = 0)) + private float experience; + @Property(comp = @Comp(gte = 0)) + private int bloomYieldMin = 8; + @Property(comp = @Comp(gte = 0)) + private int bloomYieldMax = 10; + @Property(comp = @Comp(gte = 0)) + private float failureChance = 0.25F; + @Property + private final List failureOutput = new ArrayList<>(1); + @Property + private final EnumSet anvilTiers = EnumSet.allOf(AnvilRecipe.EnumTier.class); + @Property(comp = @Comp(gt = 0)) + private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; + @Property + private AnvilRecipe.EnumType anvilType = AnvilRecipe.EnumType.HAMMER; + @Property + private String langKey; + @Property + private boolean inherit; + + private boolean tiersReset = false; + + @RecipeBuilderMethodDescription + public RecipeBuilder bloom(ItemStack bloom) { + this.bloom = bloom == null ? ItemStack.EMPTY : bloom; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder slag(ItemStack slag) { + this.slag = slag == null ? ItemStack.EMPTY : slag; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder burnTime(int burnTime) { + this.burnTime = burnTime; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder experience(float experience) { + this.experience = experience; + return this; + } + + @RecipeBuilderMethodDescription(field = { + "bloomYieldMin", "bloomYieldMax" + }) + public RecipeBuilder bloomYield(int bloomYieldMin, int bloomYieldMax) { + this.bloomYieldMin = bloomYieldMin; + this.bloomYieldMax = bloomYieldMax; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureChance(float failureChance) { + this.failureChance = failureChance; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureOutput(ItemStack failureOutput, int weight) { + if (failureOutput == null) failureOutput = ItemStack.EMPTY; + this.failureOutput.add(new BloomeryRecipeBase.FailureItem(failureOutput, weight)); + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder anvilTier(AnvilRecipe.EnumTier tier) { + if (!tiersReset) { + anvilTiers.clear(); + tiersReset = true; + } + anvilTiers.add(tier); + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierGranite(boolean inherit) { + anvilTier(AnvilRecipe.EnumTier.GRANITE); + if (inherit) { + anvilTier(AnvilRecipe.EnumTier.IRONCLAD); + anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); + } + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierGranite() { + return tierGranite(false); + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierIronclad(boolean inherit) { + anvilTier(AnvilRecipe.EnumTier.IRONCLAD); + if (inherit) { + anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); + } + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierIronclad() { + return tierIronclad(false); + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierObsidian() { + return anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder anvilType(AnvilRecipe.EnumType anvilType) { + this.anvilType = anvilType; + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilType") + public RecipeBuilder typeHammer() { + return anvilType(AnvilRecipe.EnumType.HAMMER); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder typePickaxe() { + return anvilType(AnvilRecipe.EnumType.PICKAXE); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder anvilHit(int hit) { + this.anvilHit = hit; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder langKey(String langKey) { + this.langKey = langKey; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder inherit(boolean inherit) { + this.inherit = inherit; + return this; + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Bloomery Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + int minOutput = !bloom.isEmpty() ? 0 : 1; + if (slag == null) { + slag = bloom.isEmpty() ? new ItemStack(ModuleTechBloomery.Items.SLAG, 4) : ItemStack.EMPTY; + } + if (failureOutput.isEmpty() && failureChance > 0.0F) { + failureOutput.add(new BloomeryRecipeBase.FailureItem(new ItemStack(ModuleTechBloomery.Items.SLAG), 1)); + } + if (bloom.isEmpty() && bloomYieldMin == 0 && bloomYieldMax == 0) { + bloomYieldMin = 12; + bloomYieldMax = 15; + } + validateItems(msg, 1, 1, minOutput, 1); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); + msg.add(experience < 0, "experience must be a non negative float, yet it was {}", experience); + msg.add(bloomYieldMin < 0 || bloomYieldMin > bloomYieldMax, "bloomYieldMin must be a non negative integer that is smaller than bloomYieldMax, yet it was {}", burnTime); + msg.add(bloomYieldMax < 0, "bloomYieldMax must be a non negative integer, yet it was {}", burnTime); + msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); + msg.add(anvilHit <= 0, "anvilHit must be a non negative integer that is larger than 0, yet it was {}", anvilHit); + msg.add(super.name == null, "name cannot be null"); + msg.add(ModSupport.PYROTECH.get().bloomery.getRegistry().getValue(super.name) != null, "tried to register {}, but it already exists", super.name); + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable BloomeryRecipe register() { + if (!validate()) return null; + BloomeryRecipeBuilder builder = new BloomeryRecipeBuilder(super.name, !output.isEmpty() ? output.get(0) : ItemStack.EMPTY, input.get(0).toMcIngredient()); + failureOutput.forEach(i -> builder.addFailureItem(i.getItemStack(), i.getWeight())); + BloomeryRecipe recipe = builder + .setSlagItem(slag, slag.getCount()) + .setBurnTimeTicks(burnTime) + .setExperience(experience) + .setBloomYield(bloomYieldMin, bloomYieldMax) + .setFailureChance(failureChance) + .setAnvilTiers(anvilTiers.toArray(new AnvilRecipe.EnumTier[0])) + .setLangKey(langKey) + .create(); + ((BloomeryRecipeBaseAccessor) recipe).grs$setOutputBloom(bloom.isEmpty() ? null : bloom); + ModSupport.PYROTECH.get().bloomery.add(recipe); + if (inherit) { + WitherForgeRecipe witherForgeRecipe = WitherForgeRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(new ResourceLocation(super.name.getNamespace(), "bloomery/" + super.name.getPath())); + ((BloomeryRecipeBaseAccessor) recipe).grs$setOutputBloom(((BloomeryRecipeBaseAccessor) recipe).grs$getOutputBloom()); + ModSupport.PYROTECH.get().witherForge.add(witherForgeRecipe); + } + if (bloom.isEmpty()) { + ModSupport.PYROTECH.get().anvil.add(new BloomAnvilRecipe( + recipe.getOutput(), + com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), + anvilHit, + anvilType, + Arrays.copyOf(recipe.getAnvilTiers(), recipe.getAnvilTiers().length), + recipe + ).setRegistryName(super.name)); + } + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java index cc7cb31e4..43c2263ef 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java @@ -30,7 +30,7 @@ public boolean isEnabled() { return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); } - @RecipeBuilderDescription(example = @Example("input(item('minecraft:vine')).fluidOutput(fluid('water') * 250).burnTime(60).name('water_from_vine')")) + @RecipeBuilderDescription(example = @Example(".input(item('minecraft:vine')).fluidOutput(fluid('water') * 250).burnTime(60).name('water_from_vine')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java new file mode 100644 index 000000000..81eb3fbdb --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java @@ -0,0 +1,277 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; +import com.cleanroommc.groovyscript.helper.recipe.IRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; +import com.codetaylor.mc.pyrotech.library.util.BlockMetaMatcher; +import com.codetaylor.mc.pyrotech.modules.tech.refractory.ModuleTechRefractory; +import com.codetaylor.mc.pyrotech.modules.tech.refractory.recipe.PitBurnRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.refractory.recipe.PitBurnRecipeBuilder; +import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemBlockSpecial; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fml.common.registry.ForgeRegistries; +import net.minecraftforge.oredict.OreDictionary; +import org.jetbrains.annotations.Nullable; + +import java.util.function.Predicate; + +@RegistryDescription +public class PitBurn extends ForgeRegistryWrapper { + + public PitBurn() { + super(ModuleTechRefractory.Registries.BURN_RECIPE); + } + + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechRefractory.class); + } + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:cauldron')).output(item('minecraft:cobblestone')).fluidOutput(fluid('water') * 50).burnStages(6).burnTime(1200).name('water_from_cauldron')"), + @Example(".input(item('minecraft:soul_sand')).output(item('minecraft:sand')).fluidOutput(fluid('lava') * 200).requiresRefractoryBlocks(true).burnStages(2).burnTime(600).failureChance(0.25F).failureOutput(item('minecraft:gravel') * 2).failureOutput(item('minecraft:dirt') * 3).name('lava_to_sand')"), + @Example(".input(blockstate('minecraft:sponge', 'wet=true')).output(item('minecraft:sponge')).fluidOutput(fluid('water') * 25).fluidLevelAffectsFailureChance(true).burnStages(10).burnTime(500).name('sponge_dehydrating')"), + @Example(".input(item('minecraft:chest')).output(item('minecraft:ender_chest')).fluidOutput(fluid('lava') * 125).fluidLevelAffectsFailureChance(true).requiresRefractoryBlocks(true).burnStages(4).burnTime(2000).name('chest_burning')") + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:coal', 1) * 10")) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing pit burning recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (PitBurnRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:coal_block')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing pit burning recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + if (input.getMetadata() > 15 && input.getMetadata() != OreDictionary.WILDCARD_VALUE) return; + Block block = getBlock(input); + if (block == Blocks.AIR) return; + for (PitBurnRecipe recipe : getRegistry()) { + BlockMetaMatcher matcher = recipe.getInputMatcher(); + if (matcher.getBlock() == block && (matcher.getMeta() == OreDictionary.WILDCARD_VALUE || input.getMetadata() == OreDictionary.WILDCARD_VALUE || matcher.getMeta() == input.getMetadata())) { + remove(recipe); + } + } + } + + public static class RecipeBuilder implements IRecipeBuilder { + + @Property + private ResourceLocation name; + @Property + private MatcherPredicate input; + @Property + private ItemStack output; + @Property(comp = @Comp(gt = 0)) + private int burnStages; + @Property(comp = @Comp(gt = 0)) + private int burnTime; + private FluidStack fluidOutput; + @Property(comp = @Comp(gte = 0)) + private float failureChance; + @Property + private final ItemStackList failureOutput = new ItemStackList(); + @Property + private boolean requiresRefractoryBlocks; + @Property + private boolean fluidLevelAffectsFailureChance; + + @RecipeBuilderMethodDescription + public RecipeBuilder name(String name) { + if (name.contains(":")) { + this.name = new ResourceLocation(name); + } else { + this.name = new ResourceLocation(GroovyScript.getRunConfig().getPackId(), name); + } + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder name(ResourceLocation name) { + this.name = name; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(ItemStack input) { + return input(getBlock(input), input.getMetadata()); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(IBlockState state) { + return input(state.getBlock(), state.getBlock().getMetaFromState(state)); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder input(Block block, int metadata) { + if (block == Blocks.AIR) { + return this; + } + Predicate predicate = s -> s.getBlock() == block && (metadata == OreDictionary.WILDCARD_VALUE || s.getBlock().getMetaFromState(s) == metadata); + if (this.input == null) { + this.input = new MatcherPredicate(block, metadata, predicate); + } + else if (this.input.getBlock() == Blocks.AIR) { + this.input = new MatcherPredicate(block, metadata, this.input.predicate.or(predicate)); + } + else { + this.input = new MatcherPredicate(this.input.getBlock(), this.input.getMeta(), this.input.predicate.or(predicate)); + } + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder output(ItemStack output) { + this.output = output; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder burnStages(int burnStages) { + this.burnStages = burnStages; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder burnTime(int burnTime) { + this.burnTime = burnTime; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder fluidOutput(FluidStack fluidOutput) { + this.fluidOutput = fluidOutput; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureChance(float failureChance) { + this.failureChance = failureChance; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureOutput(ItemStack failureOutputs) { + this.failureOutput.add(failureOutputs); + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureOutput(ItemStack... failureOutputs) { + for (ItemStack itemStack : failureOutputs) { + failureOutput(itemStack); + } + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureOutput(Iterable failureOutputs) { + for (ItemStack itemStack : failureOutputs) { + failureOutput(itemStack); + } + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder requiresRefractoryBlocks(boolean requiresRefractoryBlocks) { + this.requiresRefractoryBlocks = requiresRefractoryBlocks; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder fluidLevelAffectsFailureChance(boolean fluidLevelAffectsFailureChance) { + this.fluidLevelAffectsFailureChance = fluidLevelAffectsFailureChance; + return this; + } + + + @Override + public boolean validate() { + GroovyLog.Msg msg = GroovyLog.msg("Error adding Pyrotech Pit Burn Recipe"); + msg.add(input == null, "input is null"); + msg.add(output == null, "output is empty"); + msg.add(burnStages <= 0, "burnStages must be a non negative integer that is larger than 0, yet it was {}", burnStages); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); + msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); + msg.add(name == null, "name cannot be null"); + msg.add(fluidOutput != null && fluidOutput.amount * burnStages > 500, "fluidOutput amount must not be larger than 500"); + msg.add(ModSupport.PYROTECH.get().pitBurn.getRegistry().getValue(name) != null, "tried to register {}, but it already exists.", name); + return false; + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable PitBurnRecipe register() { + PitBurnRecipeBuilder builder = new PitBurnRecipeBuilder(output, input) + .setBurnStages(burnStages) + .setTotalBurnTimeTicks(burnTime) + .setFluidProduced(fluidOutput) + .setFailureChance(failureChance) + .setRequiresRefractoryBlocks(requiresRefractoryBlocks) + .setFluidLevelAffectsFailureChance(fluidLevelAffectsFailureChance); + failureOutput.forEach(builder::addFailureItem); + PitBurnRecipe recipe = builder.create(name); + ModSupport.PYROTECH.get().pitBurn.add(recipe); + return recipe; + } + } + + private static class MatcherPredicate extends BlockMetaMatcher { + + private final Predicate predicate; + + public MatcherPredicate(Block block, int metadata, Predicate predicate) { + super(block, metadata); + this.predicate = predicate; + } + + @Override + public boolean test(IBlockState blockState) { + return this.predicate.test(blockState); + } + } + + private static Block getBlock(ItemStack stack) { + Item item = stack.getItem(); + if (item instanceof ItemBlock) { + return ((ItemBlock) item).getBlock(); + } + if (item instanceof ItemBlockSpecial) { + return ((ItemBlockSpecial) item).getBlock(); + } + Block block = ForgeRegistries.BLOCKS.getValue(item.getRegistryName()); + if (block == null) block = Blocks.AIR; + return block; + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java index 3b89b776c..9d15d6fdf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java @@ -24,6 +24,10 @@ public class PyroTech extends GroovyPropertyContainer { public final TanningRack tanningRack; public final StoneCrucible stoneCrucible; public final BrickCrucible brickCrucible; + public final Worktable worktable; + public final Bloomery bloomery; + public final WitherForge witherForge; + public final PitBurn pitBurn; public PyroTech() { this.barrel = new Barrel(); @@ -46,5 +50,9 @@ public PyroTech() { this.tanningRack = new TanningRack(); this.stoneCrucible = new StoneCrucible(); this.brickCrucible = new BrickCrucible(); + this.worktable = new Worktable(); + this.bloomery = new Bloomery(); + this.witherForge = new WitherForge(); + this.pitBurn = new PitBurn(); } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java index a41f59cbf..a9d5e511a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java @@ -4,6 +4,7 @@ import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.codetaylor.mc.pyrotech.ModPyrotech; @@ -28,7 +29,7 @@ public boolean isEnabled() { return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); } - @RecipeBuilderDescription(example = @Example(".input(ore('sugarcane')).output(fluid('water') * 500).burnTime(1000).inherit(true).name('water_from_sugarcane')")) + @RecipeBuilderDescription(example = @Example(".input(ore('sugarcane')).fluidOutput(fluid('water') * 500).burnTime(1000).inherit(true).name('water_from_sugarcane')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } @@ -50,6 +51,12 @@ public StoneCrucibleRecipe add(String name, IIngredient input, FluidStack output @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:ice')")) public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing stone crucible recipe") + .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } for (StoneCrucibleRecipe recipe : getRegistry()) { if (recipe.getInput().test(input)) { remove(recipe); @@ -59,6 +66,12 @@ public void removeByInput(ItemStack input) { @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("fluid('water') * 500")) public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing stone crucible recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } for (StoneCrucibleRecipe recipe : getRegistry()) { if (output.test(recipe.getOutput())) { remove(recipe); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java new file mode 100644 index 000000000..e096183dd --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java @@ -0,0 +1,336 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.core.mixin.pyrotech.BloomeryRecipeBaseAccessor; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.pyrotech.ModPyrotech; +import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.AnvilRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.ModuleTechBloomery; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.ModuleTechBloomeryConfig; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.recipe.BloomAnvilRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.recipe.BloomeryRecipeBase; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.recipe.WitherForgeRecipe; +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.recipe.WitherForgeRecipeBuilder; +import net.minecraft.item.ItemStack; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.List; + +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.pyrotech.wither_forge.note0", + format = Admonition.Format.STANDARD, + hasTitle = true)) +public class WitherForge extends ForgeRegistryWrapper { + + public WitherForge() { + super(ModuleTechBloomery.Registries.WITHER_FORGE_RECIPE); + } + + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBloomery.class); + } + + @RecipeBuilderDescription(example = { + @Example(".input(item('minecraft:minecart')).output(item('minecraft:furnace_minecart')).slag(item('minecraft:iron_ingot')).experience(0.8F).bloomYield(1, 1).burnTime(2000).failureChance(0.5F).failureOutput(item('minecraft:tnt_minecart'), 1).name('minecart_smelting')"), + @Example(".input(item('minecraft:fishing_rod') | item('minecraft:carrot_on_a_stick')).output(item('minecraft:cooked_fish')).bloomYield(5, 8).langKey(item('minecraft:fishing_rod').getTranslationKey()).name('fishing')"), + @Example(".input(item('minecraft:paper')).bloom(item('minecraft:book')).tierGranite().tierObsidian().failureChance(0.1F).failureOutput(item('minecraft:milk_bucket'), 5).failureOutput(item('minecraft:bone'), 2).name('knowledge')"), + @Example(".input(item('minecraft:comparator')).output(item('minecraft:redstone')).bloomYield(12, 15).experience(0.6F).burnTime(4000).tierIronclad(true).anvilHit(5).typePickaxe().failureChance(0.15F).failureOutput(item('minecraft:glowstone_dust'), 5).failureOutput(item('minecraft:sugar'), 4).name('comparator_melting')") + }) + public RecipeBuilder recipeBuilder() { + return new RecipeBuilder(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.wither_forge.add0", example = @Example("'flower_pot', item('minecraft:flower_pot'), item('minecraft:clay_ball')")) + public WitherForgeRecipe add(String name, ItemStack output, IIngredient input) { + return recipeBuilder() + .bloom(output) + .input(input) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.wither_forge.add1", example = @Example("'hoopify', item('minecraft:hopper') * 4, item('minecraft:chest'), 60")) + public WitherForgeRecipe add(String name, ItemStack output, IIngredient input, int burnTime) { + return recipeBuilder() + .bloom(output) + .burnTime(burnTime) + .input(input) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.wither_forge.addBloom0", example = @Example("'quartz_recipe', item('minecraft:quartz') * 3, ore('oreQuartz')")) + public WitherForgeRecipe addBloom(String name, ItemStack bloomOutput, IIngredient input) { + return recipeBuilder() + .output(bloomOutput) + .input(input) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.wither_forge.addBloom1", example = @Example("'feathery', item('minecraft:feather'), 10, 15, item('minecraft:chicken'), 200, 0.1F, 0.25F, item('minecraft:cooked_chicken')")) + public WitherForgeRecipe addBloom(String name, ItemStack bloomOutput, int minYield, int maxYield, IIngredient input, int burnTime, float experience, float failureChance, ItemStack... failureItems) { + RecipeBuilder builder = recipeBuilder(); + builder.bloomYield(minYield, maxYield) + .input(input) + .output(bloomOutput) + .name(name); + for (ItemStack stack : failureItems) { + builder.failureOutput(stack, 1); + } + return builder + .burnTime(burnTime) + .experience(experience) + .failureChance(failureChance) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example(value = "item('minecraft:iron_nugget')", commented = true)) + public void removeByOutput(IIngredient output) { + if (GroovyLog.msg("Error removing wither forge recipe") + .add(IngredientHelper.isEmpty(output), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (WitherForgeRecipe recipe : getRegistry()) { + if (output.test(recipe.getOutput())) { + remove(recipe); + } + } + } + + @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('minecraft:gold_ore')")) + public void removeByInput(ItemStack input) { + if (GroovyLog.msg("Error removing wither forge recipe") + .add(IngredientHelper.isEmpty(input), () -> "Output 1 must not be empty") + .error() + .postIfNotEmpty()) { + return; + } + for (WitherForgeRecipe recipe : getRegistry()) { + if (recipe.getInput().test(input)) { + remove(recipe); + } + } + } + + @Property(property = "input", comp = @Comp(eq = 1)) + @Property(property = "output", comp = @Comp(eq = 1)) + @Property(property = "name") + public static class RecipeBuilder extends AbstractRecipeBuilder { + + @Property(value = "groovyscript.wiki.pyrotech.bloomery.bloom.value") + private ItemStack bloom = ItemStack.EMPTY; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.slag.value") + private ItemStack slag = null; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.burnTime.value", comp = @Comp(gt = 0)) + private int burnTime = 21600; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.experience.value", comp = @Comp(gte = 0)) + private float experience; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.bloomYieldMin.value", comp = @Comp(gte = 0)) + private int bloomYieldMin = 8; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.bloomYieldMax.value", comp = @Comp(gte = 0)) + private int bloomYieldMax = 10; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.failureChance.value", comp = @Comp(gte = 0)) + private float failureChance = 0.25F; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.failureOutput.value") + private final List failureOutput = new ArrayList<>(1); + @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilTiers.value") + private final EnumSet anvilTiers = EnumSet.allOf(AnvilRecipe.EnumTier.class); + @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilHit.value") + private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilType.value") + private AnvilRecipe.EnumType anvilType = AnvilRecipe.EnumType.HAMMER; + @Property(value = "groovyscript.wiki.pyrotech.bloomery.langKey.value") + private String langKey; + + private boolean tiersReset = false; + + @RecipeBuilderMethodDescription + public RecipeBuilder bloom(ItemStack bloom) { + this.bloom = bloom == null ? ItemStack.EMPTY : bloom; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder slag(ItemStack slag) { + this.slag = slag == null ? ItemStack.EMPTY : slag; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder burnTime(int burnTime) { + this.burnTime = burnTime; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder experience(float experience) { + this.experience = experience; + return this; + } + + @RecipeBuilderMethodDescription(field = { + "bloomYieldMin", "bloomYieldMax" + }) + public RecipeBuilder bloomYield(int bloomYieldMin, int bloomYieldMax) { + this.bloomYieldMin = bloomYieldMin; + this.bloomYieldMax = bloomYieldMax; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureChance(float failureChance) { + this.failureChance = failureChance; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder failureOutput(ItemStack failureOutput, int weight) { + this.failureOutput.add(new BloomeryRecipeBase.FailureItem(failureOutput, weight)); + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder anvilTier(AnvilRecipe.EnumTier tier) { + if (!tiersReset) { + anvilTiers.clear(); + tiersReset = true; + } + anvilTiers.add(tier); + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierGranite(boolean inherit) { + anvilTier(AnvilRecipe.EnumTier.GRANITE); + if (inherit) { + anvilTier(AnvilRecipe.EnumTier.IRONCLAD); + anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); + } + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierGranite() { + return tierGranite(false); + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierIronclad(boolean inherit) { + anvilTier(AnvilRecipe.EnumTier.IRONCLAD); + if (inherit) { + anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); + } + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierIronclad() { + return tierIronclad(false); + } + + @RecipeBuilderMethodDescription(field = "anvilTier") + public RecipeBuilder tierObsidian() { + return anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder anvilType(AnvilRecipe.EnumType anvilType) { + this.anvilType = anvilType; + return this; + } + + @RecipeBuilderMethodDescription(field = "anvilType") + public RecipeBuilder typeHammer() { + return anvilType(AnvilRecipe.EnumType.HAMMER); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder typePickaxe() { + return anvilType(AnvilRecipe.EnumType.PICKAXE); + } + + @RecipeBuilderMethodDescription + public RecipeBuilder anvilHit(int hit) { + this.anvilHit = hit; + return this; + } + + @RecipeBuilderMethodDescription + public RecipeBuilder langKey(String langKey) { + this.langKey = langKey; + return this; + } + + @Override + protected int getMaxItemInput() { + return 1; + } + + @Override + public String getErrorMsg() { + return "Error adding Pyrotech Bloomery Recipe"; + } + + @Override + public void validate(GroovyLog.Msg msg) { + int minOutput = !bloom.isEmpty() ? 0 : 1; + if (slag == null) { + slag = bloom.isEmpty() ? new ItemStack(ModuleTechBloomery.Items.SLAG, 4) : ItemStack.EMPTY; + } + if (failureOutput.isEmpty() && failureChance > 0.0F) { + failureOutput.add(new BloomeryRecipeBase.FailureItem(new ItemStack(ModuleTechBloomery.Items.SLAG), 1)); + } + validateItems(msg, 1, 1, minOutput, 1); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); + msg.add(experience < 0, "experience must be a non negative float, yet it was {}", experience); + msg.add(bloomYieldMin < 0 || bloomYieldMin > bloomYieldMax, "bloomYieldMin must be a non negative integer that is smaller than bloomYieldMax, yet it was {}", burnTime); + msg.add(bloomYieldMax < 0, "bloomYieldMax must be a non negative integer, yet it was {}", burnTime); + msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); + msg.add(super.name == null, "name cannot be null"); + msg.add(ModSupport.PYROTECH.get().witherForge.getRegistry().getValue(super.name) != null, "tried to register {}, but it already exists", super.name); + } + + @RecipeBuilderRegistrationMethod + @Override + public @Nullable WitherForgeRecipe register() { + if (!validate()) return null; + WitherForgeRecipeBuilder builder = new WitherForgeRecipeBuilder(super.name, !output.isEmpty() ? output.get(0) : ItemStack.EMPTY, input.get(0).toMcIngredient()); + failureOutput.forEach(i -> builder.addFailureItem(i.getItemStack(), i.getWeight())); + WitherForgeRecipe recipe = builder + .setSlagItem(slag, slag.getCount()) + .setBurnTimeTicks(burnTime) + .setExperience(experience) + .setBloomYield(bloomYieldMin, bloomYieldMax) + .setFailureChance(failureChance) + .setAnvilTiers(anvilTiers.toArray(new AnvilRecipe.EnumTier[0])) + .setLangKey(langKey) + .create(); + ((BloomeryRecipeBaseAccessor) recipe).grs$setOutputBloom(bloom.isEmpty() ? null : bloom); + ModSupport.PYROTECH.get().witherForge.add(recipe); + if (bloom.isEmpty()) { + ModSupport.PYROTECH.get().anvil.add(new BloomAnvilRecipe( + recipe.getOutput(), + com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), + anvilHit, + anvilType, + Arrays.copyOf(recipe.getAnvilTiers(), recipe.getAnvilTiers().length), + recipe + ).setRegistryName(super.name)); + } + return recipe; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java new file mode 100644 index 000000000..343eba7aa --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java @@ -0,0 +1,500 @@ +package com.cleanroommc.groovyscript.compat.mods.pyrotech; + +import com.cleanroommc.groovyscript.api.GroovyLog; +import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.documentation.annotations.*; +import com.cleanroommc.groovyscript.compat.mods.ModSupport; +import com.cleanroommc.groovyscript.compat.vanilla.ShapedCraftingRecipe; +import com.cleanroommc.groovyscript.compat.vanilla.ShapelessCraftingRecipe; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; +import com.cleanroommc.groovyscript.registry.AbstractCraftingRecipeBuilder; +import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.cleanroommc.groovyscript.registry.ReloadableRegistryManager; +import com.codetaylor.mc.pyrotech.ModPyrotech; +import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; +import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.WorktableRecipe; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.common.registry.ForgeRegistries; + +import java.util.ArrayList; +import java.util.List; + +@RegistryDescription( + admonition = @Admonition( + value = "groovyscript.wiki.minecraft.crafting.note0", + type = Admonition.Type.WARNING, + format = Admonition.Format.STANDARD, + hasTitle = true)) +public class Worktable extends ForgeRegistryWrapper { + + public Worktable() { + super(ModuleTechBasic.Registries.WORKTABLE_RECIPE); + } + + @Override + public boolean isEnabled() { + return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechBasic.class); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped0", example = @Example(value = "item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]", commented = true)) + public void addShaped(ItemStack output, List> input) { + shapedBuilder() + .matrix(input) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped1", example = @Example(value = "'gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]", commented = true)) + public void addShaped(String name, ItemStack output, List> input) { + shapedBuilder() + .matrix(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped1", example = @Example(value = "resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]", commented = true)) + public void addShaped(ResourceLocation name, ItemStack output, List> input) { + shapedBuilder() + .matrix(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless0", example = @Example(value = "item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]", commented = true)) + public void addShapeless(ItemStack output, List input) { + shapelessBuilder() + .input(input) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless1", example = @Example(value = "'precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]", commented = true)) + public void addShapeless(String name, ItemStack output, List input) { + shapelessBuilder() + .input(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless1", example = @Example(value = "resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]", commented = true)) + public void addShapeless(ResourceLocation name, ItemStack output, List input) { + shapelessBuilder() + .input(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped0", example = @Example(value = "item('minecraft:gold_block'), item('minecraft:diamond_pickaxe'), 2, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]", commented = true)) + public void addShaped(ItemStack output, IIngredient tool, int damage, List> input) { + shapedBuilder() + .tool(tool, damage) + .matrix(input) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped1", example = @Example(value = "'gold_v_to_clay', item('minecraft:clay'), item('minecraft:iron_pickaxe'), 3, [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]", commented = true)) + public void addShaped(String name, ItemStack output, IIngredient tool, int damage, List> input) { + shapedBuilder() + .tool(tool, damage) + .matrix(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShaped1", example = @Example(value = "resource('example:resource_location'), item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]", commented = true)) + public void addShaped(ResourceLocation name, ItemStack output, IIngredient tool, int damage, List> input) { + shapedBuilder() + .tool(tool, damage) + .matrix(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless0", example = @Example(value = "item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]", commented = true)) + public void addShapeless(ItemStack output, IIngredient tool, int damage, List input) { + shapelessBuilder() + .tool(tool, damage) + .input(input) + .output(output) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless1", example = @Example(value = "'precious_to_clay', item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]", commented = true)) + public void addShapeless(String name, ItemStack output, IIngredient tool, int damage, List input) { + shapelessBuilder() + .tool(tool, damage) + .input(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.addShapeless1", example = @Example(value = "resource('example:resource_location2'), item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]", commented = true)) + public void addShapeless(ResourceLocation name, ItemStack output, IIngredient tool, int damage, List input) { + shapelessBuilder() + .tool(tool, damage) + .input(input) + .output(output) + .name(name) + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless0", example = @Example(value = "item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]", commented = true)) + public void replaceShapeless(ItemStack output, List input) { + shapelessBuilder() + .input(input) + .output(output) + .replace() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) + public void replaceShapeless(String name, ItemStack output, List input) { + shapelessBuilder() + .input(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]", commented = true)) + public void replaceShapeless(ResourceLocation name, ItemStack output, List input) { + shapelessBuilder() + .input(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped0", example = @Example(value = "item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]", commented = true)) + public void replaceShaped(ItemStack output, List> input) { + shapedBuilder() + .matrix(input) + .output(output) + .replace() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped1", example = @Example(value = "'gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]", commented = true)) + public void replaceShaped(String name, ItemStack output, List> input) { + shapedBuilder() + .matrix(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped1", example = @Example(value = "resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]", commented = true)) + public void replaceShaped(ResourceLocation name, ItemStack output, List> input) { + shapedBuilder() + .matrix(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless0", example = @Example(value = "item('minecraft:ender_eye'), item('minecraft:shears'), 3, [item('minecraft:ender_pearl'),item('minecraft:nether_star')]", commented = true)) + public void replaceShapeless(ItemStack output, IIngredient tool, int damage, List input) { + shapelessBuilder() + .tool(tool, damage) + .input(input) + .output(output) + .replace() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulp', item('minecraft:iron_axe'), 2, item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) + public void replaceShapeless(String name, ItemStack output, IIngredient tool, int damage, List input) { + shapelessBuilder() + .tool(tool, damage) + .input(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), item('minecraft:stone_axe'), 2, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]", commented = true)) + public void replaceShapeless(ResourceLocation name, ItemStack output, IIngredient tool, int damage, List input) { + shapelessBuilder() + .tool(tool, damage) + .input(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped0", example = @Example(value = "item('minecraft:chest'), item('minecraft:iron_axe') | item('minecraft:stone_axe'), 3, [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]", commented = true)) + public void replaceShaped(ItemStack output, IIngredient tool, int damage, List> input) { + shapedBuilder() + .tool(tool, damage) + .matrix(input) + .output(output) + .replace() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped1", example = @Example(value = "'gold_to_diamonds', item('minecraft:diamond') * 8, item('minecraft:diamond_pickaxe'), 4, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]", commented = true)) + public void replaceShaped(String name, ItemStack output, IIngredient tool, int damage, List> input) { + shapedBuilder() + .tool(tool, damage) + .matrix(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShaped1", example = @Example(value = "resource('minecraft:sea_lantern'), item('minecraft:diamond_pickaxe'), 3, item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]", commented = true)) + public void replaceShaped(ResourceLocation name, ItemStack output, IIngredient tool, int damage, List> input) { + shapedBuilder() + .tool(tool, damage) + .matrix(input) + .output(output) + .name(name) + .replaceByName() + .register(); + } + + @MethodDescription(example = @Example("item('pyrotech:iron_hunters_knife')")) + public void removeByOutput(IIngredient output) { + removeByOutput(output, true); + } + + public void removeByOutput(IIngredient output, boolean log) { + if (IngredientHelper.isEmpty(output)) { + if (log) { + GroovyLog.msg("Error removing Pyrotech Worktable recipe") + .add("Output must not be empty") + .error() + .post(); + } + return; + } + List recipesToRemove = new ArrayList<>(); + for (IRecipe recipe : ForgeRegistries.RECIPES) { + if (recipe.getRegistryName() != null && output.test(recipe.getRecipeOutput())) { + recipesToRemove.add(recipe.getRegistryName()); + } + } + if (recipesToRemove.isEmpty()) { + if (log) { + GroovyLog.msg("Error removing Pyrotech Worktable recipe") + .add("No recipes found for {}", output) + .error() + .post(); + } + return; + } + for (ResourceLocation rl : recipesToRemove) { + ReloadableRegistryManager.removeRegistryEntry(ForgeRegistries.RECIPES, rl); + } + } + + @MethodDescription + public void removeByInput(IIngredient input) { + removeByInput(input, true); + } + + public void removeByInput(IIngredient input, boolean log) { + if (IngredientHelper.isEmpty(input)) { + if (log) { + GroovyLog.msg("Error removing Pyrotech Worktable recipe") + .add("Input must not be empty") + .error() + .post(); + } + return; + } + List recipesToRemove = new ArrayList<>(); + for (IRecipe recipe : ForgeRegistries.RECIPES) { + if (recipe.getRegistryName() != null && !recipe.getIngredients().isEmpty() && recipe.getIngredients().stream().anyMatch(i -> i.getMatchingStacks().length > 0 && input.test(i.getMatchingStacks()[0]))) { + recipesToRemove.add(recipe.getRegistryName()); + } + } + if (recipesToRemove.isEmpty()) { + if (log) { + GroovyLog.msg("Error removing Pyrotech Worktable recipe") + .add("No recipes found for {}", input) + .error() + .post(); + } + return; + } + for (ResourceLocation location : recipesToRemove) { + ReloadableRegistryManager.removeRegistryEntry(ForgeRegistries.RECIPES, location); + } + } + + @RecipeBuilderDescription(example = { + @Example(".name('irons_to_dirts').output(item('minecraft:dirt') * 8).shape([[item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')],[item('minecraft:iron_ingot'),null,item('minecraft:iron_ingot')],[item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')]]).replaceByName()"), + @Example(".name(resource('minecraft:sea_lantern')).output(item('minecraft:clay')).shape([[ore('blockRedstone')],[ore('blockRedstone')],[ore('blockRedstone')]]).replaceByName()"), + @Example(".output(item('minecraft:nether_star')).row('TXT').row('X X').row('!X!').key('T', item('minecraft:gravel')).key('X', item('minecraft:clay').reuse()).key('!', item('minecraft:gunpowder').transform({ _ -> item('minecraft:diamond') })).tool(item('minecraft:diamond_sword'), 5)"), + @Example(".output(item('minecraft:clay_ball') * 3).shape('S S', ' G ', 'SWS').key([S: ore('ingotIron').reuse(), G: ore('gemDiamond'), W: fluid('water') * 1000]).tool(item('minecraft:diamond_axe'), 3)"), + @Example(".name('gold_duplication_with_tnt').output(item('minecraft:gold_block')).row('!!!').row('!S!').row('!!!').key([S: ore('blockGold').reuse(), '!': item('minecraft:tnt').transform(item('minecraft:diamond'))]).tool(item('minecraft:iron_shovel'), 2)"), + @Example(".output(item('minecraft:clay')).row(' B').key('B', item('minecraft:glass_bottle')).tool(item('minecraft:stone_sword'), 3)"), + @Example(".output(item('minecraft:clay')).row(' 1 ').row(' 0 ').row(' 1 ').key('1', item('minecraft:iron_sword')).key('0', item('minecraft:diamond_sword').withNbt([display:[Name:'Sword with Specific NBT data']])).tool(item('minecraft:iron_axe'), 4)"), + }) + public Shaped shapedBuilder() { + return new Shaped(); + } + + @RecipeBuilderDescription(example = { + @Example(".output(item('minecraft:string')).input([item('minecraft:cobblestone'),item('minecraft:feather'),item('minecraft:gold_ingot')])"), + @Example(".name('precious_to_clay').output(item('minecraft:clay')).input([item('minecraft:emerald'),item('minecraft:iron_ore'),item('minecraft:gold_ingot')])"), + @Example(".name(resource('example:resource_location2')).output(item('minecraft:stone')).input([item('minecraft:gold_ore'), item('minecraft:gold_ingot')])"), + @Example(".output(item('minecraft:ender_eye')).input([item('minecraft:ender_pearl'),item('minecraft:bowl')]).replace().tool(item('minecraft:iron_sword'), 4)"), + @Example(".name('minecraft:pink_dye_from_pink_tulp').output(item('minecraft:clay')).input([item('minecraft:stick')]).replaceByName().tool(item('minecraft:iron_pickaxe'), 2)"), + @Example(".name(resource('minecraft:pink_dye_from_peony')).output(item('minecraft:coal')).input([item('minecraft:stone'), item('minecraft:iron_ingot')]).replaceByName().tool(item('minecraft:stone_axe'), 2)"), + }) + public Shapeless shapelessBuilder() { + return new Shapeless(); + } + + @Property(property = "mirrored") + @Property(property = "recipeFunction") + @Property(property = "recipeAction") + @Property(property = "name") + public static class Shaped extends AbstractCraftingRecipeBuilder.AbstractShaped { + + @Property + private IIngredient tool = IIngredient.EMPTY; + @Property(comp = @Comp(gte = 0)) + private int damage; + + public Shaped() { + super(3, 3); + } + + public Shaped tool(IIngredient tool, int damage) { + this.tool = tool; + this.damage = damage; + return this; + } + + @Override + protected void handleReplace() { + if (replace == 1) { + ModSupport.PYROTECH.get().worktable.removeByOutput(IngredientHelper.toIIngredient(output), false); + } else if (replace == 2) { + if (name == null) { + GroovyLog.msg("Error replacing Pyrotech Worktable recipe") + .add("Name must not be null when replacing by name") + .error() + .post(); + return; + } + ReloadableRegistryManager.removeRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), name); + } + } + + @RecipeBuilderRegistrationMethod + @Override + public WorktableRecipe register() { + validateName(); + GroovyLog.Msg msg = GroovyLog.msg("Error adding Pyrotech Worktable Shaped recipe '{}'", this.name) + .error() + .add((keyBasedMatrix == null || keyBasedMatrix.length == 0) && (ingredientMatrix == null || ingredientMatrix.isEmpty()), () -> "No matrix was defined") + .add(keyBasedMatrix != null && ingredientMatrix != null, () -> "A key based matrix AND a ingredient based matrix was defined. This is not allowed!") + .add(IngredientHelper.isEmpty(this.output), () -> "Output must not be empty") + .add(tool == null, "Tool must not be null") + .add(damage < 0, "Damage must not be a negative integer, yet it was {}", damage); + if (msg.postIfNotEmpty()) return null; + + ShapedCraftingRecipe recipe = null; + if (keyBasedMatrix != null) { + recipe = validateShape(msg, errors, keyBasedMatrix, keyMap, ((width1, height1, ingredients) -> new ShapedCraftingRecipe(output, ingredients, width1, height1, mirrored, recipeFunction, recipeAction))); + } else if (ingredientMatrix != null) { + recipe = validateShape(msg, ingredientMatrix, ((width1, height1, ingredients) -> new ShapedCraftingRecipe(output.copy(), ingredients, width1, height1, mirrored, recipeFunction, recipeAction))); + } + + if (recipe != null) { + handleReplace(); + WorktableRecipe rec = ModSupport.PYROTECH.get().worktable.getRegistry().getValue(this.name); + msg.add(rec != null && rec.getRecipe().canFit(1000, 1000), () -> "a recipe with that name already exists! Either replace or remove the recipe first"); + if (msg.postIfNotEmpty()) return null; + WorktableRecipe worktableRecipe = new WorktableRecipe(recipe, tool == IIngredient.EMPTY ? null : tool.toMcIngredient(), damage, null).setRegistryName(name); + ModSupport.PYROTECH.get().worktable.add(worktableRecipe); + return worktableRecipe; + } + + return null; + } + } + + @Property(property = "recipeFunction") + @Property(property = "recipeAction") + @Property(property = "name") + public static class Shapeless extends AbstractCraftingRecipeBuilder.AbstractShapeless { + + @Property + private IIngredient tool = IIngredient.EMPTY; + @Property(comp = @Comp(gte = 0)) + private int damage; + + public Shapeless() { + super(3, 3); + } + + public Shapeless tool(IIngredient tool, int damage) { + this.tool = tool; + this.damage = damage; + return this; + } + + @Override + protected void handleReplace() { + if (replace == 1) { + ModSupport.PYROTECH.get().worktable.removeByOutput(IngredientHelper.toIIngredient(output), false); + } else if (replace == 2) { + if (name == null) { + GroovyLog.msg("Error replacing Pyrotech Worktable recipe") + .add("Name must not be null when replacing by name") + .error() + .post(); + return; + } + ReloadableRegistryManager.removeRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), name); + } + } + + @RecipeBuilderRegistrationMethod + @Override + public WorktableRecipe register() { + validateName(); + IngredientHelper.trim(ingredients); + GroovyLog.Msg msg = GroovyLog.msg("Error adding Pyrotech Worktable Shapeless recipe '{}'", this.name); + if (msg.add(IngredientHelper.isEmpty(this.output), () -> "Output must not be empty") + .add(ingredients.isEmpty(), () -> "inputs must not be empty") + .add(ingredients.size() > width * height, () -> "maximum inputs are " + (width * height) + " but found " + ingredients.size()) + .add(tool == null, "Tool must not be null") + .add(damage < 0, "Damage must not be a negative integer, yet it was {}", damage) + .error() + .postIfNotEmpty()) { + return null; + } + handleReplace(); + WorktableRecipe rec = ModSupport.PYROTECH.get().worktable.getRegistry().getValue(this.name); + msg.add(rec != null && rec.getRecipe().canFit(1000, 1000), () -> "a recipe with that name already exists! Either replace or remove the recipe first"); + if (msg.postIfNotEmpty()) return null; + ShapelessCraftingRecipe recipe = new ShapelessCraftingRecipe(output.copy(), ingredients, recipeFunction, recipeAction); + rec = new WorktableRecipe(recipe, tool == IIngredient.EMPTY ? null : tool.toMcIngredient(), damage, null); + ReloadableRegistryManager.addRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), name, rec); + return rec; + } + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/BloomeryRecipeBaseAccessor.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/BloomeryRecipeBaseAccessor.java new file mode 100644 index 000000000..5b42b9dcc --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/BloomeryRecipeBaseAccessor.java @@ -0,0 +1,16 @@ +package com.cleanroommc.groovyscript.core.mixin.pyrotech; + +import com.codetaylor.mc.pyrotech.modules.tech.bloomery.recipe.BloomeryRecipeBase; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(value = BloomeryRecipeBase.class, remap = false) +public interface BloomeryRecipeBaseAccessor { + + @Accessor("outputBloom") + ItemStack grs$getOutputBloom(); + + @Accessor("outputBloom") + void grs$setOutputBloom(ItemStack bloom); +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperPitBurnMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperPitBurnMixin.java new file mode 100644 index 000000000..a0d02829b --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperPitBurnMixin.java @@ -0,0 +1,28 @@ +package com.cleanroommc.groovyscript.core.mixin.pyrotech; + +import com.codetaylor.mc.pyrotech.library.spi.plugin.jei.JEIRecipeWrapperTimed; +import com.codetaylor.mc.pyrotech.library.spi.recipe.IRecipeTimed; +import com.codetaylor.mc.pyrotech.modules.tech.refractory.plugin.jei.wrapper.JEIRecipeWrapperPitBurn; +import net.minecraft.block.Block; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraftforge.fml.common.registry.ForgeRegistries; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = JEIRecipeWrapperPitBurn.class, remap = false) +public abstract class JEIRecipeWrapperPitBurnMixin extends JEIRecipeWrapperTimed { + + public JEIRecipeWrapperPitBurnMixin(IRecipeTimed recipe) { + super(recipe); + } + + @Redirect(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getItemFromBlock(Lnet/minecraft/block/Block;)Lnet/minecraft/item/Item;"), remap = false) + private Item getBlockItemProperly(Block blockIn) { + Item item = Item.getItemFromBlock(blockIn); + if (item == Items.AIR) item = ForgeRegistries.ITEMS.getValue(blockIn.getRegistryName()); + if (item == null) item = Items.AIR; + return item; + } +} diff --git a/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperRefractoryBurnMixin.java b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperRefractoryBurnMixin.java new file mode 100644 index 000000000..4c0458bf0 --- /dev/null +++ b/src/main/java/com/cleanroommc/groovyscript/core/mixin/pyrotech/JEIRecipeWrapperRefractoryBurnMixin.java @@ -0,0 +1,28 @@ +package com.cleanroommc.groovyscript.core.mixin.pyrotech; + +import com.codetaylor.mc.pyrotech.library.spi.plugin.jei.JEIRecipeWrapperTimed; +import com.codetaylor.mc.pyrotech.library.spi.recipe.IRecipeTimed; +import com.codetaylor.mc.pyrotech.modules.tech.refractory.plugin.jei.wrapper.JEIRecipeWrapperRefractoryBurn; +import net.minecraft.block.Block; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraftforge.fml.common.registry.ForgeRegistries; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(value = JEIRecipeWrapperRefractoryBurn.class, remap = false) +public abstract class JEIRecipeWrapperRefractoryBurnMixin extends JEIRecipeWrapperTimed { + + public JEIRecipeWrapperRefractoryBurnMixin(IRecipeTimed recipe) { + super(recipe); + } + + @Redirect(method = "", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/Item;getItemFromBlock(Lnet/minecraft/block/Block;)Lnet/minecraft/item/Item;"), remap = false) + private Item getBlockItemProperly(Block blockIn) { + Item item = Item.getItemFromBlock(blockIn); + if (item == Items.AIR) item = ForgeRegistries.ITEMS.getValue(blockIn.getRegistryName()); + if (item == null) item = Items.AIR; + return item; + } +} diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 472959b82..9103eadc4 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -2388,6 +2388,26 @@ groovyscript.wiki.pyrotech.barrel.description=Over time converts a fluid with fo groovyscript.wiki.pyrotech.barrel.duration.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.barrel.add=Adds recipes in the format `name`, `input1`, `input2`, `input3`, `input4`, `fluidInput`, `fluidOutput`, `duration` +groovyscript.wiki.pyrotech.bloomery.title=Bloomery +groovyscript.wiki.pyrotech.bloomery.description=Converts item to bloom or a different item by burning it +groovyscript.wiki.pyrotech.bloomery.add0=Adds recipes in the format `name`, `output`, `input`, `(optional) inherit` +groovyscript.wiki.pyrotech.bloomery.add1=Adds recipes in the format `name`, `output`, `input`, `burnTime`, `(optional) inherit` +groovyscript.wiki.pyrotech.bloomery.addBloom0=Adds recipes in the format `name`, `bloomOutput`, `input`, `(optional) inherit` +groovyscript.wiki.pyrotech.bloomery.addBloom1=Adds recipes in the format `name`, `bloomOutput`, `minYield`, `maxYield`, `input`, `burnTime`, `experience`, `(optional) inherit`, `failureChance`, `failureItems` +groovyscript.wiki.pyrotech.bloomery.slag.value=Sets the slag item +groovyscript.wiki.pyrotech.bloomery.bloom.value=Sets the actual output (bloom) of the Bloomery. Setting langKey, anvil values, experience, bloom yields and failure values are unnecessary if this is set +groovyscript.wiki.pyrotech.bloomery.inherit.value=Sets if the recipe should be inherited by more advanced machines +groovyscript.wiki.pyrotech.bloomery.langKey.value=Sets the localization key to use for blooms name +groovyscript.wiki.pyrotech.bloomery.anvilHit.value=Sets how often the bloom needs to be hit on the anvil +groovyscript.wiki.pyrotech.bloomery.burnTime.value=Sets the time required for the recipe to complete +groovyscript.wiki.pyrotech.bloomery.anvilType.value=Sets the tool that needs to be used in anvil +groovyscript.wiki.pyrotech.bloomery.anvilTiers.value=Sets the allowed anvil tiers bloom allows +groovyscript.wiki.pyrotech.bloomery.experience.value=Sets the experience given from bloom +groovyscript.wiki.pyrotech.bloomery.bloomYieldMin.value=Sets minimum amount of drops bloom can give +groovyscript.wiki.pyrotech.bloomery.bloomYieldMax.value=Sets maximum amount of drops bloom can give +groovyscript.wiki.pyrotech.bloomery.failureChance.value=Sets the chance for bloom to give failure item instead of the actual output +groovyscript.wiki.pyrotech.bloomery.failureOutput.value=Sets the output to drop on failure + groovyscript.wiki.pyrotech.brick_crucible.title=Refractory Crucible groovyscript.wiki.pyrotech.brick_crucible.description=Melts an item into liquid. groovyscript.wiki.pyrotech.brick_crucible.burnTime.value=Sets the time required for the recipe to complete @@ -2457,6 +2477,18 @@ groovyscript.wiki.pyrotech.mechanical_compacting_bin.hits.value=Sets how often t groovyscript.wiki.pyrotech.mechanical_compacting_bin.add=Adds recipes in the format `name`, `input`, `output`, `hits` groovyscript.wiki.pyrotech.mechanical_compacting_bin.note0=Can inherit recipes from [Compacting Bin](./compacting_bin.md) +groovyscript.wiki.pyrotech.pit_burn.title=Pit Burning +groovyscript.wiki.pyrotech.pit_burn.description=Converts a block in world to an item and fluid by burning +groovyscript.wiki.pyrotech.pit_burn.name.value=The recipe registry name +groovyscript.wiki.pyrotech.pit_burn.input.value=Sets the block input +groovyscript.wiki.pyrotech.pit_burn.output.value=Sets the itemstack output +groovyscript.wiki.pyrotech.pit_burn.burnTime.value=Sets the time required for the recipe to complete +groovyscript.wiki.pyrotech.pit_burn.burnStages.value=Sets the output amount. Fluid output gets multiplied by it too +groovyscript.wiki.pyrotech.pit_burn.failureChance.value=Sets the chance to fail the recipe +groovyscript.wiki.pyrotech.pit_burn.failureOutput.value=Sets the output when the recipe failed +groovyscript.wiki.pyrotech.pit_burn.requiresRefractoryBlocks.value=Sets the need to use refractory blocks in the recipe +groovyscript.wiki.pyrotech.pit_burn.fluidLevelAffectsFailureChance.value=Sets if fluid level affects failure chance + groovyscript.wiki.pyrotech.pit_kiln.title=Pit Kiln groovyscript.wiki.pyrotech.pit_kiln.description=Converts an item into a new one by burning it. Has a chance to fail groovyscript.wiki.pyrotech.pit_kiln.burnTime.value=Sets the time required for the recipe to complete @@ -2513,6 +2545,17 @@ groovyscript.wiki.pyrotech.tanning_rack.dryTime.value=Sets the time required for groovyscript.wiki.pyrotech.tanning_rack.failureItem.value=Sets the output when the recipe failed groovyscript.wiki.pyrotech.tanning_rack.add=Adds recipes in the format `name`, `input`, `output`, `dryTime`, `failureItem` +groovyscript.wiki.pyrotech.wither_forge.title=Wither Forge +groovyscript.wiki.pyrotech.wither_forge.description=Converts item to bloom or a different item by burning it +groovyscript.wiki.pyrotech.wither_forge.add0=Adds recipes in the format `name`, `output`, `input` +groovyscript.wiki.pyrotech.wither_forge.add1=Adds recipes in the format `name`, `output`, `input`, `burnTime` +groovyscript.wiki.pyrotech.wither_forge.addBloom0=Adds recipes in the format `name`, `bloomOutput`, `input` +groovyscript.wiki.pyrotech.wither_forge.addBloom1=Adds recipes in the format `name`, `bloomOutput`, `minYield`, `maxYield`, `input`, `burnTime`, `experience`, `failureChance`, `failureItems` + +groovyscript.wiki.pyrotech.worktable.title=Worktable +groovyscript.wiki.pyrotech.worktable.description=Crafting table with where you hit it with a tool to craft stuff +groovyscript.wiki.pyrotech.worktable.tool.value=Sets the tool that will be used +groovyscript.wiki.pyrotech.worktable.damage.value=Sets the damage to put into that tool # PneumaticCraft groovyscript.wiki.pneumaticcraft.amadron.title=Amadron diff --git a/src/main/resources/mixin.groovyscript.pyrotech.json b/src/main/resources/mixin.groovyscript.pyrotech.json index 73baf6c06..ba3e1f318 100644 --- a/src/main/resources/mixin.groovyscript.pyrotech.json +++ b/src/main/resources/mixin.groovyscript.pyrotech.json @@ -5,6 +5,9 @@ "minVersion": "0.8", "compatibilityLevel": "JAVA_8", "mixins": [ + "BloomeryRecipeBaseAccessor", + "JEIRecipeWrapperPitBurnMixin", + "JEIRecipeWrapperRefractoryBurnMixin", "RegistryInitializerMixin" ] } \ No newline at end of file From f52dc84fdf4d88b968981e32fe1437a423a2cf8c Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Fri, 26 Sep 2025 15:00:58 +0300 Subject: [PATCH 10/13] Inline and sort. --- .../compat/mods/pyrotech/PyroTech.java | 75 ++++++------------- 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java index 9d15d6fdf..603bdb932 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PyroTech.java @@ -4,55 +4,28 @@ public class PyroTech extends GroovyPropertyContainer { - public final Barrel barrel; - public final Campfire campfire; - public final StoneOven stoneOven; - public final BrickOven brickOven; - public final ChoppingBlock choppingBlock; - public final StoneSawmill stoneSawmill; - public final BrickSawmill brickSawmill; - public final CompactingBin compactingBin; - public final MechanicalCompactingBin mechanicalCompactingBin; - public final CompostBin compostBin; - public final CrudeDryingRack crudeDryingRack; - public final DryingRack dryingRack; - public final PitKiln pitKiln; - public final StoneKiln stoneKiln; - public final BrickKiln brickKiln; - public final Anvil anvil; - public final SoakingPot soakingPot; - public final TanningRack tanningRack; - public final StoneCrucible stoneCrucible; - public final BrickCrucible brickCrucible; - public final Worktable worktable; - public final Bloomery bloomery; - public final WitherForge witherForge; - public final PitBurn pitBurn; - - public PyroTech() { - this.barrel = new Barrel(); - this.campfire = new Campfire(); - this.stoneOven = new StoneOven(); - this.brickOven = new BrickOven(); - this.choppingBlock = new ChoppingBlock(); - this.stoneSawmill = new StoneSawmill(); - this.brickSawmill = new BrickSawmill(); - this.compactingBin = new CompactingBin(); - this.mechanicalCompactingBin = new MechanicalCompactingBin(); - this.compostBin = new CompostBin(); - this.crudeDryingRack = new CrudeDryingRack(); - this.dryingRack = new DryingRack(); - this.pitKiln = new PitKiln(); - this.stoneKiln = new StoneKiln(); - this.brickKiln = new BrickKiln(); - this.anvil = new Anvil(); - this.soakingPot = new SoakingPot(); - this.tanningRack = new TanningRack(); - this.stoneCrucible = new StoneCrucible(); - this.brickCrucible = new BrickCrucible(); - this.worktable = new Worktable(); - this.bloomery = new Bloomery(); - this.witherForge = new WitherForge(); - this.pitBurn = new PitBurn(); - } + public final Anvil anvil = new Anvil(); + public final Barrel barrel = new Barrel(); + public final Bloomery bloomery = new Bloomery(); + public final BrickCrucible brickCrucible = new BrickCrucible(); + public final BrickKiln brickKiln = new BrickKiln(); + public final BrickOven brickOven = new BrickOven(); + public final BrickSawmill brickSawmill = new BrickSawmill(); + public final Campfire campfire = new Campfire(); + public final ChoppingBlock choppingBlock = new ChoppingBlock(); + public final CompactingBin compactingBin = new CompactingBin(); + public final CompostBin compostBin = new CompostBin(); + public final CrudeDryingRack crudeDryingRack = new CrudeDryingRack(); + public final DryingRack dryingRack = new DryingRack(); + public final MechanicalCompactingBin mechanicalCompactingBin = new MechanicalCompactingBin(); + public final PitBurn pitBurn = new PitBurn(); + public final PitKiln pitKiln = new PitKiln(); + public final SoakingPot soakingPot = new SoakingPot(); + public final StoneCrucible stoneCrucible = new StoneCrucible(); + public final StoneKiln stoneKiln = new StoneKiln(); + public final StoneOven stoneOven = new StoneOven(); + public final StoneSawmill stoneSawmill = new StoneSawmill(); + public final TanningRack tanningRack = new TanningRack(); + public final WitherForge witherForge = new WitherForge(); + public final Worktable worktable = new Worktable(); } From 0f861ef7113f0cbf0bbe2d6e0897526bcfe71932 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Tue, 7 Oct 2025 22:08:43 +0300 Subject: [PATCH 11/13] Add missing annotations and change other forgotten stuff. --- .../generated/pyrotech_generated.groovy | 35 +++-- gradle.properties | 2 +- .../compat/mods/pyrotech/Anvil.java | 16 ++- .../compat/mods/pyrotech/Barrel.java | 7 +- .../compat/mods/pyrotech/Bloomery.java | 128 +++++++----------- .../compat/mods/pyrotech/BrickCrucible.java | 9 +- .../compat/mods/pyrotech/BrickKiln.java | 11 +- .../compat/mods/pyrotech/BrickOven.java | 7 +- .../compat/mods/pyrotech/BrickSawmill.java | 48 ++++--- .../compat/mods/pyrotech/Campfire.java | 7 +- .../compat/mods/pyrotech/ChoppingBlock.java | 17 ++- .../compat/mods/pyrotech/CompactingBin.java | 13 +- .../compat/mods/pyrotech/CompostBin.java | 7 +- .../compat/mods/pyrotech/CrudeDryingRack.java | 13 +- .../compat/mods/pyrotech/DryingRack.java | 13 +- .../pyrotech/MechanicalCompactingBin.java | 7 +- .../compat/mods/pyrotech/PitBurn.java | 19 ++- .../compat/mods/pyrotech/PitKiln.java | 17 ++- .../compat/mods/pyrotech/SoakingPot.java | 7 +- .../compat/mods/pyrotech/StoneCrucible.java | 12 +- .../compat/mods/pyrotech/StoneKiln.java | 14 +- .../compat/mods/pyrotech/StoneOven.java | 10 +- .../compat/mods/pyrotech/StoneSawmill.java | 70 ++++++---- .../compat/mods/pyrotech/TanningRack.java | 12 +- .../compat/mods/pyrotech/WitherForge.java | 46 ++++--- .../compat/mods/pyrotech/Worktable.java | 17 ++- .../assets/groovyscript/lang/en_us.lang | 89 ++++++------ 27 files changed, 392 insertions(+), 261 deletions(-) diff --git a/examples/postInit/generated/pyrotech_generated.groovy b/examples/postInit/generated/pyrotech_generated.groovy index 16c616885..92939605d 100644 --- a/examples/postInit/generated/pyrotech_generated.groovy +++ b/examples/postInit/generated/pyrotech_generated.groovy @@ -5,7 +5,7 @@ log 'mod \'pyrotech\' detected, running script' // Anvil: -// When using hammer or pickaxe it can convert items. +// Converts an item to a new item by hitting it with a hammer or pickaxe. mods.pyrotech.anvil.removeByInput(item('pyrotech:material:37')) mods.pyrotech.anvil.removeByOutput(item('minecraft:stone_slab:3') * 2) @@ -60,7 +60,8 @@ mods.pyrotech.barrel.recipeBuilder() mods.pyrotech.barrel.add('iron_dirt_water_to_lava', ore('ingotIron'), ore('ingotIron'), item('minecraft:dirt'), item('minecraft:dirt'), fluid('water'), fluid('lava'), 1000) // Bloomery: -// Converts item to bloom or a different item by burning it. +// Converts item to a new item or a 'bloom' which are items that needs to be hit with hammer on anvil to get the output +// with varying amounts. mods.pyrotech.bloomery.removeByInput(item('minecraft:gold_ore')) // mods.pyrotech.bloomery.removeByOutput(item('minecraft:iron_nugget')) @@ -79,7 +80,7 @@ mods.pyrotech.bloomery.recipeBuilder() .input(item('minecraft:noteblock')) .output(item('minecraft:record_13')) .experience(0.25F) - .tierIronclad(true) + .tierIronclad() .bloomYield(1, 1) .burnTime(2000) .failureChance(0.5F) @@ -129,10 +130,9 @@ mods.pyrotech.bloomery.recipeBuilder() mods.pyrotech.bloomery.add('loreming_the_ipsum', item('minecraft:redstone'), item('minecraft:lava_bucket'), false) mods.pyrotech.bloomery.add('cooking_a_story', item('minecraft:written_book'), item('minecraft:book'), 200, true) mods.pyrotech.bloomery.addBloom('cyanide', item('minecraft:poisonous_potato'), item('minecraft:potato'), true) -mods.pyrotech.bloomery.addBloom('good_name', item('minecraft:blaze_powder'), 2, 3, ore('cropCarrot'), 500, 0.3F, true, 0.0F) // Refractory Crucible: -// Melts an item into liquid. +// Converts item into a liquid. mods.pyrotech.brick_crucible.removeByInput(item('minecraft:gravel')) mods.pyrotech.brick_crucible.removeByOutput(fluid('water') * 125) @@ -149,7 +149,7 @@ mods.pyrotech.brick_crucible.recipeBuilder() mods.pyrotech.brick_crucible.add('lava_from_obsidian', ore('obsidian'), fluid('lava') * 1000, 2000) // Refractory Kiln: -// Converts an item into a new one by burning it. Has a chance to fail. +// Converts an item into a new item or one of the failure outputs if the recipe fails. mods.pyrotech.brick_kiln.removeByInput(item('minecraft:cobblestone')) mods.pyrotech.brick_kiln.removeByOutput(item('pyrotech:bucket_clay')) @@ -168,7 +168,7 @@ mods.pyrotech.brick_kiln.recipeBuilder() mods.pyrotech.brick_kiln.add('beetroot_soup', item('minecraft:beetroot'), item('minecraft:beetroot_soup'), 1200, 0.1f, item('minecraft:beetroot_seeds')) // Refractory Oven: -// When powered by burning fuel can convert items. +// Converts item into a new item. mods.pyrotech.brick_oven.removeByInput(item('minecraft:porkchop')) mods.pyrotech.brick_oven.removeByOutput(item('minecraft:cooked_porkchop')) @@ -185,7 +185,7 @@ mods.pyrotech.brick_oven.recipeBuilder() mods.pyrotech.brick_oven.add('lead_poisoning', item('minecraft:slime_ball'), item('minecraft:lead') * 16, 1000) // Refractory Sawmill: -// Converts an item, likely wood, by cutting it to a smaller item and drops wood chips. +// Converts an item into a new item with an item with durability and drops wood chips on given amount of time. mods.pyrotech.brick_sawmill.removeByInput(item('minecraft:planks:1')) mods.pyrotech.brick_sawmill.removeByOutput(item('pyrotech:material:23')) @@ -204,7 +204,7 @@ mods.pyrotech.brick_sawmill.add('glowstone_to_dust', item('minecraft:glowstone') mods.pyrotech.brick_sawmill.add('bed_to_wool', item('minecraft:bed'), item('minecraft:wool') * 3, 500, 3) // Campfire: -// When powered by burning logs can convert items. +// Converts item into a new item on given amount of time. mods.pyrotech.campfire.removeByInput(item('minecraft:porkchop')) mods.pyrotech.campfire.removeByOutput(item('minecraft:cooked_porkchop')) @@ -337,7 +337,7 @@ mods.pyrotech.drying_rack.recipeBuilder() mods.pyrotech.drying_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true) // Mechanical Compacting Bin: -// Compacting Bin but automatic. +// Converts given amount of item into new item. mods.pyrotech.mechanical_compacting_bin.removeByInput(item('minecraft:snowball')) mods.pyrotech.mechanical_compacting_bin.removeByOutput(item('minecraft:bone_block')) @@ -435,7 +435,7 @@ mods.pyrotech.pit_kiln.recipeBuilder() mods.pyrotech.pit_kiln.add('brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')) // Soaking Pot: -// Converts an item into a new one by soaking it in a liquid. Can require a campfire. +// Converts an item and liquid into a new item. Can require a campfire below. mods.pyrotech.soaking_pot.removeByInput(item('pyrotech:hide_washed')) mods.pyrotech.soaking_pot.removeByOutput(item('pyrotech:material', 54)) @@ -454,7 +454,7 @@ mods.pyrotech.soaking_pot.recipeBuilder() mods.pyrotech.soaking_pot.add('dirt_to_apple', item('minecraft:dirt'), fluid('water'), item('minecraft:apple'), 1200) // Stone Crucible: -// Melts an item into liquid. +// Converts an item into a liquid. mods.pyrotech.stone_crucible.removeByInput(item('minecraft:ice')) mods.pyrotech.stone_crucible.removeByOutput(fluid('water') * 500) @@ -518,7 +518,7 @@ mods.pyrotech.stone_oven.recipeBuilder() mods.pyrotech.stone_oven.add('sand_to_dirt', item('minecraft:sand'), item('minecraft:dirt'), 1000, true) // Stone Sawmill: -// Converts an item, likely wood, by cutting it to a smaller item and drops wood chips. +// Converts an item into a new item with an item with durability and drops wood chips on given amount of time. mods.pyrotech.stone_sawmill.removeByInput(item('minecraft:planks:1')) mods.pyrotech.stone_sawmill.removeByOutput(item('pyrotech:material:23')) @@ -534,7 +534,7 @@ mods.pyrotech.stone_sawmill.recipeBuilder() .register() mods.pyrotech.stone_sawmill.recipeBuilder() - .input(item('minecraft:stone_pickaxe'), ore('blockIron')) + .input(item('minecraft:stone_pickaxe'), item('pyrotech:sawmill_blade_bone')) .output(item('minecraft:iron_pickaxe')) .duration(5000) .name('stone_pickaxe_upgrade') @@ -562,7 +562,8 @@ mods.pyrotech.tanning_rack.recipeBuilder() mods.pyrotech.tanning_rack.add('apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, item('minecraft:clay_ball')) // Wither Forge: -// Converts item to bloom or a different item by burning it. +// Converts item to a new item or a 'bloom' which are items that needs to be hit with hammer on anvil to get the output +// with varying amounts. mods.pyrotech.wither_forge.removeByInput(item('minecraft:gold_ore')) // mods.pyrotech.wither_forge.removeByOutput(item('minecraft:iron_nugget')) @@ -621,10 +622,8 @@ mods.pyrotech.wither_forge.addBloom('quartz_recipe', item('minecraft:quartz') * mods.pyrotech.wither_forge.addBloom('feathery', item('minecraft:feather'), 10, 15, item('minecraft:chicken'), 200, 0.1F, 0.25F, item('minecraft:cooked_chicken')) // Worktable: -// Crafting table with where you hit it with a tool to craft stuff. +// Crafting table which asks you to hit it with a tool to craft stuff. -mods.pyrotech.worktable.remove(resource('minecraft:stonebrick')) -mods.pyrotech.worktable.remove('minecraft:mossy_stonebrick') mods.pyrotech.worktable.removeByOutput(item('pyrotech:iron_hunters_knife')) // mods.pyrotech.worktable.removeAll() diff --git a/gradle.properties b/gradle.properties index cb1203043..b78dc633e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -95,7 +95,7 @@ debug_pneumaticcraft = false debug_primal_tech = false debug_prodigytech = false debug_projecte = false -debug_pyrotech = true +debug_pyrotech = false debug_random_things = false debug_roots = false diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java index c2aa08805..f7ca753c1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Anvil.java @@ -41,11 +41,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hits, String tier, String type) { return add(name, input, output, hits, tier, type, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'flint_from_gravel', ore('gravel'), item('minecraft:flint'), 5, 'granite', 'pickaxe', true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.anvil.add.inherit", example = @Example("'flint_from_gravel', ore('gravel'), item('minecraft:flint'), 5, 'granite', 'pickaxe', true")) public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hits, String tier, String type, boolean inherit) { AnvilRecipe.EnumTier enumTier = EnumHelper.valueOfNullable(AnvilRecipe.EnumTier.class, tier, false); AnvilRecipe.EnumType enumType = EnumHelper.valueOfNullable(AnvilRecipe.EnumType.class, type, false); @@ -69,7 +70,7 @@ public AnvilRecipe add(String name, IIngredient input, ItemStack output, int hit } @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example("item('pyrotech:material:37')")) - public void removeByInput(ItemStack input) { + public void removeByInput(ItemStack input) { if (GroovyLog.msg("Error removing pyrotech anvil recipe") .add(IngredientHelper.isEmpty(input), () -> "Input 1 must not be empty") .error() @@ -105,9 +106,9 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { @Property(comp = @Comp(gt = 0)) private int hits; - @Property + @Property(comp = @Comp(not = "null")) private AnvilRecipe.EnumType type; - @Property + @Property(comp = @Comp(not = "null")) private AnvilRecipe.EnumTier tier; @Property private boolean inherit; @@ -160,6 +161,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_anvil_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Anvil Recipe"; @@ -173,11 +179,11 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(hits <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", hits); msg.add(type == null, "type cannot be null."); msg.add(tier == null, "tier cannot be null."); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.ANVIL_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); msg.add(tier == AnvilRecipe.EnumTier.OBSIDIAN && inherit, "nothing can inherit from obsidian anvil."); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java index fd95f04a7..b765439a6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Barrel.java @@ -86,12 +86,17 @@ protected int getMaxItemInput() { return 1; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_barrel_"; + } + @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 4, 4, 0, 0); validateFluids(msg, 1, 1, 1, 1); msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.BARREL_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java index 2a7cf07e3..e3fa5ade5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java @@ -19,7 +19,6 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumSet; import java.util.List; @@ -37,7 +36,7 @@ public boolean isEnabled() { @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:iron_block')).bloom(item('minecraft:apple')).failureChance(0.0F).slag(item('minecraft:carrot')).inherit(true).name('metal_vegetation')"), - @Example(".input(item('minecraft:noteblock')).output(item('minecraft:record_13')).experience(0.25F).tierIronclad(true).bloomYield(1, 1).burnTime(2000).failureChance(0.5F).failureOutput(item('minecraft:record_11'), 1).inherit(true).name('recipe_for_soundphiles')"), + @Example(".input(item('minecraft:noteblock')).output(item('minecraft:record_13')).experience(0.25F).tierIronclad().bloomYield(1, 1).burnTime(2000).failureChance(0.5F).failureOutput(item('minecraft:record_11'), 1).inherit(true).name('recipe_for_soundphiles')"), @Example(".input(item('minecraft:sponge')).output(item('minecraft:sponge')).bloomYield(2, 5).typePickaxe().langKey(item('minecraft:stick').getTranslationKey()).inherit(true).name('sponge_duplication')"), @Example(".input(item('minecraft:birch_boat')).bloom(item('minecraft:dark_oak_boat')).tierObsidian().failureChance(0.1).failureOutput(item('minecraft:spruce_boat'), 5).failureOutput(item('minecraft:jungle_boat'), 2).failureOutput(item('minecraft:boat'), 1).name('boat_smelting')"), @Example(".input(item('minecraft:sand')).output(item('minecraft:glass')).bloomYield(3, 5).experience(0.1F).burnTime(4000).tierGranite().tierObsidian().anvilHit(2).typePickaxe().failureChance(0.05).failureOutput(item('minecraft:nether_star'), 1).failureOutput(item('minecraft:gold_ingot'), 10).name('glasswork')") @@ -46,11 +45,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add0") public BloomeryRecipe add(String name, ItemStack output, IIngredient input) { return add(name, output, input, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add0", example = @Example("'loreming_the_ipsum', item('minecraft:redstone'), item('minecraft:lava_bucket'), false")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add0.inherit", example = @Example("'loreming_the_ipsum', item('minecraft:redstone'), item('minecraft:lava_bucket'), false")) public BloomeryRecipe add(String name, ItemStack output, IIngredient input, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -60,11 +60,12 @@ public BloomeryRecipe add(String name, ItemStack output, IIngredient input, bool .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add1") public BloomeryRecipe add(String name, ItemStack output, IIngredient input, int burnTime) { return add(name, output, input, burnTime, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add1", example = @Example("'cooking_a_story', item('minecraft:written_book'), item('minecraft:book'), 200, true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.add1.inherit", example = @Example("'cooking_a_story', item('minecraft:written_book'), item('minecraft:book'), 200, true")) public BloomeryRecipe add(String name, ItemStack output, IIngredient input, int burnTime, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -75,11 +76,12 @@ public BloomeryRecipe add(String name, ItemStack output, IIngredient input, int .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.addBloom0") public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, IIngredient input) { return addBloom(name, bloomOutput, input, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.addBloom0", example = @Example("'cyanide', item('minecraft:poisonous_potato'), item('minecraft:potato'), true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.addBloom0.inherit", example = @Example("'cyanide', item('minecraft:poisonous_potato'), item('minecraft:potato'), true")) public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, IIngredient input, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -89,27 +91,6 @@ public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, IIngredient i .register(); } - public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, int minYield, int maxYield, IIngredient input, int burnTime, float experience, float failureChance, ItemStack... failureItems) { - return addBloom(name, bloomOutput, minYield, maxYield, input, burnTime, experience, false, failureChance, failureItems); - } - - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.bloomery.addBloom1", example = @Example("'good_name', item('minecraft:blaze_powder'), 2, 3, ore('cropCarrot'), 500, 0.3F, true, 0.0F")) - public BloomeryRecipe addBloom(String name, ItemStack bloomOutput, int minYield, int maxYield, IIngredient input, int burnTime, float experience, boolean inherit, float failureChance, ItemStack... failureItems) { - RecipeBuilder builder = recipeBuilder().inherit(inherit); - builder.bloomYield(minYield, maxYield) - .input(input) - .output(bloomOutput) - .name(name); - for (ItemStack stack : failureItems) { - builder.failureOutput(stack, 1); - } - return builder - .burnTime(burnTime) - .experience(experience) - .failureChance(failureChance) - .register(); - } - @MethodDescription(type = MethodDescription.Type.REMOVAL, example = @Example(value = "item('minecraft:iron_nugget')", commented = true)) public void removeByOutput(IIngredient output) { if (GroovyLog.msg("Error removing bloomery recipe") @@ -149,40 +130,38 @@ public static class RecipeBuilder extends AbstractRecipeBuilder private ItemStack bloom = ItemStack.EMPTY; @Property private ItemStack slag = null; - @Property(comp = @Comp(gt = 0)) + @Property(comp = @Comp(gt = 0), defaultValue = "21600") private int burnTime = 21600; @Property(comp = @Comp(gte = 0)) private float experience; - @Property(comp = @Comp(gte = 0)) - private int bloomYieldMin = 8; - @Property(comp = @Comp(gte = 0)) - private int bloomYieldMax = 10; - @Property(comp = @Comp(gte = 0)) + @Property(comp = @Comp(gte = 0), defaultValue = "12") + private int bloomYieldMin = 12; + @Property(comp = @Comp(gte = 0), defaultValue = "15") + private int bloomYieldMax = 15; + @Property(comp = @Comp(gte = 0, lte = 1), defaultValue = "0.25") private float failureChance = 0.25F; @Property private final List failureOutput = new ArrayList<>(1); @Property - private final EnumSet anvilTiers = EnumSet.allOf(AnvilRecipe.EnumTier.class); + private final EnumSet anvilTiers = EnumSet.noneOf(AnvilRecipe.EnumTier.class); @Property(comp = @Comp(gt = 0)) private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; - @Property + @Property(comp = @Comp(not = "null"), defaultValue = "hammer") private AnvilRecipe.EnumType anvilType = AnvilRecipe.EnumType.HAMMER; @Property private String langKey; @Property private boolean inherit; - private boolean tiersReset = false; - @RecipeBuilderMethodDescription public RecipeBuilder bloom(ItemStack bloom) { - this.bloom = bloom == null ? ItemStack.EMPTY : bloom; + this.bloom = bloom; return this; } @RecipeBuilderMethodDescription public RecipeBuilder slag(ItemStack slag) { - this.slag = slag == null ? ItemStack.EMPTY : slag; + this.slag = slag; return this; } @@ -222,41 +201,18 @@ public RecipeBuilder failureOutput(ItemStack failureOutput, int weight) { @RecipeBuilderMethodDescription public RecipeBuilder anvilTier(AnvilRecipe.EnumTier tier) { - if (!tiersReset) { - anvilTiers.clear(); - tiersReset = true; - } anvilTiers.add(tier); return this; } - @RecipeBuilderMethodDescription(field = "anvilTier") - public RecipeBuilder tierGranite(boolean inherit) { - anvilTier(AnvilRecipe.EnumTier.GRANITE); - if (inherit) { - anvilTier(AnvilRecipe.EnumTier.IRONCLAD); - anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); - } - return this; - } - @RecipeBuilderMethodDescription(field = "anvilTier") public RecipeBuilder tierGranite() { - return tierGranite(false); - } - - @RecipeBuilderMethodDescription(field = "anvilTier") - public RecipeBuilder tierIronclad(boolean inherit) { - anvilTier(AnvilRecipe.EnumTier.IRONCLAD); - if (inherit) { - anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); - } - return this; + return anvilTier(AnvilRecipe.EnumTier.GRANITE); } @RecipeBuilderMethodDescription(field = "anvilTier") public RecipeBuilder tierIronclad() { - return tierIronclad(false); + return anvilTier(AnvilRecipe.EnumTier.IRONCLAD); } @RecipeBuilderMethodDescription(field = "anvilTier") @@ -265,8 +221,8 @@ public RecipeBuilder tierObsidian() { } @RecipeBuilderMethodDescription - public RecipeBuilder anvilType(AnvilRecipe.EnumType anvilType) { - this.anvilType = anvilType; + public RecipeBuilder anvilType(AnvilRecipe.EnumType type) { + anvilType = type; return this; } @@ -298,6 +254,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_bloomery_"; + } + @Override protected int getMaxItemInput() { return 1; @@ -310,6 +271,13 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); + if (bloom == null) { + bloom = ItemStack.EMPTY; + } + if (slag == null) { + slag = ItemStack.EMPTY; + } int minOutput = !bloom.isEmpty() ? 0 : 1; if (slag == null) { slag = bloom.isEmpty() ? new ItemStack(ModuleTechBloomery.Items.SLAG, 4) : ItemStack.EMPTY; @@ -317,18 +285,17 @@ public void validate(GroovyLog.Msg msg) { if (failureOutput.isEmpty() && failureChance > 0.0F) { failureOutput.add(new BloomeryRecipeBase.FailureItem(new ItemStack(ModuleTechBloomery.Items.SLAG), 1)); } - if (bloom.isEmpty() && bloomYieldMin == 0 && bloomYieldMax == 0) { - bloomYieldMin = 12; - bloomYieldMax = 15; + if (anvilTiers.isEmpty()) { + anvilTiers.addAll(EnumSet.allOf(AnvilRecipe.EnumTier.class)); } validateItems(msg, 1, 1, minOutput, 1); msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(experience < 0, "experience must be a non negative float, yet it was {}", experience); msg.add(bloomYieldMin < 0 || bloomYieldMin > bloomYieldMax, "bloomYieldMin must be a non negative integer that is smaller than bloomYieldMax, yet it was {}", burnTime); msg.add(bloomYieldMax < 0, "bloomYieldMax must be a non negative integer, yet it was {}", burnTime); - msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); + msg.add(failureChance < 0 || failureChance > 1, "failureChance must not be negative nor larger than 1.0, yet it was {}", failureChance); + msg.add(anvilType == null, "anvilType must not be null"); msg.add(anvilHit <= 0, "anvilHit must be a non negative integer that is larger than 0, yet it was {}", anvilHit); - msg.add(super.name == null, "name cannot be null"); msg.add(ModSupport.PYROTECH.get().bloomery.getRegistry().getValue(super.name) != null, "tried to register {}, but it already exists", super.name); } @@ -336,7 +303,7 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable BloomeryRecipe register() { if (!validate()) return null; - BloomeryRecipeBuilder builder = new BloomeryRecipeBuilder(super.name, !output.isEmpty() ? output.get(0) : ItemStack.EMPTY, input.get(0).toMcIngredient()); + BloomeryRecipeBuilder builder = new BloomeryRecipeBuilder(super.name, output.getOrEmpty(0), input.get(0).toMcIngredient()); failureOutput.forEach(i -> builder.addFailureItem(i.getItemStack(), i.getWeight())); BloomeryRecipe recipe = builder .setSlagItem(slag, slag.getCount()) @@ -354,15 +321,16 @@ public void validate(GroovyLog.Msg msg) { ((BloomeryRecipeBaseAccessor) recipe).grs$setOutputBloom(((BloomeryRecipeBaseAccessor) recipe).grs$getOutputBloom()); ModSupport.PYROTECH.get().witherForge.add(witherForgeRecipe); } - if (bloom.isEmpty()) { - ModSupport.PYROTECH.get().anvil.add(new BloomAnvilRecipe( - recipe.getOutput(), - com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), - anvilHit, - anvilType, - Arrays.copyOf(recipe.getAnvilTiers(), recipe.getAnvilTiers().length), - recipe - ).setRegistryName(super.name)); + if (bloom.isEmpty() && bloomYieldMax != 0) { + ModSupport.PYROTECH.get().anvil.add( + new BloomAnvilRecipe( + recipe.getOutput(), + com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), + anvilHit, + anvilType, + recipe.getAnvilTiers(), + recipe + ).setRegistryName(super.name)); } return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java index 43c2263ef..a0557e0a2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickCrucible.java @@ -89,6 +89,11 @@ public RecipeBuilder burnTime(int burnTime) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_brick_crucible_"; + } + @Override protected int getMaxItemInput() { return 1; @@ -101,10 +106,10 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 0, 0); validateFluids(msg, 0, 0, 1, 1); - msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); - msg.add(super.name == null, "name cannot be null"); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java index d3c9fa5cf..4631111bd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickKiln.java @@ -86,7 +86,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder private final ItemStackList failureOutput = new ItemStackList(); @Property(comp = @Comp(gt = 0)) private int burnTime; - @Property(comp = @Comp(gte = 0)) + @Property(comp = @Comp(gte = 0, lte = 1)) private float failureChance; @RecipeBuilderMethodDescription @@ -123,6 +123,11 @@ public RecipeBuilder failureOutput(Iterable failureOutputs) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_brick_kiln_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Refractory Kiln Recipe"; @@ -130,11 +135,11 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); - msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); - msg.add(super.name == null, "name cannot be null."); + msg.add(failureChance < 0 || failureChance > 1, "failureChance must not be negative nor larger than 1.0, yet it was {}", failureChance); msg.add(ModuleTechMachine.Registries.BRICK_KILN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java index d96ccfb84..cc80b06e7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickOven.java @@ -96,6 +96,11 @@ public RecipeBuilder duration(int time) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_brick_oven_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Brick Oven Recipe"; @@ -103,9 +108,9 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.BRICK_OVEN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java index b765b5d7d..10fafbe66 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java @@ -7,8 +7,10 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.athenaeum.util.ArrayHelper; import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachineConfig; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickSawmillRecipe; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; @@ -16,6 +18,8 @@ import net.minecraftforge.oredict.OreDictionary; import org.jetbrains.annotations.Nullable; +import java.util.Objects; + @RegistryDescription( admonition = { @Admonition( @@ -97,7 +101,7 @@ public void removeByOutput(IIngredient output) { } } - @Property(property = "input", comp = @Comp(gte = 1, lt = 3)) + @Property(property = "input", comp = @Comp(gte = 1, lte = 2)) @Property(property = "output", comp = @Comp(eq = 1)) @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { @@ -119,6 +123,11 @@ public RecipeBuilder woodChips(int woodChips) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_brick_sawmill_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Refractory Sawmill Recipe"; @@ -126,9 +135,14 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 2, 1, 1); + if (input.size() > 1) { + for (ItemStack stack : input.get(1).toMcIngredient().getMatchingStacks()) { + msg.add(!ArrayHelper.contains(ModuleTechMachineConfig.BRICK_SAWMILL.SAWMILL_BLADES, Objects.requireNonNull(stack.getItem().getRegistryName()).toString()), "{} is not a brick sawmill blade", stack); + } + } msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.BRICK_SAWMILL_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -137,23 +151,25 @@ public void validate(GroovyLog.Msg msg) { public @Nullable BrickSawmillRecipe register() { if (!validate()) return null; if (input.size() > 1) { - return this.addRecipe(1, 1, input.get(1).toMcIngredient(), 1, ""); - } - else { - BrickSawmillRecipe recipe = this.addRecipe(1, 1, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 1, ""); - this.addRecipe(2, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 2, "_flint_blade"); - this.addRecipe(2, 0.5, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_iron_blade"); - this.addRecipe(3, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_diamond_blade"); + BrickSawmillRecipe recipe = new BrickSawmillRecipe(output.get(0), input.get(0).toMcIngredient(), duration, input.get(1).toMcIngredient(), woodChips).setRegistryName(super.name); + ModSupport.PYROTECH.get().brickSawmill.add(recipe); return recipe; + } else { + return addMultiRecipe(output.get(0), input.get(0).toMcIngredient(), woodChips, duration, super.name); } } + } - private BrickSawmillRecipe addRecipe(int outputMultiplier, double durationMultiplier, Ingredient blade, int woodChipsDivisor, String name) { - ItemStack out = output.get(0).copy(); - out.setCount(Math.min(output.get(0).getCount() * outputMultiplier, 64)); - BrickSawmillRecipe recipe = new BrickSawmillRecipe(out, input.get(0).toMcIngredient(), (int) ((double) duration * durationMultiplier), blade, woodChips / woodChipsDivisor).setRegistryName(new ResourceLocation(super.name.getNamespace(), super.name.getPath() + name)); - ModSupport.PYROTECH.get().brickSawmill.add(recipe); - return recipe; - } + protected static BrickSawmillRecipe addMultiRecipe(ItemStack output, Ingredient input, int woodChips, int duration, ResourceLocation name) { + BrickSawmillRecipe recipe = new BrickSawmillRecipe(output, input, duration, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips).setRegistryName(name + "_tier_0"); + ModSupport.PYROTECH.get().brickSawmill.add(recipe); + ItemStack out = output.copy(); + out.setCount(Math.min(output.getMaxStackSize(), output.getCount() * 2)); + ModSupport.PYROTECH.get().brickSawmill.add(new BrickSawmillRecipe(out, input, (int) (1.5 * (double) duration), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips / 2).setRegistryName(name + "_tier_1")); + ModSupport.PYROTECH.get().brickSawmill.add(new BrickSawmillRecipe(out, input, (int) (0.5 * (double) duration), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips / 4).setRegistryName(name + "_tier_2")); + out = output.copy(); + out.setCount(Math.min(output.getMaxStackSize(), output.getCount() * 3)); + ModSupport.PYROTECH.get().brickSawmill.add(new BrickSawmillRecipe(out, input, (int) (1.5 * (double) duration), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips / 4).setRegistryName(name + "_tier_3")); + return recipe; } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java index ba71a9041..ee21d0e41 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Campfire.java @@ -84,6 +84,11 @@ public RecipeBuilder duration(int time) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_campfire_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Campfire Recipe"; @@ -97,9 +102,9 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.CAMPFIRE_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java index a1bfb8e39..655909d1d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/ChoppingBlock.java @@ -98,6 +98,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_chopping_block_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Chopping Block Recipe"; @@ -111,9 +116,9 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(chops.stream().anyMatch(i -> i <= 0) || quantities.stream().anyMatch(i -> i <= 0), "chops and quantities must not have a negative integer value or zero"); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.CHOPPING_BLOCK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); msg.add(chops.size() != quantities.size(), "Size of chops and quantities should be equal"); } @@ -124,7 +129,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; ChoppingBlockRecipe recipe = new ChoppingBlockRecipe(output.get(0), input.get(0).toMcIngredient(), chops.toIntArray(), quantities.toIntArray()).setRegistryName(super.name); ModSupport.PYROTECH.get().choppingBlock.add(recipe); - if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + if (inherit && ModSupport.PYROTECH.get().stoneSawmill.isEnabled()) { addSawmillRecipes(ModuleTechMachineConfig.STONE_SAWMILL.INHERITED_CHOPPING_BLOCK_RECIPE_DURATION_MODIFIER); } return recipe; @@ -135,25 +140,25 @@ private void addSawmillRecipes(double durationModifier) { Ingredient in = input.get(0).toMcIngredient(); out.setCount(!quantities.isEmpty() ? quantities.get(0) : 1); ResourceLocation registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_0"); - StoneSawmillRecipe recipe = (new StoneSawmillRecipe(out, in, (int)((!chops.isEmpty() ? chops.getInt(0) * 40.0 : 240.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, 32767)), 4)).setRegistryName(registryName); + StoneSawmillRecipe recipe = (new StoneSawmillRecipe(out, in, (int) ((!chops.isEmpty() ? chops.getInt(0) * 40.0 : 240.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, 32767)), 4)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); out = output.get(0).copy(); out.setCount(quantities.size() > 1 ? quantities.get(1) : 2); registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_1"); - recipe = (new StoneSawmillRecipe(out, in, (int)((chops.size() > 1 ? chops.getInt(1) * 40.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, 32767)), 2)).setRegistryName(registryName); + recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 1 ? chops.getInt(1) * 40.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, 32767)), 2)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); out = output.get(0).copy(); registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_2"); out.setCount(quantities.size() > 2 ? quantities.get(2) : quantities.size() > 1 ? quantities.get(1) : 2); - recipe = (new StoneSawmillRecipe(out, in, (int)((chops.size() > 2 ? chops.getInt(2) * 60.0 : 120.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.OBSIDIAN_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); + recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 2 ? chops.getInt(2) * 60.0 : 120.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.OBSIDIAN_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); out = output.get(0).copy(); out.setCount(quantities.size() > 3 ? quantities.get(3) : 3); new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_3"); - recipe = (new StoneSawmillRecipe(out, in, (int)((chops.size() > 3 ? chops.getInt(3) * 80.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); + recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 3 ? chops.getInt(3) * 80.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java index f514511ca..f761516af 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompactingBin.java @@ -11,7 +11,6 @@ import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasicConfig; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CompactingBinRecipe; -import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.MechanicalCompactingBinRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.MechanicalCompactingBinRecipe; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -39,11 +38,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public CompactingBinRecipe add(String name, IIngredient input, ItemStack output, int... hits) { return add(name, input, output, false, hits); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'iron_to_clay', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, false, 9, 7, 6, 6")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.compacting_bin.add.inherit", example = @Example("'iron_to_clay', ore('ingotIron') * 5, item('minecraft:clay_ball') * 20, false, 9, 7, 6, 6")) public CompactingBinRecipe add(String name, IIngredient input, ItemStack output, boolean inherit, int... hits) { return recipeBuilder() .inherit(inherit) @@ -108,6 +108,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_compacting_bin_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Compacting Bin Recipe"; @@ -115,9 +120,9 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that is larger than 0"); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -127,7 +132,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; CompactingBinRecipe recipe = new CompactingBinRecipe(output.get(0), input.get(0).toMcIngredient(), input.get(0).getAmount(), hits.isEmpty() ? ModuleTechBasicConfig.COMPACTING_BIN.TOOL_USES_REQUIRED_PER_HARVEST_LEVEL : hits.toIntArray()).setRegistryName(super.name); ModSupport.PYROTECH.get().compactingBin.add(recipe); - if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + if (inherit && ModSupport.PYROTECH.get().mechanicalCompactingBin.isEnabled()) { MechanicalCompactingBinRecipe mechanicalCompactingBinRecipe = MechanicalCompactingBinRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(super.name.getNamespace(), "compacting_bin/" + super.name.getPath()); ModSupport.PYROTECH.get().mechanicalCompactingBin.add(mechanicalCompactingBinRecipe); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java index 8be8ec115..6509e0906 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CompostBin.java @@ -85,6 +85,11 @@ public RecipeBuilder compostValue(int compostValue) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_compost_bin_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Compost Bin Recipe"; @@ -98,9 +103,9 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(compostValue <= 0, "compostValue must be a non negative integer that is larger than 0, yet it was {}", compostValue); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java index 88afb5066..bc6386f51 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/CrudeDryingRack.java @@ -12,7 +12,6 @@ import com.codetaylor.mc.pyrotech.modules.tech.basic.init.recipe.DryingRackRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.CrudeDryingRackRecipe; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.DryingRackRecipe; -import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; @@ -41,11 +40,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public CrudeDryingRackRecipe add(String name, IIngredient input, ItemStack output, int dryTime) { return add(name, input, output, dryTime, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.crude_drying_rack.add.inherit", example = @Example("'apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true")) public CrudeDryingRackRecipe add(String name, IIngredient input, ItemStack output, int dryTime, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -108,6 +108,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_crude_drying_rack_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Crude Drying Rack Recipe"; @@ -121,9 +126,9 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(dryTime <= 0, "dryTime must be a non negative integer that is larger than 0, yet it was {}", dryTime); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.CRUDE_DRYING_RACK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -137,7 +142,7 @@ public void validate(GroovyLog.Msg msg) { ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "crude_drying_rack/" + super.name.getPath()); DryingRackRecipe dryingRackRecipe = DryingRackRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); ModSupport.PYROTECH.get().dryingRack.add(dryingRackRecipe); - if (ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + if (ModSupport.PYROTECH.get().stoneOven.isEnabled()) { StoneOvenRecipe stoneOvenRecipe = StoneOvenRecipesAdd.INHERIT_TRANSFORMER.apply(dryingRackRecipe).setRegistryName(location); ModSupport.PYROTECH.get().stoneOven.add(stoneOvenRecipe); BrickOvenRecipe brickOvenRecipe = BrickOvenRecipesAdd.INHERIT_TRANSFORMER.apply(stoneOvenRecipe).setRegistryName(location); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java index 263cd6608..7121244db 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/DryingRack.java @@ -10,7 +10,6 @@ import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.DryingRackRecipe; -import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneOvenRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.BrickOvenRecipe; @@ -43,11 +42,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public DryingRackRecipe add(String name, IIngredient input, ItemStack output, int dryTime) { return add(name, input, output, dryTime, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.drying_rack.add.inherit", example = @Example("'apple_to_dirt', item('minecraft:apple'), item('minecraft:dirt'), 1200, true")) public DryingRackRecipe add(String name, IIngredient input, ItemStack output, int dryTime, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -110,6 +110,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_drying_rack_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Drying Rack Recipe"; @@ -123,9 +128,9 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(dryTime <= 0, "dryTime must be a non negative integer that is larger than 0, yet it was {}", dryTime); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.DRYING_RACK_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -135,7 +140,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; DryingRackRecipe recipe = new DryingRackRecipe(output.get(0), input.get(0).toMcIngredient(), dryTime).setRegistryName(super.name); ModSupport.PYROTECH.get().dryingRack.add(recipe); - if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + if (inherit && ModSupport.PYROTECH.get().stoneOven.isEnabled()) { ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "drying_rack/" + super.name.getPath()); StoneOvenRecipe stoneOvenRecipe = StoneOvenRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); ModSupport.PYROTECH.get().stoneOven.add(stoneOvenRecipe); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java index 78860ac41..710958d18 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java @@ -99,6 +99,11 @@ public RecipeBuilder hits(int... hits) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_mechanical_compacting_bin_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Compacting Bin Recipe"; @@ -106,9 +111,9 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(hits.stream().anyMatch(i -> i <= 0), "hits must be a non negative integer that is larger than 0"); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.COMPACTING_BIN_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java index 81eb3fbdb..ef1dfcd13 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java @@ -87,18 +87,18 @@ public void removeByInput(ItemStack input) { public static class RecipeBuilder implements IRecipeBuilder { - @Property + @Property(comp = @Comp(not = "null")) private ResourceLocation name; - @Property + @Property(comp = @Comp(not = "null")) private MatcherPredicate input; - @Property + @Property(comp = @Comp(not = "null")) private ItemStack output; @Property(comp = @Comp(gt = 0)) private int burnStages; @Property(comp = @Comp(gt = 0)) private int burnTime; private FluidStack fluidOutput; - @Property(comp = @Comp(gte = 0)) + @Property(comp = @Comp(gte = 0, lte = 1)) private float failureChance; @Property private final ItemStackList failureOutput = new ItemStackList(); @@ -141,11 +141,9 @@ public RecipeBuilder input(Block block, int metadata) { Predicate predicate = s -> s.getBlock() == block && (metadata == OreDictionary.WILDCARD_VALUE || s.getBlock().getMetaFromState(s) == metadata); if (this.input == null) { this.input = new MatcherPredicate(block, metadata, predicate); - } - else if (this.input.getBlock() == Blocks.AIR) { + } else if (this.input.getBlock() == Blocks.AIR) { this.input = new MatcherPredicate(block, metadata, this.input.predicate.or(predicate)); - } - else { + } else { this.input = new MatcherPredicate(this.input.getBlock(), this.input.getMeta(), this.input.predicate.or(predicate)); } return this; @@ -215,16 +213,15 @@ public RecipeBuilder fluidLevelAffectsFailureChance(boolean fluidLevelAffectsFai return this; } - @Override public boolean validate() { GroovyLog.Msg msg = GroovyLog.msg("Error adding Pyrotech Pit Burn Recipe"); + msg.add(name == null, "name cannot be null"); msg.add(input == null, "input is null"); msg.add(output == null, "output is empty"); msg.add(burnStages <= 0, "burnStages must be a non negative integer that is larger than 0, yet it was {}", burnStages); msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); - msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); - msg.add(name == null, "name cannot be null"); + msg.add(failureChance < 0 || failureChance > 1, "failureChance must not be negative nor larger than 1.0, yet it was {}", failureChance); msg.add(fluidOutput != null && fluidOutput.amount * burnStages > 500, "fluidOutput amount must not be larger than 500"); msg.add(ModSupport.PYROTECH.get().pitBurn.getRegistry().getValue(name) != null, "tried to register {}, but it already exists.", name); return false; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java index ab178930c..a58124424 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitKiln.java @@ -12,7 +12,6 @@ import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.basic.ModuleTechBasic; import com.codetaylor.mc.pyrotech.modules.tech.basic.recipe.KilnPitRecipe; -import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickKilnRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.StoneKilnRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneKilnRecipe; @@ -40,11 +39,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, ItemStack... failureOutput) { return add(name, input, output, burnTime, false, failureChance, failureOutput); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.pit_kiln.add.inherit", example = @Example("'brick_to_iron', item('minecraft:brick'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) public KilnPitRecipe add(String name, IIngredient input, ItemStack output, int burnTime, boolean inherit, float failureChance, ItemStack... failureOutput) { return recipeBuilder() .inherit(inherit) @@ -96,7 +96,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { private final ItemStackList failureOutput = new ItemStackList(); @Property(comp = @Comp(gt = 0)) private int burnTime; - @Property(comp = @Comp(gte = 0)) + @Property(comp = @Comp(gte = 0, lte = 1)) private float failureChance; @Property private boolean inherit; @@ -141,6 +141,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_pit_kiln_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Pit Kiln Recipe"; @@ -153,11 +158,11 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); - msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); - msg.add(super.name == null, "name cannot be null."); + msg.add(failureChance < 0, "failureChance must not be negative nor larger than 1.0, yet it was {}", failureChance); msg.add(ModuleTechBasic.Registries.KILN_PIT_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -167,7 +172,7 @@ public void validate(GroovyLog.Msg msg) { if (!validate()) return null; KilnPitRecipe recipe = new KilnPitRecipe(output.get(0), input.get(0).toMcIngredient(), burnTime, failureChance, failureOutput.toArray(new ItemStack[0])).setRegistryName(super.name); ModSupport.PYROTECH.get().pitKiln.add(recipe); - if (inherit && ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class)) { + if (inherit && ModSupport.PYROTECH.get().stoneKiln.isEnabled()) { ResourceLocation location = new ResourceLocation(super.name.getNamespace(), "pit_kiln/" + super.name.getPath()); StoneKilnRecipe stoneKilnRecipe = StoneKilnRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(location); ModSupport.PYROTECH.get().stoneKiln.add(stoneKilnRecipe); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java index 508b9ab18..31d1ed996 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/SoakingPot.java @@ -95,6 +95,11 @@ public RecipeBuilder campfireRequired(boolean campfireRequired) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_soaking_pot_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Soaking Pot Recipe"; @@ -107,10 +112,10 @@ protected int getMaxItemInput() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); validateFluids(msg, 1, 1, 0, 0); msg.add(time <= 0, "time must be a non negative integer that is larger than 0, yet it was {}", time); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechBasic.Registries.SOAKING_POT_RECIPE.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java index a9d5e511a..4eaee47dd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java @@ -34,11 +34,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public StoneCrucibleRecipe add(String name, IIngredient input, FluidStack output, int burnTime) { return add(name, input, output, burnTime, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'water_from_cactus', ore('blockCactus'), fluid('water') * 1000, 600, true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.stone_crucible.add.inherit", example = @Example("'water_from_cactus', ore('blockCactus'), fluid('water') * 1000, 600, true")) public StoneCrucibleRecipe add(String name, IIngredient input, FluidStack output, int burnTime, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -101,6 +102,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_stone_crucible_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Stone Crucible Recipe"; @@ -108,10 +114,10 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 0, 0); validateFluids(msg, 0, 0, 1, 1); - msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); - msg.add(super.name == null, "name cannot be null"); + msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(ModuleTechMachine.Registries.STONE_CRUCIBLE_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java index 0059d6a37..48011d18e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneKiln.java @@ -39,11 +39,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public StoneKilnRecipe add(String name, IIngredient input, ItemStack output, int burnTime, float failureChance, ItemStack failureOutput) { return add(name, input, output, burnTime, false, failureChance, failureOutput); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'clay_to_iron_stone', item('minecraft:clay_ball'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.stone_kiln.add.inherit", example = @Example("'clay_to_iron_stone', item('minecraft:clay_ball'), item('minecraft:iron_ingot'), 1200, true, 0.5f, item('minecraft:dirt'), item('minecraft:cobblestone')")) public StoneKilnRecipe add(String name, IIngredient input, ItemStack output, int burnTime, boolean inherit, float failureChance, ItemStack... failureOutput) { return recipeBuilder() .inherit(inherit) @@ -95,7 +96,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder private final ItemStackList failureOutput = new ItemStackList(); @Property(comp = @Comp(gt = 0)) private int burnTime; - @Property(comp = @Comp(gte = 0)) + @Property(comp = @Comp(gte = 0, lte = 1)) private float failureChance; @Property private boolean inherit; @@ -140,6 +141,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_stone_kiln_"; + } + @Override protected int getMaxItemInput() { return 1; @@ -152,11 +158,11 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); this.failureOutput.trim(); msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); - msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); - msg.add(super.name == null, "name cannot be null."); + msg.add(failureChance < 0 || failureChance > 1, "failureChance must not be negative nor larger than 1.0, yet it was {}", failureChance); msg.add(ModuleTechMachine.Registries.STONE_KILN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java index 8453dfa23..0e93ed862 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneOven.java @@ -45,11 +45,12 @@ public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public StoneOvenRecipe add(String name, IIngredient input, ItemStack output, int duration) { return add(name, input, output, duration, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'sand_to_dirt', item('minecraft:sand'), item('minecraft:dirt'), 1000, true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.stone_oven.add.inherit", example = @Example("'sand_to_dirt', item('minecraft:sand'), item('minecraft:dirt'), 1000, true")) public StoneOvenRecipe add(String name, IIngredient input, ItemStack output, int duration, boolean inherit) { return recipeBuilder() .inherit(inherit) @@ -112,6 +113,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_stone_oven_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Stone Oven Recipe"; @@ -119,9 +125,9 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 1, 1, 1); msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.STONE_OVEN_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java index 5a3d81f5e..81b08326b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java @@ -7,8 +7,10 @@ import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; +import com.codetaylor.mc.athenaeum.util.ArrayHelper; import com.codetaylor.mc.pyrotech.ModPyrotech; import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachine; +import com.codetaylor.mc.pyrotech.modules.tech.machine.ModuleTechMachineConfig; import com.codetaylor.mc.pyrotech.modules.tech.machine.init.recipe.BrickSawmillRecipesAdd; import com.codetaylor.mc.pyrotech.modules.tech.machine.recipe.StoneSawmillRecipe; import net.minecraft.item.ItemStack; @@ -17,6 +19,8 @@ import net.minecraftforge.oredict.OreDictionary; import org.jetbrains.annotations.Nullable; +import java.util.Objects; + @RegistryDescription( admonition = { @Admonition( @@ -44,17 +48,18 @@ public boolean isEnabled() { @RecipeBuilderDescription(example = { @Example(".input(item('minecraft:sign')).output(item('minecraft:planks:0') * 2).duration(200).woodChips(5).inherit(true).name('wood_from_sign')"), - @Example(".input(item('minecraft:stone_pickaxe'), ore('blockIron')).output(item('minecraft:iron_pickaxe')).duration(5000).name('stone_pickaxe_upgrade')") + @Example(".input(item('minecraft:stone_pickaxe'), item('pyrotech:sawmill_blade_bone')).output(item('minecraft:iron_pickaxe')).duration(5000).name('stone_pickaxe_upgrade')") }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public StoneSawmillRecipe add(String name, IIngredient input, ItemStack output, int duration, int woodChips) { return add(name, input, output, duration, woodChips, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'stone_to_cobblestone', ore('stone'), item('minecraft:cobblestone'), 500, 0, true")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.stone_sawmill.add.inherit", example = @Example("'stone_to_cobblestone', ore('stone'), item('minecraft:cobblestone'), 500, 0, true")) public StoneSawmillRecipe add(String name, IIngredient input, ItemStack output, int duration, int woodChips, boolean inherit) { return recipeBuilder() .duration(duration) @@ -66,11 +71,12 @@ public StoneSawmillRecipe add(String name, IIngredient input, ItemStack output, .register(); } + @MethodDescription(type = MethodDescription.Type.ADDITION) public StoneSawmillRecipe add(String name, IIngredient input, IIngredient blade, ItemStack output, int duration, int woodChips) { return add(name, input, blade, output, duration, woodChips, false); } - @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("'apple_to_gapple_with_golden_blade', item('minecraft:apple'), item('pyrotech:sawmill_blade_bone'), item('minecraft:golden_apple'), 2000, 0, false")) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.pyrotech.stone_sawmill.add.inherit", example = @Example("'apple_to_gapple_with_golden_blade', item('minecraft:apple'), item('pyrotech:sawmill_blade_bone'), item('minecraft:golden_apple'), 2000, 0, false")) public StoneSawmillRecipe add(String name, IIngredient input, IIngredient blade, ItemStack output, int duration, int woodChips, boolean inherit) { return recipeBuilder() .duration(duration) @@ -112,7 +118,7 @@ public void removeByOutput(IIngredient output) { } } - @Property(property = "input", comp = @Comp(gte = 1, lt = 3)) + @Property(property = "input", comp = @Comp(gte = 1, lte = 2)) @Property(property = "output", comp = @Comp(eq = 1)) @Property(property = "name") public static class RecipeBuilder extends AbstractRecipeBuilder { @@ -142,6 +148,11 @@ public RecipeBuilder inherit(boolean inherit) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_stone_sawmill_"; + } + @Override public String getErrorMsg() { return "Error adding Pyrotech Stone Sawmill Recipe"; @@ -149,9 +160,14 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); validateItems(msg, 1, 2, 1, 1); + if (input.size() > 1) { + for (ItemStack stack : input.get(1).toMcIngredient().getMatchingStacks()) { + msg.add(!ArrayHelper.contains(ModuleTechMachineConfig.STONE_SAWMILL.SAWMILL_BLADES, Objects.requireNonNull(stack.getItem().getRegistryName()).toString()), "{} is not a stone sawmill blade", stack); + } + } msg.add(duration <= 0, "duration must be a non negative integer that is larger than 0, yet it was {}", duration); - msg.add(super.name == null, "name cannot be null."); msg.add(ModuleTechMachine.Registries.STONE_SAWMILL_RECIPES.getValue(super.name) != null, "tried to register {}, but it already exists.", super.name); } @@ -160,27 +176,33 @@ public void validate(GroovyLog.Msg msg) { public @Nullable StoneSawmillRecipe register() { if (!validate()) return null; if (input.size() > 1) { - return this.addRecipe(1, 1, input.get(1).toMcIngredient(), 1, ""); - } - else { - StoneSawmillRecipe recipe = this.addRecipe(1, 1, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 1, ""); - this.addRecipe(2, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 2, "_flint_blade"); - this.addRecipe(2, 0.5, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_iron_blade"); - this.addRecipe(3, 3.0 / 2.0, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), 4, "_diamond_blade"); + StoneSawmillRecipe recipe = new StoneSawmillRecipe(output.get(0), input.get(0).toMcIngredient(), duration, input.get(1).toMcIngredient(), woodChips).setRegistryName(super.name); + ModSupport.PYROTECH.get().stoneSawmill.add(recipe); + if (inherit) { + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(new ResourceLocation(super.name.getNamespace(), "stone_sawmill/" + super.name.getPath()))); + } + return recipe; + } else { + StoneSawmillRecipe[] recipes = new StoneSawmillRecipe[4]; + ItemStack out = output.get(0); + Ingredient in = input.get(0).toMcIngredient(); + StoneSawmillRecipe recipe = new StoneSawmillRecipe(out, in, duration, Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.STONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips).setRegistryName(name + "_tier_0"); + recipes[0] = recipe; + out = out.copy(); + out.setCount(Math.min(out.getMaxStackSize(), out.getCount() * 2)); + recipes[1] = new StoneSawmillRecipe(out, in, (int) (1.5 * (double) duration), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips / 2).setRegistryName(name + "_tier_1"); + recipes[2] = new StoneSawmillRecipe(out, in, (int) (0.5 * (double) duration), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips / 4).setRegistryName(name + "_tier_2"); + out = out.copy(); + out.setCount(Math.min(out.getMaxStackSize(), out.getCount() * 3)); + recipes[3] = new StoneSawmillRecipe(out, in, (int) (1.5 * (double) duration), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, OreDictionary.WILDCARD_VALUE)), woodChips / 4).setRegistryName(name + "_tier_3"); + for (StoneSawmillRecipe r : recipes) { + ModSupport.PYROTECH.get().stoneSawmill.add(r); + if (inherit) { + ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(r).setRegistryName(new ResourceLocation(super.name.getNamespace(), "stone_sawmill/" + super.name.getPath()))); + } + } return recipe; } } - - private StoneSawmillRecipe addRecipe(int outputMultiplier, double durationMultiplier, Ingredient blade, int woodChipsDivisor, String name) { - ItemStack out = output.get(0).copy(); - out.setCount(Math.min(output.get(0).getCount() * outputMultiplier, 64)); - ResourceLocation registryName = new ResourceLocation(super.name.getNamespace(), super.name.getPath() + name); - StoneSawmillRecipe recipe = new StoneSawmillRecipe(out, input.get(0).toMcIngredient(), (int) ((double) duration * durationMultiplier), blade, woodChips / woodChipsDivisor).setRegistryName(registryName); - ModSupport.PYROTECH.get().stoneSawmill.add(recipe); - if (inherit) { - ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(new ResourceLocation(registryName.getNamespace(), "stone_sawmill/" + registryName.getPath()))); - } - return recipe; - } } } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java index 6a82dfc5c..af1f19fd0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/TanningRack.java @@ -78,8 +78,8 @@ public static class RecipeBuilder extends AbstractRecipeBuilder failureOutput = new ArrayList<>(1); @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilTiers.value") private final EnumSet anvilTiers = EnumSet.allOf(AnvilRecipe.EnumTier.class); - @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilHit.value") + @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilHit.value", comp = @Comp(gt = 0)) private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; - @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilType.value") + @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilType.value", comp = @Comp(not = "null")) private AnvilRecipe.EnumType anvilType = AnvilRecipe.EnumType.HAMMER; @Property(value = "groovyscript.wiki.pyrotech.bloomery.langKey.value") private String langKey; @@ -274,6 +274,11 @@ public RecipeBuilder langKey(String langKey) { return this; } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_wither_forge_"; + } + @Override protected int getMaxItemInput() { return 1; @@ -286,6 +291,7 @@ public String getErrorMsg() { @Override public void validate(GroovyLog.Msg msg) { + validateName(); int minOutput = !bloom.isEmpty() ? 0 : 1; if (slag == null) { slag = bloom.isEmpty() ? new ItemStack(ModuleTechBloomery.Items.SLAG, 4) : ItemStack.EMPTY; @@ -298,8 +304,9 @@ public void validate(GroovyLog.Msg msg) { msg.add(experience < 0, "experience must be a non negative float, yet it was {}", experience); msg.add(bloomYieldMin < 0 || bloomYieldMin > bloomYieldMax, "bloomYieldMin must be a non negative integer that is smaller than bloomYieldMax, yet it was {}", burnTime); msg.add(bloomYieldMax < 0, "bloomYieldMax must be a non negative integer, yet it was {}", burnTime); - msg.add(failureChance < 0, "failureChance must be a non negative float, yet it was {}", failureChance); - msg.add(super.name == null, "name cannot be null"); + msg.add(failureChance < 0 || failureChance > 1, "failureChance must not be negative nor larger than 1.0, yet it was {}", failureChance); + msg.add(anvilType == null, "anvilType must not be null"); + msg.add(anvilHit <= 0, "anvilHit must be a non negative integer that is larger than 0, yet it was {}", anvilHit); msg.add(ModSupport.PYROTECH.get().witherForge.getRegistry().getValue(super.name) != null, "tried to register {}, but it already exists", super.name); } @@ -320,15 +327,16 @@ public void validate(GroovyLog.Msg msg) { .create(); ((BloomeryRecipeBaseAccessor) recipe).grs$setOutputBloom(bloom.isEmpty() ? null : bloom); ModSupport.PYROTECH.get().witherForge.add(recipe); - if (bloom.isEmpty()) { - ModSupport.PYROTECH.get().anvil.add(new BloomAnvilRecipe( - recipe.getOutput(), - com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), - anvilHit, - anvilType, - Arrays.copyOf(recipe.getAnvilTiers(), recipe.getAnvilTiers().length), - recipe - ).setRegistryName(super.name)); + if (bloom.isEmpty() && bloomYieldMax != 0) { + ModSupport.PYROTECH.get().anvil.add( + new BloomAnvilRecipe( + recipe.getOutput(), + com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), + anvilHit, + anvilType, + Arrays.copyOf(recipe.getAnvilTiers(), recipe.getAnvilTiers().length), + recipe + ).setRegistryName(super.name)); } return recipe; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java index 343eba7aa..e701e478a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.compat.mods.pyrotech; +import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.*; @@ -275,6 +276,7 @@ public void removeByOutput(IIngredient output) { removeByOutput(output, true); } + @GroovyBlacklist public void removeByOutput(IIngredient output, boolean log) { if (IngredientHelper.isEmpty(output)) { if (log) { @@ -310,6 +312,7 @@ public void removeByInput(IIngredient input) { removeByInput(input, true); } + @GroovyBlacklist public void removeByInput(IIngredient input, boolean log) { if (IngredientHelper.isEmpty(input)) { if (log) { @@ -369,9 +372,10 @@ public Shapeless shapelessBuilder() { @Property(property = "recipeFunction") @Property(property = "recipeAction") @Property(property = "name") + @Property(property = "replace") public static class Shaped extends AbstractCraftingRecipeBuilder.AbstractShaped { - @Property + @Property(comp = @Comp(not = "null")) private IIngredient tool = IIngredient.EMPTY; @Property(comp = @Comp(gte = 0)) private int damage; @@ -402,6 +406,11 @@ protected void handleReplace() { } } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_worktable_shaped"; + } + @RecipeBuilderRegistrationMethod @Override public WorktableRecipe register() { @@ -439,6 +448,7 @@ public WorktableRecipe register() { @Property(property = "recipeFunction") @Property(property = "recipeAction") @Property(property = "name") + @Property(property = "replace") public static class Shapeless extends AbstractCraftingRecipeBuilder.AbstractShapeless { @Property @@ -472,6 +482,11 @@ protected void handleReplace() { } } + @Override + public String getRecipeNamePrefix() { + return "groovyscript_worktable_shapeless_"; + } + @RecipeBuilderRegistrationMethod @Override public WorktableRecipe register() { diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 9103eadc4..4b61e6c42 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -2376,12 +2376,13 @@ groovyscript.wiki.prodigytech.zorra_altar.removeEnchantment=Removes an enchantme # Pyrotech groovyscript.wiki.pyrotech.anvil.title=Anvil -groovyscript.wiki.pyrotech.anvil.description=When using hammer or pickaxe it can convert items -groovyscript.wiki.pyrotech.anvil.hits.value=Sets how often the item needs to be hit +groovyscript.wiki.pyrotech.anvil.description=Converts an item to a new item by hitting it with a hammer or pickaxe +groovyscript.wiki.pyrotech.anvil.hits.value=Sets how many times the item needs to be hit groovyscript.wiki.pyrotech.anvil.tier.value=Sets the tier of the required anvil (Granite, Ironclad, Obsidian) groovyscript.wiki.pyrotech.anvil.type.value=Sets the type of tool required (Hammer, Pickaxe) groovyscript.wiki.pyrotech.anvil.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.anvil.add=Adds recipes in the format `name`, `input`, `output`, `hits`, `tier`, `type`, `(optional) inherit` +groovyscript.wiki.pyrotech.anvil.add.inherit=Adds recipes in the format `name`, `input`, `output`, `hits`, `tier`, `type`, `inherit` +groovyscript.wiki.pyrotech.anvil.add=Adds recipes in the format `name`, `input`, `output`, `hits`, `tier`, `type` groovyscript.wiki.pyrotech.barrel.title=Barrel groovyscript.wiki.pyrotech.barrel.description=Over time converts a fluid with four items into a new fluid @@ -2389,55 +2390,57 @@ groovyscript.wiki.pyrotech.barrel.duration.value=Sets the time required for the groovyscript.wiki.pyrotech.barrel.add=Adds recipes in the format `name`, `input1`, `input2`, `input3`, `input4`, `fluidInput`, `fluidOutput`, `duration` groovyscript.wiki.pyrotech.bloomery.title=Bloomery -groovyscript.wiki.pyrotech.bloomery.description=Converts item to bloom or a different item by burning it -groovyscript.wiki.pyrotech.bloomery.add0=Adds recipes in the format `name`, `output`, `input`, `(optional) inherit` -groovyscript.wiki.pyrotech.bloomery.add1=Adds recipes in the format `name`, `output`, `input`, `burnTime`, `(optional) inherit` -groovyscript.wiki.pyrotech.bloomery.addBloom0=Adds recipes in the format `name`, `bloomOutput`, `input`, `(optional) inherit` -groovyscript.wiki.pyrotech.bloomery.addBloom1=Adds recipes in the format `name`, `bloomOutput`, `minYield`, `maxYield`, `input`, `burnTime`, `experience`, `(optional) inherit`, `failureChance`, `failureItems` +groovyscript.wiki.pyrotech.bloomery.description=Converts item to a new item or a 'bloom' which are items that needs to be hit with hammer on anvil to get the output with varying amounts +groovyscript.wiki.pyrotech.bloomery.add0.inherit=Adds recipes in the format `name`, `output`, `input`, `inherit` +groovyscript.wiki.pyrotech.bloomery.add0=Adds recipes in the format `name`, `output`, `input` +groovyscript.wiki.pyrotech.bloomery.add1.inherit=Adds recipes in the format `name`, `output`, `input`, `burnTime`, `inherit` +groovyscript.wiki.pyrotech.bloomery.add1=Adds recipes in the format `name`, `output`, `input`, `burnTime` +groovyscript.wiki.pyrotech.bloomery.addBloom0.inherit=Adds recipes in the format `name`, `bloomOutput`, `input`, `inherit` +groovyscript.wiki.pyrotech.bloomery.addBloom0=Adds recipes in the format `name`, `bloomOutput`, `input` groovyscript.wiki.pyrotech.bloomery.slag.value=Sets the slag item groovyscript.wiki.pyrotech.bloomery.bloom.value=Sets the actual output (bloom) of the Bloomery. Setting langKey, anvil values, experience, bloom yields and failure values are unnecessary if this is set groovyscript.wiki.pyrotech.bloomery.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.bloomery.langKey.value=Sets the localization key to use for blooms name +groovyscript.wiki.pyrotech.bloomery.langKey.value=Sets the localization key of output if the output is a bloom. If it's null, the bloom will use lang key of the input. groovyscript.wiki.pyrotech.bloomery.anvilHit.value=Sets how often the bloom needs to be hit on the anvil groovyscript.wiki.pyrotech.bloomery.burnTime.value=Sets the time required for the recipe to complete -groovyscript.wiki.pyrotech.bloomery.anvilType.value=Sets the tool that needs to be used in anvil -groovyscript.wiki.pyrotech.bloomery.anvilTiers.value=Sets the allowed anvil tiers bloom allows -groovyscript.wiki.pyrotech.bloomery.experience.value=Sets the experience given from bloom -groovyscript.wiki.pyrotech.bloomery.bloomYieldMin.value=Sets minimum amount of drops bloom can give -groovyscript.wiki.pyrotech.bloomery.bloomYieldMax.value=Sets maximum amount of drops bloom can give +groovyscript.wiki.pyrotech.bloomery.anvilType.value=Sets the tool that needs to be used for hitting the bloom +groovyscript.wiki.pyrotech.bloomery.anvilTiers.value=Sets the tiers anvil can be for bloom to allow you to put on the anvil +groovyscript.wiki.pyrotech.bloomery.experience.value=Sets the experience given from bloom after the anvil recipe +groovyscript.wiki.pyrotech.bloomery.bloomYieldMin.value=Sets minimum amount of drops the bloom can give +groovyscript.wiki.pyrotech.bloomery.bloomYieldMax.value=Sets maximum amount of drops the bloom can give groovyscript.wiki.pyrotech.bloomery.failureChance.value=Sets the chance for bloom to give failure item instead of the actual output groovyscript.wiki.pyrotech.bloomery.failureOutput.value=Sets the output to drop on failure groovyscript.wiki.pyrotech.brick_crucible.title=Refractory Crucible -groovyscript.wiki.pyrotech.brick_crucible.description=Melts an item into liquid. +groovyscript.wiki.pyrotech.brick_crucible.description=Converts item into a liquid groovyscript.wiki.pyrotech.brick_crucible.burnTime.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.brick_crucible.add=Adds recipes in the format `name`, `input`, `fluidOutput`, `burnTime` groovyscript.wiki.pyrotech.brick_crucible.note0=Can inherit recipes from [Stone Crucible](./stone_crucible.md) groovyscript.wiki.pyrotech.brick_kiln.title=Refractory Kiln -groovyscript.wiki.pyrotech.brick_kiln.description=Converts an item into a new one by burning it. Has a chance to fail +groovyscript.wiki.pyrotech.brick_kiln.description=Converts an item into a new item or one of the failure outputs if the recipe fails groovyscript.wiki.pyrotech.brick_kiln.burnTime.value=Sets the time required for the recipe to complete -groovyscript.wiki.pyrotech.brick_kiln.failureChance.value=Sets the chance to fail the recipe -groovyscript.wiki.pyrotech.brick_kiln.failureOutput.value=Sets the output when the recipe failed +groovyscript.wiki.pyrotech.brick_kiln.failureChance.value=Sets the chance for recipe to fail +groovyscript.wiki.pyrotech.brick_kiln.failureOutput.value=Sets the list of items that can be outputted if the recipe fails groovyscript.wiki.pyrotech.brick_kiln.add=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `failureChance`, `failureOutput` groovyscript.wiki.pyrotech.brick_kiln.note0=Can inherit recipes from [Pit Kiln](./pit_kiln.md) and [Stone Kiln](./stone_kiln.md) groovyscript.wiki.pyrotech.brick_oven.title=Refractory Oven -groovyscript.wiki.pyrotech.brick_oven.description=When powered by burning fuel can convert items +groovyscript.wiki.pyrotech.brick_oven.description=Converts item into a new item groovyscript.wiki.pyrotech.brick_oven.duration.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.brick_oven.add=Adds recipes in the format `name`, `input`, `output`, `duration` groovyscript.wiki.pyrotech.brick_oven.note0=Can inherit recipes from [Crude Drying Rack](./crude_drying_rack.md), [Drying Rack](./drying_rack.md) and [Stone Oven](./stone_oven.md) groovyscript.wiki.pyrotech.brick_sawmill.title=Refractory Sawmill -groovyscript.wiki.pyrotech.brick_sawmill.description=Converts an item, likely wood, by cutting it to a smaller item and drops wood chips. +groovyscript.wiki.pyrotech.brick_sawmill.description=Converts an item into a new item with an item with durability and drops wood chips on given amount of time groovyscript.wiki.pyrotech.brick_sawmill.input.value=Sets the input required for the recipe. Second input value is an optional value for setting saw blade. groovyscript.wiki.pyrotech.brick_sawmill.duration.value=Sets the time required for the recipe to complete -groovyscript.wiki.pyrotech.brick_sawmill.wood_chips.value=Sets the wood chip amount that will drop. +groovyscript.wiki.pyrotech.brick_sawmill.wood_chips.value=Sets the amount of wood chip to drop. groovyscript.wiki.pyrotech.brick_sawmill.add=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips` groovyscript.wiki.pyrotech.brick_sawmill.note0=Can inherit recipes from [Chopping Block](./chopping_block.md) and [Stone Sawmill](./stone_sawmill.md) groovyscript.wiki.pyrotech.campfire.title=Campfire -groovyscript.wiki.pyrotech.campfire.description=When powered by burning logs can convert items +groovyscript.wiki.pyrotech.campfire.description=Converts item into a new item on given amount of time groovyscript.wiki.pyrotech.campfire.duration.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.campfire.add=Adds recipes in the format `name`, `input`, `output`, `duration` @@ -2451,7 +2454,8 @@ groovyscript.wiki.pyrotech.compacting_bin.title=Compacting Bin groovyscript.wiki.pyrotech.compacting_bin.description=When using a shovel it can convert items groovyscript.wiki.pyrotech.compacting_bin.hits.value=Sets how often the item needs to be hit groovyscript.wiki.pyrotech.compacting_bin.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.compacting_bin.add=Adds recipes in the format `name`, `input`, `output`, `(optional) inherit`, `hits` +groovyscript.wiki.pyrotech.compacting_bin.add.inherit=Adds recipes in the format `name`, `input`, `output`, `inherit`, `hits` +groovyscript.wiki.pyrotech.compacting_bin.add=Adds recipes in the format `name`, `input`, `output`, `hits` groovyscript.wiki.pyrotech.compost_bin.title=Compost Bin groovyscript.wiki.pyrotech.compost_bin.description=Can convert multiple items into a new one when its full @@ -2462,17 +2466,19 @@ groovyscript.wiki.pyrotech.crude_drying_rack.title=Crude Drying Rack groovyscript.wiki.pyrotech.crude_drying_rack.description=Converts an item over time into a new one groovyscript.wiki.pyrotech.crude_drying_rack.dryTime.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.crude_drying_rack.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.crude_drying_rack.add=Adds recipes in the format `name`, `input`, `output`, `dryTime`, `(optional) inherit` +groovyscript.wiki.pyrotech.crude_drying_rack.add.inherit=Adds recipes in the format `name`, `input`, `output`, `dryTime`, `inherit` +groovyscript.wiki.pyrotech.crude_drying_rack.add=Adds recipes in the format `name`, `input`, `output`, `dryTime` groovyscript.wiki.pyrotech.drying_rack.title=Drying Rack groovyscript.wiki.pyrotech.drying_rack.description=Converts an item over time into a new one groovyscript.wiki.pyrotech.drying_rack.dryTime.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.drying_rack.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.drying_rack.add=Adds recipes in the format `name`, `input`, `output`, `dryTime`, `(optional) inherit` +groovyscript.wiki.pyrotech.drying_rack.add.inherit=Adds recipes in the format `name`, `input`, `output`, `dryTime`, `inherit` +groovyscript.wiki.pyrotech.drying_rack.add=Adds recipes in the format `name`, `input`, `output`, `dryTime` groovyscript.wiki.pyrotech.drying_rack.note0=Can inherit recipes from [Crude Drying Rack](./crude_drying_rack.md) groovyscript.wiki.pyrotech.mechanical_compacting_bin.title=Mechanical Compacting Bin -groovyscript.wiki.pyrotech.mechanical_compacting_bin.description=Compacting Bin but automatic +groovyscript.wiki.pyrotech.mechanical_compacting_bin.description=Converts given amount of item into new item. groovyscript.wiki.pyrotech.mechanical_compacting_bin.hits.value=Sets how often the item needs to be hit groovyscript.wiki.pyrotech.mechanical_compacting_bin.add=Adds recipes in the format `name`, `input`, `output`, `hits` groovyscript.wiki.pyrotech.mechanical_compacting_bin.note0=Can inherit recipes from [Compacting Bin](./compacting_bin.md) @@ -2495,17 +2501,19 @@ groovyscript.wiki.pyrotech.pit_kiln.burnTime.value=Sets the time required for th groovyscript.wiki.pyrotech.pit_kiln.failureChance.value=Sets the chance to fail the recipe groovyscript.wiki.pyrotech.pit_kiln.failureOutput.value=Sets the output when the recipe failed groovyscript.wiki.pyrotech.pit_kiln.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.pit_kiln.add=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `(optional) inherit`, `failureChance`, `failureOutput` +groovyscript.wiki.pyrotech.pit_kiln.add.inherit=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `inherit`, `failureChance`, `failureOutput` +groovyscript.wiki.pyrotech.pit_kiln.add=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `failureChance`, `failureOutput` groovyscript.wiki.pyrotech.oven.note0=Stone and Refractory Oven includes some recipes from the Furnace Registry that can't be removed here, you have to use `furnace.add` or `furnace.remove` to manipulate those recipes directly -groovyscript.wiki.pyrotech.sawmill.note0=If sawmill blade is not set, it will add the recipe for all sawmill blades. sawmill blade that is set needs to be one of the sawmill blades +groovyscript.wiki.pyrotech.sawmill.note0=If sawmill blade is not set, it will add the recipe for all sawmill blades. Sawmill blade needs to be one in the sawmill blades config list. If the blade doesn't have a durability it will never break. groovyscript.wiki.pyrotech.stone_crucible.title=Stone Crucible -groovyscript.wiki.pyrotech.stone_crucible.description=Melts an item into liquid. +groovyscript.wiki.pyrotech.stone_crucible.description=Converts an item into a liquid groovyscript.wiki.pyrotech.stone_crucible.burnTime.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.stone_crucible.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.stone_crucible.add=Adds recipes in the format `name`, `input`, `fluidOutput`, `burnTime`, `(optional) inherit` +groovyscript.wiki.pyrotech.stone_crucible.add.inherit=Adds recipes in the format `name`, `input`, `fluidOutput`, `burnTime`, `inherit` +groovyscript.wiki.pyrotech.stone_crucible.add=Adds recipes in the format `name`, `input`, `fluidOutput`, `burnTime` groovyscript.wiki.pyrotech.stone_crucible.note0=Can inherit recipes from [Stone Crucible](./stone_crucible.md) groovyscript.wiki.pyrotech.stone_kiln.title=Stone Kiln @@ -2514,27 +2522,30 @@ groovyscript.wiki.pyrotech.stone_kiln.burnTime.value=Sets the time required for groovyscript.wiki.pyrotech.stone_kiln.failureChance.value=Sets the chance to fail the recipe groovyscript.wiki.pyrotech.stone_kiln.failureOutput.value=Sets the output when the recipe failed groovyscript.wiki.pyrotech.stone_kiln.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.stone_kiln.add=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `(optional) inherit`, `failureChance`, `failureOutput` +groovyscript.wiki.pyrotech.stone_kiln.add.inherit=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `inherit`, `failureChance`, `failureOutput` +groovyscript.wiki.pyrotech.stone_kiln.add=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `failureChance`, `failureOutput` groovyscript.wiki.pyrotech.stone_kiln.note0=Can inherit recipes from [Pit Kiln](./pit_kiln.md) groovyscript.wiki.pyrotech.stone_oven.title=Stone Oven groovyscript.wiki.pyrotech.stone_oven.description=When powered by burning fuel can convert items groovyscript.wiki.pyrotech.stone_oven.duration.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.stone_oven.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.stone_oven.add=Adds recipes in the format `name`, `input`, `output`, `duration`, `(optional) inherit` +groovyscript.wiki.pyrotech.stone_oven.add.inherit=Adds recipes in the format `name`, `input`, `output`, `duration`, `inherit` +groovyscript.wiki.pyrotech.stone_oven.add=Adds recipes in the format `name`, `input`, `output`, `duration` groovyscript.wiki.pyrotech.stone_oven.note0=Can inherit recipes from [Crude Drying Rack](./crude_drying_rack.md) and [Drying Rack](./drying_rack.md) groovyscript.wiki.pyrotech.stone_sawmill.title=Stone Sawmill -groovyscript.wiki.pyrotech.stone_sawmill.description=Converts an item, likely wood, by cutting it to a smaller item and drops wood chips. -groovyscript.wiki.pyrotech.stone_sawmill.input.value=Sets the input required for the recipe. Second input value is an optional value for setting sawmill blade. +groovyscript.wiki.pyrotech.stone_sawmill.description=Converts an item into a new item with an item with durability and drops wood chips on given amount of time +groovyscript.wiki.pyrotech.stone_sawmill.input.value=Sets the input required for the recipe. Second input value is an optional value for setting sawmill blade groovyscript.wiki.pyrotech.stone_sawmill.duration.value=Sets the time required for the recipe to complete -groovyscript.wiki.pyrotech.stone_sawmill.wood_chips.value=Sets the wood chip amount that will drop. +groovyscript.wiki.pyrotech.stone_sawmill.wood_chips.value=Sets the wood chip amount that will drop groovyscript.wiki.pyrotech.stone_sawmill.inherit.value=Sets if the recipe should be inherited by more advanced machines -groovyscript.wiki.pyrotech.stone_sawmill.add=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips`, `(optional) inherit` +groovyscript.wiki.pyrotech.stone_sawmill.add.inherit=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips`, `inherit` +groovyscript.wiki.pyrotech.stone_sawmill.add=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips` groovyscript.wiki.pyrotech.stone_sawmill.note0=Can inherit recipes from [Chopping Block](./chopping_block.md) groovyscript.wiki.pyrotech.soaking_pot.title=Soaking Pot -groovyscript.wiki.pyrotech.soaking_pot.description=Converts an item into a new one by soaking it in a liquid. Can require a campfire +groovyscript.wiki.pyrotech.soaking_pot.description=Converts an item and liquid into a new item. Can require a campfire below groovyscript.wiki.pyrotech.soaking_pot.time.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.soaking_pot.campfireRequired.value=Sets if a campfire is required underneath groovyscript.wiki.pyrotech.soaking_pot.add=Adds recipes in the format `name`, `input`, `output`, `time` @@ -2546,14 +2557,14 @@ groovyscript.wiki.pyrotech.tanning_rack.failureItem.value=Sets the output when t groovyscript.wiki.pyrotech.tanning_rack.add=Adds recipes in the format `name`, `input`, `output`, `dryTime`, `failureItem` groovyscript.wiki.pyrotech.wither_forge.title=Wither Forge -groovyscript.wiki.pyrotech.wither_forge.description=Converts item to bloom or a different item by burning it +groovyscript.wiki.pyrotech.wither_forge.description=Converts item to a new item or a 'bloom' which are items that needs to be hit with hammer on anvil to get the output with varying amounts groovyscript.wiki.pyrotech.wither_forge.add0=Adds recipes in the format `name`, `output`, `input` groovyscript.wiki.pyrotech.wither_forge.add1=Adds recipes in the format `name`, `output`, `input`, `burnTime` groovyscript.wiki.pyrotech.wither_forge.addBloom0=Adds recipes in the format `name`, `bloomOutput`, `input` groovyscript.wiki.pyrotech.wither_forge.addBloom1=Adds recipes in the format `name`, `bloomOutput`, `minYield`, `maxYield`, `input`, `burnTime`, `experience`, `failureChance`, `failureItems` groovyscript.wiki.pyrotech.worktable.title=Worktable -groovyscript.wiki.pyrotech.worktable.description=Crafting table with where you hit it with a tool to craft stuff +groovyscript.wiki.pyrotech.worktable.description=Crafting table which asks you to hit it with a tool to craft stuff groovyscript.wiki.pyrotech.worktable.tool.value=Sets the tool that will be used groovyscript.wiki.pyrotech.worktable.damage.value=Sets the damage to put into that tool From 6d9afd2e7ae58b09731e3e3573799a0bbd070795 Mon Sep 17 00:00:00 2001 From: CaliforniaDemise Date: Wed, 8 Oct 2025 15:31:30 +0300 Subject: [PATCH 12/13] Change Wither Forge and Bloomery support --- .../generated/pyrotech_generated.groovy | 3 +- .../compat/mods/pyrotech/Bloomery.java | 5 +-- .../compat/mods/pyrotech/WitherForge.java | 44 +++++-------------- 3 files changed, 15 insertions(+), 37 deletions(-) diff --git a/examples/postInit/generated/pyrotech_generated.groovy b/examples/postInit/generated/pyrotech_generated.groovy index 92939605d..0ee30ae36 100644 --- a/examples/postInit/generated/pyrotech_generated.groovy +++ b/examples/postInit/generated/pyrotech_generated.groovy @@ -606,7 +606,8 @@ mods.pyrotech.wither_forge.recipeBuilder() .bloomYield(12, 15) .experience(0.6F) .burnTime(4000) - .tierIronclad(true) + .tierGranite() + .tierIronclad() .anvilHit(5) .typePickaxe() .failureChance(0.15F) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java index e3fa5ade5..aca0d7a76 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java @@ -275,10 +275,7 @@ public void validate(GroovyLog.Msg msg) { if (bloom == null) { bloom = ItemStack.EMPTY; } - if (slag == null) { - slag = ItemStack.EMPTY; - } - int minOutput = !bloom.isEmpty() ? 0 : 1; + int minOutput = bloom.isEmpty() ? 1 : 0; if (slag == null) { slag = bloom.isEmpty() ? new ItemStack(ModuleTechBloomery.Items.SLAG, 4) : ItemStack.EMPTY; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java index 5c29181ae..0c0c14248 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/WitherForge.java @@ -20,7 +20,6 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumSet; import java.util.List; @@ -44,7 +43,7 @@ public boolean isEnabled() { @Example(".input(item('minecraft:minecart')).output(item('minecraft:furnace_minecart')).slag(item('minecraft:iron_ingot')).experience(0.8F).bloomYield(1, 1).burnTime(2000).failureChance(0.5F).failureOutput(item('minecraft:tnt_minecart'), 1).name('minecart_smelting')"), @Example(".input(item('minecraft:fishing_rod') | item('minecraft:carrot_on_a_stick')).output(item('minecraft:cooked_fish')).bloomYield(5, 8).langKey(item('minecraft:fishing_rod').getTranslationKey()).name('fishing')"), @Example(".input(item('minecraft:paper')).bloom(item('minecraft:book')).tierGranite().tierObsidian().failureChance(0.1F).failureOutput(item('minecraft:milk_bucket'), 5).failureOutput(item('minecraft:bone'), 2).name('knowledge')"), - @Example(".input(item('minecraft:comparator')).output(item('minecraft:redstone')).bloomYield(12, 15).experience(0.6F).burnTime(4000).tierIronclad(true).anvilHit(5).typePickaxe().failureChance(0.15F).failureOutput(item('minecraft:glowstone_dust'), 5).failureOutput(item('minecraft:sugar'), 4).name('comparator_melting')") + @Example(".input(item('minecraft:comparator')).output(item('minecraft:redstone')).bloomYield(12, 15).experience(0.6F).burnTime(4000).tierGranite().tierIronclad().anvilHit(5).typePickaxe().failureChance(0.15F).failureOutput(item('minecraft:glowstone_dust'), 5).failureOutput(item('minecraft:sugar'), 4).name('comparator_melting')") }) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); @@ -147,7 +146,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder failureOutput = new ArrayList<>(1); @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilTiers.value") - private final EnumSet anvilTiers = EnumSet.allOf(AnvilRecipe.EnumTier.class); + private final EnumSet anvilTiers = EnumSet.noneOf(AnvilRecipe.EnumTier.class); @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilHit.value", comp = @Comp(gt = 0)) private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilType.value", comp = @Comp(not = "null")) @@ -155,8 +154,6 @@ public static class RecipeBuilder extends AbstractRecipeBuilder 0.0F) { failureOutput.add(new BloomeryRecipeBase.FailureItem(new ItemStack(ModuleTechBloomery.Items.SLAG), 1)); } + if (anvilTiers.isEmpty()) { + anvilTiers.addAll(EnumSet.allOf(AnvilRecipe.EnumTier.class)); + } validateItems(msg, 1, 1, minOutput, 1); msg.add(burnTime <= 0, "burnTime must be a non negative integer that is larger than 0, yet it was {}", burnTime); msg.add(experience < 0, "experience must be a non negative float, yet it was {}", experience); @@ -334,7 +314,7 @@ public void validate(GroovyLog.Msg msg) { com.codetaylor.mc.athenaeum.util.IngredientHelper.fromStackWithNBT(recipe.getOutputBloom()), anvilHit, anvilType, - Arrays.copyOf(recipe.getAnvilTiers(), recipe.getAnvilTiers().length), + recipe.getAnvilTiers(), recipe ).setRegistryName(super.name)); } From 3c55912b013a8f37280290cc0d5ab7b3208bac40 Mon Sep 17 00:00:00 2001 From: Waiting Idly <25394029+WaitingIdly@users.noreply.github.com> Date: Wed, 24 Dec 2025 01:10:36 -0800 Subject: [PATCH 13/13] address reviews, intellij warnings, and logged issues --- .../generated/pyrotech_generated.groovy | 43 +++++++++---------- .../compat/mods/pyrotech/Bloomery.java | 17 ++++---- .../compat/mods/pyrotech/BrickSawmill.java | 8 ++-- .../compat/mods/pyrotech/ChoppingBlock.java | 10 ++--- .../pyrotech/MechanicalCompactingBin.java | 4 +- .../compat/mods/pyrotech/PitBurn.java | 9 ++-- .../compat/mods/pyrotech/StoneCrucible.java | 1 + .../compat/mods/pyrotech/StoneSawmill.java | 10 ++--- .../compat/mods/pyrotech/WitherForge.java | 26 +++++------ .../compat/mods/pyrotech/Worktable.java | 24 +++++++---- .../assets/groovyscript/lang/en_us.lang | 14 +++--- 11 files changed, 85 insertions(+), 81 deletions(-) diff --git a/examples/postInit/generated/pyrotech_generated.groovy b/examples/postInit/generated/pyrotech_generated.groovy index 0ee30ae36..1e0f7cfb8 100644 --- a/examples/postInit/generated/pyrotech_generated.groovy +++ b/examples/postInit/generated/pyrotech_generated.groovy @@ -200,8 +200,8 @@ mods.pyrotech.brick_sawmill.recipeBuilder() .register() -mods.pyrotech.brick_sawmill.add('glowstone_to_dust', item('minecraft:glowstone'), item('pyrotech:sawmill_blade_stone'), item('minecraft:glowstone_dust'), 200, 0) mods.pyrotech.brick_sawmill.add('bed_to_wool', item('minecraft:bed'), item('minecraft:wool') * 3, 500, 3) +mods.pyrotech.brick_sawmill.add('glowstone_to_dust', item('minecraft:glowstone'), item('pyrotech:sawmill_blade_stone'), item('minecraft:glowstone_dust'), 200, 0) // Campfire: // Converts item into a new item on given amount of time. @@ -466,7 +466,7 @@ mods.pyrotech.stone_crucible.recipeBuilder() .burnTime(1000) .inherit(true) .name('water_from_sugarcane') - + .register() mods.pyrotech.stone_crucible.add('water_from_cactus', ore('blockCactus'), fluid('water') * 1000, 600, true) @@ -541,8 +541,8 @@ mods.pyrotech.stone_sawmill.recipeBuilder() .register() -mods.pyrotech.stone_sawmill.add('apple_to_gapple_with_golden_blade', item('minecraft:apple'), item('pyrotech:sawmill_blade_bone'), item('minecraft:golden_apple'), 2000, 0, false) mods.pyrotech.stone_sawmill.add('stone_to_cobblestone', ore('stone'), item('minecraft:cobblestone'), 500, 0, true) +mods.pyrotech.stone_sawmill.add('apple_to_gapple_with_golden_blade', item('minecraft:apple'), item('pyrotech:sawmill_blade_bone'), item('minecraft:golden_apple'), 2000, 0, false) // Tanning Rack: // Converts an item over time into a new one. @@ -632,8 +632,8 @@ mods.pyrotech.worktable.shapedBuilder() .name('irons_to_dirts') .output(item('minecraft:dirt') * 8) .shape([[item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')], - [item('minecraft:iron_ingot'),null,item('minecraft:iron_ingot')], - [item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')]]) + [item('minecraft:iron_ingot'),null,item('minecraft:iron_ingot')], + [item('minecraft:iron_ingot'),item('minecraft:iron_ingot'),item('minecraft:iron_ingot')]]) .replaceByName() .register() @@ -641,8 +641,8 @@ mods.pyrotech.worktable.shapedBuilder() .name(resource('minecraft:sea_lantern')) .output(item('minecraft:clay')) .shape([[ore('blockRedstone')], - [ore('blockRedstone')], - [ore('blockRedstone')]]) + [ore('blockRedstone')], + [ore('blockRedstone')]]) .replaceByName() .register() @@ -718,7 +718,7 @@ mods.pyrotech.worktable.shapelessBuilder() .register() mods.pyrotech.worktable.shapelessBuilder() - .name('minecraft:pink_dye_from_pink_tulp') + .name('minecraft:pink_dye_from_pink_tulip') .output(item('minecraft:clay')) .input([item('minecraft:stick')]) .replaceByName() @@ -734,28 +734,27 @@ mods.pyrotech.worktable.shapelessBuilder() .register() -// mods.pyrotech.worktable.addShaped(item('minecraft:gold_block'), item('minecraft:diamond_pickaxe'), 2, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) // mods.pyrotech.worktable.addShaped(item('minecraft:gold_block'), [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -// mods.pyrotech.worktable.addShaped(resource('example:resource_location'), item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) +// mods.pyrotech.worktable.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) +// mods.pyrotech.worktable.addShaped(item('minecraft:gold_block'), item('minecraft:diamond_pickaxe'), 2, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[null, null, null],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) // mods.pyrotech.worktable.addShaped(resource('example:resource_location'), item('minecraft:clay'), [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) // mods.pyrotech.worktable.addShaped('gold_v_to_clay', item('minecraft:clay'), item('minecraft:iron_pickaxe'), 3, [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) -// mods.pyrotech.worktable.addShaped('gold_v_to_clay', item('minecraft:clay'), [[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[null,item('minecraft:gold_ingot'),null]]) -// mods.pyrotech.worktable.addShapeless(item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShaped(resource('example:resource_location'), item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [[item('minecraft:cobblestone')],[item('minecraft:nether_star')],[item('minecraft:cobblestone')]]) // mods.pyrotech.worktable.addShapeless(item('minecraft:clay'), [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) -// mods.pyrotech.worktable.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.addShapeless(item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'),item('minecraft:nether_star'),item('minecraft:gold_ingot')]) // mods.pyrotech.worktable.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // mods.pyrotech.worktable.addShapeless('precious_to_clay', item('minecraft:clay'), item('minecraft:iron_shovel'), 2, [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) -// mods.pyrotech.worktable.addShapeless('precious_to_clay', item('minecraft:clay'), [item('minecraft:diamond'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]) -// mods.pyrotech.worktable.replaceShaped(item('minecraft:chest'), item('minecraft:iron_axe') | item('minecraft:stone_axe'), 3, [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) +// mods.pyrotech.worktable.addShapeless(resource('example:resource_location2'), item('minecraft:clay'), item('minecraft:stone_shovel'), 3, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) // mods.pyrotech.worktable.replaceShaped(item('minecraft:chest'), [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) -// mods.pyrotech.worktable.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:diamond_pickaxe'), 3, item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) +// mods.pyrotech.worktable.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) +// mods.pyrotech.worktable.replaceShaped(item('minecraft:chest'), item('minecraft:iron_axe') | item('minecraft:stone_axe'), 3, [[ore('logWood'),ore('logWood'),ore('logWood')],[ore('logWood'),null,ore('logWood')],[ore('logWood'),ore('logWood'),ore('logWood')]]) // mods.pyrotech.worktable.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) // mods.pyrotech.worktable.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, item('minecraft:diamond_pickaxe'), 4, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -// mods.pyrotech.worktable.replaceShaped('gold_to_diamonds', item('minecraft:diamond') * 8, [[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),null,item('minecraft:gold_ingot')],[item('minecraft:gold_ingot'),item('minecraft:gold_ingot'),item('minecraft:gold_ingot')]]) -// mods.pyrotech.worktable.replaceShapeless(item('minecraft:ender_eye'), item('minecraft:shears'), 3, [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) +// mods.pyrotech.worktable.replaceShaped(resource('minecraft:sea_lantern'), item('minecraft:diamond_pickaxe'), 3, item('minecraft:clay'), [[item('minecraft:glowstone')],[item('minecraft:glowstone')],[item('minecraft:glowstone')]]) // mods.pyrotech.worktable.replaceShapeless(item('minecraft:ender_eye'), [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) -// mods.pyrotech.worktable.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), item('minecraft:stone_axe'), 2, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) +// mods.pyrotech.worktable.replaceShapeless('minecraft:pink_dye_from_pink_tulip', item('minecraft:clay'), [item('minecraft:nether_star')]) +// mods.pyrotech.worktable.replaceShapeless(item('minecraft:ender_eye'), item('minecraft:shears'), 3, [item('minecraft:ender_pearl'),item('minecraft:nether_star')]) // mods.pyrotech.worktable.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) -// mods.pyrotech.worktable.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:iron_axe'), 2, item('minecraft:clay'), [item('minecraft:nether_star')]) -// mods.pyrotech.worktable.replaceShapeless('minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]) - +// mods.pyrotech.worktable.replaceShapeless('minecraft:pink_dye_from_pink_tulip', item('minecraft:iron_axe'), 2, item('minecraft:clay'), [item('minecraft:nether_star')]) +// mods.pyrotech.worktable.replaceShapeless(resource('minecraft:pink_dye_from_peony'), item('minecraft:clay'), item('minecraft:stone_axe'), 2, [item('minecraft:cobblestone'), item('minecraft:gold_ingot')]) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java index aca0d7a76..8d748a1e5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Bloomery.java @@ -129,7 +129,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder @Property private ItemStack bloom = ItemStack.EMPTY; @Property - private ItemStack slag = null; + private ItemStack slag; @Property(comp = @Comp(gt = 0), defaultValue = "21600") private int burnTime = 21600; @Property(comp = @Comp(gte = 0)) @@ -144,7 +144,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder private final List failureOutput = new ArrayList<>(1); @Property private final EnumSet anvilTiers = EnumSet.noneOf(AnvilRecipe.EnumTier.class); - @Property(comp = @Comp(gt = 0)) + @Property(comp = @Comp(gt = 0), defaultValue = "ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED") private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; @Property(comp = @Comp(not = "null"), defaultValue = "hammer") private AnvilRecipe.EnumType anvilType = AnvilRecipe.EnumType.HAMMER; @@ -194,28 +194,27 @@ public RecipeBuilder failureChance(float failureChance) { @RecipeBuilderMethodDescription public RecipeBuilder failureOutput(ItemStack failureOutput, int weight) { - if (failureOutput == null) failureOutput = ItemStack.EMPTY; - this.failureOutput.add(new BloomeryRecipeBase.FailureItem(failureOutput, weight)); + this.failureOutput.add(new BloomeryRecipeBase.FailureItem(failureOutput == null ? ItemStack.EMPTY : failureOutput, weight)); return this; } - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder anvilTier(AnvilRecipe.EnumTier tier) { anvilTiers.add(tier); return this; } - @RecipeBuilderMethodDescription(field = "anvilTier") + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder tierGranite() { return anvilTier(AnvilRecipe.EnumTier.GRANITE); } - @RecipeBuilderMethodDescription(field = "anvilTier") + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder tierIronclad() { return anvilTier(AnvilRecipe.EnumTier.IRONCLAD); } - @RecipeBuilderMethodDescription(field = "anvilTier") + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder tierObsidian() { return anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); } @@ -231,7 +230,7 @@ public RecipeBuilder typeHammer() { return anvilType(AnvilRecipe.EnumType.HAMMER); } - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(field = "anvilType") public RecipeBuilder typePickaxe() { return anvilType(AnvilRecipe.EnumType.PICKAXE); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java index 10fafbe66..4f51db0b7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/BrickSawmill.java @@ -108,7 +108,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder 1 ? quantities.get(1) : 2); registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_1"); - recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 1 ? chops.getInt(1) * 40.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, 32767)), 2)).setRegistryName(registryName); + recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 1 ? chops.getInt(1) * 40.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.FLINT_MILL_BLADE, 1, Short.MAX_VALUE), new ItemStack(ModuleTechMachine.Items.BONE_MILL_BLADE, 1, Short.MAX_VALUE)), 2)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); out = output.get(0).copy(); registryName = new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_2"); out.setCount(quantities.size() > 2 ? quantities.get(2) : quantities.size() > 1 ? quantities.get(1) : 2); - recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 2 ? chops.getInt(2) * 60.0 : 120.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, 32767), new ItemStack(ModuleTechMachine.Items.OBSIDIAN_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); + recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 2 ? chops.getInt(2) * 60.0 : 120.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.IRON_MILL_BLADE, 1, Short.MAX_VALUE), new ItemStack(ModuleTechMachine.Items.OBSIDIAN_MILL_BLADE, 1, Short.MAX_VALUE)), 1)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); out = output.get(0).copy(); out.setCount(quantities.size() > 3 ? quantities.get(3) : 3); new ResourceLocation(super.name.getNamespace(), "chopping_block/" + super.name.getPath() + "_tier_3"); - recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 3 ? chops.getInt(3) * 80.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, 32767)), 1)).setRegistryName(registryName); + recipe = (new StoneSawmillRecipe(out, in, (int) ((chops.size() > 3 ? chops.getInt(3) * 80.0 : 160.0) * durationModifier), Ingredient.fromStacks(new ItemStack(ModuleTechMachine.Items.DIAMOND_MILL_BLADE, 1, Short.MAX_VALUE)), 1)).setRegistryName(registryName); ModSupport.PYROTECH.get().stoneSawmill.add(recipe); ModSupport.PYROTECH.get().brickSawmill.add(BrickSawmillRecipesAdd.INHERIT_TRANSFORMER.apply(recipe).setRegistryName(registryName)); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java index 710958d18..5d12d67b5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/MechanicalCompactingBin.java @@ -33,9 +33,7 @@ public boolean isEnabled() { return ModPyrotech.INSTANCE.isModuleEnabled(ModuleTechMachine.class); } - @RecipeBuilderDescription(example = { - @Example(".hits(2, 2, 1, 1).input(item('minecraft:melon') * 8).output(item('minecraft:melon_block')).name('melon_compacting')") - }) + @RecipeBuilderDescription(example = @Example(".hits(2, 2, 1, 1).input(item('minecraft:melon') * 8).output(item('minecraft:melon_block')).name('melon_compacting')")) public RecipeBuilder recipeBuilder() { return new RecipeBuilder(); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java index ef1dfcd13..13a1cb751 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/PitBurn.java @@ -97,6 +97,7 @@ public static class RecipeBuilder implements IRecipeBuilder { private int burnStages; @Property(comp = @Comp(gt = 0)) private int burnTime; + @Property private FluidStack fluidOutput; @Property(comp = @Comp(gte = 0, lte = 1)) private float failureChance; @@ -261,11 +262,11 @@ public boolean test(IBlockState blockState) { private static Block getBlock(ItemStack stack) { Item item = stack.getItem(); - if (item instanceof ItemBlock) { - return ((ItemBlock) item).getBlock(); + if (item instanceof ItemBlock itemBlock) { + return itemBlock.getBlock(); } - if (item instanceof ItemBlockSpecial) { - return ((ItemBlockSpecial) item).getBlock(); + if (item instanceof ItemBlockSpecial itemBlockSpecial) { + return itemBlockSpecial.getBlock(); } Block block = ForgeRegistries.BLOCKS.getValue(item.getRegistryName()); if (block == null) block = Blocks.AIR; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java index 4eaee47dd..c1d815003 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneCrucible.java @@ -127,6 +127,7 @@ protected int getMaxItemInput() { } @Override + @RecipeBuilderRegistrationMethod public @Nullable StoneCrucibleRecipe register() { if (!validate()) return null; StoneCrucibleRecipe recipe = new StoneCrucibleRecipe(fluidOutput.get(0), input.get(0).toMcIngredient(), burnTime).setRegistryName(super.name); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java index 81b08326b..7bd79e11f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/StoneSawmill.java @@ -125,7 +125,7 @@ public static class RecipeBuilder extends AbstractRecipeBuilder { - @Property(value = "groovyscript.wiki.pyrotech.bloomery.bloom.value") + @Property("groovyscript.wiki.pyrotech.bloomery.bloom.value") private ItemStack bloom = ItemStack.EMPTY; - @Property(value = "groovyscript.wiki.pyrotech.bloomery.slag.value") - private ItemStack slag = null; + @Property("groovyscript.wiki.pyrotech.bloomery.slag.value") + private ItemStack slag; @Property(value = "groovyscript.wiki.pyrotech.bloomery.burnTime.value", comp = @Comp(gt = 0), defaultValue = "21600") private int burnTime = 21600; @Property(value = "groovyscript.wiki.pyrotech.bloomery.experience.value", comp = @Comp(gte = 0)) @@ -143,15 +143,15 @@ public static class RecipeBuilder extends AbstractRecipeBuilder failureOutput = new ArrayList<>(1); - @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilTiers.value") + @Property("groovyscript.wiki.pyrotech.bloomery.anvilTiers.value") private final EnumSet anvilTiers = EnumSet.noneOf(AnvilRecipe.EnumTier.class); - @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilHit.value", comp = @Comp(gt = 0)) + @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilHit.value", comp = @Comp(gt = 0), defaultValue = "ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED") private int anvilHit = ModuleTechBloomeryConfig.BLOOM.HAMMER_HITS_IN_ANVIL_REQUIRED; @Property(value = "groovyscript.wiki.pyrotech.bloomery.anvilType.value", comp = @Comp(not = "null")) private AnvilRecipe.EnumType anvilType = AnvilRecipe.EnumType.HAMMER; - @Property(value = "groovyscript.wiki.pyrotech.bloomery.langKey.value") + @Property("groovyscript.wiki.pyrotech.bloomery.langKey.value") private String langKey; @RecipeBuilderMethodDescription @@ -199,23 +199,23 @@ public RecipeBuilder failureOutput(ItemStack failureOutput, int weight) { return this; } - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder anvilTier(AnvilRecipe.EnumTier tier) { anvilTiers.add(tier); return this; } - @RecipeBuilderMethodDescription(field = "anvilTier") + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder tierGranite() { return anvilTier(AnvilRecipe.EnumTier.GRANITE); } - @RecipeBuilderMethodDescription(field = "anvilTier") + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder tierIronclad() { return anvilTier(AnvilRecipe.EnumTier.IRONCLAD); } - @RecipeBuilderMethodDescription(field = "anvilTier") + @RecipeBuilderMethodDescription(field = "anvilTiers") public RecipeBuilder tierObsidian() { return anvilTier(AnvilRecipe.EnumTier.OBSIDIAN); } @@ -231,7 +231,7 @@ public RecipeBuilder typeHammer() { return anvilType(AnvilRecipe.EnumType.HAMMER); } - @RecipeBuilderMethodDescription + @RecipeBuilderMethodDescription(field = "anvilType") public RecipeBuilder typePickaxe() { return anvilType(AnvilRecipe.EnumType.PICKAXE); } @@ -294,7 +294,7 @@ public void validate(GroovyLog.Msg msg) { @Override public @Nullable WitherForgeRecipe register() { if (!validate()) return null; - WitherForgeRecipeBuilder builder = new WitherForgeRecipeBuilder(super.name, !output.isEmpty() ? output.get(0) : ItemStack.EMPTY, input.get(0).toMcIngredient()); + WitherForgeRecipeBuilder builder = new WitherForgeRecipeBuilder(super.name, output.getOrEmpty(0), input.get(0).toMcIngredient()); failureOutput.forEach(i -> builder.addFailureItem(i.getItemStack(), i.getWeight())); WitherForgeRecipe recipe = builder .setSlagItem(slag, slag.getCount()) diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java index e701e478a..da96bcf4c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pyrotech/Worktable.java @@ -158,7 +158,7 @@ public void replaceShapeless(ItemStack output, List input) { .register(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulp', item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulip', item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) public void replaceShapeless(String name, ItemStack output, List input) { shapelessBuilder() .input(input) @@ -217,7 +217,7 @@ public void replaceShapeless(ItemStack output, IIngredient tool, int damage, Lis .register(); } - @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulp', item('minecraft:iron_axe'), 2, item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) + @MethodDescription(type = MethodDescription.Type.ADDITION, description = "groovyscript.wiki.minecraft.crafting.replaceShapeless1", example = @Example(value = "'minecraft:pink_dye_from_pink_tulip', item('minecraft:iron_axe'), 2, item('minecraft:clay'), [item('minecraft:nether_star')]", commented = true)) public void replaceShapeless(String name, ItemStack output, IIngredient tool, int damage, List input) { shapelessBuilder() .tool(tool, damage) @@ -361,7 +361,7 @@ public Shaped shapedBuilder() { @Example(".name('precious_to_clay').output(item('minecraft:clay')).input([item('minecraft:emerald'),item('minecraft:iron_ore'),item('minecraft:gold_ingot')])"), @Example(".name(resource('example:resource_location2')).output(item('minecraft:stone')).input([item('minecraft:gold_ore'), item('minecraft:gold_ingot')])"), @Example(".output(item('minecraft:ender_eye')).input([item('minecraft:ender_pearl'),item('minecraft:bowl')]).replace().tool(item('minecraft:iron_sword'), 4)"), - @Example(".name('minecraft:pink_dye_from_pink_tulp').output(item('minecraft:clay')).input([item('minecraft:stick')]).replaceByName().tool(item('minecraft:iron_pickaxe'), 2)"), + @Example(".name('minecraft:pink_dye_from_pink_tulip').output(item('minecraft:clay')).input([item('minecraft:stick')]).replaceByName().tool(item('minecraft:iron_pickaxe'), 2)"), @Example(".name(resource('minecraft:pink_dye_from_peony')).output(item('minecraft:coal')).input([item('minecraft:stone'), item('minecraft:iron_ingot')]).replaceByName().tool(item('minecraft:stone_axe'), 2)"), }) public Shapeless shapelessBuilder() { @@ -384,6 +384,9 @@ public Shaped() { super(3, 3); } + @RecipeBuilderMethodDescription(field = { + "tool", "damage" + }) public Shaped tool(IIngredient tool, int damage) { this.tool = tool; this.damage = damage; @@ -395,14 +398,14 @@ protected void handleReplace() { if (replace == 1) { ModSupport.PYROTECH.get().worktable.removeByOutput(IngredientHelper.toIIngredient(output), false); } else if (replace == 2) { - if (name == null) { + if (super.name == null) { GroovyLog.msg("Error replacing Pyrotech Worktable recipe") .add("Name must not be null when replacing by name") .error() .post(); return; } - ReloadableRegistryManager.removeRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), name); + ReloadableRegistryManager.removeRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), super.name); } } @@ -436,7 +439,7 @@ public WorktableRecipe register() { WorktableRecipe rec = ModSupport.PYROTECH.get().worktable.getRegistry().getValue(this.name); msg.add(rec != null && rec.getRecipe().canFit(1000, 1000), () -> "a recipe with that name already exists! Either replace or remove the recipe first"); if (msg.postIfNotEmpty()) return null; - WorktableRecipe worktableRecipe = new WorktableRecipe(recipe, tool == IIngredient.EMPTY ? null : tool.toMcIngredient(), damage, null).setRegistryName(name); + WorktableRecipe worktableRecipe = new WorktableRecipe(recipe, tool == IIngredient.EMPTY ? null : tool.toMcIngredient(), damage, null).setRegistryName(super.name); ModSupport.PYROTECH.get().worktable.add(worktableRecipe); return worktableRecipe; } @@ -460,6 +463,9 @@ public Shapeless() { super(3, 3); } + @RecipeBuilderMethodDescription(field = { + "tool", "damage" + }) public Shapeless tool(IIngredient tool, int damage) { this.tool = tool; this.damage = damage; @@ -471,14 +477,14 @@ protected void handleReplace() { if (replace == 1) { ModSupport.PYROTECH.get().worktable.removeByOutput(IngredientHelper.toIIngredient(output), false); } else if (replace == 2) { - if (name == null) { + if (super.name == null) { GroovyLog.msg("Error replacing Pyrotech Worktable recipe") .add("Name must not be null when replacing by name") .error() .post(); return; } - ReloadableRegistryManager.removeRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), name); + ReloadableRegistryManager.removeRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), super.name); } } @@ -508,7 +514,7 @@ public WorktableRecipe register() { if (msg.postIfNotEmpty()) return null; ShapelessCraftingRecipe recipe = new ShapelessCraftingRecipe(output.copy(), ingredients, recipeFunction, recipeAction); rec = new WorktableRecipe(recipe, tool == IIngredient.EMPTY ? null : tool.toMcIngredient(), damage, null); - ReloadableRegistryManager.addRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), name, rec); + ReloadableRegistryManager.addRegistryEntry(ModSupport.PYROTECH.get().worktable.getRegistry(), super.name, rec); return rec; } } diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index 4b61e6c42..096422d4b 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -2375,6 +2375,10 @@ groovyscript.wiki.prodigytech.zorra_altar.addEnchantment=Adds an enchantment tha groovyscript.wiki.prodigytech.zorra_altar.removeEnchantment=Removes an enchantment that can be applied in the Altar. # Pyrotech +groovyscript.wiki.pyrotech.oven.note0=Stone and Refractory Oven includes some recipes from the Furnace Registry that can't be removed here, you have to use `furnace.add` or `furnace.remove` to manipulate those recipes directly +groovyscript.wiki.pyrotech.sawmill.note0=If sawmill blade is not set, it will add the recipe for all sawmill blades. Sawmill blade needs to be one in the sawmill blades config list. If the blade doesn't have a durability it will never break. +groovyscript.wiki.pyrotech.sawmill.wood_chips.value=Sets the amount of wood chips to drop + groovyscript.wiki.pyrotech.anvil.title=Anvil groovyscript.wiki.pyrotech.anvil.description=Converts an item to a new item by hitting it with a hammer or pickaxe groovyscript.wiki.pyrotech.anvil.hits.value=Sets how many times the item needs to be hit @@ -2435,7 +2439,6 @@ groovyscript.wiki.pyrotech.brick_sawmill.title=Refractory Sawmill groovyscript.wiki.pyrotech.brick_sawmill.description=Converts an item into a new item with an item with durability and drops wood chips on given amount of time groovyscript.wiki.pyrotech.brick_sawmill.input.value=Sets the input required for the recipe. Second input value is an optional value for setting saw blade. groovyscript.wiki.pyrotech.brick_sawmill.duration.value=Sets the time required for the recipe to complete -groovyscript.wiki.pyrotech.brick_sawmill.wood_chips.value=Sets the amount of wood chip to drop. groovyscript.wiki.pyrotech.brick_sawmill.add=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips` groovyscript.wiki.pyrotech.brick_sawmill.note0=Can inherit recipes from [Chopping Block](./chopping_block.md) and [Stone Sawmill](./stone_sawmill.md) @@ -2504,10 +2507,6 @@ groovyscript.wiki.pyrotech.pit_kiln.inherit.value=Sets if the recipe should be i groovyscript.wiki.pyrotech.pit_kiln.add.inherit=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `inherit`, `failureChance`, `failureOutput` groovyscript.wiki.pyrotech.pit_kiln.add=Adds recipes in the format `name`, `input`, `output`, `burnTime`, `failureChance`, `failureOutput` -groovyscript.wiki.pyrotech.oven.note0=Stone and Refractory Oven includes some recipes from the Furnace Registry that can't be removed here, you have to use `furnace.add` or `furnace.remove` to manipulate those recipes directly - -groovyscript.wiki.pyrotech.sawmill.note0=If sawmill blade is not set, it will add the recipe for all sawmill blades. Sawmill blade needs to be one in the sawmill blades config list. If the blade doesn't have a durability it will never break. - groovyscript.wiki.pyrotech.stone_crucible.title=Stone Crucible groovyscript.wiki.pyrotech.stone_crucible.description=Converts an item into a liquid groovyscript.wiki.pyrotech.stone_crucible.burnTime.value=Sets the time required for the recipe to complete @@ -2538,7 +2537,6 @@ groovyscript.wiki.pyrotech.stone_sawmill.title=Stone Sawmill groovyscript.wiki.pyrotech.stone_sawmill.description=Converts an item into a new item with an item with durability and drops wood chips on given amount of time groovyscript.wiki.pyrotech.stone_sawmill.input.value=Sets the input required for the recipe. Second input value is an optional value for setting sawmill blade groovyscript.wiki.pyrotech.stone_sawmill.duration.value=Sets the time required for the recipe to complete -groovyscript.wiki.pyrotech.stone_sawmill.wood_chips.value=Sets the wood chip amount that will drop groovyscript.wiki.pyrotech.stone_sawmill.inherit.value=Sets if the recipe should be inherited by more advanced machines groovyscript.wiki.pyrotech.stone_sawmill.add.inherit=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips`, `inherit` groovyscript.wiki.pyrotech.stone_sawmill.add=Adds recipes in the format `name`, `input`, `(optional) blade`, `output`, `duration`, `woodChips` @@ -2548,7 +2546,7 @@ groovyscript.wiki.pyrotech.soaking_pot.title=Soaking Pot groovyscript.wiki.pyrotech.soaking_pot.description=Converts an item and liquid into a new item. Can require a campfire below groovyscript.wiki.pyrotech.soaking_pot.time.value=Sets the time required for the recipe to complete groovyscript.wiki.pyrotech.soaking_pot.campfireRequired.value=Sets if a campfire is required underneath -groovyscript.wiki.pyrotech.soaking_pot.add=Adds recipes in the format `name`, `input`, `output`, `time` +groovyscript.wiki.pyrotech.soaking_pot.add=Adds recipes in the format `name`, `input`, `fluidInput`, `output`, `time` groovyscript.wiki.pyrotech.tanning_rack.title=Tanning Rack groovyscript.wiki.pyrotech.tanning_rack.description=Converts an item over time into a new one @@ -2558,6 +2556,7 @@ groovyscript.wiki.pyrotech.tanning_rack.add=Adds recipes in the format `name`, ` groovyscript.wiki.pyrotech.wither_forge.title=Wither Forge groovyscript.wiki.pyrotech.wither_forge.description=Converts item to a new item or a 'bloom' which are items that needs to be hit with hammer on anvil to get the output with varying amounts +groovyscript.wiki.pyrotech.wither_forge.note0=Can inherit recipes from [Bloomery](./bloomery.md) groovyscript.wiki.pyrotech.wither_forge.add0=Adds recipes in the format `name`, `output`, `input` groovyscript.wiki.pyrotech.wither_forge.add1=Adds recipes in the format `name`, `output`, `input`, `burnTime` groovyscript.wiki.pyrotech.wither_forge.addBloom0=Adds recipes in the format `name`, `bloomOutput`, `input` @@ -2568,6 +2567,7 @@ groovyscript.wiki.pyrotech.worktable.description=Crafting table which asks you t groovyscript.wiki.pyrotech.worktable.tool.value=Sets the tool that will be used groovyscript.wiki.pyrotech.worktable.damage.value=Sets the damage to put into that tool + # PneumaticCraft groovyscript.wiki.pneumaticcraft.amadron.title=Amadron groovyscript.wiki.pneumaticcraft.amadron.description=Uses an Amadron Tablet and linked inventories in world to trade via drones.