33import io .github .jumperonjava .customcursor .util .VersionFunctions ;
44import net .minecraft .client .MinecraftClient ;
55//? if >= 1.21.6 {
6- import net .minecraft .client .gl .RenderPipelines ;
7- //?} else {
8- /* import net.minecraft.client.render.RenderLayer;
6+ /* import net.minecraft.client.gl.RenderPipelines;
7+ */ //?} else {
8+ import net .minecraft .client .render .RenderLayer ;
99import com .mojang .blaze3d .systems .RenderSystem ;
10- */ //?}
10+ //?}
1111import net .minecraft .client .gui .DrawContext ;
1212import org .lwjgl .glfw .GLFW ;
1313import org .lwjgl .opengl .GL11 ;
1414
1515public class CursorRenderer {
16- public static void render (DrawContext context , int mouseX , int mouseY , float donotuse_delta ) {
16+ public static void render (DrawContext context , double mouseX , double mouseY , float donotuse_delta ) {
1717 var config = CustomCursorInit .getConfig ().settings ;
1818 if (MinecraftClient .getInstance ().currentScreen == null )
1919 return ;
@@ -23,39 +23,47 @@ public static void render(DrawContext context, int mouseX, int mouseY, float don
2323 }
2424 var scale = MinecraftClient .getInstance ().getWindow ().getScaleFactor ();
2525 //? if < 1.21.5
26- /* RenderSystem.depthFunc(GL11.GL_ALWAYS);*/
26+ RenderSystem .depthFunc (GL11 .GL_ALWAYS );
2727
2828 var sprite = config .arrow ;
2929
3030 //? if > 1.21.8 {
31- var contextCursor = context .cursor ;
31+ /* var contextCursor = context.cursor;
3232 sprite = config.cursorToSprite(contextCursor);
33- //?}
33+ */ //?}
3434
3535 var identifier = sprite .identifier ;
3636
37- var x = (int ) Math .round (mouseX - config .size * sprite .x / scale );
38- var y = (int ) Math .round (mouseY - config .size * sprite .y / scale );
37+
38+ mouseX = (float ) MinecraftClient .getInstance ().mouse .getX ();
39+ mouseY = (float ) MinecraftClient .getInstance ().mouse .getY ();
40+ var x = (int ) Math .round (mouseX - config .size * sprite .x );
41+ var y = (int ) Math .round (mouseY - config .size * sprite .y );
3942 var u = (float ) 0 ;
4043 var v = (float ) 0 ;
41- var width = ( int ) ( config .size / scale ) ;
42- var height = ( int ) ( config .size / scale ) ;
43- var textureWidth = ( int ) ( config .size / scale ) ;
44- var textureHeight = ( int ) ( config .size / scale ) ;
44+ var width = config .size ;
45+ var height = config .size ;
46+ var textureWidth = config .size ;
47+ var textureHeight = config .size ;
4548
4649 VersionFunctions .pushMatrix (context );
47- VersionFunctions .rotateAbout (context , (float ) Math .toRadians (sprite .rotation ), x + (float ) textureWidth /2 , y + (float ) textureHeight /2 );
50+ //? if < 1.21.6 {
51+ context .getMatrices ().scale ((float ) (1f /scale ), (float ) (1f /scale ),1f );
52+ //?} else {
53+ /*context.getMatrices().scale((float) (1f/scale), (float) (1f/scale));
54+ */ //?}
55+ VersionFunctions .rotateAbout (context , (float ) Math .toRadians (sprite .rotation ), x + (float ) textureWidth /2f , y + (float ) textureHeight /2f );
4856 //? if < 1.21.3 {
49- /* context.drawTexture(identifier,x,y,u,v,width,height,textureWidth * (sprite.mirroredX ? -1:1), textureHeight* (sprite.mirroredY ? -1:1));
50- */ //?} else if < 1.21.6 {
57+ context .drawTexture (identifier ,x ,y ,u ,v ,width ,height ,textureWidth * (sprite .mirroredX ? -1 :1 ), textureHeight * (sprite .mirroredY ? -1 :1 ));
58+ //?} else if < 1.21.6 {
5159 /*context.drawTexture(RenderLayer::getGuiTexturedOverlay, identifier, x, y, u, v, width, height, textureWidth * (sprite.mirroredX ? -1:1), textureHeight* (sprite.mirroredY ? -1:1));
5260 */ //?} else {
53- context .drawTexture (RenderPipelines .GUI_TEXTURED , identifier , x , y , u , v , width , height , textureWidth * (sprite .mirroredX ? -1 :1 ), textureHeight * (sprite .mirroredY ? -1 :1 ));
54- //?}
55- VersionFunctions .popMatrix (context );
61+ /*context.drawTexture(RenderPipelines.GUI_TEXTURED, identifier, x, y, u, v, width, height, textureWidth * (sprite.mirroredX ? -1:1), textureHeight* (sprite.mirroredY ? -1:1));
62+ */ //?}
5663
64+ VersionFunctions .popMatrix (context );
5765 //? if < 1.21.5
58- /* RenderSystem.depthFunc(GL11.GL_LEQUAL);*/
66+ RenderSystem .depthFunc (GL11 .GL_LEQUAL );
5967
6068 //for debugging
6169 //context.drawTexture(new Identifier("customcursor","textures/gui/pointer.png"), (int) (mouseX-4), (int) (mouseY-4),0,0,8,8,8,8);
0 commit comments