Fixed puppet model rotations/offsets crossing over NPCs when they shouldn't.

This commit is contained in:
Luis C.M committed 2023-01-10 13:10:22 -06:00
1 parent 06ff9fc482
commit 7f407c3c44
2 files changed
+24 -1

No files matched your search

@@ -31,6 +31,9 @@ public class ClientEventHandler {
public static EntityPlayer renderingPlayer;
public static RendererLivingEntity renderer;
public static float[] undoRotations = new float[]{0,0,0};
public static float[] undoPivots = new float[]{0,0,0};
@SubscribeEvent
public void onMouse(MouseEvent event) {
if (Minecraft.getMinecraft().currentScreen != null)
@@ -2,7 +2,6 @@ package noppes.npcs.mixin;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.EntityLivingBase;
import noppes.npcs.client.Client;
@@ -75,6 +74,9 @@ public class MixinModelRenderer {
}
}
if (ClientEventHandler.renderingNpc != null && ClientEventHandler.renderingNpc.jobInterface instanceof JobPuppet) {
ClientEventHandler.undoRotations = new float[]{this.rotateAngleX,this.rotateAngleY,this.rotateAngleZ};
ClientEventHandler.undoPivots = new float[]{this.rotationPointX,this.rotationPointY,this.rotationPointZ};
this.partName = this.getPartName((ModelRenderer) (Object) this, this.partNames);
JobPuppet modelData = (JobPuppet) ClientEventHandler.renderingNpc.jobInterface;
this.setModelParts(modelData);
@@ -103,6 +105,24 @@ public class MixinModelRenderer {
}
}
@SideOnly(Side.CLIENT)
@Inject(method = "render", at = @At(value = "TAIL"))
private void originalRotations(float p_78785_1_, CallbackInfo callbackInfo)
{
if (ClientEventHandler.undoRotations != null) {
this.rotateAngleX = ClientEventHandler.undoRotations[0];
this.rotateAngleY = ClientEventHandler.undoRotations[1];
this.rotateAngleZ = ClientEventHandler.undoRotations[2];
ClientEventHandler.undoRotations = null;
}
if (ClientEventHandler.undoPivots != null) {
this.rotationPointX = ClientEventHandler.undoPivots[0];
this.rotationPointY = ClientEventHandler.undoPivots[1];
this.rotationPointZ = ClientEventHandler.undoPivots[2];
ClientEventHandler.undoPivots = null;
}
}
public String getPartName(ModelRenderer renderer, HashMap<String,String[]> partNames) {
Class<?> RenderClass = renderer.baseModel.getClass();
Object model = renderer.baseModel;