MobZ

MobZ

1M Downloads

Feature Request - Blacklist worlds

xErrorAmelie opened this issue ยท 4 comments

commented

Hey I wanted to request a blacklist function for worlds, because of space dimensions.
MobZ Mobs spawn there all over the world and dying, because of the lack of air, which is a bit broken and annoying :)

I would love to see a function where you can specifiy worlds where no mobz mobs should spawn.

commented

In the source code, I can see the spawn is biome-based rather than world-based, which means the whitelist/blacklist is going to be biome-based. The nether and the end have their own biomes. I guess modded dimensions do something similar.

Up to 1.18.1, there was a BiomeCategory enum used to distinguish between biome types. But since 1.18.2, that enum became deprecated and was succeeded by "Biome Tags". You can find the vanilla tags in net.minecraft.world.level.biome.Biomes and net.minecraft.tags.BiomeTags. Custom and modded biomes also have their own tags.

My proposed solution is to have both a whitelist and a blacklist. In short words, a creature can only spawn in a certain biome if it passes the whitelist and is not blocked by the blacklist. The whitelist will be evaluated first. By default, it only contains one rule that matches everything. Of course, you can modify the rules to match your need. If a spawn item matches any rule in the whitelist, it will be passed to the blacklist for examination. Otherwise, it will be discarded by the whitelist, and the corresponding creature will not spawn. The blacklist works similarly. If a spawn item matches any rule in the blacklist, it will be discarded.

The whitelist/blacklist (json-based) may look like this:

{
    whitelist: [
        {
             {mob: "*", "biome": "*"}
        }
    ],
    blacklist: [
        {
             {mob: "archer", "biome": "nether_wastes"},
             {mob: "archer", "biome": "the_end"}
        }
    ]
}

See also:
https://gist.github.com/TelepathicGrunt/b768ce904baa4598b21c3ca42f137f23

commented

Since 1.19, adding mob spawns in Forge is now data-driven. See: https://github.com/rikka0w0/MobZReborn/tree/main/src/generated/resources/data/mobz/forge/biome_modifier

I'm trying to bring the same feature to the Fabric version, it will parse the same set of Forge-only JSONs and let Fabric API understand them. For 1.18.2 and below, there should be some administrative mod that let you modify mob spawns. Due to my limited available time, I won't be able to bring this feature to 1.18.2 and below. However, PRs are always welcomed.

commented

Do you want to have a look at this mod:
https://www.curseforge.com/minecraft/mc-mods/in-control

commented

I will look into that, thanks!