Reika_Mods_Issues icon indicating copy to clipboard operation
Reika_Mods_Issues copied to clipboard

[DragonAPI] PlayerPlaceBlockEvent.fireTryPlac() should not be called, when entityPlayer is null

Open wohaopa opened this issue 1 year ago • 0 comments

Not all placeBlockAt() are executed by the player, so I recommend adding a non-null check before processing such as:

public static boolean fireTryPlace(World world, int x, int y, int z, Block b, int meta, int flags, int side, EntityPlayer ep, ItemStack is) {
    if (ep != null && fire(world, x, y, z, side, b, meta, is, ep))
        return false;
    else
        return world.setBlock(x, y, z, b, meta, flags);
}

code

wohaopa avatar Sep 15 '23 04:09 wohaopa