Started by
dasMeisterhafte
on
Topic category: Help with Minecraft modding (Java Edition)
I recently wanted to create a mod that spawns a random mob when a certain action is done. Unfortunatly I dont think there is a way to that with things like element tags or ingame commands. I also looked online and found no help. Does anybody know a way to it faster than just if chains? If so please tell me.
Hi,
There is currently no direct Blockly editor block for a random entity in MCreator, therefore If chains are the standard solution for a small amount of mobs.
Another way would be custom code where you could use a list/array. This is indeed a feature which might be a good idea for future updates.
I still use if statements to this day. If you're interested, here's a typical structure:
Local variable = random number from 1 to (your number of mobs)
If local var = 1 then spawn mob 1
else if local var = 2 then spawn mob 2
else if local var = 3 then spawn mob 3
etc.
It involves a lot of copy-pasting, but I guess it's the only solution without custom code.
Aaaand I am pretty sure you are not coming far with entity tags and cmds.
A lot of useless information, I know, sorry, but unfortunately I don't think there's a better solution at the moment.