pcal43 / mob-filter

Minecraft mod for controlling what mobs can spawn where
https://www.curseforge.com/minecraft/mc-mods/mob-filter
Apache License 2.0
8 stars 3 forks source link

[1.18.2] BiomeCheck always returns null #10

Closed Seceroth closed 2 years ago

Seceroth commented 2 years ago

I'm trying to deny all mobs except Enderman from spawning in the Warped Forest biome. This is my config:

rules:

  - name: Allow Enderman in Warped Forest
    what: ALLOW_SPAWN
    when:
      entityId  : ['minecraft:enderman']
      biomeId   : ['minecraft:warped_forest']

  - name: Deny all other mobs in Warped Forest
    what: DISALLOW_SPAWN
    when:
      spawnGroup: [MONSTER, CREATURE, WATER_CREATURE, AMBIENT, MISC, WATER_AMBIENT]
      biomeId   : ['minecraft:warped_forest']

And this is what appears in the server log when using TRACE level logging:

[21:59:14] [Server thread/TRACE]: [MobFilter] IS_SPAWN_ALLOWED SpawnRequest[serverWorld=ServerLevel[world], spawnGroup=MONSTER, structureAccessor=net.minecraft.class_5138@2cef6179, chunkGenerator=net.minecraft.class_3754@749112d5, spawnEntry=doom:chaingunner*(1-4):14, blockPos=class_2339{x=-291, y=49, z=-776}, squaredDistance=2351.2637847793617, logger=net.pcal.mobfilter.MFService:TRACE in 12843fce]
[21:59:14] [Server thread/TRACE]: [MobFilter]   RULE 'Allow Enderman in Warped Forest'
[21:59:14] [Server thread/TRACE]: [MobFilter]     EntityNameCheck doom:chaingunner in [minecraft:enderman] false
[21:59:14] [Server thread/TRACE]: [MobFilter]   RULE 'Deny all other mobs in Warped Forest'
[21:59:14] [Server thread/TRACE]: [MobFilter]     SpawnGroupCheck: [MONSTER, CREATURE, AMBIENT, WATER_CREATURE, WATER_AMBIENT, MISC] MONSTER true true
[21:59:14] [Server thread/TRACE]: [MobFilter]     BiomeCheck null in [minecraft:warped_forest] false
[21:59:14] [Server thread/TRACE]: [MobFilter]   RETURN true (no rules matched)
[21:59:14] [Server thread/TRACE]: [MobFilter] ALLOW doom:chaingunner at [-291, 49, -776]
[21:59:14] [Server thread/TRACE]: [MobFilter] IS_SPAWN_ALLOWED SpawnRequest[serverWorld=ServerLevel[world], spawnGroup=MONSTER, structureAccessor=net.minecraft.class_5138@2cef6179, chunkGenerator=net.minecraft.class_3754@749112d5, spawnEntry=minecraft:magma_cube*(4-4):40, blockPos=class_2339{x=-232, y=72, z=-816}, squaredDistance=2499.48104878852, logger=net.pcal.mobfilter.MFService:TRACE in 12843fce]
[21:59:14] [Server thread/TRACE]: [MobFilter]   RULE 'Allow Enderman in Warped Forest'
[21:59:14] [Server thread/TRACE]: [MobFilter]     EntityNameCheck minecraft:magma_cube in [minecraft:enderman] false
[21:59:14] [Server thread/TRACE]: [MobFilter]   RULE 'Deny all other mobs in Warped Forest'
[21:59:14] [Server thread/TRACE]: [MobFilter]     SpawnGroupCheck: [MONSTER, CREATURE, AMBIENT, WATER_CREATURE, WATER_AMBIENT, MISC] MONSTER true true
[21:59:14] [Server thread/TRACE]: [MobFilter]     BiomeCheck null in [minecraft:warped_forest] false
[21:59:14] [Server thread/TRACE]: [MobFilter]   RETURN true (no rules matched)
[21:59:14] [Server thread/TRACE]: [MobFilter] ALLOW minecraft:magma_cube at [-232, 72, -816]

It seems the problem is that the biome check always fails, always allowing the spawn to happen. I added this mod to the AQM2 modpack, so there are other mods loaded.

pcal43 commented 2 years ago

Thanks for the detailed report. It's a legit bug, will try to get a fix out.

pcal43 commented 2 years ago

could you do me a favor and test whether this fixes it for you?

https://github.com/pcal43/mob-filter/releases/download/0.1.0-prerelease/mobfilter-0.1.0+1.18.2-biomefix.jar

pcal43 commented 2 years ago

should be fixed in 0.0.5

Seceroth commented 2 years ago

Can confirm the fix works, thanks :)