How to spawn mobs randomly using Minecraft commands?

How to spawn mobs randomly using Minecraft commands? - Crop hacker silhouette typing on computer keyboard while hacking system

I've downloaded a mod that lets me add the allay, copper golem and glare to Minecraft. They can be spawned using spawn eggs and commands. But they cannot spawn randomly naturally. I want these mobs to spawn randomly at different places only on random intervals.

I've not yet tried anything as I'm not good with commands. The mod is a forge mod with the Minecraft version being 1.16.5. I want the mobs to spawn randomly using commands or command blocks.



Best Answer

You can setup a command block to spawn them in specific locations, assuming you have the mobs ID (for example Minecraft:cow). But having them spawn randomly using the current datapack is not possible.

Now if you want to use command blocks, you could, theoretically spawn them at random places in loaded chunks, but I'm no expert at command blocks. You can spawn them in specific locations using /summon (mob id) (X-Y-Z) Replace the "(mob id)' and the "(X-Y-Z)" with the mob id and the coordinates you want to spawn the mob in. Your current coordinates can be seen using f3.

Now for the random intervals. You could use a chicken randomizer. to build this have a cage for a chicken, preferably 1x2. Have a pressure plate on one of the blocks and a chicken on the other. This pressure plate should power the command block that summons your mob. Note that this randomizer should be build at the spawn chunks, to find these die after breaking your bed, the chunks you spawn in should be the spawn chunks.

I hope this helps.




Pictures about "How to spawn mobs randomly using Minecraft commands?"

How to spawn mobs randomly using Minecraft commands? - From above of crop anonymous male hacker typing on netbook with data on screen while sitting at desk
How to spawn mobs randomly using Minecraft commands? - Student Taking Photo of the Test Paper
How to spawn mobs randomly using Minecraft commands? - From below of ethnic boy in hoodie controlling robot using panel while standing in light room



Can you spawn mobs with commands?

You can summon an entity (or mob) whenever you want using the /summon command in Minecraft.

How do you automatically spawn zombies in Minecraft?

In creative mode, click on the compass tab in your inventory, and scroll towards the bottom. You should see some "Spawn Eggs" with which you can use to spawn monsters; just right click a block while holding a spawn egg.

What is the command to spawn mobs in creative mode?

Disabling all monsters Minecraft Bedrock Edition players can edit their world settings under \u201cGame\u201d and uncheck the box next to \u201cMob Spawning.\u201d Java Edition players can type \u201c/gamerule doMobSpawning false\u201d into the chat bar to disable mobs. You'll need to be a server admin and have cheats enabled.



How to Create Random Mob Spawning In Minecraft




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Anete Lusina, Sora Shimazaki, RODNAE Productions, Vanessa Loring