Working Infinity Enchantment
This commit is contained in:
parent
a76fb8dd57
commit
76303ae194
|
@ -144,7 +144,6 @@ mcl_enchanting.enchantments = {
|
||||||
weight = 2,
|
weight = 2,
|
||||||
description = "Turns water beneath the player into frosted ice and prevents the damage the player would take from standing on magma blocks."
|
description = "Turns water beneath the player into frosted ice and prevents the damage the player would take from standing on magma blocks."
|
||||||
},
|
},
|
||||||
-- unimplemented
|
|
||||||
infinity = {
|
infinity = {
|
||||||
name = "Infinity",
|
name = "Infinity",
|
||||||
max_level = 1,
|
max_level = 1,
|
||||||
|
|
|
@ -76,6 +76,7 @@ end
|
||||||
local player_shoot_arrow = function(itemstack, player, power, damage, is_critical)
|
local player_shoot_arrow = function(itemstack, player, power, damage, is_critical)
|
||||||
local arrow_stack, arrow_stack_id = get_arrow(player)
|
local arrow_stack, arrow_stack_id = get_arrow(player)
|
||||||
local arrow_itemstring
|
local arrow_itemstring
|
||||||
|
local has_infinity_enchantment = rawget(_G, "mcl_enchanting") and mcl_enchanting.get_enchantment(player:get_wielded_item(), "infinity") > 0
|
||||||
|
|
||||||
if minetest.is_creative_enabled(player:get_player_name()) then
|
if minetest.is_creative_enabled(player:get_player_name()) then
|
||||||
if arrow_stack then
|
if arrow_stack then
|
||||||
|
@ -88,7 +89,9 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
arrow_itemstring = arrow_stack:get_name()
|
arrow_itemstring = arrow_stack:get_name()
|
||||||
|
if not has_infinity_enchantment then
|
||||||
arrow_stack:take_item()
|
arrow_stack:take_item()
|
||||||
|
end
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:set_stack("main", arrow_stack_id, arrow_stack)
|
inv:set_stack("main", arrow_stack_id, arrow_stack)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user