Fixed pony body parts appearing on players in spectator mode and possily invisible players/mobs

This commit is contained in:
Sollace 2019-08-18 15:53:15 +02:00
parent e27fd49c40
commit 3a094fe1bf
8 changed files with 55 additions and 4 deletions

View file

@ -11,7 +11,6 @@ import com.minelittlepony.client.util.render.plane.PlaneRenderer;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IPart; import com.minelittlepony.model.IPart;
import com.minelittlepony.model.armour.IEquestrianArmour; import com.minelittlepony.model.armour.IEquestrianArmour;
import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Cuboid;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -767,8 +766,10 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
protected void renderVest(float scale) { protected void renderVest(float scale) {
bodyOverlay.render(scale); bodyOverlay.render(scale);
if (bodyOverlay.visible) {
upperTorsoOverlay.render(scale); upperTorsoOverlay.render(scale);
} }
}
protected void renderLegs(float scale) { protected void renderLegs(float scale) {
if (!isSneaking) { if (!isSneaking) {
@ -788,6 +789,18 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
rightLegOverlay.render(scale); rightLegOverlay.render(scale);
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
upperTorso.visible = visible;
upperTorsoOverlay.visible = visible;
neck.visible = visible;
tail.setVisible(visible);
}
@Override @Override
public void transform(BodyPart part) { public void transform(BodyPart part) {
if (attributes.isSleeping) { if (attributes.isSleeping) {

View file

@ -6,13 +6,12 @@ import net.minecraft.util.math.MathHelper;
import com.minelittlepony.client.util.render.PonyRenderer; import com.minelittlepony.client.util.render.PonyRenderer;
import com.minelittlepony.model.IPart; import com.minelittlepony.model.IPart;
import com.minelittlepony.model.IPegasus; import com.minelittlepony.model.IPegasus;
import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.pony.meta.Wearable; import com.minelittlepony.pony.meta.Wearable;
import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.platform.GlStateManager;
import java.util.UUID; import java.util.UUID;
public class PegasusWings<T extends Model & IPegasus> implements IPart, PonyModelConstants { public class PegasusWings<T extends Model & IPegasus> implements IPart {
protected final T pegasus; protected final T pegasus;

View file

@ -127,6 +127,14 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
rightLeg = new Cuboid(this, 0, 20); rightLeg = new Cuboid(this, 0, 20);
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
leftHorn.visible = visible;
rightHorn.visible = visible;
}
@Override @Override
public boolean wingsAreOpen() { public boolean wingsAreOpen() {
return isAttacking; return isAttacking;

View file

@ -185,6 +185,12 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
rightLeg.visible = false; rightLeg.visible = false;
leftLegOverlay.visible = false; leftLegOverlay.visible = false;
rightLegOverlay.visible = false; rightLegOverlay.visible = false;
bodyCenter.visible = visible;
leftFin.visible = visible;
centerFin.visible = visible;
rightFin.visible = visible;
} }
class Armour extends ModelPonyArmour<T> { class Armour extends ModelPonyArmour<T> {

View file

@ -40,4 +40,10 @@ public class ModelAlicorn<T extends LivingEntity> extends ModelUnicorn<T> implem
wings.renderPart(scale, attributes.interpolatorId); wings.renderPart(scale, attributes.interpolatorId);
} }
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
wings.setVisible(visible);
}
} }

View file

@ -34,4 +34,10 @@ public class ModelPegasus<T extends LivingEntity> extends ModelEarthPony<T> impl
super.renderBody(scale); super.renderBody(scale);
wings.renderPart(scale, attributes.interpolatorId); wings.renderPart(scale, attributes.interpolatorId);
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
wings.setVisible(visible);
}
} }

View file

@ -125,4 +125,10 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
} }
return super.getArm(side); return super.getArm(side);
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
horn.setVisible(visible);
}
} }

View file

@ -51,6 +51,13 @@ public class ModelZebra<T extends LivingEntity> extends ModelEarthPony<T> {
.pitch = -1F; .pitch = -1F;
} }
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
bristles.visible = visible;
}
class Armour extends ModelPonyArmour<T> { class Armour extends ModelPonyArmour<T> {
@Override @Override