Package erogenousbeef.core.common

Examples of erogenousbeef.core.common.CoordTriplet


      if(settingTag.hasKey("x")) {
        int x, y, z;
        x = settingTag.getInteger("x");
        y = settingTag.getInteger("y");
        z = settingTag.getInteger("z");
        coordMappings[channel] = new CoordTriplet(x, y, z);
      }
    }
  }
View Full Code Here


      if(CircuitType.canBeToggledBetweenPulseAndNormal(newType)) {
        inputActivatesOnPulse[channelID] = changes[i].getPulseOrToggle();
      }
     
      if(CircuitType.hasCoordinate(newType)) {
        CoordTriplet coord = changes[i].getCoord();
       
        // Validate that we're pointing at the right thing, just in case.
        if(coord != null) {
          TileEntity te = worldObj.getTileEntity(coord.x, coord.y, coord.z);
          if(!(te instanceof TileEntityReactorControlRod)) {
View Full Code Here

      return new Object[] { turbine.getRotorMass() };
    case getInductorEngaged:
      return new Object[] { turbine.getInductorEngaged() };
    case getMinimumCoordinate:
    {
      CoordTriplet coord = turbine.getMinimumCoord();
      return new Object[] { coord.x, coord.y, coord.z };
    }
     
    case getMaximumCoordinate:
    {
      CoordTriplet coord = turbine.getMaximumCoord();
      return new Object[] { coord.x, coord.y, coord.z };
    }

    case setActive:
      if(arguments.length < 1) {
View Full Code Here

    int list = GLAllocation.generateDisplayLists(1);
    GL11.glNewList(list,  GL11.GL_COMPILE);

    ForgeDirection rotorDir = rotorInfo.rotorDirection;
    int rotorLen = rotorInfo.rotorLength;
    CoordTriplet currentRotorCoord = new CoordTriplet(0,0,0);

    Tessellator tessellator = Tessellator.instance;
    if(rotorDir.offsetX != 0) {
      tessellator.setTranslation(0, -0.5, -0.5);
    }
    else if(rotorDir.offsetY != 0) {
      tessellator.setTranslation(-0.5, 0, -0.5);
    }
    else {
      tessellator.setTranslation(-0.5, -0.5, 0);
    }

    tessellator.startDrawingQuads();
    tessellator.setBrightness(256);
    tessellator.setColorOpaque(255, 255, 255);
   
    CoordTriplet bladeCoord = new CoordTriplet(0,0,0);
    int rotorIdx = 0;
    boolean[] hasBlades = new boolean[4];
    ForgeDirection[] bladeDirs = StaticUtils.neighborsBySide[rotorInfo.rotorDirection.ordinal()];

    while(rotorIdx < rotorInfo.rotorLength) {
     
      for(int i = 0; i < hasBlades.length; i++) {
        hasBlades[i] = rotorInfo.bladeLengths[rotorIdx][i] > 0;
      }

      RotorSimpleRenderer.renderRotorShaft(BigReactors.blockTurbineRotorPart, renderBlocks, BlockTurbineRotorPart.METADATA_SHAFT, rotorDir, hasBlades, currentRotorCoord.x, currentRotorCoord.y, currentRotorCoord.z, false);
      for(int bladeIdx = 0; bladeIdx < bladeDirs.length; bladeIdx++) {
        bladeCoord.copy(currentRotorCoord);
        int bladeLen = 0;
        bladeCoord.translate(bladeDirs[bladeIdx]);
        while(bladeLen < rotorInfo.bladeLengths[rotorIdx][bladeIdx]) {
          RotorSimpleRenderer.renderBlade(renderBlocks, bladeCoord.x, bladeCoord.y, bladeCoord.z, BigReactors.blockTurbineRotorPart, BlockTurbineRotorPart.METADATA_BLADE, rotorInfo.rotorDirection);
          bladeLen++;
          bladeCoord.translate(bladeDirs[bladeIdx]);
        }
      }
      rotorIdx++;
      currentRotorCoord.translate(rotorDir);
    }
View Full Code Here

  }
 
  private IIcon getCasingEdgeIcon(TileEntityReactorPart part, MultiblockReactor reactor, int side) {
    if(reactor == null || !reactor.isAssembled()) { return _icons[METADATA_CASING][DEFAULT]; }

    CoordTriplet minCoord = reactor.getMinimumCoord();
    CoordTriplet maxCoord = reactor.getMaximumCoord();

    boolean xExtreme, yExtreme, zExtreme;
    xExtreme = yExtreme = zExtreme = false;

    if(part.xCoord == minCoord.x || part.xCoord == maxCoord.x) { xExtreme = true; }
View Full Code Here

    // Rotor bearing must calculate outwards dir, as this is normally only calculated in onMachineAssembled().
    rotorPart.recalculateOutwardsDirection(getMinimumCoord(), getMaximumCoord());
   
    // Find out which way the rotor runs. Obv, this is inwards from the bearing.
    ForgeDirection rotorDir = rotorPart.getOutwardsDir().getOpposite();
    CoordTriplet rotorCoord = rotorPart.getWorldLocation();
   
    CoordTriplet minRotorCoord = getMinimumCoord();
    CoordTriplet maxRotorCoord = getMaximumCoord();
   
    // Constrain min/max rotor coords to where the rotor bearing is and the block opposite it
    if(rotorDir.offsetX == 0) {
      minRotorCoord.x = maxRotorCoord.x = rotorCoord.x;
    }
    if(rotorDir.offsetY == 0) {
      minRotorCoord.y = maxRotorCoord.y = rotorCoord.y;
    }
    if(rotorDir.offsetZ == 0) {
      minRotorCoord.z = maxRotorCoord.z = rotorCoord.z;
    }

    // Figure out where the rotor ends and which directions are normal to the rotor's 4 faces (this is where blades emit from)
    CoordTriplet endRotorCoord = rotorCoord.equals(minRotorCoord) ? maxRotorCoord : minRotorCoord;
    endRotorCoord.translate(rotorDir.getOpposite());

    ForgeDirection[] bladeDirections;
    if(rotorDir.offsetY != 0) {
      bladeDirections = StaticUtils.CardinalDirections;
    }
    else if(rotorDir.offsetX != 0) {
      bladeDirections = RotorXBladeDirections;
    }
    else {
      bladeDirections = RotorZBladeDirections;
    }

    Set<CoordTriplet> rotorShafts = new HashSet<CoordTriplet>(attachedRotorShafts.size());
    Set<CoordTriplet> rotorBlades = new HashSet<CoordTriplet>(attachedRotorBlades.size());
   
    for(TileEntityTurbineRotorPart part : attachedRotorShafts) {
      rotorShafts.add(part.getWorldLocation());
    }

    for(TileEntityTurbineRotorPart part : attachedRotorBlades) {
      rotorBlades.add(part.getWorldLocation());
    }
   
    // Move along the length of the rotor, 1 block at a time
    boolean encounteredCoils = false;
    while(!rotorShafts.isEmpty() && !rotorCoord.equals(endRotorCoord)) {
      rotorCoord.translate(rotorDir);
     
      // Ensure we find a rotor block along the length of the entire rotor
      if(!rotorShafts.remove(rotorCoord)) {
        throw new MultiblockValidationException(String.format("%s - This block must contain a rotor. The rotor must begin at the bearing and run the entire length of the turbine", rotorCoord));
      }
     
      // Now move out in the 4 rotor normals, looking for blades and coils
      CoordTriplet checkCoord = rotorCoord.copy();
      boolean encounteredBlades = false;
      for(ForgeDirection bladeDir : bladeDirections) {
        checkCoord.copy(rotorCoord);
        boolean foundABlade = false;
        checkCoord.translate(bladeDir);
       
        // If we find 1 blade, we can keep moving along the normal to find more blades
        while(rotorBlades.remove(checkCoord)) {
          // We found a coil already?! NOT ALLOWED.
          if(encounteredCoils) {
            throw new MultiblockValidationException(String.format("%s - Rotor blades must be placed closer to the rotor bearing than all other parts inside a turbine", checkCoord));
          }
          foundABlade = encounteredBlades = true;
          checkCoord.translate(bladeDir);
        }

        // If this block wasn't a blade, check to see if it was a coil
        if(!foundABlade) {
          if(foundCoils.remove(checkCoord)) {
            encounteredCoils = true;

            // We cannot have blades and coils intermix. This prevents intermixing, depending on eval order.
            if(encounteredBlades) {
              throw new MultiblockValidationException(String.format("%s - Metal blocks must by placed further from the rotor bearing than all rotor blades", checkCoord));
            }
           
            // Check the two coil spots in the 'corners', which are permitted if they're connected to the main rotor coil somehow
            CoordTriplet coilCheck = checkCoord.copy();
            coilCheck.translate(bladeDir.getRotation(rotorDir));
            foundCoils.remove(coilCheck);
            coilCheck.copy(checkCoord);
            coilCheck.translate(bladeDir.getRotation(rotorDir.getOpposite()));
            foundCoils.remove(coilCheck);
          }
          // Else: It must have been air.
        }
      }
View Full Code Here

    Block block = world.getBlock(x, y, z);
    int metadata = world.getBlockMetadata(x,y,z);

    // Coil windings below here:
    if(getCoilPartData(x, y, z, block, metadata) != null) {
      foundCoils.add(new CoordTriplet(x,y,z));
      return;
    }

    // Everything else, gtfo
    throw new MultiblockValidationException(String.format("%d, %d, %d is invalid for a turbine interior. Only rotor parts, metal blocks and empty space are allowed.", x, y, z));
View Full Code Here

      for(IMultiblockPart part : connectedParts) {
        if(this.active) { part.onMachineActivated(); }
        else { part.onMachineDeactivated(); }
      }
     
      CoordTriplet referenceCoord = getReferenceCoord();
      worldObj.markBlockForUpdate(referenceCoord.x, referenceCoord.y, referenceCoord.z);

      markReferenceCoordDirty();
    }
   
View Full Code Here

 
  /**
   * Recalculate rotor and coil parameters
   */
  private void recalculateDerivedStatistics() {
    CoordTriplet minInterior, maxInterior;
    minInterior = getMinimumCoord();
    maxInterior = getMaximumCoord();
    minInterior.x++; minInterior.y++; minInterior.z++;
    maxInterior.x++; maxInterior.y++; maxInterior.z++;
   
View Full Code Here

  }

  protected void markReferenceCoordDirty() {
    if(worldObj == null || worldObj.isRemote) { return; }

    CoordTriplet referenceCoord = getReferenceCoord();
    if(referenceCoord == null) { return; }

    rpmUpdateTracker.onExternalUpdate();
   
    TileEntity saveTe = worldObj.getTileEntity(referenceCoord.x, referenceCoord.y, referenceCoord.z);
View Full Code Here

TOP

Related Classes of erogenousbeef.core.common.CoordTriplet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.