mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fixed player head rendering
This commit is contained in:
parent
27281579fc
commit
b7becaf3a4
2 changed files with 15 additions and 9 deletions
|
@ -114,6 +114,11 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
|||
|
||||
protected void setModelVisibilities(T state) {
|
||||
hat.visible = head.visible && !state.attributes.isHorsey;
|
||||
if (state.attributes.isHorsey) {
|
||||
neck.visible = head.visible;
|
||||
} else {
|
||||
neck.hidden = !head.visible;
|
||||
}
|
||||
parts.forEach(part -> part.setVisible(body.visible, state));
|
||||
}
|
||||
|
||||
|
@ -573,16 +578,10 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
|||
stack.translate(0, 1.35F, 0);
|
||||
}
|
||||
|
||||
if (state.attributes.isHorsey) {
|
||||
if (part == BodyPart.BODY) {
|
||||
if (state.attributes.isHorsey && part == BodyPart.BODY) {
|
||||
stack.scale(1.5F, 1, 1.5F);
|
||||
}
|
||||
|
||||
neck.visible = head.visible;
|
||||
} else {
|
||||
neck.hidden = !head.visible;
|
||||
}
|
||||
|
||||
PonyTransformation.forSize(state.attributes.size).transform(state.attributes, part, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.api.pony.SkinsProxy;
|
|||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.model.*;
|
||||
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer.ISkull;
|
||||
import com.minelittlepony.client.render.entity.state.PlayerPonyRenderState;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -24,6 +25,7 @@ import org.joml.Vector3f;
|
|||
public class PlayerPonySkull implements ISkull {
|
||||
private AbstractPonyModel<?> ponyHead;
|
||||
private final Map<PlayerModelKey<AbstractPonyModel<?>>, AbstractPonyModel<?>> modelCache = new HashMap<>();
|
||||
private final PlayerPonyRenderState state = new PlayerPonyRenderState();
|
||||
|
||||
private final DJPon3EarsModel deadMau5 = ModelType.DJ_PON_3.createModel();
|
||||
|
||||
|
@ -61,6 +63,10 @@ public class PlayerPonySkull implements ISkull {
|
|||
}
|
||||
}
|
||||
ponyHead = modelCache.computeIfAbsent(ModelType.getPlayerModel(race), key -> key.getKey(false).createModel());
|
||||
state.pony = pony;
|
||||
state.race = pony.race();
|
||||
state.attributes.size = pony.size();
|
||||
state.attributes.metadata = pony.metadata();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,10 +74,11 @@ public class PlayerPonySkull implements ISkull {
|
|||
public void setAngles(float yaw, float animationProgress) {
|
||||
Vector3f v = new Vector3f(0, -2, 2);
|
||||
v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
ponyHead.setVisible(true);
|
||||
ponyHead.setAngles(state);
|
||||
ponyHead.getHead().pivotX = v.x;
|
||||
ponyHead.getHead().pivotY = v.y;
|
||||
ponyHead.getHead().pivotZ = v.z;
|
||||
ponyHead.setVisible(true);
|
||||
ponyHead.setHeadRotation(animationProgress, yaw, 0);
|
||||
if (renderingEars) {
|
||||
deadMau5.setHeadRotation(animationProgress, yaw, 0);
|
||||
|
|
Loading…
Reference in a new issue