diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2021-10-18 15:25:26 +0800 |
---|---|---|
committer | Glease <4586901+Glease@users.noreply.github.com> | 2021-10-18 15:25:26 +0800 |
commit | fbe8484b9975e2b68285084936f91fb070c64d6d (patch) | |
tree | fbc6d05e62b06b0f33e8326abfefbe3cad365568 /src/main | |
parent | 1cde20e6d255b659d8009f9263ad1a944a947afb (diff) | |
download | GT5-Unofficial-fbe8484b9975e2b68285084936f91fb070c64d6d.tar.gz GT5-Unofficial-fbe8484b9975e2b68285084936f91fb070c64d6d.tar.bz2 GT5-Unofficial-fbe8484b9975e2b68285084936f91fb070c64d6d.zip |
Fix cycle in class initialization order
ExtendedFacing depends on IAlignment being fully initialized to be instantiated as part of its class initializer, which in turn require ExtendedFacing to be fully initialized to complete class initialization. How does this even work before?
Diffstat (limited to 'src/main')
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) { |