forked from MineClone5/MineClone5
Silk Touch
This commit is contained in:
parent
8a406ad968
commit
7c28bf8507
|
@ -392,7 +392,7 @@ mcl_enchanting.enchantments.sharpness = {
|
|||
requires_tool = false,
|
||||
}
|
||||
|
||||
-- unimplemented
|
||||
-- implemented in mcl_item_entity
|
||||
mcl_enchanting.enchantments.silk_touch = {
|
||||
name = "Silk Touch",
|
||||
max_level = 1,
|
||||
|
@ -407,7 +407,6 @@ mcl_enchanting.enchantments.silk_touch = {
|
|||
requires_tool = false,
|
||||
}
|
||||
|
||||
|
||||
-- unimplemented
|
||||
mcl_enchanting.enchantments.smite = {
|
||||
name = "Smite",
|
||||
|
@ -489,81 +488,3 @@ mcl_enchanting.enchantments.unbreaking = {
|
|||
end,
|
||||
requires_tool = true,
|
||||
}
|
||||
|
||||
--[[
|
||||
local pickaxes = {"mcl_tools:pick_wood", "mcl_tools:pick_stone", "mcl_tools:pick_gold", "mcl_tools:pick_iron", "mcl_tools:pick_diamond"}
|
||||
local pickaxes_better_than_iron = {"mcl_tools:pick_iron", "mcl_tools:pick_diamond"}
|
||||
local pickaxes_better_than_stone = {"mcl_tools:pick_stone", "mcl_tools:pick_gold", "mcl_tools:pick_iron", "mcl_tools:pick_diamond"}
|
||||
local shovels = {"mcl_tools:shovel_wood", "mcl_tools:shovel_stone", "mcl_tools:shovel_gold", "mcl_tools:shovel_iron", "mcl_tools:shovel_diamond"}
|
||||
|
||||
local silk_touch_tool_lists = {
|
||||
["mcl_books:bookshelf"] = true,
|
||||
["mcl_core:clay"] = true,
|
||||
["mcl_core:stone_with_coal"] = pickaxes,
|
||||
["group:coral_block"] = pickaxes,
|
||||
["group:coral"] = true,
|
||||
["group:coral_fan"] = true,
|
||||
["mcl_core:stone_with_diamond"] = pickaxes_better_than_iron,
|
||||
["mcl_core:stone_with_emerald"] = pickaxes_better_than_iron,
|
||||
["mcl_chests:ender_chest"] = pickaxes,
|
||||
["group:glass"] = true,
|
||||
["mcl_nether:glowstone"] = true,
|
||||
["mcl_core:dirt_with_grass"] = true,
|
||||
["mcl_core:gravel"] = true,
|
||||
["mcl_core:ice"] = true,
|
||||
["mcl_core:stone_with_lapis"] = pickaxes_better_than_stone,
|
||||
["group:leaves"] = true,
|
||||
["mcl_farming:melon"] = true,
|
||||
["group:huge_mushroom"] = true,
|
||||
["mcl_core:mycelium"] = true,
|
||||
["mcl_nether:quartz_ore"] = pickaxes,
|
||||
["mcl_core:packed_ice"] = true,
|
||||
["mcl_core:podzol"] = true,
|
||||
["mcl_core:stone_with_redstone"] = pickaxes_better_than_iron,
|
||||
["mcl_ocean:sea_lantern"] = true,
|
||||
["group:top_snow"] = shovels,
|
||||
["mcl_core:snowblock"] = shovels,
|
||||
["mcl_core:stone"] = pickaxes,
|
||||
}
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
local old_handle_node_drops = minetest.handle_node_drops
|
||||
function minetest.handle_node_drops(pos, drops, digger)
|
||||
if digger and digger:is_player() then
|
||||
local wielditem = digger:get_wielded_item()
|
||||
local tooldef = wielditem:get_definition()
|
||||
if tooldef._silk_touch then
|
||||
local nodename = minetest.get_node(pos).name
|
||||
local nodedef = minetest.registered_nodes[nodename]
|
||||
local silk_touch_spec = silk_touch_tool_lists[nodename]
|
||||
local suitable_tool = false
|
||||
local tool_list
|
||||
if silk_touch_spec == true then
|
||||
suitable_tool = true
|
||||
elseif silk_touch_spec then
|
||||
tool_list = silk_touch_spec
|
||||
else
|
||||
for k, v in pairs(nodedef.groups) do
|
||||
if v > 0 then
|
||||
local group_spec = silk_touch_tool_lists["group:" .. k]
|
||||
if group_spec == true then
|
||||
suitable_tool = true
|
||||
elseif group_spec then
|
||||
toollist = group_spec
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if tool_list and not suitable_tool then
|
||||
suitable_tool = (table.indexof(tool_list, tooldef._original_tool) ~= -1)
|
||||
end
|
||||
if suitable_tool then
|
||||
drops = {nodename}
|
||||
end
|
||||
end
|
||||
end
|
||||
old_handle_node_drops(pos, drops, digger)
|
||||
end
|
||||
end)
|
||||
--]]
|
||||
|
|
|
@ -215,9 +215,9 @@ function mcl_enchanting.initialize()
|
|||
local new_name = itemname .. "_enchanted"
|
||||
minetest.override_item(itemname, {_mcl_enchanting_enchanted_tool = new_name})
|
||||
local new_def = table.copy(itemdef)
|
||||
new_def.inventory_image = itemdef.inventory_image .. "^[brighten^[colorize:purple:50"
|
||||
new_def.inventory_image = itemdef.inventory_image .. "^[colorize:white:50^[colorize:purple:50"
|
||||
if new_def.wield_image then
|
||||
new_def.wield_image = new_def.wield_image .. "^[brighten^[colorize:purple:50"
|
||||
new_def.wield_image = new_def.wield_image .. "^[colorize:white:50^[colorize:purple:50"
|
||||
end
|
||||
new_def.groups.not_in_creative_inventory = 1
|
||||
new_def.groups.enchanted = 1
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
flowlib
|
||||
mcl_enchanting
|
||||
|
|
|
@ -225,14 +225,9 @@ function minetest.handle_node_drops(pos, drops, digger)
|
|||
-- Check if node will yield its useful drop by the digger's tool
|
||||
local dug_node = minetest.get_node(pos)
|
||||
local toolcaps
|
||||
local tool
|
||||
if digger ~= nil then
|
||||
if mcl_experience.throw_experience then
|
||||
local experience_amount = minetest.get_item_group(dug_node.name,"xp")
|
||||
if experience_amount > 0 then
|
||||
mcl_experience.throw_experience(pos, experience_amount)
|
||||
end
|
||||
end
|
||||
local tool = digger:get_wielded_item()
|
||||
tool = digger:get_wielded_item()
|
||||
toolcaps = tool:get_tool_capabilities()
|
||||
|
||||
if not check_can_drop(dug_node.name, toolcaps) then
|
||||
|
@ -240,12 +235,13 @@ function minetest.handle_node_drops(pos, drops, digger)
|
|||
end
|
||||
end
|
||||
|
||||
--[[ Special node drops when dug by shears by reading _mcl_shears_drop
|
||||
--[[ Special node drops when dug by shears by reading _mcl_shears_drop or with a silk touch tool reading _mcl_silk_touch_drop
|
||||
from the node definition.
|
||||
Definition of _mcl_shears_drop:
|
||||
* true: Drop itself when dug by shears
|
||||
* table: Drop every itemstring in this table when dub by shears
|
||||
Definition of _mcl_shears_drop / _mcl_silk_touch_drop:
|
||||
* true: Drop itself when dug by shears / silk touch tool
|
||||
* table: Drop every itemstring in this table when dug by shears _mcl_silk_touch_drop
|
||||
]]
|
||||
local silk_touch_drop = false
|
||||
local nodedef = minetest.registered_nodes[dug_node.name]
|
||||
if toolcaps ~= nil and toolcaps.groupcaps and toolcaps.groupcaps.shearsy_dig and nodedef._mcl_shears_drop then
|
||||
if nodedef._mcl_shears_drop == true then
|
||||
|
@ -253,6 +249,20 @@ function minetest.handle_node_drops(pos, drops, digger)
|
|||
else
|
||||
drops = nodedef._mcl_shears_drop
|
||||
end
|
||||
elseif tool and mcl_enchanting.has_enchantment(tool, "silk_touch") and nodedef._mcl_silk_touch_drop then
|
||||
silk_touch_drop = true
|
||||
if nodedef._mcl_silk_touch_drop == true then
|
||||
drops = { dug_node.name }
|
||||
else
|
||||
drops = nodedef._mcl_silk_touch_drop
|
||||
end
|
||||
end
|
||||
|
||||
if digger and mcl_experience.throw_experience and not silk_touch_drop then
|
||||
local experience_amount = minetest.get_item_group(dug_node.name,"xp")
|
||||
if experience_amount > 0 then
|
||||
mcl_experience.throw_experience(pos, experience_amount)
|
||||
end
|
||||
end
|
||||
|
||||
for _,item in ipairs(drops) do
|
||||
|
|
|
@ -136,9 +136,9 @@ armor.set_player_armor = function(self, player)
|
|||
local level = def.groups["armor_"..k]
|
||||
if level then
|
||||
local texture = def.texture or item:gsub("%:", "_")
|
||||
local enchanted = mcl_enchanting.is_enchanted_def(item)
|
||||
table.insert(textures, "("..texture..".png"..(enchanted and "^[brighten^[colorize:purple:50" or "")..")")
|
||||
preview = "(player.png^[opacity:0^"..texture.."_preview.png"..(enchanted and "^[brighten^[colorize:purple:50" or "")..")"..(preview and "^"..preview or "")
|
||||
local enchanted_addition = (mcl_enchanting.is_enchanted_def(item) and "^[colorize:white:50^[colorize:purple:50" or "")
|
||||
table.insert(textures, "("..texture..".png"..enchanted_addition..")")
|
||||
preview = "(player.png^[opacity:0^"..texture.."_preview.png"..enchanted_addition..")"..(preview and "^"..preview or "")
|
||||
armor_level = armor_level + level
|
||||
items = items + 1
|
||||
mcl_armor_points = mcl_armor_points + (def.groups["mcl_armor_points"] or 0)
|
||||
|
|
|
@ -344,6 +344,7 @@ minetest.register_node("mcl_books:bookshelf", {
|
|||
sounds = wood_sound,
|
||||
_mcl_blast_resistance = 1.5,
|
||||
_mcl_hardness = 1.5,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
|
|
@ -746,6 +746,7 @@ minetest.register_node("mcl_chests:ender_chest", {
|
|||
end,
|
||||
_mcl_blast_resistance = 3000,
|
||||
_mcl_hardness = 22.5,
|
||||
_mcl_silk_touch_drop = true,
|
||||
on_rotate = simple_rotate,
|
||||
})
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ minetest.register_node("mcl_core:stone", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_hardness = 1.5,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:stone_with_coal", {
|
||||
|
@ -36,6 +37,7 @@ minetest.register_node("mcl_core:stone_with_coal", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:stone_with_iron", {
|
||||
|
@ -49,6 +51,7 @@ minetest.register_node("mcl_core:stone_with_iron", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
|
||||
|
@ -63,6 +66,7 @@ minetest.register_node("mcl_core:stone_with_gold", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
local redstone_timer = 68.28
|
||||
|
@ -95,6 +99,7 @@ minetest.register_node("mcl_core:stone_with_redstone", {
|
|||
on_walk_over = redstone_ore_activate, -- Uses walkover mod
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
local redstone_ore_reactivate = function(pos)
|
||||
|
@ -133,6 +138,7 @@ minetest.register_node("mcl_core:stone_with_redstone_lit", {
|
|||
end,
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = "mcl_core:stone_with_redstone",
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:stone_with_lapis", {
|
||||
|
@ -168,6 +174,7 @@ minetest.register_node("mcl_core:stone_with_emerald", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:stone_with_diamond", {
|
||||
|
@ -181,6 +188,7 @@ minetest.register_node("mcl_core:stone_with_diamond", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:stonebrick", {
|
||||
|
@ -346,6 +354,7 @@ minetest.register_node("mcl_core:dirt_with_grass", {
|
|||
_mcl_snowed = "mcl_core:dirt_with_grass_snow",
|
||||
_mcl_blast_resistance = 0.5,
|
||||
_mcl_hardness = 0.6,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
mcl_core.register_snowed_node("mcl_core:dirt_with_grass_snow", "mcl_core:dirt_with_grass", nil, nil, true)
|
||||
|
||||
|
@ -389,6 +398,7 @@ minetest.register_node("mcl_core:mycelium", {
|
|||
_mcl_snowed = "mcl_core:mycelium_snow",
|
||||
_mcl_blast_resistance = 0.5,
|
||||
_mcl_hardness = 0.6,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
mcl_core.register_snowed_node("mcl_core:mycelium_snow", "mcl_core:mycelium")
|
||||
|
||||
|
@ -405,6 +415,7 @@ minetest.register_node("mcl_core:podzol", {
|
|||
_mcl_snowed = "mcl_core:podzol_snow",
|
||||
_mcl_blast_resistance = 0.5,
|
||||
_mcl_hardness = 0.6,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
mcl_core.register_snowed_node("mcl_core:podzol_snow", "mcl_core:podzol")
|
||||
|
||||
|
@ -452,6 +463,7 @@ minetest.register_node("mcl_core:gravel", {
|
|||
}),
|
||||
_mcl_blast_resistance = 0.6,
|
||||
_mcl_hardness = 0.6,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
-- sandstone --
|
||||
|
@ -594,6 +606,7 @@ minetest.register_node("mcl_core:clay", {
|
|||
sounds = mcl_sounds.node_sound_dirt_defaults(),
|
||||
_mcl_blast_resistance = 0.6,
|
||||
_mcl_hardness = 0.6,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:brick_block", {
|
||||
|
@ -776,6 +789,7 @@ minetest.register_node("mcl_core:ice", {
|
|||
end,
|
||||
_mcl_blast_resistance = 0.5,
|
||||
_mcl_hardness = 0.5,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_core:packed_ice", {
|
||||
|
@ -789,6 +803,7 @@ minetest.register_node("mcl_core:packed_ice", {
|
|||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
_mcl_blast_resistance = 0.5,
|
||||
_mcl_hardness = 0.5,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
-- Frosted Ice (4 nodes)
|
||||
|
@ -972,6 +987,7 @@ for i=1,8 do
|
|||
drop = "mcl_throwing:snowball "..(i+1),
|
||||
_mcl_blast_resistance = 0.1,
|
||||
_mcl_hardness = 0.1,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -989,6 +1005,7 @@ minetest.register_node("mcl_core:snowblock", {
|
|||
drop = "mcl_throwing:snowball 4",
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
-- Add entry aliases for the Help
|
||||
|
|
|
@ -16,6 +16,7 @@ minetest.register_node("mcl_core:glass", {
|
|||
drop = "",
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
------------------------
|
||||
|
@ -51,6 +52,7 @@ function mcl_core.add_stained_glass(desc, recipeitem, colorgroup, color)
|
|||
drop = "",
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
|
|
@ -110,6 +110,7 @@ local register_leaves = function(subname, description, longdesc, tiles, drop1, d
|
|||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ local melon_base_def = {
|
|||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
_mcl_blast_resistance = 1,
|
||||
_mcl_hardness = 1,
|
||||
_mcl_silk_touch_drop = true,
|
||||
}
|
||||
|
||||
-- Drop proabilities for melon stem
|
||||
|
|
|
@ -6,6 +6,7 @@ local template = {
|
|||
is_ground_content = true,
|
||||
_mcl_blast_resistance = 0.2,
|
||||
_mcl_hardness = 0.2,
|
||||
_mcl_silk_touch_drop = true,
|
||||
}
|
||||
|
||||
local red = table.copy(template)
|
||||
|
|
|
@ -27,6 +27,7 @@ minetest.register_node("mcl_nether:glowstone", {
|
|||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_nether:quartz_ore", {
|
||||
|
@ -40,6 +41,7 @@ minetest.register_node("mcl_nether:quartz_ore", {
|
|||
sounds = mcl_sounds.node_sound_stone_defaults(),
|
||||
_mcl_blast_resistance = 3,
|
||||
_mcl_hardness = 3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
-- For eternal fire on top of netherrack and magma blocks
|
||||
|
|
|
@ -91,6 +91,7 @@ for c=1, #corals do
|
|||
drop = "mcl_ocean:dead_"..id.."_coral_block",
|
||||
_mcl_hardness = 1.5,
|
||||
_mcl_blast_resistance = 6,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
minetest.register_node("mcl_ocean:dead_"..id.."_coral_block", {
|
||||
description = corals[c][3],
|
||||
|
@ -135,6 +136,7 @@ for c=1, #corals do
|
|||
end,
|
||||
_mcl_hardness = 0,
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
minetest.register_node("mcl_ocean:dead_"..id.."_coral", {
|
||||
description = corals[c][5],
|
||||
|
@ -202,6 +204,7 @@ for c=1, #corals do
|
|||
end,
|
||||
_mcl_hardness = 0,
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
minetest.register_node("mcl_ocean:dead_"..id.."_coral_fan", {
|
||||
description = corals[c][7],
|
||||
|
@ -234,6 +237,7 @@ for c=1, #corals do
|
|||
end,
|
||||
_mcl_hardness = 0,
|
||||
_mcl_blast_resistance = 0,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
if mod_doc then
|
||||
|
|
|
@ -21,6 +21,7 @@ minetest.register_node("mcl_ocean:sea_lantern", {
|
|||
sounds = mcl_sounds.node_sound_glass_defaults(),
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
minetest.register_node("mcl_ocean:prismarine", {
|
||||
|
|
|
@ -127,6 +127,7 @@ function xpanes.register_pane(name, def)
|
|||
connect_sides = { "left", "right" },
|
||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||
_mcl_hardness = def._mcl_hardness,
|
||||
_mcl_silk_touch_drop = def._mcl_silk_touch_drop,
|
||||
})
|
||||
|
||||
local groups = table.copy(def.groups)
|
||||
|
@ -155,6 +156,7 @@ function xpanes.register_pane(name, def)
|
|||
drop = drop,
|
||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||
_mcl_hardness = def._mcl_hardness,
|
||||
_mcl_silk_touch_drop = def._mcl_silk_touch_drop,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -204,6 +206,7 @@ local pane = function(description, node, append)
|
|||
drop = "",
|
||||
_mcl_blast_resistance = 0.3,
|
||||
_mcl_hardness = 0.3,
|
||||
_mcl_silk_touch_drop = true,
|
||||
})
|
||||
|
||||
if mod_doc and not is_canonical then
|
||||
|
|
Loading…
Reference in New Issue