Add more directionals

- Fixes #1122
 - Levers and buttons can be flipped/rotated vertically
Dieser Commit ist enthalten in:
dordsor21 2021-07-23 20:15:22 +01:00
Ursprung 0d26dad397
Commit 0be8746c11
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -91,6 +91,7 @@ public class BlockTransformExtent extends ResettableExtent {
PropertyKey.ROTATION,
PropertyKey.AXIS,
PropertyKey.FACING,
PropertyKey.FACE,
PropertyKey.SHAPE,
PropertyKey.NORTH,
PropertyKey.EAST,
@ -166,24 +167,21 @@ public class BlockTransformExtent extends ResettableExtent {
} else {
List values = property.getValues();
PropertyKey key = property.getKey();
if (key == PropertyKey.HALF || values.contains("top")) {
switch (key.getName().toLowerCase()) {
case "half": {
return adapt(UP, DOWN);
}
if (values.contains("left")) {
if (key == PropertyKey.SHAPE) {
return adapt(combine(EAST, WEST), combine(NORTH, SOUTH));
} else if (key == PropertyKey.HINGE) {
return adapt(combine(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST), combine(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST));
case "type": {
return adapt(combine(UP), combine(DOWN), 0L);
}
}
if (key == PropertyKey.ROTATION) {
case "rotation": {
List<Direction> directions = new ArrayList<>();
for (Object value : values) {
directions.add(Direction.fromRotationIndex((Integer) value).get());
}
return adapt(directions.toArray(new Direction[0]));
}
if (key == PropertyKey.AXIS) {
case "axis": {
switch (property.getValues().size()) {
case 3:
return adapt(combine(EAST, WEST), combine(UP, DOWN), combine(SOUTH, NORTH));
@ -194,14 +192,26 @@ public class BlockTransformExtent extends ResettableExtent {
return null;
}
}
if (key == PropertyKey.FACING) {
case "facing": {
List<Direction> directions = new ArrayList<>();
for (Object value : values) {
directions.add(Direction.valueOf(value.toString().toUpperCase(Locale.ROOT)));
}
return adapt(directions.toArray(new Direction[0]));
}
if (key == PropertyKey.SHAPE) {
case "face": {
if (values.size() == 3) {
return adapt(combine(UP), combine(NORTH, EAST, SOUTH, WEST), combine(DOWN));
}
return null;
}
case "hinge": {
return adapt(combine(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST), combine(NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST));
}
case "shape": {
if (values.contains("left")) {
return adapt(combine(EAST, WEST), combine(NORTH, SOUTH));
}
if (values.contains("straight")) {
ArrayList<Long> result = new ArrayList<>();
for (Object value : values) {
@ -271,6 +281,7 @@ public class BlockTransformExtent extends ResettableExtent {
}
}
}
}
return null;
}