mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
unified use of block / localBlock like it is in Hammer.
block harvesting is in own method in HarvestTool except the scythe. fix for some blocks drop nothing or not breaking at all. fix for dropping exp with silktouch.
This commit is contained in:
1 parent
e3aeca1a91
commit
e9822db594
5 files changed
+51
-89
No files matched your search
@@ -169,6 +169,7 @@ public class Scythe extends Weapon
|
||||
return false;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
boolean butter = EnchantmentHelper.getEnchantmentLevel(Enchantment.silkTouch.effectId, stack) > 0;
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
for (int xPos = x - 1; xPos <= x + 1; xPos++)
|
||||
{
|
||||
for (int yPos = y - 1; yPos <= y + 1; yPos++)
|
||||
@@ -222,12 +223,26 @@ public class Scythe extends Weapon
|
||||
}
|
||||
else
|
||||
{
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos))
|
||||
if (!world.isRemote)
|
||||
{
|
||||
// Workaround for dropping experience
|
||||
int exp = localBlock.getExpDrop(world, localMeta, fortune);
|
||||
|
||||
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (localBlock.removedByPlayer(world, player, xPos, yPos, zPos, true))
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
// Workaround for dropping experience
|
||||
if (!butter)
|
||||
localBlock.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
localBlock.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
}
|
||||
localBlock.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
localBlock.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user