3 --made for MC like Survival game
4 --License for code WTFPL and otherwise stated in readmes
6 --THIS IS THE MASTER ITEM LIST TO USE WITH DEFAULT
8 -- NOTE: Most strings intentionally not marked for translation, other mods already have these items.
9 -- TODO: Remove this file eventually, most items are already outsourced in other mods.
11 local S
= minetest
.get_translator("mobs_mc")
13 local c
= mobs_mc
.is_item_variable_overridden
16 if c("blaze_rod") then
17 minetest
.register_craftitem("mobs_mc:blaze_rod", {
18 description
= "Blaze Rod",
19 _doc_items_longdesc
= "This is a crafting component dropped from dead blazes.",
20 wield_image
= "mcl_mobitems_blaze_rod.png",
21 inventory_image
= "mcl_mobitems_blaze_rod.png",
24 -- Make blaze rod furnace-burnable. 1.5 times the burn time of a coal lump
25 local coalcraft
, burntime
26 if minetest
.get_modpath("default") then
27 coalcraft
= minetest
.get_craft_result({method
="fuel", width
=1, items
={"default:coal_lump"}})
30 burntime
= math
.floor(coalcraft
.time
* 1.5)
32 if burntime
== nil or burntime
== 0 then
36 minetest
.register_craft({
39 recipe
= "mobs_mc:blaze_rod",
43 if c("blaze_powder") then
44 minetest
.register_craftitem("mobs_mc:blaze_powder", {
45 description
= "Blaze Powder",
46 _doc_items_longdesc
= "This item is mainly used for brewing potions and crafting.",
47 wield_image
= "mcl_mobitems_blaze_powder.png",
48 inventory_image
= "mcl_mobitems_blaze_powder.png",
52 if c("blaze_rod") and c("blaze_powder") then
53 minetest
.register_craft({
54 output
= "mobs_mc:blaze_powder 2",
55 recipe
= {{ "mobs_mc:blaze_rod" }},
60 if c("chicken_raw") then
61 minetest
.register_craftitem("mobs_mc:chicken_raw", {
62 description
= "Raw Chicken",
63 _doc_items_longdesc
= "Raw chicken is a food item and can be eaten safely. Cooking it will increase its nutritional value.",
64 inventory_image
= "mcl_mobitems_chicken_raw.png",
65 groups
= { food
= 2, eatable
= 2 },
66 on_use
= minetest
.item_eat(2),
70 if c("chicken_cooked") then
71 minetest
.register_craftitem("mobs_mc:chicken_cooked", {
72 description
= "Cooked Chicken",
73 _doc_items_longdesc
= "A cooked chicken is a healthy food item which can be eaten.",
74 inventory_image
= "mcl_mobitems_chicken_cooked.png",
75 groups
= { food
= 2, eatable
= 6 },
76 on_use
= minetest
.item_eat(6),
80 if c("chicken_raw") and c("chicken_cooked") then
81 minetest
.register_craft({
83 output
= "mobs_mc:chicken_cooked",
84 recipe
= "mobs_mc:chicken_raw",
90 minetest
.register_craftitem("mobs_mc:feather", {
91 description
= "Feather",
92 _doc_items_longdesc
= "Feathers are used in crafting and are dropped from chickens.",
93 inventory_image
= "mcl_mobitems_feather.png",
99 minetest
.register_craftitem("mobs_mc:beef_raw", {
100 description
= "Raw Beef",
101 _doc_items_longdesc
= "Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value.",
102 inventory_image
= "mcl_mobitems_beef_raw.png",
103 groups
= { food
= 2, eatable
= 3 },
104 on_use
= minetest
.item_eat(3),
108 if c("beef_cooked") then
109 minetest
.register_craftitem("mobs_mc:beef_cooked", {
110 description
= "Steak",
111 _doc_items_longdesc
= "Steak is cooked beef from cows and can be eaten.",
112 inventory_image
= "mcl_mobitems_beef_cooked.png",
113 groups
= { food
= 2, eatable
= 8 },
114 on_use
= minetest
.item_eat(8),
118 if c("beef_raw") and c("beef_cooked") then
119 minetest
.register_craft({
121 output
= "mobs_mc:beef_cooked",
122 recipe
= "mobs_mc:beef_raw",
130 minetest
.register_craftitem("mobs_mc:milk_bucket", {
131 description
= "Milk",
132 _doc_items_longdesc
= "Milk is a food item obtained by using a bucket on a cow.",
133 inventory_image
= "mobs_bucket_milk.png",
134 groups
= { food
= 3, eatable
= 1 },
135 on_use
= minetest
.item_eat(1, "bucket:bucket_empty"),
141 minetest
.register_craftitem("mobs_mc:bowl", {
142 description
= "Bowl",
143 _doc_items_longdesc
= "Bowls are mainly used to hold tasty soups.",
144 inventory_image
= "mcl_core_bowl.png",
147 minetest
.register_craft({
148 output
= "mobs_mc:bowl",
150 { "group:wood", "", "group:wood" },
151 { "", "group:wood", "", },
155 minetest
.register_craft({
157 recipe
= "mobs_mc:bowl",
162 if c("mushroom_stew") then
163 minetest
.register_craftitem("mobs_mc:mushroom_stew", {
164 description
= "Mushroom Stew",
165 _doc_items_longdesc
= "Mushroom stew is a healthy soup.",
166 inventory_image
= "farming_mushroom_stew.png",
167 groups
= { food
= 3, eatable
= 6 },
168 on_use
= minetest
.item_eat(6, "mobs_mc:bowl"),
174 if c("dragon_egg") then
176 local dragon_egg_sounds
177 if minetest
.get_modpath("default") then
178 dragon_egg_sounds
= default
.node_sound_stone_defaults()
182 minetest
.register_node("mobs_mc:dragon_egg", {
183 description
= "Dragon Egg",
185 "mcl_end_dragon_egg.png",
186 "mcl_end_dragon_egg.png",
187 "mcl_end_dragon_egg.png",
188 "mcl_end_dragon_egg.png",
189 "mcl_end_dragon_egg.png",
190 "mcl_end_dragon_egg.png",
192 drawtype
= "nodebox",
193 is_ground_content
= false,
199 {-0.375, -0.5, -0.375, 0.375, -0.4375, 0.375},
200 {-0.5, -0.4375, -0.5, 0.5, -0.1875, 0.5},
201 {-0.4375, -0.1875, -0.4375, 0.4375, 0, 0.4375},
202 {-0.375, 0, -0.375, 0.375, 0.125, 0.375},
203 {-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125},
204 {-0.25, 0.25, -0.25, 0.25, 0.3125, 0.25},
205 {-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875},
206 {-0.125, 0.375, -0.125, 0.125, 0.4375, 0.125},
207 {-0.0625, 0.4375, -0.0625, 0.0625, 0.5, 0.0625},
213 groups
= {snappy
= 1, falling_node
= 1, deco_block
= 1, not_in_creative_inventory
= 1, dig_by_piston
= 1 },
214 sounds
= dragon_egg_sounds
,
215 -- TODO: Make dragon egg teleport on punching
219 local longdesc_craftitem
220 if minetest
.get_modpath("doc_items") then
221 longdesc_craftitem
= doc
.sub
.items
.temp
.craftitem
225 if c("ender_eye") then
226 minetest
.register_craftitem("mobs_mc:ender_eye", {
227 description
= "Eye of Ender",
228 _doc_items_longdesc
= longdesc_craftitem
,
229 inventory_image
= "mcl_end_ender_eye.png",
230 groups
= { craftitem
= 1 },
234 if c("ender_eye") and c("blaze_powder") and c("blaze_rod") then
235 minetest
.register_craft({
237 output
= 'mobs_mc:ender_eye',
238 recipe
= { 'mobs_mc:blaze_powder', 'mobs_mc:blaze_rod'},
243 if c("ghast_tear") then
244 minetest
.register_craftitem("mobs_mc:ghast_tear", {
245 description
= "Ghast Tear",
246 _doc_items_longdesc
= "A ghast tear is an item used in potion brewing. It is dropped from dead ghasts.",
247 wield_image
= "mcl_mobitems_ghast_tear.png",
248 inventory_image
= "mcl_mobitems_ghast_tear.png",
249 groups
= { brewitem
= 1 },
255 -- Overwrite the saddle from Mobs Redo
256 minetest
.register_craftitem(":mobs:saddle", {
257 description
= "Saddle",
258 _doc_items_longdesc
= "Saddles can be put on horses, donkeys, mules and pigs in order to mount them.",
259 _doc_items_usagehelp
= "Rightclick an animal while holding a saddle to put on the saddle. You can now mount the animal by rightclicking it again.",
260 inventory_image
= "mcl_mobitems_saddle.png",
266 local horse_armor_use
= S("Place it on a horse to put on the horse armor. Donkeys and mules can't wear horse armor.")
267 -- TODO: Balance the horse armor strength, compare with MC armor strength
268 if c("iron_horse_armor") then
269 minetest
.register_craftitem("mobs_mc:iron_horse_armor", {
270 description
= S("Iron Horse Armor"),
271 _doc_items_longdesc
= S("Iron horse armor can be worn by horses to increase their protection from harm a bit."),
272 _doc_items_usagehelp
= horse_armor_use
,
273 inventory_image
= "mobs_mc_iron_horse_armor.png",
274 _horse_overlay_image
= "mobs_mc_horse_armor_iron.png",
276 _mcl_armor_equip
= "mcl_armor_equip_iron",
279 groups
= { horse_armor
= 85 },
282 if c("gold_horse_armor") then
283 minetest
.register_craftitem("mobs_mc:gold_horse_armor", {
284 description
= S("Golden Horse Armor"),
285 _doc_items_longdesc
= S("Golden horse armor can be worn by horses to increase their protection from harm."),
286 _doc_items_usagehelp
= horse_armor_use
,
287 inventory_image
= "mobs_mc_gold_horse_armor.png",
288 _horse_overlay_image
= "mobs_mc_horse_armor_gold.png",
290 _mcl_armor_equip
= "mcl_armor_equip_iron",
293 groups
= { horse_armor
= 60 },
296 if c("diamond_horse_armor") then
297 minetest
.register_craftitem("mobs_mc:diamond_horse_armor", {
298 description
= S("Diamond Horse Armor"),
299 _doc_items_longdesc
= S("Diamond horse armor can be worn by horses to greatly increase their protection from harm."),
300 _doc_items_usagehelp
= horse_armor_use
,
301 inventory_image
= "mobs_mc_diamond_horse_armor.png",
302 _horse_overlay_image
= "mobs_mc_horse_armor_diamond.png",
304 _mcl_armor_equip
= "mcl_armor_equip_diamond",
307 groups
= { horse_armor
= 45 },
312 if c("porkchop_raw") then
313 minetest
.register_craftitem("mobs_mc:porkchop_raw", {
314 description
= "Raw Porkchop",
315 _doc_items_longdesc
= "A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value.",
316 inventory_image
= "mcl_mobitems_porkchop_raw.png",
317 groups
= { food
= 2, eatable
= 3 },
318 on_use
= minetest
.item_eat(3),
322 if c("porkchop_cooked") then
323 minetest
.register_craftitem("mobs_mc:porkchop_cooked", {
324 description
= "Cooked Porkchop",
325 _doc_items_longdesc
= "Cooked porkchop is the cooked flesh of a pig and is used as food.",
326 inventory_image
= "mcl_mobitems_porkchop_cooked.png",
327 groups
= { food
= 2, eatable
= 8 },
328 on_use
= minetest
.item_eat(8),
332 if c("porkchop_raw") and c("porkchop_cooked") then
333 minetest
.register_craft({
335 output
= "mobs_mc:porkchop_cooked",
336 recipe
= "mobs_mc:porkchop_raw",
341 if c("carrot_on_a_stick") then
342 minetest
.register_tool("mobs_mc:carrot_on_a_stick", {
343 description
= "Carrot on a Stick",
344 _doc_items_longdesc
= "A carrot on a stick can be used on saddled pigs to ride them. Pigs will also follow anyone who holds a carrot on a stick near them.",
345 _doc_items_usagehelp
= "Rightclick a saddled pig with the carrot on a stick to mount it. You can now ride it like a horse.",
346 wield_image
= "mcl_mobitems_carrot_on_a_stick.png",
347 inventory_image
= "mcl_mobitems_carrot_on_a_stick.png",
348 sounds
= { breaks
= "default_tool_breaks" },
352 -- Poor-man's recipes for carrot on a stick
353 if c("carrot_on_a_stick") and c("stick") and c("string") and minetest
.get_modpath("farming") then
354 minetest
.register_craft({
355 output
= "mobs_mc:carrot_on_a_stick",
357 {"", "", "farming:string" },
358 {"", "group:stick", "farming:string" },
359 {"group:stick", "", "farming:bread" },
363 -- FIXME: Identify correct farming mod (check if it includes the carrot item)
364 minetest
.register_craft({
365 output
= "mobs_mc:carrot_on_a_stick",
367 {"", "", "farming:string" },
368 {"", "group:stick", "farming:string" },
369 {"group:stick", "", "farming:carrot" },
374 if c("carrot_on_a_stick") and c("stick") and c("string") and minetest
.get_modpath("fishing") and minetest
.get_modpath("farming") then
375 minetest
.register_craft({
377 output
= "mobs_mc:carrot_on_a_stick",
378 recipe
= {"fishing:pole_wood", "farming:carrot"},
383 if c("rabbit_raw") then
384 minetest
.register_craftitem("mobs_mc:rabbit_raw", {
385 description
= "Raw Rabbit",
386 _doc_items_longdesc
= "Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value.",
387 inventory_image
= "mcl_mobitems_rabbit_raw.png",
388 groups
= { food
= 2, eatable
= 3 },
389 on_use
= minetest
.item_eat(3),
393 if c("rabbit_cooked") then
394 minetest
.register_craftitem("mobs_mc:rabbit_cooked", {
395 description
= "Cooked Rabbit",
396 _doc_items_longdesc
= "This is a food item which can be eaten.",
397 inventory_image
= "mcl_mobitems_rabbit_cooked.png",
398 groups
= { food
= 2, eatable
= 5 },
399 on_use
= minetest
.item_eat(5),
403 if c("rabbit_raw") and c("rabbit_cooked") then
404 minetest
.register_craft({
406 output
= "mobs_mc:rabbit_cooked",
407 recipe
= "mobs_mc:rabbit_raw",
412 if c("rabbit_hide") then
413 minetest
.register_craftitem("mobs_mc:rabbit_hide", {
414 description
= "Rabbit Hide",
415 _doc_items_longdesc
= "Rabbit hide is used to create leather.",
416 inventory_image
= "mcl_mobitems_rabbit_hide.png"
420 if c("leather") and c("rabbit_hide") then
421 minetest
.register_craft({
422 output
= "mobs:leather",
424 { "mobs_mc:rabbit_hide", "mobs_mc:rabbit_hide" },
425 { "mobs_mc:rabbit_hide", "mobs_mc:rabbit_hide" },
430 if c("rabbit_foot") then
431 minetest
.register_craftitem("mobs_mc:rabbit_foot", {
432 description
= "Rabbit's Foot",
433 _doc_items_longdesc
= "This item is used in brewing.",
434 inventory_image
= "mcl_mobitems_rabbit_foot.png"
439 if c("mutton_raw") then
440 minetest
.register_craftitem("mobs_mc:mutton_raw", {
441 description
= "Raw Mutton",
442 _doc_items_longdesc
= "Raw mutton is the flesh from a sheep and can be eaten safely. Cooking it will greatly increase its nutritional value.",
443 inventory_image
= "mcl_mobitems_mutton_raw.png",
444 groups
= { food
= 2, eatable
= 4 },
445 on_use
= minetest
.item_eat(4),
449 if c("mutton_cooked") then
450 minetest
.register_craftitem("mobs_mc:mutton_cooked", {
451 description
= "Cooked Mutton",
452 _doc_items_longdesc
= "Cooked mutton is the cooked flesh from a sheep and is used as food.",
453 inventory_image
= "mcl_mobitems_mutton_cooked.png",
454 groups
= { food
= 2, eatable
= 8 },
455 on_use
= minetest
.item_eat(8),
459 if c("mutton_raw") and c("mutton_cooked") then
460 minetest
.register_craft({
462 output
= "mobs_mc:mutton_cooked",
463 recipe
= "mobs_mc:mutton_raw",
469 if c("shulker_shell") then
470 minetest
.register_craftitem("mobs_mc:shulker_shell", {
471 description
= "Shulker Shell",
472 _doc_items_longdesc
= "Shulker shells are used in crafting. They are dropped from dead shulkers.",
473 inventory_image
= "mcl_mobitems_shulker_shell.png",
474 groups
= { craftitem
= 1 },
479 if c("magma_cream") then
480 minetest
.register_craftitem("mobs_mc:magma_cream", {
481 description
= "Magma Cream",
482 _doc_items_longdesc
= "Magma cream is a crafting component.",
483 wield_image
= "mcl_mobitems_magma_cream.png",
484 inventory_image
= "mcl_mobitems_magma_cream.png",
485 groups
= { brewitem
= 1 },
490 if c("slimeball") then
491 minetest
.register_craftitem("mobs_mc:slimeball", {
492 description
= "Slimeball",
493 _doc_items_longdesc
= "Slimeballs are used in crafting. They are dropped from slimes.",
494 inventory_image
= "mcl_mobitems_slimeball.png"
496 if minetest
.get_modpath("mesecons_materials") then
497 minetest
.register_craft({
498 output
= "mesecons_materials:glue",
499 recipe
= {{ "mobs_mc:slimeball" }},
505 if c("spider_eye") then
506 minetest
.register_craftitem("mobs_mc:spider_eye", {
507 description
= "Spider Eye",
508 _doc_items_longdesc
= "Spider eyes are used mainly in crafting and brewing. Spider eyes can be eaten, but they poison you and reduce your health by 2 hit points.",
509 inventory_image
= "mcl_mobitems_spider_eye.png",
510 wield_image
= "mcl_mobitems_spider_eye.png",
511 -- Simplified poisonous food
512 groups
= { food
= 2, eatable
= -2 },
513 on_use
= minetest
.item_eat(-2),
522 minetest
.register_craftitem("mobs_mc:totem", {
523 description
= S("Totem of Undying"),
524 _tt_help
= minetest
.colorize("#00FF00", S("Protects you from death while wielding it")),
525 _doc_items_longdesc
= S("A totem of undying is a rare artifact which may safe you from certain death."),
526 _doc_items_usagehelp
= S("The totem only works while you hold it in your hand. If you receive fatal damage, you are saved from death and you get a second chance with 1 HP. The totem is destroyed in the process, however."),
527 inventory_image
= "mcl_totems_totem.png",
528 wield_image
= "mcl_totems_totem.png",
532 minetest
.register_on_leaveplayer(function(player
)
533 hud_totem
[player
:get_player_name()] = nil
536 -- Save the player from death when holding totem of undying in hand
537 minetest
.register_on_player_hpchange(function(player
, hp_change
)
538 local hp
= player
:get_hp()
540 if hp
+ hp_change
<= 0 then
541 local wield
= player
:get_wielded_item()
542 if wield
:get_name() == "mobs_mc:totem" then
543 local ppos
= player
:get_pos()
544 local pnname
= minetest
.get_node(ppos
).name
545 -- Some exceptions when _not_ to save the player
546 for n
=1, #mobs_mc
.misc
.totem_fail_nodes
do
547 if pnname
== mobs_mc
.misc
.totem_fail_nodes
[n
] then
551 -- Reset breath as well
552 if player
:get_breath() < 11 then
553 player
:set_breath(10)
555 if not minetest
.settings
:get_bool("creative_mode") then
557 player
:set_wielded_item(wield
)
560 minetest
.sound_play({name
= "mcl_totems_totem", gain
=1}, {pos
=ppos
, max_hear_distance
=16}, true)
563 if not hud_totem
[player
:get_player_name()] then
564 hud_totem
[player
:get_player_name()] = player
:hud_add({
565 hud_elem_type
= "image",
566 text
= "mcl_totems_totem.png",
567 position
= { x
=0.5, y
=1 },
568 scale
= { x
=17, y
=17 },
569 offset
= { x
=0, y
=-178 },
572 minetest
.after(3, function(name
)
573 local player
= minetest
.get_player_by_name(name
)
574 if player
and player
:is_player() then
575 local name
= player
:get_player_name()
576 if hud_totem
[name
] then
577 player
:hud_remove(hud_totem
[name
])
578 hud_totem
[name
] = nil
581 end, player
:get_player_name())
584 -- Set HP to exactly 1
593 if c("rotten_flesh") then
594 minetest
.register_craftitem("mobs_mc:rotten_flesh", {
595 description
= "Rotten Flesh",
596 _doc_items_longdesc
= "Yuck! This piece of flesh clearly has seen better days. Eating it will only poison you and reduces your health by 4 hit points. But tamed wolves can eat it just fine.",
597 inventory_image
= "mcl_mobitems_rotten_flesh.png",
598 -- Simplified poisonous food
599 groups
= { food
= 2, eatable
= -4 },
600 on_use
= minetest
.item_eat(-4),
605 if c("nether_star") then
606 minetest
.register_craftitem("mobs_mc:nether_star", {
607 description
= "Nether Star",
608 _doc_items_longdesc
= "A nether star is a crafting component. It is dropped from the Wither.",
609 inventory_image
= "mcl_mobitems_nether_star.png"
613 if c("snowball") and minetest
.get_modpath("default") then
614 minetest
.register_craft({
615 output
= "mobs_mc:snowball 2",
620 minetest
.register_craft({
621 output
= "default:snow 2",
623 {"mobs_mc:snowball", "mobs_mc:snowball"},
624 {"mobs_mc:snowball", "mobs_mc:snowball"},
627 -- Change the appearance of default snow to avoid confusion with snowball
628 minetest
.override_item("default:snow", {
629 inventory_image
= "",
635 minetest
.register_craftitem("mobs_mc:bone", {
636 description
= "Bone",
637 _doc_items_longdesc
= "Bones can be used to tame wolves so they will protect you. They are also useful as a crafting ingredient.",
638 _doc_items_usagehelp
= "Hold the bone in your hand near wolves to attract them. Rightclick the wolf to give it a bone and tame it.",
639 inventory_image
= "mcl_mobitems_bone.png"
641 if minetest
.get_modpath("bones") then
642 minetest
.register_craft({
643 output
= "mobs_mc:bone 3",
644 recipe
= {{ "bones:bones" }},