mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-20 03:59:37 +00:00
Merge branch 'development' into 1.8 (gosh darn conflicts)
Conflicts: src/api/java/ic2/api/Direction.java src/api/java/ic2/api/energy/NodeStats.java src/main/java/mekanism/common/Mekanism.java src/main/java/mekanism/common/block/BlockMachine.java src/main/java/mekanism/common/tile/TileEntityElectricBlock.java src/main/java/mekanism/common/util/MekanismUtils.java src/main/java/mekanism/generators/common/block/BlockGenerator.java
This commit is contained in:
commit
60bf7f5f3d
13 files changed
+123
-124
No files matched your search
@@ -12,29 +12,29 @@ public enum Direction {
|
||||
/**
|
||||
* -X
|
||||
*/
|
||||
XN(0),
|
||||
XN,
|
||||
/**
|
||||
* +X
|
||||
*/
|
||||
XP(1),
|
||||
XP,
|
||||
|
||||
/**
|
||||
* -Y
|
||||
*/
|
||||
YN(2), //MC-Code starts with 0 here
|
||||
YN, //MC-Code starts with 0 here
|
||||
/**
|
||||
* +Y
|
||||
*/
|
||||
YP(3), // 1...
|
||||
YP, // 1...
|
||||
|
||||
/**
|
||||
* -Z
|
||||
*/
|
||||
ZN(4),
|
||||
ZN,
|
||||
/**
|
||||
* +Z
|
||||
*/
|
||||
ZP(5);
|
||||
ZP;
|
||||
|
||||
public static Direction fromSideValue(int side) {
|
||||
return directions[(side + 2) % 6];
|
||||
@@ -46,10 +46,6 @@ public enum Direction {
|
||||
return fromSideValue(dir.ordinal());
|
||||
}
|
||||
|
||||
private Direction(int dir1) {
|
||||
this.dir = dir1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tile entity next to a tile entity following this direction.
|
||||
*
|
||||
@@ -72,7 +68,7 @@ public enum Direction {
|
||||
public TileEntity applyTo(World world, int x, int y, int z) {
|
||||
int coords[] = { x, y, z };
|
||||
|
||||
coords[dir/2] += getSign();
|
||||
coords[ordinal() / 2] += getSign();
|
||||
|
||||
if (world != null && world.blockExists(coords[0], coords[1], coords[2])) {
|
||||
try {
|
||||
@@ -91,13 +87,7 @@ public enum Direction {
|
||||
* @return Inverse direction
|
||||
*/
|
||||
public Direction getInverse() {
|
||||
int inverseDir = dir - getSign();
|
||||
|
||||
for (Direction direction : directions) {
|
||||
if (direction.dir == inverseDir) return direction;
|
||||
}
|
||||
|
||||
return this;
|
||||
return directions[ordinal() ^ 1];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +96,7 @@ public enum Direction {
|
||||
* @return Minecraft side value
|
||||
*/
|
||||
public int toSideValue() {
|
||||
return (dir + 4) % 6;
|
||||
return (ordinal() + 4) % 6;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,14 +105,13 @@ public enum Direction {
|
||||
* @return -1 if the direction is negative, +1 if the direction is positive
|
||||
*/
|
||||
private int getSign() {
|
||||
return (dir % 2) * 2 - 1;
|
||||
return (ordinal() % 2) * 2 - 1;
|
||||
}
|
||||
|
||||
public ForgeDirection toForgeDirection() {
|
||||
return ForgeDirection.getOrientation(toSideValue());
|
||||
}
|
||||
|
||||
private int dir;
|
||||
public static final Direction[] directions = Direction.values();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class NodeStats {
|
||||
return voltage;
|
||||
}
|
||||
|
||||
private final double energyIn;
|
||||
private final double energyOut;
|
||||
private final double voltage;
|
||||
protected double energyIn;
|
||||
protected double energyOut;
|
||||
protected double voltage;
|
||||
}
|
||||
@@ -90,4 +90,6 @@ public interface IElectricItemManager {
|
||||
* @return tool tip string or null for none
|
||||
*/
|
||||
String getToolTip(ItemStack stack);
|
||||
|
||||
// TODO: add tier getter
|
||||
}
|
||||
Reference in new issue
Block a user