Skip to content

Commit

Permalink
AOE Tools now only break up to 10x harder blocks with it. (Yes, 10. b…
Browse files Browse the repository at this point in the history
…elieve me, you wouldn't like any lower value.)

That mean stone breaking obsidian is not a thing anymore
  • Loading branch information
bonii-xx committed Oct 6, 2014
1 parent 92a1948 commit bb65293
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/library/tools/AOEHarvestTool.java
Expand Up @@ -82,7 +82,7 @@ public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPla
// don't break the originally already broken block, duh
if (xPos == x && yPos == y && zPos == z)
continue;
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player);
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player, x,y,z);
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/main/java/tconstruct/library/tools/HarvestTool.java
Expand Up @@ -221,7 +221,7 @@ public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int
return used;
}

protected void breakExtraBlock(World world, int x, int y, int z, int sidehit, EntityPlayer player) {
protected void breakExtraBlock(World world, int x, int y, int z, int sidehit, EntityPlayer player, int refX, int refY, int refZ) {
// prevent calling that stuff for air blocks, could lead to unexpected behaviour since it fires events
if (world.isAirBlock(x, y, z))
return;
Expand All @@ -235,8 +235,13 @@ protected void breakExtraBlock(World world, int x, int y, int z, int sidehit, En
if (!isEffective(block, meta))
return;

Block refBlock = world.getBlock(refX, refY, refZ);
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
float strength = ForgeHooks.blockStrength(block, player, world, x,y,z);
float foo = refStrength/strength;

This comment has been minimized.

Copy link
@squeek502

squeek502 Oct 6, 2014

Contributor

Biggest bug in the universe alert: unused variable

This comment has been minimized.

Copy link
@bonii-xx

bonii-xx Oct 6, 2014

Author Contributor

Obligatory debug variable!

This comment has been minimized.

Copy link
@squeek502

squeek502 Oct 6, 2014

Contributor

Ctrl + Shift + D is your friend (in Eclipse); it'll show the result of evaluating the selected code.

This comment has been minimized.

Copy link
@bonii-xx

bonii-xx Oct 6, 2014

Author Contributor

IDEA does that without any commands. It got quite awesome, non-intrusive background code checking. ;)


// only harvestable blocks that aren't impossibly slow to harvest
if (!ForgeHooks.canHarvestBlock(block, player, meta) || ForgeHooks.blockStrength(block, player, world, x, y, z) <= 0.0001f)
if (!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength/strength > 10f)
return;

if (player.capabilities.isCreativeMode) {
Expand Down

0 comments on commit bb65293

Please sign in to comment.