2021-05-29 17:12:33 +03:00
local modname = minetest.get_current_modname ( )
local modpath = minetest.get_modpath ( modname )
local S = minetest.get_translator ( modname )
2020-06-13 02:11:06 +03:00
mcl_potions = { }
2020-06-27 15:15:01 +03:00
-- duration effects of redstone are a factor of 8/3
-- duration effects of glowstone are a time factor of 1/2
-- splash potion duration effects are reduced by a factor of 3/4
2020-06-27 14:56:27 +03:00
2020-07-12 03:26:45 +03:00
mcl_potions.II_FACTOR = 2
mcl_potions.PLUS_FACTOR = 8 / 3
2020-06-27 14:56:27 +03:00
mcl_potions.DURATION = 180
2020-07-12 03:26:45 +03:00
mcl_potions.DURATION_PLUS = mcl_potions.DURATION * mcl_potions.PLUS_FACTOR
mcl_potions.DURATION_2 = mcl_potions.DURATION / mcl_potions.II_FACTOR
2020-06-27 14:56:27 +03:00
2020-06-27 15:15:01 +03:00
mcl_potions.INV_FACTOR = 0.50
mcl_potions.SPLASH_FACTOR = 0.75
2020-07-12 14:59:29 +03:00
mcl_potions.LINGERING_FACTOR = 0.25
2020-06-27 14:56:27 +03:00
2020-06-13 02:54:45 +03:00
dofile ( modpath .. " /functions.lua " )
2020-08-10 11:40:10 +03:00
dofile ( modpath .. " /commands.lua " )
2020-06-13 02:54:45 +03:00
dofile ( modpath .. " /splash.lua " )
2020-06-18 14:43:50 +03:00
dofile ( modpath .. " /lingering.lua " )
2020-07-20 01:56:18 +03:00
dofile ( modpath .. " /tipped_arrow.lua " )
2020-06-18 00:50:18 +03:00
dofile ( modpath .. " /potions.lua " )
2019-03-08 01:22:28 +02:00
2017-01-12 04:04:58 +02:00
minetest.register_craftitem ( " mcl_potions:fermented_spider_eye " , {
2019-03-08 01:22:28 +02:00
description = S ( " Fermented Spider Eye " ) ,
2021-04-17 10:26:37 +03:00
_doc_items_longdesc = S ( " Try different combinations to create potions. " ) ,
2017-01-12 04:04:58 +02:00
wield_image = " mcl_potions_spider_eye_fermented.png " ,
inventory_image = " mcl_potions_spider_eye_fermented.png " ,
2020-08-05 21:04:12 +03:00
groups = { brewitem = 1 , } ,
2017-01-12 04:04:58 +02:00
stack_max = 64 ,
} )
minetest.register_craft ( {
type = " shapeless " ,
output = " mcl_potions:fermented_spider_eye " ,
2017-03-01 02:16:52 +02:00
recipe = { " mcl_mushrooms:mushroom_brown " , " mcl_core:sugar " , " mcl_mobitems:spider_eye " } ,
2017-01-12 04:04:58 +02:00
} )
2017-01-20 12:11:33 +02:00
minetest.register_craftitem ( " mcl_potions:glass_bottle " , {
2019-03-08 01:22:28 +02:00
description = S ( " Glass Bottle " ) ,
2020-02-19 05:54:17 +02:00
_tt_help = S ( " Liquid container " ) ,
2019-03-08 01:22:28 +02:00
_doc_items_longdesc = S ( " A glass bottle is used as a container for liquids and can be used to collect water directly. " ) ,
2020-07-12 18:58:34 +03:00
_doc_items_usagehelp = S ( " To collect water, use it on a cauldron with water (which removes a level of water) or any water source (which removes no water). " ) ,
2020-07-04 01:33:24 +03:00
inventory_image = " mcl_potions_potion_bottle.png " ,
wield_image = " mcl_potions_potion_bottle.png " ,
2017-01-20 12:11:33 +02:00
groups = { brewitem = 1 } ,
2017-03-01 17:53:03 +02:00
liquids_pointable = true ,
on_place = function ( itemstack , placer , pointed_thing )
if pointed_thing.type == " node " then
local node = minetest.get_node ( pointed_thing.under )
local def = minetest.registered_nodes [ node.name ]
2017-03-01 17:55:48 +02:00
-- Call on_rightclick if the pointed node defines it
2020-06-09 00:47:53 +03:00
if placer and not placer : get_player_control ( ) . sneak then
2017-03-01 17:55:48 +02:00
if def and def.on_rightclick then
return def.on_rightclick ( pointed_thing.under , node , placer , itemstack ) or itemstack
end
end
2017-03-01 17:53:03 +02:00
-- Try to fill glass bottle with water
2017-03-01 19:06:09 +02:00
local get_water = false
2021-04-17 10:26:37 +03:00
--local from_liquid_source = false
2017-11-30 20:27:57 +02:00
local river_water = false
2021-04-17 10:26:37 +03:00
if def and def.groups and def.groups . water and def.liquidtype == " source " then
2017-03-01 19:06:09 +02:00
-- Water source
get_water = true
2021-04-17 10:26:37 +03:00
--from_liquid_source = true
2017-11-30 20:27:57 +02:00
river_water = node.name == " mclx_core:river_water_source "
2017-03-01 19:06:09 +02:00
-- Or reduce water level of cauldron by 1
2019-02-08 23:17:51 +02:00
elseif string.sub ( node.name , 1 , 14 ) == " mcl_cauldrons: " then
local pname = placer : get_player_name ( )
if minetest.is_protected ( pointed_thing.under , pname ) then
minetest.record_protection_violation ( pointed_thing.under , pname )
return itemstack
end
if node.name == " mcl_cauldrons:cauldron_3 " then
get_water = true
minetest.set_node ( pointed_thing.under , { name = " mcl_cauldrons:cauldron_2 " } )
elseif node.name == " mcl_cauldrons:cauldron_2 " then
get_water = true
minetest.set_node ( pointed_thing.under , { name = " mcl_cauldrons:cauldron_1 " } )
elseif node.name == " mcl_cauldrons:cauldron_1 " then
get_water = true
minetest.set_node ( pointed_thing.under , { name = " mcl_cauldrons:cauldron " } )
elseif node.name == " mcl_cauldrons:cauldron_3r " then
get_water = true
river_water = true
minetest.set_node ( pointed_thing.under , { name = " mcl_cauldrons:cauldron_2r " } )
elseif node.name == " mcl_cauldrons:cauldron_2r " then
get_water = true
river_water = true
minetest.set_node ( pointed_thing.under , { name = " mcl_cauldrons:cauldron_1r " } )
elseif node.name == " mcl_cauldrons:cauldron_1r " then
get_water = true
river_water = true
minetest.set_node ( pointed_thing.under , { name = " mcl_cauldrons:cauldron " } )
end
2017-03-01 19:06:09 +02:00
end
if get_water then
2020-09-27 21:56:39 +03:00
local water_bottle
if river_water then
water_bottle = ItemStack ( " mcl_potions:river_water " )
else
water_bottle = ItemStack ( " mcl_potions:water " )
end
-- Replace with water bottle, if possible, otherwise
-- place the water potion at a place where's space
local inv = placer : get_inventory ( )
minetest.sound_play ( " mcl_potions_bottle_fill " , { pos = pointed_thing.under , gain = 0.5 , max_hear_range = 16 } , true )
if minetest.is_creative_enabled ( placer : get_player_name ( ) ) then
-- Don't replace empty bottle in creative for convenience reasons
if not inv : contains_item ( " main " , water_bottle ) then
inv : add_item ( " main " , water_bottle )
2019-02-09 00:55:49 +02:00
end
2020-09-27 21:56:39 +03:00
elseif itemstack : get_count ( ) == 1 then
return water_bottle
else
if inv : room_for_item ( " main " , water_bottle ) then
inv : add_item ( " main " , water_bottle )
2019-02-09 00:55:49 +02:00
else
2020-09-27 21:56:39 +03:00
minetest.add_item ( placer : get_pos ( ) , water_bottle )
2017-03-01 17:53:03 +02:00
end
2020-09-27 21:56:39 +03:00
itemstack : take_item ( )
2017-03-01 17:53:03 +02:00
end
end
end
return itemstack
end ,
2017-01-20 12:11:33 +02:00
} )
minetest.register_craft ( {
output = " mcl_potions:glass_bottle 3 " ,
recipe = {
2017-02-01 00:32:56 +02:00
{ " mcl_core:glass " , " " , " mcl_core:glass " } ,
{ " " , " mcl_core:glass " , " " }
2017-01-20 12:11:33 +02:00
}
} )
2017-11-30 21:35:21 +02:00
-- Template function for creating images of filled potions
2017-03-01 17:36:26 +02:00
-- - colorstring must be a ColorString of form “#RRGGBB”, e.g. “#0000FF” for blue.
-- - opacity is optional opacity from 0-255 (default: 127)
2021-05-29 17:12:33 +03:00
local function potion_image ( colorstring , opacity )
2017-03-01 17:36:26 +02:00
if not opacity then
opacity = 127
end
2020-07-04 01:33:24 +03:00
return " mcl_potions_potion_overlay.png^[colorize: " .. colorstring .. " : " .. tostring ( opacity ) .. " ^mcl_potions_potion_bottle.png "
2020-06-09 00:47:53 +03:00
end
2020-06-13 02:54:45 +03:00
2017-03-01 17:36:26 +02:00
2017-11-30 21:35:21 +02:00
-- Cauldron fill up rules:
-- Adding any water increases the water level by 1, preserving the current water type
2017-11-30 20:27:57 +02:00
local cauldron_levels = {
2017-11-30 21:35:21 +02:00
-- start = { add water, add river water }
{ " " , " _1 " , " _1r " } ,
{ " _1 " , " _2 " , " _2 " } ,
{ " _2 " , " _3 " , " _3 " } ,
{ " _1r " , " _2r " , " _2r " } ,
{ " _2r " , " _3r " , " _3r " } ,
2017-11-30 20:27:57 +02:00
}
local fill_cauldron = function ( cauldron , water_type )
local base = " mcl_cauldrons:cauldron "
for i = 1 , # cauldron_levels do
if cauldron == base .. cauldron_levels [ i ] [ 1 ] then
if water_type == " mclx_core:river_water_source " then
return base .. cauldron_levels [ i ] [ 3 ]
else
return base .. cauldron_levels [ i ] [ 2 ]
end
end
end
end
2022-07-08 02:50:51 +03:00
-- function to set node and empty water bottle (used for cauldrons and mud)
local function set_node_empty_bottle ( itemstack , placer , pointed_thing , newitemstring )
local pname = placer : get_player_name ( )
if minetest.is_protected ( pointed_thing.under , pname ) then
minetest.record_protection_violation ( pointed_thing.under , pname )
return itemstack
end
-- set the node to `itemstring`
minetest.set_node ( pointed_thing.under , { name = newitemstring } )
-- play sound
minetest.sound_play ( " mcl_potions_bottle_pour " , { pos = pointed_thing.under , gain = 0.5 , max_hear_range = 16 } , true )
--
if minetest.is_creative_enabled ( placer : get_player_name ( ) ) then
return itemstack
else
return " mcl_potions:glass_bottle "
end
end
-- used for water bottles and river water bottles
local function dispense_water_bottle ( stack , pos , droppos )
local node = minetest.get_node ( droppos )
if node.name == " mcl_core:dirt " or node.name == " mcl_core:coarse_dirt " then
-- convert dirt/coarse dirt to mud
minetest.set_node ( droppos , { name = " mcl_mud:mud " } )
minetest.sound_play ( " mcl_potions_bottle_pour " , { pos = droppos , gain = 0.5 , max_hear_range = 16 } , true )
return ItemStack ( " mcl_potions:glass_bottle " )
elseif node.name == " mcl_mud:mud " then
-- dont dispense into mud
return stack
end
end
-- on_place function for `mcl_potions:water` and `mcl_potions:river_water`
local function water_bottle_on_place ( itemstack , placer , pointed_thing )
if pointed_thing.type == " node " then
local node = minetest.get_node ( pointed_thing.under )
local def = minetest.registered_nodes [ node.name ]
-- Call on_rightclick if the pointed node defines it
if placer and not placer : get_player_control ( ) . sneak then
if def and def.on_rightclick then
return def.on_rightclick ( pointed_thing.under , node , placer , itemstack ) or itemstack
end
end
local cauldron = nil
if itemstack : get_name ( ) == " mcl_potions:water " then -- regular water
cauldron = fill_cauldron ( node.name , " mcl_core:water_source " )
elseif itemstack : get_name ( ) == " mcl_potions:river_water " then -- river water
cauldron = fill_cauldron ( node.name , " mclx_core:river_water_source " )
end
if cauldron then
set_node_empty_bottle ( itemstack , placer , pointed_thing , cauldron )
elseif node.name == " mcl_core:dirt " or node.name == " mcl_core:coarse_dirt " then
set_node_empty_bottle ( itemstack , placer , pointed_thing , " mcl_mud:mud " )
end
end
-- Drink the water by default
return minetest.do_item_eat ( 0 , " mcl_potions:glass_bottle " , itemstack , placer , pointed_thing )
end
2020-09-08 06:21:29 +03:00
-- Itemstring of potions is “mcl_potions:<NBT Potion Tag>”
2017-03-01 17:36:26 +02:00
2020-06-18 14:43:50 +03:00
minetest.register_craftitem ( " mcl_potions:water " , {
2019-03-08 01:22:28 +02:00
description = S ( " Water Bottle " ) ,
2020-02-19 05:54:17 +02:00
_tt_help = S ( " No effect " ) ,
2019-03-08 01:22:28 +02:00
_doc_items_longdesc = S ( " Water bottles can be used to fill cauldrons. Drinking water has no effect. " ) ,
2019-03-25 13:05:57 +02:00
_doc_items_usagehelp = S ( " Use the “Place” key to drink. Place this item on a cauldron to pour the water into the cauldron. " ) ,
2017-03-01 17:36:26 +02:00
stack_max = 1 ,
2020-07-18 00:25:49 +03:00
inventory_image = potion_image ( " #0022FF " ) ,
wield_image = potion_image ( " #0022FF " ) ,
2017-11-30 20:27:57 +02:00
groups = { brewitem = 1 , food = 3 , can_eat_when_full = 1 , water_bottle = 1 } ,
2022-07-08 02:50:51 +03:00
on_place = water_bottle_on_place ,
_on_dispense = dispense_water_bottle ,
2022-07-06 22:43:54 +03:00
_dispense_into_walkable = true ,
2017-11-30 20:27:57 +02:00
on_secondary_use = minetest.item_eat ( 0 , " mcl_potions:glass_bottle " ) ,
} )
2020-07-18 00:25:49 +03:00
2020-06-18 14:43:50 +03:00
minetest.register_craftitem ( " mcl_potions:river_water " , {
2019-03-08 01:22:28 +02:00
description = S ( " River Water Bottle " ) ,
2020-02-19 05:54:17 +02:00
_tt_help = S ( " No effect " ) ,
2019-03-08 01:22:28 +02:00
_doc_items_longdesc = S ( " River water bottles can be used to fill cauldrons. Drinking it has no effect. " ) ,
2019-03-25 13:05:57 +02:00
_doc_items_usagehelp = S ( " Use the “Place” key to drink. Place this item on a cauldron to pour the river water into the cauldron. " ) ,
2017-11-30 20:27:57 +02:00
stack_max = 1 ,
inventory_image = potion_image ( " #0044FF " ) ,
wield_image = potion_image ( " #0044FF " ) ,
groups = { brewitem = 1 , food = 3 , can_eat_when_full = 1 , water_bottle = 1 } ,
2022-07-08 02:50:51 +03:00
on_place = water_bottle_on_place ,
_on_dispense = dispense_water_bottle ,
2022-07-06 22:43:54 +03:00
_dispense_into_walkable = true ,
2017-03-01 17:36:26 +02:00
on_secondary_use = minetest.item_eat ( 0 , " mcl_potions:glass_bottle " ) ,
2020-07-18 00:25:49 +03:00
2017-03-01 17:36:26 +02:00
} )
2017-03-18 18:18:12 +02:00
2020-08-05 19:33:53 +03:00
-- Hurt mobs
2021-05-29 17:12:33 +03:00
local function water_splash ( obj , damage )
2020-08-05 19:33:53 +03:00
if not obj then
return
end
if not damage or ( damage > 0 and damage < 1 ) then
damage = 1
end
-- Damage mobs that are vulnerable to water
local lua = obj : get_luaentity ( )
2022-05-25 15:02:10 +03:00
if lua and lua.is_mob then
2020-08-05 19:33:53 +03:00
obj : punch ( obj , 1.0 , {
full_punch_interval = 1.0 ,
damage_groups = { water_vulnerable = damage } ,
} , nil )
end
end
mcl_potions.register_splash ( " water " , S ( " Splash Water Bottle " ) , " #0022FF " , {
tt = S ( " Extinguishes fire and hurts some mobs " ) ,
2020-08-08 11:00:16 +03:00
longdesc = S ( " A throwable water bottle that will shatter on impact, where it extinguishes nearby fire and hurts mobs that are vulnerable to water. " ) ,
2020-08-05 19:33:53 +03:00
no_effect = true ,
potion_fun = water_splash ,
effect = 1
} )
mcl_potions.register_lingering ( " water " , S ( " Lingering Water Bottle " ) , " #0022FF " , {
tt = S ( " Extinguishes fire and hurts some mobs " ) ,
2020-08-08 11:00:16 +03:00
longdesc = S ( " A throwable water bottle that will shatter on impact, where it creates a cloud of water vapor that lingers on the ground for a while. This cloud extinguishes fire and hurts mobs that are vulnerable to water. " ) ,
2020-08-05 19:33:53 +03:00
no_effect = true ,
potion_fun = water_splash ,
effect = 1
} )
2017-11-30 20:27:57 +02:00
2017-01-20 12:21:55 +02:00
minetest.register_craftitem ( " mcl_potions:speckled_melon " , {
2019-03-08 01:22:28 +02:00
description = S ( " Glistering Melon " ) ,
_doc_items_longdesc = S ( " This shiny melon is full of tiny gold nuggets and would be nice in an item frame. It isn't edible and not useful for anything else. " ) ,
2017-01-20 12:21:55 +02:00
stack_max = 64 ,
2020-08-05 21:04:12 +03:00
groups = { brewitem = 1 , } ,
2017-01-20 12:21:55 +02:00
inventory_image = " mcl_potions_melon_speckled.png " ,
} )
minetest.register_craft ( {
output = " mcl_potions:speckled_melon " ,
recipe = {
2021-05-29 17:12:33 +03:00
{ " mcl_core:gold_nugget " , " mcl_core:gold_nugget " , " mcl_core:gold_nugget " } ,
{ " mcl_core:gold_nugget " , " mcl_farming:melon_item " , " mcl_core:gold_nugget " } ,
{ " mcl_core:gold_nugget " , " mcl_core:gold_nugget " , " mcl_core:gold_nugget " } ,
2017-01-20 12:21:55 +02:00
}
} )
2020-06-13 02:11:06 +03:00
2020-05-28 04:15:46 +03:00
local water_table = {
2020-06-17 23:49:52 +03:00
[ " mcl_nether:nether_wart_item " ] = " mcl_potions:awkward " ,
2020-07-11 02:22:11 +03:00
-- ["mcl_potions:fermented_spider_eye"] = "mcl_potions:weakness",
2020-06-17 23:49:52 +03:00
[ " mcl_potions:speckled_melon " ] = " mcl_potions:mundane " ,
[ " mcl_core:sugar " ] = " mcl_potions:mundane " ,
[ " mcl_mobitems:magma_cream " ] = " mcl_potions:mundane " ,
[ " mcl_mobitems:blaze_powder " ] = " mcl_potions:mundane " ,
[ " mesecons:wire_00000000_off " ] = " mcl_potions:mundane " ,
[ " mcl_mobitems:ghast_tear " ] = " mcl_potions:mundane " ,
[ " mcl_mobitems:spider_eye " ] = " mcl_potions:mundane " ,
2020-07-18 00:05:40 +03:00
[ " mcl_mobitems:rabbit_foot " ] = " mcl_potions:mundane " ,
[ " mcl_nether:glowstone_dust " ] = " mcl_potions:thick " ,
[ " mcl_mobitems:gunpowder " ] = " mcl_potions:water_splash "
2020-05-28 04:15:46 +03:00
}
2020-06-09 00:47:53 +03:00
2020-05-28 04:15:46 +03:00
local awkward_table = {
[ " mcl_potions:speckled_melon " ] = " mcl_potions:healing " ,
[ " mcl_farming:carrot_item_gold " ] = " mcl_potions:night_vision " ,
[ " mcl_core:sugar " ] = " mcl_potions:swiftness " ,
2020-06-28 23:45:49 +03:00
[ " mcl_mobitems:magma_cream " ] = " mcl_potions:fire_resistance " ,
2020-07-11 02:22:11 +03:00
-- ["mcl_mobitems:blaze_powder"] = "mcl_potions:strength",
2020-06-21 04:00:57 +03:00
[ " mcl_fishing:pufferfish_raw " ] = " mcl_potions:water_breathing " ,
[ " mcl_mobitems:ghast_tear " ] = " mcl_potions:regeneration " ,
[ " mcl_mobitems:spider_eye " ] = " mcl_potions:poison " ,
2020-06-19 00:59:36 +03:00
[ " mcl_mobitems:rabbit_foot " ] = " mcl_potions:leaping " ,
2020-05-28 04:15:46 +03:00
}
2020-06-09 00:47:53 +03:00
2020-05-28 04:15:46 +03:00
local output_table = {
2020-06-18 14:43:50 +03:00
[ " mcl_potions:river_water " ] = water_table ,
[ " mcl_potions:water " ] = water_table ,
2020-06-17 23:49:52 +03:00
[ " mcl_potions:awkward " ] = awkward_table ,
2020-05-28 04:15:46 +03:00
}
2020-06-09 00:47:53 +03:00
2020-06-10 03:09:32 +03:00
local enhancement_table = { }
local extension_table = { }
2020-07-18 00:05:40 +03:00
local potions = { }
2020-07-11 02:22:11 +03:00
for i , potion in ipairs ( { " healing " , " harming " , " swiftness " , " slowness " ,
2020-08-08 11:00:16 +03:00
" leaping " , " poison " , " regeneration " , " invisibility " , " fire_resistance " ,
-- "weakness","strength",
" water_breathing " , " night_vision " } ) do
2020-06-18 05:17:16 +03:00
2020-08-08 11:00:16 +03:00
table.insert ( potions , potion )
2020-06-18 05:17:16 +03:00
2020-08-08 11:00:16 +03:00
if potion ~= " invisibility " and potion ~= " night_vision " and potion ~= " weakness " and potion ~= " water_breathing " and potion ~= " fire_resistance " then
enhancement_table [ " mcl_potions: " .. potion ] = " mcl_potions: " .. potion .. " _2 "
enhancement_table [ " mcl_potions: " .. potion .. " _splash " ] = " mcl_potions: " .. potion .. " _2_splash "
table.insert ( potions , potion .. " _2 " )
end
2020-06-18 05:17:16 +03:00
2020-08-08 11:00:16 +03:00
if potion ~= " healing " and potion ~= " harming " then
extension_table [ " mcl_potions: " .. potion .. " _splash " ] = " mcl_potions: " .. potion .. " _plus_splash "
extension_table [ " mcl_potions: " .. potion ] = " mcl_potions: " .. potion .. " _plus "
table.insert ( potions , potion .. " _plus " )
end
2020-06-18 05:17:16 +03:00
2020-06-10 03:09:32 +03:00
end
2020-07-18 00:25:49 +03:00
for i , potion in ipairs ( { " awkward " , " mundane " , " thick " , " water " } ) do
2020-07-18 00:05:40 +03:00
table.insert ( potions , potion )
end
2020-06-09 00:47:53 +03:00
local inversion_table = {
[ " mcl_potions:healing " ] = " mcl_potions:harming " ,
[ " mcl_potions:healing_2 " ] = " mcl_potions:harming_2 " ,
[ " mcl_potions:swiftness " ] = " mcl_potions:slowness " ,
2020-07-25 02:15:00 +03:00
[ " mcl_potions:swiftness_plus " ] = " mcl_potions:slowness_plus " ,
2020-06-09 00:47:53 +03:00
[ " mcl_potions:leaping " ] = " mcl_potions:slowness " ,
2020-06-13 02:11:06 +03:00
[ " mcl_potions:leaping_plus " ] = " mcl_potions:slowness_plus " ,
[ " mcl_potions:night_vision " ] = " mcl_potions:invisibility " ,
2020-06-17 05:29:35 +03:00
[ " mcl_potions:night_vision_plus " ] = " mcl_potions:invisibility_plus " ,
[ " mcl_potions:poison " ] = " mcl_potions:harming " ,
[ " mcl_potions:poison_2 " ] = " mcl_potions:harming_2 " ,
2020-06-17 23:49:52 +03:00
[ " mcl_potions:healing_splash " ] = " mcl_potions:harming_splash " ,
[ " mcl_potions:healing_2_splash " ] = " mcl_potions:harming_2_splash " ,
[ " mcl_potions:swiftness_splash " ] = " mcl_potions:slowness_splash " ,
2020-07-25 02:12:03 +03:00
[ " mcl_potions:swiftness_plus_splash " ] = " mcl_potions:slowness_plus_splash " ,
2020-06-17 23:49:52 +03:00
[ " mcl_potions:leaping_splash " ] = " mcl_potions:slowness_splash " ,
[ " mcl_potions:leaping_plus_splash " ] = " mcl_potions:slowness_plus_splash " ,
[ " mcl_potions:night_vision_splash " ] = " mcl_potions:invisibility_splash " ,
[ " mcl_potions:night_vision_plus_splash " ] = " mcl_potions:invisibility_plus_splash " ,
[ " mcl_potions:poison_splash " ] = " mcl_potions:harming_splash " ,
[ " mcl_potions:poison_2_splash " ] = " mcl_potions:harming_2_splash " ,
2020-06-09 00:47:53 +03:00
}
local splash_table = { }
2020-06-18 00:05:44 +03:00
local lingering_table = { }
2020-06-09 00:47:53 +03:00
for i , potion in ipairs ( potions ) do
2020-08-08 11:00:16 +03:00
splash_table [ " mcl_potions: " .. potion ] = " mcl_potions: " .. potion .. " _splash "
2020-07-12 03:34:19 +03:00
lingering_table [ " mcl_potions: " .. potion .. " _splash " ] = " mcl_potions: " .. potion .. " _lingering "
2020-06-09 00:47:53 +03:00
end
2020-06-18 14:43:50 +03:00
2020-06-09 00:47:53 +03:00
local mod_table = {
2020-06-10 03:09:32 +03:00
[ " mesecons:wire_00000000_off " ] = extension_table ,
2020-06-09 00:47:53 +03:00
[ " mcl_potions:fermented_spider_eye " ] = inversion_table ,
[ " mcl_nether:glowstone_dust " ] = enhancement_table ,
[ " mcl_mobitems:gunpowder " ] = splash_table ,
2020-06-18 00:05:44 +03:00
[ " mcl_potions:dragon_breath " ] = lingering_table ,
2020-06-09 00:47:53 +03:00
}
2020-05-28 01:36:10 +03:00
-- Compare two ingredients for compatable alchemy
function mcl_potions . get_alchemy ( ingr , pot )
2021-05-29 17:12:33 +03:00
if output_table [ pot ] then
2020-07-25 22:27:04 +03:00
2020-05-28 04:15:46 +03:00
local brew_table = output_table [ pot ]
2020-07-25 22:27:04 +03:00
2021-05-29 17:12:33 +03:00
if brew_table [ ingr ] then
2020-05-28 04:15:46 +03:00
return brew_table [ ingr ]
2020-05-28 01:36:10 +03:00
end
2020-07-25 22:27:04 +03:00
end
2021-05-29 17:12:33 +03:00
if mod_table [ ingr ] then
2020-06-09 00:47:53 +03:00
local brew_table = mod_table [ ingr ]
2020-07-25 22:27:04 +03:00
2021-05-29 17:12:33 +03:00
if brew_table [ pot ] then
2020-06-09 00:47:53 +03:00
return brew_table [ pot ]
end
2020-06-17 23:49:52 +03:00
2020-05-28 01:36:10 +03:00
end
2020-06-09 00:47:53 +03:00
2020-05-28 04:15:46 +03:00
return false
2020-05-28 01:36:10 +03:00
end
2021-03-07 01:42:34 +02:00
mcl_wip.register_wip_item ( " mcl_potions:night_vision " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_plus " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_splash " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_plus_splash " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_lingering " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_plus_lingering " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_arrow " )
mcl_wip.register_wip_item ( " mcl_potions:night_vision_plus_arrow " )