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

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

 

 

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.

Do you have an example for the color thingy?

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

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.

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.