Mineshopper/carpentersblocks — pull request #66 by Reloque (2014-06-26 09:26:47+00:00)
Title: Adventure Mode Left-Click Functionality

The explanation in my commit for carpentersblocks.item.ItemCarpentersHammer is reproduced for convenience.
-------------------------------------------------
Warning: Giant Explanation Wall of Text

The problem with tools in adventure mode is that left click functionality was simply disabled. It took me about fifteen seconds to test this: open any world with cheats, place any form of carpenters block you are to test, hold a carpenter's hammer, /gamemode 2, and attempt to left-click/shift-left-click on the collapsible block. For comparison, /gamemode 1, and do the same thing. Then /gamemode 0 and do the same thing.

There are two ways to make tools work in adventure mode, defined in net.minecraft.entity.player.EntityPlayer.isCurrentToolAdventureModeExempt().
1)The tool efficiency is greater than 1.0f, the efficiency of the player's hand. This is how vanilla tools do it. Change tool efficiency via net.minecraft.item.Item.func_150893_a().
2)The tool returns true when passed the block in question to net.minecraft.item.Item.canHarvestBlock(). Since Carpenter's Blocks tools do not have an efficiency, this is the venue to pursue Adventure Mode support.

By default, net.minecraft.item.Item.canHarvestBlock(Block blockToBeHarvested, ItemStack itemStackBeingUsed) simply drops the itemstack and calls net.minecraft.item.Item.func_150897_b(Block blockToBeHarvested). So really overriding either of those functions could do, but we don't really need the itemStackBeingUsed.

*NOTE* By default, func_150897_b() unconditionally returns false.

I didn't look too far into it, but it seems like all of the blocks a Carpenter's Blocks tool is useful for extend carpentersblocks.block.BlockCoverable. The solution is really straightforward, and works well in my dev environment.

-Reloque