1.20.2-pre1

This commit is contained in:
gnembon committed 2023-09-05 22:15:44 +02:00
1 parent ffbd1338b0
commit 5a77da26d4
12 files changed
+49 -54

No files matched your search

@@ -5,6 +5,7 @@ import carpet.network.ServerNetworkHandler;
import net.minecraft.network.Connection;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
import net.minecraft.server.players.PlayerList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -16,7 +17,7 @@ public class PlayerList_coreMixin
{
@Inject(method = "placeNewPlayer", at = @At("RETURN"))
private void onPlayerConnected(Connection connection, ServerPlayer player, int i, CallbackInfo ci)
private void onPlayerConnected(Connection connection, ServerPlayer player, CommonListenerCookie i, CallbackInfo ci)
{
CarpetServer.onPlayerLoggedIn(player);
}
@@ -4,8 +4,10 @@ import com.mojang.authlib.GameProfile;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.Connection;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import net.minecraft.server.players.PlayerList;
import org.spongepowered.asm.mixin.Final;
@@ -34,25 +36,25 @@ public abstract class PlayerList_fakePlayersMixin
}
}
@Redirect(method = "placeNewPlayer", at = @At(value = "NEW", target = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;I)Lnet/minecraft/server/network/ServerGamePacketListenerImpl;"))
private ServerGamePacketListenerImpl replaceNetworkHandler( MinecraftServer server, Connection clientConnection, ServerPlayer playerIn, int i)
@Redirect(method = "placeNewPlayer", at = @At(value = "NEW", target = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/network/Connection;Lnet/minecraft/server/level/ServerPlayer;Lnet/minecraft/server/network/CommonListenerCookie;)Lnet/minecraft/server/network/ServerGamePacketListenerImpl;"))
private ServerGamePacketListenerImpl replaceNetworkHandler(MinecraftServer server, Connection clientConnection, ServerPlayer playerIn, CommonListenerCookie cookie)
{
if (playerIn instanceof EntityPlayerMPFake fake)
{
return new NetHandlerPlayServerFake(this.server, clientConnection, fake, i);
return new NetHandlerPlayServerFake(this.server, clientConnection, fake, cookie);
}
else
{
return new ServerGamePacketListenerImpl(this.server, clientConnection, playerIn, i);
return new ServerGamePacketListenerImpl(this.server, clientConnection, playerIn, cookie);
}
}
@Redirect(method = "respawn", at = @At(value = "NEW", target = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/server/level/ServerLevel;Lcom/mojang/authlib/GameProfile;)Lnet/minecraft/server/level/ServerPlayer;"))
public ServerPlayer makePlayerForRespawn(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, ServerPlayer serverPlayer, boolean i)
@Redirect(method = "respawn", at = @At(value = "NEW", target = "(Lnet/minecraft/server/MinecraftServer;Lnet/minecraft/server/level/ServerLevel;Lcom/mojang/authlib/GameProfile;Lnet/minecraft/server/level/ClientInformation;)Lnet/minecraft/server/level/ServerPlayer;"))
public ServerPlayer makePlayerForRespawn(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, ClientInformation cli, ServerPlayer serverPlayer, boolean i)
{
if (serverPlayer instanceof EntityPlayerMPFake) {
return EntityPlayerMPFake.respawnFake(minecraftServer, serverLevel, gameProfile);
return EntityPlayerMPFake.respawnFake(minecraftServer, serverLevel, gameProfile, cli);
}
return new ServerPlayer(minecraftServer, serverLevel, gameProfile);
return new ServerPlayer(minecraftServer, serverLevel, gameProfile, cli);
}
}
@@ -4,6 +4,7 @@ import carpet.CarpetSettings;
import net.minecraft.network.Connection;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
import net.minecraft.server.network.ServerCommonPacketListenerImpl;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.spongepowered.asm.mixin.Mixin;
@@ -20,9 +21,9 @@ public abstract class ServerGamePacketListenerImpl_antiCheatDisabledMixin extend
@Shadow private int aboveGroundVehicleTickCount;
public ServerGamePacketListenerImpl_antiCheatDisabledMixin(final MinecraftServer minecraftServer, final Connection connection, final int i)
public ServerGamePacketListenerImpl_antiCheatDisabledMixin(final MinecraftServer minecraftServer, final Connection connection, CommonListenerCookie cci)
{
super(minecraftServer, connection, i);
super(minecraftServer, connection, cci);
}
//@Shadow protected abstract boolean isSingleplayerOwner();
@@ -6,9 +6,9 @@ import net.minecraft.network.Connection;
import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.CommonListenerCookie;
import net.minecraft.server.network.ServerCommonPacketListenerImpl;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -20,7 +20,7 @@ public abstract class ServerGamePacketListenerImpl_coreMixin extends ServerCommo
@Shadow
public ServerPlayer player;
public ServerGamePacketListenerImpl_coreMixin(final MinecraftServer minecraftServer, final Connection connection, final int i)
public ServerGamePacketListenerImpl_coreMixin(final MinecraftServer minecraftServer, final Connection connection, final CommonListenerCookie i)
{
super(minecraftServer, connection, i);
}
@@ -4,6 +4,7 @@ import carpet.fakes.ServerPlayerInterface;
import carpet.helpers.EntityPlayerActionPack;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ClientInformation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.spongepowered.asm.mixin.Mixin;
@@ -24,7 +25,7 @@ public abstract class ServerPlayer_actionPackMixin implements ServerPlayerInterf
}
@Inject(method = "<init>", at = @At(value = "RETURN"))
private void onServerPlayerEntityContructor(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, CallbackInfo ci)
private void onServerPlayerEntityContructor(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, ClientInformation cli, CallbackInfo ci)
{
this.actionPack = new EntityPlayerActionPack((ServerPlayer) (Object) this);
}
@@ -5,7 +5,6 @@ import carpet.fakes.ServerPlayerInterface;
import carpet.script.EntityEventsGroup;
import com.mojang.authlib.GameProfile;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.game.ServerboundClientInformationPacket;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -129,20 +128,4 @@ public abstract class ServerPlayer_scarpetEventMixin extends Player implements S
{
return isInvalidReference;
}
//getting player language
@Unique
private String language;
@Override
public String getLanguage()
{
return this.language;
}
@Inject(method = "updateOptions", at = @At("HEAD"))
public void setLanguage(ServerboundClientInformationPacket packet, CallbackInfo ci)
{
this.language = packet.language();
}
}