public float checkTemps(IInventory inv) {
   float temp = 0;
   float[] temp1 = new float[inv.getSizeInventory()];
   for (int i = 0; i < inv.getSizeInventory(); i++) {
     ItemStack is = inv.getStackInSlot(i);
     if (is != null
         && is.hasTagCompound()
         && !is.getItem().getUnlocalizedName(is).contains("Clay")) {
       if (is.getTagCompound().hasKey("temperature")) {
         temp1[i] = is.getTagCompound().getFloat("temperature");
         if (temp1[i] < TFC_ItemHeat.getMeltingPoint(is)) {
           return (float) -1;
         }
       } else {
         return (float) -1;
       }
     } else if (is == null) {
       temp1[i] = -1;
     }
   }
   int temp2 = 0;
   for (int i = 0; i < inv.getSizeInventory(); i++) {
     if (temp1[i] >= 0) {
       temp += temp1[i];
       temp2++;
     }
   }
   if (temp2 > 0) {
     temp /= temp2;
   }
   return temp;
 }
示例#2
0
  public static void dropItems(World var0, IInventory var1, int var2, int var3, int var4) {
    for (int var5 = 0; var5 < var1.getSize(); ++var5) {
      ItemStack var6 = var1.getItem(var5);

      if (var6 != null && var6.count > 0) {
        dropItems(var0, var1.getItem(var5).cloneItemStack(), var2, var3, var4);
        var1.setItem(var5, null);
      }
    }
  }