Skip to content

Commit 548be03

Browse files
committed
1.21.8-9 fixes
1 parent 5c15c62 commit 548be03

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

src/main/java/io/github/jumperonjava/customcursor/CursorEditScreen.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
//? if >= 1.21.6
66
/*import net.minecraft.client.gl.RenderPipelines;*/
77
import net.minecraft.client.gui.DrawContext;
8-
import net.minecraft.client.gui.cursor.Cursor;
9-
import net.minecraft.client.gui.cursor.StandardCursors;
108
import net.minecraft.client.gui.screen.Screen;
119
import net.minecraft.client.gui.widget.ButtonWidget;
1210
import net.minecraft.client.gui.widget.TextFieldWidget;
@@ -29,6 +27,7 @@ public CursorEditScreen(Screen parent, CursorSettings cursorConfig, Consumer<Cur
2927
this.parent = parent;
3028
this.onSuccess = onSuccess;
3129
this.targetConfig = cursorConfig.clone();
30+
this.targetCursor = targetConfig.pointer;
3231
}
3332

3433
@Override
@@ -138,7 +137,7 @@ protected void init() {
138137

139138
float time = 0;
140139
private void testcursor(DrawContext context, int mouseX, int mouseY, float delta) {
141-
context.setCursor(StandardCursors.CROSSHAIR);
140+
// context.setCursor(StandardCursors.CROSSHAIR);
142141
}
143142

144143
private void setIdentifier(Identifier identifier) {

src/main/java/io/github/jumperonjava/customcursor/CursorRenderer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public static void render(DrawContext context, int mouseX, int mouseY, float don
2323
var scale = MinecraftClient.getInstance().getWindow().getScaleFactor();
2424
//? if < 1.21.5
2525
RenderSystem.depthFunc(GL11.GL_ALWAYS);
26-
var identifier = config.identifier;
27-
var x = (int) Math.round(mouseX - config.size * config.x / scale);
28-
var y = (int) Math.round(mouseY - config.size * config.y / scale);
26+
var identifier = config.currentCursor().identifier;
27+
var x = (int) Math.round(mouseX - config.size * config.currentCursor().x / scale);
28+
var y = (int) Math.round(mouseY - config.size * config.currentCursor().y / scale);
2929
var u = (float) 0;
3030
var v = (float) 0;
3131
var width = (int) (config.size / scale);

src/main/java/io/github/jumperonjava/customcursor/CursorSettings.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33

44
import com.google.gson.Gson;
5-
import net.minecraft.client.gui.cursor.Cursor;
6-
import net.minecraft.client.gui.cursor.StandardCursors;
75
import net.minecraft.util.Identifier;
86

97
import java.util.Objects;
@@ -12,20 +10,24 @@ public class CursorSettings implements Cloneable{
1210
public int size=32;
1311
public boolean enabled=false;
1412

15-
CursorSprite pointer = new CursorSprite(1,9, 0, false,Identifier.ofVanilla("textures/item/diamond_sword.png"));
16-
CursorSprite arrow = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/arrow.png"));
17-
CursorSprite ibeam = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/ink_sac.png"));
18-
CursorSprite crosshair = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/lead.png"));
19-
CursorSprite pointing_hand = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/rabbit_foot.png"));
20-
CursorSprite resize_ns = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/golden_hoe.png"));
21-
CursorSprite resize_ew = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/copper_hoe.png"));
22-
CursorSprite resize_all = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/nether_star.png"));
23-
CursorSprite not_allowed = new CursorSprite(0,0, 0, false,Identifier.ofVanilla("textures/item/barrier.png"));
13+
CursorSprite pointer = new CursorSprite(1,9, 0, false,Identifier.of("minecraft", "textures/item/diamond_sword.png"));
14+
CursorSprite arrow = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/arrow.png"));
15+
CursorSprite ibeam = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/ink_sac.png"));
16+
CursorSprite crosshair = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/lead.png"));
17+
CursorSprite pointing_hand = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/rabbit_foot.png"));
18+
CursorSprite resize_ns = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/golden_hoe.png"));
19+
CursorSprite resize_ew = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/copper_hoe.png"));
20+
CursorSprite resize_all = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/nether_star.png"));
21+
CursorSprite not_allowed = new CursorSprite(0,0, 0, false,Identifier.of("minecraft", "textures/item/barrier.png"));
2422

2523
public CursorSettings clone() {
2624
return new Gson().fromJson(new Gson().toJson(this), CursorSettings.class);
2725
}
2826

27+
public CursorSprite currentCursor() {
28+
return pointer;
29+
}
30+
2931
public static final class CursorSprite {
3032
public float x;
3133
public float y;

src/main/java/io/github/jumperonjava/customcursor/mixin/CobblemonFix.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ void lock(DrawContext context, float tickDelta, CallbackInfo ci){
3232
locked = true;
3333
var x = (double) (this.client.getWindow().getWidth() / 2);
3434
var y = (double) (this.client.getWindow().getHeight() / 2);
35-
InputUtil.setCursorParameters(this.client.getWindow(), 212995, x, y);
35+
//? if <= 1.21.8 {
36+
InputUtil.setCursorParameters(this.client.getWindow().getHandle(), 212995, x, y);
37+
//? } else {
38+
/*InputUtil.setCursorParameters(this.client.getWindow(), 212995, x, y);
39+
*///?}
3640
} else {
3741
locked = false;
3842
}

src/main/java/io/github/jumperonjava/customcursor/mixin/TooltipPositionMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void tooltipPosChange(Args args){
1616
var scale = MinecraftClient.getInstance().getWindow().getScaleFactor();
1717
var cursor = CustomCursorInit.getConfig().pointer.clone();
1818
cursor.size/=scale;
19-
args.set(0,(int)args.get(0) - 6 + (int)(cursor.size * (1-cursor.x)));
20-
args.set(1,(int)args.get(1) - (int)(cursor.size * (cursor.y)));
19+
args.set(0,(int)args.get(0) - 6 + (int)(cursor.size * (1-cursor.currentCursor().x)));
20+
args.set(1,(int)args.get(1) - (int)(cursor.size * (cursor.currentCursor().y)));
2121
}
2222
}

src/main/java/io/github/jumperonjava/customcursor/util/ScrollListWidget.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
import com.google.common.collect.Lists;
44
import net.minecraft.client.MinecraftClient;
5-
import net.minecraft.client.gui.Click;
5+
//? if > 1.21.8 {
6+
/*import net.minecraft.client.gui.Click;
7+
*///?}
68
import net.minecraft.client.gui.DrawContext;
79
import net.minecraft.client.gui.Drawable;
810
import net.minecraft.client.gui.Element;

0 commit comments

Comments
 (0)