3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-17 00:20:09 +01:00

Cleanup and add for 1.21

Dieser Commit ist enthalten in:
dordsor21 2024-06-30 10:47:18 +01:00
Ursprung c44f736a96
Commit 35663a796a
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
9 geänderte Dateien mit 29 neuen und 43 gelöschten Zeilen

Datei anzeigen

@ -651,7 +651,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
= CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(PaperweightFakePlayer::new)); = CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(PaperweightFakePlayer::new));
@Override @Override
public boolean simulateItemUse(org.bukkit.World world, BlockVector3 position, BaseItem item, Direction face) { public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item, Direction face) {
CraftWorld craftWorld = (CraftWorld) world; CraftWorld craftWorld = (CraftWorld) world;
ServerLevel worldServer = craftWorld.getHandle(); ServerLevel worldServer = craftWorld.getHandle();
ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack

Datei anzeigen

@ -304,7 +304,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) { public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world))); return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
} }
@ -449,7 +449,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
ServerLevel nmsWorld = getServerLevel(world); ServerLevel nmsWorld = getServerLevel(world);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) { if (map != null && wasAccessibleSinceLastSave(map)) {
@ -484,7 +484,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState); int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess( return blockState1.hasPostProcess(
@ -712,12 +712,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
} }
@Override @Override
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { public IChunkGet get(World world, int chunkX, int chunkZ) {
return new PaperweightGetBlocks(world, chunkX, chunkZ); return new PaperweightGetBlocks(world, chunkX, chunkZ);
} }

Datei anzeigen

@ -45,7 +45,6 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.StateHolder;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.GlobalPalette; import net.minecraft.world.level.chunk.GlobalPalette;
@ -100,8 +99,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
private static final Field fieldTickingFluidCount; private static final Field fieldTickingFluidCount;
private static final Field fieldTickingBlockCount; private static final Field fieldTickingBlockCount;
private static final Field fieldPropertiesCodec;
private static final MethodHandle methodGetVisibleChunk; private static final MethodHandle methodGetVisibleChunk;
private static final Field fieldThreadingDetector; private static final Field fieldThreadingDetector;
@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldBiomes = tmpFieldBiomes; fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true); fieldBiomes.setAccessible(true);
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
fieldPropertiesCodec.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName( Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
"getVisibleChunkIfPresent", "getVisibleChunkIfPresent",
"b" "b"

Datei anzeigen

@ -304,7 +304,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) { public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world))); return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
} }
@ -449,7 +449,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
ServerLevel nmsWorld = getServerLevel(world); ServerLevel nmsWorld = getServerLevel(world);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) { if (map != null && wasAccessibleSinceLastSave(map)) {
@ -484,7 +484,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState); int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess( return blockState1.hasPostProcess(
@ -713,12 +713,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
} }
@Override @Override
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { public IChunkGet get(World world, int chunkX, int chunkZ) {
return new PaperweightGetBlocks(world, chunkX, chunkZ); return new PaperweightGetBlocks(world, chunkX, chunkZ);
} }

Datei anzeigen

@ -45,7 +45,6 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.StateHolder;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.ChunkStatus;
import net.minecraft.world.level.chunk.GlobalPalette; import net.minecraft.world.level.chunk.GlobalPalette;
@ -101,8 +100,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
private static final Field fieldTickingBlockCount; private static final Field fieldTickingBlockCount;
private static final Field fieldBiomes; private static final Field fieldBiomes;
private static final Field fieldPropertiesCodec;
private static final MethodHandle methodGetVisibleChunk; private static final MethodHandle methodGetVisibleChunk;
private static final Field fieldThreadingDetector; private static final Field fieldThreadingDetector;
@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldBiomes = tmpFieldBiomes; fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true); fieldBiomes.setAccessible(true);
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
fieldPropertiesCodec.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName( Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
"getVisibleChunkIfPresent", "getVisibleChunkIfPresent",
"b" "b"

Datei anzeigen

@ -312,7 +312,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) { public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world))); return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
} }
@ -457,7 +457,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
ServerLevel nmsWorld = getServerLevel(world); ServerLevel nmsWorld = getServerLevel(world);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) { if (map != null && wasAccessibleSinceLastSave(map)) {
@ -492,7 +492,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState); int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess( return blockState1.hasPostProcess(
@ -733,12 +733,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
} }
@Override @Override
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { public IChunkGet get(World world, int chunkX, int chunkZ) {
return new PaperweightGetBlocks(world, chunkX, chunkZ); return new PaperweightGetBlocks(world, chunkX, chunkZ);
} }

Datei anzeigen

@ -45,7 +45,6 @@ import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.StateHolder;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.GlobalPalette; import net.minecraft.world.level.chunk.GlobalPalette;
import net.minecraft.world.level.chunk.HashMapPalette; import net.minecraft.world.level.chunk.HashMapPalette;
@ -101,8 +100,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
private static final Field fieldTickingBlockCount; private static final Field fieldTickingBlockCount;
private static final Field fieldBiomes; private static final Field fieldBiomes;
private static final Field fieldPropertiesCodec;
private static final MethodHandle methodGetVisibleChunk; private static final MethodHandle methodGetVisibleChunk;
private static final Field fieldThreadingDetector; private static final Field fieldThreadingDetector;
@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldBiomes = tmpFieldBiomes; fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true); fieldBiomes.setAccessible(true);
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
fieldPropertiesCodec.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName( Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
"getVisibleChunkIfPresent", "getVisibleChunkIfPresent",
"b" "b"

Datei anzeigen

@ -1,6 +1,5 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1; package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1;
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
@ -10,7 +9,7 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.biome.BiomeManager;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.border.WorldBorder;
import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkSource; import net.minecraft.world.level.chunk.ChunkSource;
@ -18,7 +17,8 @@ import net.minecraft.world.level.chunk.status.ChunkStatus;
import net.minecraft.world.level.lighting.LevelLightEngine; import net.minecraft.world.level.lighting.LevelLightEngine;
import net.minecraft.world.level.material.FluidState; import net.minecraft.world.level.material.FluidState;
import org.bukkit.craftbukkit.util.BlockStateListPopulator; import org.bukkit.craftbukkit.util.BlockStateListPopulator;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
public class FaweBlockStateListPopulator extends BlockStateListPopulator { public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@ -69,6 +69,11 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
return world.getSeaLevel(); return world.getSeaLevel();
} }
@Override
public FeatureFlagSet enabledFeatures() {
return world.enabledFeatures();
}
@Override @Override
public float getShade(final Direction direction, final boolean shaded) { public float getShade(final Direction direction, final boolean shaded) {
return world.getShade(direction, shaded); return world.getShade(direction, shaded);

Datei anzeigen

@ -312,7 +312,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) { public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world))); return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
} }
@ -457,7 +457,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
ServerLevel nmsWorld = getServerLevel(world); ServerLevel nmsWorld = getServerLevel(world);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) { if (map != null && wasAccessibleSinceLastSave(map)) {
@ -492,7 +492,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
int internalId = BlockStateIdAccess.getBlockStateId(blockState); int internalId = BlockStateIdAccess.getBlockStateId(blockState);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess( return blockState1.hasPostProcess(
@ -585,7 +585,6 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
@Override @Override
public boolean generateStructure(StructureType type, World world, EditSession editSession, BlockVector3 pt) { public boolean generateStructure(StructureType type, World world, EditSession editSession, BlockVector3 pt) {
//FAWE start
ServerLevel serverLevel = ((CraftWorld) world).getHandle(); ServerLevel serverLevel = ((CraftWorld) world).getHandle();
Structure k = serverLevel Structure k = serverLevel
.registryAccess() .registryAccess()
@ -735,12 +734,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
} }
@Override @Override
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
} }
@Override @Override
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { public IChunkGet get(World world, int chunkX, int chunkZ) {
return new PaperweightGetBlocks(world, chunkX, chunkZ); return new PaperweightGetBlocks(world, chunkX, chunkZ);
} }