Skip to content

Commit

Permalink
📦 Fixed recipe type registration helper
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCrayfish committed Jan 12, 2024
1 parent dc3af4e commit 9c140fa
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.enchantment.Enchantment;
Expand Down Expand Up @@ -176,9 +177,14 @@ public static <T extends Potion> RegistryEntry<T> potion(ResourceLocation id, Su
return new RegistryEntry<>(BuiltInRegistries.POTION, id, supplier);
}

public static <T extends RecipeType<?>> RegistryEntry<T> recipeType(ResourceLocation id, Supplier<T> supplier)
public static <T extends Recipe<?>> RegistryEntry<RecipeType<?>> recipeType(ResourceLocation id)
{
return new RegistryEntry<>(BuiltInRegistries.RECIPE_TYPE, id, supplier);
return new RegistryEntry<>(BuiltInRegistries.RECIPE_TYPE, id, () -> new RecipeType<T>() {
@Override
public String toString() {
return id.getPath();
}
});
}

public static <T extends RecipeSerializer<?>> RegistryEntry<T> recipeSerializer(ResourceLocation id, Supplier<T> supplier)
Expand Down

0 comments on commit 9c140fa

Please sign in to comment.