1.20.2-pre1
This commit is contained in:
1 parent
ffbd1338b0
commit
5a77da26d4
12 files changed
+49
-54
No files matched your search
@@ -14,8 +14,10 @@ import net.minecraft.network.protocol.game.ServerboundClientCommandPacket;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.TickTask;
|
||||
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.players.GameProfileCache;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -69,9 +71,9 @@ public class EntityPlayerMPFake extends ServerPlayer
|
||||
{
|
||||
current = p.get();
|
||||
}
|
||||
EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, false);
|
||||
EntityPlayerMPFake instance = new EntityPlayerMPFake(server, worldIn, current, ClientInformation.createDefault(), false);
|
||||
instance.fixStartingPosition = () -> instance.moveTo(pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
|
||||
server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, 0);
|
||||
server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), instance, new CommonListenerCookie(current, 0, instance.clientInformation()));
|
||||
instance.teleportTo(worldIn, pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
|
||||
instance.setHealth(20.0F);
|
||||
instance.unsetRemoved();
|
||||
@@ -95,9 +97,9 @@ public class EntityPlayerMPFake extends ServerPlayer
|
||||
player.connection.disconnect(Component.translatable("multiplayer.disconnect.duplicate_login"));
|
||||
ServerLevel worldIn = player.serverLevel();//.getWorld(player.dimension);
|
||||
GameProfile gameprofile = player.getGameProfile();
|
||||
EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, true);
|
||||
EntityPlayerMPFake playerShadow = new EntityPlayerMPFake(server, worldIn, gameprofile, player.clientInformation(), true);
|
||||
playerShadow.setChatSession(player.getChatSession());
|
||||
server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), playerShadow, 0);
|
||||
server.getPlayerList().placeNewPlayer(new FakeClientConnection(PacketFlow.SERVERBOUND), playerShadow, new CommonListenerCookie(gameprofile, 0, player.clientInformation()));
|
||||
|
||||
playerShadow.setHealth(player.getHealth());
|
||||
playerShadow.connection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
|
||||
@@ -114,14 +116,14 @@ public class EntityPlayerMPFake extends ServerPlayer
|
||||
return playerShadow;
|
||||
}
|
||||
|
||||
public static EntityPlayerMPFake respawnFake(MinecraftServer server, ServerLevel level, GameProfile profile)
|
||||
public static EntityPlayerMPFake respawnFake(MinecraftServer server, ServerLevel level, GameProfile profile, ClientInformation cli)
|
||||
{
|
||||
return new EntityPlayerMPFake(server, level, profile, false);
|
||||
return new EntityPlayerMPFake(server, level, profile, cli, false);
|
||||
}
|
||||
|
||||
private EntityPlayerMPFake(MinecraftServer server, ServerLevel worldIn, GameProfile profile, boolean shadow)
|
||||
private EntityPlayerMPFake(MinecraftServer server, ServerLevel worldIn, GameProfile profile, ClientInformation cli, boolean shadow)
|
||||
{
|
||||
super(server, worldIn, profile);
|
||||
super(server, worldIn, profile, cli);
|
||||
isAShadow = shadow;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user