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 219649aa3d
commit 93e5439f96
2 changed files with 25 additions and 8 deletions

View file

@ -13,22 +13,20 @@ 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
@@ -0,0 +0,0 @@ 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
--

View file

@ -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
@@ -0,0 +0,0 @@ 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