update to more recent Forge (GUI factory changes)

This commit is contained in:
octarine-noise
2017-08-12 18:19:25 +02:00
parent f145ff221e
commit e29d224df4
5 changed files with 17 additions and 9 deletions

1
.gitignore vendored
View File

@@ -6,3 +6,4 @@ run/
.gradle/ .gradle/
build/ build/
classes/ classes/
temp/

View File

@@ -32,8 +32,8 @@ dependencies {
shade "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" shade "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
} }
minecraft { minecraft {
version = '1.11.2-13.20.0.2232' version = '1.11.2-13.20.1.2386'
mappings = 'snapshot_20161210' mappings = 'snapshot_20170612'
runDir = 'run' runDir = 'run'
} }
processResources { processResources {

View File

@@ -33,7 +33,7 @@ object Client {
val configKey = KeyHandler(BetterFoliageMod.MOD_NAME, 66, "key.betterfoliage.gui") { val configKey = KeyHandler(BetterFoliageMod.MOD_NAME, 66, "key.betterfoliage.gui") {
FMLClientHandler.instance().showGuiScreen( FMLClientHandler.instance().showGuiScreen(
ConfigGuiFactory.ConfigGuiBetterFoliage(Minecraft.getMinecraft().currentScreen) ConfigGuiFactory.createBFConfigGui(Minecraft.getMinecraft().currentScreen)
) )
} }

View File

@@ -9,12 +9,18 @@ import net.minecraftforge.fml.client.config.GuiConfig
class ConfigGuiFactory : IModGuiFactory { class ConfigGuiFactory : IModGuiFactory {
override fun mainConfigGuiClass() = ConfigGuiBetterFoliage::class.java // Deprecated stuff
override fun runtimeGuiCategories() = hashSetOf<IModGuiFactory.RuntimeOptionCategoryElement>() override fun mainConfigGuiClass() = null
override fun getHandlerFor(element: IModGuiFactory.RuntimeOptionCategoryElement?) = null override fun getHandlerFor(element: IModGuiFactory.RuntimeOptionCategoryElement?) = null
override fun initialize(minecraftInstance: Minecraft?) { }
class ConfigGuiBetterFoliage(parentScreen: GuiScreen?) : GuiConfig( override fun initialize(minecraftInstance: Minecraft?) { }
override fun hasConfigGui() = true
override fun runtimeGuiCategories() = hashSetOf<IModGuiFactory.RuntimeOptionCategoryElement>()
override fun createConfigGui(parentScreen: GuiScreen?) = createBFConfigGui(parentScreen)
companion object {
@JvmStatic
fun createBFConfigGui(parentScreen: GuiScreen?) = GuiConfig(
parentScreen, parentScreen,
Config.rootGuiElements, Config.rootGuiElements,
BetterFoliageMod.MOD_ID, BetterFoliageMod.MOD_ID,
@@ -24,3 +30,4 @@ class ConfigGuiFactory : IModGuiFactory {
BetterFoliageMod.MOD_NAME BetterFoliageMod.MOD_NAME
) )
} }
}

View File

@@ -15,7 +15,7 @@ class NonVerboseArrayEntry(
init { init {
stripTooltipDefaultText(toolTip as MutableList<String>) stripTooltipDefaultText(toolTip as MutableList<String>)
val shortDefaults = I18n.format("${configElement.languageKey}.arrayEntry", configElement.defaults.size) val shortDefaults = I18n.format("${configElement.languageKey}.arrayEntry", configElement.defaults.size)
toolTip.addAll(mc.fontRendererObj.listFormattedStringToWidth("$AQUA${I18n.format("fml.configgui.tooltip.default", shortDefaults)}", 300)) toolTip.addAll(mc.fontRenderer.listFormattedStringToWidth("$AQUA${I18n.format("fml.configgui.tooltip.default", shortDefaults)}", 300))
} }
override fun updateValueButtonText() { override fun updateValueButtonText() {