File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed
BlueMapCore/src/main/java/de/bluecolored/bluemap/core/world Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 2828import de .bluecolored .bluemap .core .world .block .entity .BlockEntity ;
2929import org .jetbrains .annotations .Nullable ;
3030
31+ import java .util .function .Consumer ;
32+
3133public interface Chunk {
3234
3335 Chunk EMPTY_CHUNK = new Chunk () {};
@@ -79,4 +81,6 @@ default boolean hasOceanFloorHeights() {
7981
8082 default @ Nullable BlockEntity getBlockEntity (int x , int y , int z ) { return null ; }
8183
84+ default void iterateBlockEntities (Consumer <BlockEntity > consumer ) { }
85+
8286}
Original file line number Diff line number Diff line change 4141
4242import java .util .HashMap ;
4343import java .util .Map ;
44+ import java .util .function .Consumer ;
4445
4546public class Chunk_1_13 extends MCAChunk {
4647
@@ -219,6 +220,11 @@ public int getOceanFloorY(int x, int z) {
219220 return blockEntities .get ((long ) y << 8 | (x & 0xF ) << 4 | z & 0xF );
220221 }
221222
223+ @ Override
224+ public void iterateBlockEntities (Consumer <BlockEntity > consumer ) {
225+ blockEntities .values ().forEach (consumer );
226+ }
227+
222228 private @ Nullable Section getSection (int y ) {
223229 y -= sectionMin ;
224230 if (y < 0 || y >= this .sections .length ) return null ;
Original file line number Diff line number Diff line change 4242
4343import java .util .HashMap ;
4444import java .util .Map ;
45+ import java .util .function .Consumer ;
4546
4647public class Chunk_1_16 extends MCAChunk {
4748
@@ -214,6 +215,11 @@ public int getOceanFloorY(int x, int z) {
214215 return blockEntities .get ((long ) y << 8 | (x & 0xF ) << 4 | z & 0xF );
215216 }
216217
218+ @ Override
219+ public void iterateBlockEntities (Consumer <BlockEntity > consumer ) {
220+ blockEntities .values ().forEach (consumer );
221+ }
222+
217223 private @ Nullable Section getSection (int y ) {
218224 y -= sectionMin ;
219225 if (y < 0 || y >= this .sections .length ) return null ;
Original file line number Diff line number Diff line change 4242
4343import java .util .HashMap ;
4444import java .util .Map ;
45+ import java .util .function .Consumer ;
4546
4647public class Chunk_1_18 extends MCAChunk {
4748
@@ -205,6 +206,11 @@ public int getOceanFloorY(int x, int z) {
205206 return blockEntities .get ((long ) y << 8 | (x & 0xF ) << 4 | z & 0xF );
206207 }
207208
209+ @ Override
210+ public void iterateBlockEntities (Consumer <BlockEntity > consumer ) {
211+ blockEntities .values ().forEach (consumer );
212+ }
213+
208214 private @ Nullable Section getSection (int y ) {
209215 y -= sectionMin ;
210216 if (y < 0 || y >= this .sections .length ) return null ;
You can’t perform that action at this time.
0 commit comments