Fix pasting nbt

Dieser Commit ist enthalten in:
Jesse Boyd 2019-04-06 02:33:17 +11:00
Ursprung 144215c813
Commit 16b01b9de2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F

Datei anzeigen

@ -107,12 +107,11 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
final int bz = getZ() << 4; final int bz = getZ() << 4;
boolean update = adapter == null || adapter.isChunkInUse(chunk); boolean update = adapter == null || adapter.isChunkInUse(chunk);
if (layer == -1) { if (layer == -1) {
if (adapter != null) if (adapter != null) {
{
// Run change task // Run change task
RunnableVal2<FaweChunk, FaweChunk> task = parent.getChangeTask(); RunnableVal2<FaweChunk, FaweChunk> task = parent.getChangeTask();
BukkitChunk_All_ReadonlySnapshot previous; BukkitChunk_All_ReadonlySnapshot previous;
if (task != null){ if (task != null) {
ChunkSnapshot snapshot = parent.ensureChunkLoaded(getX(), getZ()); ChunkSnapshot snapshot = parent.ensureChunkLoaded(getX(), getZ());
previous = new BukkitChunk_All_ReadonlySnapshot(parent, this, snapshot, biomes != null); previous = new BukkitChunk_All_ReadonlySnapshot(parent, this, snapshot, biomes != null);
for (BlockState tile : chunk.getTileEntities()) { for (BlockState tile : chunk.getTileEntities()) {
@ -235,7 +234,6 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
BlockType type = BlockTypes.getFromStateId(combined); BlockType type = BlockTypes.getFromStateId(combined);
if (type == BlockTypes.__RESERVED__) continue; if (type == BlockTypes.__RESERVED__) continue;
String s = type.getResource().toUpperCase();
if (type.getMaterial().isAir()) { if (type.getMaterial().isAir()) {
if (!place) { if (!place) {
mutableLoc.setX(xx); mutableLoc.setX(xx);
@ -251,7 +249,7 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
if (nbt != null) { if (nbt != null) {
synchronized (BukkitChunk_All.this) { synchronized (BukkitChunk_All.this) {
BaseBlock state = BaseBlock state =
BaseBlock.getFromInternalId(combined, nbt); BaseBlock.getFromInternalId(combined, nbt);
adapter.setBlock(chunk, xx, yy, zz, state, update); adapter.setBlock(chunk, xx, yy, zz, state, update);
} }
continue; continue;
@ -272,7 +270,7 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
} }
} }
} else { } else {
for (;index < 4096; index++) { for (; index < 4096; index++) {
int j = place ? index : 4095 - index; int j = place ? index : 4095 - index;
int combined = newArray[j]; int combined = newArray[j];
BlockType type = BlockTypes.getFromStateId(combined); BlockType type = BlockTypes.getFromStateId(combined);
@ -281,72 +279,72 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
if (!place) { if (!place) {
int x = cacheX[j]; int x = cacheX[j];
int z = cacheZ[j]; int z = cacheZ[j];
int y = cacheY[j]; int y = cacheY[j];
mutableLoc.setX(bx + x);
mutableLoc.setY(y);
mutableLoc.setZ(bz + z);
setBlock(adapter, chunk, mutableLoc, combined, update);
}
continue;
} else {
boolean light = type.getMaterial().getLightValue() > 0;
if (light) {
if (place) {
continue;
}
light = light && getParent().getSettings().LIGHTING.MODE != 0;
if (light) {
parent.enableLighting(disableResult);
}
} else if (!place) {
continue;
}
int x = cacheX[j];
int z = cacheZ[j];
int y = cacheY[j];
if (type.getMaterial().hasContainer() && adapter != null) {
CompoundTag tile = getTile(x, y, z);
if (tile != null) {
synchronized (BukkitChunk_All.this) {
BaseBlock state = BaseBlock.getFromInternalId(combined, tile);
adapter.setBlock(chunk, bx + x, y, bz + z, state, update);
}
break;
}
}
if (type.getMaterial().isTicksRandomly()) {
synchronized (BukkitChunk_All.this) {
mutableLoc.setX(bx + x); mutableLoc.setX(bx + x);
mutableLoc.setY(y); mutableLoc.setY(y);
mutableLoc.setZ(bz + z); mutableLoc.setZ(bz + z);
setBlock(adapter, chunk, mutableLoc, combined, update); setBlock(adapter, chunk, mutableLoc, combined, update);
} }
continue;
} else { } else {
mutableLoc.setX(bx + x); boolean light = type.getMaterial().getLightValue() > 0;
mutableLoc.setY(y); if (light) {
mutableLoc.setZ(bz + z); if (place) {
setBlock(adapter, chunk, mutableLoc, combined, update); continue;
}
light = light && getParent().getSettings().LIGHTING.MODE != 0;
if (light) {
parent.enableLighting(disableResult);
}
} else if (!place) {
continue;
}
int x = cacheX[j];
int z = cacheZ[j];
int y = cacheY[j];
if (type.getMaterial().hasContainer() && adapter != null) {
CompoundTag tile = getTile(x, y, z);
if (tile != null) {
synchronized (BukkitChunk_All.this) {
BaseBlock state = BaseBlock.getFromInternalId(combined, tile);
adapter.setBlock(chunk, bx + x, y, bz + z, state, update);
}
continue;
}
}
if (type.getMaterial().isTicksRandomly()) {
synchronized (BukkitChunk_All.this) {
mutableLoc.setX(bx + x);
mutableLoc.setY(y);
mutableLoc.setZ(bz + z);
setBlock(adapter, chunk, mutableLoc, combined, update);
}
} else {
mutableLoc.setX(bx + x);
mutableLoc.setY(y);
mutableLoc.setZ(bz + z);
setBlock(adapter, chunk, mutableLoc, combined, update);
}
if (light) {
parent.disableLighting(disableResult);
}
} }
if (light) { if (System.currentTimeMillis() - start > recommended) {
parent.disableLighting(disableResult); index++;
break mainloop;
} }
} }
if (System.currentTimeMillis() - start > recommended) { index = 0;
index++;
break mainloop;
}
} }
index = 0; } catch (final Throwable e) {
MainUtil.handleError(e);
} }
} catch (final Throwable e) { } while (System.currentTimeMillis() - start < recommended);
MainUtil.handleError(e); if (more || place) {
this.addToQueue();
} }
} while (System.currentTimeMillis() - start < recommended); parent.resetLighting(disableResult);
if (more || place) { return this;
this.addToQueue();
}
parent.resetLighting(disableResult);
return this;
} }
public void setBlock(BukkitImplAdapter adapter, Chunk chunk, Location location, int combinedId, boolean update) { public void setBlock(BukkitImplAdapter adapter, Chunk chunk, Location location, int combinedId, boolean update) {