Update to 26.1
Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
9116e6c3d1
commit
445053f69d
@ -4,7 +4,7 @@
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="-PdevBuild=true" />
|
||||
<option name="scriptParameters" value="-PdevBuild=true --stacktrace" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="-PdevBuild=false" />
|
||||
<option name="scriptParameters" value="-PdevBuild=false --stacktrace" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
|
||||
@ -17,7 +17,7 @@ buildscript {
|
||||
plugins {
|
||||
kotlin("jvm") version "2.3.10"
|
||||
kotlin("plugin.serialization") version "2.3.10"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("com.gradleup.shadow") version "9.4.1" apply false
|
||||
id("architectury-plugin") version "[3.5.166, 3.6["
|
||||
id("dev.architectury.loom-no-remap") version "[1.14.473, 1.15[" apply false
|
||||
id("com.github.ben-manes.versions") version "0.51.0"
|
||||
@ -57,7 +57,7 @@ subprojects {
|
||||
accessWidenerPath.set(project(":common").extensions.getByType<LoomGradleExtensionAPI>().accessWidenerPath)
|
||||
}
|
||||
}
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
apply(plugin = "com.gradleup.shadow")
|
||||
val shadowC by configurations.creating
|
||||
repositories {
|
||||
maven(url = "https://jitpack.io"); mavenCentral()
|
||||
@ -102,14 +102,16 @@ subprojects {
|
||||
exclude("**/*.kotlin_metadata")
|
||||
exclude("**/*.kotlin_builtins")
|
||||
exclude("META-INF/maven/**/*")
|
||||
archiveClassifier.set("shadow-${this@subprojects.name}")
|
||||
archiveVersion.set("[${rootProject.version}+$minecraftVersion]")
|
||||
archiveClassifier.set(this@subprojects.name)
|
||||
destinationDirectory.set(file("$rootDir/jars"))
|
||||
}
|
||||
val shadowJar = getByName("shadowJar") as ShadowJar
|
||||
val shrinkJar = register("shrinkJar", proguard.gradle.ProGuardTask::class) { group = this@subprojects.group as String
|
||||
val dictionariesDir = "$rootDir/obfuscation"
|
||||
dependsOn(shadowJar)
|
||||
injars(shadowJar)
|
||||
outjars("$buildDir/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
|
||||
outjars("$rootDir/jars/shrinkedJar/${shadowJar.outputs.files.singleFile.name}")
|
||||
keep("class $group.snowygui.mixins.* { * ; }")
|
||||
keep("class $group.snowygui.fabric.FabricInit")
|
||||
keep("class $group.snowygui.fabric.ModMenuConf")
|
||||
@ -157,6 +159,7 @@ subprojects {
|
||||
overloadaggressively()
|
||||
mergeinterfacesaggressively()
|
||||
}
|
||||
build.get().dependsOn(if (devBuild) shadowJar else shrinkJar)
|
||||
getByName("modrinth").dependsOn(build)
|
||||
}
|
||||
}
|
||||
@ -184,7 +187,7 @@ allprojects {
|
||||
compilerOptions {
|
||||
// https://github.com/JetBrains/kotlin/blob/master/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JVMCompilerArguments.kt
|
||||
freeCompilerArgs = listOf(
|
||||
"-Xjvm-default=all", "-Xlambdas=indy", "-Xtype-enhancement-improvements-strict-mode",
|
||||
"-jvm-default=enable", "-Xlambdas=indy", "-Xtype-enhancement-improvements-strict-mode",
|
||||
"-Xmultifile-parts-inherit",
|
||||
"-Xbackend-threads=0", "-Xno-param-assertions", "-Xno-call-assertions",
|
||||
"-opt-in=kotlin.RequiresOptIn", "-Xassertions=jvm", "-progressive"
|
||||
|
||||
@ -10,4 +10,5 @@ loom {
|
||||
accessWidenerPath = file("src/main/resources/${rootProject.name.lowercase()}.accessWidener")
|
||||
}
|
||||
|
||||
tasks.getByName("shadowJar").enabled = false
|
||||
tasks.getByName("shrinkJar").enabled = false
|
||||
|
||||
@ -2,17 +2,17 @@ package fr.username404.snowygui.mixins;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
|
||||
import fr.username404.snowygui.gui.feature.GammaBoost;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.LightmapRenderStateExtractor;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@Mixin(LightTexture.class)
|
||||
@Mixin(LightmapRenderStateExtractor.class)
|
||||
abstract class GammaMixin {
|
||||
@ModifyExpressionValue(
|
||||
method = "updateLightTexture(F)V", at = @At(
|
||||
method = "extract", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/lang/Double;floatValue()F",
|
||||
ordinal = 1
|
||||
ordinal = 0
|
||||
)
|
||||
)
|
||||
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.utils.FontUtil
|
||||
import me.shedaniel.clothconfig2.gui.entries.StringListListEntry
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.network.chat.Component.translatable
|
||||
@ -23,8 +23,8 @@ private fun supplyComponent(string: String?): Optional<Component> = string?.run
|
||||
|
||||
val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
||||
override fun isPauseScreen(): Boolean = false
|
||||
override fun render(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, pTick: Float) {
|
||||
super.renderBackground(guiGraphics, mouseX, mouseY, pTick)
|
||||
override fun extractRenderState(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, pTick: Float) {
|
||||
super.extractBackground(guiGraphics, mouseX, mouseY, pTick)
|
||||
FontUtil.drawScaled(guiGraphics,
|
||||
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
|
||||
|
||||
@ -4,7 +4,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer
|
||||
import fr.username404.snowygui.Snowy
|
||||
import fr.username404.snowygui.gui.feature.Colors
|
||||
import fr.username404.snowygui.utils.RenderingUtil
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener
|
||||
|
||||
fun interface Renderable {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package fr.username404.snowygui.gui
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.network.chat.Component.translatable
|
||||
|
||||
abstract class SnowyScreen(translatableString: String = "screen.snowy.gui", private val willPauseScreen: Boolean = false): Screen(translatable(translatableString)) {
|
||||
abstract val components: MutableCollection<Element>
|
||||
override fun render(guiGraphics: GuiGraphics, i: Int, j: Int, f: Float) {
|
||||
override fun extractRenderState(guiGraphics: GuiGraphics, i: Int, j: Int, f: Float) {
|
||||
components.forEach {
|
||||
it.display(guiGraphics)
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import fr.username404.snowygui.gui.feature.Colors
|
||||
import fr.username404.snowygui.utils.RenderingUtil
|
||||
import io.github.config4k.extract
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.network.chat.Component
|
||||
import net.minecraft.util.ARGB
|
||||
import kotlin.math.floor
|
||||
@ -157,7 +157,7 @@ class ClickBox(
|
||||
}
|
||||
|
||||
with(Minecraft.getInstance().font) {
|
||||
guiGraphics?.drawString(
|
||||
guiGraphics?.text(
|
||||
this,
|
||||
Component.nullToEmpty(name.string),
|
||||
(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.feature.ButtonInfo.Companion.Type
|
||||
import fr.username404.snowygui.utils.FontUtil
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.client.input.MouseButtonEvent
|
||||
import kotlin.reflect.full.findAnnotation
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import fr.username404.snowygui.EventSnowy
|
||||
import fr.username404.snowygui.argsLambda
|
||||
import fr.username404.snowygui.gui.Renderable
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
|
||||
sealed class ButtonImplWithHud: ButtonImpl() {
|
||||
protected abstract val hudRenderLambda: Renderable
|
||||
|
||||
@ -6,7 +6,7 @@ import fr.username404.snowygui.gui.Renderable
|
||||
import fr.username404.snowygui.utils.FontUtil
|
||||
import fr.username404.snowygui.utils.RenderingUtil
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
|
||||
@ButtonInfo(Category.HUD)
|
||||
object Keystrokes: ButtonImplWithHud() {
|
||||
|
||||
@ -2,14 +2,14 @@ package fr.username404.snowygui.utils
|
||||
|
||||
import net.minecraft.client.Minecraft
|
||||
import fr.username404.snowygui.gui.feature.Colors
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.util.ARGB
|
||||
|
||||
object FontUtil {
|
||||
fun drawScaled(guiGraphics: GuiGraphics, text: String, x: Double, y: Double, scaleFactor: Float, color: Colors = Colors.BLACK) {
|
||||
val stack = guiGraphics.pose()
|
||||
stack.scale(scaleFactor, scaleFactor)
|
||||
guiGraphics.drawString(
|
||||
guiGraphics.text(
|
||||
Minecraft.getInstance().font, text,
|
||||
(x / scaleFactor).toInt(), (y / scaleFactor).toInt(),
|
||||
ARGB.opaque(color.hexValue), false
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
package fr.username404.snowygui.utils
|
||||
|
||||
import com.mojang.blaze3d.opengl.GlStateManager
|
||||
import fr.username404.snowygui.gui.feature.Colors
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.util.ARGB
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.floor
|
||||
@ -10,8 +9,8 @@ import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
object RenderingUtil {
|
||||
fun prepareDraw() = GlStateManager._enableBlend()
|
||||
fun endDraw() = GlStateManager._disableBlend()
|
||||
fun prepareDraw() = Unit
|
||||
fun endDraw() = Unit
|
||||
|
||||
private fun argbFromRgb(rgb: Int, opacity: Float = 1f): Int {
|
||||
return ARGB.color(
|
||||
@ -98,7 +97,7 @@ object RenderingUtil {
|
||||
fun hLine(guiGraphics: GuiGraphics?, x1: Int, x2: Int, y: Int, rgb: Int, opacity: Float = 1f) {
|
||||
if (guiGraphics == null) return
|
||||
prepareDraw()
|
||||
guiGraphics.hLine(x1, x2, y, argbFromRgb(rgb, opacity))
|
||||
guiGraphics.horizontalLine(x1, x2, y, argbFromRgb(rgb, opacity))
|
||||
endDraw()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
package fr.username404.snowygui.mixins;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
|
||||
import fr.username404.snowygui.fabric.OkZoomerCompatKt;
|
||||
import fr.username404.snowygui.gui.feature.Zoom;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(GameRenderer.class)
|
||||
@Mixin(Camera.class)
|
||||
abstract class ZoomMixin {
|
||||
@Inject(at = @At(value = "RETURN"), method = "getFov(Lnet/minecraft/client/Camera;FZ)F", cancellable = true)
|
||||
private void getFov(Camera camera, float f, boolean bl, CallbackInfoReturnable<Float> cir) {
|
||||
@ModifyReturnValue(at = @At(value = "RETURN"), method = "calculateFov")
|
||||
private static float getFov(float original) {
|
||||
if (Zoom.INSTANCE.getToggled() && !OkZoomerCompatKt.isOkZoomerPresent) {
|
||||
cir.setReturnValue(Zoom.getNewZoom(cir.getReturnValue()));
|
||||
}
|
||||
return Zoom.getNewZoom(original);
|
||||
}
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,12 +4,13 @@ import fr.username404.snowygui.EventSnowy
|
||||
import fr.username404.snowygui.Snowy
|
||||
import fr.username404.snowygui.gui.feature.ButtonImpl
|
||||
import net.fabricmc.api.ClientModInitializer
|
||||
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.hud.HudElement
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry
|
||||
import net.fabricmc.loader.api.FabricLoader
|
||||
import net.fabricmc.loader.launch.common.FabricLauncherBase
|
||||
import net.minecraft.client.DeltaTracker
|
||||
import net.minecraft.client.gui.GuiGraphics
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor as GuiGraphics
|
||||
import net.minecraft.resources.Identifier
|
||||
import kotlin.io.path.exists
|
||||
import kotlin.io.path.isDirectory
|
||||
import kotlin.io.path.listDirectoryEntries
|
||||
@ -19,10 +20,10 @@ import kotlin.jvm.optionals.getOrNull
|
||||
class FabricInit: Snowy(), ClientModInitializer {
|
||||
override fun onInitializeClient() {
|
||||
atInit()
|
||||
EVENT.register(
|
||||
object: HudRenderCallback, EventSnowy {
|
||||
HudElementRegistry.addLast(Identifier.fromNamespaceAndPath("snowygui", "hud"),
|
||||
object: HudElement, EventSnowy {
|
||||
override val type: String = "HudRender"
|
||||
override fun onHudRender(guiGraphics: GuiGraphics, tickCounter: DeltaTracker) = fire(guiGraphics)
|
||||
override fun extractRenderState(guiGraphics: GuiGraphics, tickCounter: DeltaTracker) = fire(guiGraphics)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user