Compare commits

..

1 Commits

Author SHA1 Message Date
2fb30b63e2
Switch to architectury-loom 1.7, fix the port to 1.21
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
2025-02-02 18:26:19 +01:00
19 changed files with 29 additions and 66 deletions

View File

@ -3,7 +3,6 @@ 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.api.LoomGradleExtensionAPI
buildscript {
dependencies {
@ -27,7 +26,7 @@ plugins {
group = "fr.username404"
version = "0.3.5"
val groupAndName = "${rootProject.group}.${rootProject.name.lowercase()}"
val groupAndName = "${rootProject.group}.${rootProject.name.toLowerCase()}"
val javaVer: String = "21"
val sourceJavaVer: String = javaVer
@ -51,9 +50,6 @@ subprojects {
apply(plugin = "dev.architectury.loom")
apply(plugin = "org.jetbrains.kotlin.plugin.serialization")
extensions.configure<LoomGradleExtension>("loom") {
if (this@subprojects.project.name != "common") {
accessWidenerPath.set(project(":common").extensions.getByType<LoomGradleExtensionAPI>().accessWidenerPath)
}
mappingsDep = layered {
silentMojangMappingsLicense()
officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21:2024.06.23")
@ -118,7 +114,7 @@ subprojects {
val dictionariesDir = "$rootDir/obfuscation"
dependsOn(shadowJar)
injars(shadowJar)
outjars("${rootProject.layout.buildDirectory}/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
outjars("$buildDir/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
keep("class $group.snowygui.mixins.* { * ; }")
keep("class $group.snowygui.fabric.FabricInit")
keep("class $group.snowygui.fabric.ModMenuConf")

View File

@ -6,8 +6,4 @@ dependencies {
}
}
loom {
accessWidenerPath = file("src/main/resources/${rootProject.name.lowercase()}.accessWidener")
}
tasks.getByName("shrinkJar").enabled = false

View File

@ -0,0 +1,11 @@
package fr.username404.snowygui.mixins;
import net.minecraft.client.OptionInstance;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@Mixin(OptionInstance.class)
public interface OptionValueAccessor {
@Accessor("value")
void setValue(Object value);
}

View File

@ -1,6 +1,5 @@
package fr.username404.snowygui.gui.elements
import com.mojang.blaze3d.vertex.BufferUploader
import com.mojang.blaze3d.vertex.DefaultVertexFormat
import com.mojang.blaze3d.vertex.VertexFormat
import fr.username404.snowygui.Snowy.Companion.MissingComponent

View File

@ -13,7 +13,7 @@ import net.minecraft.client.gui.GuiGraphics
import kotlin.reflect.full.findAnnotation
sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
companion object {
internal companion object {
private fun addButtons(vararg buttons: ButtonImpl) {
buttons.groupBy { impl ->
ClickGui.clickBoxes.find { box ->

View File

@ -1,5 +1,6 @@
package fr.username404.snowygui.gui.feature
import fr.username404.snowygui.mixins.OptionValueAccessor
import net.minecraft.client.Minecraft
@ButtonInfo(Category.MISC)
@ -9,11 +10,11 @@ object GammaBoost: ButtonImpl() {
override fun execAction() {
with(Minecraft.getInstance().options) {
val gamma = gamma().get()
gamma().value =
if (toggled) {
if (gamma < boost) oldGamma = gamma
boost
} else oldGamma
@Suppress("KotlinConstantConditions")
(gamma() as OptionValueAccessor).setValue(if (toggled) {
if (gamma < boost) oldGamma = gamma
boost
} else oldGamma)
}
}
}

View File

@ -2,7 +2,13 @@
"required": true,
"package": "fr.username404.snowygui.mixins",
"compatibilityLevel": "JAVA_18",
"client": [],
"client": [
"KeysAccessor",
"KeyMappings",
"EndTickMixin",
"TitleScreenMixin",
"OptionValueAccessor"
],
"injectors": {
"defaultRequire": 1
},

View File

@ -1,3 +0,0 @@
accessWidener v2 named
accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object;
mutable field net/minecraft/client/OptionInstance value Ljava/lang/Object;

View File

@ -1,3 +0,0 @@
{
"accessWidener": "snowygui.accessWidener"
}

View File

@ -32,7 +32,6 @@
"snowygui-common.mixins.json",
"snowygui-fabric.mixins.json"
],
"accessWidener": "snowygui.accessWidener",
"depends": {
"fabricloader": ">=${fabric_loader}",
"fabric-language-kotlin": ">=${fabric_kotlin}",

View File

@ -3,10 +3,6 @@
"package": "fr.username404.snowygui.mixins",
"compatibilityLevel": "JAVA_18",
"client": [
"EndTickMixin",
"TitleScreenMixin",
"KeysAccessor",
"KeyMappings",
"ZoomMixin",
"OkZoomerAlternativeMixin"
],

View File

@ -1,11 +0,0 @@
package fr.username404.snowygui.forge
import fr.username404.snowygui.EventSnowy
import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.neoforge.client.event.ClientTickEvent
object EndTickHandler: EventSnowy {
override val type: String = "EndTick"
@SubscribeEvent
fun handleEndTick(event: ClientTickEvent.Post) = fire<Any>()
}

View File

@ -29,8 +29,6 @@ class ForgeInit(container: ModContainer): Snowy() {
init {
container.eventBus!!.run {
addListener(this@ForgeInit::initSetup)
register(EndTickHandler)
register(MiscHandlers)
register(HudHandler)
register(ZoomHandler)
}

View File

@ -1,22 +0,0 @@
package fr.username404.snowygui.forge
import fr.username404.snowygui.ClickGui
import fr.username404.snowygui.gui.feature.ButtonImpl
import fr.username404.snowygui.misc.AddKeyMaps
import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent
object MiscHandlers {
@SubscribeEvent
fun handleClickGuiInit(event: RegisterMenuScreensEvent) {
ClickGui.tick()
ButtonImpl.initButtons()
}
@SubscribeEvent
fun handleKeys(event: RegisterKeyMappingsEvent) {
AddKeyMaps.list.forEach {
event.register(it.key)
}
}
}

View File

@ -14,14 +14,14 @@ A cross-platform mod offering a useful interface.
logoFile = "icon.png"
[[dependencies.snowygui]]
modId = "cloth_config"
modId = "cloth-config"
mandatory = false
versionRange = "[${clothconfig},)"
ordering = "BEFORE"
side = "CLIENT"
[[dependencies.snowygui]]
modId = "neoforge"
modId = "forge"
mandatory = true
versionRange = "[${forge_version},)"
ordering = "NONE"