aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2021-10-18 09:57:27 +0200
committerGitHub <noreply@github.com>2021-10-18 09:57:27 +0200
commit10ac16f3a4bf6755db70cf07ba2b0330489f5f3a (patch)
treefbc6d05e62b06b0f33e8326abfefbe3cad365568
parent1cde20e6d255b659d8009f9263ad1a944a947afb (diff)
parentfbe8484b9975e2b68285084936f91fb070c64d6d (diff)
downloadGT5-Unofficial-10ac16f3a4bf6755db70cf07ba2b0330489f5f3a.tar.gz
GT5-Unofficial-10ac16f3a4bf6755db70cf07ba2b0330489f5f3a.tar.bz2
GT5-Unofficial-10ac16f3a4bf6755db70cf07ba2b0330489f5f3a.zip
Merge pull request #16 from GTNewHorizons/fix-8704
Fix cycle in class initialization order
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java6
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java1
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java1
3 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java
index 04f2a55bd5..8e384e098c 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java
@@ -138,9 +138,9 @@ public enum ExtendedFacing {
ExtendedFacing(String name) {
this.name = name;
- direction= Direction.VALUES[ordinal()/(ROTATIONS_COUNT*FLIPS_COUNT)].getForgeDirection();
- rotation=Rotation.VALUES[ordinal()/FLIPS_COUNT-direction.ordinal()*ROTATIONS_COUNT];
- flip=Flip.VALUES[ordinal()%FLIPS_COUNT];
+ direction= Direction.VALUES[ordinal()/(Rotation.COUNT*Flip.COUNT)].getForgeDirection();
+ rotation=Rotation.VALUES[ordinal()/Flip.COUNT-direction.ordinal()*Rotation.COUNT];
+ flip=Flip.VALUES[ordinal()%Flip.COUNT];
ForgeDirection a,b,c;
switch (direction){
case DOWN:
diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java
index 0b85c5197e..400f94f869 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Flip.java
@@ -20,6 +20,7 @@ public enum Flip {
private final String name;
public static final Flip[] VALUES = values();
+ public static final int COUNT = VALUES.length;
private static final Map<String, Flip> NAME_LOOKUP = stream(VALUES).collect(toMap(Flip::getName2, (flip) -> flip));
Flip(int oppositeIn, String nameIn) {
diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java
index b6cd1aa015..ed4872828a 100644
--- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java
+++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/Rotation.java
@@ -20,6 +20,7 @@ public enum Rotation {
private final String name;
public static final Rotation[] VALUES = values();
+ public static final int COUNT = VALUES.length;
private static final Map<String, Rotation> NAME_LOOKUP = stream(VALUES).collect(toMap(Rotation::getName2, (rotation) -> rotation));
Rotation(int oppositeIn, String nameIn) {