Exemplo n.º 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);
      }
    }
  }
Exemplo n.º 2
0
  public static final String getItemKey(ItemStack itemStack) {
    Item item = itemStack.getItem();
    String key =
        String.valueOf(Item.getIdFromItem(item)) + ":" + String.valueOf(itemStack.getItemDamage());

    if (!(item instanceof IFood)) return key;

    key +=
        ":"
            + (Food.isBrined(itemStack) ? "1" : "0")
            + (Food.isPickled(itemStack) ? "1" : "0")
            + (Food.isCooked(itemStack) ? "1" : "0")
            + (Food.isDried(itemStack) ? "1" : "0")
            + (Food.isSmoked(itemStack) ? "1" : "0")
            + (Food.isSalted(itemStack) ? "1" : "0");

    return key;
  }