Created
April 13, 2020 05:44
-
-
Save aikar/edc4fc0fe4d436b35f98a1734d8f7eaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paper start | |
Chunk currentChunk = entity.currentChunk != null ? entity.currentChunk.get() : null; | |
if (currentChunk == this) entity.setCurrentChunk(null); | |
if (this.entitySlices[i].remove(entity)) { | |
if (entitySlices[i] == entity.entitySlice) { | |
entity.entitySlice = null; | |
} else if (entity.entitySlice != null && entity.entitySlice.contains(entity)) { | |
String thisChunkStr = world.getWorld().getName() + ":" + this.loc; | |
ChunkEntitySlice entitySlice = entity.entitySlice; | |
Chunk otherChunk = entitySlice.chunk; | |
String otherChunkStr = otherChunk.world.getWorld().getName() + ":" + otherChunk.loc + " slice " + entitySlice.slice; | |
LOGGER.error("Removed " + entity + " correctly from chunk " + thisChunkStr + | |
" from slice: " + i + " but entitySlice was also in " + otherChunkStr, new Throwable("Failed remove called at")); | |
otherChunk.removeEntity(entity, entitySlice.slice); | |
} | |
entity.inChunk = false; | |
} else if (entity.entitySlice == null) { | |
return; | |
} else { | |
if (entitySlices[i] == entity.entitySlice) { | |
// we should have been here but wasn't | |
entity.entitySlice = null; | |
} | |
String curChunkStr = currentChunk != null ? currentChunk.world.getWorld().getName() + ":" + currentChunk.loc : "no chunk"; | |
String thisChunkStr = world.getWorld().getName() + ":" + this.loc; | |
LOGGER.error("Tried to remove " + entity + " from wrong slice: " + i + " in chunk " + thisChunkStr + | |
", was in slice " + entity.chunkY + " of chunk " + curChunkStr, new Throwable("Failed remove called at")); | |
if (WorldServer.DEBUG_ENTITIES) { | |
if (entity.lastChunkRemove != null) { | |
entity.lastChunkRemove.printStackTrace(); | |
} | |
if (entity.lastChunkAdd != null) { | |
entity.lastChunkAdd.printStackTrace(); | |
} | |
} | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment