1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-04-01 04:01:45 +02:00

Readd mc-4 fix

This commit is contained in:
Owen1212055 2022-06-11 10:41:59 +02:00 committed by Nassim Jahnke
parent c80df849c2
commit 1ccff4f5d1
No known key found for this signature in database
GPG key ID: 6BE3B555EBC5982B
368 changed files with 71 additions and 89 deletions
patches
removed/1.19
server
0543-MC-4-Fix-item-position-desync.patch0544-Additional-Block-Material-API-s.patch0545-Fix-harming-potion-dupe.patch0546-Implement-API-to-get-Material-from-Boats-and-Minecar.patch0547-Cache-burn-durations.patch0548-Allow-disabling-mob-spawner-spawn-egg-transformation.patch0549-Fix-Not-a-string-Map-Conversion-spam.patch0550-Implement-PlayerFlowerPotManipulateEvent.patch0551-Fix-interact-event-not-being-called-in-adventure.patch0552-Zombie-API-breaking-doors.patch0553-Fix-nerfed-slime-when-splitting.patch0554-Add-EntityLoadCrossbowEvent.patch0555-Guardian-beam-workaround.patch0556-Added-WorldGameRuleChangeEvent.patch0557-Added-ServerResourcesReloadedEvent.patch0558-Added-world-settings-for-mobs-picking-up-loot.patch0559-Implemented-BlockFailedDispenseEvent.patch0560-Added-PlayerLecternPageChangeEvent.patch0561-Added-PlayerLoomPatternSelectEvent.patch0562-Configurable-door-breaking-difficulty.patch0563-Empty-commands-shall-not-be-dispatched.patch0564-Implement-API-to-expose-exact-interaction-point.patch0565-Remove-stale-POIs.patch0566-Fix-villager-boat-exploit.patch0567-Add-sendOpLevel-API.patch0568-Add-PaperRegistry.patch0569-Add-StructuresLocateEvent.patch0570-Collision-option-for-requiring-a-player-participant.patch0571-Remove-ProjectileHitEvent-call-when-fireballs-dead.patch0572-Return-chat-component-with-empty-text-instead-of-thr.patch0573-Make-schedule-command-per-world.patch0574-Configurable-max-leash-distance.patch0575-Implement-BlockPreDispenseEvent.patch0576-Added-firing-of-PlayerChangeBeaconEffectEvent.patch0577-Add-toggle-for-always-placing-the-dragon-egg.patch0578-Added-PlayerStonecutterRecipeSelectEvent.patch0579-Add-dropLeash-variable-to-EntityUnleashEvent.patch0580-Reset-shield-blocking-on-dimension-change.patch0581-add-DragonEggFormEvent.patch0582-EntityMoveEvent.patch0583-added-option-to-disable-pathfinding-updates-on-block.patch0584-Inline-shift-direction-fields.patch0585-Allow-adding-items-to-BlockDropItemEvent.patch0586-Add-getMainThreadExecutor-to-BukkitScheduler.patch0587-living-entity-allow-attribute-registration.patch0588-fix-dead-slime-setSize-invincibility.patch0589-Merchant-getRecipes-should-return-an-immutable-list.patch0590-Add-support-for-hex-color-codes-in-console.patch0591-Expose-Tracked-Players.patch0592-Remove-streams-from-SensorNearest.patch0593-Throw-proper-exception-on-empty-JsonList-file.patch0594-Improve-ServerGUI.patch0595-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch0596-fix-converting-txt-to-json-file.patch0597-Add-worldborder-events.patch0598-added-PlayerNameEntityEvent.patch0599-Prevent-grindstones-from-overstacking-items.patch0600-Add-recipe-to-cook-events.patch0601-Add-Block-isValidTool.patch0602-Allow-using-signs-inside-spawn-protection.patch0603-Expand-world-key-API.patch0604-Add-fast-alternative-constructor-for-Rotations.patch0605-Item-Rarity-API.patch0606-Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch0607-copy-TESign-isEditable-from-snapshots.patch0608-Drop-carried-item-when-player-has-disconnected.patch0609-forced-whitelist-use-configurable-kick-message.patch0610-Don-t-ignore-result-of-PlayerEditBookEvent.patch0611-Entity-load-save-limit-per-chunk.patch0612-Expose-protocol-version.patch0613-Allow-for-Component-suggestion-tooltips-in-AsyncTabC.patch0614-Enhance-console-tab-completions-for-brigadier-comman.patch0615-Fix-PlayerItemConsumeEvent-cancelling-properly.patch0616-Add-bypass-host-check.patch0617-Set-area-affect-cloud-rotation.patch0618-add-isDeeplySleeping-to-HumanEntity.patch0619-add-consumeFuel-to-FurnaceBurnEvent.patch0620-add-get-set-drop-chance-to-EntityEquipment.patch0621-fix-PigZombieAngerEvent-cancellation.patch0622-Fix-checkReach-check-for-Shulker-boxes.patch0623-fix-PlayerItemHeldEvent-firing-twice.patch0624-Added-PlayerDeepSleepEvent.patch0625-More-World-API.patch0626-Added-PlayerBedFailEnterEvent.patch0627-Implement-methods-to-convert-between-Component-and-B.patch0628-Fix-anchor-respawn-acting-as-a-bed-respawn-from-the-.patch0629-Introduce-beacon-activation-deactivation-events.patch0630-add-RespawnFlags-to-PlayerRespawnEvent.patch0631-Add-Channel-initialization-listeners.patch0632-Send-empty-commands-if-tab-completion-is-disabled.patch0633-Add-more-WanderingTrader-API.patch0634-Add-EntityBlockStorage-clearEntities.patch0635-Add-Adventure-message-to-PlayerAdvancementDoneEvent.patch0636-Add-raw-address-to-AsyncPlayerPreLoginEvent.patch0637-Inventory-close.patch0638-call-PortalCreateEvent-players-and-end-platform.patch0639-Add-a-should-burn-in-sunlight-API-for-Phantoms-and-S.patch0640-Fix-CraftPotionBrewer-cache.patch0641-Add-basic-Datapack-API.patch

View file

@ -1,67 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 8 Dec 2020 20:24:52 -0600
Subject: [PATCH] MC-4: Fix item position desync
This fixes item position desync (MC-4) by running the item coordinates
through the encode/decode methods of the packet that causes the precision
loss, which forces the server to lose the same precision as the client
keeping them in sync.
1.19: entity tracking position changes
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
index ccc60a5465efa2b71fc2593d75af62c0b64fe66c..1adbceadd5df96e17796561a40eb7b760493440e 100644
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
@@ -101,6 +101,11 @@ public class PaperConfig {
trackPluginScoreboards = getBoolean("settings.track-plugin-scoreboards", false);
}
+ public static boolean fixEntityPositionDesync = true;
+ private static void fixEntityPositionDesync() {
+ fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync);
+ }
+
public static void registerCommands() {
for (Map.Entry<String, Command> entry : commands.entrySet()) {
MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue());
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
index b30c08bfb8c55161543a4ef09f2e462e0a1fe4ae..ec93f5300cc7d423ec0d292f0f8443f900d72dab 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMoveEntityPacket.java
@@ -21,11 +21,11 @@ public abstract class ClientboundMoveEntityPacket implements Packet<ClientGamePa
protected final boolean hasPos;
public static long entityToPacket(double coord) {
- return Mth.lfloor(coord * 4096.0D);
+ return Mth.lfloor(coord * 4096.0D); // Paper - check ItemEntity#setPosRaw on update
}
public static double packetToEntity(long coord) {
- return (double)coord / 4096.0D;
+ return (double)coord / 4096.0D; // Paper - check ItemEntity#setPosRaw on update
}
public Vec3 updateEntityPosition(Vec3 orig) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 78dbc89bb247b2765bd2d7d81013d18dfe35539f..e53d8fe713a4c9920f40bf91d6453d36520b45f7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3802,6 +3802,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
// Paper end
+ // Paper start - fix MC-4
+ if (this instanceof ItemEntity) {
+ if (com.destroystokyo.paper.PaperConfig.fixEntityPositionDesync) {
+ // encode/decode from PacketPlayOutEntity
+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D);
+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D);
+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D);
+ }
+ }
+ // Paper end - fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);

View file

@ -0,0 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <blake.galbreath@gmail.com>
Date: Tue, 8 Dec 2020 20:24:52 -0600
Subject: [PATCH] MC-4: Fix item position desync
This fixes item position desync (MC-4) by running the item coordinates
through the encode/decode methods of the packet that causes the precision
loss, which forces the server to lose the same precision as the client
keeping them in sync.
diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
index 3768a71491ef7836b9739bdaec7a077c523dbacd..a57957ace1a72b3308487f180a366c3879eceb21 100644
--- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
+++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
@@ -8,11 +8,11 @@ public class VecDeltaCodec {
public Vec3 base = Vec3.ZERO; // Paper
private static long encode(double value) {
- return Mth.lfloor(value * 4096.0D);
+ return Mth.lfloor(value * 4096.0D); // Paper - check ItemEntity#setPosRaw on update
}
private static double decode(long value) {
- return (double)value / 4096.0D;
+ return (double)value / 4096.0D; // Paper - check ItemEntity#setPosRaw on update
}
public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6b49e66f0e45eb7ed525fe4314d2a9615212f7e4..4f9a5837d66c1940385e94f80d865cde1c4cf2a2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3888,6 +3888,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
// Paper end
+ // Paper start - fix MC-4
+ if (this instanceof ItemEntity) {
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) {
+ // encode/decode from PacketPlayOutEntity
+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D);
+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D);
+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D);
+ }
+ }
+ // Paper end - fix MC-4
if (this.position.x != x || this.position.y != y || this.position.z != z) {
this.position = new Vec3(x, y, z);
int i = Mth.floor(x);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Collision option for requiring a player participant
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6b49e66f0e45eb7ed525fe4314d2a9615212f7e4..7634e8a8859f6fbf68cc3f62c698ecb84264f9c0 100644
index 4f9a5837d66c1940385e94f80d865cde1c4cf2a2..db6be2d9144fb1da9583833849f7b5518402c26d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1714,6 +1714,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

Some files were not shown because too many files have changed in this diff Show more