Jump to content

Recommended Posts

Posted

So, I'm trying to create a custom block that is effected by gravity and can be colored.  I've got the gravity part down, I just extended BlockFalling.  I looked at BlockColored and copied the body, renamed the variables that I knew what they were doing for easier reference, and created the appropriate textures for the block

 

 

  Reveal hidden contents

 

 

Only things I didn't rename were func_150032_b and func_150031_c, as I have no idea what they are doing.

 

I haven't done anything special while registering the block (Which may be where the problem is).  I created a simple little dirt to custom block with metavalue 2 to see if it works.  The block looks fine in inventory, but when I place it, it renders the neutral texture.  I get the colored texture back when I break it.  I'm guessing that somehow I have to pass the meta value on to the block, but I have no idea how, or if I should register it in some way to recognize the meta value from inventory.

 

I'm sure this is an uber noobish question, but I'm stuck :-/

 

[edit]  Okay.  So I figured out I need another class extending ItemBlockWithMetaData. 

 

 

  Reveal hidden contents

 

 

I register in PreInit with: GameRegistry.registerBlock(blockSugarCrystals, ItemBlockSugarCrystals.class, blockSugarCrystals.getUnlocalizedName());

 

Now the game crashes, probably because I'm registering wrong :-/

 

Just in case, though

 

Crash Report

 

  Reveal hidden contents

 

 

[edit again] Okay.  Digging around I found out that the problem was that the compiler was looking for a Block argument in the constructor.  I changed it to the following and it works like a dream:

 

 

  Reveal hidden contents

 

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.