Skip to content

Commit

Permalink
Fix recipes not working
Browse files Browse the repository at this point in the history
Apparently it was returning something incorrect
  • Loading branch information
QPCrummer committed May 17, 2024
1 parent 88d829e commit cf470e2
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,8 @@ public <C extends Inventory, T extends Recipe<C>> Optional<RecipeEntry<T>> getFi
}

@Inject(method = "getFirstMatch(Lnet/minecraft/recipe/RecipeType;Lnet/minecraft/inventory/Inventory;Lnet/minecraft/world/World;Lnet/minecraft/util/Identifier;)Ljava/util/Optional;", at = @At(value = "INVOKE", target = "Lnet/minecraft/recipe/RecipeManager;getAllOfType(Lnet/minecraft/recipe/RecipeType;)Ljava/util/Collection;", shift = At.Shift.BEFORE), cancellable = true)
private <C extends Inventory, T extends Recipe<C>> void injectToRemoveStream(RecipeType<T> type, C inventory, World world, Identifier id, CallbackInfoReturnable<Optional<Pair<Identifier, RecipeEntry<T>>>> cir) {
for (RecipeEntry<T> entry : this.getAllOfType(type)) {
if (entry.value().matches(inventory, world)) {
cir.setReturnValue(Optional.of(Pair.of(entry.id(), entry)));
}
}
cir.setReturnValue(Optional.empty());
private <C extends Inventory, T extends Recipe<C>> void injectToRemoveStream(RecipeType<T> type, C inventory, World world, Identifier id, CallbackInfoReturnable<Optional<RecipeEntry<T>>> cir) {
cir.setReturnValue(getFirstMatch(type, inventory, world));
}

/**
Expand Down

0 comments on commit cf470e2

Please sign in to comment.