use of net.minecraft.util.math.Vec3d in project ImmersiveEngineering by BluSunrize.
the class TileEntityConnectorMV method getConnectionOffset.
@Override
public Vec3d getConnectionOffset(Connection con) {
EnumFacing side = facing.getOpposite();
double conRadius = con.cableType.getRenderDiameter() / 2;
return new Vec3d(.5 + side.getFrontOffsetX() * (.0625 - conRadius), .5 + side.getFrontOffsetY() * (.0625 - conRadius), .5 + side.getFrontOffsetZ() * (.0625 - conRadius));
}
use of net.minecraft.util.math.Vec3d in project ImmersiveEngineering by BluSunrize.
the class TileEntityBreakerSwitch method getConnectionOffset.
@Override
public Vec3d getConnectionOffset(Connection con) {
Matrix4 mat = new Matrix4(facing);
mat.translate(.5, .5, 0).rotate(Math.PI / 2 * rotation, 0, 0, 1).translate(-.5, -.5, 0);
if (endOfLeftConnection == null)
calculateLeftConn(mat);
boolean isLeft = con.end.equals(endOfLeftConnection) || con.start.equals(endOfLeftConnection);
Vec3d ret = mat.apply(new Vec3d(isLeft ? .25 : .75, .5, .125));
return ret;
}
use of net.minecraft.util.math.Vec3d in project ImmersiveEngineering by BluSunrize.
the class TileEntityBreakerSwitch method calculateLeftConn.
protected void calculateLeftConn(Matrix4 transform) {
Vec3d leftVec = transform.apply(new Vec3d(-1, .5, .5)).subtract(0, .5, .5);
EnumFacing dir = EnumFacing.getFacingFromVector((float) leftVec.xCoord, (float) leftVec.yCoord, (float) leftVec.zCoord);
int maxDiff = Integer.MIN_VALUE;
Set<Connection> conns = ImmersiveNetHandler.INSTANCE.getConnections(worldObj, pos);
if (conns != null)
for (Connection c : conns) {
Vec3i diff = pos.equals(c.start) ? c.end.subtract(pos) : c.start.subtract(pos);
int val = 0;
switch(dir.getAxis()) {
case X:
val = diff.getX();
break;
case Y:
val = diff.getY();
break;
case Z:
val = diff.getZ();
}
val *= dir.getAxisDirection().getOffset();
if (val > maxDiff) {
maxDiff = val;
endOfLeftConnection = pos == c.end ? c.start : c.end;
}
}
}
use of net.minecraft.util.math.Vec3d in project ImmersiveEngineering by BluSunrize.
the class TileEntityBreakerSwitch method getBlockBounds.
@Override
public float[] getBlockBounds() {
Vec3d start = new Vec3d(.25, .1875, 0);
Vec3d end = new Vec3d(.75, .8125, .5);
Matrix4 mat = new Matrix4(facing);
mat.translate(.5, .5, 0).rotate(Math.PI / 2 * rotation, 0, 0, 1).translate(-.5, -.5, 0);
start = mat.apply(start);
end = mat.apply(end);
return new float[] { (float) start.xCoord, (float) start.yCoord, (float) start.zCoord, (float) end.xCoord, (float) end.yCoord, (float) end.zCoord };
}
use of net.minecraft.util.math.Vec3d in project ImmersiveEngineering by BluSunrize.
the class TileEntityConnectorRedstone method getConnectionOffset.
@Override
public Vec3d getConnectionOffset(Connection con) {
EnumFacing side = facing.getOpposite();
double conRadius = con.cableType.getRenderDiameter() / 2;
return new Vec3d(.5 - conRadius * side.getFrontOffsetX(), .5 - conRadius * side.getFrontOffsetY(), .5 - conRadius * side.getFrontOffsetZ());
}
Aggregations