Пример #1
0
  @Override
  public void careForInventorySlot(ItemStack is) {
    if (is != null) {
      HeatRegistry manager = HeatRegistry.getInstance();
      HeatIndex index = manager.findMatchingIndex(is);

      if (index != null) {
        float temp = TFC_ItemHeat.getTemp(is);
        if (fuelTimeLeft > 0 && is.getItem() instanceof ICookableFood) {
          float inc = Food.getCooked(is) + Math.min(fireTemp / 700, 2f);
          Food.setCooked(is, inc);
          temp = inc;
          if (Food.isCooked(is)) {
            int[] cookedTasteProfile = new int[] {0, 0, 0, 0, 0};
            Random r =
                new Random(
                    ((ICookableFood) is.getItem()).getFoodID()
                        + (((int) Food.getCooked(is) - 600) / 120));
            cookedTasteProfile[0] = r.nextInt(31) - 15;
            cookedTasteProfile[1] = r.nextInt(31) - 15;
            cookedTasteProfile[2] = r.nextInt(31) - 15;
            cookedTasteProfile[3] = r.nextInt(31) - 15;
            cookedTasteProfile[4] = r.nextInt(31) - 15;
            Food.setCookedProfile(is, cookedTasteProfile);
            Food.setFuelProfile(is, EnumFuelMaterial.getFuelProfile(fuelTasteProfile));
          }
        } else if (fireTemp > temp && index.hasOutput()) {
          temp += TFC_ItemHeat.getTempIncrease(is);
        } else temp -= TFC_ItemHeat.getTempDecrease(is);
        TFC_ItemHeat.setTemp(is, temp);
      }
    }
  }