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

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

There is a newer version: 2.4.0
Show newest version
package net.minecraft.server;

import io.netty.util.internal.ThreadLocalRandom;
import org.apache.commons.lang3.Validate;

import java.util.UUID;

public class AttributeModifier {

  private final double a;
  private final int b;
  private final String c;
  private final UUID d;
  private boolean e;

  public AttributeModifier(String s, double d0, int i) {
    this(MathHelper.a(ThreadLocalRandom.current()), s, d0, i);
  }

  public AttributeModifier(UUID uuid, String s, double d0, int i) {
    this.e = true;
    this.d = uuid;
    this.c = s;
    this.a = d0;
    this.b = i;
    Validate.notEmpty(s, "Modifier name cannot be empty");
    Validate.inclusiveBetween(0L, 2L, i, "Invalid operation");
  }

  public UUID a() {
    return this.d;
  }

  public String b() {
    return this.c;
  }

  public int c() {
    return this.b;
  }

  public double d() {
    return this.a;
  }

  public boolean e() {
    return this.e;
  }

  public AttributeModifier a(boolean flag) {
    this.e = flag;
    return this;
  }

  public boolean equals(Object object) {
    if (this == object) {
      return true;
    } else if (object != null && this.getClass() == object.getClass()) {
      AttributeModifier attributemodifier = (AttributeModifier) object;

      if (this.d != null) {
          return this.d.equals(attributemodifier.d);
      } else return attributemodifier.d == null;
    } else {
      return false;
    }
  }

  public int hashCode() {
    return this.d != null ? this.d.hashCode() : 0;
  }

  public String toString() {
    return "AttributeModifier{amount=" + this.a + ", operation=" + this.b + ", name='" + this.c + '\'' + ", id=" + this.d + ", serialize=" + this.e + '}';
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy