Posted April 17, 20205 yr Hey guys, sometimes when I add new blocks to my game it crashes, here is the log crash-2020-04-17_12.06.06-client.txt
April 17, 20205 yr Show your code for creating and registering your BlockItems, they seem to be missing actual blocks. I'm eager to learn and am prone to mistakes. Don't hesitate to tell me how I can improve.
April 17, 20205 yr Author This is my BlockInit class where I register Blocks and BlockItems package com.Andrew.Realism.init; import com.Andrew.Realism.RealismMod; import com.Andrew.Realism.RealismMod.Realism; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.Item.Properties; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; import net.minecraftforge.registries.ObjectHolder; @ObjectHolder(RealismMod.MOD_ID) @Mod.EventBusSubscriber(modid = RealismMod.MOD_ID, bus = Bus.MOD) public class BlockInit { // Diamond Ores public static final Block ore_red_diamond = null; public static final Block ore_blue_diamond = null; public static final Block ore_green_diamond = null; public static final Block ore_yellow_diamond = null; public static final Block ore_orange_diamond = null; public static final Block ore_pink_diamond = null; public static final Block ore_purple_diamond = null; //Other Ores public static final Block ore_ruby = null; public static final Block ore_sapphire = null; public static final Block ore_steel = null; public static final Block ore_titanium = null; public static final Block ore_vanadium = null; public static final Block ore_ameythest = null; @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { //Diamond Ores event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_red_diamond")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_blue_diamond")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_green_diamond")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_yellow_diamond")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_orange_diamond")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_pink_diamond")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_purple_diamond")); //Other Ores event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_ruby")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2).sound(SoundType.METAL)).setRegistryName("ore_sapphire")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(1).sound(SoundType.METAL)).setRegistryName("ore_steel")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(4.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(3).sound(SoundType.METAL)).setRegistryName("ore_titanium")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(4.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(3).sound(SoundType.METAL)).setRegistryName("ore_vanadium")); event.getRegistry().register(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 2.5F).harvestTool(ToolType.PICKAXE).harvestLevel(3).sound(SoundType.METAL)).setRegistryName("ore_amyethest")); //Diamond Blocks } @SubscribeEvent public static void registerBlockitems(final RegistryEvent.Register<Item> event) { //Diamond Ores event.getRegistry().register(new BlockItem(ore_red_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_red_diamond")); event.getRegistry().register(new BlockItem(ore_blue_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_blue_diamond")); event.getRegistry().register(new BlockItem(ore_green_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_green_diamond")); event.getRegistry().register(new BlockItem(ore_yellow_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_yellow_diamond")); event.getRegistry().register(new BlockItem(ore_orange_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_orange_diamond")); event.getRegistry().register(new BlockItem(ore_pink_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_pink_diamond")); event.getRegistry().register(new BlockItem(ore_purple_diamond, new Item.Properties().group(Realism.instance)).setRegistryName("ore_purple_diamond")); //Other Ores event.getRegistry().register(new BlockItem(ore_ruby, new Item.Properties().group(Realism.instance)).setRegistryName("ore_ruby")); event.getRegistry().register(new BlockItem(ore_sapphire, new Item.Properties().group(Realism.instance)).setRegistryName("ore_sapphire")); event.getRegistry().register(new BlockItem(ore_steel, new Item.Properties().group(Realism.instance)).setRegistryName("ore_steel")); event.getRegistry().register(new BlockItem(ore_titanium, new Item.Properties().group(Realism.instance)).setRegistryName("ore_titanium")); event.getRegistry().register(new BlockItem(ore_vanadium, new Item.Properties().group(Realism.instance)).setRegistryName("ore_vanadium")); event.getRegistry().register(new BlockItem(ore_ameythest, new Item.Properties().group(Realism.instance)).setRegistryName("ore_amyethest")); //Diamond Blocks } }
April 17, 20205 yr Author I've been looking at it I had a naming convention wrong betwen the Block and Block Item, Everything seems to work now
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.