Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED] Problem with Setting Block Material


TheRedMezek
 Share

Recommended Posts

I have a block class that extends BlockFurnace, and its constructor starts as follows:

 

public MyBlock(boolean isBurning){

        super(Material.rock);

 

Material.rock is underlined red, and when I mouse over it it tells me this:

 

BlockFurnace (boolean) in BlockFurnace cannot be applied to (net.minecraft.block.material.Material)

 

This confuses me greatly, as this is basically the same code as the actual BlockFurnace constructor (except that one is protected rather than public, but changing that doesn't fix the problem). The rest of the constructor works just fine and doesn't crash the game or anything. Please help me figure out what's going on and how to fix it!

 

EDIT: Actually it does crash when compiling, telling me this:

 

warning: [options] bootstrap class path not set in conjunction with -source 1.6

[filepath]MyBlock.java:55: error: incompatible types: Material cannot be converted to boolean

        super(Material.rock);

                      ^

 

EDIT2: I replaced Material.rock with true and now it's happy. Is there some other way I can set the material, or whether or not it requires a tool?

Link to comment
Share on other sites

this.blockMaterial=Material.*

after the super.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

If you just want the material to be rock, nothing needs to be done. You're extending BlockFurnace which already passed Material.rock as its material.

 

EDIT: This is also the reason why you get that error. blockMaterial, which is final, has already been assigned by BlockFurnace.

Link to comment
Share on other sites

You could use reflection. But why are you extending BlockFurnace anyways? That to me sounds like a bad idea.

I don't know what reflection is. I'm extending it because the block I'm making is basically a furnace, and I didn't want to copy-paste or recreate its functionality. Why is extending it a bad idea?

Link to comment
Share on other sites

The same thing BlockFurnace extends?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.