mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Nitpicking
This commit is contained in:
parent
722b04cbce
commit
690b5bff57
@ -100,19 +100,14 @@ public class DynamicChunk extends Chunk {
|
||||
// Verify if the block object is present
|
||||
final var entry = !entries.isEmpty() ?
|
||||
entries.get(ChunkUtils.getBlockIndex(x, y, z)) : null;
|
||||
if (entry != null) {
|
||||
if (entry != null || condition == Condition.CACHED) {
|
||||
return entry;
|
||||
}
|
||||
if (condition != Condition.NONE) {
|
||||
return null;
|
||||
}
|
||||
// Retrieve the block from state id
|
||||
final Section section = retrieveSection(y);
|
||||
final short blockStateId = section.getBlockAt(x, y, z);
|
||||
if (blockStateId == -1) {
|
||||
return Block.AIR;
|
||||
}
|
||||
return Objects.requireNonNullElse(Block.fromStateId(blockStateId), Block.AIR);
|
||||
return blockStateId > 0 ?
|
||||
Objects.requireNonNullElse(Block.fromStateId(blockStateId), Block.AIR) : Block.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,10 +24,13 @@ public interface BlockGetter {
|
||||
enum Condition {
|
||||
/**
|
||||
* Returns a block no matter what.
|
||||
* {@link Block#AIR} being the default result.
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* Returns a block only if it has a handler or nbt.
|
||||
* <p>
|
||||
* Should be more performant than {@link #NONE}.
|
||||
*/
|
||||
CACHED
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user