Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -28,6 +28,27 @@
@@ -26,6 +26,27 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
@@ -28,7 +28,7 @@
public class PlayerInteractManager {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -58,9 +79,16 @@
@@ -56,9 +77,16 @@
if (enumgamemode == this.gameModeForPlayer) {
return false;
} else {
@@ -46,7 +46,7 @@
this.level.updateSleepingPlayerList();
if (enumgamemode == EnumGamemode.CREATIVE) {
this.player.resetCurrentImpulseContext();
@@ -94,7 +122,7 @@
@@ -92,7 +120,7 @@
}
public void tick() {
@@ -55,7 +55,7 @@
IBlockData iblockdata;
if (this.hasDelayedDestroy) {
@@ -148,11 +176,33 @@
@@ -146,11 +174,33 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.level.mayInteract(this.player, blockposition)) {
@@ -89,7 +89,7 @@
if (this.isCreative()) {
this.destroyAndAck(blockposition, j, "creative destroy");
return;
@@ -168,7 +218,19 @@
@@ -166,7 +216,19 @@
float f = 1.0F;
iblockdata = this.level.getBlockState(blockposition);
@@ -110,7 +110,7 @@
EnchantmentManager.onHitBlock(this.level, this.player.getMainHandItem(), this.player, this.player, EnumItemSlot.MAINHAND, Vec3D.atCenterOf(blockposition), iblockdata, (item) -> {
this.player.onEquippedItemBroken(item, EnumItemSlot.MAINHAND);
});
@@ -176,6 +238,26 @@
@@ -174,6 +236,26 @@
f = iblockdata.getDestroyProgress(this.player, this.player.level(), blockposition);
}
@@ -137,7 +137,7 @@
if (!iblockdata.isAir() && f >= 1.0F) {
this.destroyAndAck(blockposition, j, "insta mine");
} else {
@@ -220,13 +302,15 @@
@@ -218,13 +300,15 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
if (!Objects.equals(this.destroyPos, blockposition)) {
@@ -154,7 +154,7 @@
}
}
@@ -244,10 +328,65 @@
@@ -242,10 +326,65 @@
public boolean destroyBlock(BlockPosition blockposition) {
IBlockData iblockdata = this.level.getBlockState(blockposition);
@@ -221,7 +221,7 @@
TileEntity tileentity = this.level.getBlockEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -257,6 +396,10 @@
@@ -255,6 +394,10 @@
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
return false;
} else {
@@ -232,7 +232,7 @@
IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
boolean flag = this.level.removeBlock(blockposition, false);
@@ -265,19 +408,32 @@
@@ -263,19 +406,32 @@
}
if (this.isCreative()) {
@@ -268,7 +268,7 @@
}
}
}
@@ -315,14 +471,53 @@
@@ -321,14 +477,53 @@
}
}
@@ -290,7 +290,7 @@
+ cancelledBlock = !(itileinventory instanceof ITileInventory);
+ }
+
+ if (entityplayer.getCooldowns().isOnCooldown(itemstack.getItem())) {
+ if (entityplayer.getCooldowns().isOnCooldown(itemstack)) {
+ cancelledBlock = true;
+ }
+
@@ -322,11 +322,11 @@
if (itileinventory != null) {
entityplayer.openMenu(itileinventory);
@@ -353,7 +548,7 @@
@@ -359,7 +554,7 @@
}
}
- if (!itemstack.isEmpty() && !entityplayer.getCooldowns().isOnCooldown(itemstack.getItem())) {
- if (!itemstack.isEmpty() && !entityplayer.getCooldowns().isOnCooldown(itemstack)) {
+ if (!itemstack.isEmpty() && !interactResult) { // add !interactResult SPIGOT-764
ItemActionContext itemactioncontext = new ItemActionContext(entityplayer, enumhand, movingobjectpositionblock);