public AxisAlignedBB getAABB() { return boundingBox; }
private void calculateRotorInfo() {
// Calculate bounding box
MultiblockTurbine turbine = getTurbine();
CoordTriplet minCoord = turbine.getMinimumCoord();
CoordTriplet maxCoord = turbine.getMaximumCoord();
boundingBox = AxisAlignedBB.getBoundingBox(minCoord.x, minCoord.y, minCoord.z, maxCoord.x, maxCoord.y, maxCoord.z);
if(worldObj.isRemote) {
// Calculate rotor info
rotorInfo = new RotorInfo();
rotorInfo.rotorDirection = getOutwardsDir().getOpposite();
switch(rotorInfo.rotorDirection) {
case DOWN:
case UP:
case UNKNOWN:
rotorInfo.rotorLength = maxCoord.y - minCoord.y - 1;
break;
case EAST:
case WEST:
rotorInfo.rotorLength = maxCoord.x - minCoord.x - 1;
break;
case NORTH:
case SOUTH:
rotorInfo.rotorLength = maxCoord.z - minCoord.z - 1;
break;
}
CoordTriplet currentCoord = getWorldLocation();
CoordTriplet bladeCoord = new CoordTriplet(0,0,0);
ForgeDirection[] dirsToCheck = StaticUtils.neighborsBySide[rotorInfo.rotorDirection.ordinal()];
rotorInfo.bladeLengths = new int[rotorInfo.rotorLength][4];
int rotorPosition = 0;
currentCoord.translate(rotorInfo.rotorDirection);
while(rotorPosition < rotorInfo.rotorLength) {
// Current block is a rotor
// Get list of normals
int bladeLength;
ForgeDirection bladeDir;
for(int bladeIdx = 0; bladeIdx < dirsToCheck.length; bladeIdx++) {
bladeDir = dirsToCheck[bladeIdx];
bladeCoord.copy(currentCoord);
bladeCoord.translate(bladeDir);
bladeLength = 0;
while(worldObj.getBlock(bladeCoord.x, bladeCoord.y, bladeCoord.z) == BigReactors.blockTurbineRotorPart && bladeLength < 32) {
bladeLength++;
bladeCoord.translate(bladeDir);
}
rotorInfo.bladeLengths[rotorPosition][bladeIdx] = bladeLength;
}