No Tree Punching

No Tree Punching

14M Downloads

Tool tiers seem to be ignored when installing this mod

Xitric opened this issue ยท 2 comments

commented

I noticed that when using this mod, I am able to mine any tier of ore using any tier of pickaxe. For instance, the flint pickaxe can successfully mine diamond ore. I think this is a little odd in terms of progression.

Is this behavior by design, or is it a bug?
Is there any way that I can make the mod respect tool tiers?

Environment
Mod version: notreepunching-fabric-1.18.2-5.0.3
Mod configuration: Default, freshly installed mod
Fabric version: 0.14.9
Game version: 1.18.2
Other mods installed: fabric-api-0.58.0+1.18.2

commented

Just took a look at the source code. The behavior is caused by the expression used to determine harvestability of blocks:

public static boolean modifyHarvestCheck(Player player, BlockState state, @Nullable BlockPos pos, boolean canHarvest)
{
return canHarvest || HarvestBlockHandler.isUsingCorrectToolForDrops(state, pos, player);
}

The OR operator essentially causes this mod to expand on when a block is considered harvestable compared to vanilla, while an AND operator would be restricting it further.

If this is by design, then it is perfectly fine. In that case I will simply use a fork of the mod for my personal mod pack - the rest of the features are great!

commented

Yes it's a bug, but you have the wrong reason. That canHarvest is the result of, in vanilla,

!blockState.requiresCorrectToolForDrops() || this.inventory.getSelected().isCorrectToolForDrops(blockState);

In NTP, the requiresCorrectToolForDrops() is set to true for all blocks (unlike vanilla), so it falls back to isCorrectToolForDrops, which only will return true for pickaxe-able blocks, shear-able blocks (cobweb, tripwire, redstone), and sword items (cobweb). Simply changing that to an && would mean blocks outside of this very narrow category would be impossible to harvest (i.e. every single block made out of wood, in vanilla, never reports it's using the correct tool, because it doesn't need one).