Minecraft Data Packs / Game Mechanic

RPG Style Mob Spawner (1.16.5)

  • check_circle Functions
  • 1,021 views, 2 today
  • 20 downloads, 0 today
  • 8
  • 5
  • 1
CultOfHappiness's Avatar CultOfHappiness
Level 50 : Grandmaster Vampire
98
Customisable and invisible spawners!!!!



made in 1.16.5 but can likely be upgraded by changing version number in pack meta.
This datapack uses invisible armour stands to replace vanilla mob spawners, you can customise the radius, the cooldown time and even add your own custom mobs to the list.

To create a spawner: (in console in game)

/summon minecraft:armor_stand ~ ~ ~ {Invisible:1b,Invulnerable:1b,NoGravity:1b,Marker:1b}
then standing next to it:


/tag @e[​distance=..3,type=minecraft:armor_stand] add <mob>

mob names are all lowercase no spaces or _

the default cooldown is 300 seconds (5 minutes) between mobs being spawned, the default activation threshold is 50 blocks

To customise the cooldown open the tick code with visual studio code and find this line:

execute as @e[​scores={cooldown=300..}] run scoreboard players set @s spawns 0 execute as @e[​scores={cooldown=300..}] run scoreboard players set @s cooldown 0

change the 300 to whatever time value (in seconds) you wish to use.

to change the distance parameter open the same code file and search and replace the number 50 with the radius of blocks you desire.

to add a new mob to the list copy this line of code to the end of the tick file:
execute as @e[​type=minecraft:armor_stand,tag=<mob name>,scores={spawns=0}] at @s if entity @e[​type=minecraft:player,distance=..50,] run function cultofmj.mobspawn:<mob name>

then create a new file in the functions file (copy the one named code for a blank one) and paste in this code:
execute as @e[​type=minecraft:armor_stand,tag=<mob name>,scores={spawns=0}] at @s if entity @e[​type=minecraft:player,distance=..50,] run summon minecraft:<mob name>
execute as @e[​type=minecraft:armor_stand,tag=<mob name>] at @s if entity @e[​type=minecraft:<mob name>,distance=..5] run scoreboard players add @s spawns 1
The spawners will spawn one entity every 5 minutes if a player is within 50 blocks, creating the illusion that it has always been there and will respawn after 5 minutes if killed or despawned, similar to how old RPGs and FPS games worked.

let me know if you need any help, please don't redistribute without credit <3

this datapack uses two scoreboards (cooldown and spawns) to keep track of each individual spawner. It also uses tags to decide what entity to spawn.
CompatibilityMinecraft 1.16
Tags

Create an account or sign in to comment.

Esteguarito
02/05/2024 11:21 pm
Level 1 : New Miner
Esteguarito's Avatar
Could you make a video on how to use your datapack?, and how to make it compatible with higher versions
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome