use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LogisticsBlockGenericSubMultiBlock method collisionRayTrace.
@Override
public MovingObjectPosition collisionRayTrace(World world, int x, int y, int z, Vec3 origin, Vec3 direction) {
DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
TileEntity tile = pos.getTileEntity(world);
if (tile instanceof LogisticsTileGenericSubMultiBlock) {
List<LogisticsTileGenericPipe> mainPipeList = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
for (LogisticsTileGenericPipe mainPipe : mainPipeList) {
if (mainPipe != null && mainPipe.pipe != null && mainPipe.pipe.isMultiBlock()) {
MovingObjectPosition result = LogisticsPipes.LogisticsPipeBlock.collisionRayTrace(world, mainPipe.xCoord, mainPipe.yCoord, mainPipe.zCoord, origin, direction);
if (result != null) {
result.blockX = x;
result.blockY = y;
result.blockZ = z;
return result;
}
}
}
}
return null;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class LogisticsBlockGenericSubMultiBlock method onNeighborBlockChange.
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
super.onNeighborBlockChange(world, x, y, z, block);
DoubleCoordinates pos = new DoubleCoordinates(x, y, z);
TileEntity tile = pos.getTileEntity(world);
if (tile instanceof LogisticsTileGenericSubMultiBlock) {
((LogisticsTileGenericSubMultiBlock) tile).scheduleNeighborChange();
}
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class HSTubeSCurve method getConnectedEndTile.
@Override
public TileEntity getConnectedEndTile(ForgeDirection output) {
boolean useOwn;
if (orientation.getOffset().getLength() != 0) {
if (orientation.dir.getOpposite() == output) {
useOwn = false;
} else if (orientation.dir == output) {
useOwn = true;
} else {
return null;
}
} else {
if (orientation.dir.getOpposite() == output) {
useOwn = true;
} else if (orientation.dir == output) {
useOwn = false;
} else {
return null;
}
}
if (useOwn) {
return container.getTile(output);
} else {
DoubleCoordinates pos = new DoubleCoordinates(1, 0, -3);
LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
set.add(pos);
orientation.rotatePositions(set);
TileEntity subTile = pos.add(getLPPosition()).getTileEntity(getWorld());
if (subTile instanceof LogisticsTileGenericSubMultiBlock) {
return ((LogisticsTileGenericSubMultiBlock) subTile).getTile(output);
}
}
return null;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class HSTubeSpeedup method getItemRenderPos.
@Override
public DoubleCoordinates getItemRenderPos(float fPos, LPTravelingItem travelItem) {
DoubleCoordinates pos = new DoubleCoordinates(0.5D, 0.5D, 0.5D);
float pPos = fPos;
if (travelItem.input.getOpposite() == orientation.dir1) {
CoordinateUtils.add(pos, orientation.dir1, 3);
pPos = this.getPipeLength() - fPos;
}
if (pPos < 0.5) {
if (travelItem.input == ForgeDirection.UNKNOWN) {
return null;
}
if (!container.renderState.pipeConnectionMatrix.isConnected(travelItem.input.getOpposite())) {
return null;
}
CoordinateUtils.add(pos, travelItem.input.getOpposite(), 0.5 - fPos);
} else {
if (travelItem.output == ForgeDirection.UNKNOWN) {
return null;
}
CoordinateUtils.add(pos, travelItem.output, fPos - 0.5);
}
return pos;
}
use of network.rs485.logisticspipes.world.DoubleCoordinates in project LogisticsPipes by RS485.
the class HSTubeSpeedup method addCollisionBoxesToList.
@Override
public void addCollisionBoxesToList(List arraylist, AxisAlignedBB axisalignedbb) {
DoubleCoordinates pos = getLPPosition();
DoubleCoordinates posMin = new DoubleCoordinates(LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS, LPConstants.PIPE_MIN_POS);
DoubleCoordinates posMax = new DoubleCoordinates(LPConstants.PIPE_MAX_POS, LPConstants.PIPE_MAX_POS, -3);
orientation.rotatePositions(posMin);
orientation.rotatePositions(posMax);
if (orientation == SpeedupDirection.EAST) {
pos.add(new DoubleCoordinates(1, 0, 0));
} else if (orientation == SpeedupDirection.SOUTH) {
pos.add(new DoubleCoordinates(1, 0, 1));
} else if (orientation == SpeedupDirection.WEST) {
pos.add(new DoubleCoordinates(0, 0, 1));
}
posMin.add(pos);
posMax.add(pos);
LPPositionSet<DoubleCoordinates> set = new LPPositionSet<>(DoubleCoordinates.class);
set.add(posMin);
set.add(posMax);
AxisAlignedBB box = set.toABB();
if (box != null && (axisalignedbb == null || axisalignedbb.intersectsWith(box))) {
arraylist.add(box);
}
}
Aggregations