From defa781d60bd716d33f30a2d8ffcf8430ec0145e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BCller?= <34514239+appgurueu@users.noreply.github.com> Date: Sun, 29 Jun 2025 15:32:38 +0200 Subject: [PATCH] Fix registering buckets in foreign mod namespaces --- game_api.txt | 1 + mods/bucket/init.lua | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/game_api.txt b/game_api.txt index c4250d50b..081979acb 100644 --- a/game_api.txt +++ b/game_api.txt @@ -35,6 +35,7 @@ The bucket API allows registering new types of buckets for non-default liquids. The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source. When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered. +The bucket API also allows registering buckets in other namespace using colon-prefixed itemname (i.e. ":cows:bucket_milk"). Beds API diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua index b026ee071..a10e962af 100644 --- a/mods/bucket/init.lua +++ b/mods/bucket/init.lua @@ -51,6 +51,8 @@ end -- This function can be called from any mod (that depends on bucket). function bucket.register_liquid(source, flowing, itemname, inventory_image, name, groups, force_renew) + local itemname_raw = itemname + itemname = itemname and itemname:match("^:(.+)") or itemname bucket.liquids[source] = { source = source, flowing = flowing, @@ -60,7 +62,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name bucket.liquids[flowing] = bucket.liquids[source] if itemname ~= nil then - minetest.register_craftitem(itemname, { + minetest.register_craftitem(itemname_raw, { description = name, inventory_image = inventory_image, stack_max = 1,