Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.