Jump to content

Two problems while creating a block


Therion

Recommended Posts

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

Link to comment
Share on other sites

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.

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.