diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/FaweBlockStateListPopulator.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/FaweBlockStateListPopulator.java index c0233adee..a802a2e7a 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/FaweBlockStateListPopulator.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/FaweBlockStateListPopulator.java @@ -9,7 +9,6 @@ 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; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.chunk.ChunkAccess; @@ -122,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator { @Override public BlockState getBlockState(final BlockPos pos) { - BlockState state = world.getBlockState(pos); - try { - state = new BlockState( - state.getBlock(), - state.getValues(), - PaperweightPlatformAdapter.getStatePropertiesCodec(state) - ) { - @Override - public boolean is(Block block) { - return true; - } - }; - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - return state; + return world.getBlockState(pos); } @Override 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 34bea5cc4..4780adc54 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 @@ -551,7 +551,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter(populator.getLevel().capturedBlockStates); + Map placedBlocks = populator.getList().stream().collect(Collectors.toMap( + CraftBlockState::getPosition, + craftBlockState -> craftBlockState + )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } finally { serverLevel.captureBlockStates = false; serverLevel.captureTreeGeneration = false; diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlatformAdapter.java index e08b358ac..da18f4ffb 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlatformAdapter.java @@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.TaskManager; import com.mojang.datafixers.util.Either; -import com.mojang.serialization.MapCodec; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; @@ -712,12 +711,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return List.of(); } - public static MapCodec getStatePropertiesCodec( - net.minecraft.world.level.block.state.BlockState state - ) throws IllegalAccessException { - return (MapCodec) fieldPropertiesCodec.get(state); - } - record FakeIdMapBlock(int size) implements IdMap { @Override 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 c05144d92..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 @@ -9,7 +9,6 @@ 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; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.chunk.ChunkAccess; @@ -122,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator { @Override public BlockState getBlockState(final BlockPos pos) { - BlockState state = world.getBlockState(pos); - try { - state = new BlockState( - state.getBlock(), - state.getValues(), - PaperweightPlatformAdapter.getStatePropertiesCodec(state) - ) { - @Override - public boolean is(Block block) { - return true; - } - }; - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - return state; + return world.getBlockState(pos); } @Override 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 01214d70a..26992bf1c 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 @@ -552,7 +552,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter(populator.getLevel().capturedBlockStates); + Map placedBlocks = populator.getList().stream().collect(Collectors.toMap( + CraftBlockState::getPosition, + craftBlockState -> craftBlockState + )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } finally { serverLevel.captureBlockStates = false; serverLevel.captureTreeGeneration = false; @@ -596,6 +601,7 @@ public final class PaperweightFaweAdapter extends FaweAdapter true ); + if (!structureStart.isValid()) { return null; } else { diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlatformAdapter.java index 7030883cc..8bfee0354 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlatformAdapter.java @@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.TaskManager; import com.mojang.datafixers.util.Either; -import com.mojang.serialization.MapCodec; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; @@ -712,12 +711,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return List.of(); } - public static MapCodec getStatePropertiesCodec( - net.minecraft.world.level.block.state.BlockState state - ) throws IllegalAccessException { - return (MapCodec) fieldPropertiesCodec.get(state); - } - record FakeIdMapBlock(int size) implements IdMap { @Override diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/FaweBlockStateListPopulator.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/FaweBlockStateListPopulator.java index d9cf01e9f..9a1e20c71 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/FaweBlockStateListPopulator.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/FaweBlockStateListPopulator.java @@ -1,6 +1,5 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R4; -import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; @@ -10,9 +9,7 @@ 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; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.border.WorldBorder; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkSource; @@ -124,22 +121,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator { @Override public BlockState getBlockState(final BlockPos pos) { - BlockState state = world.getBlockState(pos); - try { - state = new BlockState( - state.getBlock(), - (Reference2ObjectArrayMap, Comparable>) state.getValues(), - PaperweightPlatformAdapter.getStatePropertiesCodec(state) - ) { - @Override - public boolean is(Block block) { - return true; - } - }; - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - return state; + return world.getBlockState(pos); } @Override 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 202179eb5..227a6c1af 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 @@ -565,7 +565,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter(populator.getLevel().capturedBlockStates); + Map placedBlocks = populator.getList().stream().collect(Collectors.toMap( + CraftBlockState::getPosition, + craftBlockState -> craftBlockState + )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } finally { serverLevel.captureBlockStates = false; serverLevel.captureTreeGeneration = false; diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java index a427bc3db..1455077fd 100644 --- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java @@ -11,7 +11,6 @@ import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.TaskManager; import com.mojang.datafixers.util.Either; -import com.mojang.serialization.MapCodec; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; @@ -707,12 +706,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return List.of(); } - public static MapCodec getStatePropertiesCodec( - net.minecraft.world.level.block.state.BlockState state - ) throws IllegalAccessException { - return (MapCodec) fieldPropertiesCodec.get(state); - } - record FakeIdMapBlock(int size) implements IdMap { @Override diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/FaweBlockStateListPopulator.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/FaweBlockStateListPopulator.java index aa8f6e5e8..dd17271bb 100644 --- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/FaweBlockStateListPopulator.java +++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/FaweBlockStateListPopulator.java @@ -9,7 +9,6 @@ import net.minecraft.server.level.ServerLevel; 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.Block; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.Property; import net.minecraft.world.level.border.WorldBorder; @@ -118,22 +117,7 @@ public class FaweBlockStateListPopulator extends BlockStateListPopulator { @Override public BlockState getBlockState(final BlockPos pos) { - BlockState state = world.getBlockState(pos); - try { - state = new BlockState( - state.getBlock(), - (Reference2ObjectArrayMap, Comparable>) state.getValues(), - PaperweightPlatformAdapter.getStatePropertiesCodec(state) - ) { - @Override - public boolean is(Block block) { - return true; - } - }; - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - return state; + return world.getBlockState(pos); } @Override 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 7faf9bd30..de81ebd8d 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 @@ -566,7 +566,12 @@ public final class PaperweightFaweAdapter extends FaweAdapter(populator.getLevel().capturedBlockStates); + Map placedBlocks = populator.getList().stream().collect(Collectors.toMap( + CraftBlockState::getPosition, + craftBlockState -> craftBlockState + )); + placedBlocks.putAll(serverLevel.capturedBlockStates); + return placedBlocks; } finally { serverLevel.captureBlockStates = false; serverLevel.captureTreeGeneration = false; diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightPlatformAdapter.java index a1116ce03..766be603a 100644 --- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightPlatformAdapter.java @@ -12,7 +12,6 @@ import com.fastasyncworldedit.core.math.IntPair; import com.fastasyncworldedit.core.util.MathMan; import com.fastasyncworldedit.core.util.TaskManager; import com.mojang.datafixers.util.Either; -import com.mojang.serialization.MapCodec; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; @@ -681,12 +680,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } } - public static MapCodec getStatePropertiesCodec( - net.minecraft.world.level.block.state.BlockState state - ) throws IllegalAccessException { - return (MapCodec) fieldPropertiesCodec.get(state); - } - record FakeIdMapBlock(int size) implements IdMap { @Override