Fix spawn location event changing location

== AT ==
public net.minecraft.world.entity.Entity setRot(FF)V
This commit is contained in:
Steve Anton 2016-03-03 00:09:38 -06:00
parent c8c53412a4
commit dd1cfc07db

View file

@ -132,7 +132,7 @@
ServerLevel worldserver = this.server.getLevel(resourcekey);
ServerLevel worldserver1;
@@ -182,10 +224,24 @@
@@ -182,10 +224,27 @@
player.setServerLevel(worldserver1);
String s1 = connection.getLoggableAddress(this.server.logIPs());
@ -147,7 +147,10 @@
+
+ player.spawnIn(worldserver1);
+ player.gameMode.setLevel((ServerLevel) player.level());
+ player.absMoveTo(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
+ // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world)
+ player.setPosRaw(loc.getX(), loc.getY(), loc.getZ());
+ player.setRot(loc.getYaw(), loc.getPitch());
+ // Paper end - set raw so we aren't fully joined to the world
+ // Spigot end
+
+ // CraftBukkit - Moved message to after join
@ -159,7 +162,7 @@
ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData);
connection.setupInboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())), playerconnection);
@@ -194,7 +250,9 @@
@@ -194,7 +253,9 @@
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING);
@ -170,7 +173,7 @@
playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities()));
playerconnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected));
@@ -213,8 +271,10 @@
@@ -213,8 +274,10 @@
} else {
ichatmutablecomponent = Component.translatable("multiplayer.player.joined.renamed", player.getDisplayName(), s);
}
@ -182,7 +185,7 @@
playerconnection.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot());
ServerStatus serverping = this.server.getStatus();
@@ -222,17 +282,70 @@
@@ -222,17 +285,70 @@
player.sendServerStatus(serverping);
}
@ -257,7 +260,7 @@
}
public void updateEntireScoreboard(ServerScoreboard scoreboard, ServerPlayer player) {
@@ -269,30 +382,31 @@
@@ -269,30 +385,31 @@
}
public void addWorldborderListener(ServerLevel world) {
@ -294,7 +297,7 @@
}
@Override
@@ -319,14 +433,15 @@
@@ -319,14 +436,15 @@
}
protected void save(ServerPlayer player) {
@ -312,7 +315,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.save();
@@ -334,95 +449,176 @@
@@ -334,95 +452,176 @@
}
@ -527,7 +530,7 @@
if (entityplayer1 != null) {
set.add(entityplayer1);
@@ -431,30 +627,50 @@
@@ -431,30 +630,50 @@
Iterator iterator1 = set.iterator();
while (iterator1.hasNext()) {
@ -591,7 +594,7 @@
while (iterator.hasNext()) {
String s = (String) iterator.next();
@@ -462,41 +678,88 @@
@@ -462,41 +681,88 @@
entityplayer1.addTag(s);
}
@ -688,7 +691,7 @@
return entityplayer1;
}
@@ -524,7 +787,18 @@
@@ -524,7 +790,18 @@
public void tick() {
if (++this.sendAllPlayerInfoIn > 600) {
@ -708,10 +711,14 @@
this.sendAllPlayerInfoIn = 0;
}
@@ -541,6 +815,25 @@
}
@@ -537,9 +814,28 @@
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
entityplayer.connection.send(packet);
+ }
+
+ }
+
+ // CraftBukkit start - add a world/entity limited version
+ public void broadcastAll(Packet packet, net.minecraft.world.entity.player.Player entityhuman) {
+ for (int i = 0; i < this.players.size(); ++i) {
@ -726,15 +733,14 @@
+ public void broadcastAll(Packet packet, Level world) {
+ for (int i = 0; i < world.players().size(); ++i) {
+ ((ServerPlayer) world.players().get(i)).connection.send(packet);
+ }
+
+ }
}
}
+ // CraftBukkit end
+
public void broadcastAll(Packet<?> packet, ResourceKey<Level> dimension) {
Iterator iterator = this.players.iterator();
@@ -554,7 +847,7 @@
@@ -554,7 +850,7 @@
}
@ -743,7 +749,7 @@
PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam != null) {
@@ -573,7 +866,7 @@
@@ -573,7 +869,7 @@
}
}
@ -752,7 +758,7 @@
PlayerTeam scoreboardteam = source.getTeam();
if (scoreboardteam == null) {
@@ -619,7 +912,7 @@
@@ -619,7 +915,7 @@
}
public void deop(GameProfile profile) {
@ -761,7 +767,7 @@
ServerPlayer entityplayer = this.getPlayer(profile.getId());
if (entityplayer != null) {
@@ -643,6 +936,7 @@
@@ -643,6 +939,7 @@
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
@ -769,7 +775,7 @@
this.server.getCommands().sendCommands(player);
}
@@ -656,23 +950,19 @@
@@ -656,23 +953,19 @@
@Nullable
public ServerPlayer getPlayerByName(String name) {
@ -801,7 +807,7 @@
if (entityplayer != player && entityplayer.level().dimension() == worldKey) {
double d4 = x - entityplayer.getX();
double d5 = y - entityplayer.getY();
@@ -712,15 +1002,19 @@
@@ -712,15 +1005,19 @@
public void reloadWhiteList() {}
public void sendLevelInfo(ServerPlayer player, ServerLevel world) {
@ -825,7 +831,7 @@
}
player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
@@ -729,8 +1023,16 @@
@@ -729,8 +1026,16 @@
public void sendAllPlayerInfo(ServerPlayer player) {
player.inventoryMenu.sendAllDataToRemote();
@ -843,7 +849,7 @@
}
public int getPlayerCount() {
@@ -786,12 +1088,22 @@
@@ -786,12 +1091,22 @@
}
public void removeAll() {
@ -868,7 +874,7 @@
public void broadcastSystemMessage(Component message, boolean overlay) {
this.broadcastSystemMessage(message, (entityplayer) -> {
return message;
@@ -819,24 +1131,43 @@
@@ -819,24 +1134,43 @@
}
public void broadcastChatMessage(PlayerChatMessage message, ServerPlayer sender, ChatType.Bound params) {
@ -915,7 +921,7 @@
}
if (flag1 && sender != null) {
@@ -845,20 +1176,27 @@
@@ -845,20 +1179,27 @@
}
@ -948,7 +954,7 @@
Path path = file2.toPath();
if (FileUtil.isPathNormalized(path) && FileUtil.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -867,7 +1205,7 @@
@@ -867,7 +1208,7 @@
}
serverstatisticmanager = new ServerStatsCounter(this.server, file1);
@ -957,7 +963,7 @@
}
return serverstatisticmanager;
@@ -875,13 +1213,13 @@
@@ -875,13 +1216,13 @@
public PlayerAdvancements getPlayerAdvancements(ServerPlayer player) {
UUID uuid = player.getUUID();
@ -973,7 +979,7 @@
}
advancementdataplayer.setPlayer(player);
@@ -932,15 +1270,28 @@
@@ -932,15 +1273,28 @@
}
public void reloadResources() {