mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 05:48:00 +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.
|
* 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);
|
super.setVisible(visible);
|
||||||
neck.visible = visible;
|
neck.visible = visible;
|
||||||
|
|
||||||
parts.forEach(part -> part.setVisible(visible));
|
parts.forEach(part -> part.setVisible(visible, attributes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class EnderStallionModel extends SkeleponyModel<EndermanEntity> {
|
||||||
isBoss = !isAlicorn && entity.getUuid().getLeastSignificantBits() % 90 == 0;
|
isBoss = !isAlicorn && entity.getUuid().getLeastSignificantBits() % 90 == 0;
|
||||||
|
|
||||||
leftHorn.visible = rightHorn.visible = isBoss;
|
leftHorn.visible = rightHorn.visible = isBoss;
|
||||||
horn.setVisible(!isBoss);
|
horn.setVisible(!isBoss, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,8 +68,8 @@ public class EnderStallionModel extends SkeleponyModel<EndermanEntity> {
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible) {
|
||||||
super.setVisible(visible);
|
super.setVisible(visible);
|
||||||
|
|
||||||
tail.setVisible(false);
|
tail.setVisible(false, attributes);
|
||||||
snout.setVisible(false);
|
snout.setVisible(false, attributes);
|
||||||
|
|
||||||
leftSleeve.visible = false;
|
leftSleeve.visible = false;
|
||||||
rightSleeve.visible = false;
|
rightSleeve.visible = false;
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class LionTail implements IPart {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||||
tail.visible = visible;
|
tail.visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class PonyEars implements IPart, MsonModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||||
right.visible = visible;
|
right.visible = visible && !attributes.metadata.getRace().isHuman();
|
||||||
left.visible = visible;
|
left.visible = visible && !attributes.metadata.getRace().isHuman();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@ import com.minelittlepony.mson.api.model.PartBuilder;
|
||||||
|
|
||||||
public class PonySnout implements IPart, MsonModel {
|
public class PonySnout implements IPart, MsonModel {
|
||||||
|
|
||||||
private boolean visible = false;
|
|
||||||
|
|
||||||
private final ModelPart mare;
|
private final ModelPart mare;
|
||||||
private final ModelPart stallion;
|
private final ModelPart stallion;
|
||||||
|
|
||||||
|
@ -35,24 +33,16 @@ public class PonySnout implements IPart, MsonModel {
|
||||||
stallion.setAngles(x, y, z);
|
stallion.setAngles(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRotationAndAngles(ModelAttributes attributes, float move, float swing, float bodySwing, float ticks) {
|
|
||||||
setGender(attributes.metadata.getGender());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) {
|
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||||
this.visible = visible;
|
visible &= !attributes.metadata.getRace().isHuman() && MineLittlePony.getInstance().getConfig().snuzzles.get();
|
||||||
}
|
Gender gender = attributes.metadata.getGender();
|
||||||
|
|
||||||
public void setGender(Gender gender) {
|
mare.visible = (visible && gender.isMare());
|
||||||
boolean show = visible && MineLittlePony.getInstance().getConfig().snuzzles.get();
|
stallion.visible = (visible && gender.isStallion());
|
||||||
|
|
||||||
mare.visible = (show && gender.isMare());
|
|
||||||
stallion.visible = (show && gender.isStallion());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class PonyTail implements IPart, MsonModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||||
tail.visible = visible;
|
tail.visible = visible;
|
||||||
tailStop = model.getMetadata().getTailLength().ordinal();
|
tailStop = model.getMetadata().getTailLength().ordinal();
|
||||||
shape = model.getMetadata().getTailShape();
|
shape = model.getMetadata().getTailShape();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class UnicornHorn implements IPart {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible) {
|
public void setVisible(boolean visible, ModelAttributes attributes) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony.client.render.blockentity.skull;
|
package com.minelittlepony.client.render.blockentity.skull;
|
||||||
|
|
||||||
import com.google.common.base.Suppliers;
|
|
||||||
import com.minelittlepony.api.config.PonyConfig;
|
import com.minelittlepony.api.config.PonyConfig;
|
||||||
import com.minelittlepony.api.config.PonyLevel;
|
import com.minelittlepony.api.config.PonyLevel;
|
||||||
import com.minelittlepony.api.pony.IPony;
|
import com.minelittlepony.api.pony.IPony;
|
||||||
|
@ -12,7 +11,6 @@ import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
import net.minecraft.client.render.VertexConsumer;
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
import net.minecraft.client.util.DefaultSkinHelper;
|
import net.minecraft.client.util.DefaultSkinHelper;
|
||||||
|
@ -28,7 +26,9 @@ public class PlayerPonySkull implements ISkull {
|
||||||
private AbstractPonyModel<?> ponyHead;
|
private AbstractPonyModel<?> ponyHead;
|
||||||
private final Map<PlayerModelKey<?, AbstractPonyModel<?>>, AbstractPonyModel<?>> modelCache = new HashMap<>();
|
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
|
@Override
|
||||||
public boolean canRender(PonyConfig config) {
|
public boolean canRender(PonyConfig config) {
|
||||||
|
@ -37,7 +37,7 @@ public class PlayerPonySkull implements ISkull {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier getSkinResource(@Nullable GameProfile profile) {
|
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) {
|
if (profile != null) {
|
||||||
Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
|
Identifier skin = SkinsProxy.instance.getSkinTexture(profile);
|
||||||
|
@ -56,7 +56,10 @@ public class PlayerPonySkull implements ISkull {
|
||||||
public boolean bindPony(IPony pony) {
|
public boolean bindPony(IPony pony) {
|
||||||
Race race = pony.race();
|
Race race = pony.race();
|
||||||
if (race.isHuman()) {
|
if (race.isHuman()) {
|
||||||
return false;
|
race = Race.EARTH;
|
||||||
|
if (!renderingEars) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ponyHead = modelCache.computeIfAbsent(ModelType.getPlayerModel(race), key -> key.getKey(false).createModel());
|
ponyHead = modelCache.computeIfAbsent(ModelType.getPlayerModel(race), key -> key.getKey(false).createModel());
|
||||||
ponyHead.setMetadata(pony.metadata());
|
ponyHead.setMetadata(pony.metadata());
|
||||||
|
@ -72,7 +75,9 @@ public class PlayerPonySkull implements ISkull {
|
||||||
ponyHead.getHead().pivotZ = v.z;
|
ponyHead.getHead().pivotZ = v.z;
|
||||||
ponyHead.setVisible(true);
|
ponyHead.setVisible(true);
|
||||||
ponyHead.setHeadRotation(animationProgress, yaw, 0);
|
ponyHead.setHeadRotation(animationProgress, yaw, 0);
|
||||||
deadMau5.get().setHeadRotation(animationProgress, yaw, 0);
|
if (renderingEars) {
|
||||||
|
deadMau5.setHeadRotation(animationProgress, yaw, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,6 +88,12 @@ public class PlayerPonySkull implements ISkull {
|
||||||
stack.push();
|
stack.push();
|
||||||
ponyHead.helmetRenderList.accept(stack, vertices, lightUv, overlayUv, red, green, blue, alpha);
|
ponyHead.helmetRenderList.accept(stack, vertices, lightUv, overlayUv, red, green, blue, alpha);
|
||||||
stack.pop();
|
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": {
|
"data": {
|
||||||
"head": {
|
"head": {
|
||||||
"cubes": [
|
"cubes": [
|
||||||
|
|
Loading…
Reference in a new issue