Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2]How to make a blockstate for changing texture of block


Megaton_216_
 Share

Recommended Posts

I want to make it so that when I right-click on a block, it changes the texture of the block. There will be more than two textures that will be cycled through and I want to know how to make a blockstate for something like this. Or if there's an existing one that works for this or something it would be a big help.

Link to comment
Share on other sites

Have you tried looking at vanilla blocks that have similar behaviour? For example the redstone lamp, that change its texture based on its state (lit = false/true), or the respawn anchor (1.16) that has 5 possible different states depending on its charge. Keep in mind that the number of states a block can assume is limited. For anything that could exceed that limit you will need a tile entity.

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

4 minutes ago, diesieben07 said:

Look at how vanilla makes block states use different models, (e.g. look at FenceBlock).

I dont want the blockstate to be dependent on direction.

4 minutes ago, Beethoven92 said:

Have you tried looking at vanilla blocks that have similar behaviour? For example the redstone lamp, that change its texture based on its state (lit = false/true), or the respawn anchor (1.16) that has 5 possible different states depending on its charge. Keep in mind that the number of states a block can assume is limited. For anything that could exceed that limit you will need a tile entity.

Yeah I think NOTE_0_24 which is for the different note pitches is most like what im trying to do. It has multiple states that cycle. I just dont know how it affects the note color and I think that would be what I need.

Link to comment
Share on other sites

1 minute ago, Megaton_216_ said:

I dont want the blockstate to be dependent on direction.

Okay...?

 

1 minute ago, Megaton_216_ said:

Yeah I think NOTE_0_24 which is for the different note pitches is most like what im trying to do. It has multiple states that cycle. I just dont know how it affects the note color and I think that would be what I need.

The note color here has nothing to do with the block model.

You need a different model per block state, which is exactly what the fence does.

Link to comment
Share on other sites

7 minutes ago, diesieben07 said:

The note color here has nothing to do with the block model.

You need a different model per block state, which is exactly what the fence does.

Ok I know I need a different model but I don't understand why the fence would be a good reference. It does change the model but I dont think the directional boolean properties help since all my block would do is depend on if the player right-clicked.

Link to comment
Share on other sites

It shows the idea of multiple block states having a different model each.

How the block state is changed is not really relevant, it should be very obvious on how to achieve that in right clicking.

There are many blocks in vanilla that handle right clicking, which you can look at for reference. Don't expect to find everything ready to copy-paste. You need to use your brain and look for the parts that you need.

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.