mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 15:46:01 +00:00
Added logo and API to project for Jenkins.
This commit is contained in:
1 parent
dc0bc5c508
commit
4cd39ad1fa
214 files changed
+14788
No files matched your search
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
* Copyright (c) SpaceToad, 2011
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.src.NBTTagCompound;
|
||||
import net.minecraft.src.TileEntity;
|
||||
|
||||
public class Position {
|
||||
|
||||
public double x, y, z;
|
||||
public Orientations orientation;
|
||||
|
||||
public Position(double ci, double cj, double ck) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = Orientations.Unknown;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck, Orientations corientation) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = corientation;
|
||||
}
|
||||
|
||||
public Position(Position p) {
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = p.z;
|
||||
orientation = p.orientation;
|
||||
}
|
||||
|
||||
public Position(NBTTagCompound nbttagcompound) {
|
||||
x = nbttagcompound.getDouble("i");
|
||||
y = nbttagcompound.getDouble("j");
|
||||
z = nbttagcompound.getDouble("k");
|
||||
|
||||
orientation = Orientations.Unknown;
|
||||
}
|
||||
|
||||
public Position(TileEntity tile) {
|
||||
x = tile.xCoord;
|
||||
y = tile.yCoord;
|
||||
z = tile.zCoord;
|
||||
}
|
||||
|
||||
public void moveRight(double step) {
|
||||
switch (orientation) {
|
||||
case ZPos:
|
||||
x = x - step;
|
||||
break;
|
||||
case ZNeg:
|
||||
x = x + step;
|
||||
break;
|
||||
case XPos:
|
||||
z = z + step;
|
||||
break;
|
||||
case XNeg:
|
||||
z = z - step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void moveLeft(double step) {
|
||||
moveRight(-step);
|
||||
}
|
||||
|
||||
public void moveForwards(double step) {
|
||||
switch (orientation) {
|
||||
case YPos:
|
||||
y = y + step;
|
||||
break;
|
||||
case YNeg:
|
||||
y = y - step;
|
||||
break;
|
||||
case ZPos:
|
||||
z = z + step;
|
||||
break;
|
||||
case ZNeg:
|
||||
z = z - step;
|
||||
break;
|
||||
case XPos:
|
||||
x = x + step;
|
||||
break;
|
||||
case XNeg:
|
||||
x = x - step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void moveBackwards(double step) {
|
||||
moveForwards(-step);
|
||||
}
|
||||
|
||||
public void moveUp(double step) {
|
||||
switch (orientation) {
|
||||
case ZPos:
|
||||
case ZNeg:
|
||||
case XPos:
|
||||
case XNeg:
|
||||
y = y + step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void moveDown(double step) {
|
||||
moveUp(-step);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setDouble("i", x);
|
||||
nbttagcompound.setDouble("j", y);
|
||||
nbttagcompound.setDouble("k", z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
|
||||
public Position min(Position p) {
|
||||
return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z);
|
||||
}
|
||||
|
||||
public Position max(Position p) {
|
||||
return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user