Don't merge player movements (fixes block breaking issues)

Fixes #1640
This commit is contained in:
Aikar 2018-11-03 00:18:10 -04:00
parent 450ed0d75c
commit 00a41bca42
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
2 changed files with 28 additions and 11 deletions

View File

@ -1,4 +1,4 @@
From 1e51c493238f91608639b9fb04b67737ff5b93e5 Mon Sep 17 00:00:00 2001
From a101ae9254d474be1b9817bb5970ca62414fcdcc Mon Sep 17 00:00:00 2001
From: MisterVector <whizkid3000@hotmail.com>
Date: Thu, 1 Nov 2018 14:50:05 -0700
Subject: [PATCH] MC-136865: Use valid item for enchantment checks on block
@ -13,24 +13,22 @@ keep the clone of the item used to a non empty value so it represents
the item used.
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 23fc4d8e14..dbbd1f3341 100644
index 23fc4d8e14..599bdf054f 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -378,8 +378,13 @@ public class PlayerInteractManager {
@@ -375,10 +375,11 @@ public class PlayerInteractManager {
ItemStack itemstack1 = this.player.getItemInMainHand();
boolean flag1 = this.player.hasBlock(iblockdata);
+ ItemStack itemstack2 = flag && flag1 && event.isDropItems() && !itemstack1.isEmpty() ? itemstack1.cloneItemStack() : null; // Paper - MC-136865 - clone before use
itemstack1.a(this.world, iblockdata, blockposition, this.player);
// CraftBukkit start - Check if block should drop items
if (flag && flag1 && event.isDropItems()) {
- ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack();
+ // Paper start - fixes MC-136865
+ ItemStack itemstack2 = itemstack1.cloneItemStack(true);
+ //ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack(); // Paper - MC-136865 - move up
+ if (itemstack2.isEmpty()) {
+ itemstack2.add(1);
+ }
+ // Paper end
iblockdata.getBlock().a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack2);
}
// CraftBukkit end
--
2.19.1

View File

@ -1,4 +1,4 @@
From ce3b80309494df7c3a3f9c288d3cfe5d07fd8fb3 Mon Sep 17 00:00:00 2001
From 57dd32ddf7eb78cbf184e12490e15445dc960f91 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 1 Nov 2018 19:45:51 -0400
Subject: [PATCH] Optimize Small Entity Movement
@ -130,6 +130,25 @@ index 86488e9709..e6348a2931 100644
protected void initAttributes() {
super.initAttributes();
this.getAttributeMap().b(GenericAttributes.e);
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 4490b63258..aa5b58066a 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1643,6 +1643,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.keepLevel = false;
}
+ // Paper start
+ @Override
+ public boolean shouldMergeMovement(double mergeMin, double d0, double d1, double d2) {
+ // We need precise movement for players
+ return false;
+ }
+ // Paper end
+
@Override
public CraftPlayer getBukkitEntity() {
return (CraftPlayer) super.getBukkitEntity();
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index e63f4afa9b..f1266c0ce1 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java