Renamed CoordinateType to EnumType

This commit is contained in:
Marcel Konrad
2020-05-24 20:26:28 +02:00
parent 1a6efa33e5
commit 6e4f26b66e
5 changed files with 19 additions and 19 deletions

View File

@@ -2,7 +2,7 @@ package exopandora.worldhandler.builder.impl;
import exopandora.worldhandler.builder.CommandBuilder;
import exopandora.worldhandler.builder.CommandSyntax;
import exopandora.worldhandler.builder.types.Coordinate.CoordinateType;
import exopandora.worldhandler.builder.types.Coordinate.EnumType;
import exopandora.worldhandler.builder.types.CoordinateInt;
import exopandora.worldhandler.builder.types.ArgumentType;
import net.minecraftforge.api.distmarker.Dist;
@@ -13,9 +13,9 @@ public class BuilderSpawnpoint extends CommandBuilder
{
public BuilderSpawnpoint()
{
this.setX(new CoordinateInt(CoordinateType.GLOBAL));
this.setY(new CoordinateInt(CoordinateType.GLOBAL));
this.setZ(new CoordinateInt(CoordinateType.GLOBAL));
this.setX(new CoordinateInt(EnumType.GLOBAL));
this.setY(new CoordinateInt(EnumType.GLOBAL));
this.setZ(new CoordinateInt(EnumType.GLOBAL));
}
@Override

View File

@@ -11,14 +11,14 @@ import net.minecraftforge.api.distmarker.OnlyIn;
public abstract class Coordinate<T extends Number> implements ICoordinate<T>
{
protected T value;
protected CoordinateType type;
protected EnumType type;
public Coordinate(T value)
{
this(value, CoordinateType.ABSOLUTE);
this(value, EnumType.ABSOLUTE);
}
public Coordinate(T value, CoordinateType type)
public Coordinate(T value, EnumType type)
{
this.value = value;
this.type = type;
@@ -34,12 +34,12 @@ public abstract class Coordinate<T extends Number> implements ICoordinate<T>
return this.value;
}
public void setType(CoordinateType type)
public void setType(EnumType type)
{
this.type = type;
}
public CoordinateType getType()
public EnumType getType()
{
return this.type;
}
@@ -53,7 +53,7 @@ public abstract class Coordinate<T extends Number> implements ICoordinate<T>
@Nullable
public static <S extends Number, U extends Coordinate<S>> U parse(U coordiante, String input, Function<String, S> parser)
{
for(CoordinateType type : CoordinateType.values())
for(EnumType type : EnumType.values())
{
if(!type.prefix.isEmpty() && input.startsWith(type.prefix))
{
@@ -66,14 +66,14 @@ public abstract class Coordinate<T extends Number> implements ICoordinate<T>
}
}
coordiante.setType(CoordinateType.ABSOLUTE);
coordiante.setType(EnumType.ABSOLUTE);
coordiante.setValue(parser.apply(input));
return coordiante;
}
@OnlyIn(Dist.CLIENT)
public static enum CoordinateType
public static enum EnumType
{
ABSOLUTE(""),
GLOBAL("~"),
@@ -81,7 +81,7 @@ public abstract class Coordinate<T extends Number> implements ICoordinate<T>
private final String prefix;
private CoordinateType(String prefix)
private EnumType(String prefix)
{
this.prefix = prefix;
}

View File

@@ -16,12 +16,12 @@ public class CoordinateDouble extends Coordinate<Double>
super(value);
}
public CoordinateDouble(CoordinateType type)
public CoordinateDouble(EnumType type)
{
super(0.0, type);
}
public CoordinateDouble(Double value, CoordinateType type)
public CoordinateDouble(Double value, EnumType type)
{
super(value, type);
}

View File

@@ -16,12 +16,12 @@ public class CoordinateInt extends Coordinate<Integer>
super(value);
}
public CoordinateInt(CoordinateType type)
public CoordinateInt(EnumType type)
{
super(0, type);
}
public CoordinateInt(Integer value, CoordinateType type)
public CoordinateInt(Integer value, EnumType type)
{
super(value, type);
}