3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00

Fix looting enchant using wrong variable

Dieser Commit ist enthalten in:
md_5 2016-10-10 17:02:49 +11:00
Ursprung 70aace0312
Commit 744e1a177a

Datei anzeigen

@ -123,7 +123,7 @@
} }
} }
@@ -192,13 +251,81 @@ @@ -192,13 +251,80 @@
} }
public boolean breakBlock(BlockPosition blockposition) { public boolean breakBlock(BlockPosition blockposition) {
@ -159,8 +159,7 @@
+ if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.hasBlock(nmsBlock.getBlockData())) { + if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.hasBlock(nmsBlock.getBlockData())) {
+ // Copied from block.a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) + // Copied from block.a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity)
+ // PAIL: checkme each update + // PAIL: checkme each update
+ if (!(nmsBlock.p() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0)) { + if (!(nmsBlock.o() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0)) {
+ int data = block.getData();
+ int bonusLevel = EnchantmentManager.getEnchantmentLevel(Enchantments.LOOT_BONUS_BLOCKS, itemstack); + int bonusLevel = EnchantmentManager.getEnchantmentLevel(Enchantments.LOOT_BONUS_BLOCKS, itemstack);
+ +
+ event.setExpToDrop(nmsBlock.getExpDrop(this.world, nmsData, bonusLevel)); + event.setExpToDrop(nmsBlock.getExpDrop(this.world, nmsData, bonusLevel));
@ -206,7 +205,7 @@
if ((block instanceof BlockCommand || block instanceof BlockStructure) && !this.player.dh()) { if ((block instanceof BlockCommand || block instanceof BlockStructure) && !this.player.dh()) {
this.world.notify(blockposition, iblockdata, iblockdata, 3); this.world.notify(blockposition, iblockdata, iblockdata, 3);
return false; return false;
@@ -243,6 +370,12 @@ @@ -243,6 +369,12 @@
} }
} }
@ -219,7 +218,7 @@
return flag; return flag;
} }
} }
@@ -283,7 +416,13 @@ @@ -283,7 +415,13 @@
} }
} }
@ -233,7 +232,7 @@
if (this.gamemode == EnumGamemode.SPECTATOR) { if (this.gamemode == EnumGamemode.SPECTATOR) {
TileEntity tileentity = world.getTileEntity(blockposition); TileEntity tileentity = world.getTileEntity(blockposition);
@@ -340,6 +479,74 @@ @@ -340,6 +478,74 @@
} }
} }
} }