コード例 #1
0
  /** Executes the enchantment modifier on the ItemStack passed. */
  private static void applyEnchantmentModifier(
      IEnchantmentModifier par0IEnchantmentModifier, ItemStack par1ItemStack) {
    if (par1ItemStack != null) {
      NBTTagList var2 = par1ItemStack.getEnchantmentTagList();

      if (var2 != null) {
        for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
          short var4 = ((NBTTagCompound) var2.tagAt(var3)).getShort("id");
          short var5 = ((NBTTagCompound) var2.tagAt(var3)).getShort("lvl");

          if (Enchantment.enchantmentsList[var4] != null) {
            par0IEnchantmentModifier.calculateModifier(Enchantment.enchantmentsList[var4], var5);
          }
        }
      }
    }
  }
コード例 #2
0
  /** Executes the enchantment modifier on the ItemStack passed. */
  private static void applyEnchantmentModifier(
      IEnchantmentModifier par0IEnchantmentModifier, ItemStack par1ItemStack) {
    if (par1ItemStack != null) {
      NBTTagList nbttaglist = par1ItemStack.getEnchantmentTagList();

      if (nbttaglist != null) {
        for (int i = 0; i < nbttaglist.tagCount(); ++i) {
          short short1 = ((NBTTagCompound) nbttaglist.tagAt(i)).getShort("id");
          short short2 = ((NBTTagCompound) nbttaglist.tagAt(i)).getShort("lvl");

          if (Enchantment.enchantmentsList[short1] != null) {
            par0IEnchantmentModifier.calculateModifier(
                Enchantment.enchantmentsList[short1], short2);
          }
        }
      }
    }
  }