Fix looting enchant using wrong variable

This commit is contained in:
md_5 2016-10-10 17:02:49 +11:00
parent 70aace0312
commit 744e1a177a

View File

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