From 86b2cc16dcee593b89bd1211bbe5ade1ba222237 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 25 Feb 2023 21:54:42 +0000 Subject: [PATCH] Fix backwards compatibility with other 1.19.2 mods expecting older pony mod versions --- .../com/minelittlepony/api/pony/IPony.java | 38 ++++++++++++++++++- .../minelittlepony/client/MineLittlePony.java | 3 +- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/minelittlepony/api/pony/IPony.java b/src/main/java/com/minelittlepony/api/pony/IPony.java index 7db5185d..0ea98043 100644 --- a/src/main/java/com/minelittlepony/api/pony/IPony.java +++ b/src/main/java/com/minelittlepony/api/pony/IPony.java @@ -7,9 +7,9 @@ import org.jetbrains.annotations.Nullable; import com.google.common.collect.ComparisonChain; import com.minelittlepony.api.config.PonyConfig; import com.minelittlepony.api.pony.meta.Race; +import com.minelittlepony.api.pony.meta.Size; public interface IPony extends Comparable { - /** * Gets the global pony manager instance. */ @@ -46,12 +46,31 @@ public interface IPony extends Comparable { } /** - * Returns true if and only if this metadata represents a pony that can cast magic. + * @deprecated Replace with pony.race() when updating to 1.19.3 (minelp >=4.7.4) */ + @Deprecated + default Race getRace(boolean ignoreLevel) { + return ignoreLevel ? metadata().getRace() : race(); + } + + /** + * Returns true if and only if this metadata represents a pony that can cast magic. + * + * @deprecated Replace with pony.metadata().hasMagic() when updating to 1.19.4 (minelp >=4.8.0) + */ + @Deprecated default boolean hasMagic() { return race().hasHorn() && metadata().getGlowColor() != 0; } + /** + * @deprecated Replace with pony.race().hasWings() when updating to 1.19.3 (minelp >=4.7.4) + */ + @Deprecated + default boolean canFly() { + return race().hasWings(); + } + /** * Gets the texture used for rendering this pony. */ @@ -62,6 +81,21 @@ public interface IPony extends Comparable { */ IPonyData metadata(); + /** + * @deprecated Replace with pony.metadata() when updating to 1.19.3 (minelp >=4.7.4) + */ + @Deprecated + default IPonyData getMetadata() { + return metadata(); + } + + /** + * @deprecated Replace with pony.metadata().getSize() when updating to 1.19.3 (minelp >=4.7.4) + */ + @Deprecated + default Size getSize() { + return metadata().getSize(); + } @Override default int compareTo(@Nullable IPony o) { diff --git a/src/main/java/com/minelittlepony/client/MineLittlePony.java b/src/main/java/com/minelittlepony/client/MineLittlePony.java index 0b011afb..bec506ea 100644 --- a/src/main/java/com/minelittlepony/client/MineLittlePony.java +++ b/src/main/java/com/minelittlepony/client/MineLittlePony.java @@ -1,6 +1,7 @@ package com.minelittlepony.client; import com.minelittlepony.api.config.PonyConfig; +import com.minelittlepony.api.pony.IPonyManager; import com.minelittlepony.api.pony.network.fabric.Channel; import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.pony.PonyManager; @@ -141,7 +142,7 @@ public class MineLittlePony implements ClientModInitializer { return config; } - public PonyManager getManager() { + public IPonyManager getManager() { return ponyManager; }