sbrl / Minetest-WorldEditAdditions

Extra tools and commands to extend WorldEdit for Minetest
https://worldeditadditions.mooncarrot.space/
Mozilla Public License 2.0
16 stars 3 forks source link

Mineclone Bonemeal #106

Closed VorTechnix closed 9 months ago

VorTechnix commented 9 months ago

image

Reproduction steps: Steps to reproduce the behaviour:

  1. Enable WEA in a Mineclone 2 world
  2. Play the world

Bonemeal in Mineclone is called mcl_bone_meal:bone_meal so that needs to be looked for/handled.

Also the alias shouldn't try to register if the base command doesn't exist (how did we forget to check for that? 🤦‍♂️). Bonemeal is supposed to be an optional dependency.

sbrl commented 9 months ago

Uh oh! Okay. So this bug has 2 facets to it:

  1. WEA attempts to register the alias //bonemeal//flora when //bonemeal doesn't exist
  2. //bonemeal doesn't work in MineClone 2

Issue 1: Alias

This is an easy fix. I'll address this asap.

Issue 2: MCL Bonemeal

This is much harder. WorldEditAdditions doesn't actually hit a specific bonemeal item.... it uses API of TenPlus1's bonemeal mod:

...specifically, we call bonemeal:on_use(pos, strength, node).

To this end, if MCL 2 has a different bonemeal mod registered then we would need to inspect the API thereof to add support for that different bonemeal mod.

Do you have a link to the documentation or source code of the MCL2 bonemeal mod at all please?

sbrl commented 9 months ago

Pushed commit 873ff4bef899e674c18f7cceedcba8ec128a36d8 to the dev branch. Can you confirm this fixes the warning please @VorTechnix?

VorTechnix commented 9 months ago

Do you have a link to the documentation or source code of the MCL2 bonemeal mod at all please?

Certainly! I've been rooting around in it a lot for my farm building project.

API (it's part of mcl_dye right now but will become its own API in the future): https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_dye/API.md

Item def: https://git.minetest.land/MineClone2/MineClone2/src/branch/master/mods/ITEMS/mcl_dye/init.lua#L391

VorTechnix commented 9 months ago

Pushed commit 873ff4b to the dev branch. Can you confirm this fixes the warning please @VorTechnix?

Yup, it's fixed in dev branch.

sbrl commented 9 months ago

Thanks for that link @VorTechnix. The API there is horrible though >_<

Looks like it's not documented but one can call mcl_dye.apply_bone_meal(pointed_thing, user)

...but we don't necessarily have a user when applying bonemeal. We could probably fake pointed_thing, but fiddling the user may break the callbacks in unpredictable ways.

Unfortunately it looks like until the MineClone2 team refactor to allow the application of bonemeal without a user object we're kinda stuck here.

Marking as upstream and closing for now, but we can reopen if/when upstream refactors to make MineClone2 bonemeal support more viable.