Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 674079b24c | |||
| 8d88365f01 | |||
| 13bac9a191 | |||
| 19ae521535 | |||
| 3719d60446 | |||
| 3f803cc70f |
@ -4,7 +4,7 @@
|
|||||||
<option name="executionName" />
|
<option name="executionName" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="externalSystemIdString" value="GRADLE" />
|
<option name="externalSystemIdString" value="GRADLE" />
|
||||||
<option name="scriptParameters" value="-PdevBuild=true --stacktrace" />
|
<option name="scriptParameters" value="-PdevBuild=true" />
|
||||||
<option name="taskDescriptions">
|
<option name="taskDescriptions">
|
||||||
<list />
|
<list />
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<option name="executionName" />
|
<option name="executionName" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="externalSystemIdString" value="GRADLE" />
|
<option name="externalSystemIdString" value="GRADLE" />
|
||||||
<option name="scriptParameters" value="-PdevBuild=false --stacktrace" />
|
<option name="scriptParameters" value="-PdevBuild=false" />
|
||||||
<option name="taskDescriptions">
|
<option name="taskDescriptions">
|
||||||
<list />
|
<list />
|
||||||
</option>
|
</option>
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
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.dependencies.DependencyType
|
||||||
|
import masecla.modrinth4j.model.version.ProjectVersion.VersionType
|
||||||
import net.fabricmc.loom.LoomGradleExtension
|
import net.fabricmc.loom.LoomGradleExtension
|
||||||
import net.fabricmc.loom.api.LoomGradleExtensionAPI
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
@ -12,21 +15,22 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "2.3.10"
|
kotlin("jvm") version "2.3.0"
|
||||||
kotlin("plugin.serialization") version "2.3.10"
|
kotlin("plugin.serialization") version "2.3.0"
|
||||||
id("com.gradleup.shadow") version "9.4.1" apply false
|
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||||
id("architectury-plugin") version "[3.5.166, 3.6["
|
id("architectury-plugin") version "[3.4.160, 3.5["
|
||||||
id("dev.architectury.loom-no-remap") version "[1.14.473, 1.15[" apply false
|
id("dev.architectury.loom") version "[1.13.464, 1.14[" 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"
|
||||||
|
id("com.modrinth.minotaur") version "2.8.7" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "fr.username404"
|
group = "fr.username404"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
val groupAndName = "${rootProject.group}.${rootProject.name.lowercase()}"
|
val groupAndName = "${rootProject.group}.${rootProject.name.lowercase()}"
|
||||||
|
|
||||||
val javaVer: String = "25"
|
val javaVer: String = "21"
|
||||||
val sourceJavaVer: String = javaVer
|
val sourceJavaVer: String = javaVer
|
||||||
val kotlinVer: String by rootProject
|
val kotlinVer: String by rootProject
|
||||||
val kotlinSplitVersion = kotlinVer.split('.')
|
val kotlinSplitVersion = kotlinVer.split('.')
|
||||||
@ -46,17 +50,22 @@ subprojects {
|
|||||||
ignoreFailures = true
|
ignoreFailures = true
|
||||||
}
|
}
|
||||||
lateinit var mappingsDep: Dependency
|
lateinit var mappingsDep: Dependency
|
||||||
apply(plugin = "dev.architectury.loom-no-remap")
|
apply(plugin = "dev.architectury.loom")
|
||||||
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
|
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
|
||||||
extensions.configure<LoomGradleExtension>("loom") {
|
extensions.configure<LoomGradleExtension>("loom") {
|
||||||
if (this@subprojects.project.name != "common") {
|
if (this@subprojects.project.name != "common") {
|
||||||
accessWidenerPath.set(project(":common").extensions.getByType<LoomGradleExtensionAPI>().accessWidenerPath)
|
accessWidenerPath.set(project(":common").extensions.getByType<LoomGradleExtensionAPI>().accessWidenerPath)
|
||||||
}
|
}
|
||||||
|
mappingsDep = layered {
|
||||||
|
silentMojangMappingsLicense()
|
||||||
|
officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21.11:2025.12.20")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
apply(plugin = "com.gradleup.shadow")
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
val shadowC by configurations.creating
|
val shadowC by configurations.creating
|
||||||
repositories {
|
repositories {
|
||||||
maven(url = "https://jitpack.io"); mavenCentral()
|
maven(url = "https://jitpack.io"); mavenCentral()
|
||||||
|
maven(url = "https://maven.parchmentmc.org")
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("$kotlinX:kotlinx-coroutines-jdk8:${rootProject.property("kotlin_coroutines_version")}")
|
implementation("$kotlinX:kotlinx-coroutines-jdk8:${rootProject.property("kotlin_coroutines_version")}")
|
||||||
@ -68,6 +77,20 @@ subprojects {
|
|||||||
"com.github.Vatuu:discord-rpc:1.6.2"
|
"com.github.Vatuu:discord-rpc:1.6.2"
|
||||||
).forEach { implementation(it); shadowC(it) { isTransitive = false; exclude("com.sun.jna") } }
|
).forEach { implementation(it); shadowC(it) { isTransitive = false; exclude("com.sun.jna") } }
|
||||||
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
|
"minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}")
|
||||||
|
"mappings"(mappingsDep)
|
||||||
|
}
|
||||||
|
apply(plugin = "com.modrinth.minotaur")
|
||||||
|
extensions.configure<ModrinthExtension>("modrinth") {
|
||||||
|
projectId.set("OuGyGg6A")
|
||||||
|
syncBodyFrom.set("$rootDir/README.md")
|
||||||
|
gameVersions.add(minecraftVersion)
|
||||||
|
if (project.name == "forge") dependencies.add(com.modrinth.minotaur.dependencies.ModDependency("ordsPcFz", DependencyType.REQUIRED)) // Kotlinforforge dependency
|
||||||
|
versionNumber.set(rootProject.version.toString() + "-${project.name}")
|
||||||
|
versionType.set(VersionType.ALPHA.name)
|
||||||
|
detectLoaders.set(false)
|
||||||
|
loaders.add(project.name)
|
||||||
|
versionName.set("${rootProject.name} ${rootProject.version}")
|
||||||
|
uploadFile.set(fileTree("$rootDir/remappedJars/").files.find { it.name.contains(project.name) })
|
||||||
}
|
}
|
||||||
tasks {
|
tasks {
|
||||||
apply(plugin = "net.kyori.indra.git")
|
apply(plugin = "net.kyori.indra.git")
|
||||||
@ -85,16 +108,14 @@ subprojects {
|
|||||||
exclude("**/*.kotlin_metadata")
|
exclude("**/*.kotlin_metadata")
|
||||||
exclude("**/*.kotlin_builtins")
|
exclude("**/*.kotlin_builtins")
|
||||||
exclude("META-INF/maven/**/*")
|
exclude("META-INF/maven/**/*")
|
||||||
archiveVersion.set("[${rootProject.version}+$minecraftVersion]")
|
archiveClassifier.set("shadow-${this@subprojects.name}")
|
||||||
archiveClassifier.set(this@subprojects.name)
|
|
||||||
destinationDirectory.set(file("$rootDir/jars"))
|
|
||||||
}
|
}
|
||||||
val shadowJar = getByName("shadowJar") as ShadowJar
|
val shadowJar = getByName("shadowJar") as ShadowJar
|
||||||
val shrinkJar = register("shrinkJar", proguard.gradle.ProGuardTask::class) { group = this@subprojects.group as String
|
val shrinkJar = register("shrinkJar", proguard.gradle.ProGuardTask::class) { group = this@subprojects.group as String
|
||||||
val dictionariesDir = "$rootDir/obfuscation"
|
val dictionariesDir = "$rootDir/obfuscation"
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
injars(shadowJar)
|
injars(shadowJar)
|
||||||
outjars("$rootDir/jars/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
|
outjars("$buildDir/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
|
||||||
keep("class $group.snowygui.mixins.* { * ; }")
|
keep("class $group.snowygui.mixins.* { * ; }")
|
||||||
keep("class $group.snowygui.fabric.FabricInit")
|
keep("class $group.snowygui.fabric.FabricInit")
|
||||||
keep("class $group.snowygui.fabric.ModMenuConf")
|
keep("class $group.snowygui.fabric.ModMenuConf")
|
||||||
@ -142,7 +163,20 @@ subprojects {
|
|||||||
overloadaggressively()
|
overloadaggressively()
|
||||||
mergeinterfacesaggressively()
|
mergeinterfacesaggressively()
|
||||||
}
|
}
|
||||||
build.get().dependsOn(if (devBuild) shadowJar else shrinkJar)
|
withType(net.fabricmc.loom.task.RemapJarTask::class) {
|
||||||
|
if (!devBuild) {
|
||||||
|
dependsOn(shrinkJar)
|
||||||
|
val shrinkedJar = shrinkJar.get().outJarFileCollection.singleFile
|
||||||
|
inputFile.set(shrinkedJar)
|
||||||
|
} else inputFile.set(shadowJar.archiveFile)
|
||||||
|
archiveBaseName.set(shadowJar.archiveBaseName)
|
||||||
|
archiveVersion.set("[${rootProject.version}+$minecraftVersion]")
|
||||||
|
archiveClassifier.set(this@subprojects.name)
|
||||||
|
if (this@subprojects.name.contains("forge"))
|
||||||
|
atAccessWideners.set(listOf("${rootProject.name.lowercase()}.accessWidener"))
|
||||||
|
if (!archiveFileName.get().contains("common")) destinationDirectory.set(file("$rootDir/remappedJars"))
|
||||||
|
}
|
||||||
|
getByName("modrinth").dependsOn(build)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +203,7 @@ allprojects {
|
|||||||
compilerOptions {
|
compilerOptions {
|
||||||
// https://github.com/JetBrains/kotlin/blob/master/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
|
// https://github.com/JetBrains/kotlin/blob/master/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
|
||||||
freeCompilerArgs = listOf(
|
freeCompilerArgs = listOf(
|
||||||
"-jvm-default=enable", "-Xlambdas=indy", "-Xtype-enhancement-improvements-strict-mode",
|
"-Xjvm-default=all", "-Xlambdas=indy", "-Xtype-enhancement-improvements-strict-mode",
|
||||||
"-Xmultifile-parts-inherit",
|
"-Xmultifile-parts-inherit",
|
||||||
"-Xbackend-threads=0", "-Xno-param-assertions", "-Xno-call-assertions",
|
"-Xbackend-threads=0", "-Xno-param-assertions", "-Xno-call-assertions",
|
||||||
"-opt-in=kotlin.RequiresOptIn", "-Xassertions=jvm", "-progressive"
|
"-opt-in=kotlin.RequiresOptIn", "-Xassertions=jvm", "-progressive"
|
||||||
@ -196,7 +230,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
val modProperties = mapOf(
|
val modProperties = mapOf(
|
||||||
"mod_version" to (rootProject.version as String),
|
"mod_version" to (rootProject.version as String),
|
||||||
"minecraft_version" to minecraftVersion.replace("snapshot-", "alpha."),
|
"minecraft_version" to minecraftVersion,
|
||||||
"java_version" to javaVer,
|
"java_version" to javaVer,
|
||||||
"mod_group" to this@allprojects.group,
|
"mod_group" to this@allprojects.group,
|
||||||
"fabric_kotlin" to rootProject.property("fabric_language_kotlin"),
|
"fabric_kotlin" to rootProject.property("fabric_language_kotlin"),
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
architectury { common("fabric", "neoforge"); injectInjectables = true }
|
architectury { common("fabric", "neoforge"); injectInjectables = true }
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}")
|
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("fabric_loader_version")}")
|
||||||
implementation("me.shedaniel.cloth:cloth-config:${rootProject.property("clothconfig_version")}") {
|
modImplementation("me.shedaniel.cloth:cloth-config:${rootProject.property("clothconfig_version")}") {
|
||||||
exclude(module = "fabric-api")
|
exclude(module = "fabric-api")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,5 +10,4 @@ loom {
|
|||||||
accessWidenerPath = file("src/main/resources/${rootProject.name.lowercase()}.accessWidener")
|
accessWidenerPath = file("src/main/resources/${rootProject.name.lowercase()}.accessWidener")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.getByName("shadowJar").enabled = false
|
|
||||||
tasks.getByName("shrinkJar").enabled = false
|
tasks.getByName("shrinkJar").enabled = false
|
||||||
|
|||||||
@ -2,17 +2,17 @@ package fr.username404.snowygui.mixins;
|
|||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||||
import fr.username404.snowygui.gui.feature.GammaBoost;
|
import fr.username404.snowygui.gui.feature.GammaBoost;
|
||||||
import net.minecraft.client.renderer.LightmapRenderStateExtractor;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
|
||||||
@Mixin(LightmapRenderStateExtractor.class)
|
@Mixin(LightTexture.class)
|
||||||
abstract class GammaMixin {
|
abstract class GammaMixin {
|
||||||
@ModifyExpressionValue(
|
@ModifyExpressionValue(
|
||||||
method = "extract", at = @At(
|
method = "updateLightTexture(F)V", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Ljava/lang/Double;floatValue()F",
|
target = "Ljava/lang/Double;floatValue()F",
|
||||||
ordinal = 0
|
ordinal = 1
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
public float highGamma(float original) {
|
public float highGamma(float original) {
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import fr.username404.snowygui.gui.elements.ClickBox.Companion.sortAlphabeticall
|
|||||||
import fr.username404.snowygui.gui.feature.*
|
import fr.username404.snowygui.gui.feature.*
|
||||||
import fr.username404.snowygui.utils.FontUtil
|
import fr.username404.snowygui.utils.FontUtil
|
||||||
import me.shedaniel.clothconfig2.gui.entries.StringListListEntry
|
import me.shedaniel.clothconfig2.gui.entries.StringListListEntry
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.network.chat.Component.translatable
|
import net.minecraft.network.chat.Component.translatable
|
||||||
@ -23,13 +23,13 @@ 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 extractRenderState(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, pTick: Float) {
|
override fun render(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, pTick: Float) {
|
||||||
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
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
override fun onClose() = minecraft.gui.setScreen(configScreenParent)
|
override fun onClose() { minecraft?.screen = configScreenParent }
|
||||||
}; get() = try {
|
}; get() = try {
|
||||||
Class.forName("me.shedaniel.clothconfig2.api.ConfigBuilder")
|
Class.forName("me.shedaniel.clothconfig2.api.ConfigBuilder")
|
||||||
val macrosBox: ClickBox? = ClickGui.components.find {
|
val macrosBox: ClickBox? = ClickGui.components.find {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer
|
|||||||
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 net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||||
|
|
||||||
fun interface Renderable {
|
fun interface Renderable {
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
package fr.username404.snowygui.gui
|
package fr.username404.snowygui.gui
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.Component.translatable
|
import net.minecraft.network.chat.Component.translatable
|
||||||
|
|
||||||
abstract class SnowyScreen(translatableString: String = "screen.snowy.gui", private val willPauseScreen: Boolean = false): Screen(translatable(translatableString)) {
|
abstract class SnowyScreen(translatableString: String = "screen.snowy.gui", private val willPauseScreen: Boolean = false): Screen(translatable(translatableString)) {
|
||||||
abstract val components: MutableCollection<Element>
|
abstract val components: MutableCollection<Element>
|
||||||
override fun extractRenderState(guiGraphics: GuiGraphics, i: Int, j: Int, f: Float) {
|
override fun render(guiGraphics: GuiGraphics, i: Int, j: Int, f: Float) {
|
||||||
components.forEach {
|
components.forEach {
|
||||||
it.display(guiGraphics)
|
it.display(guiGraphics)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import fr.username404.snowygui.gui.feature.Colors
|
|||||||
import fr.username404.snowygui.utils.RenderingUtil
|
import fr.username404.snowygui.utils.RenderingUtil
|
||||||
import io.github.config4k.extract
|
import io.github.config4k.extract
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.network.chat.Component
|
import net.minecraft.network.chat.Component
|
||||||
import net.minecraft.util.ARGB
|
import net.minecraft.util.ARGB
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
@ -157,7 +157,7 @@ class ClickBox(
|
|||||||
}
|
}
|
||||||
|
|
||||||
with(Minecraft.getInstance().font) {
|
with(Minecraft.getInstance().font) {
|
||||||
guiGraphics?.text(
|
guiGraphics?.drawString(
|
||||||
this,
|
this,
|
||||||
Component.nullToEmpty(name.string),
|
Component.nullToEmpty(name.string),
|
||||||
(xi + 5 + (inclination / 2f)).toInt(),
|
(xi + 5 + (inclination / 2f)).toInt(),
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import fr.username404.snowygui.config.Configuration
|
|||||||
import fr.username404.snowygui.gui.ColoredElement
|
import fr.username404.snowygui.gui.ColoredElement
|
||||||
import fr.username404.snowygui.gui.feature.ButtonInfo.Companion.Type
|
import fr.username404.snowygui.gui.feature.ButtonInfo.Companion.Type
|
||||||
import fr.username404.snowygui.utils.FontUtil
|
import fr.username404.snowygui.utils.FontUtil
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.client.input.MouseButtonEvent
|
import net.minecraft.client.input.MouseButtonEvent
|
||||||
import kotlin.reflect.full.findAnnotation
|
import kotlin.reflect.full.findAnnotation
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,12 @@ import fr.username404.snowygui.EventSnowy
|
|||||||
import fr.username404.snowygui.argsLambda
|
import fr.username404.snowygui.argsLambda
|
||||||
import fr.username404.snowygui.gui.Renderable
|
import fr.username404.snowygui.gui.Renderable
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
|
|
||||||
sealed class ButtonImplWithHud: ButtonImpl() {
|
sealed class ButtonImplWithHud: ButtonImpl() {
|
||||||
protected abstract val hudRenderLambda: Renderable
|
protected abstract val hudRenderLambda: Renderable
|
||||||
private val generatedLambda: argsLambda = {
|
private val generatedLambda: argsLambda = {
|
||||||
if (!Minecraft.getInstance().gui.hud.isHidden) {
|
if (!Minecraft.getInstance().options.hideGui) {
|
||||||
hudRenderLambda.render(it.first() as GuiGraphics?)
|
hudRenderLambda.render(it.first() as GuiGraphics?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import fr.username404.snowygui.gui.Renderable
|
|||||||
import fr.username404.snowygui.utils.FontUtil
|
import fr.username404.snowygui.utils.FontUtil
|
||||||
import fr.username404.snowygui.utils.RenderingUtil
|
import fr.username404.snowygui.utils.RenderingUtil
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
|
|
||||||
@ButtonInfo(Category.HUD)
|
@ButtonInfo(Category.HUD)
|
||||||
object Keystrokes: ButtonImplWithHud() {
|
object Keystrokes: ButtonImplWithHud() {
|
||||||
|
|||||||
@ -29,11 +29,8 @@ object AddKeyMaps {
|
|||||||
) to lambda
|
) to lambda
|
||||||
val list: MutableMap<KeyMapping, privateLambda> = with(Minecraft.getInstance()) {
|
val list: MutableMap<KeyMapping, privateLambda> = with(Minecraft.getInstance()) {
|
||||||
mutableMapOf(
|
mutableMapOf(
|
||||||
mkMap("opengui", GLFW_KEY_Y) { Minecraft.getInstance().setScreenAndShow(ClickGui) },
|
mkMap("opengui", GLFW_KEY_Y) { setScreen(ClickGui) },
|
||||||
mkMap("configkey", GLFW_KEY_U) {
|
mkMap("configkey", GLFW_KEY_U) { setScreen(run { configScreenParent = null; SnowyConfigScreen }) }
|
||||||
configScreenParent = null
|
|
||||||
Minecraft.getInstance().setScreenAndShow(SnowyConfigScreen)
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,14 +2,14 @@ package fr.username404.snowygui.utils
|
|||||||
|
|
||||||
import net.minecraft.client.Minecraft
|
import net.minecraft.client.Minecraft
|
||||||
import fr.username404.snowygui.gui.feature.Colors
|
import fr.username404.snowygui.gui.feature.Colors
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.util.ARGB
|
import net.minecraft.util.ARGB
|
||||||
|
|
||||||
object FontUtil {
|
object FontUtil {
|
||||||
fun drawScaled(guiGraphics: GuiGraphics, text: String, x: Double, y: Double, scaleFactor: Float, color: Colors = Colors.BLACK) {
|
fun drawScaled(guiGraphics: GuiGraphics, text: String, x: Double, y: Double, scaleFactor: Float, color: Colors = Colors.BLACK) {
|
||||||
val stack = guiGraphics.pose()
|
val stack = guiGraphics.pose()
|
||||||
stack.scale(scaleFactor, scaleFactor)
|
stack.scale(scaleFactor, scaleFactor)
|
||||||
guiGraphics.text(
|
guiGraphics.drawString(
|
||||||
Minecraft.getInstance().font, text,
|
Minecraft.getInstance().font, text,
|
||||||
(x / scaleFactor).toInt(), (y / scaleFactor).toInt(),
|
(x / scaleFactor).toInt(), (y / scaleFactor).toInt(),
|
||||||
ARGB.opaque(color.hexValue), false
|
ARGB.opaque(color.hexValue), false
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
package fr.username404.snowygui.utils
|
package fr.username404.snowygui.utils
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.opengl.GlStateManager
|
||||||
import fr.username404.snowygui.gui.feature.Colors
|
import fr.username404.snowygui.gui.feature.Colors
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.util.ARGB
|
import net.minecraft.util.ARGB
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
@ -9,8 +10,8 @@ import kotlin.math.max
|
|||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
object RenderingUtil {
|
object RenderingUtil {
|
||||||
fun prepareDraw() = Unit
|
fun prepareDraw() = GlStateManager._enableBlend()
|
||||||
fun endDraw() = Unit
|
fun endDraw() = GlStateManager._disableBlend()
|
||||||
|
|
||||||
private fun argbFromRgb(rgb: Int, opacity: Float = 1f): Int {
|
private fun argbFromRgb(rgb: Int, opacity: Float = 1f): Int {
|
||||||
return ARGB.color(
|
return ARGB.color(
|
||||||
@ -97,7 +98,7 @@ object RenderingUtil {
|
|||||||
fun hLine(guiGraphics: GuiGraphics?, x1: Int, x2: Int, y: Int, rgb: Int, opacity: Float = 1f) {
|
fun hLine(guiGraphics: GuiGraphics?, x1: Int, x2: Int, y: Int, rgb: Int, opacity: Float = 1f) {
|
||||||
if (guiGraphics == null) return
|
if (guiGraphics == null) return
|
||||||
prepareDraw()
|
prepareDraw()
|
||||||
guiGraphics.horizontalLine(x1, x2, y, argbFromRgb(rgb, opacity))
|
guiGraphics.hLine(x1, x2, y, argbFromRgb(rgb, opacity))
|
||||||
endDraw()
|
endDraw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
accessWidener v2 official
|
accessWidener v2 named
|
||||||
|
|
||||||
accessible method net/minecraft/client/KeyMapping$Category register (Ljava/lang/String;)Lnet/minecraft/client/KeyMapping$Category;
|
accessible method net/minecraft/client/KeyMapping$Category register (Ljava/lang/String;)Lnet/minecraft/client/KeyMapping$Category;
|
||||||
@ -13,17 +13,17 @@ object Groups {
|
|||||||
architectury { platformSetupLoomIde(); fabric() }
|
architectury { platformSetupLoomIde(); fabric() }
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("${Groups.Fabric}:fabric-loader:${rootProject.property("fabric_loader_version")}")
|
modImplementation("${Groups.Fabric}:fabric-loader:${rootProject.property("fabric_loader_version")}")
|
||||||
api("${Groups.FabricApi}:fabric-rendering-v1:${rootProject.property("fabric_rendering_api_version")}")
|
modApi("${Groups.FabricApi}:fabric-rendering-v1:${rootProject.property("fabric_rendering_api_version")}")
|
||||||
api("${Groups.FabricApi}:fabric-api-base:${rootProject.property("fabric_api_base_version")}")
|
modApi("${Groups.FabricApi}:fabric-api-base:${rootProject.property("fabric_api_base_version")}")
|
||||||
api("me.shedaniel.cloth:cloth-config-fabric:${rootProject.property("clothconfig_version")}") { exclude(group = Groups.FabricApi) }
|
modApi("me.shedaniel.cloth:cloth-config-fabric:${rootProject.property("clothconfig_version")}") { exclude(group = Groups.FabricApi) }
|
||||||
implementation("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}")
|
modImplementation("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}")
|
||||||
implementation(group = "net.fabricmc", name = "fabric-language-kotlin", version = rootProject.property("fabric_language_kotlin") as String)
|
modImplementation(group = "net.fabricmc", name = "fabric-language-kotlin", version = rootProject.property("fabric_language_kotlin") as String)
|
||||||
implementation("com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}") {
|
modImplementation("com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}") {
|
||||||
exclude(group = Groups.FabricApi, module = "fabric-api-base")
|
exclude(group = Groups.FabricApi, module = "fabric-api-base")
|
||||||
exclude(group = Groups.FabricApi, module = "fabric-resource-loader-v0")
|
exclude(group = Groups.FabricApi, module = "fabric-resource-loader-v0")
|
||||||
}
|
}
|
||||||
implementation(project(path = ":common")) { isTransitive = false }
|
implementation(project(path = ":common", configuration = "namedElements")) { isTransitive = false }
|
||||||
add("developmentFabric", project(path = ":common")) { isTransitive = false }
|
add("developmentFabric", project(path = ":common")) { isTransitive = false }
|
||||||
shadowC(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false }
|
shadowC(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,19 +1,20 @@
|
|||||||
package fr.username404.snowygui.mixins;
|
package fr.username404.snowygui.mixins;
|
||||||
|
|
||||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
|
||||||
import fr.username404.snowygui.fabric.OkZoomerCompatKt;
|
import fr.username404.snowygui.fabric.OkZoomerCompatKt;
|
||||||
import fr.username404.snowygui.gui.feature.Zoom;
|
import fr.username404.snowygui.gui.feature.Zoom;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
|
import net.minecraft.client.renderer.GameRenderer;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(Camera.class)
|
@Mixin(GameRenderer.class)
|
||||||
abstract class ZoomMixin {
|
abstract class ZoomMixin {
|
||||||
@ModifyReturnValue(at = @At(value = "RETURN"), method = "calculateFov")
|
@Inject(at = @At(value = "RETURN"), method = "getFov(Lnet/minecraft/client/Camera;FZ)F", cancellable = true)
|
||||||
private static float getFov(float original) {
|
private void getFov(Camera camera, float f, boolean bl, CallbackInfoReturnable<Float> cir) {
|
||||||
if (Zoom.INSTANCE.getToggled() && !OkZoomerCompatKt.isOkZoomerPresent) {
|
if (Zoom.INSTANCE.getToggled() && !OkZoomerCompatKt.isOkZoomerPresent) {
|
||||||
return Zoom.getNewZoom(original);
|
cir.setReturnValue(Zoom.getNewZoom(cir.getReturnValue()));
|
||||||
}
|
}
|
||||||
return original;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,13 +4,12 @@ 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
|
||||||
import net.fabricmc.api.ClientModInitializer
|
import net.fabricmc.api.ClientModInitializer
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElement
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback
|
||||||
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry
|
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback.EVENT
|
||||||
import net.fabricmc.loader.api.FabricLoader
|
import net.fabricmc.loader.api.FabricLoader
|
||||||
import net.fabricmc.loader.launch.common.FabricLauncherBase
|
import net.fabricmc.loader.launch.common.FabricLauncherBase
|
||||||
import net.minecraft.client.DeltaTracker
|
import net.minecraft.client.DeltaTracker
|
||||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
import net.minecraft.client.gui.GuiGraphics
|
||||||
import net.minecraft.resources.Identifier
|
|
||||||
import kotlin.io.path.exists
|
import kotlin.io.path.exists
|
||||||
import kotlin.io.path.isDirectory
|
import kotlin.io.path.isDirectory
|
||||||
import kotlin.io.path.listDirectoryEntries
|
import kotlin.io.path.listDirectoryEntries
|
||||||
@ -20,10 +19,10 @@ import kotlin.jvm.optionals.getOrNull
|
|||||||
class FabricInit: Snowy(), ClientModInitializer {
|
class FabricInit: Snowy(), ClientModInitializer {
|
||||||
override fun onInitializeClient() {
|
override fun onInitializeClient() {
|
||||||
atInit()
|
atInit()
|
||||||
HudElementRegistry.addLast(Identifier.fromNamespaceAndPath("snowygui", "hud"),
|
EVENT.register(
|
||||||
object: HudElement, EventSnowy {
|
object: HudRenderCallback, EventSnowy {
|
||||||
override val type: String = "HudRender"
|
override val type: String = "HudRender"
|
||||||
override fun extractRenderState(guiGraphics: GuiGraphics, tickCounter: DeltaTracker) = fire(guiGraphics)
|
override fun onHudRender(guiGraphics: GuiGraphics, tickCounter: DeltaTracker) = fire(guiGraphics)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,17 +7,16 @@ org.gradle.parallel=true
|
|||||||
org.gradle.unsafe.configuration-cache=on
|
org.gradle.unsafe.configuration-cache=on
|
||||||
org.gradle.vfs.watch=true
|
org.gradle.vfs.watch=true
|
||||||
|
|
||||||
minecraft=26.2-snapshot-1
|
minecraft=1.21.11
|
||||||
# TODO: 26.2.0.1-beta
|
forge_version=21.11.38-beta
|
||||||
forge_version=26.1.0.19-beta
|
kotlinforforge=6.1.0
|
||||||
kotlinforforge=6.2.0
|
kotlinVer=2.3.0
|
||||||
kotlinVer=2.3.10
|
|
||||||
kotlin_coroutines_version=1.10.2
|
kotlin_coroutines_version=1.10.2
|
||||||
serializationVer=1.10.0
|
serializationVer=1.9.0
|
||||||
fabric_loader_version=0.19.1
|
fabric_loader_version=0.18.4
|
||||||
fabric_language_kotlin=1.13.9+kotlin.2.3.10
|
fabric_language_kotlin=1.13.8+kotlin.2.3.0
|
||||||
fabric_resource_loader_version=3.3.16+4fc5413f92
|
fabric_resource_loader_version=3.3.4+4fc5413f53
|
||||||
fabric_rendering_api_version=23.0.5+086d547a92
|
fabric_rendering_api_version=16.2.5+1fb1cde953
|
||||||
fabric_api_base_version=2.0.3+ece0632392
|
fabric_api_base_version=1.0.5+4ebb5c0853
|
||||||
clothconfig_version=26.1.154
|
clothconfig_version=21.11.151
|
||||||
modmenu_version=18.0.0-alpha.8
|
modmenu_version=17.0.0-beta.2
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -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-9.5.0-rc-2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@ -10,8 +10,8 @@ dependencies {
|
|||||||
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")}")
|
||||||
api("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.property("clothconfig_version")}")
|
modApi("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.property("clothconfig_version")}")
|
||||||
implementation(project(path = ":common")) { isTransitive = false }
|
implementation(project(path = ":common", configuration = "namedElements")) { isTransitive = false }
|
||||||
|
|
||||||
add("developmentNeoForge", project(path = ":common")) { isTransitive = false }
|
add("developmentNeoForge", project(path = ":common")) { isTransitive = false }
|
||||||
shadowC(project(path = ":common", configuration = "transformProductionNeoForge")) { isTransitive = false }
|
shadowC(project(path = ":common", configuration = "transformProductionNeoForge")) { isTransitive = false }
|
||||||
|
|||||||
@ -11,7 +11,7 @@ pluginManagement {
|
|||||||
|
|
||||||
include("common")
|
include("common")
|
||||||
include("fabric")
|
include("fabric")
|
||||||
//include("neoforge")
|
include("neoforge")
|
||||||
|
|
||||||
rootProject.name = "SnowyGUI"
|
rootProject.name = "SnowyGUI"
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user