MineLittlePony/src/main/java/com/minelittlepony/api/pony/IPonyData.java

90 lines
2.3 KiB
Java
Raw Normal View History

2020-04-03 23:54:12 +02:00
package com.minelittlepony.api.pony;
2016-11-24 02:01:23 -05:00
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.ComparisonChain;
2020-04-03 23:54:12 +02:00
import com.minelittlepony.api.pony.meta.Gender;
import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.api.pony.meta.Size;
import com.minelittlepony.api.pony.meta.TailLength;
import com.minelittlepony.api.pony.meta.Wearable;
2020-04-16 23:35:28 +02:00
import com.minelittlepony.common.util.animation.Interpolator;
import java.util.Arrays;
import java.util.Map;
import java.util.UUID;
2016-11-24 02:01:23 -05:00
/**
* Metadata for a pony.
2016-11-24 02:01:23 -05:00
*/
public interface IPonyData extends Comparable<IPonyData> {
/**
* Gets this pony's race.
*/
2019-03-23 21:49:34 +02:00
Race getRace();
2016-11-24 02:01:23 -05:00
/**
* Gets the length of the pony's tail.
*/
2019-03-23 21:49:34 +02:00
TailLength getTail();
/**
* Get the pony's gender (usually female).
*/
2019-03-23 21:49:34 +02:00
Gender getGender();
/**
* Gets the current pony size.
*/
2019-03-23 21:49:34 +02:00
Size getSize();
/**
* Gets the magical glow colour for magic-casting races. Returns 0 otherwise.
*/
int getGlowColor();
2019-07-24 23:37:22 +02:00
/**
* Returns true if and only if this metadata represents a pony that has a horn.
*/
boolean hasHorn();
/**
* Returns true if and only if this metadata represents a pony that can cast magic.
*/
default boolean hasMagic() {
return hasHorn() && getGlowColor() != 0;
}
/**
* Returns an array of wearables that this pony is carrying.
*/
Wearable[] getGear();
/**
* Checks it this pony is wearing the given accessory.
*/
2019-03-23 21:49:34 +02:00
boolean isWearing(Wearable wearable);
/**
* Gets an interpolator for interpolating values.
*/
2020-04-16 23:35:28 +02:00
Interpolator getInterpolator(UUID interpolatorId);
/**
* Gets the trigger pixel values as they appeared in the underlying image.
*/
Map<String, TriggerPixelType<?>> getTriggerPixels();
@Override
default int compareTo(@Nullable IPonyData o) {
return o == this ? 0 : o == null ? 1 : ComparisonChain.start()
.compare(getRace(), o.getRace())
.compare(getTail(), o.getTail())
.compare(getGender(), o.getGender())
.compare(getSize().ordinal(), o.getSize().ordinal())
.compare(getGlowColor(), o.getGlowColor())
.compare(0, Arrays.compare(getGear(), o.getGear()))
.result();
}
2016-11-24 02:01:23 -05:00
}