Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: setup jdk
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '25'
distribution: 'microsoft'
- name: make gradle wrapper executable
run: chmod +x ./gradlew
Expand All @@ -27,4 +27,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
path: build/libs/
17 changes: 8 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'net.fabricmc.fabric-loom-remap' version "${loom_version}"
id 'net.fabricmc.fabric-loom' version "${loom_version}"
id 'maven-publish'
}

Expand All @@ -26,12 +26,11 @@ loom {
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
implementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
implementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
}

Expand All @@ -46,7 +45,7 @@ processResources {
tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
// The new Minecraft 1.20.5 upwards uses Java 21
it.options.release = 21
it.options.release = 25
}

java {
Expand All @@ -55,8 +54,8 @@ java {
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}

jar {
Expand All @@ -83,4 +82,4 @@ publishing {
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ org.gradle.configuration-cache=false

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.21.11
loader_version=0.18.2
loom_version=1.14-SNAPSHOT
minecraft_version=26.1
loader_version=0.18.6
loom_version=1.15-SNAPSHOT

# Mod Properties
mod_version = 1.8.2-1.21.11
mod_version = 1.8.3-26.1
maven_group = one.pouekdev
archives_base_name = coordinatelist

# Dependencies
fabric_version=0.139.4+1.21.11
midnightlib_version=1.9.2+1.21.11-fabric
fabric_version=0.144.4+26.1
midnightlib_version=1.9.2+26.1-fabric
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
25 changes: 20 additions & 5 deletions src/main/java/one/pouekdev/coordinatelist/CListClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.multiplayer.ClientLevel;
Expand All @@ -27,19 +27,19 @@ public class CListClient implements ClientModInitializer{

@Override
public void onInitializeClient(){
openWaypointsKeybind = KeyBindingHelper.registerKeyBinding(new KeyMapping(
openWaypointsKeybind = KeyMappingHelper.registerKeyMapping(new KeyMapping(
"keybinds.waypoints.menu",
InputConstants.Type.KEYSYM,
GLFW.GLFW_KEY_M,
MOD_CATEGORY
));
addAWaypoint = KeyBindingHelper.registerKeyBinding(new KeyMapping(
addAWaypoint = KeyMappingHelper.registerKeyMapping(new KeyMapping(
"keybinds.waypoint.add",
InputConstants.Type.KEYSYM,
GLFW.GLFW_KEY_B,
MOD_CATEGORY
));
toggleVisibility = KeyBindingHelper.registerKeyBinding(new KeyMapping(
toggleVisibility = KeyMappingHelper.registerKeyMapping(new KeyMapping(
"keybinds.waypoints.toggle",
InputConstants.Type.KEYSYM,
GLFW.GLFW_KEY_J,
Expand Down Expand Up @@ -119,6 +119,21 @@ public static void addNewWaypoint(int x, int y, int z, boolean death, boolean vi
String waypointName;
if(death){
waypointName = Component.translatable("waypoint.last.death").getString();
if(CListConfig.maxDeathWaypoints >= 1){
List<Integer> deathIndices = new java.util.ArrayList<>();
for(int i = 0; i < variables.waypoints.size(); i++){
if(variables.waypoints.get(i).deathpoint && !variables.waypoints.get(i).permanent){
deathIndices.add(i);
}
}
while(deathIndices.size() >= CListConfig.maxDeathWaypoints){
deleteWaypoint(deathIndices.get(0));
deathIndices.remove(0);
for(int i = 0; i < deathIndices.size(); i++){
deathIndices.set(i, deathIndices.get(i) - 1);
}
}
}
}
else{
waypointName = Component.translatable("waypoint.new.waypoint").getString();
Expand Down Expand Up @@ -208,4 +223,4 @@ public static void checkIfSaveIsNeeded(boolean force){
variables.savedSinceLastUpdate = true;
}
}
}
}
12 changes: 6 additions & 6 deletions src/main/java/one/pouekdev/coordinatelist/CListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommands;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.commands.CommandBuildContext;
Expand All @@ -11,10 +11,10 @@
public class CListCommand implements ClientCommandRegistrationCallback{
@Override
public void register(CommandDispatcher<FabricClientCommandSource> dispatcher, @NonNull CommandBuildContext buildContext){
dispatcher.register(ClientCommandManager.literal("clist")
.then(ClientCommandManager.argument("x", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
.then(ClientCommandManager.argument("y", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
.then(ClientCommandManager.argument("z", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
dispatcher.register(ClientCommands.literal("clist")
.then(ClientCommands.argument("x", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
.then(ClientCommands.argument("y", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
.then(ClientCommands.argument("z", IntegerArgumentType.integer(Integer.MIN_VALUE, Integer.MAX_VALUE))
.executes(ctx -> {
int x = IntegerArgumentType.getInteger(ctx, "x");
int y = IntegerArgumentType.getInteger(ctx, "y");
Expand All @@ -27,4 +27,4 @@ public void register(CommandDispatcher<FabricClientCommandSource> dispatcher, @N
)
);
}
}
}
1 change: 1 addition & 0 deletions src/main/java/one/pouekdev/coordinatelist/CListConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public class CListConfig extends MidnightConfig {
@Entry public static boolean canPlaceDeathpoints = true;
@Entry public static boolean waypointTextBackground = true;
@Entry public static boolean squareWaypoints = false;
@Entry(min=0) public static int maxDeathWaypoints = 1;
}
12 changes: 10 additions & 2 deletions src/main/java/one/pouekdev/coordinatelist/CListData.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void saveListToFile(String fileName, List<CListWaypoint> waypointL
File file = new File(dataDir, fileName);
try(PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8)))){
for(int i = 0; i < waypointList.size(); i++){
writer.println(CListClient.variables.waypoints.get(i).getCoordinates() + "~" + CListClient.variables.waypoints.get(i).name.replaceAll("~", "") + "~" + CListClient.variables.waypoints.get(i).dimension + "~" + CListClient.variables.colors.get(i).getHexNoAlpha() + "~" + CListClient.variables.waypoints.get(i).render + "~" + CListClient.variables.waypoints.get(i).deathpoint);
writer.println(CListClient.variables.waypoints.get(i).getCoordinates() + "~" + CListClient.variables.waypoints.get(i).name.replaceAll("~", "") + "~" + CListClient.variables.waypoints.get(i).dimension + "~" + CListClient.variables.colors.get(i).getHexNoAlpha() + "~" + CListClient.variables.waypoints.get(i).render + "~" + CListClient.variables.waypoints.get(i).deathpoint + "~" + CListClient.variables.waypoints.get(i).permanent+ "~" + CListClient.variables.waypoints.get(i).originalX + "~" + CListClient.variables.waypoints.get(i).originalZ + "~" + CListClient.variables.waypoints.get(i).hasOriginalCoords);
}
}
catch(IOException ignored){}
Expand All @@ -41,14 +41,22 @@ public static List<CListWaypoint> loadListFromFile(String fileName){
String coords = segments[0];
String name = segments[1];
String dimension = segments[2];
String color = null, bool = null, deathpoint = null;
String color = null, bool = null, deathpoint = null, permanent = null, originalX = null, originalZ = null, hasOriginals = null;
try{
color = segments[3];
bool = segments[4];
deathpoint = segments[5];
permanent = segments[6];
originalX = segments[7];
originalZ = segments[8];
hasOriginals = segments[9];
}
catch(IndexOutOfBoundsException ignored){}
CListWaypoint waypoint = new CListWaypoint(coords, name, dimension, Boolean.parseBoolean(bool), Boolean.parseBoolean(deathpoint));
waypoint.permanent = Boolean.parseBoolean(permanent);
if(originalX != null) waypoint.originalX = Integer.parseInt(originalX);
if(originalZ != null) waypoint.originalZ = Integer.parseInt(originalZ);
waypoint.hasOriginalCoords = Boolean.parseBoolean(hasOriginals);
if(color == null){
CListClient.addRandomWaypointColor();
}
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/one/pouekdev/coordinatelist/CListRenderLayers.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package one.pouekdev.coordinatelist;

import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.platform.DepthTestFunction;
import com.mojang.blaze3d.pipeline.ColorTargetState;
import com.mojang.blaze3d.pipeline.DepthStencilState;
import com.mojang.blaze3d.platform.CompareOp;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.client.renderer.rendertype.LayeringTransform;
import net.minecraft.client.renderer.rendertype.RenderSetup;
import net.minecraft.client.renderer.rendertype.RenderType;
import net.minecraft.util.Util;
import net.minecraft.resources.Identifier;

import java.util.Optional;
import java.util.function.Function;

public class CListRenderLayers{
private static final RenderPipeline POSITION_TEX_COLOR_PIPELINE = RenderPipelines.register(
RenderPipeline.builder(RenderPipelines.GUI_TEXTURED_SNIPPET)
.withLocation("pipeline/position_tex_color")
.withCull(false)
.withoutBlend()
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
.withDepthWrite(true)
.withColorTargetState(new ColorTargetState(Optional.empty(), ColorTargetState.WRITE_ALL))
.withDepthStencilState(new DepthStencilState(CompareOp.ALWAYS_PASS, true))
.build()
);
public static final Function<Identifier, RenderType> POSITION_TEX_COLOR = Util.memoize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.navigation.ScreenRectangle;
import net.minecraft.client.gui.render.state.GuiElementRenderState;
import net.minecraft.client.renderer.state.gui.GuiElementRenderState;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.gui.render.TextureSetup;
import org.jetbrains.annotations.Nullable;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/one/pouekdev/coordinatelist/CListWaypoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ public class CListWaypoint{
private int bugFix;
public boolean render;
public boolean deathpoint;
public boolean permanent;
public int originalX;
public int originalZ;
public boolean hasOriginalCoords;

CListWaypoint(String coords, String waypointName, String waypointDimension, boolean isRendered, boolean isDeathpoint){
String s = coords;
Expand All @@ -25,6 +29,7 @@ public class CListWaypoint{
this.dimension = waypointDimension;
this.render = isRendered;
this.deathpoint = isDeathpoint;
this.permanent = false;
this.bugFix = 0;
}

Expand All @@ -36,6 +41,7 @@ public class CListWaypoint{
this.dimension = waypointDimension;
this.render = isRendered;
this.deathpoint = isDeathpoint;
this.permanent = false;
this.bugFix = 0;
}

Expand Down
Loading
Loading