Fix height brush

This commit is contained in:
Jesse Boyd 2018-09-23 17:10:56 +10:00
parent e452fc9556
commit 00ac111e46
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 7 additions and 4 deletions

View File

@ -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;
}
}
}

View File

@ -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);