mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-30 21:17:53 +01:00
More style
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
b5062ab4d6
commit
42f4678db0
@ -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
|
||||
|
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user