Fix string operation when switching an entity chunk

This commit is contained in:
TheMode 2021-07-21 08:12:03 +02:00
parent 60e22e9df8
commit 953d84add7

View File

@ -652,9 +652,8 @@ public abstract class Instance implements BlockGetter, BlockSetter, Tickable, Ta
*/
@ApiStatus.Internal
public void UNSAFE_addEntityToChunk(@NotNull Entity entity, @NotNull Chunk chunk) {
Check.notNull(chunk,
"The chunk " + chunk + " is not loaded, you can make it automatic by using Instance#enableAutoChunkLoad(true)");
Check.argCondition(!chunk.isLoaded(), "Chunk " + chunk + " has been unloaded previously");
Check.notNull(chunk, "The chunk {0} is not loaded, you can make it automatic by using Instance#enableAutoChunkLoad(true)", chunk);
Check.argCondition(!chunk.isLoaded(), "Chunk {0} has been unloaded previously", chunk);
final long chunkIndex = ChunkUtils.getChunkIndex(chunk.getChunkX(), chunk.getChunkZ());
synchronized (entitiesLock) {
Set<Entity> entities = getEntitiesInChunk(chunkIndex);