mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Don't tick dead players
Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla.
This commit is contained in:
parent
ac79088eb6
commit
e7044bdebb
1 changed files with 24 additions and 13 deletions
|
@ -114,7 +114,7 @@
|
||||||
@Nullable
|
@Nullable
|
||||||
private Vec3 startingToFallPosition;
|
private Vec3 startingToFallPosition;
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -258,6 +293,32 @@
|
@@ -258,7 +293,33 @@
|
||||||
private final CommandSource commandSource;
|
private final CommandSource commandSource;
|
||||||
private int containerCounter;
|
private int containerCounter;
|
||||||
public boolean wonGame;
|
public boolean wonGame;
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
+ public boolean queueHealthUpdatePacket;
|
+ public boolean queueHealthUpdatePacket;
|
||||||
+ public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
+ public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
||||||
+ // Paper end - cancellable death event
|
+ // Paper end - cancellable death event
|
||||||
+
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
+ public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
||||||
+ public String displayName;
|
+ public String displayName;
|
||||||
|
@ -144,9 +144,10 @@
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+ public boolean isRealPlayer; // Paper
|
+ public boolean isRealPlayer; // Paper
|
||||||
+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
+ public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||||
|
+
|
||||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
|
||||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||||
|
this.chatVisibility = ChatVisiblity.FULL;
|
||||||
@@ -266,7 +327,7 @@
|
@@ -266,7 +327,7 @@
|
||||||
this.canChatColor = true;
|
this.canChatColor = true;
|
||||||
this.lastActionTime = Util.getMillis();
|
this.lastActionTime = Util.getMillis();
|
||||||
|
@ -180,8 +181,8 @@
|
||||||
+ this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
|
+ this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
|
||||||
+ this.bukkitPickUpLoot = true;
|
+ this.bukkitPickUpLoot = true;
|
||||||
+ this.maxHealthCache = this.getMaxHealth();
|
+ this.maxHealthCache = this.getMaxHealth();
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // Use method to resend items in hands in case of client desync, because the item use got cancelled.
|
+ // Use method to resend items in hands in case of client desync, because the item use got cancelled.
|
||||||
+ // For example, when cancelling the leash event
|
+ // For example, when cancelling the leash event
|
||||||
+ public void resendItemInHands() {
|
+ public void resendItemInHands() {
|
||||||
|
@ -227,9 +228,9 @@
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ return blockposition;
|
+ return blockposition;
|
||||||
+ }
|
}
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
+
|
|
||||||
@Override
|
@Override
|
||||||
public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) {
|
public BlockPos adjustSpawnLocation(ServerLevel world, BlockPos basePos) {
|
||||||
AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO);
|
AABB axisalignedbb = this.getDimensions(Pose.STANDING).makeBoundingBox(Vec3.ZERO);
|
||||||
|
@ -448,6 +449,15 @@
|
||||||
this.containerMenu = this.inventoryMenu;
|
this.containerMenu = this.inventoryMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -807,7 +990,7 @@
|
||||||
|
|
||||||
|
public void doTick() {
|
||||||
|
try {
|
||||||
|
- if (!this.isSpectator() || !this.touchingUnloadedChunk()) {
|
||||||
|
+ if (valid && !this.isSpectator() || !this.touchingUnloadedChunk()) { // Paper - don't tick dead players that are not in the world currently (pending respawn)
|
||||||
|
super.tick();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -820,7 +1003,7 @@
|
@@ -820,7 +1003,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1519,7 +1529,7 @@
|
||||||
if (entity instanceof LivingEntity entityliving) {
|
if (entity instanceof LivingEntity entityliving) {
|
||||||
Iterator iterator = entityliving.getActiveEffects().iterator();
|
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||||
|
|
||||||
@@ -2375,10 +2966,12 @@
|
@@ -2375,16 +2966,161 @@
|
||||||
return TicketType.ENDER_PEARL.timeout();
|
return TicketType.ENDER_PEARL.timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1535,10 +1545,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) {
|
private static float calculateLookAtYaw(Vec3 respawnPos, BlockPos currentPos) {
|
||||||
@@ -2387,4 +2980,147 @@
|
Vec3 vec3d1 = Vec3.atBottomCenterOf(currentPos).subtract(respawnPos).normalize();
|
||||||
|
|
||||||
return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
return (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
+
|
+
|
||||||
+ // CraftBukkit start - Add per-player time and weather.
|
+ // CraftBukkit start - Add per-player time and weather.
|
||||||
+ public long timeOffset = 0;
|
+ public long timeOffset = 0;
|
||||||
|
@ -1563,7 +1574,7 @@
|
||||||
+ public void setPlayerWeather(WeatherType type, boolean plugin) {
|
+ public void setPlayerWeather(WeatherType type, boolean plugin) {
|
||||||
+ if (!plugin && this.weather != null) {
|
+ if (!plugin && this.weather != null) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ if (plugin) {
|
+ if (plugin) {
|
||||||
+ this.weather = type;
|
+ this.weather = type;
|
||||||
|
@ -1574,7 +1585,7 @@
|
||||||
+ } else {
|
+ } else {
|
||||||
+ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.START_RAINING, 0));
|
+ this.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.START_RAINING, 0));
|
||||||
+ }
|
+ }
|
||||||
+ }
|
}
|
||||||
+
|
+
|
||||||
+ private float pluginRainPosition;
|
+ private float pluginRainPosition;
|
||||||
+ private float pluginRainPositionPrevious;
|
+ private float pluginRainPositionPrevious;
|
||||||
|
|
Loading…
Reference in a new issue