|
4 | 4 | import de.dafuqs.spectrum.*; |
5 | 5 | import de.dafuqs.spectrum.api.predicate.item.*; |
6 | 6 | import net.minecraft.advancements.critereon.*; |
7 | | -import net.minecraft.core.*; |
8 | 7 | import net.minecraft.core.registries.*; |
| 8 | +import net.neoforged.bus.api.*; |
| 9 | +import net.neoforged.neoforge.registries.*; |
9 | 10 |
|
10 | 11 | @SuppressWarnings("unused") |
11 | 12 | public class SpectrumItemSubPredicateTypes { |
12 | 13 |
|
13 | | - private static final DeferredRegistrar REGISTRAR = new DeferredRegistrar(); |
| 14 | + private static final DeferredRegister<ItemSubPredicate.Type<?>> REGISTRAR = DeferredRegister.create(Registries.ITEM_SUB_PREDICATE_TYPE, SpectrumCommon.MOD_ID); |
14 | 15 |
|
15 | 16 | public static ItemSubPredicate.Type<SweetenedPredicate> SWEETENED = register("sweetened", SweetenedPredicate.CODEC); |
16 | 17 | public static ItemSubPredicate.Type<InfusedBeveragePredicate> INFUSED_BEVERAGE = register("infused_beverage", InfusedBeveragePredicate.CODEC); |
17 | 18 | public static ItemSubPredicate.Type<BottomlessStackPredicate> BOTTOMLESS_STACK = register("bottomless_stack", BottomlessStackPredicate.CODEC); |
18 | 19 |
|
19 | 20 | private static <T extends ItemSubPredicate> ItemSubPredicate.Type<T> register(String id, Codec<T> codec) { |
20 | | - return REGISTRAR.defer(new ItemSubPredicate.Type<>(codec), type -> Registry.register(BuiltInRegistries.ITEM_SUB_PREDICATE_TYPE, SpectrumCommon.locate(id), type)); |
| 21 | + var type = new ItemSubPredicate.Type<>(codec); |
| 22 | + REGISTRAR.register(id, () -> type); |
| 23 | + return type; |
21 | 24 | } |
22 | 25 |
|
23 | | - public static void register() { |
24 | | - REGISTRAR.flush(); |
| 26 | + public static void register(IEventBus bus) { |
| 27 | + REGISTRAR.register(bus); |
25 | 28 | } |
26 | 29 |
|
27 | 30 | } |
0 commit comments