コード例 #1
0
  /**
   * Gets the attribute modifiers for this ItemStack.nWill check for an NBT tag list containing
   * modifiers for the stack.
   */
  public Multimap getAttributeModifiers() {
    Object object;

    if (this.hasTagCompound() && this.stackTagCompound.hasKey("AttributeModifiers", 9)) {
      object = HashMultimap.create();
      NBTTagList nbttaglist = this.stackTagCompound.getTagList("AttributeModifiers", 10);

      for (int i = 0; i < nbttaglist.tagCount(); ++i) {
        NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
        AttributeModifier attributemodifier =
            SharedMonsterAttributes.readAttributeModifierFromNBT(nbttagcompound);

        if (attributemodifier.getID().getLeastSignificantBits() != 0L
            && attributemodifier.getID().getMostSignificantBits() != 0L) {
          ((Multimap) object).put(nbttagcompound.getString("AttributeName"), attributemodifier);
        }
      }
    } else {
      object = this.getItem().getAttributeModifiers(this);
    }

    return (Multimap) object;
  }
コード例 #2
0
ファイル: ItemStack.java プロジェクト: ppypp/CanaryMod
  public Multimap B() {
    Object object;

    if (this.n() && this.e.b("AttributeModifiers", 9)) {
      object = HashMultimap.create();
      NBTTagList nbttaglist = this.e.c("AttributeModifiers", 10);

      for (int i0 = 0; i0 < nbttaglist.c(); ++i0) {
        NBTTagCompound nbttagcompound = nbttaglist.b(i0);
        AttributeModifier attributemodifier = SharedMonsterAttributes.a(nbttagcompound);

        if (attributemodifier != null
            && attributemodifier.a().getLeastSignificantBits() != 0L
            && attributemodifier.a().getMostSignificantBits() != 0L) {
          ((Multimap) object).put(nbttagcompound.j("AttributeName"), attributemodifier);
        }
      }
    } else {
      object = this.b().i();
    }

    return (Multimap) object;
  }