Upstream update

This commit is contained in:
Aikar 2018-08-03 01:04:28 -04:00
parent dbde9e6332
commit 6b00d856be
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
8 changed files with 29 additions and 72 deletions

View File

@ -1,4 +1,4 @@
From 92a7df9172f5671afa9c3f2baa8c7652294f6134 Mon Sep 17 00:00:00 2001
From d00bbcd15ce5e4a064af3226369114aa8217a4aa Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:55:47 -0400
Subject: [PATCH] MC Utils
@ -54,7 +54,7 @@ index 9f3aa24590..7dbea90902 100644
return this.c(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 411ab6061b..cd4fbee0ca 100644
index 03c96de98b..2d06202da7 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -28,7 +28,7 @@ import com.google.common.collect.Lists; // CraftBukkit
@ -131,7 +131,7 @@ index ca2a14d7ac..9a513b4e3a 100644
private boolean c = true;
private boolean d = true;
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 0d26fc56dd..e7b5daf28e 100644
index 359979cc1c..0c54eaa529 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -26,6 +26,7 @@ import org.bukkit.TreeType;
@ -142,7 +142,7 @@ index 0d26fc56dd..e7b5daf28e 100644
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import org.bukkit.event.block.BlockFertilizeEvent;
@@ -555,6 +556,17 @@ public final class ItemStack {
@@ -561,6 +562,17 @@ public final class ItemStack {
return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList();
}

View File

@ -1,4 +1,4 @@
From 8a48c219a19b1af517a7c92351f522421411241a Mon Sep 17 00:00:00 2001
From b89cf5dd57e6e06e406830e4438f1e164c83d8a3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 28 May 2015 23:00:19 -0400
Subject: [PATCH] Handle Item Meta Inconsistencies
@ -18,7 +18,7 @@ For consistency, the old API methods now forward to use the
ItemMeta API equivalents, and should deprecate the old API's.
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index e7b5daf28e..6e7b2e721d 100644
index 0c54eaa529..c7ef9c6890 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader;
@ -61,7 +61,7 @@ index e7b5daf28e..6e7b2e721d 100644
this.getItem().a(this.tag);
// CraftBukkit end
}
@@ -569,6 +588,7 @@ public final class ItemStack {
@@ -575,6 +594,7 @@ public final class ItemStack {
// Paper end
public void setTag(@Nullable NBTTagCompound nbttagcompound) {
this.tag = nbttagcompound;
@ -69,7 +69,7 @@ index e7b5daf28e..6e7b2e721d 100644
}
public IChatBaseComponent getName() {
@@ -645,6 +665,7 @@ public final class ItemStack {
@@ -651,6 +671,7 @@ public final class ItemStack {
nbttagcompound.setString("id", String.valueOf(Enchantment.enchantments.b(enchantment)));
nbttagcompound.setShort("lvl", (short) ((byte) i));
nbttaglist.add((NBTBase) nbttagcompound);
@ -204,7 +204,7 @@ index f4672b9a48..e2699564af 100644
static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) {
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index f10de8550c..f21c1e846d 100644
index 5464923759..94b19d1095 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -8,12 +8,14 @@ import java.lang.reflect.Constructor;

View File

@ -1,4 +1,4 @@
From b3d7ede96e1be472691ae42cdcd99ffdf7e672d9 Mon Sep 17 00:00:00 2001
From 318d09c7f9f441287b02df9a29ba3e710836116c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 16:31:46 -0500
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
@ -186,10 +186,10 @@ index 4a128f707b..b870964674 100644
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index f455317eb6..55e45f84ca 100644
index 54ee305eba..6e524353b5 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -384,7 +384,7 @@ public class PlayerInteractManager {
@@ -385,7 +385,7 @@ public class PlayerInteractManager {
// CraftBukkit start - Drop event experience
if (flag && event != null) {

View File

@ -1,4 +1,4 @@
From c193383e12907fb2df80cbef83d0368fa99829d0 Mon Sep 17 00:00:00 2001
From 98c5390586b96cb1cd7ee97cc42abceed0d85e4e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 6 Nov 2017 21:08:22 -0500
Subject: [PATCH] API to get a BlockState without a snapshot
@ -39,10 +39,10 @@ index 6021a3401f..536fd37254 100644
return null;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index d6e4adf147..8cb08c5584 100644
index c48b394d52..7ccfa93b94 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -263,6 +263,20 @@ public class CraftBlock implements Block {
@@ -267,6 +267,20 @@ public class CraftBlock implements Block {
}
public BlockState getState() {

View File

@ -1,4 +1,4 @@
From fc10d576b3d09d06db5582b291dd01567dce5ed6 Mon Sep 17 00:00:00 2001
From 189ca2b6a44c55f33026500be2199f843abe2112 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Sun, 11 Feb 2018 10:43:46 +0000
Subject: [PATCH] Extend Player Interact cancellation
@ -13,65 +13,22 @@ Update adjacent blocks of doors, double plants, pistons and beds
when cancelling interaction.
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 55e45f84ca..e83b4fb4b0 100644
index 6e524353b5..4a439ef4ca 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -110,6 +110,7 @@ public class PlayerInteractManager {
@@ -110,6 +110,11 @@ public class PlayerInteractManager {
if (event.isCancelled()) {
// Let the client know the block still exists
((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
+ cancelBreakBlock(blockposition, this.world.getType(blockposition)); // Paper - Avoid visual issues on the client
+ // Paper start - brute force neighbor blocks for any attached blocks
+ for (EnumDirection dir : EnumDirection.values()) {
+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(dir)));
+ }
+ // Paper end
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(blockposition);
if (tileentity != null) {
@@ -249,6 +250,33 @@ public class PlayerInteractManager {
return flag;
}
+ // Paper start - Extra method to avoid visual issues on the client when cancelling block breaks
+ private void cancelBreakBlock(BlockPosition position, IBlockData data) {
+ Block block = data.getBlock();
+ // Send other half of the door
+ if (block instanceof BlockDoor) {
+ boolean bottom = data.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? position.up() : position.down()));
+ } else if (block instanceof BlockTallPlant) {
+ boolean bottom = data.get(BlockTallPlant.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? position.up() : position.down()));
+ } else if (block instanceof BlockPistonExtension) {
+ BlockPosition piston = position.shift(data.get(BlockPistonExtension.FACING).opposite());
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, piston));
+ } else if (block instanceof BlockBed) {
+ // Restore other half of bed
+ boolean foot = data.get(BlockBed.PART) == BlockPropertyBedPart.FOOT;
+ BlockPosition otherBlock = position.shift(foot ? data.get(BlockBed.FACING) : data.get(BlockBed.FACING).opposite());
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, otherBlock));
+
+ TileEntity tileentity = this.world.getTileEntity(otherBlock);
+ if (tileentity != null) {
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
+ }
+ }
+ }
+ // Paper end
+
public boolean breakBlock(BlockPosition blockposition) {
IBlockData iblockdata = this.world.getType(blockposition);
// CraftBukkit start - fire BlockBreakEvent
@@ -297,11 +325,7 @@ public class PlayerInteractManager {
}
// Let the client know the block still exists
((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
- // Send other half of the door
- if (nmsBlock instanceof BlockDoor) {
- boolean bottom = nmsData.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
- ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
- }
+ cancelBreakBlock(blockposition, nmsData); // Paper - Move cancellation code to extra "cancelBreakBlock" method
// Update any tile entity data for this block
TileEntity tileentity = this.world.getTileEntity(blockposition);
if (tileentity != null) {
@@ -459,7 +483,25 @@ public class PlayerInteractManager {
@@ -460,7 +465,25 @@ public class PlayerInteractManager {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
} else if (iblockdata.getBlock() instanceof BlockCake) {
((EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake

View File

@ -1,4 +1,4 @@
From 3413e0db563571a6aed48adddd2597b9aff71561 Mon Sep 17 00:00:00 2001
From 72c1b0bb47630ecb83b57985995078b808c6cbd3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Jun 2018 23:00:29 -0400
Subject: [PATCH] ItemStack#getMaxItemUseDuration
@ -6,10 +6,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration
Allows you to determine how long it takes to use a usable/consumable item
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 33e82f5377..0952bf0b82 100644
index 4f230975aa..e52014fd8f 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -516,6 +516,7 @@ public final class ItemStack {
@@ -522,6 +522,7 @@ public final class ItemStack {
this.getItem().b(this, world, entityhuman);
}

@ -1 +1 @@
Subproject commit 4e075fb1f1d195a006579b6d29023cdd9f47d29b
Subproject commit 14527e6623aa40fa6fbb74013cb16e8a6bfff737

@ -1 +1 @@
Subproject commit 2f17f677aae3db7e10ee61a676aa9aee01c30ecb
Subproject commit 69970127c11e52c579cc17d4ce263a344735940a