From 1b688732fe0514ac64dc68eec2020e3352720088 Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 18 Nov 2024 17:04:21 -0700 Subject: [PATCH] Fixed using enchantment table --- mods/ITEMS/mcl_enchanting/engine.lua | 13 +++++++++---- mods/ITEMS/mcl_enchanting/mod.conf | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/mods/ITEMS/mcl_enchanting/engine.lua b/mods/ITEMS/mcl_enchanting/engine.lua index dd01d5950..dada0b638 100644 --- a/mods/ITEMS/mcl_enchanting/engine.lua +++ b/mods/ITEMS/mcl_enchanting/engine.lua @@ -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 + 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") @@ -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) diff --git a/mods/ITEMS/mcl_enchanting/mod.conf b/mods/ITEMS/mcl_enchanting/mod.conf index d163fcd55..d12b52e4f 100644 --- a/mods/ITEMS/mcl_enchanting/mod.conf +++ b/mods/ITEMS/mcl_enchanting/mod.conf @@ -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