Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import meteordevelopment.meteorclient.mixininterface.ICamera;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.render.CameraTweaks;
Expand Down Expand Up @@ -37,9 +38,6 @@ public abstract class CameraMixin implements ICamera {

@Shadow protected abstract void setRotation(float yaw, float pitch);

@Unique
private float tickDelta;

@Inject(method = "getSubmersionType", at = @At("HEAD"), cancellable = true)
private void getSubmergedFluidState(CallbackInfoReturnable<CameraSubmersionType> ci) {
if (Modules.get().get(NoRender.class).noLiquidOverlay()) ci.setReturnValue(CameraSubmersionType.NONE);
Expand All @@ -60,11 +58,6 @@ private void onClipToSpace(float desiredCameraDistance, CallbackInfoReturnable<F
}
}

@Inject(method = "update", at = @At("HEAD"))
private void onUpdateHead(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo info) {
this.tickDelta = tickDelta;
}

@Inject(method = "update", at = @At("TAIL"))
private void onUpdateTail(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo info) {
if (Modules.get().isActive(Freecam.class)) {
Expand All @@ -73,7 +66,7 @@ private void onUpdateTail(BlockView area, Entity focusedEntity, boolean thirdPer
}

@ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setPos(DDD)V"))
private void onUpdateSetPosArgs(Args args) {
private void onUpdateSetPosArgs(Args args, @Local(argsOnly = true) float tickDelta) {
Freecam freecam = Modules.get().get(Freecam.class);

if (freecam.isActive()) {
Expand All @@ -84,7 +77,7 @@ private void onUpdateSetPosArgs(Args args) {
}

@ModifyArgs(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setRotation(FF)V"))
private void onUpdateSetRotationArgs(Args args) {
private void onUpdateSetRotationArgs(Args args, @Local(argsOnly = true) float tickDelta) {
Freecam freecam = Modules.get().get(Freecam.class);
FreeLook freeLook = Modules.get().get(FreeLook.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReceiver;
import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.game.ReceiveMessageEvent;
import meteordevelopment.meteorclient.mixininterface.IChatHud;
Expand Down Expand Up @@ -53,8 +54,6 @@ public abstract class ChatHudMixin implements IChatHud {
private BetterChat betterChat;
@Unique
private int nextId;
@Unique
private boolean skipOnAddMessage;

@Shadow
public abstract void addMessage(Text message, @Nullable MessageSignatureData signatureData, @Nullable MessageIndicator indicator);
Expand Down Expand Up @@ -103,9 +102,7 @@ private ChatHudLine onAddMessage_modifyChatHudLine(ChatHudLine line) {
}

@Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", cancellable = true)
private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci) {
if (skipOnAddMessage) return;

private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci, @Local(argsOnly = true) LocalRef<Text> messageRef, @Local(argsOnly = true) LocalRef<MessageIndicator> indicatorRef) {
ReceiveMessageEvent event = MeteorClient.EVENT_BUS.post(ReceiveMessageEvent.get(message, indicator, nextId));

if (event.isCancelled()) ci.cancel();
Expand All @@ -120,11 +117,8 @@ private void onAddMessage(Text message, MessageSignatureData signatureData, Mess
}

if (event.isModified()) {
ci.cancel();

skipOnAddMessage = true;
addMessage(event.getMessage(), signatureData, event.getIndicator());
skipOnAddMessage = false;
messageRef.set(event.getMessage());
indicatorRef.set(event.getIndicator());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package meteordevelopment.meteorclient.mixin;

import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import meteordevelopment.meteorclient.MeteorClient;
Expand Down Expand Up @@ -49,9 +51,6 @@ public abstract class ClientPlayNetworkHandlerMixin extends ClientCommonNetworkH
@Shadow
private ClientWorld world;

@Unique
private boolean worldNotNull;

protected ClientPlayNetworkHandlerMixin(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
super(client, connection, connectionState);
}
Expand All @@ -66,13 +65,13 @@ private void onEntitySpawn(EntitySpawnS2CPacket packet, CallbackInfo info) {
}

@Inject(method = "onGameJoin", at = @At("HEAD"))
private void onGameJoinHead(GameJoinS2CPacket packet, CallbackInfo info) {
worldNotNull = world != null;
private void onGameJoinHead(GameJoinS2CPacket packet, CallbackInfo info, @Share("worldNotNull") LocalBooleanRef worldNotNull) {
worldNotNull.set(world != null);
}

@Inject(method = "onGameJoin", at = @At("TAIL"))
private void onGameJoinTail(GameJoinS2CPacket packet, CallbackInfo info) {
if (worldNotNull) {
private void onGameJoinTail(GameJoinS2CPacket packet, CallbackInfo info, @Share("worldNotNull") LocalBooleanRef worldNotNull) {
if (worldNotNull.get()) {
MeteorClient.EVENT_BUS.post(GameLeftEvent.get());
}

Expand Down