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) {
|
protected void setModelVisibilities(T state) {
|
||||||
hat.visible = head.visible && !state.attributes.isHorsey;
|
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));
|
parts.forEach(part -> part.setVisible(body.visible, state));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,14 +578,8 @@ public abstract class AbstractPonyModel<T extends PonyRenderState> extends Clien
|
||||||
stack.translate(0, 1.35F, 0);
|
stack.translate(0, 1.35F, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.attributes.isHorsey) {
|
if (state.attributes.isHorsey && part == BodyPart.BODY) {
|
||||||
if (part == BodyPart.BODY) {
|
stack.scale(1.5F, 1, 1.5F);
|
||||||
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);
|
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.api.pony.meta.Race;
|
||||||
import com.minelittlepony.client.model.*;
|
import com.minelittlepony.client.model.*;
|
||||||
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer.ISkull;
|
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer.ISkull;
|
||||||
|
import com.minelittlepony.client.render.entity.state.PlayerPonyRenderState;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -24,6 +25,7 @@ import org.joml.Vector3f;
|
||||||
public class PlayerPonySkull implements ISkull {
|
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 PlayerPonyRenderState state = new PlayerPonyRenderState();
|
||||||
|
|
||||||
private final DJPon3EarsModel deadMau5 = ModelType.DJ_PON_3.createModel();
|
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());
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +74,11 @@ public class PlayerPonySkull implements ISkull {
|
||||||
public void setAngles(float yaw, float animationProgress) {
|
public void setAngles(float yaw, float animationProgress) {
|
||||||
Vector3f v = new Vector3f(0, -2, 2);
|
Vector3f v = new Vector3f(0, -2, 2);
|
||||||
v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||||
|
ponyHead.setVisible(true);
|
||||||
|
ponyHead.setAngles(state);
|
||||||
ponyHead.getHead().pivotX = v.x;
|
ponyHead.getHead().pivotX = v.x;
|
||||||
ponyHead.getHead().pivotY = v.y;
|
ponyHead.getHead().pivotY = v.y;
|
||||||
ponyHead.getHead().pivotZ = v.z;
|
ponyHead.getHead().pivotZ = v.z;
|
||||||
ponyHead.setVisible(true);
|
|
||||||
ponyHead.setHeadRotation(animationProgress, yaw, 0);
|
ponyHead.setHeadRotation(animationProgress, yaw, 0);
|
||||||
if (renderingEars) {
|
if (renderingEars) {
|
||||||
deadMau5.setHeadRotation(animationProgress, yaw, 0);
|
deadMau5.setHeadRotation(animationProgress, yaw, 0);
|
||||||
|
|
Loading…
Reference in a new issue