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 am a new modder trying to get comfortable with the absolute Forge basics, and I was following some tutorials on how to create a new block, but I encountered two problems while doing so.

 

1:

When i try to use the setBlockName(string) method in my mods main class, Eclipse tells me the method is undefined for the type "Block", while it works fine in the tutorial. This is my code:

 

 

@Init

    public void load(FMLInitializationEvent event) {

        proxy.registerRenderers();

        blockRF = (new RFBlock(538, 0)).setBlockName("nonReadableRFBlockName");

        LanguageRegistry.addName(blockRF, "Rotten Flesh Block");

        MinecraftForge.setBlockHarvestLevel(blockRF, "pickaxe", 1);

        GameRegistry.registerBlock(blockRF, "internalRFBlock");

 

 

2:

The tutorial tells me to add the line "super(par1, par2, Material.rock);" to my block class. However, Eclipse tells me the constructor is undefined, and recommends me to delete the par2 variable. My code:

 

 

public RFBlock(int par1, int par2){

        super(par1, Material.rock);

        this.setCreativeTab(CreativeTabs.tabBlock);

        this.setHardness(5.6F);

        this.setResistance(56.34F);

        this.setStepSound(this.soundStoneFootstep);

    }

 

 

My tutorial link: http://www.minecraftforge.net/wiki/Your_first_block

The Tutorial you're following is outdated.

 

Replace setBlockName with setUnlocalizedName. Regarding the Block constructor, parameter 1 resembles the block's index within the block list while the second provides the Block Material to use. It used to be the texture index of the block, but since that is now managed with Icons, it has been removed.

 

Couldn't find a better tutorial for you and the forge wiki really takes awefully long to load. Sorry.

  • Author

Well, that's useful information. I will look for a better tutorial then. "Thank you" given!

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.