Skip to content

Commit

Permalink
Move Gauges to seperate file
Browse files Browse the repository at this point in the history
  • Loading branch information
cam72cam committed Nov 26, 2017
1 parent 53ec308 commit 8ec3fde
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
12 changes: 2 additions & 10 deletions src/main/java/trackapi/compat/MinecraftRail.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import trackapi.lib.Gauges;
import trackapi.lib.ITrackTile;
import trackapi.lib.Util;

public class MinecraftRail implements ITrackTile {

Expand All @@ -23,15 +23,7 @@ public MinecraftRail(World world, BlockPos pos) {

@Override
public double getTrackGauge() {
return Util.MINECRAFT_GAUGE;
}

@Override
public double getTrackSlope() {
return direction == EnumRailDirection.ASCENDING_EAST ||
direction == EnumRailDirection.ASCENDING_WEST ||
direction == EnumRailDirection.ASCENDING_NORTH ||
direction == EnumRailDirection.ASCENDING_SOUTH ? 1 : 0;
return Gauges.MINECRAFT;
}

@Override
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/trackapi/lib/Gauges.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package trackapi.lib;

public class Gauges {
/**
* US Standard Gauge in meters
*/
public static final double STANDARD = 1.435;

/**
* Minecraft Gauge in meters
*/
public static final double MINECRAFT = 0.632;
}
4 changes: 2 additions & 2 deletions src/main/java/trackapi/lib/ITrackTile.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public interface ITrackTile {
/**
* The distance between the rails measured in meters
*
* @see Util#STANDARD_GAUGE
* @see Util#MINECRAFT_GAUGE
* @see Gauges#STANDARD
* @see Gauges#MINECRAFT
*/
public double getTrackGauge();

Expand Down
10 changes: 0 additions & 10 deletions src/main/java/trackapi/lib/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@
import trackapi.compat.MinecraftRail;

public class Util {
/**
* US Standard Gauge in meters
*/
public static final double STANDARD_GAUGE = 1.435;

/**
* Minecraft Gauge in meters
*/
public static final double MINECRAFT_GAUGE = 0.632;

private static ITrackTile getInternalTileEntity(World world, Vec3d pos, boolean acceptMinecraftRails) {
BlockPos bp = new BlockPos(MathHelper.floor(pos.x), MathHelper.floor(pos.y), MathHelper.floor(pos.z));
TileEntity te = world.getTileEntity(bp);
Expand Down

0 comments on commit 8ec3fde

Please sign in to comment.