Skip to content

Commit 62cfd39

Browse files
committed
remove residual @Unique usages
1 parent a188df2 commit 62cfd39

File tree

3 files changed

+13
-27
lines changed

3 files changed

+13
-27
lines changed

src/main/java/meteordevelopment/meteorclient/mixin/CameraMixin.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package meteordevelopment.meteorclient.mixin;
77

8+
import com.llamalad7.mixinextras.sugar.Local;
89
import meteordevelopment.meteorclient.mixininterface.ICamera;
910
import meteordevelopment.meteorclient.systems.modules.Modules;
1011
import meteordevelopment.meteorclient.systems.modules.render.CameraTweaks;
@@ -37,9 +38,6 @@ public abstract class CameraMixin implements ICamera {
3738

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

40-
@Unique
41-
private float tickDelta;
42-
4341
@Inject(method = "getSubmersionType", at = @At("HEAD"), cancellable = true)
4442
private void getSubmergedFluidState(CallbackInfoReturnable<CameraSubmersionType> ci) {
4543
if (Modules.get().get(NoRender.class).noLiquidOverlay()) ci.setReturnValue(CameraSubmersionType.NONE);
@@ -60,11 +58,6 @@ private void onClipToSpace(float desiredCameraDistance, CallbackInfoReturnable<F
6058
}
6159
}
6260

63-
@Inject(method = "update", at = @At("HEAD"))
64-
private void onUpdateHead(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo info) {
65-
this.tickDelta = tickDelta;
66-
}
67-
6861
@Inject(method = "update", at = @At("TAIL"))
6962
private void onUpdateTail(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo info) {
7063
if (Modules.get().isActive(Freecam.class)) {
@@ -73,7 +66,7 @@ private void onUpdateTail(BlockView area, Entity focusedEntity, boolean thirdPer
7366
}
7467

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

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

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

src/main/java/meteordevelopment/meteorclient/mixin/ChatHudMixin.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
99
import com.llamalad7.mixinextras.injector.ModifyReceiver;
1010
import com.llamalad7.mixinextras.sugar.Local;
11+
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
1112
import meteordevelopment.meteorclient.MeteorClient;
1213
import meteordevelopment.meteorclient.events.game.ReceiveMessageEvent;
1314
import meteordevelopment.meteorclient.mixininterface.IChatHud;
@@ -53,8 +54,6 @@ public abstract class ChatHudMixin implements IChatHud {
5354
private BetterChat betterChat;
5455
@Unique
5556
private int nextId;
56-
@Unique
57-
private boolean skipOnAddMessage;
5857

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

105104
@Inject(at = @At("HEAD"), method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", cancellable = true)
106-
private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci) {
107-
if (skipOnAddMessage) return;
108-
105+
private void onAddMessage(Text message, MessageSignatureData signatureData, MessageIndicator indicator, CallbackInfo ci, @Local(argsOnly = true) LocalRef<Text> messageRef, @Local(argsOnly = true) LocalRef<MessageIndicator> indicatorRef) {
109106
ReceiveMessageEvent event = MeteorClient.EVENT_BUS.post(ReceiveMessageEvent.get(message, indicator, nextId));
110107

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

122119
if (event.isModified()) {
123-
ci.cancel();
124-
125-
skipOnAddMessage = true;
126-
addMessage(event.getMessage(), signatureData, event.getIndicator());
127-
skipOnAddMessage = false;
120+
messageRef.set(event.getMessage());
121+
indicatorRef.set(event.getIndicator());
128122
}
129123
}
130124
}

src/main/java/meteordevelopment/meteorclient/mixin/ClientPlayNetworkHandlerMixin.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package meteordevelopment.meteorclient.mixin;
77

8+
import com.llamalad7.mixinextras.sugar.Share;
9+
import com.llamalad7.mixinextras.sugar.ref.LocalBooleanRef;
810
import com.mojang.brigadier.exceptions.CommandSyntaxException;
911
import meteordevelopment.meteorclient.MeteorClient;
1012
import meteordevelopment.meteorclient.commands.Commands;
@@ -53,9 +55,6 @@ public abstract class ClientPlayNetworkHandlerMixin extends ClientCommonNetworkH
5355
@Unique
5456
private boolean ignoreChatMessage;
5557

56-
@Unique
57-
private boolean worldNotNull;
58-
5958
protected ClientPlayNetworkHandlerMixin(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
6059
super(client, connection, connectionState);
6160
}
@@ -70,13 +69,13 @@ private void onEntitySpawn(EntitySpawnS2CPacket packet, CallbackInfo info) {
7069
}
7170

7271
@Inject(method = "onGameJoin", at = @At("HEAD"))
73-
private void onGameJoinHead(GameJoinS2CPacket packet, CallbackInfo info) {
74-
worldNotNull = world != null;
72+
private void onGameJoinHead(GameJoinS2CPacket packet, CallbackInfo info, @Share("worldNotNull") LocalBooleanRef worldNotNull) {
73+
worldNotNull.set(world != null);
7574
}
7675

7776
@Inject(method = "onGameJoin", at = @At("TAIL"))
78-
private void onGameJoinTail(GameJoinS2CPacket packet, CallbackInfo info) {
79-
if (worldNotNull) {
77+
private void onGameJoinTail(GameJoinS2CPacket packet, CallbackInfo info, @Share("worldNotNull") LocalBooleanRef worldNotNull) {
78+
if (worldNotNull.get()) {
8079
MeteorClient.EVENT_BUS.post(GameLeftEvent.get());
8180
}
8281

0 commit comments

Comments
 (0)