3 --made for MC like Survival game
4 --License for code WTFPL and otherwise stated in readmes
7 --dofile(minetest.get_modpath("mobs").."/api.lua")
8 --THIS IS THE MASTER ITEM LIST TO USE WITH DEFAULT
11 local MP
= minetest
.get_modpath(minetest
.get_current_modname())
12 local S
, NS
= dofile(MP
.."/intllib.lua")
14 local c
= mobs_mc
.is_item_variable_overridden
17 if c("blaze_rod") then
18 minetest
.register_craftitem("mobs_mc:blaze_rod", {
19 description
= S("Blaze Rod"),
20 _doc_items_longdesc
= S("This is a crafting component dropped from dead blazes."),
21 wield_image
= "mcl_mobitems_blaze_rod.png",
22 inventory_image
= "mcl_mobitems_blaze_rod.png",
25 -- Make blaze rod furnace-burnable. 1.5 times the burn time of a coal lump
26 local coalcraft
, burntime
27 if minetest
.get_modpath("default") then
28 coalcraft
= minetest
.get_craft_result({method
="fuel", width
=1, items
={"default:coal_lump"}})
31 burntime
= math
.floor(coalcraft
.time
* 1.5)
33 if burntime
== nil or burntime
== 0 then
37 minetest
.register_craft({
40 recipe
= "mobs_mc:blaze_rod",
44 if c("blaze_powder") then
45 minetest
.register_craftitem("mobs_mc:blaze_powder", {
46 description
= S("Blaze Powder"),
47 _doc_items_longdesc
= S("This item is mainly used for brewing potions and crafting."),
48 wield_image
= "mcl_mobitems_blaze_powder.png",
49 inventory_image
= "mcl_mobitems_blaze_powder.png",
53 if c("blaze_rod") and c("blaze_powder") then
54 minetest
.register_craft({
55 output
= "mobs_mc:blaze_powder 2",
56 recipe
= {{ "mobs_mc:blaze_rod" }},
61 if c("chicken_raw") then
62 minetest
.register_craftitem("mobs_mc:chicken_raw", {
63 description
= S("Raw Chicken"),
64 _doc_items_longdesc
= S("Raw chicken is a food item and can be eaten safely. Cooking it will increase its nutritional value."),
65 inventory_image
= "mcl_mobitems_chicken_raw.png",
66 groups
= { food
= 2, eatable
= 2 },
67 on_use
= minetest
.item_eat(2),
71 if c("chicken_cooked") then
72 minetest
.register_craftitem("mobs_mc:chicken_cooked", {
73 description
= S("Cooked Chicken"),
74 _doc_items_longdesc
= S("A cooked chicken is a healthy food item which can be eaten."),
75 inventory_image
= "mcl_mobitems_chicken_cooked.png",
76 groups
= { food
= 2, eatable
= 6 },
77 on_use
= minetest
.item_eat(6),
81 if c("chicken_raw") and c("chicken_cooked") then
82 minetest
.register_craft({
84 output
= "mobs_mc:chicken_cooked",
85 recipe
= "mobs_mc:chicken_raw",
91 minetest
.register_craftitem("mobs_mc:feather", {
92 description
= S("Feather"),
93 _doc_items_longdesc
= S("Feathers are used in crafting and are dropped from chickens."),
94 inventory_image
= "mcl_mobitems_feather.png",
100 minetest
.register_craftitem("mobs_mc:beef_raw", {
101 description
= S("Raw Beef"),
102 _doc_items_longdesc
= S("Raw beef is the flesh from cows and can be eaten safely. Cooking it will greatly increase its nutritional value."),
103 inventory_image
= "mcl_mobitems_beef_raw.png",
104 groups
= { food
= 2, eatable
= 3 },
105 on_use
= minetest
.item_eat(3),
109 if c("beef_cooked") then
110 minetest
.register_craftitem("mobs_mc:beef_cooked", {
111 description
= S("Steak"),
112 _doc_items_longdesc
= S("Steak is cooked beef from cows and can be eaten."),
113 inventory_image
= "mcl_mobitems_beef_cooked.png",
114 groups
= { food
= 2, eatable
= 8 },
115 on_use
= minetest
.item_eat(8),
119 if c("beef_raw") and c("beef_cooked") then
120 minetest
.register_craft({
122 output
= "mobs_mc:beef_cooked",
123 recipe
= "mobs_mc:beef_raw",
131 minetest
.register_craftitem("mobs_mc:milk_bucket", {
132 description
= S("Milk"),
133 _doc_items_longdesc
= S("Milk is a food item obtained by using a bucket on a cow."),
134 inventory_image
= "mobs_bucket_milk.png",
135 groups
= { food
= 3, eatable
= 1 },
136 on_use
= minetest
.item_eat(1, "bucket:bucket_empty"),
142 minetest
.register_craftitem("mobs_mc:bowl", {
143 description
= S("Bowl"),
144 _doc_items_longdesc
= S("Bowls are mainly used to hold tasty soups."),
145 inventory_image
= "mcl_core_bowl.png",
148 minetest
.register_craft({
149 output
= "mobs_mc:bowl",
151 { "group:wood", "", "group:wood" },
152 { "", "group:wood", "", },
156 minetest
.register_craft({
158 recipe
= "mobs_mc:bowl",
163 if c("mushroom_stew") then
164 minetest
.register_craftitem("mobs_mc:mushroom_stew", {
165 description
= S("Mushroom Stew"),
166 _doc_items_longdesc
= S("Mushroom stew is a healthy soup."),
167 inventory_image
= "farming_mushroom_stew.png",
168 groups
= { food
= 3, eatable
= 6 },
169 on_use
= minetest
.item_eat(6, "mobs_mc:bowl"),
175 if c("dragon_egg") then
177 local dragon_egg_sounds
178 if minetest
.get_modpath("default") then
179 dragon_egg_sounds
= default
.node_sound_stone_defaults()
183 minetest
.register_node("mobs_mc:dragon_egg", {
184 description
= S("Dragon Egg"),
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",
191 "mcl_end_dragon_egg.png",
193 drawtype
= "nodebox",
194 is_ground_content
= false,
200 {-0.375, -0.5, -0.375, 0.375, -0.4375, 0.375},
201 {-0.5, -0.4375, -0.5, 0.5, -0.1875, 0.5},
202 {-0.4375, -0.1875, -0.4375, 0.4375, 0, 0.4375},
203 {-0.375, 0, -0.375, 0.375, 0.125, 0.375},
204 {-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125},
205 {-0.25, 0.25, -0.25, 0.25, 0.3125, 0.25},
206 {-0.1875, 0.3125, -0.1875, 0.1875, 0.375, 0.1875},
207 {-0.125, 0.375, -0.125, 0.125, 0.4375, 0.125},
208 {-0.0625, 0.4375, -0.0625, 0.0625, 0.5, 0.0625},
214 groups
= {snappy
= 1, falling_node
= 1, deco_block
= 1, not_in_creative_inventory
= 1, dig_by_piston
= 1 },
215 sounds
= dragon_egg_sounds
,
216 -- TODO: Make dragon egg teleport on punching
220 local longdesc_craftitem
221 if minetest
.get_modpath("doc_items") then
222 longdesc_craftitem
= doc
.sub
.items
.temp
.craftitem
226 if c("ender_eye") then
227 minetest
.register_craftitem("mobs_mc:ender_eye", {
228 description
= S("Eye of Ender"),
229 _doc_items_longdesc
= longdesc_craftitem
,
230 inventory_image
= "mcl_end_ender_eye.png",
231 groups
= { craftitem
= 1 },
235 if c("ender_eye") and c("blaze_powder") and c("blaze_rod") then
236 minetest
.register_craft({
238 output
= 'mobs_mc:ender_eye',
239 recipe
= { 'mobs_mc:blaze_powder', 'mobs_mc:blaze_rod'},
244 if c("ghast_tear") then
245 minetest
.register_craftitem("mobs_mc:ghast_tear", {
246 description
= S("Ghast Tear"),
247 _doc_items_longdesc
= S("A ghast tear is an item used in potion brewing. It is dropped from dead ghasts."),
248 wield_image
= "mcl_mobitems_ghast_tear.png",
249 inventory_image
= "mcl_mobitems_ghast_tear.png",
250 groups
= { brewitem
= 1 },
256 -- Overwrite the saddle from Mobs Redo
257 minetest
.register_craftitem(":mobs:saddle", {
258 description
= S("Saddle"),
259 _doc_items_longdesc
= S("Saddles can be put on horses, donkeys, mules and pigs in order to mount them."),
260 _doc_items_usagehelp
= S("Rightclick an animal while holding a saddle to put on the saddle. You can now mount the animal by rightclicking it again."),
261 inventory_image
= "mcl_mobitems_saddle.png",
266 if c("saddle") and c("lether") and c("string") and c("iron_ingot") then
267 minetest
.register_craft({
268 output
= "mobs_mc:saddle",
270 {"mobs:leather", "mobs:leather", "mobs:leather"},
271 {"farming:string", "", "farming:string"},
272 {"default:steel_ingot", "", "default:steel_ingot"}
278 local horse_armor_use
= S("Rightclick a horse to put on the horse armor. Donkeys and mules can't wear horse armor.")
279 -- TODO: Balance the horse armor strength, compare with MC armor strength
280 if c("iron_horse_armor") then
281 minetest
.register_craftitem("mobs_mc:iron_horse_armor", {
282 description
= S("Iron Horse Armor"),
283 _doc_items_longdesc
= S("Iron horse armor can be worn by horses to increase their protection from harm a bit."),
284 _doc_items_usagehelp
= horse_armor_use
,
285 inventory_image
= "mobs_mc_iron_horse_armor.png",
286 _horse_overlay_image
= "mobs_mc_horse_armor_iron.png",
288 groups
= { horse_armor
= 85 },
291 if c("gold_horse_armor") then
292 minetest
.register_craftitem("mobs_mc:gold_horse_armor", {
293 description
= S("Golden Horse Armor"),
294 _doc_items_longdesc
= S("Golden horse armor can be worn by horses to increase their protection from harm."),
295 _doc_items_usagehelp
= horse_armor_use
,
296 inventory_image
= "mobs_mc_gold_horse_armor.png",
297 _horse_overlay_image
= "mobs_mc_horse_armor_gold.png",
299 groups
= { horse_armor
= 60 },
302 if c("diamond_horse_armor") then
303 minetest
.register_craftitem("mobs_mc:diamond_horse_armor", {
304 description
= S("Diamond Horse Armor"),
305 _doc_items_longdesc
= S("Diamond horse armor can be worn by horses to greatly increase their protection from harm."),
306 _doc_items_usagehelp
= horse_armor_use
,
307 inventory_image
= "mobs_mc_diamond_horse_armor.png",
308 _horse_overlay_image
= "mobs_mc_horse_armor_diamond.png",
310 groups
= { horse_armor
= 45 },
315 if c("porkchop_raw") then
316 minetest
.register_craftitem("mobs_mc:porkchop_raw", {
317 description
= S("Raw Porkchop"),
318 _doc_items_longdesc
= S("A raw porkchop is the flesh from a pig and can be eaten safely. Cooking it will greatly increase its nutritional value."),
319 inventory_image
= "mcl_mobitems_porkchop_raw.png",
320 groups
= { food
= 2, eatable
= 3 },
321 on_use
= minetest
.item_eat(3),
325 if c("porkchop_cooked") then
326 minetest
.register_craftitem("mobs_mc:porkchop_cooked", {
327 description
= S("Cooked Porkchop"),
328 _doc_items_longdesc
= "Cooked porkchop is the cooked flesh of a pig and is used as food.",
329 inventory_image
= "mcl_mobitems_porkchop_cooked.png",
330 groups
= { food
= 2, eatable
= 8 },
331 on_use
= minetest
.item_eat(8),
335 if c("porkchop_raw") and c("porkchop_cooked") then
336 minetest
.register_craft({
338 output
= "mobs_mc:porkchop_cooked",
339 recipe
= "mobs_mc:porkchop_raw",
344 if c("carrot_on_a_stick") then
345 minetest
.register_tool("mobs_mc:carrot_on_a_stick", {
346 description
= S("Carrot on a Stick"),
347 _doc_items_longdesc
= S("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."),
348 _doc_items_usagehelp
= S("Rightclick a saddled pig with the carrot on a stick to mount it. You can now ride it like a horse."),
349 wield_image
= "mcl_mobitems_carrot_on_a_stick.png",
350 inventory_image
= "mcl_mobitems_carrot_on_a_stick.png",
351 sounds
= { breaks
= "default_tool_breaks" },
355 -- Poor-man's recipes for carrot on a stick
356 if c("carrot_on_a_stick") and c("stick") and c("string") and minetest
.get_modpath("farming") then
357 minetest
.register_craft({
358 output
= "mobs_mc:carrot_on_a_stick",
360 {"", "", "farming:string" },
361 {"", "group:stick", "farming:string" },
362 {"group:stick", "", "farming:bread" },
366 -- FIXME: Identify correct farming mod (check if it includes the carrot item)
367 minetest
.register_craft({
368 output
= "mobs_mc:carrot_on_a_stick",
370 {"", "", "farming:string" },
371 {"", "group:stick", "farming:string" },
372 {"group:stick", "", "farming:carrot" },
377 if c("carrot_on_a_stick") and c("stick") and c("string") and minetest
.get_modpath("fishing") and minetest
.get_modpath("farming") then
378 minetest
.register_craft({
380 output
= "mobs_mc:carrot_on_a_stick",
381 recipe
= {"fishing:pole_wood", "farming:carrot"},
386 if c("rabbit_raw") then
387 minetest
.register_craftitem("mobs_mc:rabbit_raw", {
388 description
= S("Raw Rabbit"),
389 _doc_items_longdesc
= S("Raw rabbit is a food item from a dead rabbit. It can be eaten safely. Cooking it will increase its nutritional value."),
390 inventory_image
= "mcl_mobitems_rabbit_raw.png",
391 groups
= { food
= 2, eatable
= 3 },
392 on_use
= minetest
.item_eat(3),
396 if c("rabbit_cooked") then
397 minetest
.register_craftitem("mobs_mc:rabbit_cooked", {
398 description
= S("Cooked Rabbit"),
399 _doc_items_longdesc
= S("This is a food item which can be eaten."),
400 inventory_image
= "mcl_mobitems_rabbit_cooked.png",
401 groups
= { food
= 2, eatable
= 5 },
402 on_use
= minetest
.item_eat(5),
406 if c("rabbit_raw") and c("rabbit_cooked") then
407 minetest
.register_craft({
409 output
= "mobs_mc:rabbit_cooked",
410 recipe
= "mobs_mc:rabbit_raw",
415 if c("rabbit_hide") then
416 minetest
.register_craftitem("mobs_mc:rabbit_hide", {
417 description
= S("Rabbit Hide"),
418 _doc_items_longdesc
= S("Rabbit hide is used to create leather."),
419 inventory_image
= "mcl_mobitems_rabbit_hide.png"
423 if c("leather") and c("rabbit_hide") then
424 minetest
.register_craft({
425 output
= "mobs:leather",
427 { "mobs_mc:rabbit_hide", "mobs_mc:rabbit_hide" },
428 { "mobs_mc:rabbit_hide", "mobs_mc:rabbit_hide" },
433 if c("rabbit_foot") then
434 minetest
.register_craftitem("mobs_mc:rabbit_foot", {
435 description
= S("Rabbit's Foot"),
436 _doc_items_longdesc
= S("This item is used in brewing."),
437 inventory_image
= "mcl_mobitems_rabbit_foot.png"
442 if c("mutton_raw") then
443 minetest
.register_craftitem("mobs_mc:mutton_raw", {
444 description
= S("Raw Mutton"),
445 _doc_items_longdesc
= S("Raw mutton is the flesh from a sheep and can be eaten safely. Cooking it will greatly increase its nutritional value."),
446 inventory_image
= "mcl_mobitems_mutton_raw.png",
447 groups
= { food
= 2, eatable
= 4 },
448 on_use
= minetest
.item_eat(4),
452 if c("mutton_cooked") then
453 minetest
.register_craftitem("mobs_mc:mutton_cooked", {
454 description
= S("Cooked Mutton"),
455 _doc_items_longdesc
= S("Cooked mutton is the cooked flesh from a sheep and is used as food."),
456 inventory_image
= "mcl_mobitems_mutton_cooked.png",
457 groups
= { food
= 2, eatable
= 8 },
458 on_use
= minetest
.item_eat(8),
462 if c("mutton_raw") and c("mutton_cooked") then
463 minetest
.register_craft({
465 output
= "mobs_mc:mutton_cooked",
466 recipe
= "mobs_mc:mutton_raw",
472 if c("shulker_shell") then
473 minetest
.register_craftitem("mobs_mc:shulker_shell", {
474 description
= S("Shulker Shell"),
475 _doc_items_longdesc
= S("Shulker shells are used in crafting. They are dropped from dead shulkers."),
476 inventory_image
= "mcl_mobitems_shulker_shell.png",
477 groups
= { craftitem
= 1 },
482 if c("magma_cream") then
483 minetest
.register_craftitem("mobs_mc:magma_cream", {
484 description
= S("Magma Cream"),
485 _doc_items_longdesc
= S("Magma cream is a crafting component."),
486 wield_image
= "mcl_mobitems_magma_cream.png",
487 inventory_image
= "mcl_mobitems_magma_cream.png",
488 groups
= { brewitem
= 1 },
493 if c("slimeball") then
494 minetest
.register_craftitem("mobs_mc:slimeball", {
495 description
= S("Slimeball"),
496 _doc_items_longdesc
= S("Slimeballs are used in crafting. They are dropped from slimes."),
497 inventory_image
= "mcl_mobitems_slimeball.png"
499 if minetest
.get_modpath("mesecons_materials") then
500 minetest
.register_craft({
501 output
= "mesecons_materials:glue",
502 recipe
= {{ "mobs_mc:slimeball" }},
508 if c("spider_eye") then
509 minetest
.register_craftitem("mobs_mc:spider_eye", {
510 description
= S("Spider Eye"),
511 _doc_items_longdesc
= S("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."),
512 inventory_image
= "mcl_mobitems_spider_eye.png",
513 wield_image
= "mcl_mobitems_spider_eye.png",
514 -- Simplified poisonous food
515 groups
= { food
= 2, eatable
= -2 },
516 on_use
= minetest
.item_eat(-2),
525 minetest
.register_craftitem("mobs_mc:totem", {
526 description
= S("Totem of Undying"),
527 _doc_items_longdesc
= S("A totem of undying is a rare artifact which may safe you from certain death."),
528 _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."),
529 inventory_image
= "mcl_totems_totem.png",
530 wield_image
= "mcl_totems_totem.png",
534 minetest
.register_on_leaveplayer(function(player
)
535 hud_totem
[player
:get_player_name()] = nil
538 -- Save the player from death when holding totem of undying in hand
539 minetest
.register_on_player_hpchange(function(player
, hp_change
)
540 local hp
= player
:get_hp()
542 if hp
+ hp_change
<= 0 then
543 local wield
= player
:get_wielded_item()
544 if wield
:get_name() == "mobs_mc:totem" then
545 local ppos
= player
:get_pos()
546 local pnname
= minetest
.get_node(ppos
).name
547 -- Some exceptions when _not_ to save the player
548 for n
=1, #mobs_mc
.misc
.totem_fail_nodes
do
549 if pnname
== mobs_mc
.misc
.totem_fail_nodes
[n
] then
553 -- Reset breath as well
554 if player
:get_breath() < 11 then
555 player
:set_breath(10)
557 if not minetest
.settings
:get_bool("creative_mode") then
559 player
:set_wielded_item(wield
)
562 minetest
.sound_play({name
= "mcl_totems_totem", gain
=1}, {pos
=ppos
, max_hear_distance
=16})
565 if not hud_totem
[player
:get_player_name()] then
566 hud_totem
[player
:get_player_name()] = player
:hud_add({
567 hud_elem_type
= "image",
568 text
= "mcl_totems_totem.png",
569 position
= { x
=0.5, y
=1 },
570 scale
= { x
=17, y
=17 },
571 offset
= { x
=0, y
=-178 },
573 minetest
.after(3, function(name
)
574 local player
= minetest
.get_player_by_name(name
)
575 if player
and player
:is_player() then
576 local name
= player
:get_player_name()
577 if hud_totem
[name
] then
578 player
:hud_remove(hud_totem
[name
])
579 hud_totem
[name
] = nil
582 end, player
:get_player_name())
585 -- Set HP to exactly 1
594 if c("rotten_flesh") then
595 minetest
.register_craftitem("mobs_mc:rotten_flesh", {
596 description
= S("Rotten Flesh"),
597 _doc_items_longdesc
= S("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."),
598 inventory_image
= "mcl_mobitems_rotten_flesh.png",
599 -- Simplified poisonous food
600 groups
= { food
= 2, eatable
= -4 },
601 on_use
= minetest
.item_eat(-4),
606 if c("nether_star") then
607 minetest
.register_craftitem("mobs_mc:nether_star", {
608 description
= S("Nether Star"),
609 _doc_items_longdesc
= S("A nether star is a crafting component. It is dropped from the Wither."),
610 inventory_image
= "mcl_mobitems_nether_star.png"
614 if c("snowball") and minetest
.get_modpath("default") then
615 minetest
.register_craft({
616 output
= "mobs_mc:snowball 2",
621 minetest
.register_craft({
622 output
= "default:snow 2",
624 {"mobs_mc:snowball", "mobs_mc:snowball"},
625 {"mobs_mc:snowball", "mobs_mc:snowball"},
628 -- Change the appearance of default snow to avoid confusion with snowball
629 minetest
.override_item("default:snow", {
630 inventory_image
= "",
636 minetest
.register_craftitem("mobs_mc:bone", {
637 description
= S("Bone"),
638 _doc_items_longdesc
= S("Bones can be used to tame wolves so they will protect you. They are also useful as a crafting ingredient."),
639 _doc_items_usagehelp
= S("Hold the bone in your hand near wolves to attract them. Rightclick the wolf to give it a bone and tame it."),
640 inventory_image
= "mcl_mobitems_bone.png"
642 if minetest
.get_modpath("bones") then
643 minetest
.register_craft({
644 output
= "mobs_mc:bone 3",
645 recipe
= {{ "bones:bones" }},