remove undefined type

This commit is contained in:
Németh Noel 2021-07-09 20:13:40 +02:00
parent d6221ab212
commit 0793ccefc8
2 changed files with 4 additions and 5 deletions

View File

@ -46,7 +46,7 @@ abstract class ArgumentRelativeVec extends Argument<RelativeVec> {
double[] coordinates = new double[split.length];
boolean[] isRelative = new boolean[split.length];
var type = UNDEFINED;
RelativeVec.CoordinateType type = null;
for (int i = 0; i < split.length; i++) {
final String element = split[i];
try {
@ -54,7 +54,7 @@ abstract class ArgumentRelativeVec extends Argument<RelativeVec> {
if (MODIFIER_CHARS.contains(modifierChar)) {
isRelative[i] = true;
if (type == UNDEFINED) {
if (type == null) {
type = modifierChar == LOCAL_CHAR ? LOCAL : RELATIVE;
} else if (type != (modifierChar == LOCAL_CHAR ? LOCAL : RELATIVE)) {
throw new ArgumentSyntaxException("Cannot mix world & local coordinates (everything must either use ^ or not)", input, MIXED_TYPE_ERROR);
@ -65,7 +65,7 @@ abstract class ArgumentRelativeVec extends Argument<RelativeVec> {
coordinates[i] = getRelativeNumberParser().apply(potentialNumber).doubleValue();
}
} else {
if (type == UNDEFINED) {
if (type == null) {
type = ABSOLUTE;
} else if (type == LOCAL) {
throw new ArgumentSyntaxException("Cannot mix world & local coordinates (everything must either use ^ or not)", input, MIXED_TYPE_ERROR);

View File

@ -128,8 +128,7 @@ public final class RelativeVec {
double double18 = dna11.z() * local.z() + dna12.z() * local.y() + dna13.z() * local.x();
return new Vec(double14 + origin.x(),double16 + origin.y(),double18 + origin.z());
}),
ABSOLUTE(((vec, origin, relativeX1, relativeY1, relativeZ1) -> vec)),
UNDEFINED((vec, origin, relativeX, relativeY, relativeZ) -> Vec.ZERO);
ABSOLUTE(((vec, origin, relativeX1, relativeY1, relativeZ1) -> vec));
private final CoordinateConverter converter;