diff --git a/mods/ITEMS/mcl_mud/README.txt b/mods/ITEMS/mcl_mud/README.txt new file mode 100644 index 000000000..fe0a3f91c --- /dev/null +++ b/mods/ITEMS/mcl_mud/README.txt @@ -0,0 +1,21 @@ +License of Code +---------------- + +Author: TheRandomLegoBrick +License: GPLv3 +See https://www.gnu.org/licenses/gpl-3.0.en.html for further information + + +License of Media (textures & sounds) +------------------------------------- + +Author: TheRandomLegoBrick +Liscense: CC0 1.0 Universal (CC0 1.0) +Files: + mud_footsteps.ogg + mud_place_dug.ogg + mcl_mud_bricks.png + mcl_mud_packed_mud.png + mcl_mud.png + +See https://creativecommons.org/publicdomain/zero/1.0/legalcode for further information \ No newline at end of file diff --git a/mods/ITEMS/mcl_mud/init.lua b/mods/ITEMS/mcl_mud/init.lua new file mode 100644 index 000000000..e938ae5f2 --- /dev/null +++ b/mods/ITEMS/mcl_mud/init.lua @@ -0,0 +1,65 @@ +local S = minetest.get_translator(minetest.get_current_modname()) + +minetest.register_node("mcl_mud:mud", { + description = S("Mud"), + _doc_items_longdesc = S("Mud is a decorative block that generates in mangrove swamps. Mud can also be obtained by using water bottles on dirt or coarse dirt."), + _doc_items_hidden = false, + tiles = {"mcl_mud.png"}, + is_ground_content = true, + sounds = { + footstep = {name="mud_footsteps", gain=1}, + dug = {name="mud_place_dug", gain=1}, + place = {name="mud_place_dug", gain=1}, + }, + groups = {handy=1,shovely=1, enderman_takable=1, building_block=1}, + _mcl_blast_resistance = 0.5, + _mcl_hardness = 0.5, + collision_box = { + type = "fixed", + fixed = { + {-8 / 16, -8 / 16, -8 / 16, 8 / 16, 7 / 16, 8 / 16}, + }, + }, +}) + +minetest.register_node("mcl_mud:packed_mud", { + description = S("Packed Mud"), + _doc_items_longdesc = S("Packed mud is a decorative block used to craft mud bricks."), + _doc_items_hidden = false, + tiles = {"mcl_mud_packed_mud.png"}, + groups = {handy=1, pickaxey=1, building_block=1}, + sounds = mcl_sounds.node_sound_dirt_defaults(), + _mcl_blast_resistance = 3, + _mcl_hardness = 1, +}) + +minetest.register_node("mcl_mud:mud_bricks", { + description = S("Mud Bricks"), + _doc_items_longdesc = S("Decorative block crafted from packed mud."), + _doc_items_hidden = false, + tiles = {"mcl_mud_bricks.png"}, + groups = {handy=1, pickaxey=1, building_block=1}, + sounds = mcl_sounds.node_sound_stone_defaults(), + _mcl_blast_resistance = 3, + _mcl_hardness = 1.5, +}) + +-- packed mud +minetest.register_craft({ + type = "shapeless", + output = "mcl_mud:packed_mud", + recipe = { + "mcl_mud:mud", + "mcl_farming:wheat_item", + } +}) + +-- mud bricks +minetest.register_craft({ + type = "shaped", + output = "mcl_mud:mud_bricks 4", + recipe = { + {"mcl_mud:packed_mud", "mcl_mud:packed_mud"}, + {"mcl_mud:packed_mud", "mcl_mud:packed_mud"} + } +}) \ No newline at end of file diff --git a/mods/ITEMS/mcl_mud/mod.conf b/mods/ITEMS/mcl_mud/mod.conf new file mode 100644 index 000000000..70f48ef1e --- /dev/null +++ b/mods/ITEMS/mcl_mud/mod.conf @@ -0,0 +1,4 @@ +name = mcl_mud +author = TheRandomLegoBrick +description = Adds various mud blocks. +depends = mcl_sounds \ No newline at end of file diff --git a/mods/ITEMS/mcl_mud/sounds/mud_footsteps.ogg b/mods/ITEMS/mcl_mud/sounds/mud_footsteps.ogg new file mode 100644 index 000000000..e18c93965 Binary files /dev/null and b/mods/ITEMS/mcl_mud/sounds/mud_footsteps.ogg differ diff --git a/mods/ITEMS/mcl_mud/sounds/mud_place_dug.ogg b/mods/ITEMS/mcl_mud/sounds/mud_place_dug.ogg new file mode 100644 index 000000000..5a93ca14a Binary files /dev/null and b/mods/ITEMS/mcl_mud/sounds/mud_place_dug.ogg differ diff --git a/mods/ITEMS/mcl_mud/textures/mcl_mud.png b/mods/ITEMS/mcl_mud/textures/mcl_mud.png new file mode 100644 index 000000000..629831124 Binary files /dev/null and b/mods/ITEMS/mcl_mud/textures/mcl_mud.png differ diff --git a/mods/ITEMS/mcl_mud/textures/mcl_mud_bricks.png b/mods/ITEMS/mcl_mud/textures/mcl_mud_bricks.png new file mode 100644 index 000000000..c102118e7 Binary files /dev/null and b/mods/ITEMS/mcl_mud/textures/mcl_mud_bricks.png differ diff --git a/mods/ITEMS/mcl_mud/textures/mcl_mud_packed_mud.png b/mods/ITEMS/mcl_mud/textures/mcl_mud_packed_mud.png new file mode 100644 index 000000000..5e335e97e Binary files /dev/null and b/mods/ITEMS/mcl_mud/textures/mcl_mud_packed_mud.png differ diff --git a/mods/ITEMS/mcl_potions/init.lua b/mods/ITEMS/mcl_potions/init.lua index 5b9f1fab3..2ea7e2879 100644 --- a/mods/ITEMS/mcl_potions/init.lua +++ b/mods/ITEMS/mcl_potions/init.lua @@ -176,6 +176,76 @@ local fill_cauldron = function(cauldron, water_type) end end +-- function to set node and empty water bottle (used for cauldrons and mud) +local function set_node_empty_bottle(itemstack, placer, pointed_thing, newitemstring) + local pname = placer:get_player_name() + if minetest.is_protected(pointed_thing.under, pname) then + minetest.record_protection_violation(pointed_thing.under, pname) + return itemstack + end + + -- set the node to `itemstring` + minetest.set_node(pointed_thing.under, {name=newitemstring}) + + -- play sound + minetest.sound_play("mcl_potions_bottle_pour", {pos=pointed_thing.under, gain=0.5, max_hear_range=16}, true) + + -- + if minetest.is_creative_enabled(placer:get_player_name()) then + return itemstack + else + return "mcl_potions:glass_bottle" + end +end + +-- used for water bottles and river water bottles +local function dispense_water_bottle(stack, pos, droppos) + local node = minetest.get_node(droppos) + if node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then + -- convert dirt/coarse dirt to mud + minetest.set_node(droppos, {name = "mcl_mud:mud"}) + minetest.sound_play("mcl_potions_bottle_pour", {pos=droppos, gain=0.5, max_hear_range=16}, true) + return ItemStack("mcl_potions:glass_bottle") + + elseif node.name == "mcl_mud:mud" then + -- dont dispense into mud + return stack + end +end + +-- on_place function for `mcl_potions:water` and `mcl_potions:river_water` + +local function water_bottle_on_place(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + local def = minetest.registered_nodes[node.name] + + -- Call on_rightclick if the pointed node defines it + if placer and not placer:get_player_control().sneak then + if def and def.on_rightclick then + return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + + local cauldron = nil + if itemstack:get_name() == "mcl_potions:water" then -- regular water + cauldron = fill_cauldron(node.name, "mcl_core:water_source") + elseif itemstack:get_name() == "mcl_potions:river_water" then -- river water + cauldron = fill_cauldron(node.name, "mclx_core:river_water_source") + end + + + if cauldron then + set_node_empty_bottle(itemstack, placer, pointed_thing, cauldron) + elseif node.name == "mcl_core:dirt" or node.name == "mcl_core:coarse_dirt" then + set_node_empty_bottle(itemstack, placer, pointed_thing, "mcl_mud:mud") + end + end + + -- Drink the water by default + return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) +end + -- Itemstring of potions is “mcl_potions:” minetest.register_craftitem("mcl_potions:water", { @@ -187,39 +257,9 @@ minetest.register_craftitem("mcl_potions:water", { inventory_image = potion_image("#0022FF"), wield_image = potion_image("#0022FF"), groups = {brewitem=1, food=3, can_eat_when_full=1, water_bottle=1}, - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type == "node" then - local node = minetest.get_node(pointed_thing.under) - local def = minetest.registered_nodes[node.name] - - -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end - end - - local cauldron = fill_cauldron(node.name, "mcl_core:water_source") - if cauldron then - local pname = placer:get_player_name() - if minetest.is_protected(pointed_thing.under, pname) then - minetest.record_protection_violation(pointed_thing.under, pname) - return itemstack - end - -- Increase water level of cauldron by 1 - 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}, true) - if minetest.is_creative_enabled(placer:get_player_name()) then - return itemstack - else - return "mcl_potions:glass_bottle" - end - end - end - - -- Drink the water by default - return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) - end, + on_place = water_bottle_on_place, + _on_dispense = dispense_water_bottle, + _dispense_into_walkable = true, on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) @@ -234,39 +274,9 @@ minetest.register_craftitem("mcl_potions:river_water", { inventory_image = potion_image("#0044FF"), wield_image = potion_image("#0044FF"), groups = {brewitem=1, food=3, can_eat_when_full=1, water_bottle=1}, - on_place = function(itemstack, placer, pointed_thing) - if pointed_thing.type == "node" then - local node = minetest.get_node(pointed_thing.under) - local def = minetest.registered_nodes[node.name] - - -- Call on_rightclick if the pointed node defines it - if placer and not placer:get_player_control().sneak then - if def and def.on_rightclick then - return def.on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack - end - end - - local cauldron = fill_cauldron(node.name, "mclx_core:river_water_source") - if cauldron then - local pname = placer:get_player_name() - if minetest.is_protected(pointed_thing.under, pname) then - minetest.record_protection_violation(pointed_thing.under, pname) - return itemstack - end - -- Increase water level of cauldron by 1 - 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}, true) - if minetest.is_creative_enabled(placer:get_player_name()) then - return itemstack - else - return "mcl_potions:glass_bottle" - end - end - end - - -- Drink the water by default - return minetest.do_item_eat(0, "mcl_potions:glass_bottle", itemstack, placer, pointed_thing) - end, + on_place = water_bottle_on_place, + _on_dispense = dispense_water_bottle, + _dispense_into_walkable = true, on_secondary_use = minetest.item_eat(0, "mcl_potions:glass_bottle"), }) diff --git a/mods/ITEMS/mcl_stairs/mod.conf b/mods/ITEMS/mcl_stairs/mod.conf index a357c2c79..2fb3180b2 100644 --- a/mods/ITEMS/mcl_stairs/mod.conf +++ b/mods/ITEMS/mcl_stairs/mod.conf @@ -1,2 +1,2 @@ name = mcl_stairs -depends = mcl_core, mcl_sounds, mcl_nether, mcl_end, mcl_ocean +depends = mcl_core, mcl_sounds, mcl_nether, mcl_end, mcl_ocean, mcl_mud diff --git a/mods/ITEMS/mcl_stairs/register.lua b/mods/ITEMS/mcl_stairs/register.lua index 5de380585..eee4c5dc2 100644 --- a/mods/ITEMS/mcl_stairs/register.lua +++ b/mods/ITEMS/mcl_stairs/register.lua @@ -138,6 +138,8 @@ mcl_stairs.register_slab("purpur_block", "group:purpur_block", mcl_stairs.register_stair_and_slab_simple("prismarine", "mcl_ocean:prismarine", S("Prismarine Stairs"), S("Prismarine Slab"), S("Double Prismarine Slab")) +mcl_stairs.register_stair_and_slab_simple("mud_brick", "mcl_mud:mud_bricks", S("Mud Brick Stair"), S("Mud Brick Slab"), S("Double Mud Brick Slab")) + mcl_stairs.register_stair_and_slab_simple("prismarine_brick", "mcl_ocean:prismarine_brick", S("Prismarine Brick Stairs"), S("Prismarine Brick Slab"), S("Double Prismarine Brick Slab")) mcl_stairs.register_stair_and_slab_simple("prismarine_dark", "mcl_ocean:prismarine_dark", S("Dark Prismarine Stairs"), S("Dark Prismarine Slab"), S("Double Dark Prismarine Slab")) diff --git a/mods/ITEMS/mcl_walls/mod.conf b/mods/ITEMS/mcl_walls/mod.conf index 8839312de..b6b221007 100644 --- a/mods/ITEMS/mcl_walls/mod.conf +++ b/mods/ITEMS/mcl_walls/mod.conf @@ -1,3 +1,3 @@ name = mcl_walls -depends = mcl_core, mcl_end, mcl_ocean, mcl_nether, mcl_sounds +depends = mcl_core, mcl_end, mcl_ocean, mcl_nether, mcl_sounds, mcl_mud optional_depends = doc diff --git a/mods/ITEMS/mcl_walls/register.lua b/mods/ITEMS/mcl_walls/register.lua index 483af493e..96a1b9b9f 100644 --- a/mods/ITEMS/mcl_walls/register.lua +++ b/mods/ITEMS/mcl_walls/register.lua @@ -14,3 +14,4 @@ mcl_walls.register_wall("mcl_walls:prismarine", S("Prismarine Wall"), "mcl_ocean mcl_walls.register_wall("mcl_walls:endbricks", S("End Stone Brick Wall"), "mcl_end:end_bricks") mcl_walls.register_wall("mcl_walls:netherbrick", S("Nether Brick Wall"), "mcl_nether:nether_brick") mcl_walls.register_wall("mcl_walls:rednetherbrick", S("Red Nether Brick Wall"), "mcl_nether:red_nether_brick") +mcl_walls.register_wall("mcl_walls:mudbrick", S("Mud Brick Wall"), "mcl_mud:mud_bricks") \ No newline at end of file