Skip to content

Commit

Permalink
fix: Remove upper limit because technically it could be 512 and there…
Browse files Browse the repository at this point in the history
…'s no real point checking it as viciously as the crafting table
  • Loading branch information
BlayTheNinth committed Dec 30, 2023
1 parent 445ed5b commit a43570e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ public BlenderRecipe fromJson(ResourceLocation id, JsonObject jsonObject) {
final var ingredients = itemsFromJson(GsonHelper.getAsJsonArray(jsonObject, "ingredients"));
if (ingredients.isEmpty()) {
throw new JsonParseException("No ingredients for blender recipe");
} else if (ingredients.size() > 9) {
throw new JsonParseException("Too many ingredients for blender recipe");
} else {
final var resultItem = ShapedRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(jsonObject, "result"));
final var weight = Weight.of(GsonHelper.getAsInt(jsonObject, "weight", 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ public PrinterRecipe(ResourceLocation id, ItemStack resultItem, NonNullList<Ingr
public boolean matches(Container container, Level level) {
final var stackedContents = new StackedContents();
int foundInputs = 0;
final var used = new int[container.getContainerSize()];
for (int i = 0; i < ingredients.size(); i++) {
final var ingredient = ingredients.get(i);
for (int j = 0; j < container.getContainerSize(); j++) {
final var itemStack = container.getItem(j);
if (ingredient.test(itemStack)) {
if (ingredient.test(itemStack) && used[j] < itemStack.getCount()) { // TODO this should keep track of what's already been used, otherwise it will "reuse" inputs
foundInputs++;
stackedContents.accountStack(itemStack, 1);
used[j]++;
break;
}
}
Expand Down Expand Up @@ -95,8 +97,6 @@ public PrinterRecipe fromJson(ResourceLocation id, JsonObject jsonObject) {
final var ingredients = itemsFromJson(GsonHelper.getAsJsonArray(jsonObject, "ingredients"));
if (ingredients.isEmpty()) {
throw new JsonParseException("No ingredients for printer recipe");
} else if (ingredients.size() > 9) {
throw new JsonParseException("Too many ingredients for printer recipe");
} else {
final var resultItem = ShapedRecipe.itemStackFromJson(GsonHelper.getAsJsonObject(jsonObject, "result"));
final var weight = Weight.of(GsonHelper.getAsInt(jsonObject, "weight", 1));
Expand Down

0 comments on commit a43570e

Please sign in to comment.