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

Hello

 

I'm here again with more advice requirement than actual coding problem. I'm seeing two major styles on how to define blocks and items:

 

- The first one, also used by Mojang, is to create a "superclass" of desired functionality and every detail write in initialization of blocks and items to static properties.

 

- The other is to ceate a class for every item and block that you need, even if it doesn't have major functionality change. (Like creating cusom class for my *Enter Popukar Material Here* Pickaxe, rather than using ItemPickaxe with custom settings)).

 

So what is the better approach? What is better for scaling and not cluttering your environment? Also don't be shy and let me know which style you are using and why.

 

Many thanks in advance.

I come here to ask only after several hours of struggling, forum browsing and googling. Please be kind :)

It depends mostly on what you wanna do. I had 7 blocks that are used for building only and I don't need to tell which one's which, only the texture differs. So, I just made 7 textures and instantiated the same class 7 times with different setBlockTextureName names. An example of your blocks is required for further help I think

Check out my blog!

http://www.whov.altervista.org

  • Author

Thank you, that's the way I probably will go. I was just curious if there are some used "habits" of some sort for doing that.

I come here to ask only after several hours of struggling, forum browsing and googling. Please be kind :)

It depends mostly on what you wanna do. I had 7 blocks that are used for building only and I don't need to tell which one's which, only the texture differs. So, I just made 7 textures and instantiated the same class 7 times with different setBlockTextureName names. An example of your blocks is required for further help I think

 

Actually you don't even need 7 different block texture names, just use the unlocalized name, and name the texture file that, that's what I do. I have pretty much every block in my mod in a blockHandler class (dont like making and initializing blocks in the main class) And I have a BlockRenderer class for all blocks that just look pretty and have no functionality other than crafting, e.g. metal blocks, ores, decorative blocks etc. Though I do have separate classes for all blocks with function or a tileentity (I would like to know how to have all those blocks in one class too, I know it is possible, I have seen things like mekanism on github, and they have like one main tileentity class, and machines with seperate functionality extend that class, or one main block class and functionality blocks extend it).

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

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.