net.minestom.server.entity.attribute.AttributeOperation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of minestom-snapshots Show documentation
Show all versions of minestom-snapshots Show documentation
1.20.4 Lightweight Minecraft server
package net.minestom.server.entity.attribute;
import net.minestom.server.network.NetworkBuffer;
import net.minestom.server.utils.nbt.BinaryTagSerializer;
import org.jetbrains.annotations.Nullable;
public enum AttributeOperation {
ADD_VALUE(0),
MULTIPLY_BASE(1),
MULTIPLY_TOTAL(2);
public static final NetworkBuffer.Type NETWORK_TYPE = NetworkBuffer.Enum(AttributeOperation.class);
public static final BinaryTagSerializer NBT_TYPE = BinaryTagSerializer.fromEnumStringable(AttributeOperation.class);
private static final AttributeOperation[] VALUES = new AttributeOperation[]{ADD_VALUE, MULTIPLY_BASE, MULTIPLY_TOTAL};
private final int id;
AttributeOperation(int id) {
this.id = id;
}
public int getId() {
return this.id;
}
public static @Nullable AttributeOperation fromId(int id) {
if (id >= 0 && id < VALUES.length) {
return VALUES[id];
}
return null;
}
}