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

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.

  • Author

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.

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.

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.