All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.minecraft.server.AttributeMapServer Maven / Gradle / Ivy

The newest version!
package net.minecraft.server;

import com.google.common.collect.Sets;

import java.util.*;

public class AttributeMapServer extends AttributeMapBase {

  protected final Map d = new InsensitiveStringMap<>();
  private final Set e = Sets.newHashSet();

  public AttributeMapServer() {
  }

  public AttributeModifiable e(IAttribute iattribute) {
    return (AttributeModifiable) super.a(iattribute);
  }

  public AttributeModifiable b(String s) {
    AttributeInstance attributeinstance = super.a(s);

    if (attributeinstance == null) {
      attributeinstance = this.d.get(s);
    }

    return (AttributeModifiable) attributeinstance;
  }

  public AttributeInstance b(IAttribute iattribute) {
    AttributeInstance attributeinstance = super.b(iattribute);

    if (iattribute instanceof AttributeRanged && ((AttributeRanged) iattribute).g() != null) {
      this.d.put(((AttributeRanged) iattribute).g(), attributeinstance);
    }

    return attributeinstance;
  }

  protected AttributeInstance c(IAttribute iattribute) {
    return new AttributeModifiable(this, iattribute);
  }

  public void a(AttributeInstance attributeinstance) {
    if (attributeinstance.getAttribute().c()) {
      this.e.add(attributeinstance);
    }
    for (IAttribute iattribute : this.c.get(attributeinstance.getAttribute())) {
      AttributeModifiable attributemodifiable = this.e(iattribute);
      if (attributemodifiable != null) {
        attributemodifiable.f();
      }
    }
  }

  public Set getAttributes() {
    return this.e;
  }

  public Collection c() {
    HashSet hashset = Sets.newHashSet();
    for (AttributeInstance attributeinstance : this.a()) {
      if (attributeinstance.getAttribute().c()) {
        hashset.add(attributeinstance);
      }
    }
    return hashset;
  }

  public AttributeInstance a(String s) {
    return this.b(s);
  }

  public AttributeInstance a(IAttribute iattribute) {
    return this.e(iattribute);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy