From 69e2ce616536af7bc8121ac84fb73c096a15b0b8 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 15 Apr 2019 19:56:38 +1000 Subject: [PATCH] Avoid block vector creation for combine stages = false --- .../src/main/java/com/boydti/fawe/object/HistoryExtent.java | 2 +- .../worldedit/extension/platform/AbstractPlayerActor.java | 6 ++++-- .../com/sk89q/worldedit/extent/AbstractDelegateExtent.java | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java index 6d2c8a166..e66e505c6 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/object/HistoryExtent.java @@ -61,7 +61,7 @@ public class HistoryExtent extends AbstractDelegateExtent { @Override public > boolean setBlock(int x, int y, int z, B block) throws WorldEditException { - BaseBlock previous = queue.getFullBlock(BlockVector3.at(x, y, z)).toBaseBlock(); + BaseBlock previous = queue.getFullBlock(mutable.setComponents(x, y, z)).toBaseBlock(); if (previous.getInternalId() == block.getInternalId()) { if (!previous.hasNbtData() && (block instanceof BaseBlock && !((BaseBlock)block).hasNbtData())) { return false; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index bde285386..95fa08e91 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -25,6 +25,7 @@ import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.MutableBlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.util.Direction; import com.sk89q.worldedit.util.HandSide; @@ -106,15 +107,16 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { byte free = 0; + BlockVector3 mutablePos = MutableBlockVector3.at(0, 0, 0); while (y <= world.getMaximumPoint().getBlockY() + 2) { - if (!world.getBlock(BlockVector3.at(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { + if (!world.getBlock(mutablePos.setComponents(x, y, z)).getBlockType().getMaterial().isMovementBlocker()) { ++free; } else { free = 0; } if (free == 2) { - final BlockVector3 pos = BlockVector3.at(x, y - 2, z); + final BlockVector3 pos = mutablePos.setComponents(x, y - 2, z); final BlockStateHolder state = world.getBlock(pos); setPosition(new Location(world, Vector3.at(x + 0.5, y - 2 + BlockTypeUtil.centralTopLimit(state), z + 0.5))); return; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 14ccef8e7..d3021c391 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -47,7 +47,7 @@ import javax.annotation.Nullable; public class AbstractDelegateExtent implements LightingExtent { private transient final Extent extent; - private MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0); + protected MutableBlockVector3 mutable = new MutableBlockVector3(0, 0, 0); /** * Create a new instance.