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