Posted October 17, 201311 yr I have tried to make my own Minecraft Block using Forge, but for some reason, when I use /give Playerxxx 1000 1 the game says, There is no block with id '1000' My Block Code: package net.minecraft.blockr; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class Basalt extends Block { public Basalt(int par1, Material par2Material) { super(par1, par2Material); this.setCreativeTab(CreativeTabs.tabBlock); } } Mod code: package net.minecraft.blockr; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @Mod(modid="blockr", name="Blockr Mod", version="PreAlpha v0.0.1") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class BlockrMod { public static Block basalt; @Init public void load() { basalt = new Basalt(1000, Material.ground).setUnlocalizedName("basalt"); GameRegistry.registerBlock(basalt, basalt.getUnlocalizedName()); LanguageRegistry.addName(basalt, "Basalt Block"); } public String getVersion() { return "0.0.1"; } } What exactly is going wrong? My package is blockr (as my mod is called blockr) I know my mod was loaded as I see in Forge under Mods I see my mod
October 17, 201311 yr Hello, Don't use @Init because it as been deprecated, meaning that there is a better version of it now. 1. Instead of @Init Substitute it with @EventHandler 2. Since you are now using the an EventHandler, you have to give your 'load' method a loading event. Generally, for initializing your blocks, items, and such you want to use a PreIntializationEvent, so ... Replace public void load() With public void load(FMLPreInitializationEvent event) The rest of the code can remain the same. You can use this parameter later for other purposes, but for now, this allows Forge to initialize your blocks at the proper time. Hope this helps. =)
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.