First 1.6 push, still work to be done

This commit is contained in:
Aidan Brady committed 2013-07-20 12:10:14 -04:00
1 parent 1b039bce4b
commit cfc5dff445
462 files changed
+1473 -4025

No files matched your search

+18 -17
View File
@@ -1,6 +1,7 @@
package ic2.api;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
/**
@@ -15,7 +16,7 @@ public enum Direction {
* +X
*/
XP(1),
/**
* -Y
*/
@@ -24,7 +25,7 @@ public enum Direction {
* +Y
*/
YP(3), // 1...
/**
* -Z
*/
@@ -33,19 +34,19 @@ public enum Direction {
* +Z
*/
ZP(5);
Direction(int dir) {
this.dir = dir;
}
/*public CoordinateTuple ApplyToCoordinates(CoordinateTuple coordinates) {
CoordinateTuple ret = new CoordinateTuple(coordinates);
ret.coords[dir/2] += GetSign();
return ret;
}*/
/**
* Get the tile entity next to a tile entity following this direction.
*
@@ -54,16 +55,16 @@ public enum Direction {
*/
public TileEntity applyToTileEntity(TileEntity tileEntity) {
int coords[] = { tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord };
coords[dir/2] += getSign();
if (tileEntity.worldObj != null && tileEntity.worldObj.blockExists(coords[0], coords[1], coords[2])) {
return tileEntity.worldObj.getBlockTileEntity(coords[0], coords[1], coords[2]);
} else {
return null;
}
}
/**
* Get the inverse of this direction (XN -> XP, XP -> XN, etc.)
*
@@ -71,14 +72,14 @@ public enum Direction {
*/
public Direction getInverse() {
int inverseDir = dir - getSign();
for (Direction direction : directions) {
if (direction.dir == inverseDir) return direction;
}
return this;
}
/**
* Convert this direction to a Minecraft side value.
*
@@ -87,7 +88,7 @@ public enum Direction {
public int toSideValue() {
return (dir + 4) % 6;
}
/**
* Determine direction sign (N for negative or P for positive).
*
@@ -96,12 +97,12 @@ public enum Direction {
private int getSign() {
return (dir % 2) * 2 - 1;
}
public ForgeDirection toForgeDirection() {
return ForgeDirection.getOrientation(toSideValue());
}
private int dir;
private static final Direction[] directions = Direction.values();
public static final Direction[] directions = Direction.values();
}