Started by
RicXhard
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to create a grass block that spreads to nearby dirt blocks, but i dont understand how this works.
If you have any idea of how to help me please reply.
MCreator 1.8.3
Edited by RicXhard on Sat, 10/19/2019 - 22:24
I am almost done with my mod that does a similliar thing, you have to make a procedure determine 13 number variables (3 as temporary X,Y,Z, 3 as minimum X,Y,Z for a radius of spreading, 3 as maximum X,Y,Z for a raduis of spreading and 3 X,Y,Z as the actual radius + 1 variable for a random generation), make so you set the radius variables properly, then the game should randomize a position in a radius. You have to make an "if" statement so only if the block is dirt it will place the "grass" on it. Here comes the temp X,Y,Z part. Well, it's a temporary value randomized from that distance. The game checks first if the block in temp X,Y,Z is dirt. If it is, it places the grass at the temp coords, replacing dirt. About the last "random" variable, it's needed so the dirt won't spread super fast, and basically you add a big "if" statement for if the random number is for example 1 (you should pick a range of randomizing from like 0 to 4 or 3 by making random(0,1) x 3 or 4). Then you have to lock the element, go into the code of the procedure, find the random variable and the definition ((double) variable_name = Math.random(0,1) * 3 (or *4)) and change the "double" to "int" so it won't randomize numbers like 3,141592654 but it will print out 3 instead.
Im trying this out right now.
I'll come back if I have any problem :)