示例#1
0
  @Override
  public void updateEntity() {
    super.updateEntity();

    if (worldObj.isRemote) {
      return;
    }

    if (heat > 1500) {
      if (inv[0] != null
          && inv[0].itemID == BaconItems.rawBacon.itemID
          && lava.getCapacity() - 100 >= lava.getFluidAmount()) {
        progress++;
        if (progress > 100) {
          progress = 0;
          lava.fill(new FluidStack(BaconItems.liquidBacon, 100), true);
        }
      }
    }
    pushFluidOut();

    if (worldObj.isRemote) // || worldObj.getWorldTime() % 20 != 0)
    {
      return;
    }

    int HottestHeat = 20;
    for (int i = 0; i < 6; i++) {
      TileEntity tile = BaconWorld.getTileEntity(worldObj, xCoord, yCoord, zCoord, i);
      if (tile != null && tile instanceof Heater) {
        Heater heat = (Heater) tile;
        HottestHeat = Math.max(HottestHeat, heat.getHeat());
      }
    }

    if (HottestHeat > heat) {
      heat++;
    } else if (HottestHeat == heat) {
    } else {
      heat--;
    }
  }
示例#2
0
 public void run() {
   for (int i = 0; i < 100; ++i) {
     if (cooler.isEnabled()) {
       currentTemperatur -= Math.random() * 3.0d;
     } else if (heater.isEnabled()) {
       currentTemperatur += Math.random() * 3.0d;
     } else {
       currentTemperatur += 1.0d;
     }
     System.out.println("Temp is now: " + currentTemperatur);
     eventDispatcher.fireBlocked(new TemperatureChangeEvent(this, currentTemperatur));
     try {
       Thread.sleep(200);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
 }