Added another mixin necessary for rendering model rotations for players in MP.

This commit is contained in:
Luis C.M committed 2023-01-06 23:47:55 -06:00
1 parent ef01b700da
commit c9426682c0
3 files changed
+69 -53

No files matched your search

@@ -60,68 +60,16 @@ public class ClientEventHandler {
}
}
public void setInterpolatedAngles(PlayerModelData modelData) {
float pi = (float) Math.PI * (modelData.fullAngles ? 2 : 1);
if (!modelData.animate) {
modelData.modelRotations[0] = modelData.rotationX * pi;
modelData.modelRotations[1] = modelData.rotationY * pi;
modelData.modelRotations[2] = modelData.rotationZ * pi;
} else if (modelData.modelRotPartialTicks != ClientEventHandler.partialRenderTick) {
modelData.modelRotPartialTicks = ClientEventHandler.partialRenderTick;
if (modelData.rotationX - modelData.modelRotations[0] != 0 && modelData.rotationEnabledX) {
modelData.modelRotations[0] = (modelData.rotationX - modelData.modelRotations[0]) * modelData.animRate / 10f + modelData.modelRotations[0];
} else {
modelData.modelRotations[0] = modelData.rotationX;
}
if (modelData.rotationY - modelData.modelRotations[1] != 0 && modelData.rotationEnabledY) {
modelData.modelRotations[1] = (modelData.rotationY - modelData.modelRotations[1]) * modelData.animRate / 10f + modelData.modelRotations[1];
} else {
modelData.modelRotations[1] = modelData.rotationY;
}
if (modelData.rotationZ - modelData.modelRotations[2] != 0 && modelData.rotationEnabledZ) {
modelData.modelRotations[2] = (modelData.rotationZ - modelData.modelRotations[2]) * modelData.animRate /10f + modelData.modelRotations[2];
} else {
modelData.modelRotations[2] = modelData.rotationZ;
}
}
}
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Pre event) {
EntityPlayer player = event.entityPlayer;
ClientEventHandler.renderingPlayer = player;
ClientEventHandler.renderingPlayer = event.entityPlayer;
ClientEventHandler.renderer = event.renderer;
ClientEventHandler.partialRenderTick = event.partialRenderTick;
if (Client.playerModelData.containsKey(player.getUniqueID())) {
PlayerModelData data = Client.playerModelData.get(player.getUniqueID());
if (data.enabled()) {
GL11.glPushMatrix();
this.setInterpolatedAngles(data);
if (data.rotationEnabledX) {
GL11.glRotatef(data.modelRotations[0], 1, 0, 0);
}
if (data.rotationEnabledY) {
GL11.glRotatef(data.modelRotations[1], 0, 1, 0);
}
if (data.rotationEnabledZ) {
GL11.glRotatef(data.modelRotations[2], 0, 0, 1);
}
}
}
}
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Post event) {
EntityPlayer player = event.entityPlayer;
if (Client.playerModelData.containsKey(player.getUniqueID())) {
PlayerModelData data = Client.playerModelData.get(player.getUniqueID());
if (data.enabled()) {
GL11.glPopMatrix();
}
}
ClientEventHandler.renderingPlayer = null;
if (hasOverlays(player)) {