示例#1
0
 @Override
 public void updateEntity() {
   TFC_ItemHeat.HandleContainerHeat(this.worldObj, storage, xCoord, yCoord, zCoord);
 }
 public void updateEntity() {
   TFC_ItemHeat.HandleContainerHeat(
       this.worldObj, storage, (int) xCoord, (int) yCoord, (int) zCoord);
 }
示例#3
0
  @Override
  public void updateEntity() {
    if (!worldObj.isRemote) {
      // Here we take care of the items that we are cooking in the fire
      careForInventorySlot(0, 40);
      careForInventorySlot(1, 40);
      careForInventorySlot(2, 40);
      careForInventorySlot(3, 40);
      careForInventorySlot(4, 40);

      ItemStack[] FuelStack = new ItemStack[9];
      FuelStack[0] = fireItemStacks[5];
      FuelStack[1] = fireItemStacks[6];
      FuelStack[2] = fireItemStacks[7];
      FuelStack[3] = fireItemStacks[8];
      FuelStack[4] = fireItemStacks[9];
      FuelStack[5] = fireItemStacks[10];
      FuelStack[6] = fireItemStacks[11];
      FuelStack[7] = fireItemStacks[12];
      FuelStack[8] = fireItemStacks[13];

      TFC_ItemHeat.HandleContainerHeat(this.worldObj, FuelStack, xCoord, yCoord, zCoord);

      // Now we cook the input item
      CookItemsNew(0);
      CookItemsNew(1);
      CookItemsNew(2);
      CookItemsNew(3);
      CookItemsNew(4);

      // push the input fuel down the stack
      HandleFuelStack();

      if (ambientTemp == -1000) {
        TFCBiome biome = (TFCBiome) worldObj.getBiomeGenForCoords(xCoord, zCoord);
        ambientTemp = biome.getHeightAdjustedTemperature(yCoord);
      }
      // here we set the various temperatures to range
      this.keepTempToRange();

      // Play the fire sound
      Random R = new Random();
      if (R.nextInt(10) == 0 && fireTemperature > 210) {
        worldObj.playSoundEffect(
            xCoord, yCoord, zCoord, "fire.fire", 0.4F + (R.nextFloat() / 2), 0.7F + R.nextFloat());
      }

      if (fireTemperature >= 100 && worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != 1) {
        worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3);
      } else if (fireTemperature < 100 && worldObj.getBlockMetadata(xCoord, yCoord, zCoord) != 0) {
        worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 3);
      }

      // If the fire is still burning and has fuel
      if (fuelTimeLeft > 0
          && fireTemperature >= 210
          && (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) || !worldObj.isRaining())) {
        float desiredTemp = handleTemp();

        handleTempFlux(desiredTemp);
      } else if (fuelTimeLeft <= 0
          && fireTemperature >= 210
          && fireItemStacks[7] != null
          && (!worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord) || !worldObj.isRaining())) {
        // here we set the temp and burn time based on the fuel in the bottom slot.
        if (fireItemStacks[7] != null) {
          if (fireItemStacks[7].itemID == Item.coal.itemID
              && fireItemStacks[7].getItemDamage() == 0) {
            fuelTimeLeft = 1100;
            fuelBurnTemp = 1400;
          }
          if (fireItemStacks[7].itemID == Item.coal.itemID
              && fireItemStacks[7].getItemDamage() == 1) {
            fuelTimeLeft = 900;
            fuelBurnTemp = 1350;
          }
          fireItemStacks[7] = null;
        }
      }
      // If there is no more fuel and the fire is still hot, we start to cool it off.
      if (fuelTimeLeft <= 0 && fireTemperature > ambientTemp
          || (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord, zCoord))) {
        if (airFromBellows == 0) {
          fireTemperature -= 0.125F;
        } else {
          fireTemperature -= 0.1F;
        }
      }

      // Here we handle the bellows
      if (airFromBellowsTime > 0) {
        airFromBellowsTime--;
        airFromBellows = airFromBellowsTime / 120 * 10;
      }

      // Here we make sure that the forge is valid
      isValid = CheckValidity();

      // do a last minute check to verify stack size
      for (int c = 0; c < 5; c++) {
        if (fireItemStacks[c] != null) {
          if (fireItemStacks[c].stackSize <= 0) {
            fireItemStacks[c].stackSize = 1;
          }
        }
      }
    }
  }