Fix capes showing while elytra is worn

This commit is contained in:
Matthew Messinger 2016-12-29 03:06:25 -05:00
parent e87c550f2b
commit f5c2fe7045

View file

@ -10,8 +10,12 @@ import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerCape;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Items;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.util.math.MathHelper;
import javax.annotation.Nonnull;
import static net.minecraft.client.renderer.GlStateManager.*;
public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
@ -25,27 +29,22 @@ public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
}
@Override
public void doRenderLayer(AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6,
float p7, float scale) {
public void doRenderLayer(@Nonnull AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6, float p7, float scale) {
PlayerModel model = ((IRenderPony) renderer).getPony();
if (model.getModel() instanceof ModelHumanPlayer) {
cape.doRenderLayer(clientPlayer, p2, p3, ticks, p5, p6, p7, scale);
} else if (clientPlayer.hasPlayerInfo() && !clientPlayer.isInvisible()
&& clientPlayer.isWearing(EnumPlayerModelParts.CAPE) && clientPlayer.getLocationCape() != null) {
&& clientPlayer.isWearing(EnumPlayerModelParts.CAPE) && clientPlayer.getLocationCape() != null
&& clientPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() != Items.ELYTRA) {
pushMatrix();
model.getModel().transform(BodyPart.BODY);
translate(0.0F, 0.24F, 0.0F);
model.getModel().bipedBody.postRender(scale);
double d = clientPlayer.prevChasingPosX + (clientPlayer.chasingPosX - clientPlayer.prevChasingPosX) * scale
- (clientPlayer.prevPosX + (clientPlayer.posX - clientPlayer.prevPosX) * scale);
double d1 = clientPlayer.prevChasingPosY + (clientPlayer.chasingPosY - clientPlayer.prevChasingPosY) * scale
- (clientPlayer.prevPosY + (clientPlayer.posY - clientPlayer.prevPosY) * scale);
double d2 = clientPlayer.prevChasingPosZ + (clientPlayer.chasingPosZ - clientPlayer.prevChasingPosZ) * scale
- (clientPlayer.prevPosZ + (clientPlayer.posZ - clientPlayer.prevPosZ) * scale);
float f10 = clientPlayer.prevRenderYawOffset
+ (clientPlayer.renderYawOffset - clientPlayer.prevRenderYawOffset) * scale;
double d = clientPlayer.prevChasingPosX + (clientPlayer.chasingPosX - clientPlayer.prevChasingPosX) * scale - (clientPlayer.prevPosX + (clientPlayer.posX - clientPlayer.prevPosX) * scale);
double d1 = clientPlayer.prevChasingPosY + (clientPlayer.chasingPosY - clientPlayer.prevChasingPosY) * scale - (clientPlayer.prevPosY + (clientPlayer.posY - clientPlayer.prevPosY) * scale);
double d2 = clientPlayer.prevChasingPosZ + (clientPlayer.chasingPosZ - clientPlayer.prevChasingPosZ) * scale - (clientPlayer.prevPosZ + (clientPlayer.posZ - clientPlayer.prevPosZ) * scale);
float f10 = clientPlayer.prevRenderYawOffset + (clientPlayer.renderYawOffset - clientPlayer.prevRenderYawOffset) * scale;
double d3 = MathHelper.sin(f10 * 3.1415927F / 180.0F);
double d4 = (-MathHelper.cos(f10 * 3.1415927F / 180.0F));
float f12 = (float) d1 * 10.0F;
@ -64,9 +63,7 @@ public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
}
float f15 = clientPlayer.prevCameraYaw + (clientPlayer.cameraYaw - clientPlayer.prevCameraYaw) * scale;
f12 += MathHelper.sin((clientPlayer.prevDistanceWalkedModified
+ (clientPlayer.distanceWalkedModified - clientPlayer.prevDistanceWalkedModified) * scale) * 6.0F)
* 32.0F * f15;
f12 += MathHelper.sin((clientPlayer.prevDistanceWalkedModified + (clientPlayer.distanceWalkedModified - clientPlayer.prevDistanceWalkedModified) * scale) * 6.0F) * 32.0F * f15;
rotate(2.0F + f13 / 12.0F + f12, 1.0F, 0.0F, 0.0F);
rotate(f14 / 2.0F, 0.0F, 0.0F, 1.0F);