diff --git a/build.gradle b/build.gradle index 33808d7f..001d6d2f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'fabric-loom' version '1.7-SNAPSHOT' apply(false) - id 'net.neoforged.moddev' version '0.1.110' apply(false) + id 'net.neoforged.moddev' version '1.0.21' apply(false) id 'net.darkhax.curseforgegradle' version '1.1.18' apply(false) id "com.modrinth.minotaur" version "2.+" apply(false) } diff --git a/common/src/main/java/net/blay09/mods/balm/api/event/client/RecipesUpdatedEvent.java b/common/src/main/java/net/blay09/mods/balm/api/event/client/RecipesUpdatedEvent.java index 52b71dc8..1d3ce621 100644 --- a/common/src/main/java/net/blay09/mods/balm/api/event/client/RecipesUpdatedEvent.java +++ b/common/src/main/java/net/blay09/mods/balm/api/event/client/RecipesUpdatedEvent.java @@ -3,6 +3,7 @@ import net.blay09.mods.balm.api.event.BalmEvent; import net.minecraft.client.multiplayer.ClientRecipeContainer; +@Deprecated public class RecipesUpdatedEvent extends BalmEvent { private final ClientRecipeContainer clientRecipeContainer; diff --git a/fabric/src/main/java/net/blay09/mods/balm/fabric/block/FabricBalmBlocks.java b/fabric/src/main/java/net/blay09/mods/balm/fabric/block/FabricBalmBlocks.java index 3f0de172..36c644be 100644 --- a/fabric/src/main/java/net/blay09/mods/balm/fabric/block/FabricBalmBlocks.java +++ b/fabric/src/main/java/net/blay09/mods/balm/fabric/block/FabricBalmBlocks.java @@ -26,7 +26,7 @@ public DeferredObject registerBlock(Function sup @Override public DeferredObject registerBlockItem(Function supplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { - return Balm.getItems().registerItem(() -> supplier.apply(identifier), identifier, creativeTab); + return Balm.getItems().registerItem(supplier::apply, identifier, creativeTab); } @Override diff --git a/fabric/src/main/java/net/blay09/mods/balm/mixin/ClientPacketListenerMixin.java b/fabric/src/main/java/net/blay09/mods/balm/mixin/ClientPacketListenerMixin.java deleted file mode 100644 index 98cf5f26..00000000 --- a/fabric/src/main/java/net/blay09/mods/balm/mixin/ClientPacketListenerMixin.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.blay09.mods.balm.mixin; - -import net.blay09.mods.balm.api.Balm; -import net.blay09.mods.balm.api.event.client.RecipesUpdatedEvent; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientPacketListener; -import net.minecraft.client.multiplayer.ClientRecipeContainer; -import net.minecraft.core.RegistryAccess; -import net.minecraft.network.protocol.game.ClientboundUpdateRecipesPacket; -import net.minecraft.world.item.crafting.RecipeManager; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ClientPacketListener.class) -public class ClientPacketListenerMixin { - - @Shadow - private ClientRecipeContainer recipes; - - @Inject(method = "handleUpdateRecipes(Lnet/minecraft/network/protocol/game/ClientboundUpdateRecipesPacket;)V", at = @At("RETURN")) - void handleUpdateRecipes(ClientboundUpdateRecipesPacket packet, CallbackInfo callbackInfo) { - Balm.getEvents().fireEvent(new RecipesUpdatedEvent(recipes)); - } -} diff --git a/fabric/src/main/resources/balm.fabric.mixins.json b/fabric/src/main/resources/balm.fabric.mixins.json index 8d93e10a..9cf01904 100644 --- a/fabric/src/main/resources/balm.fabric.mixins.json +++ b/fabric/src/main/resources/balm.fabric.mixins.json @@ -29,7 +29,6 @@ "AbstractContainerScreenMixin", "ChatComponentMixin", "CheckboxAccessor", - "ClientPacketListenerMixin", "EntityModelSetAccessor", "EntityModelSetMixin", "GuiMixin", diff --git a/gradle.properties b/gradle.properties index b266f6e2..13a43360 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,17 +19,17 @@ modrinth_release_type = release modrinth_project_id = MBAkmtvl # Minecraft -minecraft_version = 1.21.2-pre1 -minimum_minecraft_version = 1.21 -minecraft_versions = 1.21,1.21.1,1.21.2-pre1 -minecraft_version_range = [1.21,) +minecraft_version = 1.21.2 +minimum_minecraft_version = 1.21.2 +minecraft_versions = 1.21,1.21.1,1.21.2 +minecraft_version_range = [1.21.2,) pack_format_number = 18 java_version = 21 # NeoForm and Parchment -neo_form_version=1.21.2-pre1-20241008.174159 +neo_form_version=1.21.2-20241022.151510 parchment_minecraft=1.21 -parchment_version=2024.06.23 +parchment_version=2024.07.28 # Forge forge_version = 52.0.18 @@ -38,16 +38,16 @@ forge_loader_version_range = [51,) # NeoForge neoforge_snapshot_url= -neoforge_version = 21.1.8 -neoforge_version_range = [21.0.82-beta,) +neoforge_version = 21.2.0-beta +neoforge_version_range = [21.2.0-beta,) neoforge_loader_version_range = [1,) # Fabric -fabric_version = 0.105.3+1.21.2 -fabric_loader_version = 0.16.5 +fabric_version = 0.106.1+1.21.2 +fabric_loader_version = 0.16.7 # Dependencies -kuma_version = [21.0,22) +kuma_version = [21.2,22) jei_minecraft_version = 1.19.2 jei_version = 11.4.0.288 rei_version = 10.0.581 diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmHooks.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmHooks.java index dc5af2ff..67c5a44d 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmHooks.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmHooks.java @@ -14,12 +14,10 @@ import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; -import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; import net.minecraft.world.phys.BlockHitResult; -import net.neoforged.neoforge.common.EffectCures; import net.neoforged.neoforge.common.ItemAbilities; import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.util.FakePlayer; @@ -84,11 +82,7 @@ public CompoundTag getPersistentData(Entity entity) { @Override public void curePotionEffects(LivingEntity entity, ItemStack curativeItem) { - if (curativeItem.getItem() == Items.MILK_BUCKET) { - entity.removeEffectsCuredBy(EffectCures.MILK); - } else if (curativeItem.getItem() == Items.HONEY_BOTTLE) { - entity.removeEffectsCuredBy(EffectCures.HONEY); - } + entity.removeAllEffects(); } @Override @@ -98,7 +92,7 @@ public boolean isFakePlayer(Player player) { @Override public ItemStack getCraftingRemainingItem(ItemStack itemStack) { - return itemStack.getCraftingRemainingItem(); + return itemStack.getCraftingRemainder(); } @Override @@ -112,8 +106,8 @@ public boolean canItemsStack(ItemStack first, ItemStack second) { } @Override - public int getBurnTime(ItemStack itemStack) { - return itemStack.getBurnTime(RecipeType.SMELTING); + public int getBurnTime(Level level, ItemStack itemStack) { + return level.fuelValues().burnDuration(itemStack); } @Override diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRegistries.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRegistries.java index a18fd51c..273b0ed7 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRegistries.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRegistries.java @@ -49,22 +49,22 @@ public Collection getItemKeys() { @Override public Item getItem(ResourceLocation key) { - return BuiltInRegistries.ITEM.get(key); + return BuiltInRegistries.ITEM.getValue(key); } @Override public Block getBlock(ResourceLocation key) { - return BuiltInRegistries.BLOCK.get(key); + return BuiltInRegistries.BLOCK.getValue(key); } @Override public Fluid getFluid(ResourceLocation key) { - return BuiltInRegistries.FLUID.get(key); + return BuiltInRegistries.FLUID.getValue(key); } @Override public MobEffect getMobEffect(ResourceLocation key) { - return BuiltInRegistries.MOB_EFFECT.get(key); + return BuiltInRegistries.MOB_EFFECT.getValue(key); } @Override @@ -84,6 +84,6 @@ public Fluid getMilkFluid() { @Override public Attribute getAttribute(ResourceLocation key) { - return BuiltInRegistries.ATTRIBUTE.get(key); + return BuiltInRegistries.ATTRIBUTE.getValue(key); } } diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRuntime.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRuntime.java index cc9718de..bc7080ae 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRuntime.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/NeoForgeBalmRuntime.java @@ -38,6 +38,7 @@ import net.blay09.mods.balm.neoforge.sound.NeoForgeBalmSounds; import net.blay09.mods.balm.neoforge.stats.NeoForgeBalmStats; import net.blay09.mods.balm.neoforge.world.NeoForgeBalmWorldGen; +import net.minecraft.core.HolderLookup; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.packs.resources.PreparableReloadListener; import net.minecraft.server.packs.resources.ResourceManager; @@ -52,6 +53,7 @@ import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; +import java.util.function.Function; public class NeoForgeBalmRuntime implements BalmRuntime { private final BalmWorldGen worldGen = new NeoForgeBalmWorldGen(); @@ -222,8 +224,8 @@ private void initializeAddons() { } @Override - public void addServerReloadListener(ResourceLocation identifier, PreparableReloadListener reloadListener) { - NeoForge.EVENT_BUS.addListener((AddReloadListenerEvent event) -> event.addListener(reloadListener)); + public void addServerReloadListener(ResourceLocation identifier, Function reloadListener) { + NeoForge.EVENT_BUS.addListener((AddReloadListenerEvent event) -> event.addListener(reloadListener.apply(event.getRegistryAccess()))); } @Override diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/NeoForgeBalmBlocks.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/NeoForgeBalmBlocks.java index fea134c8..73ac06d6 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/NeoForgeBalmBlocks.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/NeoForgeBalmBlocks.java @@ -9,32 +9,28 @@ import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.state.BlockBehaviour; import org.jetbrains.annotations.Nullable; -import java.util.function.Supplier; +import java.util.function.BiFunction; +import java.util.function.Function; public class NeoForgeBalmBlocks implements BalmBlocks { - @Override - public BlockBehaviour.Properties blockProperties() { - return BlockBehaviour.Properties.of(); - } @Override - public DeferredObject registerBlock(Supplier supplier, ResourceLocation identifier) { + public DeferredObject registerBlock(Function supplier, ResourceLocation identifier) { final var register = DeferredRegisters.get(Registries.BLOCK, identifier.getNamespace()); final var registryObject = register.register(identifier.getPath(), supplier); return new DeferredObject<>(identifier, registryObject, registryObject::isBound); } @Override - public DeferredObject registerBlockItem(Supplier supplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { - return Balm.getItems().registerItem(supplier::get, identifier, creativeTab); + public DeferredObject registerBlockItem(Function supplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { + return Balm.getItems().registerItem(supplier::apply, identifier, creativeTab); } @Override - public void register(Supplier blockSupplier, Supplier blockItemSupplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { - registerBlock(blockSupplier, identifier); - registerBlockItem(blockItemSupplier, identifier, creativeTab); + public void register(Function blockSupplier, BiFunction blockItemSupplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { + final var deferredBlock = registerBlock(blockSupplier, identifier); + registerBlockItem((id) -> blockItemSupplier.apply(deferredBlock.get(), id), identifier, creativeTab); } } diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/entity/NeoForgeBalmBlockEntities.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/entity/NeoForgeBalmBlockEntities.java index 945bbad1..3bdd9a35 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/entity/NeoForgeBalmBlockEntities.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/block/entity/NeoForgeBalmBlockEntities.java @@ -9,7 +9,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; -import net.neoforged.neoforge.registries.DeferredRegister; import java.util.Arrays; import java.util.function.Supplier; @@ -20,7 +19,7 @@ public DeferredObject> registerBlockE final var register = DeferredRegisters.get(Registries.BLOCK_ENTITY_TYPE, identifier.getNamespace()); final var registryObject = register.register(identifier.getPath(), () -> { Block[] resolvedBlocks = blocks.get(); - return BlockEntityType.Builder.of(factory::create, resolvedBlocks).build(null); + return new BlockEntityType<>(factory::create, resolvedBlocks); }); return new DeferredObject<>(identifier, registryObject, registryObject::isBound); } @@ -30,7 +29,7 @@ public DeferredObject> registerBlockE final var register = DeferredRegisters.get(Registries.BLOCK_ENTITY_TYPE, identifier.getNamespace()); final var registryObject = register.register(identifier.getPath(), () -> { Block[] resolvedBlocks = Arrays.stream(blocks).map(DeferredObject::get).toArray(Block[]::new); - return BlockEntityType.Builder.of(factory::create, resolvedBlocks).build(null); + return new BlockEntityType<>(factory::create, resolvedBlocks); }); return new DeferredObject<>(identifier, registryObject, registryObject::isBound); } diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeBalmModels.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeBalmModels.java index bfc8fed8..83eb8b70 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeBalmModels.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeBalmModels.java @@ -46,7 +46,7 @@ public void resolveAndSet(ModelBakery modelBakery, Map loadDynamicModel(ModelResourceLocation identif public BakedModel resolve(ModelBakery bakery, Map modelRegistry, ModelBakery.TextureGetter textureGetter) { final var unbakedModels = new HashMap(); for (final var modelId : models) { - unbakedModels.put(modelId, ((ModelBakeryAccessor) bakery).callGetModel(modelId.id())); + unbakedModels.put(modelId, getUnbakedModelOrMissing(modelId.id())); } return new NeoForgeCachedDynamicModel(bakery, unbakedModels, @@ -186,12 +186,12 @@ public ModelState getModelState(Transformation transformation) { @Override public UnbakedModel getUnbakedModelOrMissing(ResourceLocation location) { - return ((ModelBakeryAccessor) modelBakery).callGetModel(location); + return ((ModelBakeryAccessor) modelBakery).getUnbakedModels().getOrDefault(location, ((ModelBakeryAccessor) modelBakery).getMissingModel()); } @Override public UnbakedModel getUnbakedMissingModel() { - return ((ModelBakeryAccessor) modelBakery).callGetModel(ModelBakery.MISSING_MODEL_LOCATION); + return ((ModelBakeryAccessor) modelBakery).getMissingModel(); } public void register(String modId, IEventBus eventBus) { diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeCachedDynamicModel.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeCachedDynamicModel.java index dcf1c089..0e1f181f 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeCachedDynamicModel.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/client/rendering/NeoForgeCachedDynamicModel.java @@ -38,15 +38,6 @@ public List getItemRenderTypes(ItemStack itemStack, boolean fabulous return renderTypes; } - @Override - public List getRenderTypes(ItemStack itemStack, boolean fabulous) { - List result = getItemRenderTypes(itemStack, fabulous); - if (result.isEmpty()) { - return super.getRenderTypes(itemStack, fabulous); - } - return result; - } - @Override public List getBlockRenderTypes(BlockState state, RandomSource rand) { return renderTypes; diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/entity/NeoForgeBalmEntities.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/entity/NeoForgeBalmEntities.java index ebfff63d..f2caaf14 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/entity/NeoForgeBalmEntities.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/entity/NeoForgeBalmEntities.java @@ -4,6 +4,7 @@ import net.blay09.mods.balm.api.entity.BalmEntities; import net.blay09.mods.balm.neoforge.DeferredRegisters; import net.minecraft.core.registries.Registries; +import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; @@ -38,7 +39,7 @@ public void registerAttributes(EntityAttributeCreationEvent event) { @Override public DeferredObject> registerEntity(ResourceLocation identifier, EntityType.Builder typeBuilder) { final var register = DeferredRegisters.get(Registries.ENTITY_TYPE, identifier.getNamespace()); - final var registryObject = register.register(identifier.getPath(), () -> typeBuilder.build(identifier.toString())); + final var registryObject = register.register(identifier.getPath(), () -> typeBuilder.build(ResourceKey.create(Registries.ENTITY_TYPE, identifier))); return new DeferredObject<>(identifier, registryObject, registryObject::isBound); } @@ -47,7 +48,7 @@ public DeferredObject> registerEntity(Res final var register = DeferredRegisters.get(Registries.ENTITY_TYPE, identifier.getNamespace()); final var registrations = getActiveRegistrations(); final var registryObject = register.register(identifier.getPath(), () -> { - EntityType entityType = typeBuilder.build(identifier.toString()); + EntityType entityType = typeBuilder.build(ResourceKey.create(Registries.ENTITY_TYPE, identifier)); registrations.attributeSuppliers.put(entityType, attributeBuilder.get().build()); return entityType; }); diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/event/NeoForgeBalmClientEvents.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/event/NeoForgeBalmClientEvents.java index 77f13dd6..2e5fa1dd 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/event/NeoForgeBalmClientEvents.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/event/NeoForgeBalmClientEvents.java @@ -266,14 +266,6 @@ public static void registerEvents(NeoForgeBalmEvents events) { }); }); - events.registerEvent(RecipesUpdatedEvent.class, priority -> { - NeoForge.EVENT_BUS.addListener(NeoForgeBalmEvents.toForge(priority), (net.neoforged.neoforge.client.event.RecipesUpdatedEvent orig) -> { - RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess(); // same way that Minecraft does it in the packet handler - final RecipesUpdatedEvent event = new RecipesUpdatedEvent(orig.getRecipeManager(), registryAccess); - events.fireEventHandlers(priority, event); - }); - }); - events.registerEvent(ItemTooltipEvent.class, priority -> { NeoForge.EVENT_BUS.addListener(NeoForgeBalmEvents.toForge(priority), (net.neoforged.neoforge.event.entity.player.ItemTooltipEvent orig) -> { final ItemTooltipEvent event = new ItemTooltipEvent(orig.getItemStack(), orig.getEntity(), orig.getToolTip(), orig.getFlags()); diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/item/NeoForgeBalmItems.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/item/NeoForgeBalmItems.java index 3f8bbabc..7ae36a2c 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/item/NeoForgeBalmItems.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/item/NeoForgeBalmItems.java @@ -4,8 +4,6 @@ import net.blay09.mods.balm.api.DeferredObject; import net.blay09.mods.balm.api.item.BalmItems; import net.blay09.mods.balm.neoforge.DeferredRegisters; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; @@ -18,6 +16,7 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; import java.util.function.Supplier; public class NeoForgeBalmItems implements BalmItems { @@ -44,12 +43,7 @@ public void buildCreativeTabContents(ResourceLocation tabIdentifier, CreativeMod private final Map registrations = new ConcurrentHashMap<>(); @Override - public Item.Properties itemProperties() { - return new Item.Properties(); - } - - @Override - public DeferredObject registerItem(Supplier supplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { + public DeferredObject registerItem(Function supplier, ResourceLocation identifier, @Nullable ResourceLocation creativeTab) { final var register = DeferredRegisters.get(Registries.ITEM, identifier.getNamespace()); final var registryObject = register.register(identifier.getPath(), supplier); if (creativeTab != null) { diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/recipe/NeoForgeBalmRecipes.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/recipe/NeoForgeBalmRecipes.java index 08e8a71e..1dd7662e 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/recipe/NeoForgeBalmRecipes.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/recipe/NeoForgeBalmRecipes.java @@ -6,8 +6,11 @@ import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.crafting.Recipe; +import net.minecraft.world.item.crafting.RecipeBookCategory; 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; @@ -23,4 +26,25 @@ public > DeferredObject> registerRecipeType(Su return new DeferredObject<>(identifier, registryObject, () -> registryObject.isBound() && serializerRegistryObject.isBound()); } + @Override + public > DeferredObject registerRecipeDisplayType(Supplier supplier, ResourceLocation identifier) { + final var register = DeferredRegisters.get(Registries.RECIPE_DISPLAY, identifier.getNamespace()); + final var registryObject = register.register(identifier.getPath(), supplier); + return new DeferredObject<>(identifier, registryObject, registryObject::isBound); + } + + @Override + public > DeferredObject registerSlotDisplayType(Supplier supplier, ResourceLocation identifier) { + final var register = DeferredRegisters.get(Registries.SLOT_DISPLAY, identifier.getNamespace()); + final var registryObject = register.register(identifier.getPath(), supplier); + return new DeferredObject<>(identifier, registryObject, registryObject::isBound); + } + + @Override + public DeferredObject registerRecipeBookCategory(Supplier supplier, ResourceLocation identifier) { + final var register = DeferredRegisters.get(Registries.RECIPE_BOOK_CATEGORY, identifier.getNamespace()); + final var registryObject = register.register(identifier.getPath(), supplier); + return new DeferredObject<>(identifier, registryObject, registryObject::isBound); + } + } diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/world/NeoForgeBalmWorldGen.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/world/NeoForgeBalmWorldGen.java index 1eb6c19a..e63f1c3f 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/world/NeoForgeBalmWorldGen.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/world/NeoForgeBalmWorldGen.java @@ -59,8 +59,8 @@ public void modifyBiome(Holder biome, BiomeModifier.Phase phase, Modifiab if (location != null && biomeModification.getBiomePredicate().test(location, biome)) { Registry placedFeatures = ServerLifecycleHooks.getCurrentServer() .registryAccess() - .registryOrThrow(Registries.PLACED_FEATURE); - placedFeatures.getHolder(biomeModification.getConfiguredFeatureKey()) + .lookupOrThrow(Registries.PLACED_FEATURE); + placedFeatures.get(biomeModification.getConfiguredFeatureKey()) .ifPresent(placedFeature -> builder.getGenerationSettings().addFeature(biomeModification.getStep(), placedFeature)); } } diff --git a/settings.gradle b/settings.gradle index 2c2a69e6..d9e93c35 100644 --- a/settings.gradle +++ b/settings.gradle @@ -45,5 +45,5 @@ plugins { include("common") include("fabric") -// include("neoforge") +include("neoforge") // include("forge")