Working Infinity Enchantment

This commit is contained in:
Lizzy Fleckenstein 2020-10-27 20:02:46 +01:00
parent a76fb8dd57
commit 76303ae194
2 changed files with 4 additions and 2 deletions

View File

@ -144,7 +144,6 @@ mcl_enchanting.enchantments = {
weight = 2,
description = "Turns water beneath the player into frosted ice and prevents the damage the player would take from standing on magma blocks."
},
-- unimplemented
infinity = {
name = "Infinity",
max_level = 1,

View File

@ -76,6 +76,7 @@ end
local player_shoot_arrow = function(itemstack, player, power, damage, is_critical)
local arrow_stack, arrow_stack_id = get_arrow(player)
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 arrow_stack then
@ -88,7 +89,9 @@ local player_shoot_arrow = function(itemstack, player, power, damage, is_critica
return false
end
arrow_itemstring = arrow_stack:get_name()
if not has_infinity_enchantment then
arrow_stack:take_item()
end
local inv = player:get_inventory()
inv:set_stack("main", arrow_stack_id, arrow_stack)
end