1
0
Fork 0

Don't change water bottles when using in creative

This commit is contained in:
Wuzzy 2019-02-08 23:55:49 +01:00
parent 46c7413337
commit 5b0945b88c
1 changed files with 30 additions and 20 deletions

View File

@ -76,6 +76,7 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
end end
end end
if get_water then if get_water then
if minetest.settings:get_bool("creative_mode") ~= true then
-- Replace with water bottle, if possible, otherwise -- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space -- place the water potion at a place where's space
local water_bottle local water_bottle
@ -84,7 +85,6 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
else else
water_bottle = ItemStack("mcl_potions:potion_water") water_bottle = ItemStack("mcl_potions:potion_water")
end end
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
if itemstack:get_count() == 1 then if itemstack:get_count() == 1 then
return water_bottle return water_bottle
else else
@ -97,6 +97,8 @@ minetest.register_craftitem("mcl_potions:glass_bottle", {
itemstack:take_item() itemstack:take_item()
end end
end end
minetest.sound_play("mcl_potions_bottle_fill", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
end
end end
return itemstack return itemstack
end, end,
@ -175,9 +177,13 @@ minetest.register_craftitem("mcl_potions:potion_water", {
-- Increase water level of cauldron by 1 -- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron}) minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
if minetest.settings:get_bool("creative_mode") == true then
return itemstack
else
return "mcl_potions:glass_bottle" return "mcl_potions:glass_bottle"
end end
end end
end
-- Drink the water by default -- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)
@ -215,9 +221,13 @@ minetest.register_craftitem("mcl_potions:potion_river_water", {
-- Increase water level of cauldron by 1 -- Increase water level of cauldron by 1
minetest.set_node(pointed_thing.under, {name=cauldron}) minetest.set_node(pointed_thing.under, {name=cauldron})
minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}) minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16})
if minetest.settings:get_bool("creative_mode") == true then
return itemstack
else
return "mcl_potions:glass_bottle" return "mcl_potions:glass_bottle"
end end
end end
end
-- Drink the water by default -- Drink the water by default
return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing)