3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

Update to NMS given by 1.16.5.

Since there's no new NMS revision (we're still on R3...?!) but there were changes, it would be more difficult to maintain both 1.16.4 and 1.16.5. Therefore, let's just stop supporting 1.16.4 as 1.16.5 is a minor update regardless.
Fixes #859
Dieser Commit ist enthalten in:
dordsor21 2021-01-18 16:13:42 +00:00
Ursprung 3ba982927a
Commit 0f6b56572a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
10 geänderte Dateien mit 75 neuen und 75 gelöschten Zeilen

Datei anzeigen

@ -57,13 +57,13 @@ dependencies {
"compile"("org.spigotmcv1_16_r2:spigotmcv1_16_r2:1_16_r2") "compile"("org.spigotmcv1_16_r2:spigotmcv1_16_r2:1_16_r2")
"compile"("org.spigotmcv1_16_r3:spigotmcv1_16_r3:1_16_r3") "compile"("org.spigotmcv1_16_r3:spigotmcv1_16_r3:1_16_r3")
"implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}") "implementation"("it.unimi.dsi:fastutil:${Versions.FAST_UTIL}")
"api"("com.destroystokyo.paper:paper-api:1.16.4-R0.1-SNAPSHOT") { "api"("com.destroystokyo.paper:paper-api:1.16.5-R0.1-SNAPSHOT") {
exclude("junit", "junit") exclude("junit", "junit")
isTransitive = false isTransitive = false
} }
"compileOnly"("org.jetbrains:annotations:20.1.0") "compileOnly"("org.jetbrains:annotations:20.1.0")
"testCompileOnly"("org.jetbrains:annotations:20.1.0") "testCompileOnly"("org.jetbrains:annotations:20.1.0")
"compileOnly"("org.spigotmc:spigot:1.16.4-R0.1-SNAPSHOT") "compileOnly"("org.spigotmc:spigot:1.16.5-R0.1-SNAPSHOT")
"implementation"("io.papermc:paperlib:1.0.6") "implementation"("io.papermc:paperlib:1.0.6")
"compileOnly"("com.sk89q:dummypermscompat:1.10") { "compileOnly"("com.sk89q:dummypermscompat:1.10") {
exclude("com.github.MilkBowl", "VaultAPI") exclude("com.github.MilkBowl", "VaultAPI")

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4; package com.boydti.fawe.bukkit.adapter.mc1_16_5;
import com.sk89q.util.ReflectionUtil; import com.sk89q.util.ReflectionUtil;
import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.world.registry.BlockMaterial;
@ -12,7 +12,7 @@ import net.minecraft.server.v1_16_R3.ITileEntity;
import net.minecraft.server.v1_16_R3.Material; import net.minecraft.server.v1_16_R3.Material;
import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData;
public class BlockMaterial_1_16_4 implements BlockMaterial { public class BlockMaterial_1_16_5 implements BlockMaterial {
private final Block block; private final Block block;
private final IBlockData defaultState; private final IBlockData defaultState;
private final Material material; private final Material material;
@ -21,11 +21,11 @@ public class BlockMaterial_1_16_4 implements BlockMaterial {
private final org.bukkit.Material craftMaterial; private final org.bukkit.Material craftMaterial;
private final int opacity; private final int opacity;
public BlockMaterial_1_16_4(Block block) { public BlockMaterial_1_16_5(Block block) {
this(block, block.getBlockData()); this(block, block.getBlockData());
} }
public BlockMaterial_1_16_4(Block block, IBlockData defaultState) { public BlockMaterial_1_16_5(Block block, IBlockData defaultState) {
this.block = block; this.block = block;
this.defaultState = defaultState; this.defaultState = defaultState;
this.material = defaultState.getMaterial(); this.material = defaultState.getMaterial();

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4; package com.boydti.fawe.bukkit.adapter.mc1_16_5;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
@ -51,7 +51,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Function; import java.util.function.Function;
public final class BukkitAdapter_1_16_4 extends NMSAdapter { public final class BukkitAdapter_1_16_5 extends NMSAdapter {
/* /*
NMS fields NMS fields
*/ */
@ -310,7 +310,7 @@ public final class BukkitAdapter_1_16_4 extends NMSAdapter {
final int ordinal = paletteToBlock[i]; final int ordinal = paletteToBlock[i];
blockToPalette[ordinal] = Integer.MAX_VALUE; blockToPalette[ordinal] = Integer.MAX_VALUE;
final BlockState state = BlockTypesCache.states[ordinal]; final BlockState state = BlockTypesCache.states[ordinal];
final IBlockData ibd = ((BlockMaterial_1_16_4) state.getMaterial()).getState(); final IBlockData ibd = ((BlockMaterial_1_16_5) state.getMaterial()).getState();
palette.a(ibd); palette.a(ibd);
} }
try { try {

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4; package com.boydti.fawe.bukkit.adapter.mc1_16_5;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
@ -9,7 +9,7 @@ import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.boydti.fawe.beta.implementation.queue.QueueHandler; import com.boydti.fawe.beta.implementation.queue.QueueHandler;
import com.boydti.fawe.bukkit.adapter.BukkitGetBlocks; import com.boydti.fawe.bukkit.adapter.BukkitGetBlocks;
import com.boydti.fawe.bukkit.adapter.DelegateLock; import com.boydti.fawe.bukkit.adapter.DelegateLock;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.nbt.LazyCompoundTag_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.nbt.LazyCompoundTag_1_16_5;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.collection.AdaptedMap; import com.boydti.fawe.object.collection.AdaptedMap;
import com.boydti.fawe.object.collection.BitArrayUnstretched; import com.boydti.fawe.object.collection.BitArrayUnstretched;
@ -77,12 +77,12 @@ import java.util.function.Function;
import static org.slf4j.LoggerFactory.getLogger; import static org.slf4j.LoggerFactory.getLogger;
public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBlocks { public class BukkitGetBlocks_1_16_5 extends CharGetBlocks implements BukkitGetBlocks {
private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_4.class); private static final Logger log = LoggerFactory.getLogger(BukkitGetBlocks_1_16_5.class);
private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); private static final Function<BlockPosition, BlockVector3> posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ());
private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_4(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); private static final Function<TileEntity, CompoundTag> nmsTile2We = tileEntity -> new LazyCompoundTag_1_16_5(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
public ChunkSection[] sections; public ChunkSection[] sections;
public Chunk nmsChunk; public Chunk nmsChunk;
public WorldServer world; public WorldServer world;
@ -91,15 +91,15 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
public NibbleArray[] blockLight = new NibbleArray[16]; public NibbleArray[] blockLight = new NibbleArray[16];
public NibbleArray[] skyLight = new NibbleArray[16]; public NibbleArray[] skyLight = new NibbleArray[16];
private boolean createCopy = false; private boolean createCopy = false;
private BukkitGetBlocks_1_16_4_Copy copy = null; private BukkitGetBlocks_1_16_5_Copy copy = null;
private boolean forceLoadSections = true; private boolean forceLoadSections = true;
private boolean lightUpdate = false; private boolean lightUpdate = false;
public BukkitGetBlocks_1_16_4(World world, int chunkX, int chunkZ) { public BukkitGetBlocks_1_16_5(World world, int chunkX, int chunkZ) {
this(((CraftWorld) world).getHandle(), chunkX, chunkZ); this(((CraftWorld) world).getHandle(), chunkX, chunkZ);
} }
public BukkitGetBlocks_1_16_4(WorldServer world, int chunkX, int chunkZ) { public BukkitGetBlocks_1_16_5(WorldServer world, int chunkX, int chunkZ) {
this.world = world; this.world = world;
this.chunkX = chunkX; this.chunkX = chunkX;
this.chunkZ = chunkZ; this.chunkZ = chunkZ;
@ -212,7 +212,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
if (tileEntity == null) { if (tileEntity == null) {
return null; return null;
} }
return new LazyCompoundTag_1_16_4(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); return new LazyCompoundTag_1_16_5(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound())));
} }
@Override @Override
@ -354,7 +354,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
}; };
} }
private void updateGet(BukkitGetBlocks_1_16_4 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) { private void updateGet(BukkitGetBlocks_1_16_5 get, Chunk nmsChunk, ChunkSection[] sections, ChunkSection section, char[] arr, int layer) {
synchronized (get) { synchronized (get) {
if (this.getChunk() != nmsChunk) { if (this.getChunk() != nmsChunk) {
this.nmsChunk = nmsChunk; this.nmsChunk = nmsChunk;
@ -376,13 +376,13 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
} }
public Chunk ensureLoaded(net.minecraft.server.v1_16_R3.World nmsWorld, int chunkX, int chunkZ) { public Chunk ensureLoaded(net.minecraft.server.v1_16_R3.World nmsWorld, int chunkX, int chunkZ) {
return BukkitAdapter_1_16_4.ensureLoaded(nmsWorld, chunkX, chunkZ); return BukkitAdapter_1_16_5.ensureLoaded(nmsWorld, chunkX, chunkZ);
} }
@Override @Override
public synchronized <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) { public synchronized <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
forceLoadSections = false; forceLoadSections = false;
copy = createCopy ? new BukkitGetBlocks_1_16_4_Copy(world) : null; copy = createCopy ? new BukkitGetBlocks_1_16_5_Copy(world) : null;
try { try {
WorldServer nmsWorld = world; WorldServer nmsWorld = world;
Chunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ); Chunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ);
@ -434,8 +434,8 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
ChunkSection newSection; ChunkSection newSection;
ChunkSection existingSection = sections[layer]; ChunkSection existingSection = sections[layer];
if (existingSection == null) { if (existingSection == null) {
newSection = BukkitAdapter_1_16_4.newChunkSection(layer, setArr, fastmode); newSection = BukkitAdapter_1_16_5.newChunkSection(layer, setArr, fastmode);
if (BukkitAdapter_1_16_4.setSectionAtomic(sections, null, newSection, layer)) { if (BukkitAdapter_1_16_5.setSectionAtomic(sections, null, newSection, layer)) {
updateGet(this, nmsChunk, sections, newSection, setArr, layer); updateGet(this, nmsChunk, sections, newSection, setArr, layer);
continue; continue;
} else { } else {
@ -447,10 +447,10 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
} }
} }
} }
BukkitAdapter_1_16_4.fieldTickingBlockCount.set(existingSection, (short) 0); BukkitAdapter_1_16_5.fieldTickingBlockCount.set(existingSection, (short) 0);
//ensure that the server doesn't try to tick the chunksection while we're editing it. //ensure that the server doesn't try to tick the chunksection while we're editing it.
DelegateLock lock = BukkitAdapter_1_16_4.applyLock(existingSection); DelegateLock lock = BukkitAdapter_1_16_5.applyLock(existingSection);
synchronized (this) { synchronized (this) {
synchronized (lock) { synchronized (lock) {
@ -467,9 +467,9 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
} else if (lock.isModified()) { } else if (lock.isModified()) {
this.reset(layer); this.reset(layer);
} }
newSection = BukkitAdapter_1_16_4 newSection = BukkitAdapter_1_16_5
.newChunkSection(layer, this::loadPrivately, setArr, fastmode); .newChunkSection(layer, this::loadPrivately, setArr, fastmode);
if (!BukkitAdapter_1_16_4 if (!BukkitAdapter_1_16_5
.setSectionAtomic(sections, existingSection, newSection, layer)) { .setSectionAtomic(sections, existingSection, newSection, layer)) {
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer); log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
} else { } else {
@ -503,10 +503,10 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
Map<HeightMapType, int[]> heightMaps = set.getHeightMaps(); Map<HeightMapType, int[]> heightMaps = set.getHeightMaps();
for (Map.Entry<HeightMapType, int[]> entry : heightMaps.entrySet()) { for (Map.Entry<HeightMapType, int[]> entry : heightMaps.entrySet()) {
BukkitGetBlocks_1_16_4.this.setHeightmapToGet(entry.getKey(), entry.getValue()); BukkitGetBlocks_1_16_5.this.setHeightmapToGet(entry.getKey(), entry.getValue());
} }
BukkitGetBlocks_1_16_4.this.setLightingToGet(set.getLight()); BukkitGetBlocks_1_16_5.this.setLightingToGet(set.getLight());
BukkitGetBlocks_1_16_4.this.setSkyLightingToGet(set.getSkyLight()); BukkitGetBlocks_1_16_5.this.setSkyLightingToGet(set.getSkyLight());
Runnable[] syncTasks = null; Runnable[] syncTasks = null;
@ -552,7 +552,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
if (idTag == null || posTag == null || rotTag == null) { if (idTag == null || posTag == null || rotTag == null) {
getLogger( getLogger(
BukkitGetBlocks_1_16_4.class).debug("Unknown entity tag: " + nativeTag); BukkitGetBlocks_1_16_5.class).debug("Unknown entity tag: " + nativeTag);
continue; continue;
} }
final double x = posTag.getDouble(0); final double x = posTag.getDouble(0);
@ -686,13 +686,13 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
if (super.sections[layer].isFull()) { if (super.sections[layer].isFull()) {
return super.blocks[layer]; return super.blocks[layer];
} else { } else {
return BukkitGetBlocks_1_16_4.this.update(layer, null); return BukkitGetBlocks_1_16_5.this.update(layer, null);
} }
} }
@Override @Override
public synchronized void send(int mask, boolean lighting) { public synchronized void send(int mask, boolean lighting) {
BukkitAdapter_1_16_4.sendChunk(world, chunkX, chunkZ, mask, lighting); BukkitAdapter_1_16_5.sendChunk(world, chunkX, chunkZ, mask, lighting);
} }
@Override @Override
@ -708,7 +708,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
data = new char[4096]; data = new char[4096];
Arrays.fill(data, (char) 1); Arrays.fill(data, (char) 1);
} }
DelegateLock lock = BukkitAdapter_1_16_4.applyLock(section); DelegateLock lock = BukkitAdapter_1_16_5.applyLock(section);
synchronized (lock) { synchronized (lock) {
lock.untilFree(); lock.untilFree();
lock.setModified(false); lock.setModified(false);
@ -717,10 +717,10 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
FAWE_Spigot_v1_16_R3 adapter = ((FAWE_Spigot_v1_16_R3) WorldEditPlugin.getInstance().getBukkitImplAdapter()); FAWE_Spigot_v1_16_R3 adapter = ((FAWE_Spigot_v1_16_R3) WorldEditPlugin.getInstance().getBukkitImplAdapter());
final DataPaletteBlock<IBlockData> blocks = section.getBlocks(); final DataPaletteBlock<IBlockData> blocks = section.getBlocks();
final DataBits bits = (DataBits) BukkitAdapter_1_16_4.fieldBits.get(blocks); final DataBits bits = (DataBits) BukkitAdapter_1_16_5.fieldBits.get(blocks);
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_16_4.fieldPalette.get(blocks); final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_16_5.fieldPalette.get(blocks);
final int bitsPerEntry = (int) BukkitAdapter_1_16_4.fieldBitsPerEntry.get(bits); final int bitsPerEntry = (int) BukkitAdapter_1_16_5.fieldBitsPerEntry.get(bits);
final long[] blockStates = bits.a(); final long[] blockStates = bits.a();
new BitArrayUnstretched(bitsPerEntry, 4096, blockStates).toRaw(data); new BitArrayUnstretched(bitsPerEntry, 4096, blockStates).toRaw(data);
@ -887,7 +887,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
try { try {
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks(); final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_16_4.fieldPalette.get(blocksExisting); final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_16_5.fieldPalette.get(blocksExisting);
int paletteSize; int paletteSize;
if (palette instanceof DataPaletteLinear) { if (palette instanceof DataPaletteLinear) {

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4; package com.boydti.fawe.bukkit.adapter.mc1_16_5;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
@ -6,7 +6,7 @@ import com.boydti.fawe.beta.IBlocks;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.IChunkSet; import com.boydti.fawe.beta.IChunkSet;
import com.boydti.fawe.beta.implementation.lighting.HeightMapType; import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.nbt.LazyCompoundTag_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.nbt.LazyCompoundTag_1_16_5;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitAdapter;
@ -35,7 +35,7 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Future; import java.util.concurrent.Future;
public class BukkitGetBlocks_1_16_4_Copy implements IChunkGet { public class BukkitGetBlocks_1_16_5_Copy implements IChunkGet {
private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>(); private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>();
private final Set<CompoundTag> entities = new HashSet<>(); private final Set<CompoundTag> entities = new HashSet<>();
@ -43,13 +43,13 @@ public class BukkitGetBlocks_1_16_4_Copy implements IChunkGet {
private final char[][] blocks = new char[16][]; private final char[][] blocks = new char[16][];
private final WorldServer world; private final WorldServer world;
protected BukkitGetBlocks_1_16_4_Copy(WorldServer world) { protected BukkitGetBlocks_1_16_5_Copy(WorldServer world) {
this.world = world; this.world = world;
} }
protected void storeTile(TileEntity tile) { protected void storeTile(TileEntity tile) {
tiles.put(BlockVector3.at(tile.getPosition().getX(), tile.getPosition().getY(), tile.getPosition().getZ()), tiles.put(BlockVector3.at(tile.getPosition().getX(), tile.getPosition().getY(), tile.getPosition().getZ()),
new LazyCompoundTag_1_16_4(Suppliers.memoize(() -> tile.save(new NBTTagCompound())))); new LazyCompoundTag_1_16_5(Suppliers.memoize(() -> tile.save(new NBTTagCompound()))));
} }
@Override @Override
@ -115,7 +115,7 @@ public class BukkitGetBlocks_1_16_4_Copy implements IChunkGet {
public void setHeightmapToGet(HeightMapType type, int[] data) {} public void setHeightmapToGet(HeightMapType type, int[] data) {}
protected void storeBiomes(BiomeStorage biomeStorage) { protected void storeBiomes(BiomeStorage biomeStorage) {
this.biomeStorage = new BiomeStorage(biomeStorage.g, BukkitAdapter_1_16_4.getBiomeArray(biomeStorage).clone()); this.biomeStorage = new BiomeStorage(biomeStorage.registry, BukkitAdapter_1_16_5.getBiomeArray(biomeStorage).clone());
} }
@Override @Override

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4; package com.boydti.fawe.bukkit.adapter.mc1_16_5;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.object.IntPair; import com.boydti.fawe.object.IntPair;
@ -214,7 +214,7 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess<Chunk, I
return; return;
} }
for (IntPair chunk : toSend) { for (IntPair chunk : toSend) {
BukkitAdapter_1_16_4.sendChunk(getWorld().getWorld().getHandle(), chunk.x, chunk.z, 0, false); BukkitAdapter_1_16_5.sendChunk(getWorld().getWorld().getHandle(), chunk.x, chunk.z, 0, false);
} }
} }
}; };
@ -229,7 +229,7 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess<Chunk, I
cachedChanges.forEach(cc -> cc.chunk.setType(cc.position, cc.blockData, cachedChanges.forEach(cc -> cc.chunk.setType(cc.position, cc.blockData,
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE))); sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)));
for (IntPair chunk : cachedChunksToSend) { for (IntPair chunk : cachedChunksToSend) {
BukkitAdapter_1_16_4.sendChunk(getWorld().getWorld().getHandle(), chunk.x, chunk.z, 0, false); BukkitAdapter_1_16_5.sendChunk(getWorld().getWorld().getHandle(), chunk.x, chunk.z, 0, false);
} }
} }
}; };

Datei anzeigen

@ -1,10 +1,10 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4; package com.boydti.fawe.bukkit.adapter.mc1_16_5;
import com.boydti.fawe.bukkit.adapter.MapChunkUtil; import com.boydti.fawe.bukkit.adapter.MapChunkUtil;
import net.minecraft.server.v1_16_R3.PacketPlayOutMapChunk; import net.minecraft.server.v1_16_R3.PacketPlayOutMapChunk;
public class MapChunkUtil_1_16_4 extends MapChunkUtil<PacketPlayOutMapChunk> { public class MapChunkUtil_1_16_5 extends MapChunkUtil<PacketPlayOutMapChunk> {
public MapChunkUtil_1_16_4() throws NoSuchFieldException { public MapChunkUtil_1_16_5() throws NoSuchFieldException {
fieldX = PacketPlayOutMapChunk.class.getDeclaredField("a"); fieldX = PacketPlayOutMapChunk.class.getDeclaredField("a");
fieldZ = PacketPlayOutMapChunk.class.getDeclaredField("b"); fieldZ = PacketPlayOutMapChunk.class.getDeclaredField("b");
fieldBitMask = PacketPlayOutMapChunk.class.getDeclaredField("c"); fieldBitMask = PacketPlayOutMapChunk.class.getDeclaredField("c");

Datei anzeigen

@ -1,4 +1,4 @@
package com.boydti.fawe.bukkit.adapter.mc1_16_4.nbt; package com.boydti.fawe.bukkit.adapter.mc1_16_5.nbt;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.ListTag; import com.sk89q.jnbt.ListTag;
@ -17,17 +17,17 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
public class LazyCompoundTag_1_16_4 extends CompoundTag { public class LazyCompoundTag_1_16_5 extends CompoundTag {
private final Supplier<NBTTagCompound> nmsTag; private final Supplier<NBTTagCompound> nmsTag;
private CompoundTag cachedValue; private CompoundTag cachedValue;
public LazyCompoundTag_1_16_4(Supplier<NBTTagCompound> tag) { public LazyCompoundTag_1_16_5(Supplier<NBTTagCompound> tag) {
super(new HashMap<>()); super(new HashMap<>());
this.nmsTag = tag; this.nmsTag = tag;
} }
public LazyCompoundTag_1_16_4(NBTTagCompound tag) { public LazyCompoundTag_1_16_5(NBTTagCompound tag) {
this(() -> tag); this(() -> tag);
} }
@ -94,7 +94,7 @@ public class LazyCompoundTag_1_16_4 extends CompoundTag {
NBTTagList nbtList = (NBTTagList) tag; NBTTagList nbtList = (NBTTagList) tag;
for (NBTBase elem : nbtList) { for (NBTBase elem : nbtList) {
if (elem instanceof NBTTagCompound) { if (elem instanceof NBTTagCompound) {
list.add(new LazyCompoundTag_1_16_4((NBTTagCompound) elem)); list.add(new LazyCompoundTag_1_16_5((NBTTagCompound) elem));
} else { } else {
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem)); list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
} }

Datei anzeigen

@ -22,12 +22,12 @@ package com.sk89q.worldedit.bukkit.adapter.impl;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket; import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.BlockMaterial_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.BlockMaterial_1_16_5;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.BukkitAdapter_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.BukkitAdapter_1_16_5;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.BukkitGetBlocks_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.BukkitGetBlocks_1_16_5;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.FAWEWorldNativeAccess_1_16_R3; import com.boydti.fawe.bukkit.adapter.mc1_16_5.FAWEWorldNativeAccess_1_16_R3;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.MapChunkUtil_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.MapChunkUtil_1_16_5;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.nbt.LazyCompoundTag_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.nbt.LazyCompoundTag_1_16_5;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.StringTag;
@ -130,7 +130,7 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
ordinalToIbdID = new int[ibdToStateOrdinal.length]; // size ordinalToIbdID = new int[ibdToStateOrdinal.length]; // size
for (int i = 0; i < ibdToStateOrdinal.length; i++) { for (int i = 0; i < ibdToStateOrdinal.length; i++) {
BlockState state = BlockTypesCache.states[i]; BlockState state = BlockTypesCache.states[i];
BlockMaterial_1_16_4 material = (BlockMaterial_1_16_4) state.getMaterial(); BlockMaterial_1_16_5 material = (BlockMaterial_1_16_5) state.getMaterial();
int id = Block.REGISTRY_ID.getId(material.getState()); int id = Block.REGISTRY_ID.getId(material.getState());
char ordinal = state.getOrdinalChar(); char ordinal = state.getOrdinalChar();
ibdToStateOrdinal[id] = ordinal; ibdToStateOrdinal[id] = ordinal;
@ -142,13 +142,13 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
@Override @Override
public BlockMaterial getMaterial(BlockType blockType) { public BlockMaterial getMaterial(BlockType blockType) {
Block block = getBlock(blockType); Block block = getBlock(blockType);
return new BlockMaterial_1_16_4(block); return new BlockMaterial_1_16_5(block);
} }
@Override @Override
public synchronized BlockMaterial getMaterial(BlockState state) { public synchronized BlockMaterial getMaterial(BlockState state) {
IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState(); IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState();
return new BlockMaterial_1_16_4(bs.getBlock(), bs); return new BlockMaterial_1_16_5(bs.getBlock(), bs);
} }
public Block getBlock(BlockType blockType) { public Block getBlock(BlockType blockType) {
@ -195,14 +195,14 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
World nmsWorld = nmsChunk.getWorld(); World nmsWorld = nmsChunk.getWorld();
BlockPosition blockPos = new BlockPosition(x, y, z); BlockPosition blockPos = new BlockPosition(x, y, z);
IBlockData blockData = ((BlockMaterial_1_16_4) state.getMaterial()).getState(); IBlockData blockData = ((BlockMaterial_1_16_5) state.getMaterial()).getState();
ChunkSection[] sections = nmsChunk.getSections(); ChunkSection[] sections = nmsChunk.getSections();
int y4 = y >> 4; int y4 = y >> 4;
ChunkSection section = sections[y4]; ChunkSection section = sections[y4];
IBlockData existing; IBlockData existing;
if (section == null) { if (section == null) {
existing = ((BlockMaterial_1_16_4) BlockTypes.AIR.getDefaultState().getMaterial()).getState(); existing = ((BlockMaterial_1_16_5) BlockTypes.AIR.getDefaultState().getMaterial()).getState();
} else { } else {
existing = section.getType(x & 15, y & 15, z & 15); existing = section.getType(x & 15, y & 15, z & 15);
} }
@ -303,7 +303,7 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
@Override @Override
public OptionalInt getInternalBlockStateId(BlockState state) { public OptionalInt getInternalBlockStateId(BlockState state) {
BlockMaterial_1_16_4 material = (BlockMaterial_1_16_4) state.getMaterial(); BlockMaterial_1_16_5 material = (BlockMaterial_1_16_5) state.getMaterial();
IBlockData mcState = material.getCraftBlockData().getState(); IBlockData mcState = material.getCraftBlockData().getState();
return OptionalInt.of(Block.REGISTRY_ID.getId(mcState)); return OptionalInt.of(Block.REGISTRY_ID.getId(mcState));
} }
@ -366,16 +366,16 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
@Override @Override
public <B extends BlockStateHolder<B>> BlockData adapt(B state) { public <B extends BlockStateHolder<B>> BlockData adapt(B state) {
BlockMaterial_1_16_4 material = (BlockMaterial_1_16_4) state.getMaterial(); BlockMaterial_1_16_5 material = (BlockMaterial_1_16_5) state.getMaterial();
return material.getCraftBlockData(); return material.getCraftBlockData();
} }
private MapChunkUtil_1_16_4 mapUtil = new MapChunkUtil_1_16_4(); private MapChunkUtil_1_16_5 mapUtil = new MapChunkUtil_1_16_5();
@Override @Override
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) { public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) {
WorldServer nmsWorld = ((CraftWorld) world).getHandle(); WorldServer nmsWorld = ((CraftWorld) world).getHandle();
PlayerChunk map = BukkitAdapter_1_16_4.getPlayerChunk(nmsWorld, packet.getChunkX(), packet.getChunkZ()); PlayerChunk map = BukkitAdapter_1_16_5.getPlayerChunk(nmsWorld, packet.getChunkX(), packet.getChunkZ());
if (map != null && map.hasBeenLoaded()) { if (map != null && map.hasBeenLoaded()) {
boolean flag = false; boolean flag = false;
PlayerChunk.d players = map.players; PlayerChunk.d players = map.players;
@ -428,8 +428,8 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
@Override @Override
public NBTBase fromNative(Tag foreign) { public NBTBase fromNative(Tag foreign) {
if (foreign instanceof LazyCompoundTag_1_16_4) { if (foreign instanceof LazyCompoundTag_1_16_5) {
return ((LazyCompoundTag_1_16_4) foreign).get(); return ((LazyCompoundTag_1_16_5) foreign).get();
} }
return parent.fromNative(foreign); return parent.fromNative(foreign);
} }
@ -441,7 +441,7 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
@Override @Override
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) {
return new BukkitGetBlocks_1_16_4(world, chunkX, chunkZ); return new BukkitGetBlocks_1_16_5(world, chunkX, chunkZ);
} }
@Override @Override

Datei anzeigen

@ -3,7 +3,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.regen;
import com.boydti.fawe.Fawe; import com.boydti.fawe.Fawe;
import com.boydti.fawe.beta.IChunkCache; import com.boydti.fawe.beta.IChunkCache;
import com.boydti.fawe.beta.IChunkGet; import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.BukkitGetBlocks_1_16_4; import com.boydti.fawe.bukkit.adapter.mc1_16_5.BukkitGetBlocks_1_16_5;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.mojang.datafixers.util.Either; import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec; import com.mojang.serialization.Codec;
@ -328,7 +328,7 @@ public class Regen_v1_16_R3 extends Regenerator<IChunkAccess, ProtoChunk, Chunk,
@Override @Override
protected IChunkCache<IChunkGet> initSourceQueueCache() { protected IChunkCache<IChunkGet> initSourceQueueCache() {
return (chunkX, chunkZ) -> new BukkitGetBlocks_1_16_4(freshNMSWorld, chunkX, chunkZ) { return (chunkX, chunkZ) -> new BukkitGetBlocks_1_16_5(freshNMSWorld, chunkX, chunkZ) {
@Override @Override
public Chunk ensureLoaded(World nmsWorld, int x, int z) { public Chunk ensureLoaded(World nmsWorld, int x, int z) {
return getChunkAt(x, z); return getChunkAt(x, z);