diff --git a/src/main/java/com/minelittlepony/api/model/IPart.java b/src/main/java/com/minelittlepony/api/model/IPart.java index b688b4f6..d52b8300 100644 --- a/src/main/java/com/minelittlepony/api/model/IPart.java +++ b/src/main/java/com/minelittlepony/api/model/IPart.java @@ -21,7 +21,7 @@ public interface IPart extends PonyModelConstants { /** * Sets whether this part should be rendered. */ - default void setVisible(boolean visible) { + default void setVisible(boolean visible, ModelAttributes attributes) { } } diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index f6e53c18..1d9c0ff2 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -593,7 +593,7 @@ public abstract class AbstractPonyModel extends ClientPo super.setVisible(visible); neck.visible = visible; - parts.forEach(part -> part.setVisible(visible)); + parts.forEach(part -> part.setVisible(visible, attributes)); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java b/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java index 906033c6..0fa4a898 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java @@ -33,7 +33,7 @@ public class EnderStallionModel extends SkeleponyModel { isBoss = !isAlicorn && entity.getUuid().getLeastSignificantBits() % 90 == 0; leftHorn.visible = rightHorn.visible = isBoss; - horn.setVisible(!isBoss); + horn.setVisible(!isBoss, attributes); } @Override @@ -68,8 +68,8 @@ public class EnderStallionModel extends SkeleponyModel { public void setVisible(boolean visible) { super.setVisible(visible); - tail.setVisible(false); - snout.setVisible(false); + tail.setVisible(false, attributes); + snout.setVisible(false, attributes); leftSleeve.visible = false; rightSleeve.visible = false; diff --git a/src/main/java/com/minelittlepony/client/model/part/LionTail.java b/src/main/java/com/minelittlepony/client/model/part/LionTail.java index 334915e0..e232f468 100644 --- a/src/main/java/com/minelittlepony/client/model/part/LionTail.java +++ b/src/main/java/com/minelittlepony/client/model/part/LionTail.java @@ -74,7 +74,7 @@ public class LionTail implements IPart { } @Override - public void setVisible(boolean visible) { + public void setVisible(boolean visible, ModelAttributes attributes) { tail.visible = visible; } diff --git a/src/main/java/com/minelittlepony/client/model/part/PonyEars.java b/src/main/java/com/minelittlepony/client/model/part/PonyEars.java index 116179c5..a6b887ad 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonyEars.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonyEars.java @@ -30,8 +30,8 @@ public class PonyEars implements IPart, MsonModel { } @Override - public void setVisible(boolean visible) { - right.visible = visible; - left.visible = visible; + public void setVisible(boolean visible, ModelAttributes attributes) { + right.visible = visible && !attributes.metadata.getRace().isHuman(); + left.visible = visible && !attributes.metadata.getRace().isHuman(); } } diff --git a/src/main/java/com/minelittlepony/client/model/part/PonySnout.java b/src/main/java/com/minelittlepony/client/model/part/PonySnout.java index d7e54b2c..70d66f81 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonySnout.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonySnout.java @@ -13,8 +13,6 @@ import com.minelittlepony.mson.api.model.PartBuilder; public class PonySnout implements IPart, MsonModel { - private boolean visible = false; - private final ModelPart mare; private final ModelPart stallion; @@ -35,24 +33,16 @@ public class PonySnout implements IPart, MsonModel { stallion.setAngles(x, y, z); } - @Override - public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) { - setGender(attributes.metadata.getGender()); - } - @Override public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { } @Override - public void setVisible(boolean visible) { - this.visible = visible; - } + public void setVisible(boolean visible, ModelAttributes attributes) { + visible &= !attributes.metadata.getRace().isHuman() && MineLittlePony.getInstance().getConfig().snuzzles.get(); + Gender gender = attributes.metadata.getGender(); - public void setGender(Gender gender) { - boolean show = visible && MineLittlePony.getInstance().getConfig().snuzzles.get(); - - mare.visible = (show && gender.isMare()); - stallion.visible = (show && gender.isStallion()); + mare.visible = (visible && gender.isMare()); + stallion.visible = (visible && gender.isStallion()); } } diff --git a/src/main/java/com/minelittlepony/client/model/part/PonyTail.java b/src/main/java/com/minelittlepony/client/model/part/PonyTail.java index 242eb78a..dd821e01 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonyTail.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonyTail.java @@ -83,7 +83,7 @@ public class PonyTail implements IPart, MsonModel { } @Override - public void setVisible(boolean visible) { + public void setVisible(boolean visible, ModelAttributes attributes) { tail.visible = visible; tailStop = model.getMetadata().getTailLength().ordinal(); shape = model.getMetadata().getTailShape(); diff --git a/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java b/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java index 048bfd68..4f1a5002 100644 --- a/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java @@ -42,7 +42,7 @@ public class UnicornHorn implements IPart { } @Override - public void setVisible(boolean visible) { + public void setVisible(boolean visible, ModelAttributes attributes) { this.visible = visible; } } diff --git a/src/main/java/com/minelittlepony/client/render/blockentity/skull/PlayerPonySkull.java b/src/main/java/com/minelittlepony/client/render/blockentity/skull/PlayerPonySkull.java index 85e628f0..bbed84e8 100644 --- a/src/main/java/com/minelittlepony/client/render/blockentity/skull/PlayerPonySkull.java +++ b/src/main/java/com/minelittlepony/client/render/blockentity/skull/PlayerPonySkull.java @@ -1,6 +1,5 @@ package com.minelittlepony.client.render.blockentity.skull; -import com.google.common.base.Suppliers; import com.minelittlepony.api.config.PonyConfig; import com.minelittlepony.api.config.PonyLevel; import com.minelittlepony.api.pony.IPony; @@ -12,7 +11,6 @@ import com.mojang.authlib.GameProfile; import java.util.HashMap; import java.util.Map; -import java.util.function.Supplier; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.DefaultSkinHelper; @@ -28,7 +26,9 @@ public class PlayerPonySkull implements ISkull { private AbstractPonyModel ponyHead; private final Map>, AbstractPonyModel> modelCache = new HashMap<>(); - private final Supplier deadMau5 = Suppliers.memoize(ModelType.DJ_PON_3::createModel); + private final DJPon3EarsModel deadMau5 = ModelType.DJ_PON_3.createModel(); + + private boolean renderingEars; @Override public boolean canRender(PonyConfig config) { @@ -37,7 +37,7 @@ public class PlayerPonySkull implements ISkull { @Override public Identifier getSkinResource(@Nullable GameProfile profile) { - deadMau5.get().setVisible(profile != null && "deadmau5".equals(profile.getName())); + renderingEars = profile != null && "deadmau5".equals(profile.getName()); if (profile != null) { Identifier skin = SkinsProxy.instance.getSkinTexture(profile); @@ -56,7 +56,10 @@ public class PlayerPonySkull implements ISkull { public boolean bindPony(IPony pony) { Race race = pony.race(); if (race.isHuman()) { - return false; + race = Race.EARTH; + if (!renderingEars) { + return false; + } } ponyHead = modelCache.computeIfAbsent(ModelType.getPlayerModel(race), key -> key.getKey(false).createModel()); ponyHead.setMetadata(pony.metadata()); @@ -72,7 +75,9 @@ public class PlayerPonySkull implements ISkull { ponyHead.getHead().pivotZ = v.z; ponyHead.setVisible(true); ponyHead.setHeadRotation(animationProgress, yaw, 0); - deadMau5.get().setHeadRotation(animationProgress, yaw, 0); + if (renderingEars) { + deadMau5.setHeadRotation(animationProgress, yaw, 0); + } } @Override @@ -83,6 +88,12 @@ public class PlayerPonySkull implements ISkull { stack.push(); ponyHead.helmetRenderList.accept(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); stack.pop(); - deadMau5.get().render(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); + if (renderingEars) { + stack.push(); + stack.scale(1.3333334f, 1.3333334f, 1.3333334f); + stack.translate(0, 0.05F, 0); + deadMau5.render(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); + stack.pop(); + } } } diff --git a/src/main/resources/assets/minelittlepony/models/entity/dj_pon_three.json b/src/main/resources/assets/minelittlepony/models/entity/dj_pon_three.json index 36432d96..dffcc0c1 100644 --- a/src/main/resources/assets/minelittlepony/models/entity/dj_pon_three.json +++ b/src/main/resources/assets/minelittlepony/models/entity/dj_pon_three.json @@ -1,5 +1,5 @@ { - "texture": {"w": 64, "h": 64}, + "texture": {"w": 64, "h": 64, "u": 24, "v": 0}, "data": { "head": { "cubes": [