Draco18s Posted June 20, 2023 Posted June 20, 2023 (edited) I have a custom loot function that I want to have run when my own loot tables for my own blocks runs (it sets the number of drops based on a blockstate value). Things that did not work: Using Forge registries Forge does not provide a replacement for BuiltInRegistries.LOOT_FUNCTION_TYPE Forge also does not appear to need or provide a replacement for BuiltInRegistries.LOOT_CONDITION CanToolPerformAction just creates a new LootItemConditionType and runs with it, no registration needed Using an existing LootItemFunctionType in LootItemFunctionType getType() De/serializer attempts to cast my function to an unrelated function Using a new LootItemFunctionType() De/serializer gets a null serializer to serialize with Cannot invoke "net.minecraft.resources.ResourceLocation.toString()" because the return value of "net.minecraft.core.Registry.getKey(Object)" is null Attempting to make the same calls LootFunctions.register does Fail with fml.modloading.failedtoloadmod Attempting to make the same calls as LootFunctions.register at different points during the init/setup process (tried numerous events) Most fail with an Optional.get() returning no value (in this case, trying to get the built in registry's ResourceKey as a ResourceKey<E> not a ResourceKey<? extends Registry<E>>) Others fail with fml.modloading.failedtoloadmod Things I will not do, but which would probably work: Individually test against 16 different values and individually compute the resulting fixed value count This is so dumb I'm not even going to pretend that I should consider it Edited June 20, 2023 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Draco18s Posted June 20, 2023 Author Posted June 20, 2023 (edited) Solved public static final DeferredRegister<LootItemFunctionType> FUNCS = DeferredRegister.create(Registries.LOOT_FUNCTION_TYPE, MODID); I hadn't been able to find Registries.LOOT_FUNCTION_TYPE Edited June 20, 2023 by Draco18s Quote Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.