diff --git a/build.gradle.kts b/build.gradle.kts index 761ed43..d2d776a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,7 +45,7 @@ dependencies { modImplementation("net.fabricmc", "fabric-loader", loaderVersion) modImplementation("net.fabricmc.fabric-api", "fabric-api", fabricVersion) modImplementation("net.fabricmc", "fabric-language-kotlin", fabricKotlinVersion) - modImplementation("com.gitlab.Lortseam.completeconfig", "gui-cloth", completeConfigVersion) + modImplementation("com.gitlab.Lortseam", "completeconfig", completeConfigVersion) } tasks { @@ -74,7 +74,7 @@ tasks { modrinth { token.set(System.getenv("MODRINTH_TOKEN")) - gameVersions.set(listOf("1.19", "1.19.1", "1.19.2")) + gameVersions.set(listOf("1.18.2")) projectId.set(base.archivesName) versionName.set(modVersionName) versionType.set(modVersionType) diff --git a/changelogs/1.4.0-beta+fabric-1.18.2.md b/changelogs/1.4.0-beta+fabric-1.18.2.md new file mode 100644 index 0000000..f1075fa --- /dev/null +++ b/changelogs/1.4.0-beta+fabric-1.18.2.md @@ -0,0 +1,6 @@ +Now in 1.18.2! + +**Changed**: +- Backported to 1.18.2 + +**Full Changelog**: https://github.com/eth0net/enchant-menu/compare/v1.4.0-beta+fabric-1.19...v1.4.0-beta+fabric-1.18.2 diff --git a/gradle.properties b/gradle.properties index 9fcafcf..9e80f3a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,23 +2,23 @@ kotlin.code.style=official org.gradle.jvmargs=-Xmx1G org.gradle.warning.mode=all # Fabric Properties - https://fabricmc.net/develop/ -minecraftVersion=1.19 -yarnMappings=1.19+build.4 -loaderVersion=0.14.8 +minecraftVersion=1.18.2 +yarnMappings=1.18.2+build.4 +loaderVersion=0.14.9 # Fabric API -fabricVersion=0.58.0+1.19 -fabricVersionId=3KmOcp6b +fabricVersion=0.58.0+1.18.2 +fabricVersionId=4XRtXhtL loomVersion=0.12-SNAPSHOT # Kotlin systemProp.kotlinVersion=1.7.0 fabricKotlinVersion=1.8.2+kotlin.1.7.10 fabricKotlinVersionId=5Aq3SFbi # Complete Config -completeConfigVersion=2.0.0 -completeConfigVersionId=zaC01d1T +completeConfigVersion=1.4.1 +completeConfigVersionId=mjJMU8FD # Mod Properties mavenGroup=com.github.eth0net modId=enchant-menu -modVersion=1.4.0-beta+fabric-1.19 -modVersionName=1.4.0 Beta Fabric 1.19 +modVersion=1.4.0-beta+fabric-1.18.2 +modVersionName=1.4.0 Beta Fabric 1.18.2 modVersionType=beta diff --git a/src/main/kotlin/com/github/eth0net/enchantmenu/client/gui/screen/EnchantMenuScreen.kt b/src/main/kotlin/com/github/eth0net/enchantmenu/client/gui/screen/EnchantMenuScreen.kt index 572dc62..e482e67 100644 --- a/src/main/kotlin/com/github/eth0net/enchantmenu/client/gui/screen/EnchantMenuScreen.kt +++ b/src/main/kotlin/com/github/eth0net/enchantmenu/client/gui/screen/EnchantMenuScreen.kt @@ -20,13 +20,14 @@ import net.minecraft.entity.player.PlayerEntity import net.minecraft.entity.player.PlayerInventory import net.minecraft.item.ItemStack import net.minecraft.text.Text +import net.minecraft.text.TranslatableText import org.lwjgl.glfw.GLFW import kotlin.math.roundToInt @Environment(EnvType.CLIENT) class EnchantMenuScreen(handler: EnchantMenuScreenHandler, playerInventory: PlayerInventory, title: Text) : HandledScreen(handler, object : PlayerInventory(playerInventory.player) { - override fun getDisplayName() = Text.empty() + override fun getDisplayName() = Text.of("") }, title) { private val texture = EnchantMenu.id("textures/gui/enchant_menu.png") @@ -127,7 +128,7 @@ class EnchantMenuScreen(handler: EnchantMenuScreenHandler, playerInventory: Play // level text val level = handler.level.toString() - textRenderer.drawTrimmed(Text.literal(level), x + 23 - level.length * 3, y + 21, level.length * 6, 0xFFFFFF) + textRenderer.drawTrimmed(Text.of(level), x + 23 - level.length * 3, y + 21, level.length * 6, 0xFFFFFF) // level change buttons if (handler.level < EnchantMenuConfig.Levels.maximum) addDrawableChild(TexturedButtonWidget( @@ -157,7 +158,7 @@ class EnchantMenuScreen(handler: EnchantMenuScreenHandler, playerInventory: Play ) { onToggleTreasureClick() }) // search box - searchBox = TextFieldWidget(textRenderer, x + 78, y + 6, 71, 9, Text.translatable("enchant-menu.title")) + searchBox = TextFieldWidget(textRenderer, x + 78, y + 6, 71, 9, TranslatableText("enchant-menu.title")) searchBox?.setChangedListener { handler.search = it } searchBox?.text = handler.search addSelectableChild(searchBox) diff --git a/src/main/kotlin/com/github/eth0net/enchantmenu/config/EnchantMenuCompleteConfig.kt b/src/main/kotlin/com/github/eth0net/enchantmenu/config/EnchantMenuCompleteConfig.kt index c97bb12..edff954 100644 --- a/src/main/kotlin/com/github/eth0net/enchantmenu/config/EnchantMenuCompleteConfig.kt +++ b/src/main/kotlin/com/github/eth0net/enchantmenu/config/EnchantMenuCompleteConfig.kt @@ -2,18 +2,18 @@ package com.github.eth0net.enchantmenu.config import com.github.eth0net.enchantmenu.EnchantMenu import me.lortseam.completeconfig.api.ConfigContainer +import me.lortseam.completeconfig.api.ConfigContainer.Transitive import me.lortseam.completeconfig.api.ConfigEntries import me.lortseam.completeconfig.api.ConfigEntry import me.lortseam.completeconfig.api.ConfigGroup import me.lortseam.completeconfig.data.Config -import org.spongepowered.configurate.CommentedConfigurationNode object EnchantMenuCompleteConfig : Config(EnchantMenu.MOD_ID), ConfigContainer { @ConfigEntry var checkPermission = true - @ConfigContainer.Transitive - @ConfigEntries(includeAll = true) + @Transitive + @ConfigEntries object Levels : ConfigGroup { @ConfigEntry.BoundedInteger(min = 1, max = 100) @ConfigEntry.Slider @@ -55,16 +55,16 @@ object EnchantMenuCompleteConfig : Config(EnchantMenu.MOD_ID), ConfigContainer { } } - @ConfigContainer.Transitive - @ConfigEntries(includeAll = true) + @Transitive + @ConfigEntries object AllowLimitBreaks : ConfigGroup { var incompatible = true var level = true var treasure = true } - @ConfigContainer.Transitive - @ConfigEntries(includeAll = true) + @Transitive + @ConfigEntries object DefaultLimitBreaks : ConfigGroup { var incompatible = false var level = false @@ -84,9 +84,5 @@ object EnchantMenuCompleteConfig : Config(EnchantMenu.MOD_ID), ConfigContainer { EnchantMenuConfig.DefaultLimitBreaks.treasure = DefaultLimitBreaks.treasure } - override fun apply(node: CommentedConfigurationNode?) { - super.apply(node) - } - - override fun onConfigEntryUpdate() = applyConfig() + override fun onUpdate() = applyConfig() } diff --git a/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandler.kt b/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandler.kt index 4f452e8..35e120b 100644 --- a/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandler.kt +++ b/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandler.kt @@ -18,7 +18,7 @@ import net.minecraft.screen.ScreenHandlerContext import net.minecraft.screen.slot.Slot import net.minecraft.sound.SoundCategory import net.minecraft.sound.SoundEvents -import net.minecraft.text.Text +import net.minecraft.text.TranslatableText import net.minecraft.util.registry.Registry class EnchantMenuScreenHandler( @@ -83,7 +83,7 @@ class EnchantMenuScreenHandler( override fun onButtonClick(player: PlayerEntity, id: Int): Boolean { if (!player.canEnchant()) { - player.sendMessage(Text.translatable("error.enchant-menu.permission")) + player.sendMessage(TranslatableText("error.enchant-menu.permission"), false) return false } diff --git a/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandlerFactory.kt b/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandlerFactory.kt index 0bb4991..b4bb57c 100644 --- a/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandlerFactory.kt +++ b/src/main/kotlin/com/github/eth0net/enchantmenu/screen/EnchantMenuScreenHandlerFactory.kt @@ -5,12 +5,12 @@ import net.minecraft.entity.player.PlayerInventory import net.minecraft.screen.NamedScreenHandlerFactory import net.minecraft.screen.ScreenHandlerContext import net.minecraft.text.MutableText -import net.minecraft.text.Text +import net.minecraft.text.TranslatableText object EnchantMenuScreenHandlerFactory : NamedScreenHandlerFactory { override fun createMenu(syncId: Int, inv: PlayerInventory, player: PlayerEntity): EnchantMenuScreenHandler { return EnchantMenuScreenHandler(syncId, inv, ScreenHandlerContext.create(player.world, player.blockPos)) } - override fun getDisplayName(): MutableText = Text.translatable("enchant-menu.title") + override fun getDisplayName(): MutableText = TranslatableText("enchant-menu.title") } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4202646..acca76e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,13 +33,13 @@ "depends": { "fabric": "*", "fabric-language-kotlin": ">=1.8.2+kotlin.1.7.10", - "fabricloader": ">=0.14.8", + "fabricloader": ">=0.14.9", "java": ">=17", - "minecraft": "1.19.x" + "minecraft": "1.18.2" }, "recommends": { "cloth-config": "*", - "completeconfig-base": "^2.0.0", + "completeconfig-base": "^1.4.1", "modmenu": "*" } }