From 57f992a524bee43299a538bf054c8b5b6c80ea8b Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Sun, 23 Jun 2019 14:05:14 -0400 Subject: [PATCH] Remove nullblock from EditSession --- .../fawe/bukkit/listener/CFIPacketListener.java | 10 ++-------- .../com/boydti/fawe/object/brush/CopyPastaBrush.java | 3 ++- .../object/clipboard/DiskOptimizedClipboard.java | 7 ++----- .../boydti/fawe/object/clipboard/EmptyClipboard.java | 6 +++--- .../fawe/object/clipboard/WorldCopyClipboard.java | 3 ++- .../fawe/object/clipboard/WorldCutClipboard.java | 8 ++++---- .../boydti/fawe/object/extent/FaweRegionExtent.java | 12 ++++++------ .../boydti/fawe/object/extent/ProcessedWEExtent.java | 9 ++++----- .../boydti/fawe/object/extent/TemporalExtent.java | 7 +++---- .../fawe/object/pattern/ExpressionPattern.java | 7 +++---- .../main/java/com/sk89q/worldedit/EditSession.java | 3 +-- .../worldedit/command/tool/RecursivePickaxe.java | 4 ++-- .../worldedit/command/tool/brush/GravityBrush.java | 3 ++- .../sk89q/worldedit/math/convolution/HeightMap.java | 2 +- 14 files changed, 37 insertions(+), 47 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java index 246f4bae2..980f8abc8 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/listener/CFIPacketListener.java @@ -1,6 +1,5 @@ package com.boydti.fawe.bukkit.listener; -import com.boydti.fawe.FaweCache; import com.boydti.fawe.command.CFICommands; import com.boydti.fawe.object.FaweChunk; import com.boydti.fawe.object.FawePlayer; @@ -15,30 +14,25 @@ import com.comphenix.protocol.events.ListenerPriority; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; -import com.comphenix.protocol.injector.netty.WirePacket; import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.wrappers.BlockPosition; import com.comphenix.protocol.wrappers.ChunkCoordIntPair; import com.comphenix.protocol.wrappers.EnumWrappers; -import com.comphenix.protocol.wrappers.WrappedBlockData; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.event.platform.BlockInteractEvent; import com.sk89q.worldedit.event.platform.Interaction; import com.sk89q.worldedit.extension.platform.PlatformManager; import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; import java.lang.reflect.InvocationTargetException; import java.util.List; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -70,7 +64,7 @@ public class CFIPacketListener implements Listener { Player plr = event.getPlayer(); BlockVector3 realPos = pt.add(gen.getOrigin().toBlockPoint()); if (!sendBlockChange(plr, gen, pt, Interaction.HIT)) { - gen.setBlock(pt, EditSession.nullBlock); + gen.setBlock(pt, BlockTypes.AIR.getDefaultState()); } } catch (WorldEditException e) { e.printStackTrace(); diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java index c9187ad11..a8afef32d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/brush/CopyPastaBrush.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.concurrent.ThreadLocalRandom; @@ -69,7 +70,7 @@ public class CopyPastaBrush implements Brush, ResettableTool { if (super.test(vector) && vector.getBlockY() >= minY) { BaseBlock block = editSession.getFullBlock(vector); if (!block.getBlockType().getMaterial().isAir()) { - builder.add(vector, EditSession.nullBlock.toBaseBlock(), block); + builder.add(vector, BlockTypes.AIR.getDefaultState().toBaseBlock(), block); return true; } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java index 678fe777f..11dc47669 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/DiskOptimizedClipboard.java @@ -1,7 +1,6 @@ package com.boydti.fawe.object.clipboard; import com.boydti.fawe.Fawe; -import com.boydti.fawe.FaweCache; import com.boydti.fawe.config.Settings; import com.boydti.fawe.jnbt.NBTStreamer; import com.boydti.fawe.object.IntegerTrio; @@ -10,7 +9,6 @@ import com.boydti.fawe.util.ReflectionUtils; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.IntTag; import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -24,7 +22,6 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; -import sun.misc.Unsafe; import java.io.Closeable; import java.io.File; @@ -446,7 +443,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable { e.printStackTrace(); MainUtil.handleError(e); } - return EditSession.nullBlock.toBaseBlock(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } @Override @@ -485,7 +482,7 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable { } catch (Exception e) { MainUtil.handleError(e); } - return EditSession.nullBlock.toBaseBlock(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java index d838fb473..0254fe2e2 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/EmptyClipboard.java @@ -1,6 +1,5 @@ package com.boydti.fawe.object.clipboard; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; @@ -15,6 +14,7 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import javax.annotation.Nullable; import java.util.Collections; @@ -74,12 +74,12 @@ public class EmptyClipboard implements Clipboard { @Override public BaseBlock getFullBlock(BlockVector3 position) { - return EditSession.nullBlock.toBaseBlock(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } @Override public BlockState getLazyBlock(BlockVector3 position) { - return EditSession.nullBlock; + return BlockTypes.AIR.getDefaultState(); } @Override diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCopyClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCopyClipboard.java index c2ce98412..c998dce2d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCopyClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCopyClipboard.java @@ -17,6 +17,7 @@ import com.sk89q.worldedit.math.MutableBlockVector2; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.ArrayList; import java.util.List; @@ -149,7 +150,7 @@ public class WorldCopyClipboard extends ReadOnlyClipboard { } task.run(xx, yy, zz, block); } else if (air) { - task.run(xx, yy, zz, EditSession.nullBlock); + task.run(xx, yy, zz, BlockTypes.AIR.getDefaultState()); } } } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java index 242c6bc52..73d1fa467 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java @@ -3,8 +3,8 @@ package com.boydti.fawe.object.clipboard; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.world.block.BlockTypes; public class WorldCutClipboard extends WorldCopyClipboard { public WorldCutClipboard(EditSession editSession, Region region, boolean copyEntities, boolean copyBiome) { @@ -21,13 +21,13 @@ public class WorldCutClipboard extends WorldCopyClipboard { int yy = my + y; int zz = mz + z; BaseBlock block = extent.getFullBlock(BlockVector3.at(xx, yy, zz)); - extent.setBlock(xx, yy, zz, EditSession.nullBlock); + extent.setBlock(xx, yy, zz, BlockTypes.AIR.getDefaultState()); return block; } public BaseBlock getBlockAbs(int x, int y, int z) { BaseBlock block = extent.getFullBlock(BlockVector3.at(x, y, z)); - extent.setBlock(x, y, z, EditSession.nullBlock); + extent.setBlock(x, y, z, BlockTypes.AIR.getDefaultState()); return block; } @@ -40,4 +40,4 @@ public class WorldCutClipboard extends WorldCopyClipboard { extent.commit(); } } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/FaweRegionExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/FaweRegionExtent.java index 3c6cb801b..b7f86660c 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/FaweRegionExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/FaweRegionExtent.java @@ -3,7 +3,6 @@ package com.boydti.fawe.object.extent; import com.boydti.fawe.config.BBC; import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.util.WEManager; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -16,6 +15,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Collection; import javax.annotation.Nullable; @@ -110,14 +110,14 @@ public abstract class FaweRegionExtent extends ResettableExtent { } return super.getBiome(position); } - + @Override public BaseBlock getFullBlock(BlockVector3 position) { if (!contains(position)) { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } - return EditSession.nullBlock.toBaseBlock(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } return super.getFullBlock(position); } @@ -128,7 +128,7 @@ public abstract class FaweRegionExtent extends ResettableExtent { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } - return EditSession.nullBlock; + return BlockTypes.AIR.getDefaultState(); } return super.getBlock(position); } @@ -139,7 +139,7 @@ public abstract class FaweRegionExtent extends ResettableExtent { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } - return EditSession.nullBlock; + return BlockTypes.AIR.getDefaultState(); } return super.getLazyBlock(position); } @@ -150,7 +150,7 @@ public abstract class FaweRegionExtent extends ResettableExtent { if (!limit.MAX_FAILS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION); } - return EditSession.nullBlock; + return BlockTypes.AIR.getDefaultState(); } return super.getLazyBlock(x, y, z); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java index 270792162..d9a331f82 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/ProcessedWEExtent.java @@ -3,8 +3,6 @@ package com.boydti.fawe.object.extent; import com.boydti.fawe.config.BBC; import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.util.WEManager; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; @@ -18,6 +16,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.util.List; @@ -66,17 +65,17 @@ public class ProcessedWEExtent extends AbstractDelegateExtent { public BlockState getLazyBlock(int x, int y, int z) { if (!limit.MAX_CHECKS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS); - return EditSession.nullBlock; + return BlockTypes.AIR.getDefaultState(); } else { return extent.getLazyBlock(x, y, z); } } - + @Override public BaseBlock getFullBlock(BlockVector3 pos) { if (!limit.MAX_CHECKS()) { WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS); - return EditSession.nullBlock.toBaseBlock(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } else { return extent.getFullBlock(pos); } diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/TemporalExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/TemporalExtent.java index d678f7b7f..6005c0d8d 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/extent/TemporalExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/extent/TemporalExtent.java @@ -1,6 +1,5 @@ package com.boydti.fawe.object.extent; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.extent.AbstractDelegateExtent; @@ -9,11 +8,11 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.registry.BundledBlockData; +import com.sk89q.worldedit.world.block.BlockTypes; public class TemporalExtent extends AbstractDelegateExtent { private int x, y, z = Integer.MAX_VALUE; - private BlockStateHolder block = EditSession.nullBlock; + private BlockStateHolder block = BlockTypes.AIR.getDefaultState(); private int bx, bz = Integer.MAX_VALUE; private BiomeType biome = null; @@ -72,7 +71,7 @@ public class TemporalExtent extends AbstractDelegateExtent { } return super.getLazyBlock(x, y, z); } - + @Override public BaseBlock getFullBlock(BlockVector3 position) { if (position.getX() == x && position.getY() == y && position.getZ() == z) { diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java index c023f4ff3..aaf3ee200 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/pattern/ExpressionPattern.java @@ -1,6 +1,5 @@ package com.boydti.fawe.object.pattern; -import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.function.pattern.AbstractPattern; @@ -9,7 +8,7 @@ import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.internal.expression.runtime.EvaluationException; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.shape.WorldEditExpressionEnvironment; -import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; import java.io.IOException; @@ -59,7 +58,7 @@ public class ExpressionPattern extends AbstractPattern { return BlockState.getFromInternalId((int) combined).toBaseBlock(); } catch (EvaluationException e) { e.printStackTrace(); - return EditSession.nullBlock.toBaseBlock(); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } catch (Throwable e) { e.printStackTrace(); throw e; @@ -74,4 +73,4 @@ public class ExpressionPattern extends AbstractPattern { e.printStackTrace(); } } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 263e115bd..c1108ca4b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -235,7 +235,6 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, private final int maxY; public static final UUID CONSOLE = UUID.fromString("1-1-3-3-7"); - public static final BlockState nullBlock = BlockTypes.AIR.getDefaultState(); @Deprecated public EditSession(@Nonnull World world, @Nullable FaweQueue queue, @Nullable FawePlayer player, @Nullable FaweLimit limit, @Nullable FaweChangeSet changeSet, @Nullable RegionWrapper[] allowedRegions, @Nullable Boolean autoQueue, @Nullable Boolean fastmode, @Nullable Boolean checkMemory, @Nullable Boolean combineStages, @Nullable BlockBag blockBag, @Nullable EventBus bus, @Nullable EditSessionEvent event) { @@ -2121,7 +2120,7 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, ForwardExtentCopy copy = new ForwardExtentCopy(this, region, this, to); - if (replacement == null) replacement = nullBlock; + if (replacement == null) replacement = BlockTypes.AIR.getDefaultState(); final BlockReplace remove = replacement instanceof ExistingPattern ? null : new BlockReplace(this, replacement); copy.setCopyBiomes(copyBiomes); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java index be256f239..ce74b6285 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java @@ -54,7 +54,7 @@ public class RecursivePickaxe implements BlockTool { editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop); final int radius = (int) range; - final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock)); + final BlockReplace replace = new BlockReplace(editSession, (BlockTypes.AIR.getDefaultState())); editSession.setMask((Mask) null); RecursiveVisitor visitor = new RecursiveVisitor(new IdMask(editSession), replace, radius, editSession); visitor.visit(pos); @@ -64,4 +64,4 @@ public class RecursivePickaxe implements BlockTool { session.remember(editSession); return true; } -} \ No newline at end of file +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java index 646915f30..13fc1ee71 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java @@ -26,6 +26,7 @@ import com.sk89q.worldedit.function.mask.Masks; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypes; public class GravityBrush implements Brush { @@ -52,7 +53,7 @@ public class GravityBrush implements Brush { BlockStateHolder block = editSession.getLazyBlock(x, y, z); if (!block.getBlockType().getMaterial().isAir()) { if (y != freeSpot) { - editSession.setBlock(x, y, z, EditSession.nullBlock); + editSession.setBlock(x, y, z, BlockTypes.AIR.getDefaultState()); editSession.setBlock(x, freeSpot, z, block); } freeSpot = y + 1; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java index 2c74d2f73..d6ace915e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java @@ -201,7 +201,7 @@ public class HeightMap { // Grow -- start from 1 below top replacing airblocks for (int setY = newBlock - 1, getY = curBlock; setY >= curBlock; --setY, getY--) { BlockStateHolder get = session.getBlock(xr, getY, zr); - if (get != EditSession.nullBlock) tmpBlock = get; + if (get != BlockTypes.AIR.getDefaultState()) tmpBlock = get; session.setBlock(xr, setY, zr, tmpBlock); ++blocksChanged; }