Jump to content

[1.8] Handling Color variations of blocks


Durand1w

Recommended Posts

I currently have a 1.8 mod that has working slabs for all the colors of the existing hardened stained clay blocks.  I am wondering if there are any suggestions on a better way to handle the class creation and block state files for color variations of blocks?  Right now the mod has an Item, Slab, Half Slab and Double Slab class for each color which is 4 classes x 16 blocks.  I also have a large mass of asset files for the rending. 

 

I could simply copy the same code to create the planned stained glass slabs, but wanted to see if there are any recommended approaches or suggestions.  Thanks for any insight.

Link to comment
Share on other sites

Why do you even have class-per block?

 

To have block instance you don't need whole damn class for it.

 

Suggestion:

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe03_block_variants

Have one block with metadata, if not even 1 block, still - ONE class. Not milions.

 

Better suggestion:

You kinda seem like you don't know how to properly use java. I mean - class-per-instance is either bad design or lack of knowlegde. Therefore - consider reading more on it.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Thank you for the link.  Honestly, it is bad design.  The good news is I'm aware of it, the bad news is the reasoning below.

 

I have tried to avoid using metadata outside of the absolute need for it to create slab/double slabs.  During upgrades you can still manually edit the level.dat if there are block id issues, which I had to perform for the last 1.6 to 1.7 update to keep our world from Beta.  Metadata isn't as easily editted outside of entities and storage.  I'm also not concerned with the maximum block limit as that has continued to increase over time.

 

 

To your point, it is the use of instances where I'm lacking.  16x4 classes + 16x5 rendering files for a single set of colored blocks isn't sustainable over the long run if you want to do more than one set, so I have the need to find a better way.

Link to comment
Share on other sites

I

Since 1.7.X, block IDs no longer exist, so you dont need to worry about ID conflicts anymore! So you should be able to use metadata.

This is not true. Block IDs exist just like before. They are just assigned dynamically.

I thought the same thing! A couple people told me that they were removed, and I didn't understand because I can still access IDs in my IDE.

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.