mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-03-13 13:57:48 +08:00
Properly repeat extents for negative coordinates
An extent's content was returned flipped when applied for negative positions, as e.g. `Math.abs(-2) % 3` returns 2 instead of 1 (as 1 + -1 * 3 = -2) (cherry picked from commit b0cf5dd2bf1b9bcbf1c7efff0fe25de7ee9a2090)
This commit is contained in:
parent
df2eb157b0
commit
544793d541
@ -88,9 +88,9 @@ public class RepeatingExtentPattern extends AbstractExtentPattern {
|
||||
@Override
|
||||
public BaseBlock applyBlock(BlockVector3 position) {
|
||||
BlockVector3 base = position.add(offset);
|
||||
int x = Math.abs(base.getBlockX()) % size.getBlockX();
|
||||
int y = Math.abs(base.getBlockY()) % size.getBlockY();
|
||||
int z = Math.abs(base.getBlockZ()) % size.getBlockZ();
|
||||
int x = Math.floorMod(base.getBlockX(), size.getBlockX());
|
||||
int y = Math.floorMod(base.getBlockY(), size.getBlockY());
|
||||
int z = Math.floorMod(base.getBlockZ(), size.getBlockZ());
|
||||
return getExtent().getFullBlock(BlockVector3.at(x, y, z).add(origin));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user