Increase diff stability

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-09-22 02:57:13 +10:00
parent 8a3c8cfcd4
commit e903417936
27 changed files with 162 additions and 170 deletions

View File

@@ -158,7 +158,8 @@
+ // CraftBukkit start - fire BlockBreakEvent
+ org.bukkit.block.Block bblock = CraftBlock.at(level, blockposition);
+ BlockBreakEvent event = null;
+
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
+ if (this.player instanceof EntityPlayer) {
+ // Sword + Creative mode pre-cancel
+ boolean isSwordNoBreak = !this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player);
@@ -193,8 +194,7 @@
+ }
+ // Let the client know the block still exists
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
+
+ // Brute force all possible updates
+ for (EnumDirection dir : EnumDirection.values()) {
+ this.player.connection.send(new PacketPlayOutBlockChange(level, blockposition.relative(dir)));
@@ -252,13 +252,13 @@
+ // CraftBukkit start
+ if (event.isDropItems()) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
}
+ }
+ level.captureDrops = null;
+
+ // Drop event experience
+ if (flag && event != null) {
+ iblockdata.getBlock().popExperience(this.level, blockposition, event.getExpToDrop());
+ }
}
+
+ return true;
+ // CraftBukkit end