I was following some tutorials on yt and noticed that a lot has changed from 1.19.2 to 1.19.3. My IDE doesn't show me any error but when I try to load the game the error I get is:
Registration.java:
public class Registration {
private Registration() {}
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
private static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, MODID);
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MODID);
private static final DeferredRegister<Codec<? extends IGlobalLootModifier>> GLM = DeferredRegister.create(ForgeRegistries.Keys.GLOBAL_LOOT_MODIFIER_SERIALIZERS, MODID);
private static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, MODID);
private static final DeferredRegister<PlacedFeature> PLACED_FEATURES = DeferredRegister.create(Registries.PLACED_FEATURE, MODID);
public static final RegistryObject<Block> EXAMPLE_BLOCK = BLOCKS.register("example_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops()));
public static final RegistryObject<Block> EXAMPLE_CARROT_CROP = BLOCKS.register("example_carrot_crop", () -> new ExCarrotCropBlock(BlockBehaviour.Properties.of(Material.PLANT).noCollission().randomTicks().instabreak().sound(SoundType.CROP).noOcclusion()));
public static final RegistryObject<Block> EXAMPLE_ORE = BLOCKS.register("example_ore", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(2.0f)));
public static final RegistryObject<Block> DEEPSLATE_EXAMPLE_ORE = BLOCKS.register("deepslate_example_ore", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(2.0f)));
public static final RegistryObject<Block> EXAMPLE_ADVANCED_BLOCK = BLOCKS.register("example_advanced_block", ExampleAdvancedBlock::new);
public static final RegistryObject<BlockEntityType<ExampleAdvancedBlockEntity>> EXAMPLE_ADVANCED_BLOCK_ENTITY = BLOCK_ENTITIES.register("example_advanced_block_entity", () -> BlockEntityType.Builder.of(ExampleAdvancedBlockEntity::new, EXAMPLE_ADVANCED_BLOCK.get()).build(null));
public static final RegistryObject<Item> EXAMPLE_INGOT = ITEMS.register("example_ingot", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> EXAMPLE_FOOD = ITEMS.register("example_food", () -> new Item(new Item.Properties().food(new FoodProperties.Builder().nutrition(6).saturationMod(0.6F).build())));
public static final RegistryObject<Item> EXAMPLE_CARROT = ITEMS.register("example_carrot", () -> new BlockItem(EXAMPLE_CARROT_CROP.get(), new Item.Properties().food(new FoodProperties.Builder().nutrition(6).saturationMod(0.6F).build())));
public static final RegistryObject<Item> EXAMPLE_PICKAXE = ITEMS.register("example_pickaxe", () -> new PickaxeItem(new ExampleToolTier(), 0, 0, new Item.Properties().stacksTo(1)));
public static final RegistryObject<Item> EXAMPLE_BLOCK_ITEM = ITEMS.register("example_block", () -> new BlockItem(EXAMPLE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Item> EXAMPLE_ADVANCED_BLOCK_ITEM = ITEMS.register("example_advanced_block", () -> new BlockItem(EXAMPLE_ADVANCED_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Item> EXAMPLE_ORE_ITEM = ITEMS.register("example_ore", () -> new BlockItem(EXAMPLE_ORE.get(), new Item.Properties()));
public static final RegistryObject<Item> DEEPSLATE_EXAMPLE_ORE_ITEM = ITEMS.register("deepslate_example_ore", () -> new BlockItem(DEEPSLATE_EXAMPLE_ORE.get(), new Item.Properties()));
public static final RegistryObject<Item> RAW_EXAMPLE_ORE = ITEMS.register("raw_example_ore", () -> new Item(new Item.Properties()));
public static final RegistryObject<Codec<GrassLootModifier>> GRASS_MOD = GLM.register("grass", GrassLootModifier.CODEC);
public static final RegistryObject<MenuType<ExampleAdvancedBlockMenu>> EXAMPLE_ADVANCED_BLOCK_CONTAINER = CONTAINERS.register("example_advanced_block_container", () -> IForgeMenuType.create((id, inv, data) -> new ExampleAdvancedBlockMenu(id, data.readBlockPos(), inv, inv.player)));
public static final Supplier<List<OreConfiguration.TargetBlockState>> OVERWORLD_EXAMPLE_ORE = Suppliers.memoize(() -> List.of(
OreConfiguration.target(new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), EXAMPLE_ORE.get().defaultBlockState()),
OreConfiguration.target(new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES), DEEPSLATE_EXAMPLE_ORE.get().defaultBlockState())
));
public static final RegistryObject<PlacedFeature> EXAMPLE_ORE_PLACED =
PLACED_FEATURES.register("example_ore_placed",
() -> new PlacedFeature(Holder.direct(new ConfiguredFeature<>(Feature.ORE, new OreConfiguration(OVERWORLD_EXAMPLE_ORE.get(), 7))),
CustomOrePlacements.commonOrePlacement(7,
HeightRangePlacement.triangle(
VerticalAnchor.aboveBottom(-80),
VerticalAnchor.aboveBottom(80)
)
)
)
);
public static void init() {
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
BLOCKS.register(bus);
BLOCK_ENTITIES.register(bus);
ITEMS.register(bus);
GLM.register(bus);
CONTAINERS.register(bus);
PLACED_FEATURES.register(bus);
}
}
The method `init` is called directly from the ExampleMod constructor (main entry point of the mod).
The `CustomOrePlacements` class is basically a copy of some of the private methods from the `OrePlacements` class.
I've already placed a json file inside `resources/data/examplemod/forge/biome_modifier`:
{
"type": "forge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "examplemod:example_ore_placed",
"step": "underground_ores"
}
I was wondering if someone could explain what's wrong with the code and how to fix this problem.