Skip to content

Commit 63be060

Browse files
feat: port to 26.1
1 parent 565b28b commit 63be060

File tree

19 files changed

+90
-110
lines changed

19 files changed

+90
-110
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [26.1.0.1]
2+
3+
### Changed
4+
5+
- Updated to `26.1`
6+
17
## [21.11.0]
28

39
### Changed
@@ -12,7 +18,7 @@
1218

1319
## [21.9.2]
1420

15-
### Fixed
21+
### Fixed
1622

1723
- Hopefully address various shader issues with Iris specifically. Big thanks to all the users that helped as part of [#317](https://github.com/AdvancedXRay/XRay-Mod/issues/317)
1824

build.gradle

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java-library'
3-
id 'fabric-loom' version '1.13.3' apply(false)
4-
id 'net.neoforged.moddev' version '2.0.112' apply(false)
3+
id 'net.fabricmc.fabric-loom' version '1.15-SNAPSHOT' apply(false)
4+
id 'net.neoforged.moddev' version '2.0.141' apply(false)
55
id "me.modmuss50.mod-publish-plugin" version "1.1.0"
66
}
77

@@ -21,7 +21,7 @@ allprojects {
2121

2222
tasks.withType(JavaCompile).configureEach {
2323
options.encoding = 'UTF-8'
24-
options.release = 21
24+
options.release = 25
2525
}
2626

2727
idea {
@@ -43,15 +43,6 @@ subprojects {
4343
archivesName = "advanced-xray-$project.name"
4444
}
4545

46-
repositories {
47-
maven {
48-
url "https://libraries.minecraft.net"
49-
content {
50-
includeModule("org.lwjgl", "lwjgl-freetype")
51-
}
52-
}
53-
}
54-
5546
if (project.name != "common") {
5647
dependencies {
5748
api project(":common")
@@ -65,7 +56,7 @@ subprojects {
6556
def replaceProperties = [
6657
minecraft_version: minecraft_version,
6758
minecraft_version_range: minecraft_version_range.replace("[%base]", minecraft_version),
68-
forge_version_range: forge_version_range,
59+
forge_version_range: neoforge_version_range,
6960
version: version,
7061
]
7162

@@ -110,7 +101,7 @@ publishMods {
110101
def curseForgeOptions = curseforgeOptions {
111102
accessToken = providers.environmentVariable("CURSE_DEPLOY_TOKEN")
112103
minecraftVersions.add("${minecraft_version}")
113-
javaVersions.add(JavaVersion.VERSION_21)
104+
javaVersions.add(JavaVersion.VERSION_25)
114105
}
115106

116107
curseforge("curseforgeNeoforge") {

common/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom'
2+
id 'net.fabricmc.fabric-loom'
33
}
44

55
loom {
@@ -18,15 +18,14 @@ repositories {
1818

1919
dependencies {
2020
minecraft "com.mojang:minecraft:${project.minecraft_version}"
21-
mappings loom.officialMojangMappings()
2221

2322
testImplementation platform('org.junit:junit-bom:5.10.3')
2423
testImplementation 'org.junit.jupiter:junit-jupiter'
2524
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
2625

2726
compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5'
2827

29-
modCompileOnly "curse.maven:irisshaders-455508:${iris_version}"
28+
// modCompileOnly "curse.maven:irisshaders-455508:${iris_version}"
3029
}
3130

3231
test {

common/src/main/java/pro/mikey/xray/core/ChunkScanTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ public class ChunkScanTask implements Runnable {
1818

1919
public ChunkScanTask(Level level, ChunkPos pos) {
2020
// Move the chunk pos to block pos by multiplying by 16
21-
this.startX = pos.x << 4;
22-
this.startZ = pos.z << 4;
21+
this.startX = pos.x() << 4;
22+
this.startZ = pos.z() << 4;
2323

2424
this.level = level;
2525
}

common/src/main/java/pro/mikey/xray/core/ScanController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ public void toggleXRay() {
7878
requestBlockFinder(true); // finally, force a refresh
7979

8080
if (!XRay.config().showOverlay.get() && Minecraft.getInstance().player != null)
81-
Minecraft.getInstance().player.displayClientMessage(Component.translatable("xray.toggle.activated"), false);
81+
Minecraft.getInstance().player.sendSystemMessage(Component.translatable("xray.toggle.activated"));
8282
} else // disable drawing
8383
{
8484
if (!XRay.config().showOverlay.get() && Minecraft.getInstance().player != null)
85-
Minecraft.getInstance().player.displayClientMessage(Component.translatable("xray.toggle.deactivated"), false);
85+
Minecraft.getInstance().player.sendSystemMessage(Component.translatable("xray.toggle.deactivated"));
8686

8787
xrayActive = false;
8888
}
@@ -158,8 +158,8 @@ public synchronized void requestBlockFinder(boolean force) {
158158

159159
List<ChunkPos> chunksToScan = new ArrayList<>();
160160
var playerChunkPos = player.chunkPosition();
161-
for (int i = playerChunkPos.x - range; i <= playerChunkPos.x + range; i++) {
162-
for (int j = playerChunkPos.z - range; j <= playerChunkPos.z + range; j++) {
161+
for (int i = playerChunkPos.x() - range; i <= playerChunkPos.x() + range; i++) {
162+
for (int j = playerChunkPos.z() - range; j <= playerChunkPos.z() + range; j++) {
163163
chunksToScan.add(new ChunkPos(i, j));
164164
}
165165
}
@@ -193,7 +193,7 @@ public static void onBlockChange(Level level, BlockPos pos, BlockState state) {
193193
return;
194194
}
195195

196-
var chunkPos = new ChunkPos(pos);
196+
var chunkPos = new ChunkPos(pos.getX(), pos.getZ());
197197
Set<OutlineRenderTarget> outlineRenderTargets = ScanController.INSTANCE.syncRenderList.get(chunkPos);
198198
if (outlineRenderTargets == null) {
199199
// It's not being rendered, so we don't care

common/src/main/java/pro/mikey/xray/screens/FindBlockScreen.java

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

33
import net.minecraft.client.Minecraft;
44
import net.minecraft.client.gui.Font;
5-
import net.minecraft.client.gui.GuiGraphics;
5+
import net.minecraft.client.gui.GuiGraphicsExtractor;
66
import net.minecraft.client.gui.components.Button;
77
import net.minecraft.client.gui.components.EditBox;
88
import net.minecraft.client.gui.components.ObjectSelectionList;
@@ -75,9 +75,9 @@ private static Predicate<Block> removeIgnoredBlocks() {
7575
}
7676

7777
@Override
78-
public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
79-
search.render(graphics, x, y, partialTicks);
80-
blockList.render(graphics, x, y, partialTicks);
78+
public void renderExtra(GuiGraphicsExtractor graphics, int x, int y, float partialTicks) {
79+
search.extractRenderState(graphics, x, y, partialTicks);
80+
blockList.extractRenderState(graphics, x, y, partialTicks);
8181
}
8282

8383
@Override
@@ -126,11 +126,6 @@ void updateEntries(List<Block> blocks) {
126126
blocks.forEach(block -> this.addEntry(new BlockSlot(block, this)));
127127
}
128128

129-
@Override
130-
public void renderWidget(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) {
131-
super.renderWidget(pGuiGraphics, pMouseX, pMouseY, pPartialTick);
132-
}
133-
134129
public class BlockSlot extends ObjectSelectionList.Entry<ScrollingBlockList.BlockSlot> {
135130
Block block;
136131
ItemStack stack;
@@ -147,15 +142,15 @@ public Block getBlock() {
147142
}
148143

149144
@Override
150-
public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean hovering, float partialTicks) {
145+
public void extractContent(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, boolean hovering, float partialTicks) {
151146
Font font = this.parent.minecraft.font;
152147

153148
var registryName = BuiltInRegistries.BLOCK.getKey(this.block);
154149

155-
guiGraphics.drawString(font, this.block.getName().getString(), this.getContentX() + 25, this.getContentY() + 7, Color.WHITE.getRGB());
156-
guiGraphics.drawString(font, registryName.getNamespace(), this.getContentX() + 25, this.getContentY() + 17, Color.GRAY.getRGB());
150+
guiGraphics.text(font, this.block.getName().getString(), this.getContentX() + 25, this.getContentY() + 7, Color.WHITE.getRGB());
151+
guiGraphics.text(font, registryName.getNamespace(), this.getContentX() + 25, this.getContentY() + 17, Color.GRAY.getRGB());
157152

158-
guiGraphics.renderItem(this.stack, this.getContentX(), this.getContentY() + 7);
153+
guiGraphics.item(this.stack, this.getContentX(), this.getContentY() + 7);
159154
}
160155

161156
@Override

common/src/main/java/pro/mikey/xray/screens/HelpScreen.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package pro.mikey.xray.screens;
22

33
import net.minecraft.client.Minecraft;
4-
import net.minecraft.client.gui.GuiGraphics;
4+
import net.minecraft.client.gui.GuiGraphicsExtractor;
55
import net.minecraft.client.gui.components.Button;
66
import net.minecraft.client.resources.language.I18n;
77
import net.minecraft.network.chat.Component;
@@ -36,12 +36,12 @@ public void init() {
3636
}
3737

3838
@Override
39-
public void renderExtra(GuiGraphics guiGraphics, int x, int y, float partialTicks) {
39+
public void renderExtra(GuiGraphicsExtractor guiGraphics, int x, int y, float partialTicks) {
4040
int lineY = (getHeight() / 2) - 85;
4141
for (LinedText linedText : areas) {
4242
for (String line : linedText.getLines()) {
4343
lineY += 12;
44-
guiGraphics.drawString(getFontRender(), line, (getWidth() / 2) - 176, lineY, Color.WHITE.getRGB());
44+
guiGraphics.text(getFontRender(), line, (getWidth() / 2) - 176, lineY, Color.WHITE.getRGB());
4545
}
4646
lineY += 10;
4747
}

common/src/main/java/pro/mikey/xray/screens/HudOverlay.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.mojang.blaze3d.systems.GpuDevice;
44
import com.mojang.blaze3d.systems.RenderSystem;
55
import net.minecraft.client.Minecraft;
6-
import net.minecraft.client.gui.GuiGraphics;
6+
import net.minecraft.client.gui.GuiGraphicsExtractor;
77
import net.minecraft.client.renderer.RenderPipelines;
88
import net.minecraft.client.resources.language.I18n;
99
import net.minecraft.resources.Identifier;
@@ -13,7 +13,7 @@
1313
public class HudOverlay {
1414
private static final Identifier CIRCLE = XRay.assetLocation("gui/circle.png");
1515

16-
public static void renderGameOverlayEvent(GuiGraphics graphics) {
16+
public static void renderGameOverlayEvent(GuiGraphicsExtractor graphics) {
1717
// Draw Indicator
1818
if(!ScanController.INSTANCE.isXRayActive() || !XRay.config().showOverlay.get())
1919
return;
@@ -30,6 +30,6 @@ public static void renderGameOverlayEvent(GuiGraphics graphics) {
3030
graphics.blit(RenderPipelines.GUI_TEXTURED, CIRCLE, x, y, 0f, 0f, 5, 5, 5, 5, 0xFF00FF00);
3131

3232
int width = Minecraft.getInstance().font.width(I18n.get("xray.overlay"));
33-
graphics.drawString(Minecraft.getInstance().font, I18n.get("xray.overlay"), x + (!renderDebug ? 10 : -width - 5), y - (!renderDebug ? 1 : 2), 0xff00ff00);
33+
graphics.text(Minecraft.getInstance().font, I18n.get("xray.overlay"), x + (!renderDebug ? 10 : -width - 5), y - (!renderDebug ? 1 : 2), 0xff00ff00);
3434
}
3535
}

common/src/main/java/pro/mikey/xray/screens/ScanConfigureScreen.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package pro.mikey.xray.screens;
22

33
import net.minecraft.client.Minecraft;
4-
import net.minecraft.client.gui.GuiGraphics;
4+
import net.minecraft.client.gui.GuiGraphicsExtractor;
55
import net.minecraft.client.gui.components.Button;
66
import net.minecraft.client.gui.components.EditBox;
77
import net.minecraft.client.gui.layouts.GridLayout;
@@ -183,18 +183,18 @@ public void tick() {
183183
}
184184

185185
@Override
186-
public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
187-
graphics.drawString(font, selectBlock.getName().getString(), getWidth() / 2 - 100, getHeight() / 2 - 90, 0xffffffff);
186+
public void renderExtra(GuiGraphicsExtractor graphics, int x, int y, float partialTicks) {
187+
graphics.text(font, selectBlock.getName().getString(), getWidth() / 2 - 100, getHeight() / 2 - 90, 0xffffffff);
188188

189189
// blit render the TRANSPARENT_BACKGROUND texture, a 16x16 checkerboard pattern that should tile to fit the fill area
190190
graphics.blit(RenderPipelines.GUI_TEXTURED, TRANSPARENT_BACKGROUND, this.getWidth() / 2 - 100, this.getHeight() / 2 - 45, 0, 0, 202, 24, 16, 16, 0x80FFFFFF);
191191

192192
int color = ((int) (this.alphaSlider.getValue() * 255) << 24) | ((int) (this.redSlider.getValue() * 255) << 16) | ((int) (this.greenSlider.getValue() * 255) << 8) | (int) (this.blueSlider.getValue() * 255);
193193
graphics.fill(this.getWidth() / 2 - 100, this.getHeight() / 2 - 45, (this.getWidth() / 2 + 2) + 100, (this.getHeight() / 2 - 45) + 24, color);
194194

195-
oreName.render(graphics, x, y, partialTicks);
195+
oreName.extractWidgetRenderState(graphics, x, y, partialTicks);
196196

197-
graphics.renderItem(this.icon, this.getWidth() / 2 + 85, this.getHeight() / 2 - 105);
197+
graphics.item(this.icon, this.getWidth() / 2 + 85, this.getHeight() / 2 - 105);
198198
}
199199

200200
@Override

common/src/main/java/pro/mikey/xray/screens/ScanManageScreen.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
import net.minecraft.client.Minecraft;
44
import net.minecraft.client.gui.Font;
5-
import net.minecraft.client.gui.GuiGraphics;
5+
import net.minecraft.client.gui.GuiGraphicsExtractor;
66
import net.minecraft.client.gui.components.Button;
77
import net.minecraft.client.gui.components.EditBox;
88
import net.minecraft.client.gui.components.ObjectSelectionList;
99
import net.minecraft.client.gui.components.Tooltip;
1010
import net.minecraft.client.input.KeyEvent;
1111
import net.minecraft.client.input.MouseButtonEvent;
1212
import net.minecraft.client.renderer.RenderPipelines;
13-
import net.minecraft.client.renderer.entity.ItemRenderer;
1413
import net.minecraft.client.resources.language.I18n;
1514
import net.minecraft.network.chat.Component;
1615
import net.minecraft.resources.Identifier;
@@ -45,7 +44,6 @@ public class ScanManageScreen extends GuiBase {
4544

4645
private Button distButtons;
4746
private EditBox search;
48-
public ItemRenderer render;
4947

5048
private String lastSearch = "";
5149

@@ -69,7 +67,6 @@ public void init() {
6967
return;
7068
}
7169

72-
this.render = Minecraft.getInstance().getItemRenderer();
7370
this.children().clear();
7471

7572
this.scrollList = new ScanEntryScroller(((getWidth() / 2) - (203 / 2)) - 37, getHeight() / 2 + 10, 203, 185, this);
@@ -94,7 +91,7 @@ public void init() {
9491

9592
// Check if the hand item is a block or not
9693
if (!(handItem.getItem() instanceof BlockItem)) {
97-
minecraft.player.displayClientMessage(Component.literal("[XRay] " + Component.translatable("xray.message.invalid_hand", Utils.safeItemStackName(handItem).getString())), false);
94+
minecraft.player.sendSystemMessage(Component.literal("[XRay] " + Component.translatable("xray.message.invalid_hand", Utils.safeItemStackName(handItem).getString())));
9895
this.onClose();
9996
return;
10097
}
@@ -126,11 +123,11 @@ public void init() {
126123

127124
minecraft.setScreen(new ScanConfigureScreen(lookingAt, ScanManageScreen::new));
128125
} else {
129-
player.displayClientMessage(Component.literal("[XRay] " + I18n.get("xray.message.nothing_infront")), false);
126+
player.sendSystemMessage(Component.literal("[XRay] " + I18n.get("xray.message.nothing_infront")));
130127
this.onClose();
131128
}
132129
} catch (NullPointerException ex) {
133-
player.displayClientMessage(Component.literal("[XRay] " + I18n.get("xray.message.thats_odd")), false);
130+
player.sendSystemMessage(Component.literal("[XRay] " + I18n.get("xray.message.thats_odd")));
134131
this.onClose();
135132
}
136133
})
@@ -222,18 +219,18 @@ public boolean mouseClicked(MouseButtonEvent event, boolean bl) {
222219
}
223220

224221
@Override
225-
public void renderExtra(GuiGraphics graphics, int x, int y, float partialTicks) {
222+
public void renderExtra(GuiGraphicsExtractor graphics, int x, int y, float partialTicks) {
226223
if (!search.isFocused() && search.getValue().isEmpty()) {
227-
graphics.drawString(getFontRender(), I18n.get("xray.single.search"), getWidth() / 2 - 130, getHeight() / 2 - 101, Color.GRAY.getRGB());
224+
graphics.text(getFontRender(), I18n.get("xray.single.search"), getWidth() / 2 - 130, getHeight() / 2 - 101, Color.GRAY.getRGB());
228225
}
229226

230227
Matrix3x2fStack pose = graphics.pose();
231228
pose.pushMatrix();
232229
pose.translate(this.getWidth() / 2f - 140, ((this.getHeight() / 2f) - 3) + 120);
233230
pose.scale(0.75f, 0.75f);
234-
graphics.drawString(this.font, Component.translatable("xray.tooltips.edit1"), 0, 0, Color.GRAY.getRGB());
231+
graphics.text(this.font, Component.translatable("xray.tooltips.edit1"), 0, 0, Color.GRAY.getRGB());
235232
pose.translate(0, 12);
236-
graphics.drawString(this.font, Component.translatable("xray.tooltips.edit2"), 0, 0, Color.GRAY.getRGB());
233+
graphics.text(this.font, Component.translatable("xray.tooltips.edit2"), 0, 0, Color.GRAY.getRGB());
237234
pose.popMatrix();
238235
}
239236

@@ -323,13 +320,13 @@ public static class ScanSlot extends ObjectSelectionList.Entry<ScanSlot> {
323320
}
324321

325322
@Override
326-
public void renderContent(GuiGraphics guiGraphics, int mouseX, int mouseY, boolean hovering, float partialTicks) {
323+
public void extractContent(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, boolean hovering, float partialTicks) {
327324
Font font = Minecraft.getInstance().font;
328325

329-
guiGraphics.drawString(font, this.entry.name(), this.getContentX() + 25, this.getContentY() + 7, 0xFFFFFFFF);
330-
guiGraphics.drawString(font, this.entry.enabled() ? "Enabled" : "Disabled", this.getContentX() + 25, this.getContentY() + 17, this.entry.enabled() ? Color.GREEN.getRGB() : Color.RED.getRGB());
326+
guiGraphics.text(font, this.entry.name(), this.getContentX() + 25, this.getContentY() + 7, 0xFFFFFFFF);
327+
guiGraphics.text(font, this.entry.enabled() ? "Enabled" : "Disabled", this.getContentX() + 25, this.getContentY() + 17, this.entry.enabled() ? Color.GREEN.getRGB() : Color.RED.getRGB());
331328

332-
guiGraphics.renderItem(this.icon, this.getContentX(), this.getContentY() + 7);
329+
guiGraphics.item(this.icon, this.getContentX(), this.getContentY() + 7);
333330

334331
var stack = guiGraphics.pose();
335332
stack.pushMatrix();

0 commit comments

Comments
 (0)