geforkt von Mirrors/FastAsyncWorldEdit
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:
Ursprung
3ba982927a
Commit
0f6b56572a
@ -57,13 +57,13 @@ dependencies {
|
||||
"compile"("org.spigotmcv1_16_r2:spigotmcv1_16_r2:1_16_r2")
|
||||
"compile"("org.spigotmcv1_16_r3:spigotmcv1_16_r3:1_16_r3")
|
||||
"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")
|
||||
isTransitive = false
|
||||
}
|
||||
"compileOnly"("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")
|
||||
"compileOnly"("com.sk89q:dummypermscompat:1.10") {
|
||||
exclude("com.github.MilkBowl", "VaultAPI")
|
||||
|
@ -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.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 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 IBlockData defaultState;
|
||||
private final Material material;
|
||||
@ -21,11 +21,11 @@ public class BlockMaterial_1_16_4 implements BlockMaterial {
|
||||
private final org.bukkit.Material craftMaterial;
|
||||
private final int opacity;
|
||||
|
||||
public BlockMaterial_1_16_4(Block block) {
|
||||
public BlockMaterial_1_16_5(Block block) {
|
||||
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.defaultState = defaultState;
|
||||
this.material = defaultState.getMaterial();
|
@ -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.FaweCache;
|
||||
@ -51,7 +51,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
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
|
||||
*/
|
||||
@ -310,7 +310,7 @@ public final class BukkitAdapter_1_16_4 extends NMSAdapter {
|
||||
final int ordinal = paletteToBlock[i];
|
||||
blockToPalette[ordinal] = Integer.MAX_VALUE;
|
||||
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);
|
||||
}
|
||||
try {
|
@ -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.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.bukkit.adapter.BukkitGetBlocks;
|
||||
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.object.collection.AdaptedMap;
|
||||
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
||||
@ -77,12 +77,12 @@ import java.util.function.Function;
|
||||
|
||||
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<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 Chunk nmsChunk;
|
||||
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[] skyLight = new NibbleArray[16];
|
||||
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 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);
|
||||
}
|
||||
|
||||
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.chunkX = chunkX;
|
||||
this.chunkZ = chunkZ;
|
||||
@ -212,7 +212,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
if (tileEntity == 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
|
||||
@ -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) {
|
||||
if (this.getChunk() != 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) {
|
||||
return BukkitAdapter_1_16_4.ensureLoaded(nmsWorld, chunkX, chunkZ);
|
||||
return BukkitAdapter_1_16_5.ensureLoaded(nmsWorld, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized <T extends Future<T>> T call(IChunkSet set, Runnable finalizer) {
|
||||
forceLoadSections = false;
|
||||
copy = createCopy ? new BukkitGetBlocks_1_16_4_Copy(world) : null;
|
||||
copy = createCopy ? new BukkitGetBlocks_1_16_5_Copy(world) : null;
|
||||
try {
|
||||
WorldServer nmsWorld = world;
|
||||
Chunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ);
|
||||
@ -434,8 +434,8 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
ChunkSection newSection;
|
||||
ChunkSection existingSection = sections[layer];
|
||||
if (existingSection == null) {
|
||||
newSection = BukkitAdapter_1_16_4.newChunkSection(layer, setArr, fastmode);
|
||||
if (BukkitAdapter_1_16_4.setSectionAtomic(sections, null, newSection, layer)) {
|
||||
newSection = BukkitAdapter_1_16_5.newChunkSection(layer, setArr, fastmode);
|
||||
if (BukkitAdapter_1_16_5.setSectionAtomic(sections, null, newSection, layer)) {
|
||||
updateGet(this, nmsChunk, sections, newSection, setArr, layer);
|
||||
continue;
|
||||
} 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.
|
||||
DelegateLock lock = BukkitAdapter_1_16_4.applyLock(existingSection);
|
||||
DelegateLock lock = BukkitAdapter_1_16_5.applyLock(existingSection);
|
||||
|
||||
synchronized (this) {
|
||||
synchronized (lock) {
|
||||
@ -467,9 +467,9 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
} else if (lock.isModified()) {
|
||||
this.reset(layer);
|
||||
}
|
||||
newSection = BukkitAdapter_1_16_4
|
||||
newSection = BukkitAdapter_1_16_5
|
||||
.newChunkSection(layer, this::loadPrivately, setArr, fastmode);
|
||||
if (!BukkitAdapter_1_16_4
|
||||
if (!BukkitAdapter_1_16_5
|
||||
.setSectionAtomic(sections, existingSection, newSection, layer)) {
|
||||
log.error("Failed to set chunk section:" + chunkX + "," + chunkZ + " layer: " + layer);
|
||||
} else {
|
||||
@ -503,10 +503,10 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
|
||||
Map<HeightMapType, int[]> heightMaps = set.getHeightMaps();
|
||||
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_4.this.setSkyLightingToGet(set.getSkyLight());
|
||||
BukkitGetBlocks_1_16_5.this.setLightingToGet(set.getLight());
|
||||
BukkitGetBlocks_1_16_5.this.setSkyLightingToGet(set.getSkyLight());
|
||||
|
||||
Runnable[] syncTasks = null;
|
||||
|
||||
@ -552,7 +552,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
|
||||
if (idTag == null || posTag == null || rotTag == null) {
|
||||
getLogger(
|
||||
BukkitGetBlocks_1_16_4.class).debug("Unknown entity tag: " + nativeTag);
|
||||
BukkitGetBlocks_1_16_5.class).debug("Unknown entity tag: " + nativeTag);
|
||||
continue;
|
||||
}
|
||||
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()) {
|
||||
return super.blocks[layer];
|
||||
} else {
|
||||
return BukkitGetBlocks_1_16_4.this.update(layer, null);
|
||||
return BukkitGetBlocks_1_16_5.this.update(layer, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -708,7 +708,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
data = new char[4096];
|
||||
Arrays.fill(data, (char) 1);
|
||||
}
|
||||
DelegateLock lock = BukkitAdapter_1_16_4.applyLock(section);
|
||||
DelegateLock lock = BukkitAdapter_1_16_5.applyLock(section);
|
||||
synchronized (lock) {
|
||||
lock.untilFree();
|
||||
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());
|
||||
|
||||
final DataPaletteBlock<IBlockData> blocks = section.getBlocks();
|
||||
final DataBits bits = (DataBits) BukkitAdapter_1_16_4.fieldBits.get(blocks);
|
||||
final DataPalette<IBlockData> palette = (DataPalette<IBlockData>) BukkitAdapter_1_16_4.fieldPalette.get(blocks);
|
||||
final DataBits bits = (DataBits) BukkitAdapter_1_16_5.fieldBits.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();
|
||||
|
||||
new BitArrayUnstretched(bitsPerEntry, 4096, blockStates).toRaw(data);
|
||||
@ -887,7 +887,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks implements BukkitGetBl
|
||||
try {
|
||||
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;
|
||||
|
||||
if (palette instanceof DataPaletteLinear) {
|
@ -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;
|
||||
@ -6,7 +6,7 @@ import com.boydti.fawe.beta.IBlocks;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
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.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
@ -35,7 +35,7 @@ import java.util.Set;
|
||||
import java.util.UUID;
|
||||
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 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 WorldServer world;
|
||||
|
||||
protected BukkitGetBlocks_1_16_4_Copy(WorldServer world) {
|
||||
protected BukkitGetBlocks_1_16_5_Copy(WorldServer world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
protected void storeTile(TileEntity tile) {
|
||||
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
|
||||
@ -115,7 +115,7 @@ public class BukkitGetBlocks_1_16_4_Copy implements IChunkGet {
|
||||
public void setHeightmapToGet(HeightMapType type, int[] data) {}
|
||||
|
||||
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
|
@ -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.object.IntPair;
|
||||
@ -214,7 +214,7 @@ public class FAWEWorldNativeAccess_1_16_R3 implements WorldNativeAccess<Chunk, I
|
||||
return;
|
||||
}
|
||||
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,
|
||||
sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE)));
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
@ -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 net.minecraft.server.v1_16_R3.PacketPlayOutMapChunk;
|
||||
|
||||
public class MapChunkUtil_1_16_4 extends MapChunkUtil<PacketPlayOutMapChunk> {
|
||||
public MapChunkUtil_1_16_4() throws NoSuchFieldException {
|
||||
public class MapChunkUtil_1_16_5 extends MapChunkUtil<PacketPlayOutMapChunk> {
|
||||
public MapChunkUtil_1_16_5() throws NoSuchFieldException {
|
||||
fieldX = PacketPlayOutMapChunk.class.getDeclaredField("a");
|
||||
fieldZ = PacketPlayOutMapChunk.class.getDeclaredField("b");
|
||||
fieldBitMask = PacketPlayOutMapChunk.class.getDeclaredField("c");
|
@ -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.ListTag;
|
||||
@ -17,17 +17,17 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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 CompoundTag cachedValue;
|
||||
|
||||
public LazyCompoundTag_1_16_4(Supplier<NBTTagCompound> tag) {
|
||||
public LazyCompoundTag_1_16_5(Supplier<NBTTagCompound> tag) {
|
||||
super(new HashMap<>());
|
||||
this.nmsTag = tag;
|
||||
}
|
||||
|
||||
public LazyCompoundTag_1_16_4(NBTTagCompound tag) {
|
||||
public LazyCompoundTag_1_16_5(NBTTagCompound tag) {
|
||||
this(() -> tag);
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public class LazyCompoundTag_1_16_4 extends CompoundTag {
|
||||
NBTTagList nbtList = (NBTTagList) tag;
|
||||
for (NBTBase elem : nbtList) {
|
||||
if (elem instanceof NBTTagCompound) {
|
||||
list.add(new LazyCompoundTag_1_16_4((NBTTagCompound) elem));
|
||||
list.add(new LazyCompoundTag_1_16_5((NBTTagCompound) elem));
|
||||
} else {
|
||||
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
|
||||
}
|
@ -22,12 +22,12 @@ package com.sk89q.worldedit.bukkit.adapter.impl;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
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_4.BukkitAdapter_1_16_4;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_4.BukkitGetBlocks_1_16_4;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_4.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_4.nbt.LazyCompoundTag_1_16_4;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_5.BlockMaterial_1_16_5;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_5.BukkitAdapter_1_16_5;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_5.BukkitGetBlocks_1_16_5;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_5.FAWEWorldNativeAccess_1_16_R3;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_5.MapChunkUtil_1_16_5;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_5.nbt.LazyCompoundTag_1_16_5;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
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
|
||||
for (int i = 0; i < ibdToStateOrdinal.length; 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());
|
||||
char ordinal = state.getOrdinalChar();
|
||||
ibdToStateOrdinal[id] = ordinal;
|
||||
@ -142,13 +142,13 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
|
||||
@Override
|
||||
public BlockMaterial getMaterial(BlockType blockType) {
|
||||
Block block = getBlock(blockType);
|
||||
return new BlockMaterial_1_16_4(block);
|
||||
return new BlockMaterial_1_16_5(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized BlockMaterial getMaterial(BlockState state) {
|
||||
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) {
|
||||
@ -195,14 +195,14 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
|
||||
World nmsWorld = nmsChunk.getWorld();
|
||||
|
||||
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();
|
||||
int y4 = y >> 4;
|
||||
ChunkSection section = sections[y4];
|
||||
|
||||
IBlockData existing;
|
||||
if (section == null) {
|
||||
existing = ((BlockMaterial_1_16_4) BlockTypes.AIR.getDefaultState().getMaterial()).getState();
|
||||
existing = ((BlockMaterial_1_16_5) BlockTypes.AIR.getDefaultState().getMaterial()).getState();
|
||||
} else {
|
||||
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
|
||||
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();
|
||||
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
|
||||
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();
|
||||
}
|
||||
|
||||
private MapChunkUtil_1_16_4 mapUtil = new MapChunkUtil_1_16_4();
|
||||
private MapChunkUtil_1_16_5 mapUtil = new MapChunkUtil_1_16_5();
|
||||
|
||||
@Override
|
||||
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) {
|
||||
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()) {
|
||||
boolean flag = false;
|
||||
PlayerChunk.d players = map.players;
|
||||
@ -428,8 +428,8 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
|
||||
|
||||
@Override
|
||||
public NBTBase fromNative(Tag foreign) {
|
||||
if (foreign instanceof LazyCompoundTag_1_16_4) {
|
||||
return ((LazyCompoundTag_1_16_4) foreign).get();
|
||||
if (foreign instanceof LazyCompoundTag_1_16_5) {
|
||||
return ((LazyCompoundTag_1_16_5) foreign).get();
|
||||
}
|
||||
return parent.fromNative(foreign);
|
||||
}
|
||||
@ -441,7 +441,7 @@ public final class FAWE_Spigot_v1_16_R3 extends CachedBukkitAdapter implements I
|
||||
|
||||
@Override
|
||||
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
|
||||
|
@ -3,7 +3,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.regen;
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.beta.IChunkCache;
|
||||
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.mojang.datafixers.util.Either;
|
||||
import com.mojang.serialization.Codec;
|
||||
@ -328,7 +328,7 @@ public class Regen_v1_16_R3 extends Regenerator<IChunkAccess, ProtoChunk, Chunk,
|
||||
|
||||
@Override
|
||||
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
|
||||
public Chunk ensureLoaded(World nmsWorld, int x, int z) {
|
||||
return getChunkAt(x, z);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren