Skip to content

Commit defa781

Browse files
authored
Fix registering buckets in foreign mod namespaces
1 parent 69b2fb7 commit defa781

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

game_api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The bucket API allows registering new types of buckets for non-default liquids.
3535

3636
The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source.
3737
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.
38+
The bucket API also allows registering buckets in other namespace using colon-prefixed itemname (i.e. ":cows:bucket_milk").
3839

3940

4041
Beds API

mods/bucket/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ end
5151
-- This function can be called from any mod (that depends on bucket).
5252
function bucket.register_liquid(source, flowing, itemname, inventory_image, name,
5353
groups, force_renew)
54+
local itemname_raw = itemname
55+
itemname = itemname and itemname:match("^:(.+)") or itemname
5456
bucket.liquids[source] = {
5557
source = source,
5658
flowing = flowing,
@@ -60,7 +62,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
6062
bucket.liquids[flowing] = bucket.liquids[source]
6163

6264
if itemname ~= nil then
63-
minetest.register_craftitem(itemname, {
65+
minetest.register_craftitem(itemname_raw, {
6466
description = name,
6567
inventory_image = inventory_image,
6668
stack_max = 1,

0 commit comments

Comments
 (0)