Beispiel #1
0
  public Attributes(ItemStack stack) {
    // Create a CraftItemStack (under the hood)
    this.stack = NbtFactory.getCraftItemStack(stack);

    // Load NBT
    NbtCompound nbt = NbtFactory.fromItemTag(this.stack);
    this.attributes = nbt.getList("AttributeModifiers", true);
  }
Beispiel #2
0
 public void setUUID(@Nonnull UUID id) {
   Preconditions.checkNotNull("id", "id cannot be NULL.");
   data.put("UUIDLeast", id.getLeastSignificantBits());
   data.put("UUIDMost", id.getMostSignificantBits());
 }
Beispiel #3
0
 public void setName(@Nonnull String name) {
   Preconditions.checkNotNull(name, "name cannot be NULL.");
   data.put("Name", name);
 }
Beispiel #4
0
 public UUID getUUID() {
   return new UUID(data.getLong("UUIDMost", null), data.getLong("UUIDLeast", null));
 }
Beispiel #5
0
 public void setAttributeType(@Nonnull AttributeType type) {
   Preconditions.checkNotNull(type, "type cannot be NULL.");
   data.put("AttributeName", type.getMinecraftId());
 }
Beispiel #6
0
 public String getName() {
   return data.getString("Name", null);
 }
Beispiel #7
0
 public AttributeType getAttributeType() {
   return AttributeType.fromId(data.getString("AttributeName", null));
 }
Beispiel #8
0
 public void setOperation(@Nonnull Operation operation) {
   Preconditions.checkNotNull(operation, "operation cannot be NULL.");
   data.put("Operation", operation.getId());
 }
Beispiel #9
0
 public Operation getOperation() {
   return Operation.fromId(data.getInteger("Operation", 0));
 }
Beispiel #10
0
 public void setAmount(double amount) {
   data.put("Amount", amount);
 }
Beispiel #11
0
 public double getAmount() {
   return data.getDouble("Amount", 0.0);
 }