From 61eb5ecb06c33d0934dd852468e8bf2f8794d261 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 12 Dec 2023 17:28:36 +0000 Subject: [PATCH] Update 1.20.3/4 adapters --- .../fawe/v1_20_R2/PaperweightFaweAdapter.java | 1 - .../ext.fawe/v1_20_R3/PaperweightAdapter.java | 3 ++- .../PaperweightServerLevelDelegateProxy.java | 2 +- .../v1_20_R3/FaweBlockStateListPopulator.java | 26 +++++++++++++++++++ .../fawe/v1_20_R3/PaperweightFaweAdapter.java | 9 ++++--- .../fawe/v1_20_R4/PaperweightFaweAdapter.java | 8 +++--- .../fawe/v1_21_R1/PaperweightFaweAdapter.java | 9 ++++--- 7 files changed, 46 insertions(+), 12 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java index cde16e321..316c9d207 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java @@ -688,7 +688,6 @@ public final class PaperweightFaweAdapter extends FaweAdapter true); + StructureStart structureStart = k.generate(originalWorld.registryAccess(), chunkManager.getGenerator(), chunkManager.getGenerator().getBiomeSource(), chunkManager.randomState(), originalWorld.getStructureManager(), originalWorld.getSeed(), chunkPos, 0, proxyLevel, biome -> true); if (!structureStart.isValid()) { return false; diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightServerLevelDelegateProxy.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightServerLevelDelegateProxy.java index c61ec5931..bff0df85f 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightServerLevelDelegateProxy.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext.fawe/v1_20_R3/PaperweightServerLevelDelegateProxy.java @@ -35,7 +35,7 @@ import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Proxy; -public class PaperweightServerLevelDelegateProxy implements InvocationHandler { +public class PaperweightServerLevelDelegateProxy implements InvocationHandler { private final EditSession editSession; private final ServerLevel serverLevel; diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/FaweBlockStateListPopulator.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/FaweBlockStateListPopulator.java index 0fe249092..6b9050fed 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/FaweBlockStateListPopulator.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/FaweBlockStateListPopulator.java @@ -5,6 +5,7 @@ import net.minecraft.core.Direction; import net.minecraft.core.Holder; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.BiomeManager; @@ -103,4 +104,29 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator { return world.getWorldBorder(); } + @Override + public boolean setBlock(final BlockPos pos, final BlockState state, final int flags, final int maxUpdateDepth) { + return world.setBlock(pos, state, flags, maxUpdateDepth); + } + + @Override + public boolean removeBlock(final BlockPos pos, final boolean move) { + return world.removeBlock(pos, move); + } + + @Override + public boolean destroyBlock(final BlockPos pos, final boolean drop, final Entity breakingEntity, final int maxUpdateDepth) { + return world.destroyBlock(pos, drop, breakingEntity, maxUpdateDepth); + } + + @Override + public BlockState getBlockState(final BlockPos pos) { + return world.getBlockState(pos); + } + + @Override + public boolean setBlock(final BlockPos pos, final BlockState state, final int flags) { + return world.setBlock(pos, state, flags); + } + } diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java index ed4681a92..b39bfdd8c 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java @@ -529,6 +529,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter true ); if (!structureStart.isValid()) { @@ -611,7 +612,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter structureStart.placeInChunk( - serverLevel, + populator, serverLevel.structureManager(), chunkManager.getGenerator(), serverLevel.getRandom(), @@ -625,10 +626,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter placedBlocks = populator.getList().stream().collect(Collectors.toMap( CraftBlockState::getPosition, craftBlockState -> craftBlockState )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } } finally { serverLevel.captureBlockStates = false; diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java index a7ce14c87..2f6986cc3 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java @@ -610,7 +610,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter true ); if (!structureStart.isValid()) { @@ -626,7 +626,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter structureStart.placeInChunk( - serverLevel, + populator, serverLevel.structureManager(), chunkManager.getGenerator(), serverLevel.getRandom(), @@ -640,10 +640,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter placedBlocks = populator.getList().stream().collect(Collectors.toMap( CraftBlockState::getPosition, craftBlockState -> craftBlockState )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } } finally { serverLevel.captureBlockStates = false; diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java index e88cb4dda..11a52a0a8 100644 --- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java @@ -582,6 +582,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter true ); if (!structureStart.isValid()) { @@ -626,7 +627,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter structureStart.placeInChunk( - serverLevel, + populator, serverLevel.structureManager(), chunkManager.getGenerator(), serverLevel.getRandom(), @@ -640,10 +641,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter placedBlocks = populator.getList().stream().collect(Collectors.toMap( CraftBlockState::getPosition, craftBlockState -> craftBlockState )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } } finally { serverLevel.captureBlockStates = false;