Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 13:00:05 +01:00
Fix other ProtocolSupport compatibility issues
Dieser Commit ist enthalten in:
Ursprung
a4f63ec6f0
Commit
72a44d65fd
@ -439,10 +439,11 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
|||||||
}
|
}
|
||||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||||
section = sections[j] = this.sectionPalettes[j];
|
section = sections[j] = this.sectionPalettes[j];
|
||||||
getParent().setCount(0, count - this.getAir(j), section);
|
// getParent().setCount(0, count - this.getAir(j), section);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
sections[j] = getParent().newChunkSection(j << 4, flag, array);
|
section = sections[j] = getParent().newChunkSection(j << 4, flag, array);
|
||||||
|
// getParent().setCount(0, count - this.getAir(j), section);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (count >= 4096) {
|
} else if (count >= 4096) {
|
||||||
@ -452,10 +453,11 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
|||||||
}
|
}
|
||||||
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
if (this.sectionPalettes != null && this.sectionPalettes[j] != null) {
|
||||||
section = sections[j] = this.sectionPalettes[j];
|
section = sections[j] = this.sectionPalettes[j];
|
||||||
getParent().setCount(0, count - this.getAir(j), section);
|
// getParent().setCount(0, count - this.getAir(j), section);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
sections[j] = getParent().newChunkSection(j << 4, flag, array);
|
section = sections[j] = getParent().newChunkSection(j << 4, flag, array);
|
||||||
|
// getParent().setCount(0, count - this.getAir(j), section);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
protected final static Field fieldLinearIndex;
|
protected final static Field fieldLinearIndex;
|
||||||
protected final static Field fieldDefaultBlock;
|
protected final static Field fieldDefaultBlock;
|
||||||
|
|
||||||
|
protected final static Field fieldFluidCount;
|
||||||
protected final static Field fieldTickingBlockCount;
|
protected final static Field fieldTickingBlockCount;
|
||||||
protected final static Field fieldNonEmptyBlockCount;
|
protected final static Field fieldNonEmptyBlockCount;
|
||||||
protected final static Field fieldSection;
|
protected final static Field fieldSection;
|
||||||
@ -120,18 +121,20 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
fieldLiquidCount = ChunkSection.class.getDeclaredField("e");
|
fieldLiquidCount = ChunkSection.class.getDeclaredField("e");
|
||||||
fieldEmittedLight = ChunkSection.class.getDeclaredField("emittedLight");
|
fieldEmittedLight = ChunkSection.class.getDeclaredField("emittedLight");
|
||||||
fieldSkyLight = ChunkSection.class.getDeclaredField("skyLight");
|
fieldSkyLight = ChunkSection.class.getDeclaredField("skyLight");
|
||||||
|
|
||||||
|
|
||||||
fieldTickingBlockCount = ChunkSection.class.getDeclaredField("tickingBlockCount");
|
|
||||||
fieldNonEmptyBlockCount = ChunkSection.class.getDeclaredField("nonEmptyBlockCount");
|
|
||||||
fieldSection.setAccessible(true);
|
fieldSection.setAccessible(true);
|
||||||
fieldTickingBlockCount.setAccessible(true);
|
|
||||||
fieldNonEmptyBlockCount.setAccessible(true);
|
|
||||||
|
|
||||||
fieldLiquidCount.setAccessible(true);
|
fieldLiquidCount.setAccessible(true);
|
||||||
fieldEmittedLight.setAccessible(true);
|
fieldEmittedLight.setAccessible(true);
|
||||||
fieldSkyLight.setAccessible(true);
|
fieldSkyLight.setAccessible(true);
|
||||||
|
|
||||||
|
fieldFluidCount = ChunkSection.class.getDeclaredField("e");
|
||||||
|
fieldTickingBlockCount = ChunkSection.class.getDeclaredField("tickingBlockCount");
|
||||||
|
fieldNonEmptyBlockCount = ChunkSection.class.getDeclaredField("nonEmptyBlockCount");
|
||||||
|
fieldFluidCount.setAccessible(true);
|
||||||
|
fieldTickingBlockCount.setAccessible(true);
|
||||||
|
fieldNonEmptyBlockCount.setAccessible(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// fieldBiomes = ChunkProviderGenerate.class.getDeclaredField("D"); // *
|
// fieldBiomes = ChunkProviderGenerate.class.getDeclaredField("D"); // *
|
||||||
// fieldBiomes.setAccessible(true);
|
// fieldBiomes.setAccessible(true);
|
||||||
|
|
||||||
@ -689,13 +692,18 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
public Object get() {
|
public Object get() {
|
||||||
try {
|
try {
|
||||||
int dirtyBits = fieldDirtyBits.getInt(playerChunk);
|
int dirtyBits = fieldDirtyBits.getInt(playerChunk);
|
||||||
if (mask == 0) dirtyBits |= 65535;
|
if (dirtyBits == 0) {
|
||||||
else dirtyBits |= mask;
|
((CraftWorld) getWorld()).getHandle().getPlayerChunkMap().a(playerChunk);
|
||||||
|
}
|
||||||
|
if (mask == 0) {
|
||||||
|
dirtyBits = 65535;
|
||||||
|
} else {
|
||||||
|
dirtyBits |= mask;
|
||||||
|
}
|
||||||
|
System.out.println("Mask is " + dirtyBits);
|
||||||
|
|
||||||
fieldDirtyBits.set(playerChunk, dirtyBits);
|
fieldDirtyBits.set(playerChunk, dirtyBits);
|
||||||
fieldDirtyCount.set(playerChunk, 64);
|
fieldDirtyCount.set(playerChunk, 64);
|
||||||
PlayerChunkMap playerManager = ((CraftWorld) getWorld()).getHandle().getPlayerChunkMap();
|
|
||||||
playerManager.a(playerChunk);
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -821,6 +829,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setCount(int tickingBlockCount, int nonEmptyBlockCount, ChunkSection section) throws NoSuchFieldException, IllegalAccessException {
|
public static void setCount(int tickingBlockCount, int nonEmptyBlockCount, ChunkSection section) throws NoSuchFieldException, IllegalAccessException {
|
||||||
|
// fieldFluidCount.set(section, 0); // TODO FIXME
|
||||||
fieldTickingBlockCount.set(section, tickingBlockCount);
|
fieldTickingBlockCount.set(section, tickingBlockCount);
|
||||||
fieldNonEmptyBlockCount.set(section, nonEmptyBlockCount);
|
fieldNonEmptyBlockCount.set(section, nonEmptyBlockCount);
|
||||||
}
|
}
|
||||||
@ -871,20 +880,17 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
if (Settings.IMP.PROTOCOL_SUPPORT_FIX) {
|
if (Settings.IMP.PROTOCOL_SUPPORT_FIX) {
|
||||||
bitsPerEntry = Math.max(bitsPerEntry, 4); // Protocol support breaks <4 bits per entry
|
bitsPerEntry = Math.max(bitsPerEntry, 4); // Protocol support breaks <4 bits per entry
|
||||||
} else {
|
} else {
|
||||||
bitsPerEntry = 1; // For some reason minecraft needs 4096 bits to store 0 entries
|
bitsPerEntry = Math.max(bitsPerEntry, 1); // For some reason minecraft needs 4096 bits to store 0 entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||||
if (num_palette == 1) {
|
if (num_palette == 1) {
|
||||||
// Set a value, because minecraft needs it for some reason even if the array is empty
|
|
||||||
for (int i = 0; i < blockBitArrayEnd; i++) blockstates[i] = 0;
|
for (int i = 0; i < blockBitArrayEnd; i++) blockstates[i] = 0;
|
||||||
} else {
|
} else {
|
||||||
BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
||||||
bitArray.fromRaw(blocksCopy);
|
bitArray.fromRaw(blocksCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// set palette & data bits
|
// set palette & data bits
|
||||||
DataPaletteBlock<IBlockData> dataPaletteBlocks = section.getBlocks();
|
DataPaletteBlock<IBlockData> dataPaletteBlocks = section.getBlocks();
|
||||||
// private DataPalette<T> h;
|
// private DataPalette<T> h;
|
||||||
@ -892,7 +898,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
|||||||
long[] bits = Arrays.copyOfRange(blockstates, 0, blockBitArrayEnd);
|
long[] bits = Arrays.copyOfRange(blockstates, 0, blockBitArrayEnd);
|
||||||
DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||||
DataPalette<IBlockData> palette;
|
DataPalette<IBlockData> palette;
|
||||||
// DataPaletteHash<IBlockData> hash = new DataPaletteHash<>(Block.REGISTRY_ID, num_palette, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
// palette = new DataPaletteHash<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
||||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
||||||
// set palette
|
// set palette
|
||||||
for (int i = 0; i < num_palette; i++) {
|
for (int i = 0; i < num_palette; i++) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren