This mod allows you to prevent mobs from being spawned.
In this mod, I created these conditions.
You can make own rule by combining the conditions.
Rules can be added/removed via command.
To change the number of mobs spawned from default Monster Spawner, execute this(1.18 only)
To change the limit of numbers of mobs which can newly spawn, execute this.
These are the default values in vanilla.
To add rules, make data pack. In the data pack, create "limit-mob-spawn" directory and place rule file(json) in the dir. See Official Wiki for more detail of data pack.
datapacks in each world
└─pack.mcdata
└─data
└─(name space)
└─limitmobspawn
└─demo1.json
└─other rule files
Follow these link to see example rules.
1.16.5: this
1.17.1: this
1.19.2 Example Datapack
See this page for change log.