Skip to content

Commit

Permalink
Merge pull request EngineHub#2582 from EngineHub/deform-fix-queryrel
Browse files Browse the repository at this point in the history
Fix queryRel for //deform and //brush deform
  • Loading branch information
TomyLobo authored Jul 20, 2024
2 parents 292dae6 + 570ec87 commit 9fae677
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2440,9 +2440,12 @@ public int deformRegion(final Region region, final Vector3 zero, final Vector3 u

final DoubleArrayList<BlockVector3, BaseBlock> queue = new DoubleArrayList<>(false);

for (BlockVector3 position : region) {
for (BlockVector3 targetBlockPosition : region) {
final Vector3 targetPosition = targetBlockPosition.toVector3();
environment.setCurrentBlock(targetPosition);

// offset, scale
final Vector3 scaled = position.toVector3().subtract(zero).divide(unit);
final Vector3 scaled = targetPosition.subtract(zero).divide(unit);

// transform
expression.evaluate(new double[]{ scaled.x(), scaled.y(), scaled.z() }, timeout);
Expand All @@ -2453,7 +2456,7 @@ public int deformRegion(final Region region, final Vector3 zero, final Vector3 u
final BaseBlock material = world.getFullBlock(sourcePosition);

// queue operation
queue.put(position, material);
queue.put(targetBlockPosition, material);
}

int affected = 0;
Expand Down

0 comments on commit 9fae677

Please sign in to comment.