Block color changin depending on its height

Started by geni_o_o_ on

Topic category: Help with modding (Java Edition)

Last seen on 12:26, 11. Apr 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Block color changin depending on its height
Sun, 04/02/2023 - 16:20 (edited)

Is there any way to make a block change color depending on its height ?
Like a procedure that sets the tint to another color when its at a certain height, idk.

I use MCreator 2023.1 and its a 1.19.2 Mod
I would love to get some help

 

Edited by geni_o_o_ on Sun, 04/02/2023 - 16:20
Last seen on 19:37, 27. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, this procedure can work…
Sat, 04/01/2023 - 13:51

Yes, this procedure can work. You need to create one bloc for each color your bloc (I call basic_bloc) can have. When the player destroy one of these blocs (I call bloc_color[number]), they have to drop the basic_bloc.

Than, wrote this procedure (I'm french, some translations can be wrong)
number 1, number 2 etc... are numbers like 10, 20 etc... You can place what you want. I my procedure, number 1 is smaller than number 2, number 2  is smaller than number 3 etc...

When [bloc] placed
Remove [basic_bloc] at [x] [y] [z]
if [y] > [obtain world surface height at [x] [z]] and [y] < ([obtain world surface height at [x] [z]] + [number 1])
	place [bloc_color1] at [x] [y] [z]
else if [y] > ([obtain world surface height at [x] [z]] + [number 1]) and [y] < ([obtain world surface height at [x] [z]] + [number 2])
	place [bloc_color2] at [x] [y] [z]
else if [y] > ([obtain world surface height at [x] [z]] + [number 2]) and [y] < ([obtain world surface height at [x] [z]] + [number 3])
	place [bloc_color3] at [x] [y] [z]
	
	etc...
Last seen on 12:26, 11. Apr 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks! @TheDragon'sSon I…
Sat, 04/01/2023 - 13:56

Thanks! @TheDragon'sSon I will try that!

 

Last seen on 19:37, 27. Apr 2024
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hope it will work, and tell…
Sun, 04/02/2023 - 06:07

Hope it will work, and tell me if something didn't work

Last seen on 12:26, 11. Apr 2023
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I didn't try it, but I used…
Sun, 04/02/2023 - 09:48

I didn't try it, but I used it in a way you told me.
I just added a few blocks with different colors and then use them in that way.

Thanks for your help!