Jump to content

Block With Given ID Does Not Exist - Minecraft Mod


xtremegamer

Recommended Posts

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

Link to comment
Share on other sites

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. =)

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.