Revert "Remove lapis requirement in creative"

This reverts commit 1e2457567f.
This commit is contained in:
payton 2024-11-24 12:41:46 -07:00
parent 5a49b45791
commit 51c1f363bf
1 changed files with 5 additions and 5 deletions

View File

@ -536,11 +536,11 @@ function mcl_enchanting.show_enchanting_formspec(player)
for i, slot in ipairs(table_slots) do
any_enchantment = any_enchantment or slot
local enough_lapis = inv:contains_item("enchanting_lapis", ItemStack({ name = "mcl_core:lapis", count = i }))
local enough_levels = slot and slot.level_requirement <= player_levels
local can_enchant = true
local enough_levels = true
if mcl_gamemode.get_gamemode(player) == "survival" then
can_enchant = (slot and enough_lapis and enough_levels)
local enough_levels = slot and slot.level_requirement <= player_levels
end
local can_enchant = (slot and enough_lapis and enough_levels)
local ending = (can_enchant and "" or "_off")
local hover_ending = (can_enchant and "_hovered" or "_off")
formspec = formspec
@ -600,7 +600,7 @@ function mcl_enchanting.handle_formspec_fields(player, formname, fields)
local num_bookshelfes = meta:get_int("mcl_enchanting:num_bookshelves")
local itemstack = inv:get_stack("enchanting_item", 1)
local cost = ItemStack({ name = "mcl_core:lapis", count = button_pressed })
if not inv:contains_item("enchanting_lapis", cost) and mcl_gamemode.get_gamemode(player) == "survival" then
if not inv:contains_item("enchanting_lapis", cost) then
return
end
local slots = mcl_enchanting.get_table_slots(player, itemstack, num_bookshelfes)
@ -614,8 +614,8 @@ function mcl_enchanting.handle_formspec_fields(player, formname, fields)
return
end
mcl_experience.set_level(player, player_level - button_pressed)
inv:remove_item("enchanting_lapis", cost)
end
inv:remove_item("enchanting_lapis", cost)
mcl_enchanting.set_enchanted_itemstring(itemstack)
mcl_enchanting.set_enchantments(itemstack, slot.enchantments)
inv:set_stack("enchanting_item", 1, itemstack)