Jump to content

[1.7.10] Items and Blocks creation advice / discussion


Recommended Posts

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 :)

Posted

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

Posted

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 :)

Posted

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

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