Finish porting to 1.21
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
c506c9a9d2
commit
bf317e38f0
|
@ -1,12 +1,12 @@
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import com.modrinth.minotaur.ModrinthExtension
|
import com.modrinth.minotaur.ModrinthExtension
|
||||||
import masecla.modrinth4j.model.version.ProjectVersion.VersionType
|
|
||||||
import com.modrinth.minotaur.dependencies.DependencyType
|
import com.modrinth.minotaur.dependencies.DependencyType
|
||||||
|
import masecla.modrinth4j.model.version.ProjectVersion.VersionType
|
||||||
import net.fabricmc.loom.LoomGradleExtension
|
import net.fabricmc.loom.LoomGradleExtension
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath("com.guardsquare:proguard-gradle:[7.4, 7.5[") {
|
classpath("com.guardsquare:proguard-gradle:[7.5, 7.6[") {
|
||||||
exclude("com.android.tools.build")
|
exclude("com.android.tools.build")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ plugins {
|
||||||
kotlin("jvm") version "2.0.0"
|
kotlin("jvm") version "2.0.0"
|
||||||
kotlin("plugin.serialization") version "2.0.0"
|
kotlin("plugin.serialization") version "2.0.0"
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||||
id("architectury-plugin") version "[3.4.124, 3.5["
|
id("architectury-plugin") version "[3.4.160, 3.5["
|
||||||
id("dev.architectury.loom") version "1.6-SNAPSHOT" apply false
|
id("dev.architectury.loom") version "1.9-SNAPSHOT" apply false
|
||||||
id("com.github.ben-manes.versions") version "0.51.0"
|
id("com.github.ben-manes.versions") version "0.51.0"
|
||||||
id("net.kyori.indra.git") version "3.1.3"
|
id("net.kyori.indra.git") version "3.1.3"
|
||||||
id("org.cqfn.diktat.diktat-gradle-plugin") version "1.2.5"
|
id("org.cqfn.diktat.diktat-gradle-plugin") version "1.2.5"
|
||||||
|
|
|
@ -30,7 +30,7 @@ object ClickGui: SnowyScreen() {
|
||||||
buttonsContext { this.mouseClicked(d, e, i) }; return super.mouseClicked(d, e, i);
|
buttonsContext { this.mouseClicked(d, e, i) }; return super.mouseClicked(d, e, i);
|
||||||
}
|
}
|
||||||
override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { draggingBox = null; buttonsContext { this.mouseReleased(d, e, i) }; return false }
|
override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { draggingBox = null; buttonsContext { this.mouseReleased(d, e, i) }; return false }
|
||||||
override fun mouseScrolled(d: Double, e: Double, f: Double): Boolean { boxContext { scroll(d, e, f) }; return false }
|
override fun mouseScrolled(d: Double, e: Double, f: Double, scrollY: Double): Boolean { boxContext { scroll(d, e, f) }; return false }
|
||||||
|
|
||||||
override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean {
|
override fun mouseDragged(d: Double, e: Double, i: Int, f: Double, g: Double): Boolean {
|
||||||
if (i == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
if (i == GLFW.GLFW_MOUSE_BUTTON_LEFT) {
|
||||||
|
|
|
@ -4,11 +4,7 @@ import fr.username404.snowygui.ClickGui
|
||||||
import fr.username404.snowygui.gui.elements.ClickBox
|
import fr.username404.snowygui.gui.elements.ClickBox
|
||||||
import fr.username404.snowygui.gui.elements.ClickBox.Companion.buttonsMax
|
import fr.username404.snowygui.gui.elements.ClickBox.Companion.buttonsMax
|
||||||
import fr.username404.snowygui.gui.elements.ClickBox.Companion.sortAlphabetically
|
import fr.username404.snowygui.gui.elements.ClickBox.Companion.sortAlphabetically
|
||||||
import fr.username404.snowygui.gui.feature.Category
|
import fr.username404.snowygui.gui.feature.*
|
||||||
import fr.username404.snowygui.gui.feature.Colors
|
|
||||||
import fr.username404.snowygui.gui.feature.Macro
|
|
||||||
import fr.username404.snowygui.gui.feature.Keystrokes
|
|
||||||
import fr.username404.snowygui.gui.feature.Zoom
|
|
||||||
import fr.username404.snowygui.utils.FontUtil
|
import fr.username404.snowygui.utils.FontUtil
|
||||||
import net.minecraft.client.gui.GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
@ -27,8 +23,8 @@ private fun supplyComponent(string: String?): Optional<Component> = string?.run
|
||||||
|
|
||||||
val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
||||||
override fun isPauseScreen(): Boolean = false
|
override fun isPauseScreen(): Boolean = false
|
||||||
override fun render(guiGraphics: GuiGraphics, i: Int, j: Int, f: Float) {
|
override fun render(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, pTick: Float) {
|
||||||
super.renderBackground(guiGraphics)
|
super.renderBackground(guiGraphics, mouseX, mouseY, pTick)
|
||||||
FontUtil.drawScaled(guiGraphics,
|
FontUtil.drawScaled(guiGraphics,
|
||||||
text = "An appropriate version of the Cloth Config mod is required for the configuration of snowygui.", 16.0, 16.0,
|
text = "An appropriate version of the Cloth Config mod is required for the configuration of snowygui.", 16.0, 16.0,
|
||||||
color = Colors.WHITE, scaleFactor = 0.85F
|
color = Colors.WHITE, scaleFactor = 0.85F
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.mojang.blaze3d.vertex.*
|
||||||
import fr.username404.snowygui.Snowy
|
import fr.username404.snowygui.Snowy
|
||||||
import fr.username404.snowygui.gui.feature.Colors
|
import fr.username404.snowygui.gui.feature.Colors
|
||||||
import fr.username404.snowygui.utils.RenderingUtil
|
import fr.username404.snowygui.utils.RenderingUtil
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.colorEnd
|
|
||||||
import net.minecraft.client.gui.GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||||
|
|
||||||
|
@ -55,11 +54,11 @@ abstract class ColoredElement(
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic protected fun VertexConsumer.colorIt(color: Int, opacity: Float = 1F): VertexConsumer {
|
@JvmStatic protected fun VertexConsumer.colorIt(color: Int, opacity: Float = 1F): VertexConsumer {
|
||||||
with(hextoRGB(color)) {
|
with(hextoRGB(color)) {
|
||||||
return this@colorIt.color(get(0), get(1), get(2), opacity)
|
return this@colorIt.setColor(get(0), get(1), get(2), opacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
internal fun VertexConsumer.colorEnd(color: Int = this@ColoredElement.color) = colorEnd(color, opacity)
|
internal fun VertexConsumer.colorEnd(color: Int = this@ColoredElement.color) = colorIt(color, opacity)
|
||||||
protected fun defaultRectFunc() = RenderingUtil.drawRectangle(x, y, height, width, color, opacity)
|
protected fun defaultRectFunc() = RenderingUtil.drawRectangle(x, y, height, width, color, opacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package fr.username404.snowygui.gui.elements
|
package fr.username404.snowygui.gui.elements
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||||
|
import com.mojang.blaze3d.vertex.VertexFormat
|
||||||
import fr.username404.snowygui.Snowy.Companion.MissingComponent
|
import fr.username404.snowygui.Snowy.Companion.MissingComponent
|
||||||
import fr.username404.snowygui.config.Configuration
|
import fr.username404.snowygui.config.Configuration
|
||||||
import com.mojang.blaze3d.vertex.VertexFormat
|
|
||||||
import fr.username404.snowygui.gui.ColoredElement
|
import fr.username404.snowygui.gui.ColoredElement
|
||||||
import fr.username404.snowygui.gui.feature.ButtonImpl
|
import fr.username404.snowygui.gui.feature.ButtonImpl
|
||||||
import fr.username404.snowygui.gui.feature.Category
|
import fr.username404.snowygui.gui.feature.Category
|
||||||
import fr.username404.snowygui.gui.feature.Colors
|
import fr.username404.snowygui.gui.feature.Colors
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.buffer
|
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.colorShader
|
import fr.username404.snowygui.utils.RenderingUtil.colorShader
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.endDraw
|
import fr.username404.snowygui.utils.RenderingUtil.endDraw
|
||||||
import fr.username404.snowygui.utils.RenderingUtil.prepareDraw
|
import fr.username404.snowygui.utils.RenderingUtil.prepareDraw
|
||||||
|
@ -75,43 +74,43 @@ class ClickBox(
|
||||||
var sortAlphabetically: Boolean by Configuration
|
var sortAlphabetically: Boolean by Configuration
|
||||||
const val buttonsMax: Short = 16 // TODO Remove the buttons limit
|
const val buttonsMax: Short = 16 // TODO Remove the buttons limit
|
||||||
const val clickboxHeightOffset: Int = 80
|
const val clickboxHeightOffset: Int = 80
|
||||||
private const val inclination: Double = 2.5
|
private const val inclination: Float = 2.5F
|
||||||
}
|
}
|
||||||
override fun render(guiGraphics: GuiGraphics?) {
|
override fun render(guiGraphics: GuiGraphics?) {
|
||||||
|
val x = x.toFloat()
|
||||||
|
val y = y.toFloat()
|
||||||
val currentHeight = y + (height + clickboxHeightOffset)
|
val currentHeight = y + (height + clickboxHeightOffset)
|
||||||
prepareDraw()
|
prepareDraw()
|
||||||
with(buffer) {
|
with(tessellator.begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR)) {
|
||||||
begin(VertexFormat.Mode.TRIANGLE_FAN, DefaultVertexFormat.POSITION_COLOR)
|
|
||||||
// Render the header:
|
// Render the header:
|
||||||
vertex(x, y + height, 0.0).colorEnd()
|
addVertex(x, y + height, 0.0F).colorEnd()
|
||||||
vertex(x + width + inclination, y + height, 0.0).colorEnd()
|
addVertex(x + width + inclination, y + height, 0.0F).colorEnd()
|
||||||
vertex(x + width, y, 0.0).colorEnd()
|
addVertex(x + width, y, 0.0F).colorEnd()
|
||||||
vertex(x + inclination, y, 0.0).colorEnd()
|
addVertex(x + inclination, y, 0.0F).colorEnd()
|
||||||
|
|
||||||
// Render the box:
|
// Render the box:
|
||||||
vertex(x, currentHeight, 0.0).colorEnd()
|
addVertex(x, currentHeight, 0.0F).colorEnd()
|
||||||
vertex(x + width + inclination, currentHeight, 0.0).colorEnd()
|
addVertex(x + width + inclination, currentHeight, 0.0F).colorEnd()
|
||||||
vertex(x + width + inclination, y + height, 0.0).colorEnd()
|
addVertex(x + width + inclination, y + height, 0.0F).colorEnd()
|
||||||
tessellator.end()
|
|
||||||
|
|
||||||
colorShader()
|
colorShader()
|
||||||
begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR)
|
with(tessellator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR)) {
|
||||||
vertex(x + inclination, y + height, 0.0).colorEnd(Colors.WHITE_LINES.hexValue)
|
addVertex(x + inclination, y + height, 0.0F).colorEnd(Colors.WHITE_LINES.hexValue)
|
||||||
vertex(x + width, y + height, 0.0).colorEnd(Colors.WHITE_LINES.hexValue)
|
addVertex(x + width, y + height, 0.0F).colorEnd(Colors.WHITE_LINES.hexValue)
|
||||||
tessellator.end()
|
}
|
||||||
}
|
}
|
||||||
endDraw()
|
endDraw()
|
||||||
|
|
||||||
if (buttons.isNotEmpty()) {
|
if (buttons.isNotEmpty()) {
|
||||||
buttonsProgressBar.apply {
|
buttonsProgressBar.apply {
|
||||||
x = this@ClickBox.x + this@ClickBox.width - 3
|
this.x = this@ClickBox.x + this@ClickBox.width - 3
|
||||||
y = this@ClickBox.y + this@ClickBox.height + 3
|
this.y = this@ClickBox.y + this@ClickBox.height + 3
|
||||||
}.display(guiGraphics)
|
}.display(guiGraphics)
|
||||||
buttons.forEachIndexed { num, button ->
|
buttons.forEachIndexed { num, button ->
|
||||||
val fullHeight = (y + height.toDouble())..(y + height + clickboxHeightOffset)
|
val fullHeight = (y + height.toDouble())..(this.y + height + clickboxHeightOffset)
|
||||||
button.also {
|
button.also {
|
||||||
it.x = x + 3
|
it.x = this.x + 3
|
||||||
it.y = y + 3 + height + (((num + 1) - barStage) * 9)
|
it.y = this.y + 3 + height + (((num + 1) - barStage) * 9)
|
||||||
it.hidden = if ((num + 1) <= 8) ((it.y) !in fullHeight) else ((it.y + it.height) !in fullHeight)
|
it.hidden = if ((num + 1) <= 8) ((it.y) !in fullHeight) else ((it.y + it.height) !in fullHeight)
|
||||||
}.display(guiGraphics)
|
}.display(guiGraphics)
|
||||||
}
|
}
|
||||||
|
@ -119,7 +118,7 @@ class ClickBox(
|
||||||
guiGraphics?.run {
|
guiGraphics?.run {
|
||||||
with(Minecraft.getInstance().font) {
|
with(Minecraft.getInstance().font) {
|
||||||
drawInBatch(name.string,
|
drawInBatch(name.string,
|
||||||
(x + 5).toFloat(), (y + 2).toFloat(), Colors.TRANSPARENT.hexValue, false,
|
(x + 5), (y + 2), Colors.TRANSPARENT.hexValue, false,
|
||||||
pose().last().pose(), bufferSource(), Font.DisplayMode.NORMAL, 0, 15728880, isBidirectional
|
pose().last().pose(), bufferSource(), Font.DisplayMode.NORMAL, 0, 15728880, isBidirectional
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package fr.username404.snowygui.utils
|
package fr.username404.snowygui.utils
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem
|
import com.mojang.blaze3d.systems.RenderSystem
|
||||||
import com.mojang.blaze3d.vertex.BufferBuilder
|
|
||||||
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
import com.mojang.blaze3d.vertex.DefaultVertexFormat
|
||||||
import com.mojang.blaze3d.vertex.Tesselator
|
import com.mojang.blaze3d.vertex.Tesselator
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer
|
import com.mojang.blaze3d.vertex.VertexConsumer
|
||||||
|
@ -12,12 +11,10 @@ import net.minecraft.client.renderer.GameRenderer
|
||||||
|
|
||||||
object RenderingUtil {
|
object RenderingUtil {
|
||||||
@JvmField val tessellator: Tesselator = Tesselator.getInstance()
|
@JvmField val tessellator: Tesselator = Tesselator.getInstance()
|
||||||
@JvmField val buffer: BufferBuilder = tessellator.builder
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun VertexConsumer.colorIt(color: Int, opacity: Float = 1F): VertexConsumer = hextoRGB(color).run {
|
fun VertexConsumer.colorIt(color: Int, opacity: Float = 1F): VertexConsumer = hextoRGB(color).run {
|
||||||
color(get(0), get(1), get(2), opacity)
|
setColor(get(0), get(1), get(2), opacity)
|
||||||
}
|
}
|
||||||
fun VertexConsumer.colorEnd(color: Int, opacity: Float = 1F) = colorIt(color, opacity).endVertex()
|
|
||||||
fun colorShader() {
|
fun colorShader() {
|
||||||
RenderSystem.setShader(GameRenderer::getPositionColorShader)
|
RenderSystem.setShader(GameRenderer::getPositionColorShader)
|
||||||
RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
|
RenderSystem.setShaderColor(1F, 1F, 1F, 1F)
|
||||||
|
@ -33,13 +30,12 @@ object RenderingUtil {
|
||||||
fun drawRectangle(
|
fun drawRectangle(
|
||||||
x: Double, y: Double, height: Int, width: Int,
|
x: Double, y: Double, height: Int, width: Int,
|
||||||
color: Int = Colors.TRANSPARENT(), opacity: Float = 1F
|
color: Int = Colors.TRANSPARENT(), opacity: Float = 1F
|
||||||
): Unit = buffer.run {
|
): Unit = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR).run {
|
||||||
fun VertexConsumer.colorEnd() = colorEnd(color, opacity)
|
fun VertexConsumer.colorEnd() = colorIt(color, opacity)
|
||||||
begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR)
|
val x = x.toFloat() ; val y = y.toFloat()
|
||||||
vertex(x, y + height, 0.0).colorEnd()
|
addVertex(x, y + height, 0.0F).colorEnd()
|
||||||
vertex(x + width, y + height, 0.0).colorEnd()
|
addVertex(x + width, y + height, 0.0F).colorEnd()
|
||||||
vertex(x + width, y, 0.0).colorEnd()
|
addVertex(x + width, y, 0.0F).colorEnd()
|
||||||
vertex(x, y, 0.0).colorEnd()
|
addVertex(x, y, 0.0F).colorEnd()
|
||||||
tessellator.end()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package fr.username404.snowygui.fabric
|
package fr.username404.snowygui.fabric
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
|
||||||
import fr.username404.snowygui.EventSnowy
|
import fr.username404.snowygui.EventSnowy
|
||||||
import fr.username404.snowygui.Snowy
|
import fr.username404.snowygui.Snowy
|
||||||
import fr.username404.snowygui.gui.feature.ButtonImpl
|
import fr.username404.snowygui.gui.feature.ButtonImpl
|
||||||
|
@ -8,6 +7,7 @@ import net.fabricmc.api.ClientModInitializer
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.EVENT
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.EVENT
|
||||||
import net.fabricmc.loader.api.FabricLoader
|
import net.fabricmc.loader.api.FabricLoader
|
||||||
|
import net.minecraft.client.DeltaTracker
|
||||||
import net.minecraft.client.gui.GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import kotlin.io.path.exists
|
import kotlin.io.path.exists
|
||||||
import kotlin.io.path.isDirectory
|
import kotlin.io.path.isDirectory
|
||||||
|
@ -21,7 +21,7 @@ class FabricInit: Snowy(), ClientModInitializer {
|
||||||
EVENT.register(
|
EVENT.register(
|
||||||
object: HudRenderCallback, EventSnowy {
|
object: HudRenderCallback, EventSnowy {
|
||||||
override val type: String = "HudRender"
|
override val type: String = "HudRender"
|
||||||
override fun onHudRender(guiGraphics: GuiGraphics?, tickDelta: Float) = fire(guiGraphics)
|
override fun onHudRender(guiGraphics: GuiGraphics?, tickCounter: DeltaTracker?) = fire(guiGraphics)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ repositories {
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
forge("net.neoforged:neoforge:${rootProject.property("forge_version").toString().let {
|
neoForge("net.neoforged:neoforge:${rootProject.property("forge_version").toString().let {
|
||||||
return@let if (it.length > 4) it else "$it.+"
|
return@let if (it.length > 4) it else "$it.+"
|
||||||
}}")
|
}}")
|
||||||
implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlinforforge")}")
|
implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlinforforge")}")
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
loom.platform=forge
|
loom.platform=neoforge
|
|
@ -4,25 +4,18 @@ import fr.username404.snowygui.Snowy
|
||||||
import fr.username404.snowygui.config.SnowyConfigScreen
|
import fr.username404.snowygui.config.SnowyConfigScreen
|
||||||
import fr.username404.snowygui.config.configScreenParent
|
import fr.username404.snowygui.config.configScreenParent
|
||||||
import fr.username404.snowygui.gui.feature.ButtonImpl
|
import fr.username404.snowygui.gui.feature.ButtonImpl
|
||||||
import net.minecraftforge.fml.ModList
|
import net.neoforged.fml.ModContainer
|
||||||
import net.minecraftforge.fml.common.Mod
|
import net.neoforged.fml.ModList
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent
|
import net.neoforged.fml.common.Mod
|
||||||
import net.minecraftforge.client.ConfigScreenHandler
|
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent
|
||||||
import net.minecraftforge.forgespi.language.ModFileScanData
|
import net.neoforged.neoforge.client.gui.IConfigScreenFactory
|
||||||
|
import net.neoforged.neoforgespi.language.ModFileScanData
|
||||||
import org.objectweb.asm.Type
|
import org.objectweb.asm.Type
|
||||||
import thedarkcolour.kotlinforforge.forge.FORGE_BUS
|
|
||||||
import thedarkcolour.kotlinforforge.forge.LOADING_CONTEXT
|
|
||||||
import thedarkcolour.kotlinforforge.forge.MOD_BUS
|
|
||||||
|
|
||||||
@Mod("snowygui")
|
@Mod("snowygui")
|
||||||
@Suppress("UNUSED_PARAMETER")
|
@Suppress("UNUSED_PARAMETER")
|
||||||
class ForgeInit: Snowy() {
|
class ForgeInit(container: ModContainer): Snowy() {
|
||||||
private fun initSetup(event: FMLClientSetupEvent) = atInit()
|
private fun initSetup(event: FMLClientSetupEvent) = atInit()
|
||||||
private fun configSetup(event: FMLClientSetupEvent) {
|
|
||||||
LOADING_CONTEXT.registerExtensionPoint(
|
|
||||||
ConfigScreenHandler.ConfigScreenFactory::class.java
|
|
||||||
) { ConfigScreenHandler.ConfigScreenFactory { _, parent -> configScreenParent = parent; SnowyConfigScreen } }
|
|
||||||
}
|
|
||||||
override val annotatedButtons = ModList.get() // Forge-specific reflection
|
override val annotatedButtons = ModList.get() // Forge-specific reflection
|
||||||
.allScanData
|
.allScanData
|
||||||
.flatMap { obj: ModFileScanData -> obj.classes }
|
.flatMap { obj: ModFileScanData -> obj.classes }
|
||||||
|
@ -34,13 +27,14 @@ class ForgeInit: Snowy() {
|
||||||
.map { Class.forName((it!!.javaClass.getDeclaredField("clazz").apply { isAccessible = true }.get(it) as Type).className).asSubclass(ButtonImpl::class.java)}
|
.map { Class.forName((it!!.javaClass.getDeclaredField("clazz").apply { isAccessible = true }.get(it) as Type).className).asSubclass(ButtonImpl::class.java)}
|
||||||
.toSet()
|
.toSet()
|
||||||
init {
|
init {
|
||||||
with(MOD_BUS) {
|
container.eventBus!!.run {
|
||||||
addListener(this@ForgeInit::initSetup)
|
addListener(this@ForgeInit::initSetup)
|
||||||
addListener(this@ForgeInit::configSetup)
|
|
||||||
}
|
|
||||||
with(FORGE_BUS) {
|
|
||||||
register(HudHandler)
|
register(HudHandler)
|
||||||
register(ZoomHandler)
|
register(ZoomHandler)
|
||||||
}
|
}
|
||||||
|
container.registerExtensionPoint(
|
||||||
|
IConfigScreenFactory::class.java,
|
||||||
|
IConfigScreenFactory { _, parent -> configScreenParent = parent; SnowyConfigScreen }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
package fr.username404.snowygui.forge
|
package fr.username404.snowygui.forge
|
||||||
|
|
||||||
import fr.username404.snowygui.EventSnowy
|
import fr.username404.snowygui.EventSnowy
|
||||||
import net.minecraftforge.client.event.RenderGuiEvent
|
import net.neoforged.bus.api.SubscribeEvent
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent
|
import net.neoforged.neoforge.client.event.RenderGuiEvent
|
||||||
|
|
||||||
object HudHandler: EventSnowy {
|
object HudHandler: EventSnowy {
|
||||||
override val type: String = "HudRender"
|
override val type: String = "HudRender"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package fr.username404.snowygui.forge
|
package fr.username404.snowygui.forge
|
||||||
|
|
||||||
import fr.username404.snowygui.gui.feature.Zoom
|
import fr.username404.snowygui.gui.feature.Zoom
|
||||||
import net.minecraftforge.client.event.ComputeFovModifierEvent
|
import net.neoforged.bus.api.SubscribeEvent
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent
|
import net.neoforged.neoforge.client.event.ComputeFovModifierEvent
|
||||||
|
|
||||||
object ZoomHandler {
|
object ZoomHandler {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
|
|
@ -9,8 +9,8 @@ org.gradle.vfs.watch=true
|
||||||
|
|
||||||
minecraft=1.21
|
minecraft=1.21
|
||||||
forge_version=21.0.0-beta
|
forge_version=21.0.0-beta
|
||||||
kotlinforforge=5.3.0
|
kotlinforforge=5.4.0
|
||||||
kotlinVer=2.0
|
kotlinVer=2.0.0
|
||||||
kotlin_coroutines_version=1.7.1
|
kotlin_coroutines_version=1.7.1
|
||||||
serializationVer=1.7.0
|
serializationVer=1.7.0
|
||||||
fabric_loader_version=0.14.20
|
fabric_loader_version=0.14.20
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-milestone-3-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
Loading…
Reference in New Issue