More style

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-11 06:13:48 +02:00
parent b5062ab4d6
commit 42f4678db0
2 changed files with 7 additions and 9 deletions

View File

@ -104,18 +104,17 @@ public class DynamicChunk extends Chunk {
@Override
public @Nullable Block getBlock(int x, int y, int z, @NotNull Condition condition) {
// Verify if the block object is present
final var entry = !entries.isEmpty() ?
final Block entry = !entries.isEmpty() ?
entries.get(ChunkUtils.getBlockIndex(x, y, z)) : null;
if (entry != null || condition == Condition.CACHED) {
return entry;
}
// Retrieve the block from state id
final Section section = getOptionalSection(y);
if (section == null)
return Block.AIR;
if (section == null) return Block.AIR; // Section is unloaded
final short blockStateId = section.getBlockAt(x, y, z);
return blockStateId > 0 ?
Objects.requireNonNullElse(Block.fromStateId(blockStateId), Block.AIR) : Block.AIR;
if (blockStateId == -1) return Block.AIR; // Section is empty
return Objects.requireNonNullElse(Block.fromStateId(blockStateId), Block.AIR);
}
@Override

View File

@ -129,16 +129,15 @@ public abstract class ThreadProvider {
final ReentrantLock lock = thread.getLock();
lock.lock();
for (var chunkEntry : chunkEntries) {
for (ChunkEntry chunkEntry : chunkEntries) {
final Chunk chunk = chunkEntry.chunk;
if (!ChunkUtils.isLoaded(chunk))
return;
if (!ChunkUtils.isLoaded(chunk)) return;
try {
chunk.tick(time);
} catch (Throwable e) {
MinecraftServer.getExceptionManager().handleException(e);
}
final var entities = chunkEntry.entities;
final List<Entity> entities = chunkEntry.entities;
if (!entities.isEmpty()) {
for (Entity entity : entities) {
if (lock.hasQueuedThreads()) {