Update to Minecraft 1.18.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-03-01 02:00:00 +11:00
parent bd40300a4f
commit 9ee989ea81
184 changed files with 1785 additions and 1785 deletions

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -24,6 +24,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -26,6 +26,27 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
@@ -27,8 +27,8 @@
+
public class PlayerInteractManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -54,6 +75,13 @@
private static final Logger LOGGER = LogUtils.getLogger();
@@ -56,6 +77,13 @@
if (enumgamemode == this.gameModeForPlayer) {
return false;
} else {
@@ -42,7 +42,7 @@
this.setGameModeForPlayer(enumgamemode, this.gameModeForPlayer);
return true;
}
@@ -64,7 +92,7 @@
@@ -66,7 +94,7 @@
this.gameModeForPlayer = enumgamemode;
enumgamemode.updatePlayerAbilities(this.player.getAbilities());
this.player.onUpdateAbilities();
@@ -51,7 +51,7 @@
this.level.updateSleepingPlayerList();
}
@@ -86,7 +114,7 @@
@@ -88,7 +116,7 @@
}
public void tick() {
@@ -60,7 +60,7 @@
IBlockData iblockdata;
if (this.hasDelayedDestroy) {
@@ -142,10 +170,32 @@
@@ -152,10 +180,32 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.level.mayInteract(this.player, blockposition)) {
@@ -93,11 +93,11 @@
if (this.isCreative()) {
this.destroyAndAck(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
return;
@@ -160,11 +210,43 @@
@@ -170,11 +220,43 @@
float f = 1.0F;
iblockdata = this.level.getBlockState(blockposition);
- if (!iblockdata.isAir()) {
iblockdata1 = this.level.getBlockState(blockposition);
- if (!iblockdata1.isAir()) {
+ // CraftBukkit start - Swings at air do *NOT* exist.
+ if (event.useInteractedBlock() == Event.Result.DENY) {
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
@@ -110,9 +110,9 @@
+ } else if (data.getBlock() instanceof BlockTrapdoor) {
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
+ }
+ } else if (!iblockdata.isAir()) {
iblockdata.attack(this.level, blockposition, this.player);
f = iblockdata.getDestroyProgress(this.player, this.player.level, blockposition);
+ } else if (!iblockdata1.isAir()) {
iblockdata1.attack(this.level, blockposition, this.player);
f = iblockdata1.getDestroyProgress(this.player, this.player.level, blockposition);
}
+ if (event.useItemInHand() == Event.Result.DENY) {
@@ -135,10 +135,10 @@
+ }
+ // CraftBukkit end
+
if (!iblockdata.isAir() && f >= 1.0F) {
if (!iblockdata1.isAir() && f >= 1.0F) {
this.destroyAndAck(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
} else {
@@ -208,13 +290,15 @@
@@ -218,13 +300,15 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
if (!Objects.equals(this.destroyPos, blockposition)) {
@@ -155,7 +155,7 @@
}
}
@@ -224,17 +308,72 @@
@@ -234,17 +318,72 @@
if (this.destroyBlock(blockposition)) {
this.player.connection.send(new PacketPlayOutBlockBreak(blockposition, this.level.getBlockState(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
} else {
@@ -230,7 +230,7 @@
TileEntity tileentity = this.level.getBlockEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -244,6 +383,10 @@
@@ -254,6 +393,10 @@
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
return false;
} else {
@@ -241,7 +241,7 @@
block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
boolean flag = this.level.removeBlock(blockposition, false);
@@ -252,19 +395,32 @@
@@ -262,19 +405,32 @@
}
if (this.isCreative()) {
@@ -277,7 +277,7 @@
}
}
}
@@ -306,12 +462,52 @@
@@ -316,12 +472,52 @@
}
}
@@ -330,7 +330,7 @@
if (itileinventory != null) {
entityplayer.openMenu(itileinventory);
@@ -325,7 +521,7 @@
@@ -335,7 +531,7 @@
ItemStack itemstack1 = itemstack.copy();
if (!flag1) {
@@ -339,7 +339,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.ITEM_USED_ON_BLOCK.trigger(entityplayer, blockposition, itemstack1);
@@ -333,17 +529,17 @@
@@ -343,17 +539,17 @@
}
}
@@ -360,7 +360,7 @@
}
if (enuminteractionresult1.consumesAction()) {
@@ -351,10 +547,10 @@
@@ -361,10 +557,10 @@
}
return enuminteractionresult1;