RegistryEvents is where i register the blocks, items and biomes
@Mod.EventBusSubscriber(
bus = Bus.MOD
)
public class RegistryEvents {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, MoreContent.MOD_ID);
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MoreContent.MOD_ID);
public static final DeferredRegister<Biome> BIOMES = DeferredRegister.create(ForgeRegistries.BIOMES, MoreContent.MOD_ID);
@SubscribeEvent
public static void onEntityRegistry(Register<EntityType<?>> event) {
ModEntityTypes.register(event.getRegistry());
}
public RegistryEvents() {
BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
BIOMES.register(FMLJavaModLoadingContext.get().getModEventBus());
}
//*************************ITEMS****************************************************************//
public static final RegistryObject<Item> ENDER_BEAST_ARCHER = ITEMS.register("ender_beast_archer_spawn_egg", () -> new SpawnEggItem(ModEntityTypes.ENDERBEASTARCHER, 3286365, 4859178, (new Item.Properties()).group(ItemGroup.MISC)));
//BLOCKITEMS
public static final RegistryObject<Item> FIERCE_SAND_ITEM = ITEMS.register("fierce_sand", () -> new BlockItem(RegistryEvents.FIERCE_SAND.get(), new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)));
public static final RegistryObject<Item> FIERCE_SANDSTONE_ITEM = ITEMS.register("fierce_sandstone", () -> new BlockItem(RegistryEvents.FIERCE_SANDSTONE.get(), new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)));
public static final RegistryObject<Item> FOSSILS_ITEM = ITEMS.register("fossils", () -> new BlockItem(RegistryEvents.FOSSILS.get(), new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)));
public static final RegistryObject<Item> ERODED_STONE_ITEM = ITEMS.register("eroded_stone", () -> new BlockItem(RegistryEvents.ERODED_STONE.get(), new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)));
public static final RegistryObject<Item> DEAD_GRASS_ITEM = ITEMS.register("dead_grass", () -> new BlockItem(RegistryEvents.DEAD_GRASS.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> DESERTS_HOPE_ITEM = ITEMS.register("deserts_hope", () -> new BlockItem(RegistryEvents.DESERTS_HOPE.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> SPIKED_VINE_ITEM = ITEMS.register("spiked_vine", () -> new BlockItem(RegistryEvents.SPIKED_VINE.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> SPIKY_FRUIT_ITEM = ITEMS.register("spiky_fruit", () -> new Item(new Item.Properties().group(ItemGroup.FOOD).food(ModFoods.SPIKY_FRUIT)));
public static final RegistryObject<Item> GOLDEN_SPIKY_FRUIT_ITEM = ITEMS.register("golden_spiky_fruit", () -> new Item(new Item.Properties().group(ItemGroup.FOOD).food(ModFoods.GOLDEN_SPIKY_FRUIT)));
/////
public static final RegistryObject<Item> LARGE_ACACIA_TORCH_ITEM = ITEMS.register("large_acacia_torch", () -> new BlockItem(RegistryEvents.LARGE_ACACIA_TORCH.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> LARGE_BIRCH_TORCH_ITEM = ITEMS.register("large_birch_torch", () -> new BlockItem(RegistryEvents.LARGE_BIRCH_TORCH.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> LARGE_DARK_OAK_TORCH_ITEM = ITEMS.register("large_dark_oak_torch", () -> new BlockItem(RegistryEvents.LARGE_DARK_OAK_TORCH.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> LARGE_JUNGLE_TORCH_ITEM = ITEMS.register("large_jungle_torch", () -> new BlockItem(RegistryEvents.LARGE_JUNGLE_TORCH.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> LARGE_OAK_TORCH_ITEM = ITEMS.register("large_oak_torch", () -> new BlockItem(RegistryEvents.LARGE_OAK_TORCH.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
public static final RegistryObject<Item> LARGE_SPRUCE_TORCH_ITEM = ITEMS.register("large_spruce_torch", () -> new BlockItem(RegistryEvents.LARGE_SPRUCE_TORCH.get(), new Item.Properties().group(ItemGroup.DECORATIONS)));
//*************************BLOCKS***************************************************************//
public static final RegistryObject<Block> FIERCE_SAND = BLOCKS.register("fierce_sand", () -> new SandBlock(16760677, Block.Properties.create(Material.SAND, MaterialColor.SAND).hardnessAndResistance(0.5F).harvestTool(ToolType.SHOVEL).sound(SoundType.SAND)));
public static final RegistryObject<Block> FIERCE_SANDSTONE = BLOCKS.register("fierce_sandstone", () -> new Block(Block.Properties.create(Material.ROCK, MaterialColor.SAND).hardnessAndResistance(0.9F).harvestTool(ToolType.PICKAXE).sound(SoundType.STONE)));
public static final RegistryObject<Block> FOSSILS = BLOCKS.register("fossils", () -> new Block(Block.Properties.create(Material.ROCK, MaterialColor.DIRT).hardnessAndResistance(1.0F).harvestTool(ToolType.PICKAXE).sound(SoundType.STONE)));
public static final RegistryObject<Block> ERODED_STONE = BLOCKS.register("eroded_stone", () -> new Block(Block.Properties.create(Material.ROCK, MaterialColor.DIRT).hardnessAndResistance(1.0F).harvestTool(ToolType.PICKAXE).sound(SoundType.STONE)));
public static final RegistryObject<Block> SPIKED_VINE = BLOCKS.register("spiked_vine", () -> new SpikedVineBlock(Block.Properties.create(Material.PLANTS, MaterialColor.GRASS).hardnessAndResistance(0.5F).harvestTool(ToolType.AXE).sound(SoundType.PLANT)));
public static final RegistryObject<Block> SPIKY_FRUIT = BLOCKS.register("spiky_fruit", () -> new SpikyFruitBlock(Block.Properties.create(Material.PLANTS, MaterialColor.ORANGE_TERRACOTTA).hardnessAndResistance(0.5F).harvestTool(ToolType.AXE).sound(SoundType.PLANT)));
public static final RegistryObject<Block> DEAD_GRASS = BLOCKS.register("dead_grass", () -> new DeserticBushBlock(Block.Properties.create(Material.PLANTS, MaterialColor.GOLD).zeroHardnessAndResistance().sound(SoundType.PLANT).doesNotBlockMovement()));
public static final RegistryObject<Block> DESERTS_HOPE = BLOCKS.register("deserts_hope", () -> new FlowerBlock(Effects.REGENERATION, 8, Block.Properties.create(Material.PLANTS).zeroHardnessAndResistance().sound(SoundType.PLANT).doesNotBlockMovement()));
////
public static final RegistryObject<Block> POTTED_DESERTS_HOPE = BLOCKS.register("potted_deserts_hope", () -> new FlowerPotBlock(RegistryEvents.DESERTS_HOPE.get(), Block.Properties.create(Material.MISCELLANEOUS).zeroHardnessAndResistance().notSolid()));
public static final RegistryObject<Block> LARGE_ACACIA_TORCH = BLOCKS.register("large_acacia_torch", () -> new LargeTorchBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0.75F).sound(SoundType.WOOD)));
public static final RegistryObject<Block> LARGE_BIRCH_TORCH = BLOCKS.register("large_birch_torch", () -> new LargeTorchBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0.75F).sound(SoundType.WOOD)));
public static final RegistryObject<Block> LARGE_DARK_OAK_TORCH = BLOCKS.register("large_dark_oak_torch", () -> new LargeTorchBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0.75F).sound(SoundType.WOOD)));
public static final RegistryObject<Block> LARGE_JUNGLE_TORCH = BLOCKS.register("large_jungle_torch", () -> new LargeTorchBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0.75F).sound(SoundType.WOOD)));
public static final RegistryObject<Block> LARGE_OAK_TORCH = BLOCKS.register("large_oak_torch", () -> new LargeTorchBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0.75F).sound(SoundType.WOOD)));
public static final RegistryObject<Block> LARGE_SPRUCE_TORCH = BLOCKS.register("large_spruce_torch", () -> new LargeTorchBlock(Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0.75F).sound(SoundType.WOOD)));
////////BIOMES/////////
public static final RegistryObject<Biome> RAMMERS_VALLEY = BIOMES.register("rammers_valley", RammersValleyBiome::new);
public static void registerBiomesToDictionary() {
BiomeManager.addBiome(BiomeManager.BiomeType.WARM, new BiomeManager.BiomeEntry(RAMMERS_VALLEY.get(), 30));
}
public static void addBiomeTypes() {
BiomeDictionary.addTypes(RAMMERS_VALLEY.get(), BiomeDictionary.Type.DRY, BiomeDictionary.Type.SANDY, BiomeDictionary.Type.OVERWORLD);
}
}
apparently if i delete new RegistryEvents(); Minecraft throws me this: More Content (more content) encountered an error during the load_registries event phase
the other thing you pointed out were infact useless.
@Mod("morecontent")
@Mod.EventBusSubscriber(modid = "morecontent", bus = Mod.EventBusSubscriber.Bus.MOD)
public class MoreContent {
public static MoreContent INSTANCE;
public static final String MOD_ID = "morecontent";
public MoreContent() {
INSTANCE = this;
new RegistryEvents();
}
@SubscribeEvent
public void setupCommon(FMLCommonSetupEvent event) {
PacketHandler.register();
DeferredWorkQueue.runLater(() -> {
RegistryEvents.addBiomeTypes();
RegistryEvents.registerBiomesToDictionary();
});
}
@SubscribeEvent
public static void clientSetup(FMLClientSetupEvent event) {
RenderHandler.registerEntityRenders();
RenderHandler.registerBlockRenders();
}
}
i registered the packets on FMLCommonSetup and i get a crash when i use a packet along with this
[19:51:22] [Server thread/ERROR] [ne.mi.fm.ne.NetworkRegistry/NETREGISTRY]: Attempted to register channel morecontent:main even though registry phase is over
"[19:51:22] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
java.lang.ExceptionInInitializerError: null