mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 06:41:08 +00:00
improve chunk existing check
This commit is contained in:
@@ -11,7 +11,7 @@ public interface IHeadless extends Closeable {
|
|||||||
|
|
||||||
void saveAll();
|
void saveAll();
|
||||||
|
|
||||||
@RegionCoordinates
|
@ChunkCoordinates
|
||||||
boolean exists(int x, int z);
|
boolean exists(int x, int z);
|
||||||
|
|
||||||
@RegionCoordinates
|
@RegionCoordinates
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ public class Headless implements IHeadless, LevelHeightAccessor {
|
|||||||
public boolean exists(int x, int z) {
|
public boolean exists(int x, int z) {
|
||||||
if (closed) return false;
|
if (closed) return false;
|
||||||
try {
|
try {
|
||||||
return storage.getRegionFile(new ChunkPos(x << 5, z << 5), true) != null;
|
CompoundTag tag = storage.read(new ChunkPos(x, z));
|
||||||
|
return tag != null && !"empty".equals(tag.getString("Status"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -137,16 +138,9 @@ public class Headless implements IHeadless, LevelHeightAccessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateChunk(int x, int z) {
|
public void generateChunk(int x, int z) {
|
||||||
if (closed) return;
|
if (closed || exists(x, z)) return;
|
||||||
try {
|
try {
|
||||||
var pos = new ChunkPos(x, z);
|
var pos = new ChunkPos(x, z);
|
||||||
try {
|
|
||||||
CompoundTag tag = storage.read(pos);
|
|
||||||
if (tag != null && !"empty".equals(tag.getString("Status"))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Throwable ignored) {}
|
|
||||||
|
|
||||||
ProtoChunk chunk = binding.createProtoChunk(pos, this);
|
ProtoChunk chunk = binding.createProtoChunk(pos, this);
|
||||||
var tc = new MCATerrainChunk(chunk);
|
var tc = new MCATerrainChunk(chunk);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user