Add some compatibility for unicopia

This commit is contained in:
Sollace 2023-04-11 17:16:21 +02:00
parent 3b3b1740fe
commit 2d6f0cce2e
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
4 changed files with 35 additions and 1 deletions

View file

@ -3,6 +3,8 @@ package com.minelittlepony.api.model;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import java.util.UUID;
public interface IPart {
/**
* Sets the model's various rotation angles.
@ -11,6 +13,13 @@ public interface IPart {
}
@Deprecated
default void setRotationAndAngles(boolean goingFast, UUID interpolatorId, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) {
Compat.attributes.isGoingFast = goingFast;
Compat.attributes.interpolatorId = interpolatorId;
setPartAngles(Compat.attributes, limbAngle, limbSpeed, bodySwing, animationProgress);
}
/**
* Renders this model component.
*/
@ -22,4 +31,14 @@ public interface IPart {
default void setVisible(boolean visible, ModelAttributes attributes) {
}
@Deprecated
default void setVisible(boolean visible) {
setVisible(visible, Compat.attributes);
}
@Deprecated
class Compat {
public static ModelAttributes attributes = new ModelAttributes();
}
}

View file

@ -87,7 +87,7 @@ public class ModelAttributes {
* Unique id of the interpolator used for this model.
* Usually the UUID of the entity being rendered.
*/
private UUID interpolatorId = UUID.randomUUID();
UUID interpolatorId = UUID.randomUUID();
/**
* The actual, visible height of this model when rendered.

View file

@ -9,6 +9,7 @@ import net.minecraft.util.Hand;
import org.jetbrains.annotations.Nullable;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.model.IPart;
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.IPonyData;
@ -48,6 +49,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
@Override
public void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
IPart.Compat.attributes = attributes;
child = entity.isBaby();
attributes.updateLivingState(entity, pony, mode);
PonyModelPrepareCallback.EVENT.invoker().onPonyModelPrepared(entity, this, mode);

View file

@ -21,6 +21,17 @@ import net.minecraft.util.math.RotationAxis;
import net.minecraft.world.World;
public class LevitatingItemRenderer {
@Deprecated
private static int COLOR;
@Deprecated
public static boolean isEnabled() {
return false;
}
@Deprecated
public static RenderLayer getRenderLayer(Identifier texture) {
return MagicGlow.getColoured(texture, COLOR);
}
private VertexConsumerProvider getProvider(IPony pony, VertexConsumerProvider renderContext) {
final int color = pony.metadata().getGlowColor();
return layer -> {
@ -41,6 +52,8 @@ public class LevitatingItemRenderer {
IPony pony = IPony.getManager().getPony((PlayerEntity)entity);
COLOR = pony.metadata().getGlowColor();
matrix.push();
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.hasMagic();