PatchworkMC / patchwork-api

An attempt to reimplement the Minecraft Forge API on Fabric
GNU Lesser General Public License v2.1
282 stars 48 forks source link

Impl removedByPlayer and canHarvestBlock in IForgeBlock #126

Closed rikka0w0 closed 4 years ago

rikka0w0 commented 4 years ago

getExpDrops will be always called for all blocks, the exp orb drop behavior follows this rule:

        //          isVanillaBlock      exp     Action
        //  Vanilla     true            xxx     Let the vanilla method do the orb drop
        //  Fabric mod  false           == 0        Let the vanilla method do the orb drop
        //  Forge mod   false           >0      Do orb drop here
        //  Forge mod   false           <=0     Do nothing

Fabric mods does not have a method to get the amount of experience dropped from another block. If a Forge mod calls getExpDrop on a Fabric mod block, it will always get 0. This will be changed once Fabric has something equivalent.

getHarvestTool and getHarvestLevel are stubs, I will impl more tooltype stuff in another pr.

rikka0w0 commented 4 years ago

The logic here is somewhat tricky, but looks sound.

If #127 ends up merged before this, can you include the implementation of ForgeHooks.canHarvestBlock?

Yes of course, and also there are other things that I'm going to add to ForgeHooks and ForgeHooksClient. In all of my PRs, the event dispatch is handled by individual classes, and ForgeHooks is only supposed to be used for accepting Forge mod calls.

TheGlitch76 commented 4 years ago

Merge conflicts!