Jump to content

[SOLVED] [1.10.2] Best way for tons of items / blocks?


Zootaxz

Recommended Posts

Hey,

 

What is the best way to create "tons" of same items / blocks with different names/colors?

 

Example:

Ingots, Dusts, Plates and so on have always the same texture, but another color - Currently ~ 23 different ingots, and in my project 23 different json files and 23 different textures. The same for dust, 23 different dusts > 23 json's > 23 dust textures.

 

Is this the way i "should" do it?

 

I tried something with 1 texture for each base (ingot, dust, plate) and pass the color in constructor for the different classes. The problems were:

1. To use only one json i need the same name for all ingots!?

2. How i can apply the color, i saved in the item class, to the texture?

 

I dont think this is the right way, i read something about "Blockstates" for Blocks and MetaData(Damage) for Items, but with the blockstates for blocks i need all textures, too, or not?

I tried something and reduces my 10 blockstate.json, 10 block.json, 10 itemblock.json and 10 block.png to 1 blockstate.json, 10 block.json, 10 itemblock.json, 10 block.png. A small reduce of files.. i think i did it wrong!

And for the items, i need the same amount of json files and textures as before.

 

I hope someone can comprehend my problem.

 

The writing of the json files and textures is not the problem (wrote a util class which do it automatically for me), but the amount of files is in my mind not the best way.

 

Thanks :)

 

 

Link to comment
Share on other sites

I'd recommend creating an enum to describe the possible metal types, storing the metadata, name and colour of each one (as well as any other required properties).

 

Create a single

Item

for each metal form (ingot, dust, plate, etc.), using the metadata to store the metal type.

 

Create a singe

Block

per 16 metal types and metal form (ore, block, etc.), using a

PropertyEnum

to store the metal type. Look at

BlockOldLog

and

BlockNewLog

to see how vanilla does something similar (one enum across multiple

Block

s).

 

Map each

Block

and

Item

(including

ItemBlock

) to a single model with the appropriate texture, then register an

IBlockColor

/

IItemColor

implementation for each one that uses the colour from the metal type enum.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Do you have an example for the color thingy?

I don't have any examples of this specific case, but I do have some examples of

IBlockColor

/

IItemColor

implementation and registration here. This class gets called in init.

 

I already do this with enums and metadata for my ores and ingots usw. but didnt know about the method for using one model.

 

For the block models, use

StateMap.Builder

to create an

IStateMapper

implementation that ignores the

IBlockState

and maps to a single blockstates file and variant and register it with

ModelLoader.setCustomStateMapper

.

 

For the item models, create an

ItemMeshDefinition

that ignores the metadata and maps to a single

ModelResourceLocation

and register it with

ModelLoader.setCustomMeshDefinition

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.