mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix off by one error for negative coordinates when using -r with //deform (#2092)
The problem: Off by one error for negative coordinates. Source: Behaviour of rounding coordinates (doubles) after deform. The off by error came down to rounding using casts (int) and rounding using Math.floor() (int)( 1.8) = 1 (int)(-1.8) = -1 (int)Math.floor( 1.8) = 1 (int)Math.floor(-1.8) = -2 Looking at the original WorldEdit implementation a Math.floor call is present too. It was missing FAWE which resulted in the bug. Co-authored-by: Alexander Brandes <mc.cache@web.de>
This commit is contained in:
parent
94f57799d0
commit
211e8034ff
@ -3025,9 +3025,9 @@ public class EditSession extends PassthroughExtent implements AutoCloseable {
|
|||||||
|
|
||||||
// transform
|
// transform
|
||||||
expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout);
|
expression.evaluate(new double[]{scaled.getX(), scaled.getY(), scaled.getZ()}, timeout);
|
||||||
int xv = (int) (x.getValue() * unit.getX() + zero2.getX());
|
int xv = (int) Math.floor(x.getValue() * unit.getX() + zero2.getX());
|
||||||
int yv = (int) (y.getValue() * unit.getY() + zero2.getY());
|
int yv = (int) Math.floor(y.getValue() * unit.getY() + zero2.getY());
|
||||||
int zv = (int) (z.getValue() * unit.getZ() + zero2.getZ());
|
int zv = (int) Math.floor(z.getValue() * unit.getZ() + zero2.getZ());
|
||||||
|
|
||||||
BlockState get;
|
BlockState get;
|
||||||
if (yv >= minY && yv <= maxY) {
|
if (yv >= minY && yv <= maxY) {
|
||||||
|
Loading…
Reference in New Issue
Block a user