From 20add2613f5066ed423cd71b30596d22bdd520a2 Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Fri, 14 Jun 2024 11:12:23 +0200 Subject: [PATCH] feat: Update Forge and NeoForge to 1.21 --- .../net/blay09/mods/waystones/Waystones.java | 4 +- .../block/entity/ModBlockEntities.java | 28 +- .../mods/waystones/client/ModTextures.java | 10 - .../waystones/client/WaystonesClient.java | 8 - .../blay09/mods/waystones/menu/ModMenus.java | 285 +++++++++--------- .../RepurposedStructuresIntegration.java | 2 +- .../compat/TheOneProbeIntegration.java | 2 +- gradle.properties | 2 +- .../mods/waystones/NeoForgeWaystones.java | 6 - .../client/NeoForgeWaystonesClient.java | 17 ++ .../RepurposedStructuresIntegration.java | 6 +- .../compat/TheOneProbeIntegration.java | 2 +- 12 files changed, 180 insertions(+), 192 deletions(-) delete mode 100644 common/src/main/java/net/blay09/mods/waystones/client/ModTextures.java create mode 100644 neoforge/src/main/java/net/blay09/mods/waystones/client/NeoForgeWaystonesClient.java diff --git a/common/src/main/java/net/blay09/mods/waystones/Waystones.java b/common/src/main/java/net/blay09/mods/waystones/Waystones.java index 29105d71..f7c1d386 100644 --- a/common/src/main/java/net/blay09/mods/waystones/Waystones.java +++ b/common/src/main/java/net/blay09/mods/waystones/Waystones.java @@ -32,9 +32,9 @@ public static void initialize() { ModEventHandlers.initialize(); ModNetworking.initialize(Balm.getNetworking()); ModBlocks.initialize(Balm.getBlocks()); - ModBlockEntities.initialize(Balm.getBlockEntities()); + ModBlockEntities.initialize(); ModItems.initialize(Balm.getItems()); - ModMenus.initialize(Balm.getMenus()); + ModMenus.initialize(); ModWorldGen.initialize(Balm.getWorldGen()); ModCommands.initialize(Balm.getCommands()); ModComponents.initialize(Balm.getComponents()); diff --git a/common/src/main/java/net/blay09/mods/waystones/block/entity/ModBlockEntities.java b/common/src/main/java/net/blay09/mods/waystones/block/entity/ModBlockEntities.java index 4833dc4e..4779d5fa 100644 --- a/common/src/main/java/net/blay09/mods/waystones/block/entity/ModBlockEntities.java +++ b/common/src/main/java/net/blay09/mods/waystones/block/entity/ModBlockEntities.java @@ -1,5 +1,6 @@ package net.blay09.mods.waystones.block.entity; +import net.blay09.mods.balm.api.Balm; import net.blay09.mods.balm.api.DeferredObject; import net.blay09.mods.balm.api.block.BalmBlockEntities; import net.blay09.mods.waystones.Waystones; @@ -9,20 +10,21 @@ import net.minecraft.world.level.block.entity.BlockEntityType; public class ModBlockEntities { - public static DeferredObject> waystone; - public static DeferredObject> sharestone; - public static DeferredObject> warpPlate; - public static DeferredObject> portstone; + private static final BalmBlockEntities blockEntities = Balm.getBlockEntities(); + public static DeferredObject> waystone = blockEntities.registerBlockEntity(id("waystone"), + WaystoneBlockEntity::new, + () -> new Block[]{ModBlocks.waystone, ModBlocks.mossyWaystone, ModBlocks.sandyWaystone, ModBlocks.deepslateWaystone, ModBlocks.blackstoneWaystone, ModBlocks.endStoneWaystone}); + public static DeferredObject> sharestone = blockEntities.registerBlockEntity(id("sharestone"), + SharestoneBlockEntity::new, + () -> ModBlocks.sharestones); + public static DeferredObject> warpPlate = blockEntities.registerBlockEntity(id("warp_plate"), + WarpPlateBlockEntity::new, + () -> new Block[]{ModBlocks.warpPlate}); + public static DeferredObject> portstone = blockEntities.registerBlockEntity(id("portstone"), + PortstoneBlockEntity::new, + () -> ModBlocks.portstones); - public static void initialize(BalmBlockEntities blockEntities) { - waystone = blockEntities.registerBlockEntity(id("waystone"), - WaystoneBlockEntity::new, - () -> new Block[]{ModBlocks.waystone, ModBlocks.mossyWaystone, ModBlocks.sandyWaystone, ModBlocks.deepslateWaystone, ModBlocks.blackstoneWaystone, ModBlocks.endStoneWaystone}); - sharestone = blockEntities.registerBlockEntity(id("sharestone"), - SharestoneBlockEntity::new, - () -> ModBlocks.sharestones); - warpPlate = blockEntities.registerBlockEntity(id("warp_plate"), WarpPlateBlockEntity::new, () -> new Block[]{ModBlocks.warpPlate}); - portstone = blockEntities.registerBlockEntity(id("portstone"), PortstoneBlockEntity::new, () -> ModBlocks.portstones); + public static void initialize() { } private static ResourceLocation id(String name) { diff --git a/common/src/main/java/net/blay09/mods/waystones/client/ModTextures.java b/common/src/main/java/net/blay09/mods/waystones/client/ModTextures.java deleted file mode 100644 index c83f119c..00000000 --- a/common/src/main/java/net/blay09/mods/waystones/client/ModTextures.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.blay09.mods.waystones.client; - -import net.blay09.mods.balm.api.client.rendering.BalmTextures; - -public class ModTextures { - - public static void initialize(BalmTextures textures) { - } - -} diff --git a/common/src/main/java/net/blay09/mods/waystones/client/WaystonesClient.java b/common/src/main/java/net/blay09/mods/waystones/client/WaystonesClient.java index f1c58fd0..4f698bfb 100644 --- a/common/src/main/java/net/blay09/mods/waystones/client/WaystonesClient.java +++ b/common/src/main/java/net/blay09/mods/waystones/client/WaystonesClient.java @@ -1,18 +1,11 @@ package net.blay09.mods.waystones.client; -import net.blay09.mods.balm.api.Balm; import net.blay09.mods.balm.api.client.BalmClient; -import net.blay09.mods.balm.api.event.client.UseItemInputEvent; import net.blay09.mods.waystones.InternalClientMethodsImpl; import net.blay09.mods.waystones.api.client.WaystonesClientAPI; -import net.blay09.mods.waystones.block.entity.WaystoneBlockEntityBase; import net.blay09.mods.waystones.client.requirement.RequirementClientRegistry; import net.blay09.mods.waystones.compat.Compat; -import net.blay09.mods.waystones.network.message.RequestEditWaystoneMessage; import net.minecraft.client.ClientBrandRetriever; -import net.minecraft.client.Minecraft; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.HitResult; import java.util.Locale; @@ -24,7 +17,6 @@ public static void initialize() { ModClientEventHandlers.initialize(); ModRenderers.initialize(BalmClient.getRenderers()); ModScreens.initialize(BalmClient.getScreens()); - ModTextures.initialize(BalmClient.getTextures()); ModModels.initialize(BalmClient.getModels()); InventoryButtonGuiHandler.initialize(); diff --git a/common/src/main/java/net/blay09/mods/waystones/menu/ModMenus.java b/common/src/main/java/net/blay09/mods/waystones/menu/ModMenus.java index 109adef6..1dc2b1d7 100644 --- a/common/src/main/java/net/blay09/mods/waystones/menu/ModMenus.java +++ b/common/src/main/java/net/blay09/mods/waystones/menu/ModMenus.java @@ -1,12 +1,12 @@ package net.blay09.mods.waystones.menu; +import net.blay09.mods.balm.api.Balm; import net.blay09.mods.balm.api.DeferredObject; import net.blay09.mods.balm.api.menu.BalmMenuFactory; import net.blay09.mods.balm.api.menu.BalmMenus; import net.blay09.mods.waystones.Waystones; import net.blay09.mods.waystones.api.TeleportFlags; import net.blay09.mods.waystones.api.Waystone; -import net.blay09.mods.waystones.block.entity.WarpPlateBlockEntity; import net.blay09.mods.waystones.block.entity.WaystoneBlockEntity; import net.blay09.mods.waystones.block.entity.WaystoneBlockEntityBase; import net.blay09.mods.waystones.core.WaystoneImpl; @@ -24,151 +24,144 @@ import java.util.Set; public class ModMenus { - public static DeferredObject> waystoneSelection; - public static DeferredObject> warpScrollSelection; - public static DeferredObject> warpStoneSelection; - public static DeferredObject> portstoneSelection; - public static DeferredObject> inventorySelection; - public static DeferredObject> adminSelection; - public static DeferredObject> sharestoneSelection; - public static DeferredObject> waystoneModifiers; - public static DeferredObject> waystoneSettings; - - public static void initialize(BalmMenus menus) { - waystoneSelection = menus.registerMenu(id("waystone_selection"), new BalmMenuFactory() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, WaystoneSelectionMenu.Data data) { - final var blockEntity = inventory.player.level().getBlockEntity(data.pos()); - if (blockEntity instanceof WaystoneBlockEntity waystone) { - return new WaystoneSelectionMenu(ModMenus.waystoneSelection.get(), - waystone.getWaystone(), - windowId, - data.waystones(), - Collections.emptySet()); - } - - return null; - } - - @Override - public StreamCodec getStreamCodec() { - return WaystoneSelectionMenu.STREAM_CODEC; - } - }); - - warpScrollSelection = menus.registerMenu(id("warp_scroll_selection"), new BalmMenuFactory>() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { - return new WaystoneSelectionMenu(ModMenus.warpScrollSelection.get(), null, windowId, waystones, Collections.emptySet()); - } - - @Override - public StreamCodec> getStreamCodec() { - return WaystoneImpl.LIST_STREAM_CODEC; - } - }); - - warpStoneSelection = menus.registerMenu(id("warp_stone_selection"), new BalmMenuFactory>() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { - return new WaystoneSelectionMenu(ModMenus.warpStoneSelection.get(), null, windowId, waystones, Collections.emptySet()); - } - - @Override - public StreamCodec> getStreamCodec() { - return WaystoneImpl.LIST_STREAM_CODEC; - } - }); - - portstoneSelection = menus.registerMenu(id("portstone_selection"), new BalmMenuFactory>() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { - return new WaystoneSelectionMenu(ModMenus.portstoneSelection.get(), null, windowId, waystones, Collections.emptySet()); - } - - @Override - public StreamCodec> getStreamCodec() { - return WaystoneImpl.LIST_STREAM_CODEC; - } - }); - - sharestoneSelection = menus.registerMenu(id("sharestone_selection"), new BalmMenuFactory() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, WaystoneSelectionMenu.Data data) { - final var blockEntity = inventory.player.level().getBlockEntity(data.pos()); - if (blockEntity instanceof WaystoneBlockEntity waystone) { - return new WaystoneSelectionMenu(ModMenus.sharestoneSelection.get(), - waystone.getWaystone(), - windowId, - data.waystones(), - Collections.emptySet()); - } - - return null; - } - - @Override - public StreamCodec getStreamCodec() { - return WaystoneSelectionMenu.STREAM_CODEC; - } - }); - - inventorySelection = menus.registerMenu(id("inventory_selection"), new BalmMenuFactory>() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { - return new WaystoneSelectionMenu(ModMenus.inventorySelection.get(), null, windowId, waystones, Set.of(TeleportFlags.INVENTORY_BUTTON)); - } - - @Override - public StreamCodec> getStreamCodec() { - return WaystoneImpl.LIST_STREAM_CODEC; - } - }); - - adminSelection = menus.registerMenu(id("admin_selection"), new BalmMenuFactory>() { - @Override - public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { - return new WaystoneSelectionMenu(ModMenus.adminSelection.get(), null, windowId, waystones, Set.of(TeleportFlags.ADMIN)); - } - - @Override - public StreamCodec> getStreamCodec() { - return WaystoneImpl.LIST_STREAM_CODEC; - } - }); - - waystoneModifiers = menus.registerMenu(id("waystone_modifiers"), new BalmMenuFactory() { - @Override - public WaystoneModifierMenu create(int windowId, Inventory inventory, BlockPos pos) { - final var blockEntity = inventory.player.level().getBlockEntity(pos); - if (blockEntity instanceof WaystoneBlockEntityBase waystoneBlockEntity) { - return new WaystoneModifierMenu(windowId, waystoneBlockEntity, inventory); - } - return null; - } - - @Override - public StreamCodec getStreamCodec() { - return BlockPos.STREAM_CODEC.cast(); - } - }); - - waystoneSettings = menus.registerMenu(id("waystone"), new BalmMenuFactory() { - @Override - public WaystoneEditMenu create(int windowId, Inventory inventory, WaystoneEditMenu.Data data) { - BlockEntity blockEntity = inventory.player.level().getBlockEntity(data.pos()); - if (blockEntity instanceof WaystoneBlockEntityBase waystoneBlockEntity) { - return new WaystoneEditMenu(windowId, data.waystone(), waystoneBlockEntity, inventory, data.modifierCount(), data.canEdit()); - } - - return null; - } - - @Override - public StreamCodec getStreamCodec() { - return WaystoneEditMenu.STREAM_CODEC; - } - }); + private static final BalmMenus menus = Balm.getMenus(); + public static DeferredObject> waystoneSelection = menus.registerMenu(id("waystone_selection"), + new BalmMenuFactory() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, WaystoneSelectionMenu.Data data) { + final var blockEntity = inventory.player.level().getBlockEntity(data.pos()); + if (blockEntity instanceof WaystoneBlockEntity waystone) { + return new WaystoneSelectionMenu(ModMenus.waystoneSelection.get(), + waystone.getWaystone(), + windowId, + data.waystones(), + Collections.emptySet()); + } + + return null; + } + + @Override + public StreamCodec getStreamCodec() { + return WaystoneSelectionMenu.STREAM_CODEC; + } + }); + public static DeferredObject> warpScrollSelection = menus.registerMenu(id("warp_scroll_selection"), + new BalmMenuFactory>() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { + return new WaystoneSelectionMenu(ModMenus.warpScrollSelection.get(), null, windowId, waystones, Collections.emptySet()); + } + + @Override + public StreamCodec> getStreamCodec() { + return WaystoneImpl.LIST_STREAM_CODEC; + } + }); + public static DeferredObject> warpStoneSelection = menus.registerMenu(id("warp_stone_selection"), + new BalmMenuFactory>() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { + return new WaystoneSelectionMenu(ModMenus.warpStoneSelection.get(), null, windowId, waystones, Collections.emptySet()); + } + + @Override + public StreamCodec> getStreamCodec() { + return WaystoneImpl.LIST_STREAM_CODEC; + } + }); + public static DeferredObject> portstoneSelection = menus.registerMenu(id("portstone_selection"), + new BalmMenuFactory>() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { + return new WaystoneSelectionMenu(ModMenus.portstoneSelection.get(), null, windowId, waystones, Collections.emptySet()); + } + + @Override + public StreamCodec> getStreamCodec() { + return WaystoneImpl.LIST_STREAM_CODEC; + } + }); + public static DeferredObject> inventorySelection = menus.registerMenu(id("inventory_selection"), + new BalmMenuFactory>() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { + return new WaystoneSelectionMenu(ModMenus.inventorySelection.get(), null, windowId, waystones, Set.of(TeleportFlags.INVENTORY_BUTTON)); + } + + @Override + public StreamCodec> getStreamCodec() { + return WaystoneImpl.LIST_STREAM_CODEC; + } + }); + public static DeferredObject> adminSelection = menus.registerMenu(id("admin_selection"), + new BalmMenuFactory>() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, Collection waystones) { + return new WaystoneSelectionMenu(ModMenus.adminSelection.get(), null, windowId, waystones, Set.of(TeleportFlags.ADMIN)); + } + + @Override + public StreamCodec> getStreamCodec() { + return WaystoneImpl.LIST_STREAM_CODEC; + } + }); + public static DeferredObject> sharestoneSelection = menus.registerMenu(id("sharestone_selection"), + new BalmMenuFactory() { + @Override + public WaystoneSelectionMenu create(int windowId, Inventory inventory, WaystoneSelectionMenu.Data data) { + final var blockEntity = inventory.player.level().getBlockEntity(data.pos()); + if (blockEntity instanceof WaystoneBlockEntity waystone) { + return new WaystoneSelectionMenu(ModMenus.sharestoneSelection.get(), + waystone.getWaystone(), + windowId, + data.waystones(), + Collections.emptySet()); + } + + return null; + } + + @Override + public StreamCodec getStreamCodec() { + return WaystoneSelectionMenu.STREAM_CODEC; + } + }); + public static DeferredObject> waystoneModifiers = menus.registerMenu(id("waystone_modifiers"), + new BalmMenuFactory() { + @Override + public WaystoneModifierMenu create(int windowId, Inventory inventory, BlockPos pos) { + final var blockEntity = inventory.player.level().getBlockEntity(pos); + if (blockEntity instanceof WaystoneBlockEntityBase waystoneBlockEntity) { + return new WaystoneModifierMenu(windowId, waystoneBlockEntity, inventory); + } + return null; + } + + @Override + public StreamCodec getStreamCodec() { + return BlockPos.STREAM_CODEC.cast(); + } + }); + public static DeferredObject> waystoneSettings = menus.registerMenu(id("waystone"), + new BalmMenuFactory() { + @Override + public WaystoneEditMenu create(int windowId, Inventory inventory, WaystoneEditMenu.Data data) { + BlockEntity blockEntity = inventory.player.level().getBlockEntity(data.pos()); + if (blockEntity instanceof WaystoneBlockEntityBase waystoneBlockEntity) { + return new WaystoneEditMenu(windowId, data.waystone(), waystoneBlockEntity, inventory, data.modifierCount(), data.canEdit()); + } + + return null; + } + + @Override + public StreamCodec getStreamCodec() { + return WaystoneEditMenu.STREAM_CODEC; + } + }); + + public static void initialize() { } @NotNull diff --git a/forge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java b/forge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java index 869f41f5..56cb35b7 100644 --- a/forge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java +++ b/forge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java @@ -12,7 +12,7 @@ public class RepurposedStructuresIntegration { public static final DeferredRegister> RS_CONDITIONS_REGISTRY = DeferredRegister.createOptional( - new ResourceLocation("repurposed_structures", "json_conditions"), "waystones"); + ResourceLocation.fromNamespaceAndPath("repurposed_structures", "json_conditions"), "waystones"); public static final RegistryObject> WAYSTONE_CONFIG_CONDITION = RS_CONDITIONS_REGISTRY.register( "config", () -> () -> WaystonesConfig.getActive().worldGen.spawnInVillages != WaystonesConfigData.VillageWaystoneGeneration.DISABLED); diff --git a/forge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java b/forge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java index 4e8b224e..8aea7eac 100644 --- a/forge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java +++ b/forge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java @@ -39,7 +39,7 @@ public static class ProbeInfoProvider implements IProbeInfoProvider { @Override public ResourceLocation getID() { - return new ResourceLocation(Waystones.MOD_ID, "top"); + return ResourceLocation.fromNamespaceAndPath(Waystones.MOD_ID, "top"); } @Override diff --git a/gradle.properties b/gradle.properties index a87fe331..925db58b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,7 +33,7 @@ pack_format_number = 18 java_version = 21 # Balm -balm_version = 21.0.1-SNAPSHOT +balm_version = 21.0.3-SNAPSHOT balm_version_range = [21.0.0,) # Forge diff --git a/neoforge/src/main/java/net/blay09/mods/waystones/NeoForgeWaystones.java b/neoforge/src/main/java/net/blay09/mods/waystones/NeoForgeWaystones.java index ede085bc..b8ac712a 100644 --- a/neoforge/src/main/java/net/blay09/mods/waystones/NeoForgeWaystones.java +++ b/neoforge/src/main/java/net/blay09/mods/waystones/NeoForgeWaystones.java @@ -1,13 +1,9 @@ package net.blay09.mods.waystones; import net.blay09.mods.balm.api.Balm; -import net.blay09.mods.balm.api.client.BalmClient; import net.blay09.mods.balm.neoforge.NeoForgeLoadContext; -import net.blay09.mods.waystones.client.WaystonesClient; import net.blay09.mods.waystones.compat.Compat; -import net.neoforged.api.distmarker.Dist; import net.neoforged.bus.api.IEventBus; -import net.neoforged.fml.DistExecutor; import net.neoforged.fml.common.Mod; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,8 +18,6 @@ public class NeoForgeWaystones { public NeoForgeWaystones(IEventBus modEventBus) { final var context = new NeoForgeLoadContext(modEventBus); Balm.initialize(Waystones.MOD_ID, context, Waystones::initialize); - // TODO client entry point - DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> BalmClient.initialize(Waystones.MOD_ID, context, WaystonesClient::initialize)); Balm.initializeIfLoaded(Compat.THEONEPROBE, "net.blay09.mods.waystones.compat.TheOneProbeIntegration"); diff --git a/neoforge/src/main/java/net/blay09/mods/waystones/client/NeoForgeWaystonesClient.java b/neoforge/src/main/java/net/blay09/mods/waystones/client/NeoForgeWaystonesClient.java new file mode 100644 index 00000000..1e10a622 --- /dev/null +++ b/neoforge/src/main/java/net/blay09/mods/waystones/client/NeoForgeWaystonesClient.java @@ -0,0 +1,17 @@ +package net.blay09.mods.waystones.client; + +import net.blay09.mods.balm.api.client.BalmClient; +import net.blay09.mods.balm.neoforge.NeoForgeLoadContext; +import net.blay09.mods.waystones.Waystones; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.common.Mod; + +@Mod(value = Waystones.MOD_ID, dist = Dist.CLIENT) +public class NeoForgeWaystonesClient { + + public NeoForgeWaystonesClient(IEventBus modEventBus) { + final var context = new NeoForgeLoadContext(modEventBus); + BalmClient.initialize(Waystones.MOD_ID, context, WaystonesClient::initialize); + } +} diff --git a/neoforge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java b/neoforge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java index 47b3adb1..05c5327b 100644 --- a/neoforge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java +++ b/neoforge/src/main/java/net/blay09/mods/waystones/compat/RepurposedStructuresIntegration.java @@ -3,7 +3,7 @@ import net.blay09.mods.waystones.config.WaystonesConfig; import net.blay09.mods.waystones.config.WaystonesConfigData; import net.minecraft.resources.ResourceLocation; -import net.neoforged.fml.javafmlmod.FMLJavaModLoadingContext; +import net.neoforged.fml.ModLoadingContext; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; @@ -11,13 +11,13 @@ public class RepurposedStructuresIntegration { public static final DeferredRegister> RS_CONDITIONS_REGISTRY = DeferredRegister.create( - new ResourceLocation("repurposed_structures", "json_conditions"), "waystones"); + ResourceLocation.fromNamespaceAndPath("repurposed_structures", "json_conditions"), "waystones"); public static final DeferredHolder, Supplier> WAYSTONE_CONFIG_CONDITION = RS_CONDITIONS_REGISTRY.register( "config", () -> () -> WaystonesConfig.getActive().worldGen.spawnInVillages != WaystonesConfigData.VillageWaystoneGeneration.DISABLED); public RepurposedStructuresIntegration() { - final var modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); + final var modEventBus = ModLoadingContext.get().getActiveContainer().getEventBus(); RS_CONDITIONS_REGISTRY.register(modEventBus); } } diff --git a/neoforge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java b/neoforge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java index c1b46a12..d5e401b4 100644 --- a/neoforge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java +++ b/neoforge/src/main/java/net/blay09/mods/waystones/compat/TheOneProbeIntegration.java @@ -39,7 +39,7 @@ public static class ProbeInfoProvider implements IProbeInfoProvider { @Override public ResourceLocation getID() { - return new ResourceLocation(Waystones.MOD_ID, "top"); + return ResourceLocation.fromNamespaceAndPath(Waystones.MOD_ID, "top"); } @Override