Start trying to port to 1.21.6

Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404-59 2025-06-26 21:23:53 +02:00
parent 9e0f5e696c
commit 38df17d90f
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
7 changed files with 37 additions and 37 deletions

View File

@ -14,8 +14,8 @@ buildscript {
} }
plugins { plugins {
kotlin("jvm") version "2.0.0" kotlin("jvm") version "2.1.20"
kotlin("plugin.serialization") version "2.0.0" kotlin("plugin.serialization") version "2.1.20"
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.160, 3.5[" id("architectury-plugin") version "[3.4.160, 3.5["
id("dev.architectury.loom") version "1.10-SNAPSHOT" apply false id("dev.architectury.loom") version "1.10-SNAPSHOT" apply false
@ -57,7 +57,7 @@ subprojects {
} }
mappingsDep = layered { mappingsDep = layered {
silentMojangMappingsLicense() silentMojangMappingsLicense()
officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21.5:2025.04.19") officialMojangMappings().parchment("org.parchmentmc.data:parchment-1.21.6:2025.06.26-nightly-20250626.125431-1")
} }
val refmap = "snowygui-${project.name}-refmap.json" val refmap = "snowygui-${project.name}-refmap.json"
mixin { mixin {

View File

@ -1,5 +1,6 @@
package fr.username404.snowygui.gui.elements package fr.username404.snowygui.gui.elements
import com.mojang.blaze3d.systems.RenderSystem.teardownOverlayColor
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 fr.username404.snowygui.gui.ColoredElement import fr.username404.snowygui.gui.ColoredElement
@ -12,7 +13,6 @@ import fr.username404.snowygui.utils.RenderingUtil.prepareDraw
import fr.username404.snowygui.utils.RenderingUtil.renderBufferWithPipeline import fr.username404.snowygui.utils.RenderingUtil.renderBufferWithPipeline
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.Font
import net.minecraft.client.gui.GuiGraphics import net.minecraft.client.gui.GuiGraphics
import net.minecraft.client.renderer.RenderPipelines import net.minecraft.client.renderer.RenderPipelines
import net.minecraft.network.chat.Component import net.minecraft.network.chat.Component
@ -45,7 +45,7 @@ class ClickBox(
override val color: Int get() = this@ClickBox.color override val color: Int get() = this@ClickBox.color
override fun render(guiGraphics: GuiGraphics?) { override fun render(guiGraphics: GuiGraphics?) {
prepareDraw() prepareDraw()
colorShader(); defaultRectFunc() colorShader(); defaultRectFunc(); teardownOverlayColor()
endDraw() endDraw()
} }
init { height = 8 } init { height = 8 }
@ -119,9 +119,11 @@ class ClickBox(
} }
guiGraphics?.run { guiGraphics?.run {
with(Minecraft.getInstance().font) { with(Minecraft.getInstance().font) {
drawInBatch(Component.nullToEmpty(name.string), drawString(
(x + 5), (y + 2), Colors.TRANSPARENT.hexValue, false, this,
pose().last().pose(), bufferSource, Font.DisplayMode.NORMAL, 0, 15728880, isBidirectional Component.nullToEmpty(name.string),
(x + 5).toInt(), (y + 2).toInt(),
Colors.TRANSPARENT.hexValue, false
) )
} }
} }

View File

@ -1,5 +1,6 @@
package fr.username404.snowygui.gui.feature package fr.username404.snowygui.gui.feature
import com.mojang.blaze3d.systems.RenderSystem.teardownOverlayColor
import fr.username404.snowygui.ClickGui import fr.username404.snowygui.ClickGui
import fr.username404.snowygui.Snowy import fr.username404.snowygui.Snowy
import fr.username404.snowygui.config.Configuration import fr.username404.snowygui.config.Configuration
@ -87,7 +88,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
} }
final override fun render(guiGraphics: GuiGraphics?) { final override fun render(guiGraphics: GuiGraphics?) {
prepareDraw() prepareDraw()
colorShader(); defaultRectFunc() colorShader(); defaultRectFunc(); teardownOverlayColor()
endDraw() endDraw()
if (guiGraphics != null) { if (guiGraphics != null) {
FontUtil.drawScaled(guiGraphics, title, x + 1, y + 1, 0.75F) FontUtil.drawScaled(guiGraphics, title, x + 1, y + 1, 0.75F)

View File

@ -3,13 +3,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.GuiGraphics import net.minecraft.client.gui.GuiGraphics
import org.joml.Matrix3x2f
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, scaleFactor) stack.scale(scaleFactor, scaleFactor, Matrix3x2f())
guiGraphics.drawString(Minecraft.getInstance().font, text, (x / scaleFactor).toInt(), (y / scaleFactor).toInt(), color.hexValue, false) guiGraphics.drawString(Minecraft.getInstance().font, text, (x / scaleFactor).toInt(), (y / scaleFactor).toInt(), color.hexValue, false)
val factorToOriginal = 1F / scaleFactor val factorToOriginal = 1F / scaleFactor
stack.scale(factorToOriginal, factorToOriginal, factorToOriginal) stack.scale(factorToOriginal, factorToOriginal, Matrix3x2f())
} }
} }

View File

@ -1,7 +1,6 @@
package fr.username404.snowygui.utils package fr.username404.snowygui.utils
import com.mojang.blaze3d.buffers.BufferType import com.mojang.blaze3d.buffers.GpuBuffer
import com.mojang.blaze3d.buffers.BufferUsage
import com.mojang.blaze3d.opengl.GlCommandEncoder import com.mojang.blaze3d.opengl.GlCommandEncoder
import com.mojang.blaze3d.opengl.GlStateManager import com.mojang.blaze3d.opengl.GlStateManager
import com.mojang.blaze3d.pipeline.RenderPipeline import com.mojang.blaze3d.pipeline.RenderPipeline
@ -16,7 +15,6 @@ import fr.username404.snowygui.gui.hextoRGB
import net.minecraft.client.Minecraft import net.minecraft.client.Minecraft
import net.minecraft.client.renderer.RenderPipelines import net.minecraft.client.renderer.RenderPipelines
import java.util.OptionalInt import java.util.OptionalInt
import java.util.OptionalDouble
object RenderingUtil { object RenderingUtil {
@JvmStatic @JvmStatic
@ -24,7 +22,7 @@ object RenderingUtil {
setColor(get(0), get(1), get(2), opacity) setColor(get(0), get(1), get(2), opacity)
} }
fun colorShader() { fun colorShader() {
RenderSystem.setShaderColor(1F, 1F, 1F, 1F) RenderSystem.setupOverlayColor(Minecraft.getInstance().mainRenderTarget.colorTextureView)
} }
fun prepareDraw() { fun prepareDraw() {
colorShader() colorShader()
@ -32,6 +30,7 @@ object RenderingUtil {
} }
fun endDraw() { fun endDraw() {
GlStateManager._disableBlend() GlStateManager._disableBlend()
RenderSystem.teardownOverlayColor()
} }
fun drawRectangle( fun drawRectangle(
x: Double, y: Double, height: Int, width: Int, x: Double, y: Double, height: Int, width: Int,
@ -58,14 +57,13 @@ object RenderingUtil {
builder.buildOrThrow().use { meshData -> builder.buildOrThrow().use { meshData ->
val encoder = RenderSystem.getDevice().createCommandEncoder() as GlCommandEncoder val encoder = RenderSystem.getDevice().createCommandEncoder() as GlCommandEncoder
encoder.createRenderPass( encoder.createRenderPass(
renderTarget.colorTexture!!, { name },
OptionalInt.empty(), renderTarget.colorTextureView!!,
renderTarget.depthTexture, OptionalInt.empty()
OptionalDouble.empty()
).use { renderPass -> ).use { renderPass ->
encoder.inRenderPass = false; encoder.inRenderPass = false;
RenderSystem.getDevice().createBuffer( RenderSystem.getDevice().createBuffer(
{ name }, BufferType.VERTICES, BufferUsage.DYNAMIC_WRITE, meshData.vertexBuffer() { name }, GpuBuffer.USAGE_VERTEX, meshData.vertexBuffer()
).use { buffer -> ).use { buffer ->
val autoStorageIndexBuffer = RenderSystem.getSequentialBuffer(mode) val autoStorageIndexBuffer = RenderSystem.getSequentialBuffer(mode)
renderPass.setPipeline(renderPipeline) renderPass.setPipeline(renderPipeline)
@ -75,7 +73,7 @@ object RenderingUtil {
autoStorageIndexBuffer.type() autoStorageIndexBuffer.type()
) )
uniformAndSamplerConsumer?.invoke(renderPass) uniformAndSamplerConsumer?.invoke(renderPass)
renderPass.drawIndexed(0, meshData.drawState().indexCount()) renderPass.draw(0, meshData.drawState().indexCount())
} }
encoder.inRenderPass = false; encoder.inRenderPass = false;
} }

View File

@ -3,7 +3,5 @@ accessWidener v2 named
accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object; accessible field net/minecraft/client/OptionInstance value Ljava/lang/Object;
mutable field net/minecraft/client/OptionInstance value Ljava/lang/Object; mutable field net/minecraft/client/OptionInstance value Ljava/lang/Object;
accessible field net/minecraft/client/gui/GuiGraphics bufferSource Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;
accessible field com/mojang/blaze3d/opengl/GlCommandEncoder inRenderPass Z accessible field com/mojang/blaze3d/opengl/GlCommandEncoder inRenderPass Z
mutable field com/mojang/blaze3d/opengl/GlCommandEncoder inRenderPass Z mutable field com/mojang/blaze3d/opengl/GlCommandEncoder inRenderPass Z

View File

@ -1,22 +1,22 @@
org.gradle.daemon=false org.gradle.daemon=false
kotlin.code.style=official kotlin.code.style=official
org.gradle.jvmargs=-Xmx2G -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+AlwaysPreTouch org.gradle.jvmargs=-Xmx2G -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockExperimentalVMOptions -XX:+AlwaysPreTouch
kotlin.incremental=true kotlin.incremental=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true 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=1.21.5 minecraft=1.21.6
forge_version=21.5.40-beta forge_version=21.6.0-beta
kotlinforforge=5.7.0 kotlinforforge=5.8.0
kotlinVer=2.1.0 kotlinVer=2.1.20
kotlin_coroutines_version=1.9.0 kotlin_coroutines_version=1.10.2
serializationVer=1.7.3 serializationVer=1.8.1
fabric_loader_version=0.14.20 fabric_loader_version=0.16.0
fabric_language_kotlin=1.13.0+kotlin.2.1.0 fabric_language_kotlin=1.13.3+kotlin.2.1.21
fabric_resource_loader_version=3.1.6+02ca679607 fabric_resource_loader_version=3.1.10+fa6cb72b9c
fabric_rendering_api_version=11.1.11+081cc04307 fabric_rendering_api_version=12.3.0+ac3e15d19c
fabric_api_base_version=0.4.62+73a52b4b07 fabric_api_base_version=0.4.63+9ec45cd89c
clothconfig_version=18.0.145 clothconfig_version=19.0.146
modmenu_version=14.0.0-rc.2 modmenu_version=15.0.0-beta.1