Update to Minecraft 1.15

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2019-12-11 09:00:00 +11:00
parent 1400103b2f
commit 0e142c7f03
293 changed files with 2875 additions and 2648 deletions

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/server/PlayerInteractManager.java
+++ b/net/minecraft/server/PlayerInteractManager.java
@@ -2,6 +2,15 @@
@@ -3,6 +3,15 @@
import java.util.Objects;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
@@ -16,7 +16,7 @@
public class PlayerInteractManager {
@@ -30,7 +39,7 @@
@@ -31,7 +40,7 @@
this.gamemode = enumgamemode;
enumgamemode.a(this.player.abilities);
this.player.updateAbilities();
@@ -25,7 +25,7 @@
this.world.everyoneSleeping();
}
@@ -55,7 +64,7 @@
@@ -56,7 +65,7 @@
}
public void a() {
@@ -34,13 +34,13 @@
IBlockData iblockdata;
if (this.i) {
@@ -111,9 +120,31 @@
@@ -112,9 +121,31 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.world.a((EntityHuman) this.player, blockposition)) {
+ // CraftBukkit start - fire PlayerInteractEvent
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false));
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, "may not interact"));
+ // Update any tile entity data for this block
+ TileEntity tileentity = world.getTileEntity(blockposition);
+ if (tileentity != null) {
@@ -66,7 +66,7 @@
if (this.isCreative()) {
if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) {
@@ -130,15 +161,49 @@
@@ -131,16 +162,50 @@
return;
}
@@ -94,8 +94,8 @@
f = iblockdata.getDamage(this.player, this.player.world, blockposition);
+ // Allow fire punching to be blocked
+ this.world.douseFire((EntityHuman) null, blockposition, enumdirection);
+ }
+
}
+ if (event.useItemInHand() == Event.Result.DENY) {
+ // If we 'insta destroyed' then the client needs to be informed.
+ if (f > 1.0f) {
@@ -113,16 +113,17 @@
+
+ if (blockEvent.getInstaBreak()) {
+ f = 2.0f;
}
+ }
+ // CraftBukkit end
+
if (!iblockdata.isAir() && f >= 1.0F) {
this.a(blockposition, packetplayinblockdig_enumplayerdigtype);
@@ -189,17 +254,73 @@
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
} else {
@@ -200,17 +265,73 @@
if (this.breakBlock(blockposition)) {
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true));
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
} else {
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false));
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, s));
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // CraftBukkit - SPIGOT-5196
}
@@ -194,7 +195,7 @@
TileEntity tileentity = this.world.getTileEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -209,6 +330,10 @@
@@ -220,6 +341,10 @@
} else if (this.player.a((World) this.world, blockposition, this.gamemode)) {
return false;
} else {
@@ -205,7 +206,7 @@
block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player);
boolean flag = this.world.a(blockposition, false);
@@ -217,20 +342,33 @@
@@ -228,19 +353,32 @@
}
if (this.isCreative()) {
@@ -213,13 +214,12 @@
+ // return true; // CraftBukkit
} else {
ItemStack itemstack = this.player.getItemInMainHand();
ItemStack itemstack1 = itemstack.cloneItemStack();
boolean flag1 = this.player.hasBlock(iblockdata);
itemstack.a(this.world, iblockdata, blockposition, this.player);
- if (flag && flag1) {
+ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
ItemStack itemstack1 = itemstack.isEmpty() ? ItemStack.a : itemstack.cloneItemStack();
block.a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack1);
}
@@ -242,7 +242,7 @@
}
}
}
@@ -272,12 +410,40 @@
@@ -282,12 +420,40 @@
}
}
@@ -283,27 +283,30 @@
if (itileinventory != null) {
entityhuman.openContainer(itileinventory);
@@ -289,24 +455,26 @@
boolean flag = !entityhuman.getItemInMainHand().isEmpty() || !entityhuman.getItemInOffHand().isEmpty();
boolean flag1 = entityhuman.isSneaking() && flag;
@@ -300,29 +466,29 @@
boolean flag1 = entityhuman.dT() && flag;
- if (!flag1 && iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock)) {
- return EnumInteractionResult.SUCCESS;
- } else if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) {
+ if (!flag1) {
+ enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.FAIL;
+ }
+
if (!flag1) {
- EnumInteractionResult enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock);
+ enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock);
if (enuminteractionresult.a()) {
return enuminteractionresult;
}
}
- if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) {
+ if (!itemstack.isEmpty() && enuminteractionresult != EnumInteractionResult.SUCCESS && !interactResult) { // add !interactResult SPIGOT-764
ItemActionContext itemactioncontext = new ItemActionContext(entityhuman, enumhand, movingobjectpositionblock);
if (this.isCreative()) {
int i = itemstack.getCount();
- EnumInteractionResult enuminteractionresult = itemstack.placeItem(itemactioncontext);
- EnumInteractionResult enuminteractionresult1 = itemstack.placeItem(itemactioncontext);
+ enuminteractionresult = itemstack.placeItem(itemactioncontext, enumhand);
itemstack.setCount(i);
return enuminteractionresult;
- return enuminteractionresult1;
+ return enuminteractionresult;
} else {
- return itemstack.placeItem(itemactioncontext);
+ return itemstack.placeItem(itemactioncontext, enumhand);