mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
Add end escape pearl
This commit is contained in:
parent
6b10633332
commit
060a853840
3 changed files with 46 additions and 2 deletions
4
mods/MISC/mcl_temp_end_escape/depends.txt
Normal file
4
mods/MISC/mcl_temp_end_escape/depends.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
mcl_worlds
|
||||
mcl_spawn
|
||||
mcl_throwing
|
||||
mcl_mobitems
|
38
mods/MISC/mcl_temp_end_escape/init.lua
Normal file
38
mods/MISC/mcl_temp_end_escape/init.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
local escape = function(itemstack, user, pointed_thing)
|
||||
local pos = user:get_pos()
|
||||
if not pos then
|
||||
return itemstack
|
||||
end
|
||||
local dim = mcl_worlds.pos_to_dimension(pos)
|
||||
|
||||
if dim == "end" then
|
||||
local target = mcl_spawn.get_spawn_pos(user)
|
||||
user:set_pos(target)
|
||||
minetest.sound_play("mcl_portals_teleport", {pos=target, gain=0.5, max_hear_distance = 16})
|
||||
itemstack:take_item()
|
||||
else
|
||||
minetest.chat_send_player(user:get_player_name(), "This item only works in the End.")
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craftitem("mcl_temp_end_escape:end_escape_pearl", {
|
||||
description = "End Escape Pearl",
|
||||
_doc_items_longdesc = "With this item you can teleport from the End back to spawn point in the Overworld.".."\n".."This item will be removed in later versions.",
|
||||
_doc_items_uagehelp = "Use rightclick to use. This only works in the End.",
|
||||
inventory_image = "mcl_throwing_ender_pearl.png^[colorize:#0000FF:127",
|
||||
wield_image = "mcl_throwing_ender_pearl.png^[colorize:#0000FF:127",
|
||||
on_place = escape,
|
||||
on_secondary_use = escape,
|
||||
stack_max = 64,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_temp_end_escape:end_escape_pearl",
|
||||
type = "shapeless",
|
||||
recipe = {
|
||||
"mcl_throwing:ender_pearl","mcl_mobitems:shulker_shell",
|
||||
"mcl_mobitems:shulker_shell","mcl_throwing:ender_pearl",
|
||||
},
|
||||
})
|
|
@ -20,7 +20,9 @@ local wip_items = {
|
|||
"mcl_minecarts:tnt_minecart",
|
||||
"mcl_minecarts:activator_rail",
|
||||
}
|
||||
local experimental_items = {}
|
||||
local experimental_items = {
|
||||
"mcl_temp_end_escape:end_escape_pearl",
|
||||
}
|
||||
|
||||
for i=1,#wip_items do
|
||||
local def = minetest.registered_items[wip_items[i]]
|
||||
|
@ -42,7 +44,7 @@ for i=1,#experimental_items do
|
|||
break
|
||||
end
|
||||
local new_description = def.description
|
||||
new_description = new_description .. "\n"..core.colorize("#FFFF00", "(Experimental)")
|
||||
new_description = new_description .. "\n"..core.colorize("#FFFF00", "(Temporary)")
|
||||
minetest.override_item(experimental_items[i], { description = new_description })
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue