@@ -16,10 +16,23 @@ import net.minecraft.locale.Language
1616import net.minecraft.network.chat.Component
1717import net.minecraft.network.chat.FormattedText
1818import net.minecraft.network.chat.Style
19- import net.minecraft.resources.ResourceLocation
2019import net.minecraft.util.FormattedCharSequence
2120import java.net.URI
2221
22+ typealias Identifier =
23+ // ? if >=1.21.11 {
24+ net.minecraft.resources.Identifier
25+ // ?} else {
26+ /* net.minecraft.resources.ResourceLocation
27+ */ // ?}
28+
29+ typealias Util =
30+ // ? if >=1.21.11 {
31+ net.minecraft.util.Util
32+ // ?} else {
33+ /* net.minecraft.Util
34+ */ // ?}
35+
2336object VersionFunctions {
2437 private val client: Minecraft = Minecraft .getInstance()
2538
@@ -78,18 +91,22 @@ object VersionFunctions {
7891
7992 fun drawTexture (
8093 context : GuiGraphics ,
81- texture : ResourceLocation ? ,
94+ texture : Identifier ? ,
8295 x : Int , y : Int ,
8396 u : Float , v : Float ,
8497 width : Int , height : Int ,
8598 textureWidth : Int , textureHeight : Int
8699 ) {
87- /* ? if >=1.21.6 {*/
100+ /* ? if >=1.21.11 {*/
88101 if (texture != null ) {
102+ context.blit(net.minecraft.client.renderer.RenderPipelines .GUI_TEXTURED , texture, x, y, u, v, width, height, textureWidth, textureHeight)
103+ }
104+ /* ?} else if >=1.21.6 {*/
105+ /* if (texture != null) {
89106 RenderSystem.setShaderTexture(0, Minecraft.getInstance().textureManager.getTexture(texture).textureView);
90107 context.blit(net.minecraft.client.renderer.RenderPipelines.GUI_TEXTURED, texture, x, y, u, v, width, height, textureWidth, textureHeight)
91108 }
92- /* ?} else if >=1.21.5 {*/
109+ */ /* ?} else if >=1.21.5 {*/
93110 /* if (texture != null) {
94111 RenderSystem.setShaderTexture(0, Minecraft.getInstance().getTextureManager().getTexture(texture).getTexture());
95112 context.blit(net.minecraft.client.renderer.RenderType::guiTextured, texture, x, y, u, v, width, height, textureWidth, textureHeight)
@@ -124,7 +141,7 @@ object VersionFunctions {
124141 }
125142
126143 @JvmStatic
127- fun blitSprite (context : Any , sprite : ResourceLocation , x : Int , y : Int , width : Int , height : Int ) {
144+ fun blitSprite (context : Any , sprite : Identifier , x : Int , y : Int , width : Int , height : Int ) {
128145 /* ? if >=1.21.6 {*/
129146 (context as GuiGraphics ).blitSprite(net.minecraft.client.renderer.RenderPipelines .GUI_TEXTURED , sprite, x, y, width, height)
130147 /* ?} else if >=1.21.2 {*/
@@ -158,10 +175,6 @@ object VersionFunctions {
158175 */ /* ?}*/
159176 }
160177
161- fun versionString (): String {
162- return " 1.21.8"
163- }
164-
165178 fun getToastManager ():
166179 /* ? if >=1.21.2 {*/
167180 net.minecraft.client.gui.components.toasts.ToastManager {
0 commit comments