mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Fix rendering issues with elytra flight
This commit is contained in:
parent
80516f9068
commit
6c0542ff89
3 changed files with 15 additions and 19 deletions
|
@ -8,11 +8,7 @@ import com.minelittlepony.model.PMAPI;
|
|||
import com.minelittlepony.model.PlayerModel;
|
||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||
import com.minelittlepony.model.pony.ModelPlayerPony;
|
||||
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
||||
import com.minelittlepony.renderer.layer.LayerPonyCape;
|
||||
import com.minelittlepony.renderer.layer.LayerPonyElytra;
|
||||
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
||||
import com.minelittlepony.renderer.layer.*;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
@ -32,8 +28,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||
|
||||
@Mixin(RenderPlayer.class)
|
||||
public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony {
|
||||
|
||||
|
@ -43,6 +37,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
|||
private PlayerModel playerModel;
|
||||
private Pony thePony;
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
private MixinRenderPlayer(RenderManager renderManager) {
|
||||
super(renderManager, null, 0.5F);
|
||||
}
|
||||
|
@ -101,9 +96,9 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
|||
if (MineLittlePony.getConfig().showscale && !(playerModel.getModel() instanceof ModelHumanPlayer)) {
|
||||
PonySize size = thePony.metadata.getSize();
|
||||
if (size == PonySize.LARGE)
|
||||
scale(0.9F, 0.9F, 0.9F);
|
||||
GlStateManager.scale(0.9F, 0.9F, 0.9F);
|
||||
else if (size == PonySize.NORMAL || size == PonySize.FOAL)
|
||||
scale(0.8F, 0.8F, 0.8F);
|
||||
GlStateManager.scale(0.8F, 0.8F, 0.8F);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,9 +213,13 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
|||
target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V",
|
||||
ordinal = 3))
|
||||
private void rotateRedirect(float f1, float f2, float f3, float f4) {
|
||||
if (this.playerModel.getModel() instanceof ModelPlayerPony)
|
||||
boolean isPony = this.playerModel.getModel() instanceof ModelPlayerPony;
|
||||
if (isPony)
|
||||
f1 += 90;
|
||||
|
||||
GlStateManager.rotate(f1, f2, f3, f4);
|
||||
if (isPony)
|
||||
GlStateManager.translate(0, -1, 0);
|
||||
}
|
||||
|
||||
private void updateModel(AbstractClientPlayer player) {
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package com.minelittlepony.model.pony;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
import com.minelittlepony.model.PegasusWings;
|
||||
import com.minelittlepony.model.PonySnout;
|
||||
import com.minelittlepony.model.UnicornHorn;
|
||||
import com.minelittlepony.model.*;
|
||||
import com.minelittlepony.renderer.PlaneRenderer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
@ -84,7 +79,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
|||
this.setLegs(limbSwing, limbSwingAmount, ageInTicks, entityIn);
|
||||
this.holdItem(limbSwingAmount);
|
||||
this.swingItem(entityIn, this.swingProgress);
|
||||
if (this.isSneak && !this.isFlying) {
|
||||
if (this.isSneak && !this.isFlying && !this.rainboom) {
|
||||
this.adjustBody(BODY_ROTATE_ANGLE_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK);
|
||||
this.sneakLegs();
|
||||
this.setHead(0.0F, 6.0F, -2.0F);
|
||||
|
|
|
@ -17,6 +17,8 @@ import net.minecraft.inventory.EntityEquipmentSlot;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class LayerPonyElytra implements LayerRenderer<AbstractClientPlayer> {
|
||||
|
||||
private static final ResourceLocation TEXTURE_ELYTRA = new ResourceLocation("textures/entity/elytra.png");
|
||||
|
@ -31,7 +33,7 @@ public class LayerPonyElytra implements LayerRenderer<AbstractClientPlayer> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(AbstractClientPlayer entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) {
|
||||
public void doRenderLayer(@Nonnull AbstractClientPlayer entity, float swing, float swingAmount, float ticks, float age, float yaw, float head, float scale) {
|
||||
|
||||
AbstractPonyModel model = ((IRenderPony) this.renderPlayer).getPony().getModel();
|
||||
if (model instanceof ModelHumanPlayer) {
|
||||
|
@ -41,7 +43,7 @@ public class LayerPonyElytra implements LayerRenderer<AbstractClientPlayer> {
|
|||
|
||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.ELYTRA) {
|
||||
if (itemstack.getItem() == Items.ELYTRA) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
if (entity.isPlayerInfoSet() && entity.getLocationElytra() != null) {
|
||||
|
|
Loading…
Reference in a new issue