Package erogenousbeef.bigreactors.common.multiblock

Examples of erogenousbeef.bigreactors.common.multiblock.MultiblockTurbine


    TileEntity te = blockAccess.getTileEntity(x, y, z);
    int metadata = blockAccess.getBlockMetadata(x,y,z);

    if(te instanceof TileEntityTurbinePartBase) {
      TileEntityTurbinePartBase part = (TileEntityTurbinePartBase)te;
      MultiblockTurbine turbine = part.getTurbine();
     
      if(metadata == METADATA_FLUIDPORT) {
        if(te instanceof TileEntityTurbineFluidPort) {
          if(turbine == null || !turbine.isAssembled() || part.getOutwardsDir().ordinal() == side)
          {
            if(((TileEntityTurbineFluidPort)te).getFlowDirection() == FluidFlow.Out)
              return _subIcons[SUBICON_FLUIDPORT_OUTPUT];
            else
              return _icons[METADATA_FLUIDPORT];
          }
          else if(turbine.isAssembled() && part.getOutwardsDir().ordinal() != side)
            return _subIcons[SUBICON_HOUSING_FACE];
        }
        return getIcon(side, metadata);
      }
      else if(!part.isConnected() || turbine == null || !turbine.isAssembled()) {
        return getIcon(side, metadata);
      }
      else {
        int subIcon = SUBICON_NONE;
        if(metadata == METADATA_HOUSING) {
          subIcon = getSubIconForHousing(blockAccess, x, y, z, turbine, side);
        }
        else if(part.getOutwardsDir().ordinal() == side) {
          // Only put the fancy icon on one side of the machine. Other parts will use the base.
          if(metadata == METADATA_CONTROLLER) {
            if(turbine.getActive()) {
              subIcon = SUBICON_CONTROLLER_ACTIVE;
            }
            else {
              subIcon = SUBICON_CONTROLLER_IDLE;
            }
View Full Code Here


      if(metadata == METADATA_BEARING) {
          TileEntity te = world.getTileEntity(x, y, z);
        if(te instanceof TileEntityTurbinePartStandard) {
          // Rotor bearing found!
          TileEntityTurbinePartStandard bearing = (TileEntityTurbinePartStandard)te;
          MultiblockTurbine turbine = bearing.getTurbine();
          if(turbine != null && turbine.getActive()) {
            // Spawn particles!
            int numParticles = Math.min(20, Math.max(1, turbine.getFluidConsumedLastTick() / 40));
            ForgeDirection inwardsDir = bearing.getOutwardsDir().getOpposite();
            CoordTriplet minCoord, maxCoord;
            minCoord = turbine.getMinimumCoord();
            maxCoord = turbine.getMaximumCoord();
            minCoord.x++; minCoord.y++; minCoord.z++;
            maxCoord.x--; maxCoord.y--; maxCoord.z--;
            if(inwardsDir.offsetX != 0) {
              minCoord.x = maxCoord.x = bearing.xCoord + inwardsDir.offsetX;
            }
View Full Code Here

 
  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
View Full Code Here

    if(!this.isConnected()) {
      throw new Exception("Unable to access turbine - port is not connected");
    }

    ComputerMethod computerMethod = ComputerMethod.values()[method];
    MultiblockTurbine turbine = getTurbine();
    FluidTankInfo ti;

    switch(computerMethod) {
    case getConnected:
      return new Object[] { isConnected() };
    case getActive:
      return new Object[] { turbine.getActive() };
    case getEnergyProducedLastTick:
      return new Object[] { turbine.getEnergyGeneratedLastTick() };
    case getEnergyStored:
      return new Object[] { turbine.getEnergyStored() };
    case getFluidAmountMax:
      return new Object[] { MultiblockTurbine.TANK_SIZE };
    case getFluidFlowRate:
      return new Object[] { turbine.getFluidConsumedLastTick() };
    case getFluidFlowRateMax:
      return new Object[] { turbine.getMaxIntakeRate() };
    case getFluidFlowRateMaxMax:
      return new Object[] { turbine.getMaxIntakeRateMax() };
    case getInputAmount:
      ti = turbine.getTankInfo(MultiblockTurbine.TANK_INPUT);
      if(ti != null && ti.fluid != null) {
        return new Object[] { ti.fluid.amount };
      }
      else {
        return new Object[] { 0f };
      }
    case getInputType:
      ti = turbine.getTankInfo(MultiblockTurbine.TANK_INPUT);
      if(ti != null && ti.fluid != null) {
        return new Object[] { ti.fluid.getFluid().getName() };
      }
      else {
        return null;
      }
    case getOutputAmount:
      ti = turbine.getTankInfo(MultiblockTurbine.TANK_OUTPUT);
      if(ti != null && ti.fluid != null) {
        return new Object[] { ti.fluid.amount };
      }
      else {
        return new Object[] { 0f };
      }
    case getOutputType:
      ti = turbine.getTankInfo(MultiblockTurbine.TANK_OUTPUT);
      if(ti != null && ti.fluid != null) {
        return new Object[] { ti.fluid.getFluid().getName() };
      }
      else {
        return null;
      }
    case getRotorSpeed:
      return new Object[] { turbine.getRotorSpeed() };
    case getNumberOfBlades:
      return new Object[] { turbine.getNumRotorBlades() };
    case getBladeEfficiency:
      return new Object[] { turbine.getRotorEfficiencyLastTick() * 100f };
    case getRotorMass:
      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) {
        throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
      }
      if(!(arguments[0] instanceof Boolean)) {
        throw new IllegalArgumentException("Invalid argument 0, expected Boolean");
      }
      turbine.setActive((Boolean)arguments[0]);
      break;
    case setFluidFlowRateMax:
      if(arguments.length < 1) {
        throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
      }
      if(!(arguments[0] instanceof Double)) {
        throw new IllegalArgumentException("Invalid argument 0, expected Number");
      }
      int newRate = (int)Math.round((Double)arguments[0]);
      turbine.setMaxIntakeRate(newRate);
      break;
    case setVentNone:
      turbine.setVentStatus(VentStatus.DoNotVent, true);
      break;
    case setVentOverflow:
      turbine.setVentStatus(VentStatus.VentOverflow, true);
      break;
    case setVentAll:
      turbine.setVentStatus(VentStatus.VentAll, true);
      break;
    case setInductorEngaged:
      if(arguments.length < 1) {
        throw new IllegalArgumentException("Insufficient number of arguments, expected 1");
      }
      if(!(arguments[0] instanceof Boolean)) {
        throw new IllegalArgumentException("Invalid argument 0, expected Boolean");
      }
      turbine.setInductorEngaged((Boolean)arguments[0], true);
      break;
    default:
      throw new Exception("Method unimplemented - yell at Beef");
    }
   
View Full Code Here

  public void onMultiblockServerTick() {
    // Try to pump steam out, if an outlet
    if(pumpDestination == null || flowSetting != FluidFlow.Out)
      return;

    MultiblockTurbine turbine = getTurbine();
    FluidStack fluidToDrain = turbine.drain(MultiblockTurbine.TANK_OUTPUT, turbine.TANK_SIZE, false);
   
    if(fluidToDrain != null && fluidToDrain.amount > 0)
    {
      fluidToDrain.amount = pumpDestination.fill(getOutwardsDir().getOpposite(), fluidToDrain, true);
      turbine.drain(MultiblockTurbine.TANK_OUTPUT, fluidToDrain, true);
    }
  }
View Full Code Here

    protected abstract IMessage handleMessage(M message, MessageContext ctx, MultiblockTurbine turbine);

    @Override
    protected IMessage handleMessage(M message, MessageContext ctx, TileEntity te) {
      if(te instanceof TileEntityTurbinePartBase) {
        MultiblockTurbine reactor = ((TileEntityTurbinePartBase)te).getTurbine();
        if(reactor != null) {
          return handleMessage(message, ctx, reactor);
        }
        else {
          BRLog.error("Received TurbineMessageClient for a turbine part @ %d, %d, %d which has no attached turbine", te.xCoord, te.yCoord, te.zCoord);
View Full Code Here

    protected abstract IMessage handleMessage(M message, MessageContext ctx, MultiblockTurbine turbine);

    @Override
    protected IMessage handleMessage(M message, MessageContext ctx, TileEntity te) {
      if(te instanceof TileEntityTurbinePartBase) {
        MultiblockTurbine reactor = ((TileEntityTurbinePartBase)te).getTurbine();
        if(reactor != null) {
          return handleMessage(message, ctx, reactor);
        }
        else {
          BRLog.error("Received TurbineMessageServer for a turbine part @ %d, %d, %d which has no attached turbine", te.xCoord, te.yCoord, te.zCoord);
View Full Code Here

      double z, float f) {
    TileEntityTurbineRotorBearing bearing = (TileEntityTurbineRotorBearing)tileentity;
   
    if(bearing == null || !bearing.isConnected()) { return; }
   
    MultiblockTurbine turbine = bearing.getTurbine();
   
    if(!turbine.isAssembled() || !turbine.getActive() || !turbine.hasGlass()) { return; }
   
    Integer displayList = bearing.getDisplayList();
    ForgeDirection rotorDir = bearing.getOutwardsDir().getOpposite();
   
    if(displayList == null) {
      RotorInfo info = bearing.getRotorInfo();
      displayList = generateRotor(info);
      bearing.setDisplayList(displayList);
    }
   
    float angle = bearing.getAngle();
    long elapsedTime = Minecraft.getSystemTime() - ClientProxy.lastRenderTime;
   
    float speed = turbine.getRotorSpeed();
    if(speed > 0.001f) {
      angle += speed * ((float)elapsedTime / 60000f) * 360f; // RPM * time in minutes * 360 degrees per rotation
      angle = angle % 360f;
      bearing.setAngle(angle);
    }
View Full Code Here

  public TileEntityTurbinePartBase() {
  }
 
  @Override
  public MultiblockControllerBase createNewMultiblock() {
    return new MultiblockTurbine(worldObj);
  }
View Full Code Here

    }
  }
 
  @Override
  public String getDebugInfo() {
    MultiblockTurbine t = getTurbine();
    StringBuilder sb = new StringBuilder();
    sb.append(getClass().toString()).append("\n");
    if(t == null) {
      sb.append("Not attached to controller!");
      return sb.toString();
    }
    sb.append(t.getDebugInfo());
    return sb.toString();
  }
View Full Code Here

TOP

Related Classes of erogenousbeef.bigreactors.common.multiblock.MultiblockTurbine

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.