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

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,7 @@ package exopandora.worldhandler.gui.content.impl;
import exopandora.worldhandler.builder.impl.BuilderGive; import exopandora.worldhandler.builder.impl.BuilderGive;
import exopandora.worldhandler.builder.impl.BuilderSetBlock; import exopandora.worldhandler.builder.impl.BuilderSetBlock;
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.CoordinateInt;
import exopandora.worldhandler.config.Config; import exopandora.worldhandler.config.Config;
import exopandora.worldhandler.gui.button.GuiButtonBase; import exopandora.worldhandler.gui.button.GuiButtonBase;
@@ -73,7 +73,7 @@ public class ContentContainers extends Content
if(block != null) if(block != null)
{ {
CommandHelper.sendCommand(new BuilderSetBlock(new CoordinateInt(cx, CoordinateType.GLOBAL), new CoordinateInt(yOffset, CoordinateType.GLOBAL), new CoordinateInt(cz, CoordinateType.GLOBAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode())); CommandHelper.sendCommand(new BuilderSetBlock(new CoordinateInt(cx, EnumType.GLOBAL), new CoordinateInt(yOffset, EnumType.GLOBAL), new CoordinateInt(cz, EnumType.GLOBAL), block.getRegistryName(), Config.getSettings().getBlockPlacingMode()));
} }
} }
} }