mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +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
@@ -185,7 +185,6 @@ public class Excavator extends HarvestTool
|
||||
break;
|
||||
}
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
for (int xPos = x - xRange; xPos <= x + xRange; xPos++)
|
||||
{
|
||||
for (int yPos = y - yRange; yPos <= y + yRange; yPos++)
|
||||
@@ -194,11 +193,10 @@ public class Excavator extends HarvestTool
|
||||
{
|
||||
if (!(tags.getBoolean("Broken")))
|
||||
{
|
||||
Block localblock = world.getBlock(xPos, yPos, zPos);
|
||||
block = localblock;
|
||||
Block localBlock = world.getBlock(xPos, yPos, zPos);
|
||||
int localMeta = world.getBlockMetadata(xPos, yPos, zPos);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
float localHardness = block == null ? Float.MAX_VALUE : block.getBlockHardness(world, xPos, yPos, zPos);
|
||||
int hlvl = localBlock.getHarvestLevel(localMeta);
|
||||
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, xPos, yPos, zPos);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel") && localHardness - 1.5 <= blockHardness)
|
||||
{
|
||||
@@ -211,27 +209,17 @@ public class Excavator extends HarvestTool
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && !(localHardness < 0))
|
||||
if (localBlock != null && !(localHardness < 0))
|
||||
{
|
||||
for (int iter = 0; iter < materials.length; iter++)
|
||||
{
|
||||
if (materials[iter] == block.getMaterial())
|
||||
if (materials[iter] == localBlock.getMaterial())
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (block.removedByPlayer(world, player, xPos, yPos, zPos))
|
||||
{
|
||||
block.onBlockDestroyedByPlayer(world, xPos, yPos, zPos, localMeta);
|
||||
}
|
||||
|
||||
// Workaround for dropping experience
|
||||
int exp = block.getExpDrop(world, localMeta, fortune);
|
||||
block.dropXpOnBlockBreak(world, xPos, yPos, zPos, exp);
|
||||
|
||||
block.harvestBlock(world, player, xPos, yPos, zPos, localMeta);
|
||||
block.onBlockHarvested(world, xPos, yPos, zPos, localMeta, player);
|
||||
if (blockHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localblock, xPos, yPos, zPos, player);
|
||||
mineBlock(world, xPos, yPos, zPos, localMeta, player, localBlock);
|
||||
if (localHardness > 0f)
|
||||
onBlockDestroyed(stack, world, localBlock, xPos, yPos, zPos, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user