Skip to content

Commit

Permalink
feat(1.21.2): Add registerSlotDisplayType
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Oct 18, 2024
1 parent ce67cb9 commit d0d8b87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.display.RecipeDisplay;
import net.minecraft.world.item.crafting.display.SlotDisplay;

import java.util.function.Supplier;

public interface BalmRecipes {
<T extends Recipe<?>> DeferredObject<RecipeType<T>> registerRecipeType(Supplier<RecipeType<T>> typeSupplier, Supplier<RecipeSerializer<T>> serializerSupplier, ResourceLocation identifier);

<T extends RecipeDisplay.Type<?>> DeferredObject<T> registerRecipeDisplayType(Supplier<T> supplier, ResourceLocation identifier);

<T extends SlotDisplay.Type<?>> DeferredObject<T> registerSlotDisplayType(Supplier<T> supplier, ResourceLocation identifier);

DeferredObject<RecipeBookCategory> registerRecipeBookCategory(Supplier<RecipeBookCategory> supplier, ResourceLocation identifier);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.item.crafting.display.RecipeDisplay;
import net.minecraft.world.item.crafting.display.SlotDisplay;

import java.util.function.Supplier;

Expand All @@ -27,11 +28,17 @@ public <T extends Recipe<?>> DeferredObject<RecipeType<T>> registerRecipeType(Su

@Override
public DeferredObject<RecipeBookCategory> registerRecipeBookCategory(Supplier<RecipeBookCategory> supplier, ResourceLocation identifier) {
return new DeferredObject<>(identifier, () -> Registry.register(BuiltInRegistries.RECIPE_BOOK_CATEGORY, identifier, supplier.get())).resolveImmediately();
return new DeferredObject<>(identifier,
() -> Registry.register(BuiltInRegistries.RECIPE_BOOK_CATEGORY, identifier, supplier.get())).resolveImmediately();
}

@Override
public <T extends RecipeDisplay.Type<?>> DeferredObject<T> registerRecipeDisplayType(Supplier<T> supplier, ResourceLocation identifier) {
return new DeferredObject<>(identifier, () -> Registry.register(BuiltInRegistries.RECIPE_DISPLAY, identifier, supplier.get())).resolveImmediately();
}

@Override
public <T extends SlotDisplay.Type<?>> DeferredObject<T> registerSlotDisplayType(Supplier<T> supplier, ResourceLocation identifier) {
return new DeferredObject<>(identifier, () -> Registry.register(BuiltInRegistries.SLOT_DISPLAY, identifier, supplier.get())).resolveImmediately();
}
}

0 comments on commit d0d8b87

Please sign in to comment.