Fixed trigger pixels being interpreted encorrectly

This commit is contained in:
Sollace 2019-05-29 12:27:57 +02:00
parent 7dda33dddc
commit b39f8f9a32
6 changed files with 41 additions and 37 deletions

View file

@ -22,8 +22,11 @@ public interface ITriggerPixelMapped<T extends Enum<T> & ITriggerPixelMapped<T>>
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static <T extends Enum<T> & ITriggerPixelMapped<T>> T getByTriggerPixel(T type, int pixelValue) { static <T extends Enum<T> & ITriggerPixelMapped<T>> T getByTriggerPixel(T type, int pixelValue) {
for (T i : (T[])type.getClass().getEnumConstants()) { for (T i : (T[])type.getClass().getEnumConstants()) {
if (i.getTriggerPixel() == pixelValue) return i; if (i.getTriggerPixel() == pixelValue) {
return i;
}
} }
return type; return type;
} }
} }

View file

@ -8,18 +8,18 @@ import javax.annotation.Nonnull;
public enum Race implements ITriggerPixelMapped<Race> { public enum Race implements ITriggerPixelMapped<Race> {
HUMAN(0, false, false), HUMAN (0x000000, false, false),
EARTH(0xf9b131, false, false), EARTH (0x31b1f9, false, false),
PEGASUS(0x88caf0, true, false), PEGASUS (0xf0ca88, true, false),
UNICORN(0xd19fe4, false, true), UNICORN (0xe49fd1, false, true),
ALICORN(0xfef9fc, true, true), ALICORN (0xfcf9fe, true, true),
CHANGELING(0x282b29, true, true), CHANGELING (0x292b28, true, true),
ZEBRA(0xd0cccf, false, false), ZEBRA (0xcfccd0, false, false),
REFORMED_CHANGELING(0xcaed5a, CHANGELING), CHANGEDLING (0x5aedca, CHANGELING),
GRIFFIN(0xae9145, PEGASUS), GRIFFIN (0x4591ae, PEGASUS),
HIPPOGRIFF(0xd6ddac, PEGASUS), HIPPOGRIFF (0xacddd6, PEGASUS),
BATPONY(0xeeeeee, true, false), BATPONY (0xeeeeee, true, false),
SEAPONY(0x3655dd, false, true); SEAPONY (0xdd5536, false, true);
private boolean wings; private boolean wings;
private boolean horn; private boolean horn;

View file

@ -5,12 +5,12 @@ import com.minelittlepony.pony.ITriggerPixelMapped;
import com.minelittlepony.settings.PonySettings; import com.minelittlepony.settings.PonySettings;
public enum Size implements ITriggerPixelMapped<Size> { public enum Size implements ITriggerPixelMapped<Size> {
TALL(0x534b76, 0.45f, 1.1F), TALL (0x764b53, 0.45f, 1.1F),
BULKY(0xce3254, 0.5f, 1), BULKY (0x5432ce, 0.5f, 1),
LANKY(0x3254ce, 0.45F, 0.85F), LANKY (0xce5432, 0.45F, 0.85F),
NORMAL(0, 0.4f, 0.8F), NORMAL (0x000000, 0.4f, 0.8F),
YEARLING(0x53beff, 0.4F, 0.6F), YEARLING(0xffbe53, 0.4F, 0.6F),
FOAL(0xffbe53, 0.25f, 0.6F); FOAL (0x53beff, 0.25f, 0.6F);
private int triggerValue; private int triggerValue;

View file

@ -4,11 +4,11 @@ import com.minelittlepony.pony.ITriggerPixelMapped;
public enum TailLength implements ITriggerPixelMapped<TailLength> { public enum TailLength implements ITriggerPixelMapped<TailLength> {
STUB(0x425844), STUB (0x445842),
QUARTER(0xd19fe4), QUARTER (0xe49fd1),
HALF(0x534b76), HALF (0x764b53),
THREE_QUARTERS(0x8a6b7f), THREE_QUARTERS (0x7f6b8a),
FULL(0); FULL (0x000000);
private int triggerValue; private int triggerValue;

View file

@ -77,12 +77,12 @@ public enum TriggerPixels {
} }
enum Channel { enum Channel {
RAW(-1, 0), RAW (0xFFFFFFFF, 0),
ALL (0xffffff, 0), ALL (0x00FFFFFF, 0),
ALPHA(0xff, 24), ALPHA(0x000000FF, 24),
RED (0xff, 16), RED (0x000000FF, 0),
GREEN(0xff, 8), GREEN(0x000000FF, 8),
BLUE (0xff, 0); BLUE (0x000000FF, 16);
private int mask; private int mask;
private int offset; private int offset;
@ -93,7 +93,8 @@ public enum TriggerPixels {
} }
public int readValue(int x, int y, NativeImage image) { public int readValue(int x, int y, NativeImage image) {
/*getPixelABGR*/
return (image.getPixelRGBA(x, y) >> offset) & mask; return (image.getPixelRGBA(x, y) >> offset) & mask;
} }
} }
} }

View file

@ -6,12 +6,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public enum Wearable implements ITriggerPixelMapped<Wearable> { public enum Wearable implements ITriggerPixelMapped<Wearable> {
NONE(0), NONE (0x00),
MUFFIN(50), MUFFIN (0x32),
HAT(100), HAT (0x64),
ANTLERS(150), ANTLERS (0x96),
SADDLE_BAGS(200), SADDLE_BAGS (0xC8),
STETSON(250); STETSON (0xFA);
private int triggerValue; private int triggerValue;