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 9cd2e341e6
commit 9ef0589a5f
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) { private CompoundTag readChunk(int x, int z) {
try { try {
return cps.chunkMap.readChunk(new ChunkPos(x, z)); return cps.chunkMap.read(new ChunkPos(x, z));
} catch (Exception exc) { } catch (Exception exc) {
Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc); Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc);
return null; return null;

View file

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

View file

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

View file

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

View file

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