mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 06:24:06 +01:00
39 lines
2.4 KiB
Diff
39 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Tue, 16 Feb 2021 00:16:56 -0800
|
|
Subject: [PATCH] Send full pos packets for hard colliding entities
|
|
|
|
Prevent collision problems due to desync (i.e boats)
|
|
|
|
Configurable under
|
|
`send-full-pos-for-hard-colliding-entities`
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index 96d5b89d67f0904c0a6f68a7bbffc48457e850de..4b828da7f8dbadb8af66ffc04d631273cfccdf36 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -615,4 +615,10 @@ public class PaperConfig {
|
|
}
|
|
}
|
|
}
|
|
+
|
|
+ public static boolean sendFullPosForHardCollidingEntities;
|
|
+
|
|
+ private static void sendFullPosForHardCollidingEntities() {
|
|
+ sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
index 66df9492004ae648c5a5db8d1e76931284297ec1..2abfc5c801cd58223986d6c5012fc381e66f0d9a 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
@@ -158,7 +158,7 @@ public class ServerEntity {
|
|
long i1 = this.positionCodec.encodeZ(vec3d);
|
|
boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L;
|
|
|
|
- if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround()) {
|
|
+ if (!flag4 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.isOnGround() && !(com.destroystokyo.paper.PaperConfig.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
|
|
if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) {
|
|
if (flag2) {
|
|
packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.isOnGround());
|