Skip to content

Commit a1370a9

Browse files
committed
fix: build errors
1 parent 5a42891 commit a1370a9

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

src/main/java/luma/hunt/client/screen/JoinGameScreen.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
import net.minecraft.client.gui.screen.Screen;
88
import net.minecraft.client.gui.DrawContext;
99
import net.minecraft.client.network.ServerAddress;
10+
/*? >=1.20.2 {*/
11+
import net.minecraft.client.gui.screen.multiplayer.ConnectScreen;
12+
/*? } else {*/
1013
import net.minecraft.client.gui.screen.ConnectScreen;
14+
/*? }*/
1115
import net.minecraft.client.network.ServerInfo;
1216
import net.minecraft.client.MinecraftClient;
1317
import net.minecraft.text.Text;
@@ -74,6 +78,10 @@ public static void connectTo(String ip, int port) {
7478
MinecraftClient client = MinecraftClient.getInstance();
7579
ServerAddress address = new ServerAddress(ip, port);
7680
ServerInfo info = new ServerInfo("LH | Lobby", ip + ":" + port, false);
81+
/*? <1.20.2 {*/
82+
ConnectScreen.connect(client.currentScreen, client, address, info);
83+
/*? } else {*/
7784
ConnectScreen.connect(client.currentScreen, client, address, info, false);
85+
/*? }*/
7886
}
7987
}

src/main/java/luma/hunt/mixin/ChatHudMixin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@
1212

1313
@Mixin(ChatHud.class)
1414
public class ChatHudMixin {
15+
/*? <1.20.2 {*/
1516
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;ILnet/minecraft/client/gui/hud/MessageIndicator;Z)V", at = @At("HEAD"))
1617
private void onAddMessage(Text message, MessageSignatureData signature, int ticks, MessageIndicator indicator, boolean refresh, CallbackInfo ci) {
1718
if (message != null) {
1819
String text = message.getString();
1920
LobbyManager.getInstance().checkChatForE4mc(text);
2021
}
2122
}
23+
/*? } else {*/
24+
@Inject(method = "addMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/message/MessageSignatureData;Lnet/minecraft/client/gui/hud/MessageIndicator;)V", at = @At("HEAD"))
25+
private void onAddMessage(Text message, MessageSignatureData signature, MessageIndicator indicator, CallbackInfo ci) {
26+
if (message != null) {
27+
String text = message.getString();
28+
LobbyManager.getInstance().checkChatForE4mc(text);
29+
}
30+
}
31+
/*? }*/
2232
}

src/main/java/luma/hunt/mixin/ServerPlayerEntityMixin.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
@Mixin(ServerPlayerEntity.class)
1717
public abstract class ServerPlayerEntityMixin {
1818

19+
/*? <1.21 {*/
1920
@Inject(method = "moveToWorld", at = @At("HEAD"))
2021
private void onMoveToWorld(ServerWorld destination, CallbackInfoReturnable<ServerPlayerEntity> cir) {
2122
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
@@ -33,4 +34,24 @@ private void onMoveToWorld(ServerWorld destination, CallbackInfoReturnable<Serve
3334
GameManager.getInstance().onRunnerEnterEndGateway(player.getServer(), player);
3435
}
3536
}
37+
/*? } else {*/
38+
@Inject(method = "teleportTo(Lnet/minecraft/world/TeleportTarget;)Lnet/minecraft/server/network/ServerPlayerEntity;", at = @At("HEAD"))
39+
private void onTeleportTo(net.minecraft.world.TeleportTarget target, CallbackInfoReturnable<ServerPlayerEntity> cir) {
40+
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
41+
if (!GameSettings.getInstance().isGameActive()) {
42+
return;
43+
}
44+
45+
Role role = LobbyManager.getInstance().getPlayerRole(player.getUuid());
46+
if (role != Role.RUNNER) {
47+
return;
48+
}
49+
50+
ServerWorld destination = target.world();
51+
ServerWorld currentWorld = player.getServerWorld();
52+
if (currentWorld.getRegistryKey() == World.END && destination.getRegistryKey() == World.OVERWORLD) {
53+
GameManager.getInstance().onRunnerEnterEndGateway(player.getServer(), player);
54+
}
55+
}
56+
/*? }*/
3657
}

0 commit comments

Comments
 (0)