diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java
index bc25248fd..9bd290581 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/BufferQuad.java
@@ -35,7 +35,7 @@ public final class BufferQuad
public static final int NORMAL_MAX_QUAD_WIDTH = 2048;
/**
* The maximum number of blocks wide a quad can be
- * when {@link Config.Client.Advanced.Graphics.AdvancedGraphics#earthCurveRatio earthCurveRatio}
+ * when {@link Config.Client.Advanced.Graphics.Experimental#earthCurveRatio earthCurveRatio}
* is enabled.
*/
public static final int MAX_QUAD_WIDTH_FOR_EARTH_CURVATURE = LodUtil.CHUNK_WIDTH;
@@ -99,7 +99,7 @@ public final class BufferQuad
if (compareDirection == BufferMergeDirectionEnum.EastWest)
{
- switch (this.direction.getAxis())
+ switch (this.direction.axis)
{
case X:
return threeDimensionalCompare(this.x, this.y, this.z, quad.x, quad.y, quad.z);
@@ -109,12 +109,12 @@ public final class BufferQuad
return threeDimensionalCompare(this.z, this.y, this.x, quad.z, quad.y, quad.x);
default:
- throw new IllegalArgumentException("Invalid Axis enum: " + this.direction.getAxis());
+ throw new IllegalArgumentException("Invalid Axis enum: [" + this.direction.axis + "].");
}
}
else
{
- switch (this.direction.getAxis())
+ switch (this.direction.axis)
{
case X:
return threeDimensionalCompare(this.x, this.z, this.y, quad.x, quad.z, quad.y);
@@ -124,7 +124,7 @@ public final class BufferQuad
return threeDimensionalCompare(this.z, this.x, this.y, quad.z, quad.x, quad.y);
default:
- throw new IllegalArgumentException("Invalid Axis enum: " + this.direction.getAxis());
+ throw new IllegalArgumentException("Invalid Axis enum: [" + this.direction.axis + "].");
}
}
}
@@ -169,7 +169,7 @@ public final class BufferQuad
short thisParallelCompareStartPos; // edge parallel to the merge direction
short otherPerpendicularCompareStartPos;
short otherParallelCompareStartPos;
- switch (this.direction.getAxis())
+ switch (this.direction.axis)
{
default: // shouldn't normally happen, just here to make the compiler happy
case X:
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java
index fe7f256ea..a75b1566d 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/ColumnRenderBufferBuilder.java
@@ -150,13 +150,13 @@ public class ColumnRenderBufferBuilder
// get adjacent render data columns //
//==================================//
- ColumnArrayView[] adjColumnViews = new ColumnArrayView[EDhDirection.ADJ_DIRECTIONS.length];
- for (EDhDirection lodDirection : EDhDirection.ADJ_DIRECTIONS)
+ ColumnArrayView[] adjColumnViews = new ColumnArrayView[EDhDirection.CARDINAL_COMPASS.length];
+ for (EDhDirection lodDirection : EDhDirection.CARDINAL_COMPASS)
{
try
{
- int xAdj = relX + lodDirection.getNormal().x;
- int zAdj = relZ + lodDirection.getNormal().z;
+ int xAdj = relX + lodDirection.normal.x;
+ int zAdj = relZ + lodDirection.normal.z;
boolean isCrossRenderSourceBoundary =
(xAdj < 0 || xAdj >= ColumnRenderSource.SECTION_SIZE) ||
(zAdj < 0 || zAdj >= ColumnRenderSource.SECTION_SIZE);
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java
index b55392db6..463e171b8 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/dataObjects/render/bufferBuilding/LodQuadBuilder.java
@@ -304,7 +304,7 @@ public class LodQuadBuilder
short widthEastWest = quad.widthEastWest;
short widthNorthSouth = quad.widthNorthSouthOrUpDown;
byte normalIndex = (byte) quad.direction.ordinal();
- EDhDirection.Axis axis = quad.direction.getAxis();
+ EDhDirection.Axis axis = quad.direction.axis;
for (int i = 0; i < quadBase.length; i++)
{
short dx, dy, dz;
@@ -352,7 +352,7 @@ public class LodQuadBuilder
if (this.grassSideRenderingMode != EDhApiGrassSideRendering.AS_GRASS)
{
// only change the vertex color if it's on the side or bottom
- if (quad.direction.getAxis().isHorizontal() || quad.direction == EDhDirection.DOWN)
+ if (quad.direction.axis.isHorizontal() || quad.direction == EDhDirection.DOWN)
{
if (this.grassSideRenderingMode == EDhApiGrassSideRendering.AS_DIRT
// if we want the color to fade, only apply the dirt color to the bottom vertices
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java b/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java
index 0b21d4d77..337a1b544 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/enums/EDhDirection.java
@@ -19,496 +19,162 @@
package com.seibel.distanthorizons.core.enums;
-import java.util.Arrays;
-import java.util.Locale;
-import java.util.Map;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
import com.seibel.distanthorizons.core.util.math.Vec3i;
/**
- * An (almost) exact copy of Minecraft's
- * Direction enum.
- *
* Up
* Down
* North
* South
* East
* West
- *
- * @author James Seibel
- * @version 2021-11-13
*/
public enum EDhDirection
{
/** negative Y */
- DOWN(0, 1, -1, "down", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Y, new Vec3i(0, -1, 0)),
+ DOWN("down", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Y, new Vec3i(0, -1, 0)),
/** positive Y */
- UP(1, 0, -1, "up", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Y, new Vec3i(0, 1, 0)),
+ UP("up", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Y, new Vec3i(0, 1, 0)),
/** negative Z */
- NORTH(2, 3, 2, "north", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, -1)),
+ NORTH("north", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, -1)),
/** positive Z */
- SOUTH(3, 2, 0, "south", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, 1)),
+ SOUTH("south", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.Z, new Vec3i(0, 0, 1)),
/** negative X */
- WEST(4, 5, 1, "west", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.X, new Vec3i(-1, 0, 0)),
+ WEST("west", EDhDirection.AxisDirection.NEGATIVE, EDhDirection.Axis.X, new Vec3i(-1, 0, 0)),
/** positive X */
- EAST(5, 4, 3, "east", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.X, new Vec3i(1, 0, 0));
+ EAST("east", EDhDirection.AxisDirection.POSITIVE, EDhDirection.Axis.X, new Vec3i(1, 0, 0));
- /**
- * Up, Down, West, East, North, South
- * Similar to {@link EDhDirection#OPPOSITE_DIRECTIONS}, just with a different order
- */
- public static final EDhDirection[] CARDINAL_DIRECTIONS = new EDhDirection[]{
+
+ /** Up, Down, West, East, North, South */
+ public static final EDhDirection[] ALL = new EDhDirection[] {
EDhDirection.UP,
EDhDirection.DOWN,
EDhDirection.WEST,
EDhDirection.EAST,
EDhDirection.NORTH,
- EDhDirection.SOUTH};
+ EDhDirection.SOUTH
+ };
- /**
- * Up, Down, South, North, East, West
- * Similar to {@link EDhDirection#CARDINAL_DIRECTIONS}, just with a different order
- */
- public static final EDhDirection[] OPPOSITE_DIRECTIONS = new EDhDirection[]{
- EDhDirection.UP,
- EDhDirection.DOWN,
- EDhDirection.SOUTH,
- EDhDirection.NORTH,
- EDhDirection.EAST,
- EDhDirection.WEST};
-
- /** North, South, East, West */ // TODO rename to state this is just X/Z or flat directions
- public static final EDhDirection[] ADJ_DIRECTIONS = new EDhDirection[]{
+ /** North, South, East, West */
+ public static final EDhDirection[] CARDINAL_COMPASS = new EDhDirection[] {
EDhDirection.EAST,
EDhDirection.WEST,
EDhDirection.SOUTH,
- EDhDirection.NORTH};
-
-// private final int data3d;
-// private final int oppositeIndex;
-// private final int data2d;
+ EDhDirection.NORTH
+ };
- private final String name;
- private final EDhDirection.Axis axis;
- private final EDhDirection.AxisDirection axisDirection;
- private final Vec3i normal;
- private static final EDhDirection[] VALUES = values();
- private static final Map BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(EDhDirection::getName, (p_199787_0_) ->
+
+ public final String name;
+ public final EDhDirection.Axis axis;
+ public final EDhDirection.AxisDirection axisDirection;
+ public final Vec3i normal;
+
+
+
+ //=============//
+ // constructor //
+ //=============//
+
+ EDhDirection(String name, EDhDirection.AxisDirection axisDirection, EDhDirection.Axis axis, Vec3i normal)
{
- return p_199787_0_;
- }));
-
-// private static final LodDirection[] BY_3D_DATA = Arrays.stream(VALUES).sorted(Comparator.comparingInt((p_199790_0_) ->
-// {
-// return p_199790_0_.data3d;
-// })).toArray((p_199788_0_) ->
-// {
-// return new LodDirection[p_199788_0_];
-// });
-//
-// private static final LodDirection[] BY_2D_DATA = Arrays.stream(VALUES).filter((p_199786_0_) ->
-// {
-// return p_199786_0_.getAxis().isHorizontal();
-// }).sorted(Comparator.comparingInt((p_199789_0_) ->
-// {
-// return p_199789_0_.data2d;
-// })).toArray((p_199791_0_) ->
-// {
-// return new LodDirection[p_199791_0_];
-// });
-
-// private static final Long2ObjectMap BY_NORMAL = Arrays.stream(VALUES).collect(Collectors.toMap((p_218385_0_) ->
-// {
-// return (new BlockPos(p_218385_0_.getNormal())).asLong();
-// }, (p_218384_0_) ->
-// {
-// return p_218384_0_;
-// }, (p_218386_0_, p_218386_1_) ->
-// {
-// throw new IllegalArgumentException("Duplicate keys");
-// }, Long2ObjectOpenHashMap::new));
-
-
-
- EDhDirection(int p_i46016_3_, int p_i46016_4_, int p_i46016_5_, String p_i46016_6_, EDhDirection.AxisDirection p_i46016_7_, EDhDirection.Axis p_i46016_8_, Vec3i p_i46016_9_)
- {
-// this.data3d = p_i46016_3_;
-// this.data2d = p_i46016_5_;
-// this.oppositeIndex = p_i46016_4_;
- this.name = p_i46016_6_;
- this.axis = p_i46016_8_;
- this.axisDirection = p_i46016_7_;
- this.normal = p_i46016_9_;
+ this.name = name;
+ this.axis = axis;
+ this.axisDirection = axisDirection;
+ this.normal = normal;
}
-
-
-
-
-// public static LodDirection[] orderedByNearest(Entity p_196054_0_)
-// {
-// float f = p_196054_0_.getViewXRot(1.0F) * ((float) Math.PI / 180F);
-// float f1 = -p_196054_0_.getViewYRot(1.0F) * ((float) Math.PI / 180F);
-// float f2 = MathHelper.sin(f);
-// float f3 = MathHelper.cos(f);
-// float f4 = MathHelper.sin(f1);
-// float f5 = MathHelper.cos(f1);
-// boolean flag = f4 > 0.0F;
-// boolean flag1 = f2 < 0.0F;
-// boolean flag2 = f5 > 0.0F;
-// float f6 = flag ? f4 : -f4;
-// float f7 = flag1 ? -f2 : f2;
-// float f8 = flag2 ? f5 : -f5;
-// float f9 = f6 * f3;
-// float f10 = f8 * f3;
-// LodDirection lodDirection = flag ? EAST : WEST;
-// LodDirection direction1 = flag1 ? UP : DOWN;
-// LodDirection direction2 = flag2 ? SOUTH : NORTH;
-// if (f6 > f8)
-// {
-// if (f7 > f9)
-// {
-// return makeDirectionArray(direction1, lodDirection, direction2);
-// }
-// else
-// {
-// return f10 > f7 ? makeDirectionArray(lodDirection, direction2, direction1) : makeDirectionArray(lodDirection, direction1, direction2);
-// }
-// }
-// else if (f7 > f10)
-// {
-// return makeDirectionArray(direction1, direction2, lodDirection);
-// }
-// else
-// {
-// return f9 > f7 ? makeDirectionArray(direction2, lodDirection, direction1) : makeDirectionArray(direction2, direction1, lodDirection);
-// }
-// }
-
-// private static LodDirection[] makeDirectionArray(LodDirection p_196053_0_, LodDirection p_196053_1_, LodDirection p_196053_2_)
-// {
-// return new LodDirection[] { p_196053_0_, p_196053_1_, p_196053_2_, p_196053_2_.getOpposite(), p_196053_1_.getOpposite(), p_196053_0_.getOpposite() };
-// }
-
-// public static LodDirection rotate(Mat4f p_229385_0_, LodDirection p_229385_1_)
-// {
-// Vec3i Vec3i = p_229385_1_.getNormal();
-// Vector4f vector4f = new Vector4f(Vec3i.getX(), Vec3i.getY(), Vec3i.getZ(), 0.0F);
-// vector4f.transform(p_229385_0_);
-// return getNearest(vector4f.x(), vector4f.y(), vector4f.z());
-// }
-
-// public Quaternion getRotation()
-// {
-// Quaternion quaternion = Vector3f.XP.rotationDegrees(90.0F);
-// switch (this)
-// {
-// case DOWN:
-// return Vector3f.XP.rotationDegrees(180.0F);
-// case UP:
-// return Quaternion.ONE.copy();
-// case NORTH:
-// quaternion.mul(Vector3f.ZP.rotationDegrees(180.0F));
-// return quaternion;
-// case SOUTH:
-// return quaternion;
-// case WEST:
-// quaternion.mul(Vector3f.ZP.rotationDegrees(90.0F));
-// return quaternion;
-// case EAST:
-// default:
-// quaternion.mul(Vector3f.ZP.rotationDegrees(-90.0F));
-// return quaternion;
-// }
-// }
-
-// public int get3DDataValue()
-// {
-// return this.data3d;
-// }
-//
-// public int get2DDataValue()
-// {
-// return this.data2d;
-// }
- public EDhDirection.AxisDirection getAxisDirection()
- {
- return this.axisDirection;
- }
-
-// public LodDirection getOpposite()
-// {
-// return from3DDataValue(this.oppositeIndex);
-// }
- public EDhDirection getClockWise()
- {
- switch (this)
+
+ //=========//
+ // methods //
+ //=========//
+
+ public EDhDirection opposite()
+ {
+ switch(this)
{
+ case UP:
+ return EDhDirection.DOWN;
+ case DOWN:
+ return EDhDirection.UP;
+
case NORTH:
- return EAST;
+ return EDhDirection.SOUTH;
case SOUTH:
- return WEST;
- case WEST:
- return NORTH;
+ return EDhDirection.NORTH;
+
case EAST:
- return SOUTH;
- default:
- throw new IllegalStateException("Unable to get Y-rotated facing of " + this);
- }
- }
-
- public EDhDirection getCounterClockWise()
- {
- switch (this)
- {
- case NORTH:
- return WEST;
- case SOUTH:
- return EAST;
+ return EDhDirection.WEST;
case WEST:
- return SOUTH;
- case EAST:
- return NORTH;
+ return EDhDirection.EAST;
+
default:
- throw new IllegalStateException("Unable to get CCW facing of " + this);
+ throw new IllegalArgumentException();
}
}
- public String getName()
- {
- return this.name;
- }
- public EDhDirection.Axis getAxis()
- {
- return this.axis;
- }
+ @Override
+ public String toString() { return this.name; }
- public static EDhDirection byName(String name)
- {
- return name == null ? null : BY_NAME.get(name.toLowerCase(Locale.ROOT));
- }
-
-// public static LodDirection from3DDataValue(int p_82600_0_)
-// {
-// return BY_3D_DATA[MathHelper.abs(p_82600_0_ % BY_3D_DATA.length)];
-// }
-//
-// public static LodDirection from2DDataValue(int p_176731_0_)
-// {
-// return BY_2D_DATA[MathHelper.abs(p_176731_0_ % BY_2D_DATA.length)];
-// }
-
-// @Nullable
-// public static LodDirection fromNormal(int p_218383_0_, int p_218383_1_, int p_218383_2_)
-// {
-// return BY_NORMAL.get(BlockPos.asLong(p_218383_0_, p_218383_1_, p_218383_2_));
-// }
-
-// public static LodDirection fromYRot(double p_176733_0_)
-// {
-// return from2DDataValue(MathHelper.floor(p_176733_0_ / 90.0D + 0.5D) & 3);
-// }
- public static EDhDirection fromAxisAndDirection(EDhDirection.Axis p_211699_0_, EDhDirection.AxisDirection p_211699_1_)
- {
- switch (p_211699_0_)
- {
- case X:
- return p_211699_1_ == EDhDirection.AxisDirection.POSITIVE ? EAST : WEST;
- case Y:
- return p_211699_1_ == EDhDirection.AxisDirection.POSITIVE ? UP : DOWN;
- case Z:
- default:
- return p_211699_1_ == EDhDirection.AxisDirection.POSITIVE ? SOUTH : NORTH;
- }
- }
-
-// public float toYRot()
-// {
-// return (this.data2d & 3) * 90;
-// }
-
-// public static LodDirection getRandom(Random p_239631_0_)
-// {
-// return Util.getRandom(VALUES, p_239631_0_);
-// }
-
-// public static LodDirection getNearest(double p_210769_0_, double p_210769_2_, double p_210769_4_)
-// {
-// return getNearest((float) p_210769_0_, (float) p_210769_2_, (float) p_210769_4_);
-// }
-
-// public static LodDirection getNearest(float p_176737_0_, float p_176737_1_, float p_176737_2_)
-// {
-// LodDirection lodDirection = NORTH;
-// float f = Float.MIN_VALUE;
-//
-// for (LodDirection direction1 : VALUES)
-// {
-// float f1 = p_176737_0_ * direction1.normal.x + p_176737_1_ * direction1.normal.y + p_176737_2_ * direction1.normal.z;
-// if (f1 > f)
-// {
-// f = f1;
-// lodDirection = direction1;
-// }
-// }
-//
-// return lodDirection;
-// }
- public static EDhDirection get(EDhDirection.AxisDirection p_181076_0_, EDhDirection.Axis p_181076_1_)
- {
- for (EDhDirection lodDirection : VALUES)
- {
- if (lodDirection.getAxisDirection() == p_181076_0_ && lodDirection.getAxis() == p_181076_1_)
- {
- return lodDirection;
- }
- }
-
- throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_);
- }
+ //================//
+ // helper classes //
+ //================//
- public Vec3i getNormal()
+ /**
+ * X
+ * Y
+ * Z
+ */
+ public enum Axis
{
- return this.normal;
- }
-
-// public boolean isFacingAngle(float p_243532_1_)
-// {
-// float f = p_243532_1_ * ((float) Math.PI / 180F);
-// float f1 = -MathHelper.sin(f);
-// float f2 = MathHelper.cos(f);
-// return this.normal.getX() * f1 + this.normal.getZ() * f2 > 0.0F;
-// }
-
- public enum Axis implements Predicate
- {
- X("x")
- {
- @Override
- public int choose(int x, int y, int z)
- {
- return x;
- }
-
- @Override
- public double choose(double x, double y, double z)
- {
- return x;
- }
- },
- Y("y")
- {
- @Override
- public int choose(int x, int y, int z)
- {
- return y;
- }
-
- @Override
- public double choose(double x, double y, double z)
- {
- return y;
- }
- },
- Z("z")
- {
- @Override
- public int choose(int x, int y, int z)
- {
- return z;
- }
-
- @Override
- public double choose(double x, double y, double z)
- {
- return z;
- }
- };
+ X("x"),
+ Y("y"),
+ Z("z");
- private static final EDhDirection.Axis[] VALUES = values();
+ public final String name;
- private static final Map BY_NAME = Arrays.stream(VALUES).collect(Collectors.toMap(EDhDirection.Axis::getName, (p_199785_0_) ->
- {
- return p_199785_0_;
- }));
- private final String name;
- Axis(String name)
- {
- this.name = name;
- }
+ //=============//
+ // constructor //
+ //=============//
- public static EDhDirection.Axis byName(String name)
- {
- return BY_NAME.get(name.toLowerCase(Locale.ROOT));
- }
+ Axis(String name) { this.name = name; }
- public String getName()
- {
- return this.name;
- }
- public boolean isVertical()
- {
- return this == Y;
- }
- public boolean isHorizontal()
- {
- return this == X || this == Z;
- }
+ //=========//
+ // methods //
+ //=========//
+
+ public boolean isVertical() { return this == Y; }
+ public boolean isHorizontal() { return this == X || this == Z; }
@Override
- public String toString()
- {
- return this.name;
- }
-
-// public static LodDirection.Axis getRandom(Random p_239634_0_)
-// {
-// return Util.getRandom(VALUES, p_239634_0_);
-// }
+ public String toString() { return this.name; }
- @Override
- public boolean test(EDhDirection p_test_1_)
- {
- return p_test_1_ != null && p_test_1_.getAxis() == this;
- }
-
-// public LodDirection.Plane getPlane()
-// {
-// switch (this)
-// {
-// case X:
-// case Z:
-// return LodDirection.Plane.HORIZONTAL;
-// case Y:
-// return LodDirection.Plane.VERTICAL;
-// default:
-// throw new Error("Someone's been tampering with the universe!");
-// }
-// }
-
- public abstract int choose(int p_196052_1_, int p_196052_2_, int p_196052_3_);
-
- public abstract double choose(double p_196051_1_, double p_196051_3_, double p_196051_5_);
}
+ /**
+ * POSITIVE
+ * NEGATIVE
+ */
public enum AxisDirection
{
POSITIVE(1, "Towards positive"),
NEGATIVE(-1, "Towards negative");
- private final int step;
- private final String name;
+ public final int step;
+ public final String name;
+
+
+
+ //=============//
+ // constructor //
+ //=============//
AxisDirection(int newStep, String newName)
{
@@ -516,77 +182,20 @@ public enum EDhDirection
this.name = newName;
}
- public int getStep()
- {
- return this.step;
- }
+
+
+ //=========//
+ // methods //
+ //=========//
+
+ public EDhDirection.AxisDirection opposite()
+ { return (this == POSITIVE) ? NEGATIVE : POSITIVE; }
@Override
- public String toString()
- {
- return this.name;
- }
+ public String toString() { return this.name; }
+
+
- public EDhDirection.AxisDirection opposite()
- {
- return this == POSITIVE ? NEGATIVE : POSITIVE;
- }
- }
-
-// public static enum Plane implements Iterable, Predicate
-// {
-// HORIZONTAL(new LodDirection[] { LodDirection.NORTH, LodDirection.EAST, LodDirection.SOUTH, LodDirection.WEST }, new LodDirection.Axis[] { LodDirection.Axis.X, LodDirection.Axis.Z }),
-// VERTICAL(new LodDirection[] { LodDirection.UP, LodDirection.DOWN }, new LodDirection.Axis[] { LodDirection.Axis.Y });
-//
-// private final LodDirection[] faces;
-// private final LodDirection.Axis[] axis;
-//
-// private Plane(LodDirection[] p_i49393_3_, LodDirection.Axis[] p_i49393_4_)
-// {
-// this.faces = p_i49393_3_;
-// this.axis = p_i49393_4_;
-// }
-//
-// public LodDirection getRandomDirection(Random p_179518_1_)
-// {
-// return Util.getRandom(this.faces, p_179518_1_);
-// }
-//
-// public LodDirection.Axis getRandomAxis(Random p_244803_1_)
-// {
-// return Util.getRandom(this.axis, p_244803_1_);
-// }
-//
-// @Override
-// public boolean test(@Nullable LodDirection p_test_1_)
-// {
-// return p_test_1_ != null && p_test_1_.getAxis().getPlane() == this;
-// }
-//
-// @Override
-// public Iterator iterator()
-// {
-// return Iterators.forArray(this.faces);
-// }
-//
-// public Stream stream()
-// {
-// return Arrays.stream(this.faces);
-// }
-// }
-
-
-
-
- public String getSerializedName()
- {
- return this.name;
- }
-
- @Override
- public String toString()
- {
- return this.name;
}
}
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java
index 029519a38..8f61356b9 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/generation/DhLightingEngine.java
@@ -314,7 +314,7 @@ public class DhLightingEngine
// propagate the lighting in each cardinal direction, IE: -x, +x, -y, +y, -z, +z
- for (EDhDirection direction : EDhDirection.CARDINAL_DIRECTIONS) // since this is an array instead of an ArrayList this advanced for-loop shouldn't cause any GC issues
+ for (EDhDirection direction : EDhDirection.ALL) // since this is an array instead of an ArrayList this advanced for-loop shouldn't cause any GC issues
{
lightPos.mutateOffset(direction, neighbourBlockPos);
neighbourBlockPos.mutateToChunkRelativePos(relNeighbourBlockPos);
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java
index bf38a563e..7b0315396 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/pos/DhSectionPos.java
@@ -344,8 +344,8 @@ public class DhSectionPos
}
return DhSectionPos.encode(getDetailLevel(pos),
- getX(pos) + dir.getNormal().x,
- getZ(pos) + dir.getNormal().z);
+ getX(pos) + dir.normal.x,
+ getZ(pos) + dir.normal.z);
}
@Deprecated
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPos.java b/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPos.java
index 61e81a192..0ae896d92 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPos.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPos.java
@@ -75,9 +75,9 @@ public class DhBlockPos implements INetworkObject
//========//
/** creates a new {@link DhBlockPos} with the given offset from the current pos. */
- public DhBlockPos createOffset(EDhDirection direction) { return this.mutateOrCreateOffset(direction.getNormal().x, direction.getNormal().y, direction.getNormal().z, null); }
+ public DhBlockPos createOffset(EDhDirection direction) { return this.mutateOrCreateOffset(direction.normal.x, direction.normal.y, direction.normal.z, null); }
/** if not null, mutates "mutablePos" so it matches the current pos after being offset. Otherwise creates a new {@link DhBlockPos}. */
- public void mutateOffset(EDhDirection direction, @NotNull DhBlockPosMutable mutablePos) { this.mutateOrCreateOffset(direction.getNormal().x, direction.getNormal().y, direction.getNormal().z, mutablePos); }
+ public void mutateOffset(EDhDirection direction, @NotNull DhBlockPosMutable mutablePos) { this.mutateOrCreateOffset(direction.normal.x, direction.normal.y, direction.normal.z, mutablePos); }
public DhBlockPos createOffset(int x, int y, int z) { return this.mutateOrCreateOffset(x,y,z, null); }
public void mutateOffset(int x, int y, int z, @NotNull DhBlockPosMutable mutablePos) { this.mutateOrCreateOffset(x, y, z, mutablePos); }
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPosMutable.java b/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPosMutable.java
index 31b2eb6d2..d7d8f2763 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPosMutable.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/pos/blockPos/DhBlockPosMutable.java
@@ -50,7 +50,7 @@ public class DhBlockPosMutable extends DhBlockPos
//========//
/** @see DhBlockPos#createOffset(EDhDirection) */
- public DhBlockPosMutable createOffset(EDhDirection direction) { return new DhBlockPosMutable(super.mutateOrCreateOffset(direction.getNormal().x, direction.getNormal().y, direction.getNormal().z, null)); }
+ public DhBlockPosMutable createOffset(EDhDirection direction) { return new DhBlockPosMutable(super.mutateOrCreateOffset(direction.normal.x, direction.normal.y, direction.normal.z, null)); }
/** @see DhBlockPos#createOffset(int, int, int) */
public DhBlockPosMutable createOffset(int x, int y, int z) { return new DhBlockPosMutable(this.mutateOrCreateOffset(x,y,z, null)); }
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java
index 17d16598c..154a0cdb7 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodQuadTree.java
@@ -640,7 +640,7 @@ public class LodQuadTree extends QuadTree implements IDebugRen
// clear cache //
this.clearRenderCacheForPos(pos);
- for (EDhDirection direction : EDhDirection.ADJ_DIRECTIONS)
+ for (EDhDirection direction : EDhDirection.CARDINAL_COMPASS)
{
long adjacentPos = DhSectionPos.getAdjacentPos(pos, direction);
this.clearRenderCacheForPos(adjacentPos);
@@ -658,7 +658,7 @@ public class LodQuadTree extends QuadTree implements IDebugRen
// the adjacent locations also need to be updated to make sure lighting
// and water updates correctly, otherwise oceans may have walls
// and lights may not show up over LOD borders
- for (EDhDirection direction : EDhDirection.ADJ_DIRECTIONS)
+ for (EDhDirection direction : EDhDirection.CARDINAL_COMPASS)
{
long adjacentPos = DhSectionPos.getAdjacentPos(pos, direction);
this.sectionsToReload.add(adjacentPos);
diff --git a/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java b/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java
index 3842b1ab2..aecf09bcc 100644
--- a/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java
+++ b/core/src/main/java/com/seibel/distanthorizons/core/render/LodRenderSection.java
@@ -296,13 +296,13 @@ public class LodRenderSection implements IDebugRenderable, AutoCloseable
CachedColumnRenderSource eastRenderSource = adjacentLoadFutures[2].get();
CachedColumnRenderSource westRenderSource = adjacentLoadFutures[3].get())
{
- ColumnRenderSource[] adjacentRenderSections = new ColumnRenderSource[EDhDirection.ADJ_DIRECTIONS.length];
+ ColumnRenderSource[] adjacentRenderSections = new ColumnRenderSource[EDhDirection.CARDINAL_COMPASS.length];
adjacentRenderSections[EDhDirection.NORTH.ordinal() - 2] = (northRenderSource != null) ? northRenderSource.columnRenderSource : null;
adjacentRenderSections[EDhDirection.SOUTH.ordinal() - 2] = (southRenderSource != null) ? southRenderSource.columnRenderSource : null;
adjacentRenderSections[EDhDirection.EAST.ordinal() - 2] = (eastRenderSource != null) ? eastRenderSource.columnRenderSource : null;
adjacentRenderSections[EDhDirection.WEST.ordinal() - 2] = (westRenderSource != null) ? westRenderSource.columnRenderSource : null;
- boolean[] adjIsSameDetailLevel = new boolean[EDhDirection.ADJ_DIRECTIONS.length];
+ boolean[] adjIsSameDetailLevel = new boolean[EDhDirection.CARDINAL_COMPASS.length];
adjIsSameDetailLevel[EDhDirection.NORTH.ordinal() - 2] = this.isAdjacentPosSameDetailLevel(EDhDirection.NORTH);
adjIsSameDetailLevel[EDhDirection.SOUTH.ordinal() - 2] = this.isAdjacentPosSameDetailLevel(EDhDirection.SOUTH);
adjIsSameDetailLevel[EDhDirection.EAST.ordinal() - 2] = this.isAdjacentPosSameDetailLevel(EDhDirection.EAST);