Credits and licence. This project is a derivative of No Mob Spawning on Trees by oldjunyi, which is open source under the MIT License (original source). This version is also MIT, and the original's licence and copyright notice ship inside the jar. The original author is not involved.
How it differs from the original: the original stops at Forge 1.12.2; this one is rewritten for Minecraft 1.21.4 to 26.3 on Fabric and NeoForge. It adds block, mob and biome tags to the rules, fixes three bugs in the original's rule matching (* ranges, daytime after day one, sky light at night), adds /nmsot commands, covers mushroom stems by default, and drops settings for game features that no longer exist. The full list is under "What changed from the original" below.
Runs on: Minecraft 26.3 on Fabric, and 1.21.11, 1.21.10, 1.21.8, 1.21.5 and 1.21.4 on Fabric and on NeoForge. Fabric files need Fabric API. Older versions: the original No Mob Spawning on Trees covers Forge up to 1.12.2. Each file was tested on a real dedicated server, next to a control boot without the mod.
Creepers on your roof, skeletons in the canopy of a jungle tree farm, zombies dropping out of a giant spruce: mobs spawn on logs just like on any other block. With this mod they don't. Out of the box no mob spawns naturally on any log, wood, stem or hyphae block, or on a mushroom block. Everything else spawns as normal.
Drop the jar in mods/ on the server; players install nothing and join with a normal client.
This is a continuation of No Mob Spawning on Trees by oldjunyi (about 25 million CurseForge downloads, last released for 1.12.2 in 2018), ported to current versions with full credit; the original author is not involved. Original project: https://www.curseforge.com/minecraft/mc-mods/no-mob-spawning-on-trees
The rules, config/nmsot/rules.txt
One rule per line, in the original's language. A natural spawn that matches a line is blocked; a line starting with - lets matching spawns through again; later lines win. # starts a comment. Apply changes with /nmsot reload.
- woodlogs: any log, wood, stem or hyphae block. block:minecraft:stone and blocktag:minecraft:leaves for one block or a block tag
- mob:zombie (namespace optional), mobtag:minecraft:skeletons, mobtype:monster (also creature, ambient, water_creature, water_ambient, axolotls, underground_water_creature, misc)
- dim:the_nether (or the old numbers 0, -1, 1), biome:plains, biometag:minecraft:is_forest, biometype:FOREST (read as the tag c:is_forest)
- light:0-7 (the higher of block and sky light at the mob's feet; light:0-7,sky or light:0-7,block), daytime:13000-23000, moonphase:fullmoon (or 0-7), position:,-64-0, (x, y, z of the mob's feet), chance:0.5
- Combine with & (and), | (or), ! (not) and brackets. Example: mobtype:monster & !(dim:the_nether | light:0-3)
Commands for operators: /nmsot help, /nmsot reload, /nmsot rules (the rules in force with their line numbers), and /nmsot test x y z mob, which tells you whether a natural spawn of that mob with its feet there would be blocked, and by which line.
An old config/NoMobSpawningOnTrees.cfg from the original is imported once (its blacklistRules list) when rules.txt does not exist yet.
What changed from the original
- The rules apply to natural spawning, the game's own spawning around players. Spawners, spawn eggs, /summon and the animals placed when a chunk is first generated are not affected
- A rule judges the mob that spawns. A rider that arrives with its mount comes with the mount: on 1.21.11 and 26.3 the test saw about 100 spear-carrying zombies a minute arrive riding a mount while mob:zombie stopped every other zombie (older versions had none). To keep those out too, add a rule for the mount. The original worked the same way (a spider jockey's skeleton came with its spider)
- New words: blocktag:, mobtag:, biometag:, and ids with or without a namespace
- Fixed: * in a range now means any number (a typo in the original made it match nothing); daytime: counts within the day (the original compared the total world time, so ranges only worked on day one); sky light no longer goes below 0 at night
- Removed, each with a warning that names the line: material: (Minecraft has no block materials any more), numeric biome ids, block metadata ranges (ignored), @ spawn-list lines, extraSpawningTries and the spawn capacity settings
- The default list also covers mushroom stems, which became their own block in Minecraft 1.13
What the tests showed on each file, against a control boot where mobs spawned on logs and on grass: with the default rules, thousands of natural spawns in a minute on grass and none on logs; every rule word answered correctly through /nmsot test (blocks, block tags, stripped wood, mushroom stems, mobs, mob tags, the - line, later lines winning, biome, biometype read as c:is_plains, light with and without glowstone beside, daytime at night, at noon and on the second night, moon phase, position inside and outside a box, dim:-1 in the Nether, chance 1 and 0); a reloaded rules file with mob:zombie stopped every natural zombie spawn while other mobs kept spawning and logs opened up again; bad lines were skipped with a warning naming them; an old NoMobSpawningOnTrees.cfg was imported; a player who is not an operator could not use /nmsot. An operator joined with a vanilla-protocol client throughout.
Not tested: singleplayer and a real game client; other people's mods alongside; biomes other than plains, the End.
Compatibility: Minecraft 26.3 (Java 25) with Fabric Loader and Fabric API, and 1.21.4 to 1.21.11 (Java 21) with Fabric Loader and Fabric API or with NeoForge; pick the file for your version and loader. Do not install it next to the original. Licence: MIT.
Found a bug or want a feature? Comment here and I will answer.
More free tools: actuallyop.com

