Remove lapis requirement in creative

This commit is contained in:
payton 2024-11-19 16:24:08 -07:00
parent 1b688732fe
commit 1e2457567f
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 for i, slot in ipairs(table_slots) do
any_enchantment = any_enchantment or slot any_enchantment = any_enchantment or slot
local enough_lapis = inv:contains_item("enchanting_lapis", ItemStack({ name = "mcl_core:lapis", count = i })) local enough_lapis = inv:contains_item("enchanting_lapis", ItemStack({ name = "mcl_core:lapis", count = i }))
local enough_levels = true local enough_levels = slot and slot.level_requirement <= player_levels
local can_enchant = true
if mcl_gamemode.get_gamemode(player) == "survival" then if mcl_gamemode.get_gamemode(player) == "survival" then
local enough_levels = slot and slot.level_requirement <= player_levels can_enchant = (slot and enough_lapis and enough_levels)
end end
local can_enchant = (slot and enough_lapis and enough_levels)
local ending = (can_enchant and "" or "_off") local ending = (can_enchant and "" or "_off")
local hover_ending = (can_enchant and "_hovered" or "_off") local hover_ending = (can_enchant and "_hovered" or "_off")
formspec = formspec 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 num_bookshelfes = meta:get_int("mcl_enchanting:num_bookshelves")
local itemstack = inv:get_stack("enchanting_item", 1) local itemstack = inv:get_stack("enchanting_item", 1)
local cost = ItemStack({ name = "mcl_core:lapis", count = button_pressed }) local cost = ItemStack({ name = "mcl_core:lapis", count = button_pressed })
if not inv:contains_item("enchanting_lapis", cost) then if not inv:contains_item("enchanting_lapis", cost) and mcl_gamemode.get_gamemode(player) == "survival" then
return return
end end
local slots = mcl_enchanting.get_table_slots(player, itemstack, num_bookshelfes) 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 return
end end
mcl_experience.set_level(player, player_level - button_pressed) mcl_experience.set_level(player, player_level - button_pressed)
inv:remove_item("enchanting_lapis", cost)
end end
inv:remove_item("enchanting_lapis", cost)
mcl_enchanting.set_enchanted_itemstring(itemstack) mcl_enchanting.set_enchanted_itemstring(itemstack)
mcl_enchanting.set_enchantments(itemstack, slot.enchantments) mcl_enchanting.set_enchantments(itemstack, slot.enchantments)
inv:set_stack("enchanting_item", 1, itemstack) inv:set_stack("enchanting_item", 1, itemstack)