Use read API (avoid fixers running)

This commit is contained in:
Michael Primm 2023-05-09 14:17:43 -05:00 committed by Michael Primm
parent d1b95c9ae0
commit 4e61fa6b22
5 changed files with 48 additions and 38 deletions

View File

@ -67,7 +67,7 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
private CompoundTag readChunk(int x, int z) {
try {
return cps.chunkMap.readChunk(new ChunkPos(x, z));
return cps.chunkMap.read(new ChunkPos(x, z));
} catch (Exception exc) {
Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc);
return null;

View File

@ -67,13 +67,14 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
private CompoundTag readChunk(int x, int z) {
try {
CompoundTag rslt = cps.chunkMap.readChunk(new ChunkPos(x, z));
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z));
if (rslt != null) {
if (rslt.contains("Level")) {
rslt = rslt.getCompound("Level");
CompoundTag lev = rslt;
if (lev.contains("Level")) {
lev = lev.getCompound("Level");
}
// Don't load uncooked chunks
String stat = rslt.getString("Status");
String stat = lev.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted

View File

@ -68,17 +68,20 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
private CompoundTag readChunk(int x, int z) {
try {
CompoundTag rslt = cps.chunkMap.readChunk(new ChunkPos(x, z)).join().get();
if (rslt.contains("Level")) {
rslt = rslt.getCompound("Level");
}
// Don't load uncooked chunks
String stat = rslt.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
rslt = null;
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z)).join().get();
if (rslt != null) {
CompoundTag lev = rslt;
if (lev.contains("Level")) {
lev = lev.getCompound("Level");
}
// Don't load uncooked chunks
String stat = lev.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
rslt = null;
}
}
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
// rslt.toString() : "null"));

View File

@ -68,17 +68,20 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
private CompoundTag readChunk(int x, int z) {
try {
CompoundTag rslt = cps.chunkMap.readChunk(new ChunkPos(x, z)).join().get();
if (rslt.contains("Level")) {
rslt = rslt.getCompound("Level");
}
// Don't load uncooked chunks
String stat = rslt.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
rslt = null;
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z)).join().get();
if (rslt != null) {
CompoundTag lev = rslt;
if (lev.contains("Level")) {
lev = lev.getCompound("Level");
}
// Don't load uncooked chunks
String stat = lev.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
rslt = null;
}
}
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
// rslt.toString() : "null"));

View File

@ -68,17 +68,20 @@ public class ForgeMapChunkCache extends GenericMapChunkCache {
private CompoundTag readChunk(int x, int z) {
try {
CompoundTag rslt = cps.chunkMap.readChunk(new ChunkPos(x, z)).join().get();
if (rslt.contains("Level")) {
rslt = rslt.getCompound("Level");
}
// Don't load uncooked chunks
String stat = rslt.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
rslt = null;
CompoundTag rslt = cps.chunkMap.read(new ChunkPos(x, z)).join().get();
if (rslt != null) {
CompoundTag lev = rslt;
if (lev.contains("Level")) {
lev = lev.getCompound("Level");
}
// Don't load uncooked chunks
String stat = lev.getString("Status");
ChunkStatus cs = ChunkStatus.byName(stat);
if ((stat == null) ||
// Needs to be at least lighted
(!cs.isOrAfter(ChunkStatus.LIGHT))) {
rslt = null;
}
}
// Log.info(String.format("loadChunk(%d,%d)=%s", x, z, (rslt != null) ?
// rslt.toString() : "null"));