From c545683025fc6021cfee8b8f15bd84d146110825 Mon Sep 17 00:00:00 2001 From: Chicken Bones Date: Wed, 4 Sep 2013 12:51:37 +1000 Subject: [PATCH] Added a few functions to BlockCoord Made RedundantTransformation more redundant --- codechicken/lib/vec/BlockCoord.java | 20 +++++++++++++++++++ .../lib/vec/RedundantTransformation.java | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/codechicken/lib/vec/BlockCoord.java b/codechicken/lib/vec/BlockCoord.java index 7c713d2..63952cc 100644 --- a/codechicken/lib/vec/BlockCoord.java +++ b/codechicken/lib/vec/BlockCoord.java @@ -177,4 +177,24 @@ public class BlockCoord implements Comparable { return set(coord.x, coord.y, coord.z); } + + public int toSide() + { + if(!isAxial()) return -1; + if(y < 0) return 0; + if(y > 0) return 1; + if(z < 0) return 2; + if(z > 0) return 3; + if(x < 0) return 4; + if(x > 0) return 5; + + return -1; + } + + public int absSum() + { + return (x < 0 ? -x : x) + + (y < 0 ? -y : y) + + (z < 0 ? -z : z); + } } diff --git a/codechicken/lib/vec/RedundantTransformation.java b/codechicken/lib/vec/RedundantTransformation.java index a803675..08842f6 100644 --- a/codechicken/lib/vec/RedundantTransformation.java +++ b/codechicken/lib/vec/RedundantTransformation.java @@ -30,6 +30,11 @@ public class RedundantTransformation extends Transformation return this; } + @Override + public Transformation merge(Transformation next) { + return next; + } + @Override public String toString() {