From 3a094fe1bf061da4eaf5fdb394e8b5adc2fea44b Mon Sep 17 00:00:00 2001 From: Sollace Date: Sun, 18 Aug 2019 15:53:15 +0200 Subject: [PATCH] Fixed pony body parts appearing on players in spectator mode and possily invisible players/mobs --- .../client/model/AbstractPonyModel.java | 17 +++++++++++++++-- .../client/model/components/PegasusWings.java | 3 +-- .../model/entities/ModelEnderStallion.java | 8 ++++++++ .../client/model/entities/ModelSeapony.java | 6 ++++++ .../client/model/races/ModelAlicorn.java | 6 ++++++ .../client/model/races/ModelPegasus.java | 6 ++++++ .../client/model/races/ModelUnicorn.java | 6 ++++++ .../client/model/races/ModelZebra.java | 7 +++++++ 8 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index 191adc28..f9332dd9 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -11,7 +11,6 @@ import com.minelittlepony.client.util.render.plane.PlaneRenderer; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IPart; import com.minelittlepony.model.armour.IEquestrianArmour; - import net.minecraft.client.model.Cuboid; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -767,7 +766,9 @@ public abstract class AbstractPonyModel extends ClientPo protected void renderVest(float scale) { bodyOverlay.render(scale); - upperTorsoOverlay.render(scale); + if (bodyOverlay.visible) { + upperTorsoOverlay.render(scale); + } } protected void renderLegs(float scale) { @@ -788,6 +789,18 @@ public abstract class AbstractPonyModel extends ClientPo 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 public void transform(BodyPart part) { if (attributes.isSleeping) { diff --git a/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java b/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java index bfd82486..9f9747e8 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java +++ b/src/main/java/com/minelittlepony/client/model/components/PegasusWings.java @@ -6,13 +6,12 @@ import net.minecraft.util.math.MathHelper; import com.minelittlepony.client.util.render.PonyRenderer; import com.minelittlepony.model.IPart; import com.minelittlepony.model.IPegasus; -import com.minelittlepony.model.PonyModelConstants; import com.minelittlepony.pony.meta.Wearable; import com.mojang.blaze3d.platform.GlStateManager; import java.util.UUID; -public class PegasusWings implements IPart, PonyModelConstants { +public class PegasusWings implements IPart { protected final T pegasus; diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java b/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java index 95d6ac98..738dfedb 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java @@ -127,6 +127,14 @@ public class ModelEnderStallion extends ModelSkeletonPony { rightLeg = new Cuboid(this, 0, 20); } + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + + leftHorn.visible = visible; + rightHorn.visible = visible; + } + @Override public boolean wingsAreOpen() { return isAttacking; diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java index a42b5b7d..047b991f 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java @@ -185,6 +185,12 @@ public class ModelSeapony extends ModelUnicorn { rightLeg.visible = false; leftLegOverlay.visible = false; rightLegOverlay.visible = false; + + bodyCenter.visible = visible; + + leftFin.visible = visible; + centerFin.visible = visible; + rightFin.visible = visible; } class Armour extends ModelPonyArmour { diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelAlicorn.java b/src/main/java/com/minelittlepony/client/model/races/ModelAlicorn.java index f1de38d2..b7848000 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelAlicorn.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelAlicorn.java @@ -40,4 +40,10 @@ public class ModelAlicorn extends ModelUnicorn implem wings.renderPart(scale, attributes.interpolatorId); } } + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + wings.setVisible(visible); + } } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelPegasus.java b/src/main/java/com/minelittlepony/client/model/races/ModelPegasus.java index d2ab3023..2c349d3e 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelPegasus.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelPegasus.java @@ -34,4 +34,10 @@ public class ModelPegasus extends ModelEarthPony impl super.renderBody(scale); wings.renderPart(scale, attributes.interpolatorId); } + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + wings.setVisible(visible); + } } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java b/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java index c1ab2c74..f4f0f27c 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java @@ -125,4 +125,10 @@ public class ModelUnicorn extends ModelEarthPony impl } return super.getArm(side); } + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + horn.setVisible(visible); + } } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java b/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java index dd5d34b0..ed4971ce 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelZebra.java @@ -51,6 +51,13 @@ public class ModelZebra extends ModelEarthPony { .pitch = -1F; } + + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + bristles.visible = visible; + } + class Armour extends ModelPonyArmour { @Override