1 local go_fishing
= function(itemstack
, user
, pointed_thing
)
2 if pointed_thing
and pointed_thing
.under
then
3 -- Use pointed node's on_rightclick function first, if present
4 local node
= minetest
.get_node(pointed_thing
.under
)
5 if user
and not user
:get_player_control().sneak
then
6 if minetest
.registered_nodes
[node
.name
] and minetest
.registered_nodes
[node
.name
].on_rightclick
then
7 return minetest
.registered_nodes
[node
.name
].on_rightclick(pointed_thing
.under
, node
, user
, itemstack
) or itemstack
11 if string.find(node
.name
, "mcl_core:water") then
15 -- FIXME: Maybe use a better seeding
16 local pr
= PseudoRandom(os
.time() * math
.random(1, 100))
17 local r
= pr
:next(1, 100)
20 items
= mcl_loot
.get_loot({
22 { itemstring
= "mcl_fishing:fish_raw", weight
= 60 },
23 { itemstring
= "mcl_fishing:salmon_raw", weight
= 25 },
24 { itemstring
= "mcl_fishing:clownfish_raw", weight
= 2 },
25 { itemstring
= "mcl_fishing:pufferfish_raw", weight
= 13 },
30 items
= mcl_loot
.get_loot({
32 { itemstring
= "mcl_core:bowl", weight
= 10 },
33 { itemstring
= "mcl_fishing:fishing_rod", weight
= 2, wear_min
= 6554, wear_max
= 65535 }, -- 10%-100% damage
34 { itemstring
= "mcl_mobitems:leather", weight
= 10 },
35 { itemstring
= "3d_armor:boots_leather", weight
= 10, wear_min
= 6554, wear_max
= 65535 }, -- 10%-100% damage
36 { itemstring
= "mcl_mobitems:rotten_flesh", weight
= 10 },
37 { itemstring
= "mcl_core:stick", weight
= 5 },
38 { itemstring
= "mcl_mobitems:string", weight
= 5 },
39 { itemstring
= "mcl_potions:potion_water", weight
= 10 },
40 { itemstring
= "mcl_mobitems:bone", weight
= 10 },
41 { itemstring
= "mcl_dye:black", weight
= 1, amount_min
= 10, amount_max
= 10 },
42 { itemstring
= "mcl_mobitems:string", weight
= 10 }, -- TODO: Tripwire Hook
47 items
= mcl_loot
.get_loot({
49 -- TODO: Enchanted Bow
50 { itemstring
= "mcl_bows:bow", wear_min
= 49144, wear_max
= 65535 }, -- 75%-100% damage
51 -- TODO: Enchanted Book
52 { itemstring
= "mcl_books:book" },
53 -- TODO: Enchanted Fishing Rod
54 { itemstring
= "mcl_fishing:fishing_rod", wear_min
= 49144, wear_max
= 65535 }, -- 75%-100% damage
55 { itemstring
= "mcl_mobs:nametag", },
56 { itemstring
= "mcl_mobitems:saddle", },
57 { itemstring
= "mcl_flowers:waterlily", },
63 item
= ItemStack(items
[1])
67 local inv
= user
:get_inventory()
68 if inv
:room_for_item("main", item
) then
69 inv
:add_item("main", item
)
71 if not minetest
.settings
:get_bool("creative_mode") then
72 local idef
= itemstack
:get_definition()
73 itemstack
:add_wear(65535/65) -- 65 uses
74 if itemstack
:get_count() == 0 and idef
.sound
and idef
.sound
.breaks
then
75 minetest
.sound_play(idef
.sound
.breaks
, {pos
=pointed_thing
.above
, gain
=0.5})
85 minetest
.register_tool("mcl_fishing:fishing_rod", {
86 description
= "Fishing Rod",
87 _doc_items_longdesc
= "Fishing rods can be used to catch fish.",
88 _doc_items_usagehelp
= "Rightclick a water source to try to go fishing. Who knows what you're going to catch?",
89 -- This item is incomplete, hide it from creative inventory
90 groups
= { tool
=1, not_in_creative_inventory
=1 },
91 inventory_image
= "mcl_fishing_fishing_rod.png",
93 liquids_pointable
= true,
94 on_place
= go_fishing
,
95 sound
= { breaks
= "default_tool_breaks" },
100 Temporarily removed from crafting as the fishing rod is massively overpowered atm.
102 TODO: Re-enable crafting when fishing rod has been improved.
104 minetest.register_craft({
105 output = "mcl_fishing:fishing_rod",
107 {'','','mcl_core:stick'},
108 {'','mcl_core:stick','mcl_mobitems:string'},
109 {'mcl_core:stick','','mcl_mobitems:string'},
112 minetest.register_craft({
113 output = "mcl_fishing:fishing_rod",
115 {'mcl_core:stick', '', ''},
116 {'mcl_mobitems:string', 'mcl_core:stick', ''},
117 {'mcl_mobitems:string','','mcl_core:stick'},
122 minetest
.register_craft({
124 recipe
= "mcl_fishing:fishing_rod",
130 minetest
.register_craftitem("mcl_fishing:fish_raw", {
131 description
= "Raw Fish",
132 _doc_items_longdesc
= "Raw fish is obtained by fishing and is a food item which can be eaten safely. Cooking it improves its nutritional value.",
133 inventory_image
= "mcl_fishing_fish_raw.png",
134 on_place
= minetest
.item_eat(2),
135 on_secondary_use
= minetest
.item_eat(2),
137 groups
= { food
=2, eatable
= 2 },
138 _mcl_saturation
= 0.4,
141 minetest
.register_craftitem("mcl_fishing:fish_cooked", {
142 description
= "Cooked Fish",
143 _doc_items_longdesc
= "Mmh, fish! This is a healthy food item.",
144 inventory_image
= "mcl_fishing_fish_cooked.png",
145 on_place
= minetest
.item_eat(5),
146 on_secondary_use
= minetest
.item_eat(5),
148 groups
= { food
=2, eatable
=5 },
152 minetest
.register_craft({
154 output
= "mcl_fishing:fish_cooked",
155 recipe
= "mcl_fishing:fish_raw",
160 minetest
.register_craftitem("mcl_fishing:salmon_raw", {
161 description
= "Raw Salmon",
162 _doc_items_longdesc
= "Raw salmon is obtained by fishing and is a food item which can be eaten safely. Cooking it improves its nutritional value.",
163 inventory_image
= "mcl_fishing_salmon_raw.png",
164 on_place
= minetest
.item_eat(2),
165 on_secondary_use
= minetest
.item_eat(2),
167 groups
= { food
=2, eatable
= 2 },
168 _mcl_saturation
= 0.4,
171 minetest
.register_craftitem("mcl_fishing:salmon_cooked", {
172 description
= "Cooked Salmon",
173 _doc_items_longdesc
= "This is a healthy food item which can be eaten.",
174 inventory_image
= "mcl_fishing_salmon_cooked.png",
175 on_place
= minetest
.item_eat(6),
176 on_secondary_use
= minetest
.item_eat(6),
178 groups
= { food
=2, eatable
=6 },
179 _mcl_saturation
= 9.6,
182 minetest
.register_craft({
184 output
= "mcl_fishing:salmon_cooked",
185 recipe
= "mcl_fishing:salmon_raw",
190 minetest
.register_craftitem("mcl_fishing:clownfish_raw", {
191 description
= "Clownfish",
192 _doc_items_longdesc
= "Clownfish may be obtained by fishing (and luck) and is a food item which can be eaten safely.",
193 inventory_image
= "mcl_fishing_clownfish_raw.png",
194 on_place
= minetest
.item_eat(1),
195 on_secondary_use
= minetest
.item_eat(1),
197 groups
= { food
=2, eatable
= 1 },
198 _mcl_saturation
= 0.2,
202 -- TODO: Add real status effect
203 minetest
.register_craftitem("mcl_fishing:pufferfish_raw", {
204 description
= "Pufferfish",
205 _doc_items_longdesc
= "Pufferfish are a common species of fish and can be obtained by fishing. They can technically be eaten, but they are very bad for humans. Eating a pufferfish only restores 1 hunger point and will poison you very badly (which drains your health non-fatally) and causes serious food poisoning (which increases your hunger).",
206 inventory_image
= "mcl_fishing_pufferfish_raw.png",
207 on_place
= minetest
.item_eat(1),
208 on_secondary_use
= minetest
.item_eat(1),
210 groups
= { food
=2, eatable
=1 },
211 _mcl_saturation
= 0.2,