mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Fixed deadmou5' ears not rendering correctly on player heads and fixed snuzzles rendering both genders on player heads
This commit is contained in:
parent
1b1c9899a2
commit
41a281f2f5
10 changed files with 35 additions and 34 deletions
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -593,7 +593,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
super.setVisible(visible);
|
||||
neck.visible = visible;
|
||||
|
||||
parts.forEach(part -> part.setVisible(visible));
|
||||
parts.forEach(part -> part.setVisible(visible, attributes));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,7 @@ public class EnderStallionModel extends SkeleponyModel<EndermanEntity> {
|
|||
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<EndermanEntity> {
|
|||
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<PlayerModelKey<?, AbstractPonyModel<?>>, AbstractPonyModel<?>> modelCache = new HashMap<>();
|
||||
|
||||
private final Supplier<DJPon3EarsModel> 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,8 +56,11 @@ public class PlayerPonySkull implements ISkull {
|
|||
public boolean bindPony(IPony pony) {
|
||||
Race race = pony.race();
|
||||
if (race.isHuman()) {
|
||||
race = Race.EARTH;
|
||||
if (!renderingEars) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ponyHead = modelCache.computeIfAbsent(ModelType.getPlayerModel(race), key -> key.getKey(false).createModel());
|
||||
ponyHead.setMetadata(pony.metadata());
|
||||
return true;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"texture": {"w": 64, "h": 64},
|
||||
"texture": {"w": 64, "h": 64, "u": 24, "v": 0},
|
||||
"data": {
|
||||
"head": {
|
||||
"cubes": [
|
||||
|
|
Loading…
Reference in a new issue