Enchantments (specifically silk touch) Not Being Respected

Issue #15 resolved
FenixFyreX created an issue

I've tried every vanilla pick with silk touch applied and it doesn't activate / work when any effortless building mode is active. This is using the latest release, not a dev build. I can see this mitigated two different ways:

  • Instead of setting the block state in the IBlockAccess as you are now, check if there is a tool in hand and use Item#onItemUse. This would require a bit of a rewrite, but ultimately would fix any incompatibility issues on placement / destruction from here on out.

  • or, simply check both hands for enchantments and apply them.

Any ideas / thoughts?

Comments (4)

  1. Requios repo owner

    Item#onItemUse is for rightclicking items, not harvesting. Block#harvestBlock exists which does take into account enchantments but drops the blocks in the world at the block position. So far the mod drops blocks directly into the player inventory, ideally I want to keep it that way.

    But I will use that for now and not drop it straight into the inventory, for compatibility's sake (e.g. shearing leaves, dropping tile entities like beds and banners, etc). Maybe I'll vacuum the item entities towards the player in the future, but that's too much work for now.

    Btw, no need to check both hands for enchantments, tools only work in the main hand in vanilla.

    Thanks for testing my mod btw. The most important thing I need right now is beta testers that search for bugs. Oh and I also could use some help with ArchitectureCraft and BlockCraftery compatibility. You could look into that if you want.

  2. FenixFyreX reporter

    Sorry, I meant to say use Item#onItemUse to place blocks if its either a ItemBlock or whitelisted item, like the Randomizer Bag or dank null, etc. And I realized my mistake of suggesting a right click method for harvesting all too late >.<

    Either way, I am glad to be of service, and hope I'm not overstepping boundaries or anything. I just really respect the mod and your work is all, and wanted to help out :)

    I can look into those two if you'd like.

  3. Requios repo owner

    Breaking shows preview (breaking only in creative). Build mode cancels when opposite mouse button is pressed (left button when placing, right button when breaking). Simple shader when placing more than 1500 blocks (or when useShaders is false). Added axis limits in addition to total block limit. Fixed placing on self (and being pushed). Fixed issue #15 silk touch, shearing leaves, dropping bed etc by using Block#harvestBlock (items dont drop directly to inventory anymore). Fixed randomizerbag not randomizing in buildmodes.

    → <<cset be865d273c64>>

  4. Log in to comment