Skip to content

Commit c2815eb

Browse files
feat: port to neoforge 1.20.3
1 parent 66b0b0c commit c2815eb

7 files changed

Lines changed: 30 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
env:
2121
SAPS_TOKEN: ${{ secrets.SAPS_TOKEN }}
2222
CURSE_DEPLOY_TOKEN: ${{ secrets.CURSE_DEPLOY_TOKEN }}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2324
run: |
2425
chmod +x ./gradlew
2526
./gradlew build publish publishMods --stacktrace --no-daemon

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
## [82.0.0]
1+
## [83.0.0]
22

33
### Changed
44

5-
- Updated to 1.20.2 for NeoForge
6-
- Shifted versioning to be inline with Minecraft release numbers for the major game version (1.20.2 being 82 for example)
5+
- Updated to 1.20.3 for NeoForge

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ plugins {
22
id 'idea'
33
id 'java-library'
44
id 'maven-publish'
5-
id 'net.neoforged.gradle.userdev' version '7.0.55'
6-
id 'net.neoforged.gradle.mixin' version '7.0.55'
5+
id 'net.neoforged.gradle.userdev' version '7.0.57'
6+
id 'net.neoforged.gradle.mixin' version '7.0.57'
77
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
88
}
99

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
org.gradle.jvmargs=-Xmx4G
44

55
mod_id=xray
6-
mod_version=82.0.0
7-
minecraft_version=1.20.2
8-
minecraft_version_range=[%base],1.20.3
6+
mod_version=83.0.0
7+
minecraft_version=1.20.3
8+
minecraft_version_range=[%base],1.20.4
99

1010
# Forge
11-
forge_version= 20.2.86
11+
forge_version=20.3.1-beta
1212
curse_id=256256

src/main/java/pro/mikey/xray/gui/GuiSelectionScreen.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.minecraft.client.gui.components.AbstractSelectionList;
1111
import net.minecraft.client.gui.components.Button;
1212
import net.minecraft.client.gui.components.EditBox;
13+
import net.minecraft.client.gui.components.ObjectSelectionList;
1314
import net.minecraft.client.renderer.entity.ItemRenderer;
1415
import net.minecraft.client.resources.language.I18n;
1516
import net.minecraft.locale.Language;
@@ -275,7 +276,7 @@ void updateEntries(List<BlockData> blocks) {
275276
blocks.forEach(block -> this.addEntry(new BlockSlot(block, this))); // @mcp: addEntry = addEntry
276277
}
277278

278-
public static class BlockSlot extends AbstractSelectionList.Entry<ScrollingBlockList.BlockSlot> {
279+
public static class BlockSlot extends ObjectSelectionList.Entry<ScrollingBlockList.BlockSlot> {
279280
BlockData block;
280281
ScrollingBlockList parent;
281282

@@ -305,7 +306,7 @@ public void render(GuiGraphics guiGraphics, int entryIdx, int top, int left, int
305306
// Minecraft.getInstance().getItemRenderer().renderAndDecorateItem(stack, blockData.getItemStack(), left + 8, top + 7);
306307
// Lighting.setupForFlatItems();
307308

308-
if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getTop() + this.parent.getHeight()) && mouseY > this.parent.getTop()) {
309+
if (mouseX > left && mouseX < (left + entryWidth) && mouseY > top && mouseY < (top + entryHeight) && mouseY < (this.parent.getY() + this.parent.getHeight()) && mouseY > this.parent.getY()) {
309310
guiGraphics.renderTooltip(
310311
font,
311312
Language.getInstance().getVisualOrder(Arrays.asList(Component.translatable("xray.tooltips.edit1"), Component.translatable("xray.tooltips.edit2"))),
@@ -335,6 +336,11 @@ public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_,
335336
this.parent.setSelected(this, mouse);
336337
return false;
337338
}
339+
340+
@Override
341+
public Component getNarration() {
342+
return Component.empty();
343+
}
338344
}
339345
}
340346
}

src/main/java/pro/mikey/xray/gui/utils/ScrollingList.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,40 @@
1010
import java.util.AbstractList;
1111

1212
/**
13-
* A bare bones implementation of the {@link AbstractList} / {@link net.minecraft.client.gui.widget.list.ExtendedList}
13+
* A bare bones implementation of the {@link AbstractList}
1414
* without the background or borders. With GL_SCISSOR to crop out the overflow
1515
*
1616
* This is how an abstract implementation should look... :cry:
1717
*/
1818
public class ScrollingList<E extends AbstractSelectionList.Entry<E>> extends AbstractSelectionList<E> {
1919
public ScrollingList(int x, int y, int width, int height, int slotHeightIn) {
20-
super(Minecraft.getInstance(), width, height, y - (height / 2), (y - (height / 2)) + height, slotHeightIn);
21-
this.setLeftPos(x - (width / 2));
20+
super(Minecraft.getInstance(), width, height, y - (height / 2), slotHeightIn);
21+
this.setX(x - (width / 2));
2222
this.setRenderBackground(false);
2323

2424
// this.setRenderTopAndBottom(false); // removes background
2525
}
2626

2727
@Override
28-
public void render(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
28+
public void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
2929
double scale = Minecraft.getInstance().getWindow().getGuiScale();
3030

3131
GL11.glEnable(GL11.GL_SCISSOR_TEST);
32-
GL11.glScissor((int)(this.x0 * scale), (int)(Minecraft.getInstance().getWindow().getHeight() - ((this.y0 + this.height) * scale)),
32+
GL11.glScissor((int)(this.getX() * scale), (int)(Minecraft.getInstance().getWindow().getHeight() - ((this.getX() + this.height) * scale)),
3333
(int)(this.width * scale), (int)(this.height * scale));
3434

35-
super.render(guiGraphics, mouseX, mouseY, partialTicks);
35+
super.renderWidget(guiGraphics, mouseX, mouseY, partialTicks);
3636

3737
GL11.glDisable(GL11.GL_SCISSOR_TEST);
3838
}
3939

40-
@Override // @mcp: getScrollbarPosition = getScrollbarPosition
41-
protected int getScrollbarPosition() {
42-
return (this.x0 + this.width) - 6;
43-
}
44-
4540
@Override
46-
public void updateNarration(NarrationElementOutput p_169152_) {
41+
protected void updateWidgetNarration(NarrationElementOutput p_259858_) {
4742

4843
}
44+
45+
@Override // @mcp: getScrollbarPosition = getScrollbarPosition
46+
protected int getScrollbarPosition() {
47+
return (this.getX() + this.width) - 6;
48+
}
4949
}

src/main/java/pro/mikey/xray/xray/Controller.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class Controller {
2727
add(Blocks.AIR);
2828
add(Blocks.BEDROCK);
2929
add(Blocks.STONE);
30-
add(Blocks.GRASS);
30+
add(Blocks.GRASS_BLOCK);
3131
add(Blocks.DIRT);
3232
}};
3333

0 commit comments

Comments
 (0)