Пример #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);
      }
    }
  }
Пример #2
0
 private void smokeBlock(int x, int y, int z) {
   if (worldObj.blockExists(x, y, z) && worldObj.getBlock(x, y, z) == TFCBlocks.smokeRack) {
     TESmokeRack te = (TESmokeRack) worldObj.getTileEntity(x, y, z);
     te.lastSmokedTime = (int) TFC_Time.getTotalHours();
     if (te.getStackInSlot(0) != null) {
       ItemStack is = te.getStackInSlot(0);
       if (Food.getSmokeCounter(is) < Food.SMOKEHOURS)
         Food.setSmokeCounter(is, Food.getSmokeCounter(is) + 1);
       else Food.setFuelProfile(is, EnumFuelMaterial.getFuelProfile(fuelTasteProfile));
     }
     if (te.getStackInSlot(1) != null) {
       ItemStack is = te.getStackInSlot(1);
       if (Food.getSmokeCounter(is) < Food.SMOKEHOURS)
         Food.setSmokeCounter(is, Food.getSmokeCounter(is) + 1);
       else Food.setFuelProfile(is, EnumFuelMaterial.getFuelProfile(fuelTasteProfile));
     }
   }
 }