-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constraints on input stack size for recipe builder #222
Constraints on input stack size for recipe builder #222
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in a number of places, GroovyScriptConfig
is imported but unused. imports should be cleaned up.
...ain/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/AtomicReconstructor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/astralsorcery/Lightwell.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/registry/AbstractCraftingRecipeBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/prodigytech/PrimordialisReactor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/betterwithmods/HopperFilters.java
Outdated
Show resolved
Hide resolved
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noted a few more places to apply previously commented changes
src/main/java/com/cleanroommc/groovyscript/compat/mods/appliedenergistics2/CannonAmmo.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/aetherlegacy/FreezerFuel.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/chisel/Carving.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/ThermionicFabricator.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/forestry/Carpenter.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/Vat.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SliceNSplice.java
Outdated
Show resolved
Hide resolved
src/main/java/com/cleanroommc/groovyscript/compat/mods/actuallyadditions/Empowerer.java
Show resolved
Hide resolved
Something like this, maybe |
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about adding methods to directly add to the msg
and calling those?
additionally, IResourceStack
should probably be used here instead of IIngredient
, since IResourceStack
is the interface that has getAmount
.
public static void overMaxSize(GroovyLog.Msg msg, Collection<IIngredient> ingredients, int maxSize) {
if (!GroovyScriptConfig.compat.checkInputStackCounts) return;
for (var ingredient : ingredients) {
msg.add(IngredientHelper.overMaxSize(ingredient, maxSize), "Expected stack size of {} for {}, got {}", maxSize, ingredient, ingredient.getAmount());
}
}
public static void overMaxSize(GroovyLog.Msg msg, IIngredient ingredient, int maxSize) {
if (!GroovyScriptConfig.compat.checkInputStackCounts) return;
msg.add(IngredientHelper.overMaxSize(ingredient, maxSize), "Expected stack size of {} for {}, got {}", maxSize, ingredient, ingredient.getAmount());
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
# Conflicts: # src/main/java/com/cleanroommc/groovyscript/GroovyScriptConfig.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/bloodmagic/TartaricForge.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMill.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/enderio/SagMillGrinding.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/BioReactor.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/Extractor.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreRaw.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/OreSieve.java # src/main/java/com/cleanroommc/groovyscript/compat/mods/industrialforegoing/ProteinReactor.java # src/main/java/com/cleanroommc/groovyscript/helper/recipe/AbstractRecipeBuilder.java
# Conflicts: # src/main/java/com/cleanroommc/groovyscript/compat/mods/ModSupport.java
This pull request adds error messages that happen when a recipe becomes invalid/gives unexpected results with ItemStack input of size > 1. It turns out that the absolute majority of mods don't care about the input stack size, which can give results ranging from "recipe is cheaper than intended" to "this cannot be executed at all". I went over nearly every compat in the mod (the exceptions are Mekanism, Thermal Expansion, IC2 exp/c, and Tinker's Complement, I believe the 4 first ones do properly support input stack sizes), nearly every machine in that mod, and checked whether that machine supports multi-inputs. This behavior can be disabled in the config if the pack developer has a mixin to fix the offending mod or such.
I've also found some other bugs/weird behaviors while working on this branch, listed on the bottom of the list. Some with GS, some with other mods (LMAO).
The following machines have multi-input recipes by default. Not all of them were tested:
The following machines don't have them by default but support them:
The following machines inhibit weird behavior when multi-input is provided. I've opted to "ban" that use case:
The following machines either ignore the input stack size or fail to execute their recipe. Note that these recipes show up in JEI as though they worked. I banned these:
The following mods were untested because they didn't exist in GS when I started the branch 😔
Here's the bugs I found:
⚰️ do with this as you will