mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-24 21:37:59 +01:00
Add some compatibility for unicopia
This commit is contained in:
parent
d881fc1a5d
commit
53e9a1f9da
4 changed files with 37 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -6,8 +6,7 @@ import com.minelittlepony.client.util.render.RenderLayerUtil;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -16,11 +15,23 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.CrossbowItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.UseAction;
|
||||
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 -> {
|
||||
|
@ -37,6 +48,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();
|
||||
|
|
Loading…
Reference in a new issue