Skip to content

Commit a547649

Browse files
committed
Halfway done with 1.21.5 support
1 parent 3709d74 commit a547649

File tree

14 files changed

+117
-93
lines changed

14 files changed

+117
-93
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,22 @@ on: [pull_request, push, workflow_dispatch]
88

99
jobs:
1010
build:
11-
strategy:
12-
matrix:
13-
# Use these Java versions
14-
java: [
15-
21, # Current Java LTS
16-
]
17-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-24.04
1812
steps:
1913
- name: checkout repository
2014
uses: actions/checkout@v4
2115
- name: validate gradle wrapper
22-
uses: gradle/wrapper-validation-action@v2
23-
- name: setup jdk ${{ matrix.java }}
16+
uses: gradle/actions/wrapper-validation@v4
17+
- name: setup jdk
2418
uses: actions/setup-java@v4
2519
with:
26-
java-version: ${{ matrix.java }}
20+
java-version: '21'
2721
distribution: 'microsoft'
2822
- name: make gradle wrapper executable
2923
run: chmod +x ./gradlew
3024
- name: build
3125
run: ./gradlew build
3226
- name: capture build artifacts
33-
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
3427
uses: actions/upload-artifact@v4
3528
with:
3629
name: Artifacts

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Jakub Starostecki
3+
Copyright (c) 2025 Jakub Starostecki
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

build.gradle

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
plugins {
2-
id 'fabric-loom' version '1.9-SNAPSHOT'
2+
id 'fabric-loom' version '1.10-SNAPSHOT'
33
id 'maven-publish'
44
}
55

66
version = project.mod_version
77
group = project.maven_group
88

9+
base {
10+
archivesName = project.archives_base_name
11+
}
12+
913
repositories {
1014
maven { url = "https://api.modrinth.com/maven" }
1115
// Add repositories to retrieve artifacts from in here.
@@ -20,24 +24,18 @@ dependencies {
2024
minecraft "com.mojang:minecraft:${project.minecraft_version}"
2125
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
2226
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
27+
2328
// Fabric API. This is technically optional, but you probably want it anyway.
2429
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
2530
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
2631
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
27-
// Uncomment the following line to enable the deprecated Fabric API modules.
28-
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
29-
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
30-
}
31-
32-
base {
33-
archivesName = project.archives_base_name
3432
}
3533

3634
processResources {
3735
inputs.property "version", project.version
3836

3937
filesMatching("fabric.mod.json") {
40-
expand "version": project.version
38+
expand "version": inputs.properties.version
4139
}
4240
}
4341

@@ -58,15 +56,18 @@ java {
5856
}
5957

6058
jar {
59+
inputs.property "archivesName", project.base.archivesName
60+
6161
from("LICENSE") {
62-
rename { "${it}_${base.archivesName.get()}"}
62+
rename { "${it}_${inputs.properties.archivesName}"}
6363
}
6464
}
6565

6666
// configure the maven publication
6767
publishing {
6868
publications {
69-
mavenJava(MavenPublication) {
69+
create("mavenJava", MavenPublication) {
70+
artifactId = project.archives_base_name
7071
from components.java
7172
}
7273
}
@@ -78,4 +79,4 @@ publishing {
7879
// The repositories here will be used for publishing your artifact, not for
7980
// retrieving dependencies.
8081
}
81-
}
82+
}

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.21.4
8-
yarn_mappings=1.21.4+build.2
9-
loader_version=0.16.9
7+
minecraft_version=1.21.5
8+
yarn_mappings=1.21.5+build.1
9+
loader_version=0.16.10
1010

1111
# Mod Properties
12-
mod_version = 1.7.2-1.21.4
12+
mod_version = 1.7.2-1.21.5
1313
maven_group = one.pouekdev
1414
archives_base_name = coordinatelist
1515

1616
# Dependencies
17-
fabric_version=0.112.0+1.21.4
18-
midnightlib_version=1.6.6-fabric
17+
fabric_version=0.119.5+1.21.5
18+
midnightlib_version=1.7.1+1.21.4-fabric
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
6-
zipStorePath=wrapper/dists
7+
zipStorePath=wrapper/dists

gradlew

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ done
8383
# This is normally unused
8484
# shellcheck disable=SC2034
8585
APP_BASE_NAME=${0##*/}
86-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
86+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
8787

8888
# Use the maximum available, or set MAX_FD != -1 to use that value.
8989
MAX_FD=maximum

src/main/java/one/pouekdev/coordinatelist/CListClient.java

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package one.pouekdev.coordinatelist;
22

3-
import com.mojang.blaze3d.systems.RenderSystem;
3+
import com.mojang.blaze3d.vertex.VertexFormat;
44
import net.fabricmc.api.ClientModInitializer;
55
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
66
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
77
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
88
import net.minecraft.client.font.TextRenderer;
9-
import net.minecraft.client.gl.ShaderProgramKeys;
109
import net.minecraft.client.option.KeyBinding;
1110
import net.minecraft.client.render.*;
1211
import net.minecraft.client.util.InputUtil;
@@ -21,26 +20,22 @@
2120
import org.apache.commons.lang3.StringUtils;
2221
import org.joml.Matrix4f;
2322
import org.lwjgl.glfw.GLFW;
24-
import org.lwjgl.opengl.GL11;
2523
import eu.midnightdust.lib.config.MidnightConfig;
2624

27-
import java.util.ArrayList;
2825
import java.util.List;
2926
import java.util.Objects;
3027
import java.util.Random;
31-
import java.util.regex.Matcher;
32-
import java.util.regex.Pattern;
3328

3429
public class CListClient implements ClientModInitializer {
3530
public static CListVariables variables = new CListVariables();
3631
static Random rand = new Random();
3732
KeyBinding open_waypoints_keybind;
3833
KeyBinding add_a_waypoint;
3934
KeyBinding toggle_visibility;
40-
public float calculateSizeWaypoint(){
35+
public float calculateWaypointSize(){
4136
return 0.5f * (CListConfig.multiplier/10.0f);
4237
}
43-
public float calculateSizeText(){
38+
public float calculateTextSize(){
4439
return 15f * (CListConfig.multiplier/10.0f);
4540
}
4641
public float distanceTo(CListWaypoint waypoint) {
@@ -77,15 +72,6 @@ public Vec3d calculateRenderCoords(CListWaypoint waypoint, Camera camera, float
7772
}
7873
return new Vec3d(prx,pry,prz);
7974
}
80-
public static List<String> findNumbersInString(String input) {
81-
List<String> numbersList = new ArrayList<>();
82-
Pattern pattern = Pattern.compile("-?\\b(?![A-Za-z])\\d+(\\.\\d+)?\\b");
83-
Matcher matcher = pattern.matcher(input);
84-
while (matcher.find()) {
85-
numbersList.add(matcher.group());
86-
}
87-
return numbersList;
88-
}
8975
@Override
9076
public void onInitializeClient() {
9177
open_waypoints_keybind = KeyBindingHelper.registerKeyBinding(new KeyBinding(
@@ -108,14 +94,12 @@ public void onInitializeClient() {
10894
));
10995
WorldRenderEvents.END.register(context ->{
11096
if (!variables.waypoints.isEmpty() && CListConfig.waypoints_toggled && !CListVariables.minecraft_client.options.hudHidden) {
111-
RenderSystem.disableCull();
112-
RenderSystem.depthFunc(GL11.GL_ALWAYS);
11397
for(int i = 0; i < variables.waypoints.size(); i++){
11498
CListWaypoint waypoint = variables.waypoints.get(i);
11599
int distance_without_decimal_places = (int) distanceTo(waypoint);
116100
if(Objects.equals(waypoint.getDimensionString(), getDimension(String.valueOf(variables.last_world.getDimension().effects()))) && waypoint.render && (CListConfig.render_distance == 0 || CListConfig.render_distance >= distance_without_decimal_places)) {
117101
Camera camera = context.camera();
118-
float size = calculateSizeWaypoint();
102+
float size = calculateWaypointSize();
119103
Vec3d renderCoords = calculateRenderCoords(waypoint, camera, distance_without_decimal_places);
120104
Vec3d targetPosition = new Vec3d(renderCoords.x, renderCoords.y+1, renderCoords.z);
121105
Vec3d transformedPosition = targetPosition.subtract(camera.getPos());
@@ -130,25 +114,21 @@ public void onInitializeClient() {
130114
BufferBuilder buffer = tessellator.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE_COLOR);
131115
buffer.vertex(positionMatrix, 0, 1, 0).color(variables.colors.get(i).r, variables.colors.get(i).g, variables.colors.get(i).b, 1f).texture(0f, 0f);
132116
buffer.vertex(positionMatrix, 0, 0, 0).color(variables.colors.get(i).r, variables.colors.get(i).g, variables.colors.get(i).b, 1f).texture(0f, 1f);
133-
buffer.vertex(positionMatrix, 1, 0, 0).color(variables.colors.get(i).r, variables.colors.get(i).g, variables.colors.get(i).b, 1f).texture(1f, 1);
117+
buffer.vertex(positionMatrix, 1, 0, 0).color(variables.colors.get(i).r, variables.colors.get(i).g, variables.colors.get(i).b, 1f).texture(1f, 1f);
134118
buffer.vertex(positionMatrix, 1, 1, 0).color(variables.colors.get(i).r, variables.colors.get(i).g, variables.colors.get(i).b, 1f).texture(1f, 0f);
135-
RenderSystem.setShader(ShaderProgramKeys.POSITION_TEX_COLOR);
119+
Identifier icon;
136120
if(waypoint.deathpoint){
137-
RenderSystem.setShaderTexture(0, Identifier.of("coordinatelist", "skull.png"));
121+
icon = Identifier.of("coordinatelist", "skull.png");
138122
}
139123
else {
140-
RenderSystem.setShaderTexture(0, Identifier.of("coordinatelist", "waypoint_icon.png"));
124+
icon = Identifier.of("coordinatelist", "waypoint_icon.png");
141125
}
142-
RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
143-
BufferRenderer.drawWithGlobalProgram(buffer.end());
144-
RenderSystem.enableBlend();
145-
RenderSystem.depthMask(true);
146-
RenderSystem.clear(GL11.GL_DEPTH_BUFFER_BIT);
126+
CListRenderLayers.POSITION_TEX_COLOR.apply(icon).draw(buffer.end());
147127
TextRenderer textRenderer = CListVariables.minecraft_client.textRenderer;
148128
String labelText = waypoint.name + " (" + distance_without_decimal_places + " m)";
149129
int textWidth = textRenderer.getWidth(labelText);
150130
matrixStack.scale(-0.025f, -0.025f, 0.025f);
151-
size = calculateSizeText();
131+
size = calculateTextSize();
152132
matrixStack.scale((float) Math.log(size * 4), (float) Math.log(size * 4), (float) Math.log(size * 4));
153133
matrixStack.translate(0,-20,0);
154134
positionMatrix = matrixStack.peek().getPositionMatrix();
@@ -157,16 +137,14 @@ public void onInitializeClient() {
157137
if(CListConfig.waypoint_text_background) {
158138
textRenderer.draw(labelText, h, 0, 0xFFFFFF, false, positionMatrix, v, TextRenderer.TextLayerType.NORMAL, 0x90000000, LightmapTextureManager.MAX_LIGHT_COORDINATE);
159139
}
160-
// This fixes text flickering. If somebody finds a better way to fix it, please open a PR
161-
matrixStack.translate(0,0,0.06f);
162-
positionMatrix = matrixStack.peek().getPositionMatrix();
163-
textRenderer.draw(labelText, h,0,0xFFFFFF,false,positionMatrix,v, TextRenderer.TextLayerType.NORMAL,0x00000000,LightmapTextureManager.MAX_LIGHT_COORDINATE);
140+
else{
141+
textRenderer.draw(labelText, h, 0, 0xFFFFFF, false, positionMatrix, v, TextRenderer.TextLayerType.NORMAL, 0x00000000, LightmapTextureManager.MAX_LIGHT_COORDINATE);
142+
}
143+
// If we want text to be rendered on top we will have to have a separate layer for it
144+
// A separate layer breaks the rotation of the text
164145
v.draw();
165-
RenderSystem.disableBlend();
166146
}
167147
}
168-
RenderSystem.depthFunc(GL11.GL_LEQUAL);
169-
RenderSystem.enableCull();
170148
}
171149
});
172150
ClientTickEvents.END_CLIENT_TICK.register(client -> {
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package one.pouekdev.coordinatelist;
2+
3+
import com.mojang.blaze3d.pipeline.RenderPipeline;
4+
import com.mojang.blaze3d.platform.DepthTestFunction;
5+
import net.minecraft.client.gl.RenderPipelines;
6+
import net.minecraft.client.render.RenderLayer;
7+
import net.minecraft.client.render.RenderPhase;
8+
import net.minecraft.util.Identifier;
9+
import net.minecraft.util.TriState;
10+
import net.minecraft.util.Util;
11+
12+
import java.util.function.Function;
13+
14+
public class CListRenderLayers {
15+
private static final RenderPipeline TEXT_PIPELINE = RenderPipelines.register(
16+
RenderPipeline.builder(RenderPipelines.TEXT_SNIPPET, RenderPipelines.FOG_SNIPPET)
17+
.withLocation("pipeline/text")
18+
.withVertexShader("core/rendertype_text")
19+
.withFragmentShader("core/rendertype_text")
20+
.withSampler("Sampler0")
21+
.withSampler("Sampler2")
22+
.build()
23+
);
24+
public static final RenderLayer TEXT = RenderLayer.of(
25+
"text",
26+
1536,
27+
false,
28+
true,
29+
TEXT_PIPELINE,
30+
RenderLayer.MultiPhaseParameters.builder().build(false)
31+
);
32+
private static final RenderPipeline POSITION_TEX_COLOR_PIPELINE = RenderPipelines.register(
33+
RenderPipeline.builder(RenderPipelines.POSITION_TEX_COLOR_SNIPPET)
34+
.withLocation("pipeline/position_tex_color")
35+
.withCull(false)
36+
.withoutBlend()
37+
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
38+
.withDepthWrite(true)
39+
.build()
40+
);
41+
public static final Function<Identifier, RenderLayer> POSITION_TEX_COLOR = Util.memoize(
42+
texture -> RenderLayer.of(
43+
"pos_tex_color",
44+
1536,
45+
false,
46+
true,
47+
POSITION_TEX_COLOR_PIPELINE,
48+
RenderLayer.MultiPhaseParameters.builder().texture(new RenderPhase.Texture(texture, TriState.FALSE, false)).build(false)
49+
)
50+
);
51+
}

src/main/java/one/pouekdev/coordinatelist/CListWaypoint.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ public class CListWaypoint {
3939
public String getCoordinates(){
4040
return "X: " + x + " Y: " + y + " Z: " + z;
4141
}
42-
public void setName(String value){
43-
this.name = value;
44-
}
4542
public void toggleVisibility(){
4643
this.bug_fix += 1;
4744
if(bug_fix == 2){

0 commit comments

Comments
 (0)