Ensure we actually removed entity from chunk before decrementing counts
If a plugin hacks into NMS and triggers entity removal, it could result in an entity being attempted to remove from the chunk twice. The 2nd pass will return false, as it did not find the entity in the list. We should not touch entity counts if the entity was not removed, to avoid going negative.
This commit is contained in:
@@ -120,6 +120,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return new Location(entity.getWorld().getWorld(), entity.locX, entity.locY, entity.locZ);
|
||||
+ }
|
||||
+
|
||||
+ public static BlockPosition toBlockPosition(Location loc) {
|
||||
+ return new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isEdgeOfChunk(BlockPosition pos) {
|
||||
+ final int modX = pos.getX() & 15;
|
||||
+ final int modZ = pos.getZ() & 15;
|
||||
|
||||
Reference in New Issue
Block a user