Skip to content

Commit

Permalink
Support MInecraft 1.20.2-pre2 (1.20.2 Snapshot)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrix-Shen committed Sep 8, 2023
1 parent 0325d2b commit 74c33ff
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ mod_sources=https://github.com/The-Cat-Town-Craft/Carpet-TCTC-Addition
mod_version=2.2

# Required Libraries
# MagicLib - 0.7.382
magiclib_dependency=0.7.382+17856bd-beta
magiclib_version=0.7.382+17856bd-beta
# MagicLib - 0.7.384
magiclib_dependency=0.7.384+e9e3c4a-beta
magiclib_version=0.7.384+e9e3c4a-beta

# Annotation processor
lombok_version=1.18.28
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

import java.util.Optional;

//#if MC > 12001
//$$ import net.minecraft.server.network.CommonListenerCookie;
//#endif

@Mixin(PlayerList.class)
public abstract class MixinPlayerList {
@Shadow public abstract MinecraftServer getServer();
Expand All @@ -31,7 +35,7 @@ public abstract class MixinPlayerList {
at = @At(
value = "INVOKE",
//#if MC > 12001
//$$ target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;<init>(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;I)V",
//$$ target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;<init>(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/server/network/CommonListenerCookie;)V",
//#else
target = "Lnet/minecraft/server/network/ServerGamePacketListenerImpl;<init>(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;)V",
//#endif
Expand All @@ -42,22 +46,24 @@ private void onPlaceNewPlayer(
Connection connection,
ServerPlayer serverPlayer,
//#if MC > 12001
//$$ int i,
//$$ CommonListenerCookie commonListenerCookie,
//#endif
CallbackInfo ci
) {
if (CarpetTCTCAdditionSettings.freecamRestoreLocation &&
this.getServer() instanceof DedicatedServer &&
//#if MC > 11605
this.getServer().getForcedGameType() != null) {
this.getServer().getForcedGameType() != null
//#else
//$$ this.getServer().getForceGameType()) {
//$$ this.getServer().getForceGameType()
//#endif
Optional.ofNullable(FreeCameraUtil.get(serverPlayer.getUUID())).ifPresent(data -> {
if (data.isFreecam) {
FreecamCommand.exitFreecam(serverPlayer, data, true);
}
});
) {
Optional.ofNullable(FreeCameraUtil.get(serverPlayer.getUUID()))
.ifPresent(data -> {
if (data.isFreecam) {
FreecamCommand.exitFreecam(serverPlayer, data, true);
}
});
}
}
}
4 changes: 2 additions & 2 deletions versions/1.20.2/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Independent branch configuration
# Development Environment
minecraft_version=23w35a
minecraft_dependency=1.20.2-alpha.23.35.a
minecraft_version=1.20.2-pre2
minecraft_dependency=1.20.2-beta.2

0 comments on commit 74c33ff

Please sign in to comment.