Skip to content

Commit ee490b7

Browse files
committed
v1.0
1 parent f3d56e9 commit ee490b7

4 files changed

Lines changed: 8 additions & 23 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
1111
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
1212

1313

14-
version = "0.1"
14+
version = "1.0"
1515
group = "trackapi" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
1616
archivesBaseName = "TrackAPI"
1717

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
package trackapi;
22

33
import net.minecraftforge.fml.common.Mod;
4-
import net.minecraftforge.fml.common.Mod.EventHandler;
5-
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
64

75
@Mod(modid = TrackAPI.MODID, version = TrackAPI.VERSION, acceptedMinecraftVersions = "[1.12,1.13)")
86
public class TrackAPI
97
{
108
public static final String MODID = "trackapi";
11-
public static final String VERSION = "0.1";
12-
13-
@EventHandler
14-
public void init(FMLInitializationEvent event)
15-
{
16-
System.out.println("TrackAPI Activated");
17-
}
9+
public static final String VERSION = "1.0";
1810
}

src/main/java/trackapi/compat/MinecraftRail.java

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
public class MinecraftRail implements ITrackTile {
1313

1414
private EnumRailDirection direction;
15+
private BlockPos pos;
1516

1617
public MinecraftRail(World world, BlockPos pos) {
18+
this.pos = pos;
1719
IBlockState state = world.getBlockState(pos);
1820
BlockRailBase blockrailbase = (BlockRailBase)state.getBlock();
1921
this.direction = blockrailbase.getRailDirection(world, pos, state, null);
@@ -33,13 +35,7 @@ public double getTrackSlope() {
3335
}
3436

3537
@Override
36-
public Vec3d getNextPosition(Vec3d currentPosition, float rotationYaw, float bogeyYaw, double distance) {
37-
if (distance < 0) {
38-
distance = -distance;
39-
rotationYaw = (rotationYaw + 180) % 360;
40-
bogeyYaw = (bogeyYaw + 180) % 360;
41-
}
42-
38+
public Vec3d getNextPosition(Vec3d currentPosition, Vec3d motion) {
4339
//TODO fill in the rest of the states
4440

4541
switch (direction) {
@@ -52,14 +48,11 @@ public Vec3d getNextPosition(Vec3d currentPosition, float rotationYaw, float bog
5248
case ASCENDING_WEST:
5349
break;
5450
case EAST_WEST:
55-
break;
51+
return currentPosition.addVector(motion.x > 0 ? motion.lengthVector() : -motion.lengthVector(), 0, pos.getZ() - currentPosition.z + 0.5);
5652
case NORTH_EAST:
5753
break;
5854
case NORTH_SOUTH:
59-
if (rotationYaw / 180 == 0) {
60-
return currentPosition.addVector(0, 0, distance);
61-
}
62-
return currentPosition.addVector(0, 0, -distance);
55+
return currentPosition.addVector(pos.getX() - currentPosition.x + 0.5, 0, motion.z > 0 ? motion.lengthVector() : -motion.lengthVector());
6356
case NORTH_WEST:
6457
break;
6558
case SOUTH_EAST:

src/main/java/trackapi/lib/ITrackTile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ public interface ITrackTile {
2727
* @param distance - Distanced traveled in meters
2828
* @return The new position of the entity or bogey
2929
*/
30-
public Vec3d getNextPosition(Vec3d currentPosition, float rotationYaw, float bogeyYaw, double distance);
30+
public Vec3d getNextPosition(Vec3d currentPosition, Vec3d motion);
3131
}

0 commit comments

Comments
 (0)