From 00ac111e465df4167429927ca4dd12ca6765b6f5 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Sun, 23 Sep 2018 17:10:56 +1000 Subject: [PATCH] Fix height brush --- .../src/main/java/com/sk89q/worldedit/extent/Extent.java | 8 ++++---- .../com/sk89q/worldedit/world/block/BlockStateImpl.java | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java index c81716677..ae697294b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java @@ -221,21 +221,21 @@ public interface Extent extends InputExtent, OutputExtent { for (int d = 0; d <= clearance; d++) { int y1 = y + d; block = getLazyBlock(x, y1, z); - if (!block.getBlockType().getMaterial().isMovementBlocker() != state && block != EditSession.nullBlock) return y1 - offset; + if (!block.getMaterial().isMovementBlocker() != state && block.getBlockType() != BlockTypes.__RESERVED__) return y1 - offset; int y2 = y - d; block = getLazyBlock(x, y2, z); - if (!block.getBlockType().getMaterial().isMovementBlocker() != state && block != EditSession.nullBlock) return y2 + offset; + if (!block.getMaterial().isMovementBlocker() != state && block.getBlockType() != BlockTypes.__RESERVED__) return y2 + offset; } if (clearanceAbove != clearanceBelow) { if (clearanceAbove < clearanceBelow) { for (int layer = y - clearance - 1; layer >= minY; layer--) { block = getLazyBlock(x, layer, z); - if (!block.getBlockType().getMaterial().isMovementBlocker() != state && block != EditSession.nullBlock) return layer + offset; + if (!block.getMaterial().isMovementBlocker() != state && block.getBlockType() != BlockTypes.__RESERVED__) return layer + offset; } } else { for (int layer = y + clearance + 1; layer <= maxY; layer++) { block = getLazyBlock(x, layer, z); - if (!block.getBlockType().getMaterial().isMovementBlocker() != state && block != EditSession.nullBlock) return layer - offset; + if (!block.getMaterial().isMovementBlocker() != state && block.getBlockType() != BlockTypes.__RESERVED__) return layer - offset; } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateImpl.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateImpl.java index 458526b93..f79df990e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateImpl.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateImpl.java @@ -18,6 +18,9 @@ public class BlockStateImpl extends BlockState { public BlockMaterial getMaterial() { if (this.material == null) { + if (type == BlockTypes.__RESERVED__) { + return this.material = type.getMaterial(); + } synchronized (this) { if (this.material == null) { this.material = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this);