MobFilter

MobFilter

984 Downloads

BlockId filter is game crash

bakrun opened this issue ยท 5 comments

commented

crash by this code MFRules.java
public String getBlockId() {
final BlockEntity be = serverWorld.getBlockEntity(this.blockPos); // FIXME do we need to check at y+1?
return String.valueOf(Registries.BLOCK_ENTITY_TYPE.getId(be.getType()));
}

unless blockPos like chest, this BlockEntity be is null
so java.lang.NullPointerException: Cannot invoke "net.minecraft.class_2586.method_11017()" because "be" is null and crash game

fix this

        final BlockState be = serverWorld.getBlockState(this.blockPos.down()); // FIXME do we need to check at y+1?
        return String.valueOf(Registries.BLOCK.getId(be.getBlock()));

BlockState not down = air so use down
This will get the block ID as intended

and mobfilter.yaml there is a typo
dimensionId: ['minecraft:nether'] -> dimensionId: ['minecraft:the_nether']

commented

Super. I just pushed out the fix in release 0.2.1+1.19.4.

Thanks a lot for testing it out.

commented

can you try this one and see if it fixes it?

https://github.com/pcal43/mob-filter/releases/tag/blockfix

commented

can you try this one and see if it fixes it?

https://github.com/pcal43/mob-filter/releases/tag/blockfix

game not crash but doesn't work BlockId
Because bs recognizes an air block 1 space above the block where monsters spawn, the block ID is displayed as air.

final BlockState bs = serverWorld.getBlockState(this.blockPos.down(1));

commented