Dark Utilities

Dark Utilities

93M Downloads

Hostile mob filter allows incorrect mobs to pass through.

TheDarkFlame opened this issue ยท 3 comments

commented

https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.18.2/net/minecraft/world/entity/MobCategory.html

I've been playing with minecolonies mod and noticed that citizens there follow rules for hostile filters as if they are hostile. This is because they are created as a MobCategory.CREATURE
I see that you are filtering based on Mob and MobCategoryMobType. It might be helpful to add in extra filters based on the MobCategory entity, specifically, CREATURE and MONSTER.

commented

Hello, the hostile filter does not appear to check mob categories at all? Originally this code checked for the MonsterEntity interface level class marker. In the 1.18.2 port we moved over to Mojang's official class mappings and it looks like this code was incorrectly updated to check for Mob when it should be checking for the Enemy marker interface. This should mean that the filter has a bug that would allow most mobs through such as horses and fish as well?

commented

Apologies, meant that your filter is using Mob and MobType (not MobCategory).

I'm not running the latest build, but this bug exists in the version I am running (13.1.6), and source code suggests no changes since then.

In testing to confirm, I was able to push a sheep through the filter.

Also might be nice to add a custom entity selection, although that may require a bit more work...

commented

Thanks for letting me know. This has been corrected for 1.18.2 and 1.19.2 on both Forge and Fabric.