From 3f28a5759d71effae2bf010fcab3487169b202ea Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 16 Feb 2022 18:18:58 +0000 Subject: [PATCH] Make slope method slightly more readable in AngleMask --- .../core/function/mask/AngleMask.java | 52 +++++++++++-------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java index 55289c32d..12deadc31 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/AngleMask.java @@ -89,30 +89,38 @@ public class AngleMask extends AbstractExtentMask implements ResettableMask { if (slope >= min) { return lastValue = true; } - slope = Math.max(slope, Math.abs( - getHeight(extent, x, y, z + distance) - getHeight(extent, x, y, z - distance)) - * ADJACENT_MOD); - slope = Math.max(slope, Math.abs( - getHeight(extent, x + distance, y, z + distance) - getHeight(extent, - x - distance, y, z - distance - )) * DIAGONAL_MOD); - slope = Math.max(slope, Math.abs( - getHeight(extent, x - distance, y, z + distance) - getHeight(extent, - x + distance, y, z - distance - )) * DIAGONAL_MOD); + slope = Math.max( + slope, + Math.abs(getHeight(extent, x, y, z + distance) - getHeight(extent, x, y, z - distance)) * ADJACENT_MOD + ); + slope = Math.max( + slope, + Math.abs( + getHeight(extent, x + distance, y, z + distance) - + getHeight(extent, x - distance, y, z - distance)) * DIAGONAL_MOD + ); + slope = Math.max( + slope, + Math.abs( + getHeight(extent, x - distance, y, z + distance) - + getHeight(extent, x + distance, y, z - distance)) * DIAGONAL_MOD + ); return lastValue = (slope >= min); } else { - slope = Math.max(slope, Math.abs( - getHeight(extent, x, y, z + distance) - getHeight(extent, x, y, z - distance)) - * ADJACENT_MOD); - slope = Math.max(slope, Math.abs( - getHeight(extent, x + distance, y, z + distance) - getHeight(extent, - x - distance, y, z - distance - )) * DIAGONAL_MOD); - slope = Math.max(slope, Math.abs( - getHeight(extent, x - distance, y, z + distance) - getHeight(extent, - x + distance, y, z - distance - )) * DIAGONAL_MOD); + slope = Math.max( + slope, + Math.abs(getHeight(extent, x, y, z + distance) - getHeight(extent, x, y, z - distance)) * ADJACENT_MOD + ); + slope = Math.max( + slope, + Math.abs(getHeight(extent, x + distance, y, z + distance) - + getHeight(extent, x - distance, y, z - distance)) * DIAGONAL_MOD + ); + slope = Math.max( + slope, + Math.abs(getHeight(extent, x - distance, y, z + distance) - + getHeight(extent, x + distance, y, z - distance)) * DIAGONAL_MOD + ); return lastValue = (slope >= min && slope <= max); } }