From 16d43f287dbbca670e53f2b2161440ab9b385d49 Mon Sep 17 00:00:00 2001 From: Chicken-Bomes Date: Wed, 18 Dec 2013 12:25:04 +1000 Subject: [PATCH] Added a few more set methods to (Block/Cuboid)Coord --- codechicken/lib/vec/BlockCoord.java | 7 ++++++- codechicken/lib/vec/CuboidCoord.java | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/codechicken/lib/vec/BlockCoord.java b/codechicken/lib/vec/BlockCoord.java index 63952cc..e47dce1 100644 --- a/codechicken/lib/vec/BlockCoord.java +++ b/codechicken/lib/vec/BlockCoord.java @@ -71,7 +71,7 @@ public class BlockCoord implements Comparable return this; } - public double mag_() + public double mag() { return Math.sqrt(x*x+y*y+z*z); } @@ -177,6 +177,11 @@ public class BlockCoord implements Comparable { return set(coord.x, coord.y, coord.z); } + + public BlockCoord set(int[] ia) + { + return set(ia[0], ia[1], ia[2]); + } public int toSide() { diff --git a/codechicken/lib/vec/CuboidCoord.java b/codechicken/lib/vec/CuboidCoord.java index dbe21c7..90b69ba 100644 --- a/codechicken/lib/vec/CuboidCoord.java +++ b/codechicken/lib/vec/CuboidCoord.java @@ -107,7 +107,25 @@ public class CuboidCoord public void set(BlockCoord min, BlockCoord max) { - this.min = min; - this.max = max; + this.min.set(min); + this.max.set(max); + } + + public CuboidCoord set(int x1, int y1, int z1, int x2, int y2, int z2) + { + min.set(x1, y1, z1); + max.set(x2, y2, z2); + return this; + } + + public CuboidCoord set(BlockCoord coord) { + min.set(coord); + max.set(coord); + return this; + } + + public CuboidCoord set(int[] ia) + { + return set(ia[0], ia[1], ia[2], ia[3], ia[4], ia[5]); } }