Started by
Arturinelhuevin
on
Topic category: Help with Minecraft modding (Java Edition)
I'm trying to make an item that summons a random entity of the game (includying my custom mobs, but right now I don't have any).
How can I summon a random entity when I right click the item? And what if I have custom mobs?
Can someone help me, please?
Make an RNG procedure that sets a custom local variable to a random number between 1 and... however many different types of creatures you want the item to be able to summon. Then, make an 'Else If' block that checks if the number is one, and summons whichever creature you assign to one, then checks if the number is two, and if so spawns whichever creature is assigned to two... and so on and so forth.
You can find RNG blocks in the Math tab, and custom variables to the right of the screen when you're designing a procedure. You can also assign a range of numbers for different entities to make some more likely than others- if, for example, the variable is set to a random number 1-30, you could assign any number greater than 0 and less than four to one type of entity, giving it a 10% chance of spawning.
Thanks you so much!
I don't know why I hadn't thought of it before lmao.
And again, thanks for your reply :)
I want to spawn ANY random entity, this would cause me hours of work. is there another way than manually using If, else if, else if, else if, etc.