3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-16 16:10:07 +01:00

Cleanup and add for 1.21

Dieser Commit ist enthalten in:
dordsor21 2024-06-30 10:47:18 +01:00
Ursprung 4b2f47e9f9
Commit 0a3a6074c2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B
9 geänderte Dateien mit 32 neuen und 45 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));
@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;
ServerLevel worldServer = craftWorld.getHandle();
ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack

Datei anzeigen

@ -312,7 +312,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
}
@ -457,7 +457,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) {
@ -492,7 +492,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess(
@ -720,12 +720,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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();
}
@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);
}

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.Blocks;
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.ChunkStatus;
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 fieldTickingBlockCount;
private static final Field fieldPropertiesCodec;
private static final MethodHandle methodGetVisibleChunk;
private static final Field fieldThreadingDetector;
@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true);
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
fieldPropertiesCodec.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
"getVisibleChunkIfPresent",
"b"

Datei anzeigen

@ -312,7 +312,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
}
@ -457,7 +457,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) {
@ -492,7 +492,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess(
@ -721,12 +721,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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();
}
@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);
}

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.Blocks;
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.ChunkStatus;
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 fieldBiomes;
private static final Field fieldPropertiesCodec;
private static final MethodHandle methodGetVisibleChunk;
private static final Field fieldThreadingDetector;
@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true);
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
fieldPropertiesCodec.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
"getVisibleChunkIfPresent",
"b"

Datei anzeigen

@ -320,7 +320,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
}
@ -465,7 +465,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) {
@ -500,7 +500,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess(
@ -741,12 +741,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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();
}
@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);
}

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.Blocks;
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.GlobalPalette;
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 fieldBiomes;
private static final Field fieldPropertiesCodec;
private static final MethodHandle methodGetVisibleChunk;
private static final Field fieldThreadingDetector;
@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldBiomes = tmpFieldBiomes;
fieldBiomes.setAccessible(true);
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
fieldPropertiesCodec.setAccessible(true);
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
"getVisibleChunkIfPresent",
"b"

Datei anzeigen

@ -1,6 +1,5 @@
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.Direction;
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.BiomeManager;
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.chunk.ChunkAccess;
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.material.FluidState;
import org.bukkit.craftbukkit.util.BlockStateListPopulator;
import org.jetbrains.annotations.Nullable;
import javax.annotation.Nullable;
public class FaweBlockStateListPopulator extends BlockStateListPopulator {
@ -69,6 +69,11 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator {
return world.getSeaLevel();
}
@Override
public FeatureFlagSet enabledFeatures() {
return world.enabledFeatures();
}
@Override
public float getShade(final Direction direction, final boolean shaded) {
return world.getShade(direction, shaded);

Datei anzeigen

@ -21,6 +21,7 @@ import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_21_R1.PaperweightAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1.nbt.PaperweightLazyCompoundTag;
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1.regen.PaperweightRegen;
import com.sk89q.worldedit.entity.BaseEntity;
@ -139,7 +140,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
}
private final com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_21_R1.PaperweightAdapter parent;
private final PaperweightAdapter parent;
// ------------------------------------------------------------------------
// Code that may break between versions of Minecraft
// ------------------------------------------------------------------------
@ -150,7 +151,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
private Map<String, List<Property<?>>> allBlockProperties = null;
public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException {
this.parent = new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_21_R1.PaperweightAdapter();
this.parent = new PaperweightAdapter();
}
public Function<BlockEntity, FaweCompoundTag> blockEntityToCompoundTag() {
@ -320,7 +321,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@Override
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
}
@ -465,7 +466,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
if (map != null && wasAccessibleSinceLastSave(map)) {
@ -500,7 +501,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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);
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
return blockState1.hasPostProcess(
@ -593,7 +594,6 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
@Override
public boolean generateStructure(StructureType type, World world, EditSession editSession, BlockVector3 pt) {
//FAWE start
ServerLevel serverLevel = ((CraftWorld) world).getHandle();
Structure k = serverLevel
.registryAccess()
@ -743,12 +743,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter<net.minecraft.nbt.
}
@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();
}
@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);
}