Skip to content

Commit

Permalink
AOE tools now behave like normal tools while sneaking.
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Sep 23, 2014
1 parent cb7ea6f commit 570edc8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/items/tools/LumberAxe.java
Expand Up @@ -85,7 +85,7 @@ public float stoneboundModifier ()
@Override
public boolean onBlockStartBreak (ItemStack stack, int x, int y, int z, EntityPlayer player)
{
if (!stack.hasTagCompound())
if (!stack.hasTagCompound() || player.isSneaking())
return super.onBlockStartBreak(stack, x, y, z, player);

World world = player.worldObj;
Expand Down
9 changes: 4 additions & 5 deletions src/main/java/tconstruct/library/tools/AOEHarvestTool.java
Expand Up @@ -24,10 +24,12 @@ public AOEHarvestTool(int baseDamage, int breakRadius, int breakDepth) {
this.breakDepth = breakDepth;
}

boolean antiRecurse;

@Override
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
// sneaking == regular blockbreak
if(player.isSneaking())
return super.onBlockStartBreak(stack, x,y,z, player);

// only effective materials matter. We don't want to aoe when beraking dirt with a hammer.
Block block = player.worldObj.getBlock(x,y,z);
int meta = player.worldObj.getBlockMetadata(x,y,z);
Expand All @@ -50,7 +52,6 @@ public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPla

// the code below initiates block breaks, which again call this function. But we don't want to do the aoe-break-stuff again. This is to prevent recursive, infinite-range aoe blockbreaking.
if(originalBlock || player.capabilities.isCreativeMode) {
antiRecurse = true;
MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(player.worldObj, player, false, 4.5d);
if(mop == null)
return super.onBlockStartBreak(stack, x,y,z, player);
Expand Down Expand Up @@ -87,8 +88,6 @@ public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPla
continue;
breakExtraBlock(player.worldObj, xPos, yPos, zPos, sideHit, player);
}

antiRecurse = false;
}


Expand Down

6 comments on commit 570edc8

@Vexatos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mDiyo wanted AOE tools to not be able to break single blocks as it removes the need for non-AOE tools entirely.

@TherminatorX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Vexatos Ex. If you have a hammer now, you will never need a pickax, and making pickaxes when you have materials for a hammer would make no sense.

@PrincessOfEvil
Copy link
Collaborator

@PrincessOfEvil PrincessOfEvil commented on 570edc8 Sep 27, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TherminatorX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 blocks per 3 sec is still faster than 1 block per 1 sec

@Vexatos
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TherminatorX It's the exact opposite: Adding this feature completely removes the need for any precision tool; it makes 50% of TCon tools unnecessary.

@PrincessOfEvil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually, i don't NEED 9 blocks mined. And when making tunnels, that's 1 block per 3 sec/1 block per 2/1 sec.

Please sign in to comment.