Fix backwards compatibility with other 1.19.2 mods expecting older pony mod versions

This commit is contained in:
Sollace 2023-02-25 21:54:42 +00:00
parent 67831d232d
commit 86b2cc16dc
2 changed files with 38 additions and 3 deletions

View file

@ -7,9 +7,9 @@ import org.jetbrains.annotations.Nullable;
import com.google.common.collect.ComparisonChain; import com.google.common.collect.ComparisonChain;
import com.minelittlepony.api.config.PonyConfig; import com.minelittlepony.api.config.PonyConfig;
import com.minelittlepony.api.pony.meta.Race; import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.api.pony.meta.Size;
public interface IPony extends Comparable<IPony> { public interface IPony extends Comparable<IPony> {
/** /**
* Gets the global pony manager instance. * Gets the global pony manager instance.
*/ */
@ -46,12 +46,31 @@ public interface IPony extends Comparable<IPony> {
} }
/** /**
* 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() { default boolean hasMagic() {
return race().hasHorn() && metadata().getGlowColor() != 0; 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. * Gets the texture used for rendering this pony.
*/ */
@ -62,6 +81,21 @@ public interface IPony extends Comparable<IPony> {
*/ */
IPonyData metadata(); 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 @Override
default int compareTo(@Nullable IPony o) { default int compareTo(@Nullable IPony o) {

View file

@ -1,6 +1,7 @@
package com.minelittlepony.client; package com.minelittlepony.client;
import com.minelittlepony.api.config.PonyConfig; import com.minelittlepony.api.config.PonyConfig;
import com.minelittlepony.api.pony.IPonyManager;
import com.minelittlepony.api.pony.network.fabric.Channel; import com.minelittlepony.api.pony.network.fabric.Channel;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.pony.PonyManager; import com.minelittlepony.client.pony.PonyManager;
@ -141,7 +142,7 @@ public class MineLittlePony implements ClientModInitializer {
return config; return config;
} }
public PonyManager getManager() { public IPonyManager getManager() {
return ponyManager; return ponyManager;
} }