properly register item function types
This commit is contained in:
parent
e8f8682692
commit
94c64e0a5c
@ -1,19 +1,18 @@
|
||||
package ru.dbotthepony.mc.otm.registry
|
||||
|
||||
import net.minecraft.core.Registry
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.level.storage.loot.functions.LootItemFunctionType
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemConditionType
|
||||
import net.minecraftforge.registries.RegisterEvent
|
||||
import net.minecraftforge.eventbus.api.IEventBus
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.data.loot.RandomizerFunction
|
||||
|
||||
object MItemFunctionTypes {
|
||||
val RANDOMIZER = LootItemFunctionType(RandomizerFunction.Companion)
|
||||
private val registry = DeferredRegister.create(Registry.LOOT_FUNCTION_REGISTRY, OverdriveThatMatters.MOD_ID)
|
||||
|
||||
internal fun register(event: RegisterEvent) {
|
||||
if (event.getVanillaRegistry<LootItemConditionType>() == Registry.LOOT_FUNCTION_TYPE) {
|
||||
Registry.LOOT_FUNCTION_TYPE.register(ResourceLocation(OverdriveThatMatters.MOD_ID, "randomizer"), RANDOMIZER)
|
||||
}
|
||||
val RANDOMIZER: LootItemFunctionType by registry.register("randomizer") { LootItemFunctionType(RandomizerFunction.Companion) }
|
||||
|
||||
internal fun register(bus: IEventBus) {
|
||||
registry.register(bus)
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,6 @@ object MRegistry {
|
||||
bus.addListener(this::initializeCommon)
|
||||
bus.addListener(MStats::registerVanilla)
|
||||
bus.addListener(MLootItemConditions::register)
|
||||
bus.addListener(MItemFunctionTypes::register)
|
||||
|
||||
MBlocks.register(bus)
|
||||
MBlockEntities.register(bus)
|
||||
@ -236,6 +235,7 @@ object MRegistry {
|
||||
AndroidFeatures.register(bus)
|
||||
MSoundEvents.register(bus)
|
||||
LootModifiers.register(bus)
|
||||
MItemFunctionTypes.register(bus)
|
||||
|
||||
MRecipes.register(bus)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user