mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 00:10:32 +01:00
39 lines
2.5 KiB
Diff
39 lines
2.5 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 92413fd4132b1e5b63d4be0e9cf341d2a7200df4..5203a43d707010f6ba43be2d6627d48560b77731 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -625,4 +625,10 @@ public class PaperConfig {
|
|
private static void lagCompensateBlockBreaking() {
|
|
lagCompensateBlockBreaking = getBoolean("settings.lag-compensate-block-breaking", true);
|
|
}
|
|
+
|
|
+ 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 ea9cd490fc3bfcf6a2900a702615e6626f0ed98b..9760ff4b6ca0e555f01151968cbfe0cdb8960e35 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
@@ -172,7 +172,7 @@ public class ServerEntity {
|
|
// Paper end - remove allocation of Vec3D here
|
|
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());
|