mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-28 13:36:31 +01:00
Add iterateBlockEntities method to Chunk
This commit is contained in:
parent
809847f0b0
commit
511d3ffa98
@ -28,6 +28,8 @@
|
||||
import de.bluecolored.bluemap.core.world.block.entity.BlockEntity;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public interface Chunk {
|
||||
|
||||
Chunk EMPTY_CHUNK = new Chunk() {};
|
||||
@ -79,4 +81,6 @@ default boolean hasOceanFloorHeights() {
|
||||
|
||||
default @Nullable BlockEntity getBlockEntity(int x, int y, int z) { return null; }
|
||||
|
||||
default void iterateBlockEntities(Consumer<BlockEntity> consumer) { }
|
||||
|
||||
}
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Chunk_1_13 extends MCAChunk {
|
||||
|
||||
@ -219,6 +220,11 @@ public int getOceanFloorY(int x, int z) {
|
||||
return blockEntities.get((long) y << 8 | (x & 0xF) << 4 | z & 0xF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iterateBlockEntities(Consumer<BlockEntity> consumer) {
|
||||
blockEntities.values().forEach(consumer);
|
||||
}
|
||||
|
||||
private @Nullable Section getSection(int y) {
|
||||
y -= sectionMin;
|
||||
if (y < 0 || y >= this.sections.length) return null;
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Chunk_1_16 extends MCAChunk {
|
||||
|
||||
@ -214,6 +215,11 @@ public int getOceanFloorY(int x, int z) {
|
||||
return blockEntities.get((long) y << 8 | (x & 0xF) << 4 | z & 0xF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iterateBlockEntities(Consumer<BlockEntity> consumer) {
|
||||
blockEntities.values().forEach(consumer);
|
||||
}
|
||||
|
||||
private @Nullable Section getSection(int y) {
|
||||
y -= sectionMin;
|
||||
if (y < 0 || y >= this.sections.length) return null;
|
||||
|
@ -42,6 +42,7 @@
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class Chunk_1_18 extends MCAChunk {
|
||||
|
||||
@ -205,6 +206,11 @@ public int getOceanFloorY(int x, int z) {
|
||||
return blockEntities.get((long) y << 8 | (x & 0xF) << 4 | z & 0xF);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void iterateBlockEntities(Consumer<BlockEntity> consumer) {
|
||||
blockEntities.values().forEach(consumer);
|
||||
}
|
||||
|
||||
private @Nullable Section getSection(int y) {
|
||||
y -= sectionMin;
|
||||
if (y < 0 || y >= this.sections.length) return null;
|
||||
|
Loading…
Reference in New Issue
Block a user