Fix enchanting table experience requirement in creative mode (#4705)
Reviewed-on: VoxeLibre/VoxeLibre#4705 Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-authored-by: payton <pdp9729@gmail.com> Co-committed-by: payton <pdp9729@gmail.com>
This commit is contained in:
parent
d7f0070aca
commit
6247c9eeb9
|
@ -536,7 +536,10 @@ 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 enough_levels = true
|
||||
if mcl_gamemode.get_gamemode(player) == "survival" then
|
||||
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")
|
||||
|
@ -606,10 +609,12 @@ function mcl_enchanting.handle_formspec_fields(player, formname, fields)
|
|||
return
|
||||
end
|
||||
local player_level = mcl_experience.get_level(player)
|
||||
if player_level < slot.level_requirement then
|
||||
return
|
||||
if mcl_gamemode.get_gamemode(player) == "survival" then
|
||||
if player_level < slot.level_requirement then
|
||||
return
|
||||
end
|
||||
mcl_experience.set_level(player, player_level - button_pressed)
|
||||
end
|
||||
mcl_experience.set_level(player, player_level - button_pressed)
|
||||
inv:remove_item("enchanting_lapis", cost)
|
||||
mcl_enchanting.set_enchanted_itemstring(itemstack)
|
||||
mcl_enchanting.set_enchantments(itemstack, slot.enchantments)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name = mcl_enchanting
|
||||
description = Enchanting for MineClone2
|
||||
depends = tt, walkover, mcl_sounds, mcl_colors, mcl_experience, mcl_util
|
||||
depends = tt, walkover, mcl_sounds, mcl_colors, mcl_experience, mcl_util, mcl_gamemode
|
||||
optional_depends = screwdriver
|
||||
author = Fleckenstein
|
||||
|
|
Loading…
Reference in New Issue