|
14 | 14 | import org.spongepowered.asm.mixin.Shadow; |
15 | 15 | import org.spongepowered.asm.mixin.injection.At; |
16 | 16 | import org.spongepowered.asm.mixin.injection.Inject; |
17 | | -import org.spongepowered.asm.mixin.injection.ModifyArg; |
18 | 17 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 18 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; |
19 | 19 |
|
20 | 20 | import java.util.ArrayList; |
21 | 21 | import java.util.Collections; |
@@ -63,18 +63,17 @@ public void onDisconnect(Screen screen, CallbackInfo ci) { |
63 | 63 | } |
64 | 64 |
|
65 | 65 | // Earth annoying his friends <3 nothing to see here |
66 | | - @ModifyArg(method = "<init>", index = 2, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/WindowProvider;createWindow(Lnet/minecraft/client/WindowSettings;Ljava/lang/String;Ljava/lang/String;)Lnet/minecraft/client/util/Window;")) |
67 | | - private String modifyWindowTitle(String title) { |
| 66 | + @Inject(method = "getWindowTitle", at = @At("RETURN"), cancellable = true) |
| 67 | + private void modifyWindowTitle(CallbackInfoReturnable<String> ci) { |
68 | 68 | String playerName = MinecraftClient.getInstance().getSession().getProfile().getName(); |
69 | | - if (!"Earthcomputer".equals(playerName) |
70 | | - && !"Azteched".equals(playerName) |
71 | | - && !"samnrad".equals(playerName) |
72 | | - && !"allocator".equals(playerName)) |
73 | | - return title; |
74 | | - |
75 | | - List<Character> chars = title.chars().mapToObj(c -> (char)c).collect(Collectors.toCollection(ArrayList::new)); |
76 | | - Collections.shuffle(chars); |
77 | | - return chars.stream().map(String::valueOf).collect(Collectors.joining()); |
| 69 | + if ("Earthcomputer".equals(playerName) |
| 70 | + || "Azteched".equals(playerName) |
| 71 | + || "samnrad".equals(playerName) |
| 72 | + || "allocator".equals(playerName)) { |
| 73 | + List<Character> chars = ci.getReturnValue().chars().mapToObj(c -> (char) c).collect(Collectors.toCollection(ArrayList::new)); |
| 74 | + Collections.shuffle(chars); |
| 75 | + ci.setReturnValue(chars.stream().map(String::valueOf).collect(Collectors.joining())); |
| 76 | + } |
78 | 77 | } |
79 | 78 |
|
80 | 79 | @Override |
|
0 commit comments