mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-14 01:14:18 +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
@@ -249,18 +249,16 @@ public class Battleaxe extends HarvestTool
|
||||
return false;
|
||||
|
||||
World world = player.worldObj;
|
||||
final Block wood = world.getBlock(x, y, z);
|
||||
final Block block = world.getBlock(x, y, z);
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
final int fortune = EnchantmentHelper.getFortuneModifier(player);
|
||||
for (int yPos = y + 1; yPos < y + 9; yPos++)
|
||||
{
|
||||
Block block = world.getBlock(x, yPos, z);
|
||||
if (!(tags.getBoolean("Broken")) && block != null && block.getMaterial() == Material.wood)
|
||||
Block localBlock = world.getBlock(x, yPos, z);
|
||||
if (!(tags.getBoolean("Broken")) && localBlock != null && localBlock.getMaterial() == Material.wood)
|
||||
{
|
||||
Block localblock = world.getBlock(x, yPos, z);
|
||||
int localMeta = world.getBlockMetadata(x, yPos, z);
|
||||
int hlvl = block.getHarvestLevel(meta);
|
||||
int hlvl = localBlock.getHarvestLevel(localMeta);
|
||||
|
||||
if (hlvl <= tags.getInteger("HarvestLevel"))
|
||||
{
|
||||
@@ -273,23 +271,12 @@ public class Battleaxe extends HarvestTool
|
||||
|
||||
if (!cancelHarvest)
|
||||
{
|
||||
if (block != null && block.getMaterial() == Material.wood)
|
||||
if (localBlock != null && localBlock.getMaterial() == Material.wood)
|
||||
{
|
||||
localMeta = world.getBlockMetadata(x, yPos, z);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (block.removedByPlayer(world, player, x, yPos, z))
|
||||
{
|
||||
block.onBlockDestroyedByPlayer(world, x, yPos, z, localMeta);
|
||||
}
|
||||
|
||||
// Workaround for dropping experience
|
||||
int exp = block.getExpDrop(world, localMeta, fortune);
|
||||
block.dropXpOnBlockBreak(world, x, y, z, exp);
|
||||
|
||||
block.harvestBlock(world, player, x, yPos, z, localMeta);
|
||||
block.onBlockHarvested(world, x, yPos, z, localMeta, player);
|
||||
onBlockDestroyed(stack, world, block, x, yPos, z, player);
|
||||
mineBlock(world, x, yPos, z, localMeta, player, localBlock);
|
||||
onBlockDestroyed(stack, world, localBlock, x, yPos, z, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -303,7 +290,7 @@ public class Battleaxe extends HarvestTool
|
||||
break;
|
||||
}
|
||||
if (!world.isRemote)
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(wood) + (meta << 12));
|
||||
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
|
||||
return super.onBlockStartBreak(stack, x, y, z, player);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user