mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
Cleanup
This commit is contained in:
parent
e25f521253
commit
7032645c63
@ -86,8 +86,7 @@ public class DynamicChunk extends Chunk {
|
|||||||
this.nbtMap.remove(index);
|
this.nbtMap.remove(index);
|
||||||
}
|
}
|
||||||
// Tickable
|
// Tickable
|
||||||
final boolean tickable = handler != null && handler.isTickable();
|
if (handler != null && handler.isTickable()) {
|
||||||
if (tickable) {
|
|
||||||
this.tickableMap.put(index, handler);
|
this.tickableMap.put(index, handler);
|
||||||
} else {
|
} else {
|
||||||
this.tickableMap.remove(index);
|
this.tickableMap.remove(index);
|
||||||
@ -106,15 +105,19 @@ public class DynamicChunk extends Chunk {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(long time) {
|
public void tick(long time) {
|
||||||
this.tickableMap.forEach((index, handler) -> {
|
if (tickableMap.isEmpty())
|
||||||
|
return;
|
||||||
|
for (var entry : tickableMap.int2ObjectEntrySet()) {
|
||||||
|
final int index = entry.getIntKey();
|
||||||
|
|
||||||
final byte x = ChunkUtils.blockIndexToChunkPositionX(index);
|
final byte x = ChunkUtils.blockIndexToChunkPositionX(index);
|
||||||
final short y = ChunkUtils.blockIndexToChunkPositionY(index);
|
final short y = ChunkUtils.blockIndexToChunkPositionY(index);
|
||||||
final byte z = ChunkUtils.blockIndexToChunkPositionZ(index);
|
final byte z = ChunkUtils.blockIndexToChunkPositionZ(index);
|
||||||
final BlockPosition blockPosition = new BlockPosition(x, y, z);
|
final BlockPosition blockPosition = new BlockPosition(x, y, z);
|
||||||
|
|
||||||
final Block block = getBlock(blockPosition);
|
final Block block = getBlock(blockPosition);
|
||||||
handler.tick(BlockHandler.Tick.from(block, instance, blockPosition));
|
entry.getValue().tick(BlockHandler.Tick.from(block, instance, blockPosition));
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user