From c2cc4f5aeb9e65fd32ab18eac0a126addca57001 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 20 Dec 2019 05:54:03 +0000 Subject: [PATCH] Fix craftbook --- .../com/boydti/fawe/bukkit/FaweBukkit.java | 1 - .../adapter/mc1_15/BukkitGetBlocks_1_15.java | 2 +- .../com/boydti/fawe/beta/IDelegateChunk.java | 9 ++---- .../implementation/chunk/ChunkHolder.java | 6 ---- .../beta/implementation/chunk/NullChunk.java | 5 --- .../factory/parser/DefaultBlockParser.java | 32 +++++++++---------- .../worldedit/world/block/CompoundInput.java | 2 +- .../world/block/FuzzyBlockState.java | 2 +- 8 files changed, 21 insertions(+), 38 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index cddda8fb0..1ab8535cf 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -12,7 +12,6 @@ import com.boydti.fawe.bukkit.listener.CFIPacketListener; import com.boydti.fawe.bukkit.listener.ChunkListener_8; import com.boydti.fawe.bukkit.listener.ChunkListener_9; import com.boydti.fawe.bukkit.listener.RenderListener; -import com.boydti.fawe.bukkit.regions.ASkyBlockHook; import com.boydti.fawe.bukkit.regions.FactionsUUIDFeature; import com.boydti.fawe.bukkit.regions.FreeBuildRegion; import com.boydti.fawe.bukkit.regions.GriefPreventionFeature; diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java index 316de949d..ba2c9a37e 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_15/BukkitGetBlocks_1_15.java @@ -80,7 +80,7 @@ public class BukkitGetBlocks_1_15 extends CharGetBlocks { } @Override - public CompoundTag getTag(int x, int y, int z) { + public CompoundTag getTile(int x, int y, int z) { TileEntity tileEntity = getChunk().getTileEntity(new BlockPosition((x & 15) + (X << 4), y, (z & 15) + (Z << 4))); return new LazyCompoundTag_1_15(Suppliers.memoize(() -> tileEntity.save(new NBTTagCompound()))); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/IDelegateChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/IDelegateChunk.java index e9952dcbe..9838c5fa4 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/IDelegateChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/IDelegateChunk.java @@ -40,8 +40,8 @@ public interface IDelegateChunk extends IQueueChunk { } @Override - default CompoundTag getTag(int x, int y, int z) { - return getParent().getTag(x, y, z); + default CompoundTag getTile(int x, int y, int z) { + return getParent().getTile(x, y, z); } @Override @@ -54,11 +54,6 @@ public interface IDelegateChunk extends IQueueChunk { // getParent().flood(flood, mask, block); // } - @Override - default CompoundTag getTile(int x, int y, int z) { - return getParent().getTile(x, y, z); - } - @Override default boolean setTile(int x, int y, int z, CompoundTag tag) { return getParent().setTile(x, y, z, tag); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java index e8a44584c..2468ec128 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/ChunkHolder.java @@ -293,12 +293,6 @@ public class ChunkHolder> implements IQueueChunk { //// block.flood(get, set, mask, block, ); // } - @Override - public CompoundTag getTag(int x, int y, int z) { - return delegate.getFullBlock(this, x, y, z) - .getNbtData(); // TODO NOT IMPLEMENTED (add getTag delegate) - } - @Override public Map getTiles() { return delegate.get(this).getTiles(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/NullChunk.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/NullChunk.java index 5c0d983c5..6b2516dd6 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/NullChunk.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/chunk/NullChunk.java @@ -112,11 +112,6 @@ public enum NullChunk implements IQueueChunk { return BlockTypes.__RESERVED__.getDefaultState().toBaseBlock(); } - @Override - public CompoundTag getTag(int x, int y, int z) { - return null; - } - @Override public Map getTiles() { return Collections.emptyMap(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java index 0b5f1aa2f..74e0d6306 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/parser/DefaultBlockParser.java @@ -346,23 +346,23 @@ public class DefaultBlockParser extends InputParser { if (stateString != null) { state = BlockState.get(state.getBlockType(), "[" + stateString + "]", state); - if (context.isPreferringWildcard()) { - if (stateString.isEmpty()) { - state = new FuzzyBlockState(state); - } else { - BlockType type = state.getBlockType(); - FuzzyBlockState.Builder fuzzyBuilder = FuzzyBlockState.builder(); - fuzzyBuilder.type(type); - String[] entries = stateString.split(","); - for (String entry : entries) { - String[] split = entry.split("="); - String key = split[0]; - String val = split[1]; - Property prop = type.getProperty(key); - fuzzyBuilder.withProperty(prop, prop.getValueFor(val)); - } - state = fuzzyBuilder.build(); + } + if (context.isPreferringWildcard()) { + if (stateString == null || stateString.isEmpty()) { + state = new FuzzyBlockState(state); + } else { + BlockType type = state.getBlockType(); + FuzzyBlockState.Builder fuzzyBuilder = FuzzyBlockState.builder(); + fuzzyBuilder.type(type); + String[] entries = stateString.split(","); + for (String entry : entries) { + String[] split = entry.split("="); + String key = split[0]; + String val = split[1]; + Property prop = type.getProperty(key); + fuzzyBuilder.withProperty(prop, prop.getValueFor(val)); } + state = fuzzyBuilder.build(); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java index a6556a3db..cd25c817b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/CompoundInput.java @@ -7,7 +7,7 @@ public enum CompoundInput { CONTAINER() { @Override public BaseBlock get(BlockState state, ITileInput input, int x, int y, int z) { - return state.toBaseBlock(input.getTag(x, y, z)); + return state.toBaseBlock(input.getTile(x, y, z)); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java index e28d86ea5..1d99baae7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -91,7 +91,7 @@ public class FuzzyBlockState extends BlockState { @Override public BaseBlock toBaseBlock() { - return new BaseBlock(); + return new BaseBlock(this); } @Override