-
-
[Solved][1.18.2] How to register LootItemFunction and others
Yes, of course, those codes are just for testing.
-
[Solved][1.18.2] How to register LootItemFunction and others
Thanks! It works fine: @Mod("testmod") public final class TestMod { public TestMod() { FMLJavaModLoadingContext.get().getModEventBus().addGenericListener( GlobalLootModifierSerializer.class, (RegistryEvent.Register event) -> { TestLootItemFunctions.init(); } ); } }
-
[Solved][1.18.2] How to register LootItemFunction and others
Thanks. So is there any plan to support register additional registry entry (such as LootItemFunctionType) in the future?
-
[Solved][1.18.2] How to register LootItemFunction and others
Hello, I want to register additional LootItemFunction(LootItemFunctionType), LootItemConditions(LootItemConditionType) and etc, At 1.18.1, I was using the following code, it works fine: @Mod("testmod") public final class TestMod { public TestMod() { TestLootItemFunctions.init(); } } public final class TestLootItemFunctions { public static void init() {} public static final LootItemFunctionType TEST_FUNCTION = register(new ResourceLocation("testmod:test"), new TestFunction.Serializer()); private static LootItemFunctionType register(ResourceLocation id, Serializer<? extends LootItemFunction> serializer) { // net.minecraft.core.Registry return Registry.register(Registry.LOOT_FUNCTION_TYPE, id, new LootItemFunctionType(serializer)); } } But it is no longer works (Minecraft 1.18.2, official mappings, Forge 40.0.3): Caused by: java.lang.IllegalStateException: Registry is already frozen (trying to add key ResourceKey[minecraft:loot_function_type / testmod:test]) at net.minecraft.core.MappedRegistry.validateWrite(MappedRegistry.java:78) ~[forge-1.18.2-40.0.3_mapped_official_1.18.2-recomp.jar%2376!/:?] at net.minecraft.core.MappedRegistry.registerMapping(MappedRegistry.java:87) ~[forge-1.18.2-40.0.3_mapped_official_1.18.2-recomp.jar%2376!/:?] at net.minecraft.core.MappedRegistry.registerMapping(MappedRegistry.java:83) ~[forge-1.18.2-40.0.3_mapped_official_1.18.2-recomp.jar%2376!/:?] at net.minecraft.core.MappedRegistry.register(MappedRegistry.java:128) ~[forge-1.18.2-40.0.3_mapped_official_1.18.2-recomp.jar%2376!/:?] at net.minecraft.core.Registry.register(Registry.java:564) ~[forge-1.18.2-40.0.3_mapped_official_1.18.2-recomp.jar%2376!/:?] at net.minecraft.core.Registry.register(Registry.java:560) ~[forge-1.18.2-40.0.3_mapped_official_1.18.2-recomp.jar%2376!/:?] at com.testmod.server.loot.TestLootItemConditions.register(TestLootItemConditions.java:17) ~[%2380!/:?] at com.testmod.server.loot.TestLootItemConditions.<clinit>(TestLootItemConditions.java:14) ~[%2380!/:?] at com.testmod.TestMod.<init>(TestMod.java:23) ~[%2380!/:?] ... 14 more
IPS spam blocked by CleanTalk.