Hide minecart with command block from Creative

This commit is contained in:
Wuzzy 2017-08-30 21:51:27 +02:00
parent b2f97fa3cf
commit 505cdb9d43
2 changed files with 15 additions and 8 deletions

View file

@ -55,14 +55,15 @@ Or you can play in “creative mode” in which you can build almost anything in
More help about the gameplay, blocks items and much more can be found from inside More help about the gameplay, blocks items and much more can be found from inside
the game. You can access the help from your inventory menu. the game. You can access the help from your inventory menu.
### Special blocks ### Special items
The following blocks are interesting for Creative Mode and for adventure The following items are interesting for Creative Mode and for adventure
map builders. They can not be obtained in-game or in the creative inventory. map builders. They can not be obtained in-game or in the creative inventory.
* Barrier: `mcl_core:barrier` * Barrier: `mcl_core:barrier`
* Command Block: `mesecons_commandblock:commandblock_off` * Command Block: `mesecons_commandblock:commandblock_off`
* Monster Spawner (WIP): `mcl_mobspawners:spawner` * Monster Spawner: `mcl_mobspawners:spawner`
* Huge mushroom blocks: See `mods/ITEMS/mcl_mushrooms/README.md` * Huge mushroom blocks: See `mods/ITEMS/mcl_mushrooms/README.md`
* Minecart with Command Block: `mcl_minecarts:command_block_minecart`
Use the `/giveme` chat command to obtain them. See the in-game help for Use the `/giveme` chat command to obtain them. See the in-game help for
an explanation. an explanation.

View file

@ -328,9 +328,13 @@ mcl_minecarts.place_minecart = function(itemstack, pointed_thing)
return itemstack return itemstack
end end
local register_craftitem = function(itemstring, entity_id, description, longdesc, usagehelp, icon) local register_craftitem = function(itemstring, entity_id, description, longdesc, usagehelp, icon, creative)
entity_mapping[itemstring] = entity_id entity_mapping[itemstring] = entity_id
local groups = { minecart = 1, transport = 1 }
if creative == false then
groups.not_in_creative_inventory = 1
end
local def = { local def = {
stack_max = 1, stack_max = 1,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
@ -348,7 +352,7 @@ local register_craftitem = function(itemstring, entity_id, description, longdesc
return mcl_minecarts.place_minecart(itemstack, pointed_thing) return mcl_minecarts.place_minecart(itemstack, pointed_thing)
end, end,
groups = { minecart = 1, transport = 1}, groups = groups,
} }
def.description = description def.description = description
def._doc_items_longdesc = longdesc def._doc_items_longdesc = longdesc
@ -358,9 +362,9 @@ local register_craftitem = function(itemstring, entity_id, description, longdesc
minetest.register_craftitem(itemstring, def) minetest.register_craftitem(itemstring, def)
end end
local function register_minecart(itemstring, entity_id, description, longdesc, usagehelp, mesh, textures, icon, drop, on_rightclick) local function register_minecart(itemstring, entity_id, description, longdesc, usagehelp, mesh, textures, icon, drop, on_rightclick, creative)
register_entity(entity_id, mesh, textures, drop, on_rightclick) register_entity(entity_id, mesh, textures, drop, on_rightclick)
register_craftitem(itemstring, entity_id, description, longdesc, usagehelp, icon) register_craftitem(itemstring, entity_id, description, longdesc, usagehelp, icon, creative)
if minetest.get_modpath("doc_identifier") ~= nil then if minetest.get_modpath("doc_identifier") ~= nil then
doc.sub.identifier.register_object(entity_id, "craftitems", itemstring) doc.sub.identifier.register_object(entity_id, "craftitems", itemstring)
end end
@ -468,7 +472,9 @@ register_minecart(
"mcl_minecarts_minecart.png", "mcl_minecarts_minecart.png",
}, },
"mcl_minecarts_minecart_command_block.png", "mcl_minecarts_minecart_command_block.png",
{"mcl_minecarts:minecart"} {"mcl_minecarts:minecart"},
nil,
false
) )
-- Minecart with Hopper -- Minecart with Hopper