Topic category: Help with Minecraft modding (Java Edition)
The question is: I want to make a mod that adds skins to the mobs, every time a mob appears there a possibility that has a skin, I will use a pig as an example:
normal pig, gold pig, devil pig and ender pig
When a pig appears, you choose if it will be changed or not, if you choose that it will be changed, it will be changed
Here I have the first problem, the procedure "detect if there an entity in X Y Z in a cube 1 type pig" works?
The second and most important thing for me, how do I make the apparition work? you could use "if random 0.1 ≥ 0.5
do: despawn current entity spawn gold pig "
but that has a problem, I must put if that happens and also if not if, and that is the problem, the pig that is lower will be the least likely to appear, the simplest solution is to put that a variable is set to random 0 , 1 x 10 to be a complete number, the problem is that it will only be from 1 to 9 and when I have more than 9 pigs it will not work, any solution?
Instead of searching for the mob inside of the area, do it on the entity tick update.
I understand what you mean, but I can't edit a vanilla pig, my idea is that when one appears, the change happens
I guess you can use the procedure "when an entity is generated" and put that if a pig is detected in XYZ with a block of 1 make the change
my main problem is randomness