diff --git a/src/main/java/com/cleanroommc/groovyscript/GroovyScriptConfig.java b/src/main/java/com/cleanroommc/groovyscript/GroovyScriptConfig.java index d09bafc7e..d3c9f4c2c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/GroovyScriptConfig.java +++ b/src/main/java/com/cleanroommc/groovyscript/GroovyScriptConfig.java @@ -20,6 +20,9 @@ public static class Compat { @Config.Comment("Enables DE energy core compat. Config is mainly for other mods compat.") public boolean draconicEvolutionEnergyCore = true; + @Config.Comment("Validate input stack sizes when adding recipes, i.e. disallow adding recipes with input stack size > 1 when the machine's code doesn't check for input count. Disable if you want to write such recipes anyway.") + public boolean checkInputStackCounts = true; + @Config.Name("ExtendedCrafting recipe maker makes grs recipes") @Config.Comment("If this is true, the recipe maker from ExtendedCrafting will produce a script for GroovyScript instead of CraftTweaker.") public boolean extendedCraftingRecipeMakerMakesGrsRecipes = true; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java index d733a076b..9702e5c2e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java @@ -13,7 +13,6 @@ import com.cleanroommc.groovyscript.compat.mods.astralsorcery.AstralSorcery; import com.cleanroommc.groovyscript.compat.mods.atum.Atum; import com.cleanroommc.groovyscript.compat.mods.botaniatweaks.BotaniaTweaks; -import com.cleanroommc.groovyscript.compat.mods.theaurorian.TheAurorian; import com.cleanroommc.groovyscript.compat.mods.avaritia.Avaritia; import com.cleanroommc.groovyscript.compat.mods.betterwithmods.BetterWithMods; import com.cleanroommc.groovyscript.compat.mods.bloodmagic.BloodMagic; @@ -21,8 +20,8 @@ import com.cleanroommc.groovyscript.compat.mods.botanicadditions.BotanicAdditions; import com.cleanroommc.groovyscript.compat.mods.calculator.Calculator; import com.cleanroommc.groovyscript.compat.mods.chisel.Chisel; -import com.cleanroommc.groovyscript.compat.mods.cyclic.Cyclic; import com.cleanroommc.groovyscript.compat.mods.compactmachines.CompactMachines; +import com.cleanroommc.groovyscript.compat.mods.cyclic.Cyclic; import com.cleanroommc.groovyscript.compat.mods.draconicevolution.DraconicEvolution; import com.cleanroommc.groovyscript.compat.mods.enderio.EnderIO; import com.cleanroommc.groovyscript.compat.mods.essentialcraft.EssentialCraft; @@ -53,6 +52,7 @@ import com.cleanroommc.groovyscript.compat.mods.tcomplement.TinkersComplement; import com.cleanroommc.groovyscript.compat.mods.techreborn.TechReborn; import com.cleanroommc.groovyscript.compat.mods.thaumcraft.Thaumcraft; +import com.cleanroommc.groovyscript.compat.mods.theaurorian.TheAurorian; import com.cleanroommc.groovyscript.compat.mods.thermalexpansion.ThermalExpansion; import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.TinkersConstruct; import com.cleanroommc.groovyscript.compat.mods.woot.Woot; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java index e875d37d4..948472c39 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java @@ -90,6 +90,11 @@ public RecipeBuilder type(Lens type) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Actually Additions Atomic Reconstructor recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java index 5c88ad942..f1d39a18b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Compost.java @@ -83,6 +83,11 @@ public RecipeBuilder outputDisplay(IBlockState outputDisplay) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Actually Additions Compost recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java index 9c748c5b8..0d6d1edd4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Crusher.java @@ -76,6 +76,11 @@ public RecipeBuilder chance(int chance) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Actually Additions Crusher recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java index 916294af5..827eaa175 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java @@ -155,6 +155,12 @@ public RecipeBuilder blue(float blue) { return this; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed on the Empowerer or Display Stands + return 1; + } + @Override public String getErrorMsg() { return "Error adding Actually Additions Empowerer recipe"; @@ -168,6 +174,7 @@ public void validate(GroovyLog.Msg msg) { validateItems(msg, 4, 4, 1, 1); validateFluids(msg); msg.add(mainInput == null, "mainInput must be defined"); + msg.add(IngredientHelper.overMaxSize(mainInput, 1), "mainInput must have a stack size of 1"); msg.add(energyPerStand < 0, "energyPerStand must be a non negative integer, yet it was {}", energyPerStand); msg.add(time <= 0, "time must be an integer greater than 0, yet it was {}", time); msg.add(red < 0 || red > 1, "red must be a float between 0 and 1, yet it was {}", red); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java index b96dd4ae5..f3b9a66ec 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Enchanter.java @@ -51,6 +51,11 @@ public RecipeBuilder time(int time) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Aether Enchanter Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java index 99771326a..48259357c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/EnchanterFuel.java @@ -1,9 +1,11 @@ package com.cleanroommc.groovyscript.compat.mods.aetherlegacy; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.gildedgames.the_aether.api.enchantments.AetherEnchantmentFuel; import net.minecraft.item.ItemStack; @@ -18,6 +20,12 @@ public EnchanterFuel() { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:blaze_rod'), 1000")) public void add(ItemStack fuel, int timeGiven) { + if (IngredientHelper.overMaxSize(fuel, 1)) { + GroovyLog.msg("Error adding Enchanter Fuel").error() + .add("Fuel must have stack size of 1, got {}", fuel.getCount()) + .post(); + return; + } AetherEnchantmentFuel enchantmentFuel = new AetherEnchantmentFuel(fuel, timeGiven); add(enchantmentFuel); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java index 702ab5d79..3d9371355 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/Freezer.java @@ -51,6 +51,11 @@ public RecipeBuilder time(int time) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Aether Freezer Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java index bcce1f42a..3ae553430 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java @@ -1,9 +1,11 @@ package com.cleanroommc.groovyscript.compat.mods.aetherlegacy; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.ForgeRegistryWrapper; import com.gildedgames.the_aether.api.freezables.AetherFreezableFuel; import net.minecraft.item.ItemStack; @@ -18,6 +20,12 @@ public FreezerFuel() { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:packed_ice'), 1000")) public void add(ItemStack fuel, int timeGiven) { + if (IngredientHelper.overMaxSize(fuel, 1)) { + GroovyLog.msg("Error adding Freezer Fuel").error() + .add("Fuel must have stack size of 1, got {}", fuel.getCount()) + .post(); + return; + } AetherFreezableFuel freezableFuel = new AetherFreezableFuel(fuel, timeGiven); add(freezableFuel); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java index 6c3f0bca5..cd658313b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java @@ -1,11 +1,13 @@ package com.cleanroommc.groovyscript.compat.mods.appliedenergistics2; import appeng.api.AEApi; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.core.mixin.appliedenergistics2.MatterCannonAmmoRegistryAccessor; import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; import net.minecraft.item.ItemStack; import org.apache.commons.lang3.tuple.Pair; @@ -27,6 +29,12 @@ public void onReload() { @MethodDescription(type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:clay'), 10000")) public void add(ItemStack item, double value) { + if (IngredientHelper.overMaxSize(item, 1)) { + GroovyLog.msg("Error adding Cannon Ammo").error() + .add("Item must have stack size of 1, got {}", item.getCount()) + .post(); + return; + } addScripted(Pair.of(item, value)); ((MatterCannonAmmoRegistryAccessor) AEApi.instance().registries().matterCannon()).getDamageModifiers().put(item, value); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java index 54e9a23cc..a64adb732 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/Inscriber.java @@ -110,6 +110,12 @@ public RecipeBuilder bottom(ItemStack bottom) { return this; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in the machine's slots + return 1; + } + @Override public String getErrorMsg() { return "Error adding Applied Energistics 2 Inscriber recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java index f95336271..84da63998 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Grindstone.java @@ -90,6 +90,12 @@ public RecipeBuilder secondaryChance(float chance) { return this; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public String getErrorMsg() { return "Error adding Astral Sorcery Grindstone recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java index b86981fbc..5480387fd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/InfusionAltar.java @@ -147,6 +147,12 @@ public RecipeBuilder time(int time) { return this; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public String getErrorMsg() { return "Error adding Astral Infusion recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Lightwell.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Lightwell.java index 2fcd37f1c..b0ae570d3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Lightwell.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Lightwell.java @@ -6,6 +6,7 @@ import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.core.mixin.astralsorcery.WellLiquefactionAccessor; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.recipe.IRecipeBuilder; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; import hellfirepvp.astralsorcery.common.base.WellLiquefaction; @@ -177,6 +178,7 @@ public boolean validate() { } if (this.output == null) out.add("No output specified.").error(); if (this.catalyst == null) out.add("No catalyst specified.").error(); + if (IngredientHelper.overMaxSize(this.catalyst, 1)) out.add("Catalyst must have a stack size of 1.").error(); out.postIfNotEmpty(); return out.getLevel() != Level.ERROR; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java index 50b14bda4..c3e097262 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java @@ -125,6 +125,7 @@ public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, Integer.MAX_VALUE, 0, 0); validateFluids(msg); msg.add(IngredientHelper.isEmpty(filter), "filter must be defined"); + msg.add(IngredientHelper.overMaxSize(filter, 1), "Filter must have stack size of 1, got {}", filter.getAmount()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java index 6cc10b50f..a6522858e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Kiln.java @@ -121,6 +121,12 @@ public String getErrorMsg() { return "Error adding Better With Mods Kiln recipe"; } + @Override + protected int getMaxItemInput() { + // Uses blocks to craft + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 0, 1, 3); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java index 873c86820..3ae30ee25 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/MillStone.java @@ -105,6 +105,11 @@ public String getErrorMsg() { return "Error adding Better With Mods Mill recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 3, 1, 3); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java index 4f7f4e28b..681e6afe6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Saw.java @@ -97,6 +97,12 @@ public String getErrorMsg() { return "Error adding Better With Mods Saw recipe"; } + @Override + protected int getMaxItemInput() { + // Uses blocks to craft + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 0, 1, 3); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java index b938467c3..d8836bda5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/Turntable.java @@ -118,6 +118,12 @@ public String getErrorMsg() { return "Error adding Better With Mods Turntable recipe"; } + @Override + protected int getMaxItemInput() { + // Uses blocks to craft + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 0, 0, 2); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java index 514030c11..6c0578fdf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyArray.java @@ -159,6 +159,12 @@ public RecipeBuilder texture(String texture) { return this; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in the Ashes's slots + return 1; + } + @Override public String getErrorMsg() { return "Error adding Blood Magic Alchemy Array recipe"; @@ -168,6 +174,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); msg.add(catalyst == null, "Must have a catalyst ItemStack but didn't find any!"); + msg.add(IngredientHelper.overMaxSize(catalyst, 1), "Catalyst must have a stack size of 1!"); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java index 1d7b5b8e4..c3db6e1f6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/AlchemyTable.java @@ -143,6 +143,11 @@ public RecipeBuilder tier(int tier) { return minimumTier(tier); } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Blood Magic Alchemy Table recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java index 15356983b..c67302f4c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/BloodAltar.java @@ -131,6 +131,11 @@ public RecipeBuilder drainRate(int drainRate) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Blood Magic Blood Altar recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java index 112f82f2e..8d94539c1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java @@ -18,7 +18,7 @@ import java.util.Collection; import java.util.Collections; -@RegistryDescription +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.bloodmagic.tartaric_forge.note", type = Admonition.Type.WARNING)) public class TartaricForge extends StandardListRegistry { @RecipeBuilderDescription(example = { @@ -125,6 +125,11 @@ public RecipeBuilder drain(int drain) { return soulDrain(drain); } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Blood Magic Tartaric Forge recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java index 63a71c879..18008c2b0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/Apothecary.java @@ -84,6 +84,12 @@ public boolean removeByInputs(IIngredient... inputs) { @Property(property = "output", comp = @Comp(eq = 1)) public class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + // Each slot of Apothecary can only contain 1 item + return 1; + } + @Override public String getErrorMsg() { return "Error adding Botania Apothecary recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java index 794952a46..31497851d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/ManaInfusion.java @@ -112,6 +112,11 @@ public RecipeBuilder useConjuration() { return catalyst(RecipeManaInfusion.conjurationState); } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Botania Mana Infusion recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java index 2078be0af..de28efa80 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/botania/RuneAltar.java @@ -88,6 +88,12 @@ public RecipeBuilder mana(int amount) { return this; } + @Override + protected int getMaxItemInput() { + // Each slot of Apothecary can only contain 1 item + return 1; + } + @Override public String getErrorMsg() { return "Error adding Botania Rune Altar recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java index 08297c10d..6fd8f29e4 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AlgorithmSeparator.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 2)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Algorithm Separator Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java index 5925e9d78..ae6c09de3 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/AtomicCalculator.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Atomic Calculator Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java index 9d1ac2cfc..2da303b54 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/BasicCalculator.java @@ -67,6 +67,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Basic Calculator Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java index 32c38eb84..df3b97f8b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ConductorMast.java @@ -71,6 +71,11 @@ public RecipeBuilder value(int value) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Conductor Mast Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java index 71e947a50..dff8de92a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ExtractionChamber.java @@ -81,6 +81,11 @@ public RecipeBuilder isDamaged(boolean isDamaged) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Extraction Chamber Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java index 479d7f71e..07cdc04ea 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/FlawlessCalculator.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Flawless Calculator Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java index 11a58686a..f0ac9120d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/GlowstoneExtractor.java @@ -55,6 +55,11 @@ public RecipeBuilder value(int value) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Glowstone Extractor Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java index 22f66417e..76b3342aa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/HealthProcessor.java @@ -55,6 +55,11 @@ public RecipeBuilder value(int value) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Health Processor Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java index f7043398f..dd7203ddc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/PrecisionChamber.java @@ -65,6 +65,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 2)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Precision Chamber Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java index ffbcc0396..0f477d6db 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ProcessingChamber.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Processing Chamber Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java index 6394c2c85..ddfb9dbaf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ReassemblyChamber.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Reassembly Chamber Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java index 19bf4f0ca..2254d81c5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RedstoneExtractor.java @@ -55,6 +55,11 @@ public RecipeBuilder value(int value) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Redstone Extractor Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java index d77b96d64..563a82a40 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/RestorationChamber.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Restoration Chamber Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java index 0a76fe7de..cb59ea615 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/ScientificCalculator.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Scientific Calculator Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java index 45d2abde6..f94d58345 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StarchExtractor.java @@ -55,6 +55,11 @@ public RecipeBuilder value(int value) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Starch Extractor Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java index 6c44e6130..00c3a3b3c 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/calculator/StoneSeparator.java @@ -62,6 +62,11 @@ public boolean removeByOutput(IIngredient output) { @Property(property = "output", comp = @Comp(eq = 2)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Calculator Stone Separator Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java index 9e5092e88..ef20b0afc 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java @@ -7,6 +7,7 @@ import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.compat.mods.ModSupport; import com.cleanroommc.groovyscript.helper.ingredient.GroovyScriptCodeConverter; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.AbstractReloadableStorage; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; import net.minecraft.item.ItemStack; @@ -60,6 +61,12 @@ public void onReload() { @Example("'demo', item('chisel:antiblock:3')"), @Example("'demo', item('minecraft:sea_lantern')")}, type = MethodDescription.Type.ADDITION) public void addVariation(String groupName, ItemStack item) { + if (IngredientHelper.overMaxSize(item, 1)) { + GroovyLog.msg("Error adding Chisel Carving").error() + .add("Item must have stack size of 1, got {}", item.getCount()) + .post(); + return; + } try { getRegistry().addVariation(groupName, CarvingUtils.variationFor(item, 0)); addScripted(Pair.of(groupName, item)); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java index 22942890f..fb464fe3b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/compactmachines/Miniaturization.java @@ -150,6 +150,12 @@ public String getErrorMsg() { return "Error adding Compact Machines Multiblock recipe"; } + @Override + protected int getMaxItemInput() { + // GS's code throws the quantity away + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java index 6596c081c..15c7eb7b0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Enchanter.java @@ -153,7 +153,8 @@ public boolean validate() { .add(enchantment == null, () -> "enchantment must not be null") .add(IngredientHelper.isEmpty(input), () -> "input must not be empty") .add(IngredientHelper.isEmpty(book), () -> "custom book must not be empty") - .add(IngredientHelper.isEmpty(lapis), () -> "custom lapis must not be empty"); + .add(IngredientHelper.isEmpty(lapis), () -> "custom lapis must not be empty") + .add(IngredientHelper.overMaxSize(book, 1), () -> "custom book stack size must be 1"); if (amount <= 0 && input != null) amount = input.getAmount(); return !msg.postIfNotEmpty(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java index 8e846ffa5..24c372e94 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java @@ -21,7 +21,7 @@ import java.util.Collection; -@RegistryDescription +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.enderio.sag_mill.note", type = Admonition.Type.WARNING)) public class SagMill extends StandardListRegistry { public SagMill() { @@ -96,6 +96,11 @@ public RecipeBuilder bonusTypeChance() { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding EnderIO Sag Mill recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java index bfde27169..5b27ce2ad 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java @@ -14,7 +14,7 @@ import java.util.Collection; -@RegistryDescription +@RegistryDescription(admonition = @Admonition(value = "groovyscript.wiki.enderio.sag_mill.note", type = Admonition.Type.WARNING)) public class SagMillGrinding extends StandardListRegistry { public SagMillGrinding() { @@ -78,6 +78,11 @@ public RecipeBuilder duration(int duration) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding EnderIO Sag Mill Grinding Ball entry"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java index dc0850467..9c74bd82a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java @@ -113,6 +113,9 @@ public void validate(GroovyLog.Msg msg) { int inputSize = input.getRealSize(); output.trim(); msg.add(inputSize < 1 || inputSize > 6, () -> "Must have 1 - 6 inputs, but found " + input.size()); + for (IIngredient ingredient : input) { + msg.add(IngredientHelper.overMaxSize(ingredient, 1), "Input {} must have a stack size of 1", ingredient); + } msg.add(output.size() != 1, () -> "Must have exactly 1 output, but found " + output.size()); validateFluids(msg); if (energy <= 0) energy = 5000; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java index d7a207338..33ad14e75 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SoulBinder.java @@ -165,6 +165,12 @@ public RecipeBuilder energy(int energy) { return this; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in the machine's slots + return 1; + } + @Override public String getErrorMsg() { return "Error adding EnderIO Soul Binder recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java index ef88a4362..74e1ade9d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Tank.java @@ -221,6 +221,11 @@ public RecipeBuilder drain() { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding EnderIO Tank recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java index 6a541fe67..517d4fa12 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java @@ -168,6 +168,12 @@ public boolean validate() { GroovyLog.Msg msg = GroovyLog.msg("Error adding EnderIO Vat recipe").error(); msg.add(IngredientHelper.isEmpty(input), () -> "fluid input must not be empty"); msg.add(IngredientHelper.isEmpty(output), () -> "fluid output must not be empty"); + for (IIngredient ingredient : itemInputs1) { + msg.add(IngredientHelper.overMaxSize(ingredient, 1), "First slot input {} must have a stack size of 1", ingredient); + } + for (IIngredient ingredient : itemInputs2) { + msg.add(IngredientHelper.overMaxSize(ingredient, 1), "Second slot input {} must have a stack size of 1", ingredient); + } if (energy <= 0) energy = 5000; if (baseMultiplier <= 0) baseMultiplier = 1; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java index 156ec6d6e..e28356d70 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/MagicianTable.java @@ -50,6 +50,11 @@ public RecipeBuilder mru(int cost) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Magician Table Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java index 619434f90..900e703bd 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/RadiatingChamber.java @@ -77,9 +77,14 @@ public RadiatingChamber.RecipeBuilder upperBalance(float upperBalance) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { - return "Error adding Magician Table Recipe"; + return "Error adding Radiating Chamber Recipe"; } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java index 37acae30d..cde4391c0 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/essentialcraft/WindRune.java @@ -63,6 +63,11 @@ public RecipeBuilder espe(int cost) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Wind Rune Recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java index e20ab2552..1439a79b9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/BloodInfuser.java @@ -112,6 +112,11 @@ public String getErrorMsg() { return "Error adding EvilCraft Blood Infuser Recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java index 57115396e..3c8d58630 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/evilcraft/EnvironmentalAccumulator.java @@ -135,6 +135,11 @@ public String getErrorMsg() { return "Error adding EvilCraft Environmental Accumulator Recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java index 88117da7e..bd7334c21 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java @@ -1,10 +1,13 @@ package com.cleanroommc.groovyscript.compat.mods.forestry; +import com.cleanroommc.groovyscript.GroovyScriptConfig; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.IResourceStack; import com.cleanroommc.groovyscript.core.mixin.forestry.CarpenterRecipeManagerAccessor; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import forestry.api.recipes.ICarpenterRecipe; @@ -16,10 +19,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; public class Carpenter extends ForestryRegistry { @@ -200,6 +200,10 @@ public void validate(GroovyLog.Msg msg) { validateFluids(msg, 0, 1, 0, 0); validateItems(msg, 0, 0, 1, 1); validatePattern(msg, pattern, keys); + for (IIngredient ingredient : keys.values()) { + msg.add(IngredientHelper.overMaxSize(ingredient, 1), "Grid input {} must have a stack size of 1", ingredient); + } + msg.add(IngredientHelper.overMaxSize(box, 1), "Box must have a stack size of 1, got {}", box.getAmount()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java index 4e3d0379a..d71a2f5db 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Centrifuge.java @@ -110,6 +110,11 @@ public String getErrorMsg() { return "Error adding Forestry Centrifuge recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateFluids(msg); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java index 3a0f96d1a..d87f241bf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Moistener.java @@ -92,6 +92,11 @@ public String getErrorMsg() { return "Error adding Forestry Moistener recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateFluids(msg); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java index bce89ded3..cda583507 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java @@ -6,6 +6,7 @@ import com.cleanroommc.groovyscript.core.mixin.forestry.FabricatorRecipeManagerAccessor; import com.cleanroommc.groovyscript.helper.Alias; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; import com.cleanroommc.groovyscript.helper.recipe.AbstractRecipeBuilder; import forestry.api.recipes.IFabricatorRecipe; @@ -161,6 +162,10 @@ public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 0, 1, 1); validateFluids(msg, 1, 1, 0, 0); Carpenter.validatePattern(msg, pattern, keys); + for (IIngredient ingredient : keys.values()) { + msg.add(IngredientHelper.overMaxSize(ingredient, 1), "Grid input {} must have a stack size of 1", ingredient); + } + msg.add(IngredientHelper.overMaxSize(catalyst, 1), "Box must have a stack size of 1, got {}", catalyst.getAmount()); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java index 47460c9d8..4d874fce1 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BlastFurnaceFuel.java @@ -73,6 +73,12 @@ public String getErrorMsg() { return "Error adding Immersive Engineering Blast Furnace Fuel"; } + @Override + protected int getMaxItemInput() { + // The recipe requires X inputs, but only consumes 1 anyway + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 0); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java index 42fde134d..ea277e549 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/BottlingMachine.java @@ -91,6 +91,12 @@ public void removeByInput(ItemStack input, FluidStack inputFluid) { @Property(property = "fluidInput", comp = @Comp(eq = 1)) public static class RecipeBuilder extends AbstractRecipeBuilder { + @Override + protected int getMaxItemInput() { + // Recipe cannot be executed + return 1; + } + @Override public String getErrorMsg() { return "Error adding Immersive Engineering Bottling recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java index f2da52f1b..f3db52354 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/immersiveengineering/CokeOven.java @@ -99,6 +99,11 @@ public RecipeBuilder creosote(int creosote) { return this; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public String getErrorMsg() { return "Error adding Immersive Engineering Coke Oven recipe"; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java index ba47d88e1..70423202d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java @@ -2,10 +2,12 @@ import com.buuz135.industrial.api.recipe.BioReactorEntry; import com.buuz135.industrial.api.recipe.IReactorEntry; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.StandardListRegistry; import com.google.common.base.Predicate; import net.minecraft.item.ItemStack; @@ -29,6 +31,12 @@ public IReactorEntry add(ItemStack input) { @MethodDescription(description = "groovyscript.wiki.industrialforegoing.bio_reactor.add1", type = MethodDescription.Type.ADDITION) public IReactorEntry add(ItemStack input, @Nullable Predicate nbtCheck) { + if (IngredientHelper.overMaxSize(input, 1)) { + GroovyLog.msg("Error adding Bioreactor recipe").error() + .add("Input stack size must be 1") + .post(); + return null; + } IReactorEntry recipe = new BioReactorEntry(input, nbtCheck); add(recipe); return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java index 4d477dc33..64ff59c73 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java @@ -1,11 +1,13 @@ package com.cleanroommc.groovyscript.compat.mods.industrialforegoing; import com.buuz135.industrial.api.extractor.ExtractorEntry; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.StandardListRegistry; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -31,6 +33,12 @@ public ExtractorEntry add(ItemStack input, FluidStack output) { @MethodDescription(description = "groovyscript.wiki.industrialforegoing.extractor.add1", type = MethodDescription.Type.ADDITION, example = @Example("item('minecraft:stone'), fluid('water') * 100, 1")) public ExtractorEntry add(ItemStack input, FluidStack output, float breakChance) { + if (IngredientHelper.overMaxSize(input, 1)) { + GroovyLog.msg("Error adding Fluid Extractor recipe").error() + .add("Stack size of input must be 1") + .post(); + return null; + } ExtractorEntry recipe = new ExtractorEntry(input, output, breakChance); add(recipe); return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java index 66416ad3e..3490de3cb 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java @@ -1,11 +1,13 @@ package com.cleanroommc.groovyscript.compat.mods.industrialforegoing; import com.buuz135.industrial.api.recipe.ore.OreFluidEntryRaw; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; import com.cleanroommc.groovyscript.registry.StandardListRegistry; import net.minecraftforge.fluids.FluidStack; @@ -29,6 +31,12 @@ public Collection getRecipes() { @Example("ore('stone'), fluid('water') * 1000, fluid('lava') * 50") }) public OreFluidEntryRaw add(OreDictIngredient ore, FluidStack input, FluidStack output) { + if (IngredientHelper.overMaxSize(ore, 1)) { + GroovyLog.msg("Error adding Ore Washer recipe").error() + .add("Stack size of input ore must be 1") + .post(); + return null; + } return add(ore.getOreDict(), input, output); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java index 76871cdec..eb60981d6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java @@ -1,11 +1,13 @@ package com.cleanroommc.groovyscript.compat.mods.industrialforegoing; import com.buuz135.industrial.api.recipe.ore.OreFluidEntrySieve; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.helper.Alias; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.StandardListRegistry; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -29,6 +31,12 @@ public Collection getRecipes() { @Example("fluid('lava') * 5, item('minecraft:gold_ingot'), item('minecraft:clay')") }) public OreFluidEntrySieve add(FluidStack input, ItemStack output, ItemStack sieveItem) { + if (IngredientHelper.overMaxSize(sieveItem, 1)) { + GroovyLog.msg("Error adding Fluid Sieving recipe").error() + .add("Sieve item stack size must be 1") + .post(); + return null; + } OreFluidEntrySieve recipe = new OreFluidEntrySieve(input, output, sieveItem); add(recipe); return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java index fa27ca3fd..65e04109f 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java @@ -2,10 +2,12 @@ import com.buuz135.industrial.api.recipe.IReactorEntry; import com.buuz135.industrial.api.recipe.ProteinReactorEntry; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.registry.StandardListRegistry; import com.google.common.base.Predicate; import net.minecraft.item.ItemStack; @@ -29,6 +31,12 @@ public IReactorEntry add(ItemStack input) { @MethodDescription(description = "groovyscript.wiki.industrialforegoing.protein_reactor.add1", type = MethodDescription.Type.ADDITION) public IReactorEntry add(ItemStack input, @Nullable Predicate nbtCheck) { + if (IngredientHelper.overMaxSize(input, 1)) { + GroovyLog.msg("Error adding Protein Reactor recipe").error() + .add("Input stack size must be 1") + .post(); + return null; + } IReactorEntry recipe = new ProteinReactorEntry(input, nbtCheck); add(recipe); return recipe; diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java index 28ddcd4ad..7acc0c783 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/inspirations/Cauldron.java @@ -321,6 +321,11 @@ public String getErrorMsg() { return "Error adding Inspirations Cauldron recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { if (type == null) { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java index 00805fed6..c0e9eeb68 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/DryingBasin.java @@ -105,6 +105,12 @@ public String getErrorMsg() { return "Error adding Integrated Dynamics Drying Basin Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed (normal), ignores input stack size (mechanical) + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 1, 0, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java index d257f7f95..fad729e97 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/integrateddynamics/Squeezer.java @@ -118,6 +118,12 @@ public String getErrorMsg() { return "Error adding Integrated Dynamics Squeezer Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed (normal), ignores input stack size (mechanical) + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 3); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java index 87d7e45ed..6c8f2b1db 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Aggregator.java @@ -61,6 +61,11 @@ public String getErrorMsg() { return "Error adding Lazy AE2 Aggregator recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 3, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java index 3fb369d38..ea3a8db1b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Centrifuge.java @@ -60,6 +60,11 @@ public String getErrorMsg() { return "Error adding Lazy AE2 Centrifuge recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 3, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java index 889cf4e1a..06667b152 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Energizer.java @@ -76,6 +76,11 @@ public void validate(GroovyLog.Msg msg) { msg.add(energy <= 0, "energy must be greater than 0, yet it was {}", energy); } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override @RecipeBuilderRegistrationMethod public @Nullable EnergizeRecipe register() { diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java index 21e97930e..29b14d31a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/lazyae2/Etcher.java @@ -77,6 +77,11 @@ public String getErrorMsg() { return "Error adding Lazy AE2 Etcher recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java index 910f0a732..c1788b6bf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Altar.java @@ -145,6 +145,12 @@ public String getRecipeNamePrefix() { return "groovyscript_altar_"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java index 30c8caa18..28d5209bf 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Offering.java @@ -125,6 +125,12 @@ public String getRecipeNamePrefix() { return "groovyscript_offering_"; } + @Override + protected int getMaxItemInput() { + // Offering Table's capacity + return 16; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java index 08611c939..9c963f610 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/naturesaura/Ritual.java @@ -136,6 +136,12 @@ public String getRecipeNamePrefix() { return "groovyscript_ritual_"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java index 83ca00c6b..fa97d92f9 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/Explosion.java @@ -71,6 +71,11 @@ public String getErrorMsg() { return "Error adding PneumaticCraft Explosion recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java index e93b233d4..90ecea9f5 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/HeatFrameCooling.java @@ -58,6 +58,12 @@ public String getErrorMsg() { return "Error adding PneumaticCraft Heat Frame Cooling recipe"; } + @Override + protected int getMaxItemInput() { + // The recipe correctly requires an increased amount of input items, but only consumes 1 + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java index 6372f0151..6803f4dd6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/pneumaticcraft/PlasticMixer.java @@ -138,6 +138,12 @@ public String getErrorMsg() { return "Error adding PneumaticCraft Plastic Mixer recipe"; } + @Override + protected int getMaxItemInput() { + // PnC modifies the recipe to only consume 1 item + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 0, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java index 0dc8b36a0..ef659be33 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/AtomicReshaper.java @@ -146,6 +146,12 @@ public String getErrorMsg() { return "Error adding ProdigyTech Atomic Reshaper Recipe"; } + @Override + protected int getMaxItemInput() { + // The recipe correctly requires an increased amount of input items, but only consumes 1 + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, Integer.MAX_VALUE); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java index 4952ff632..3535dcc46 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/ExplosionFurnaceAdditives.java @@ -1,9 +1,11 @@ package com.cleanroommc.groovyscript.compat.mods.prodigytech; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.ItemsIngredient; import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; @@ -33,6 +35,13 @@ private void remove(EFAdditiveRecipe recipe) { @MethodDescription(example = @Example("item('minecraft:cobblestone'), 50"), type = MethodDescription.Type.ADDITION) public void addExplosive(IIngredient explosive, int power) { + if (IngredientHelper.overMaxSize(explosive, 1)) { + GroovyLog.msg("Error adding Explosion Furnace Explosive").error() + .add("Expected input stack size of 1") + .post(); + return; + } + EFAdditiveRecipe recipe = new EFAdditiveExplosive(explosive, power); add(recipe); } @@ -51,13 +60,19 @@ public boolean removeExplosive(IIngredient explosive) { @MethodDescription(priority = 2000, example = @Example(commented = true)) public void removeAllExplosives() { - ExplosionFurnaceManager.EXPLOSIVES.getAllContent().forEach(r -> - addBackup(new EFAdditiveExplosive(new ItemsIngredient(r.getMatchingStacks()), r.getPower()))); + ExplosionFurnaceManager.EXPLOSIVES.getAllContent().forEach(r -> addBackup(new EFAdditiveExplosive(new ItemsIngredient(r.getMatchingStacks()), r.getPower()))); ExplosionFurnaceManager.removeAllExplosives(); } @MethodDescription(example = @Example("item('minecraft:stone'), 50"), type = MethodDescription.Type.ADDITION) public void addDampener(IIngredient dampener, int power) { + if (IngredientHelper.overMaxSize(dampener, 1)) { + GroovyLog.msg("Error adding Explosion Furnace Dampener").error() + .add("Expected input stack size of 1") + .post(); + return; + } + EFAdditiveRecipe recipe = new EFAdditiveDampener(dampener, power); add(recipe); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java index e792686a4..acc1c81a2 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java @@ -1,10 +1,12 @@ package com.cleanroommc.groovyscript.compat.mods.prodigytech; +import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.api.documentation.annotations.Example; import com.cleanroommc.groovyscript.api.documentation.annotations.MethodDescription; import com.cleanroommc.groovyscript.api.documentation.annotations.RegistryDescription; import com.cleanroommc.groovyscript.helper.SimpleObjectStream; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.ItemsIngredient; import com.cleanroommc.groovyscript.helper.ingredient.OreDictIngredient; import com.cleanroommc.groovyscript.registry.VirtualizedRegistry; @@ -48,6 +50,14 @@ private boolean removeRecipeBase(IIngredient x) { @MethodDescription(example = @Example("item('minecraft:diamond')"), type = MethodDescription.Type.ADDITION) public void add(IIngredient x) { + if (IngredientHelper.overMaxSize(x, 1)) { + // PT modifies the recipe to only consume 1 item + GroovyLog.msg("Error adding Primordialis Reactor fuel").error() + .add("Expected input stack size of 1") + .post(); + return; + } + addScripted(x); addRecipeBase(x); } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java index 60bc2b470..9cae6add8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandler.java @@ -40,6 +40,12 @@ public RecipeBuilder time(int time) { return this; } + @Override + protected int getMaxItemInput() { + // PT modifies the recipe to only consume 1 item + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java index 830b3357a..9931036b6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/SimpleRecipeHandlerSecondaryOutput.java @@ -48,6 +48,12 @@ public SimpleRecipeHandlerSecondaryOutput.RecipeBuilder secondaryChance(float se return this; } + @Override + protected int getMaxItemInput() { + // PT modifies the recipe to only consume 1 item + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 2); 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 d795757aa..d44c6fa77 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 @@ -130,6 +130,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Anvil Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 eb716e512..810232082 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 @@ -72,6 +72,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Barrel Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each slot + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 4, 4, 0, 0); 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 08d782353..03380321a 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 @@ -82,6 +82,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Campfire Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each slot + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 cd33f5876..cb587dc36 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 @@ -78,6 +78,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Chopping Block Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 96c0817cf..ef26472c2 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 @@ -84,6 +84,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Compost Bin Recipe"; } + @Override + protected int getMaxItemInput() { + // The composting bin won't accept any item that has a stack size of more than 1 + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 2290dbb60..eb626fe7e 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 @@ -83,6 +83,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Crude Drying Rack Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 1d1d5f10f..24fba6e76 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 @@ -83,6 +83,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Drying Rack Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each slot + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 d0cb45152..89ead0c33 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 @@ -116,6 +116,11 @@ public String getErrorMsg() { return "Error adding Pyrotech Pit Kiln Recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 0cc25e490..fd742bc58 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 @@ -94,6 +94,11 @@ public String getErrorMsg() { return "Error adding Pyrotech Soaking Pot Recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); 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 80f33009c..101be6bd6 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 @@ -92,6 +92,12 @@ public String getErrorMsg() { return "Error adding Pyrotech Tanning Rack Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/FeyCrafter.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/FeyCrafter.java index 60d1cc531..39b4995ea 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/FeyCrafter.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/FeyCrafter.java @@ -111,6 +111,11 @@ public String getRecipeNamePrefix() { return "groovyscript_fey_crafter_"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java index 4daa27caa..8fb57f9c7 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Mortar.java @@ -242,6 +242,12 @@ public String getRecipeNamePrefix() { return "groovyscript_mortar_recipe_"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each slot + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java index 31eb421c0..a7f8b11c8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Pyre.java @@ -130,6 +130,12 @@ public String getRecipeNamePrefix() { return "groovyscript_pyre_recipe_"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each slot + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateName(); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java index 49fd32060..1a979e63b 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/roots/Rituals.java @@ -138,6 +138,12 @@ public String getErrorMsg() { return "Error creating Roots Ritual Recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each slot + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 5, 5, 0, 0); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java index 8314333d6..386e44963 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/Alchemy.java @@ -121,6 +121,11 @@ public String getErrorMsg() { return "Error adding Rustic Alchemy recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, advanced ? 3 : 2, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java index fdced5aac..d18ee789d 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/rustic/CrushingTub.java @@ -70,6 +70,11 @@ public String getErrorMsg() { return "Error adding Rustic Crushing Tub recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 0); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java index 745440c9b..e2a844294 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/Crucible.java @@ -186,6 +186,7 @@ public String getErrorMsg() { public void validate(GroovyLog.Msg msg) { validateItems(msg, 0, 0, 1, 1); msg.add(IngredientHelper.isEmpty(catalyst), () -> "Catalyst must not be empty"); + msg.add(IngredientHelper.overMaxSize(catalyst, 1), () -> "Catalyst amount must be 1"); msg.add(aspects.size() == 0, () -> "Aspects must not be empty"); if (researchKey == null) researchKey = ""; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java index 505e49db6..37fd11258 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/thaumcraft/InfusionCrafting.java @@ -196,10 +196,18 @@ public String getErrorMsg() { return "Error adding Thaumcraft Infusion Crafting recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed in each pedestal + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 100, 1, 1); msg.add(IngredientHelper.isEmpty(mainInput), () -> "Main Input must not be empty"); + // More than 1 item cannot be placed + msg.add(IngredientHelper.overMaxSize(mainInput, 1), () -> "Main input amount must be 1"); if (researchKey == null) { researchKey = ""; } diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java index 17bcb5831..8f5a7d3aa 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingBasin.java @@ -119,6 +119,12 @@ public String getErrorMsg() { return "Error adding Tinkers Construct Casting Basin recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateFluids(msg, 1, 1, 0, 0); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java index 2116ded90..157d80a2e 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/CastingTable.java @@ -118,6 +118,12 @@ public String getErrorMsg() { return "Error adding Tinkers Construct Casting Table recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateFluids(msg, 1, 1, 0, 0); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java index 078989453..d69f7b8e8 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/Drying.java @@ -99,6 +99,12 @@ public String getErrorMsg() { return "Error adding Tinkers Construct Drying recipe"; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 1, 1); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java index 400fad33e..f146c978a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/tinkersconstruct/recipe/MeltingRecipeBuilder.java @@ -54,6 +54,12 @@ public String getErrorMsg() { return "Error adding " + recipeName; } + @Override + protected int getMaxItemInput() { + // More than 1 item cannot be placed + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, 1, 0, 0); diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java index b0e348449..ca29b1646 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/mods/woot/StygianIronAnvil.java @@ -106,6 +106,11 @@ public String getErrorMsg() { return "Error adding Woot Stygian Iron Anvil recipe"; } + @Override + protected int getMaxItemInput() { + return 1; + } + @Override public void validate(GroovyLog.Msg msg) { // Note: JEI can only display 6 inputs, but there doesnt appear to be a limit for the actual recipe @@ -113,6 +118,8 @@ public void validate(GroovyLog.Msg msg) { validateItems(msg, 1, Integer.MAX_VALUE, 1, 1); validateFluids(msg); msg.add(IngredientHelper.isEmpty(base), "base must be defined"); + // More than 1 base cannot be placed + msg.add(IngredientHelper.overMaxSize(base, 1), "base must have a stack size of 1"); } @Override diff --git a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java index 3ce4aeb92..347f5d925 100644 --- a/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java +++ b/src/main/java/com/cleanroommc/groovyscript/compat/vanilla/Furnace.java @@ -29,6 +29,7 @@ public void add(IIngredient input, ItemStack output, float exp) { if (GroovyLog.msg("Error adding Minecraft Furnace recipe") .add(IngredientHelper.isEmpty(input), () -> "Input must not be empty") .add(IngredientHelper.isEmpty(output), () -> "Output must not be empty") + .add(IngredientHelper.overMaxSize(input, 1), () -> "Input size must be 1") .error() .postIfNotEmpty()) { return; diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java index d3d789a3b..fa36a9988 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/ingredient/IngredientHelper.java @@ -1,5 +1,6 @@ package com.cleanroommc.groovyscript.helper.ingredient; +import com.cleanroommc.groovyscript.GroovyScriptConfig; import com.cleanroommc.groovyscript.api.IIngredient; import com.cleanroommc.groovyscript.sandbox.expand.LambdaClosure; import groovy.lang.Closure; @@ -86,6 +87,18 @@ public static boolean isEmpty(@Nullable NBTTagCompound nbt) { return nbt == null || nbt.isEmpty(); } + public static boolean overMaxSize(@Nullable IIngredient ingredient, int maxSize) { + return GroovyScriptConfig.compat.checkInputStackCounts && ingredient != null && ingredient.getAmount() > maxSize; + } + + public static boolean overMaxSize(Collection ingredient, int maxSize) { + return ingredient.stream().anyMatch(a -> overMaxSize(a, maxSize)); + } + + public static boolean overMaxSize(@Nullable ItemStack ingredient, int maxSize) { + return GroovyScriptConfig.compat.checkInputStackCounts && ingredient != null && ingredient.getCount() > maxSize; + } + /** * Determines whether the list or all elements in the list are considered empty * diff --git a/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java index e20845750..403b9a6c6 100644 --- a/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java @@ -1,12 +1,14 @@ package com.cleanroommc.groovyscript.helper.recipe; import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.GroovyScriptConfig; 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.Property; import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; import com.cleanroommc.groovyscript.helper.ingredient.FluidStackList; +import com.cleanroommc.groovyscript.helper.ingredient.IngredientHelper; import com.cleanroommc.groovyscript.helper.ingredient.IngredientList; import com.cleanroommc.groovyscript.helper.ingredient.ItemStackList; import net.minecraft.item.ItemStack; @@ -162,12 +164,23 @@ public void validateFluids(GroovyLog.Msg msg, int minFluidInput, int maxFluidInp validateCustom(msg, fluidOutput, minFluidOutput, maxFluidOutput, "fluid output"); } + @GroovyBlacklist + protected int getMaxItemInput() { + return Integer.MAX_VALUE; + } + @GroovyBlacklist public void validateItems(GroovyLog.Msg msg, int minInput, int maxInput, int minOutput, int maxOutput) { input.trim(); output.trim(); validateCustom(msg, input, minInput, maxInput, "item input"); validateCustom(msg, output, minOutput, maxOutput, "item output"); + if (GroovyScriptConfig.compat.checkInputStackCounts) { + int maxAmountAllowed = getMaxItemInput(); + for (IIngredient ingredient : input) { + msg.add(IngredientHelper.overMaxSize(ingredient, maxAmountAllowed), "Expected stack size of {} for {}, got {}", maxAmountAllowed, ingredient, ingredient.getAmount()); + } + } } @GroovyBlacklist diff --git a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java index 294e8e289..03531d49a 100644 --- a/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java +++ b/src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java @@ -1,9 +1,11 @@ package com.cleanroommc.groovyscript.registry; import com.cleanroommc.groovyscript.GroovyScript; +import com.cleanroommc.groovyscript.GroovyScriptConfig; import com.cleanroommc.groovyscript.api.GroovyBlacklist; import com.cleanroommc.groovyscript.api.GroovyLog; import com.cleanroommc.groovyscript.api.IIngredient; +import com.cleanroommc.groovyscript.api.IResourceStack; import com.cleanroommc.groovyscript.api.documentation.annotations.Comp; import com.cleanroommc.groovyscript.api.documentation.annotations.Property; import com.cleanroommc.groovyscript.api.documentation.annotations.RecipeBuilderMethodDescription; @@ -168,6 +170,8 @@ protected T validateShape(GroovyLog.Msg msg, List errors, String[] k } int finalRowWidth = rowWidth; msg.add(rowWidth > width, () -> "At least one row has a row length of " + finalRowWidth + ", but maximum is " + width); + checkStackSizes(msg, ingredients); + if (checkedChars.isEmpty()) { msg.add("Matrix must not be empty"); } else if (checkedChars.size() == 1) { @@ -180,6 +184,14 @@ protected T validateShape(GroovyLog.Msg msg, List errors, String[] k return recipeCreator.createRecipe(rowWidth, keyBasedMatrix.length, ingredients); } + protected void checkStackSizes(GroovyLog.Msg msg, Collection ingredients) { + if (GroovyScriptConfig.compat.checkInputStackCounts) { + for (IIngredient ingredient : ingredients) { + msg.add(IngredientHelper.overMaxSize(ingredient, 1), "Expected stack size 1 for {}, got {}", ingredient.toString(), ingredient.getAmount()); + } + } + } + @GroovyBlacklist @Nullable protected T validateShape(GroovyLog.Msg msg, List> ingredientMatrix, IRecipeCreator recipeCreator) { diff --git a/src/main/resources/assets/groovyscript/lang/en_us.lang b/src/main/resources/assets/groovyscript/lang/en_us.lang index a8d1c920e..9168c01dc 100644 --- a/src/main/resources/assets/groovyscript/lang/en_us.lang +++ b/src/main/resources/assets/groovyscript/lang/en_us.lang @@ -596,6 +596,7 @@ groovyscript.wiki.bloodmagic.sacrificial.value.value=Sets how much Life Essence groovyscript.wiki.bloodmagic.tartaric_forge.title=Tartaric Forge groovyscript.wiki.bloodmagic.tartaric_forge.description=Converts up to 4 input items into an output itemstack, requiring a Tartaric gem with a minimum amount of souls, and consuming some. +groovyscript.wiki.bloodmagic.tartaric_forge.note=Tartaric Forge can properly execute recipes that only have 1 input, but they're bugged in JEI. If a recipe only has 1 input, it will be duplicated in the bottom-right slot. This bug is purely visual, and the recipe still works as intended. groovyscript.wiki.bloodmagic.tartaric_forge.add=Adds recipes in the format `input`, `output`, `minimumSouls`, `soulDrain` groovyscript.wiki.bloodmagic.tartaric_forge.minimumSouls.value=Sets how much Demonic Will is required in the Tartaric Gem to start the craft groovyscript.wiki.bloodmagic.tartaric_forge.soulDrain.value=Sets how much Demonic Will is drained from the Tartaric Gem when the craft is completed @@ -893,6 +894,7 @@ groovyscript.wiki.enderio.fluid_fuel.remove=Removes recipes matching the target groovyscript.wiki.enderio.sag_mill.title=Sag Mill groovyscript.wiki.enderio.sag_mill.description=Convert an input itemstack into up to 4 output itemstacks with chances, using energy. Output can be boosted by Grinding Balls based on set bonusType. Can be set to require at least SIMPLE, NORMAL, or ENHANCED tiers, or to IGNORE the tier. SIMPLE and IGNORE are effectively the same. +groovyscript.wiki.enderio.sag_mill.note=EnderIO executes recipes using both its input and its grinding ball slot as inputs, which means it can consume grinding balls as input. This means an item that can be used as an input should not be able to also be used as a grinding ball. groovyscript.wiki.enderio.sag_mill.chances.value=Sets the chance the given output of each output slot groovyscript.wiki.enderio.sag_mill.bonusType.value=Sets the type of bonus a Grinding Ball can apply