Skip to content

Commit

Permalink
Fix meteor rotations being rendered on other players in third person
Browse files Browse the repository at this point in the history
  • Loading branch information
Wide-Cat committed Dec 23, 2024
1 parent 4db6cbb commit fbdc927
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.mixininterface.IEntityRenderState;
import meteordevelopment.meteorclient.mixininterface.IVec3d;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.render.Chams;
Expand All @@ -28,6 +26,8 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import static meteordevelopment.meteorclient.MeteorClient.mc;

@Mixin(PlayerEntityRenderer.class)
public abstract class PlayerEntityRendererMixin {
// Chams
Expand All @@ -45,7 +45,7 @@ public abstract class PlayerEntityRendererMixin {
@Inject(method = "updateRenderState(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/client/render/entity/state/PlayerEntityRenderState;F)V", at = @At("RETURN"))
private void updateRenderState$scale(AbstractClientPlayerEntity player, PlayerEntityRenderState state, float f, CallbackInfo info) {
if (!chams.isActive() || !chams.players.get()) return;
if (chams.ignoreSelf.get() && player == MeteorClient.mc.player) return;
if (chams.ignoreSelf.get() && player == mc.player) return;

float v = chams.playersScale.get().floatValue();
state.baseScale *= v;
Expand Down Expand Up @@ -82,7 +82,7 @@ public abstract class PlayerEntityRendererMixin {

@Inject(method = "updateRenderState(Lnet/minecraft/client/network/AbstractClientPlayerEntity;Lnet/minecraft/client/render/entity/state/PlayerEntityRenderState;F)V", at = @At("RETURN"))
private void updateRenderState$rotations(AbstractClientPlayerEntity player, PlayerEntityRenderState state, float f, CallbackInfo info) {
if (Rotations.rotating && ((IEntityRenderState) state).meteor$getEntity() == MeteorClient.mc.player) {
if (Rotations.rotating && player == mc.player) {
state.bodyYaw = Rotations.serverYaw;
state.pitch = Rotations.serverPitch;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,26 @@

package meteordevelopment.meteorclient.mixininterface;

import meteordevelopment.meteorclient.mixin.EntityRenderDispatcherMixin;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.render.entity.state.EntityRenderState;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;

public interface IEntityRenderState {
/**
* Returns the entity that the render state refers to; necessary in scenarios when you want to perform an entity
* rendering task with data that isn't present in the render state.<p>
*
* The entity is only set after the render state is retrieved in EntityRenderDispatcher#render, so make sure not
* to call this before that point (e.g. mixing into an updateRenderState method), otherwise the entity returned will
* not be the same one that the render state is referring to.
*
* @return The entity that the render state refers to
*
* @see EntityRenderDispatcherMixin#render$getAndUpdateRenderState(EntityRenderState, Entity, double, double, double, float, MatrixStack, VertexConsumerProvider, int, EntityRenderer)
*/
Entity meteor$getEntity();

void meteor$setEntity(Entity entity);
Expand Down

0 comments on commit fbdc927

Please sign in to comment.