Use enum for AxolotlMeta

This commit is contained in:
Articdive 2021-06-10 09:18:17 +02:00
parent 2976be947b
commit 29bac6fe24
No known key found for this signature in database
GPG Key ID: B069585F0F7D90DE

View File

@ -12,13 +12,12 @@ public class AxolotlMeta extends WaterAnimalMeta {
super(entity, metadata);
}
//todo variant enum
public int getVariant() {
return metadata.getIndex(OFFSET, 0);
public Variant getVariant() {
return Variant.VALUES[super.metadata.getIndex(OFFSET, 0)];
}
public void setVariant(int variant) {
metadata.setIndex(variant, Metadata.VarInt(variant));
public void setVariant(Variant variant) {
metadata.setIndex(OFFSET, Metadata.VarInt(variant.ordinal()));
}
public boolean isPlayingDead() {
@ -36,4 +35,14 @@ public class AxolotlMeta extends WaterAnimalMeta {
public void setFromBucket(boolean fromBucket) {
metadata.setIndex(OFFSET + 2, Metadata.Boolean(fromBucket));
}
public enum Variant {
LUCY,
WILD,
GOLD,
CYAN,
BLUE;
private final static AxolotlMeta.Variant[] VALUES = values();
}
}