1 Commits

Author SHA1 Message Date
b4eb3884a5 Add initial Quilt submodule config
- Added missing `gradle.properties` for the `:quilt` module
- Added `include("quilt")` to `settings.gradle`

Not sure what this setup really does beyond setting Loom's platform to Quilt.
This doesn't currently build — possibly due to:
A) Missing support, or
B) Me doing something wrong.

This branch might be dead, but at least this stuff is tracked now.

Best regards,
my future self (if I ever come back to this)
2025-05-18 16:33:34 +02:00
9 changed files with 300 additions and 299 deletions

View File

@@ -27,7 +27,7 @@ assignees: zaze06
**Config** **Config**
*If needed* *If needed*
*Use [GitHub Gist](gist.gihub.com) to upload your speedometer config, located in `<minecraft>/config/speedometer/config.json`* *Use [GitHub Gist](gist.gihub.com) to upload your speedometer config, located in *
**Logs** **Logs**
*If needed(Most of the times)* *If needed(Most of the times)*

View File

@@ -4,7 +4,7 @@
"description": "A different speedometer", "description": "A different speedometer",
"supported_formats": { "supported_formats": {
"min_inclusive": 34, "min_inclusive": 34,
"max_inclusive": 80 "max_inclusive": 57
} }
} }
} }

View File

@@ -6,7 +6,6 @@ import dev.architectury.event.events.client.ClientTickEvent;
import dev.architectury.platform.Platform; import dev.architectury.platform.Platform;
import dev.architectury.registry.client.keymappings.KeyMappingRegistry; import dev.architectury.registry.client.keymappings.KeyMappingRegistry;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.CrashReport;
import net.minecraft.client.DeltaTracker; import net.minecraft.client.DeltaTracker;
import net.minecraft.client.KeyMapping; import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@@ -183,8 +182,7 @@ public class Client {
} }
if(Config.isDebug()){ if(Config.isDebug()){
String debugData = "Speedometer: "+VERSION+"\n"+ String debugData = "Velocity raw:" + "\n" +
"Velocity raw:" + "\n" +
" X: " + vec.x + "\n" + " X: " + vec.x + "\n" +
" Y: " + vec.y + "\n" + " Y: " + vec.y + "\n" +
" Z: " + vec.z + "\n" + " Z: " + vec.z + "\n" +
@@ -241,80 +239,86 @@ public class Client {
} }
private static int getPos(GuiGraphics event, int width, String input, boolean isXPosition) { private static int getPos(GuiGraphics event, int width, String input, boolean isXPosition) {
ArrayList<String> tokens = new ArrayList<>(); ArrayList<String> passerPose = new ArrayList<>();
final char[] s = input.toCharArray(); final char[] s = input.toCharArray();
try{ try{
for(int i = 0; i <s.length; i++){ for(int i = 0; i <s.length; i++){
char c = s[i]; char c = s[i];
if(c == '+' || if(c == 'W' || c == 'H'){
if(isXPosition) passerPose.add(String.valueOf(event.guiWidth()));
else passerPose.add(String.valueOf(event.guiHeight()));
}
else if(c == 'h' || c == 'w'){
if(isXPosition) passerPose.add(String.valueOf(event.guiWidth() / 2));
else passerPose.add(String.valueOf(event.guiHeight() / 2));
}
else if(c == 'S' || c == 's'){
passerPose.add(String.valueOf(width));
}
else if(c == '+' ||
c == '-' || c == '-' ||
c == '*' || c == '*' ||
c == '/'){ c == '/'){
tokens.add(Character.toString(c)); passerPose.add(Character.toString(c));
} }
else if(Character.isDigit(c)){ else if(Character.isDigit(c)){
int lastIndex = i - 1; int lastIndex = i - 1;
if(lastIndex >= 0 && tokens.get(lastIndex).matches("^[0-9]+$")) { if(lastIndex > 0 && passerPose.get(lastIndex).matches("^[0-9]+$")) {
tokens.set(tokens.size() - 1, tokens.get(tokens.size() - 1) + c); passerPose.add(passerPose.removeLast() + c);
} }
else else
{ {
tokens.add(Character.toString(c)); passerPose.add(Character.toString(c));
} }
} }
else{ else{
throw new IllegalArgumentException("Invalid character in input string: " + c); throw new Exception();
} }
} }
}catch (Exception e){ }catch (Exception e){
tokens.clear(); passerPose.clear();
defaultValues(event, isXPosition, tokens); defaultValues(event, isXPosition, passerPose);
} }
//
int position; int position;
try{ try{
position = Integer.parseInt(tokens.getFirst()); position = Integer.parseInt(passerPose.getFirst());
}catch (NumberFormatException e){ }catch (NumberFormatException e){
tokens.clear(); passerPose.clear();
defaultValues(event, isXPosition, tokens); defaultValues(event, isXPosition, passerPose);
position = Integer.parseInt(tokens.getFirst()); position = Integer.parseInt(passerPose.getFirst());
} }
for(int i = 1; i < tokens.size(); i+=2){ for(int i = 1; i < passerPose.size(); i++){
String operator = tokens.get(i); boolean first = false;
if(i + 1 >= tokens.size()) { String s1 = passerPose.get(i);
LOGGER.error("Invalid expression: missing operand after operator '{}'", operator); String s2 = "";
break; try{
} s2 = passerPose.get(i+1);
String operand = tokens.get(i + 1); }catch (Exception e){
int value; first = true;
try {
value = Integer.parseInt(operand);
}
catch (NumberFormatException e) {
LOGGER.error("Invalid operand: '{}'. Using default value. REPORT THIS! https://github.com/zaze06/Speedometer/issues/new/choose", operand);
Minecraft.getInstance().emergencySaveAndCrash(new CrashReport("Invalid operand in speedometer position calculation. REPORT THIS! https://github.com/zaze06/Speedometer/issues/new/choose", e));
return -1;
} }
switch (operator) { if(Objects.equals(s1, "+") && !first){
case "+" -> position += value; position += Integer.parseInt(s2);
case "-" -> position -= value; }else if(Objects.equals(s1, "-") && !first){
case "*" -> position *= value; position -= Integer.parseInt(s2);
case "/" -> position /= value; }else if(Objects.equals(s1, "*") && !first){
position *= Integer.parseInt(s2);
}else if(Objects.equals(s1, "/") && !first){
position /= Integer.parseInt(s2);
} }
} }
if((Config.isDebug()) && Config.getCounter() < 2) {
if (Config.isDebug() && Config.getCounter() < 2) { String speedDisplayType = SpeedTypes.getName(Config.getSpeedType()).getString();
LOGGER.info("Selected speed type: {}\n{}\n\n{}\n\n{}", String splitRawSpeedPosition = Arrays.toString(passerPose.toArray());
SpeedTypes.getName(Config.getSpeedType()).getString(), String rawSpeedPosition = isXPosition ? Config.getXPosition() : Config.getYPosition();
Arrays.toString(tokens.toArray()), LOGGER.info("Selected speed type: {}\n{}\n\n{}\n\n{}", speedDisplayType, splitRawSpeedPosition, position, rawSpeedPosition);
position,
isXPosition ? Config.getXPosition() : Config.getYPosition());
Config.addCounter(); Config.addCounter();
} }
return position; return position;
} }

View File

@@ -1,29 +1,29 @@
org.gradle.jvmargs=-Xmx8G org.gradle.jvmargs=-Xmx8G
minecraft_version=1.21.6 minecraft_version=1.21.5
archives_base_name=speedometer archives_base_name=speedometer
mod_version=6.3.0 mod_version=6.2.4
maven_group=me.zacharias maven_group=me.zacharias
# https://modrinth.com/mod/architectury-api/versions # https://modrinth.com/mod/architectury-api/versions
architectury_version=17.0.6 architectury_version=16.0.3
# https://modrinth.com/mod/cloth-config/versions # https://modrinth.com/mod/cloth-config/versions
cloth_config_version = 19.0.147 cloth_config_version = 18.0.145
# NeoForged Only # NeoForged Only
# https://neoforged.net/ # https://neoforged.net/
neoforge_version = 21.6.12-beta neoforge_version = 21.5.14-beta
# Fabric Only # Fabric Only
# https://fabricmc.net/develop/ # https://fabricmc.net/develop/
fabric_loader_version=0.16.14 fabric_loader_version=0.16.10
fabric_api_version=0.127.1 fabric_api_version=0.119.6
# Fabric Only # Fabric Only
# https://modrinth.com/mod/modmenu/versions # https://modrinth.com/mod/modmenu/versions
modmenu_version = 15.0.0-beta.3 modmenu_version = 14.0.0-rc.2
# Version of the org.json json library # Version of the org.json json library
json_version = 20240303 json_version = 20240303

View File

@@ -27,7 +27,7 @@ public class SpeedometerNeoForge {
} }
} }
@EventBusSubscriber(modid = MOD_ID,/* bus = EventBusSubscriber.Bus.MOD, */value = Dist.CLIENT) @EventBusSubscriber(modid = MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
class EventHandler class EventHandler
{ {
/** /**

View File

@@ -8,8 +8,7 @@
"6.2.1": "Fixed issue #3", "6.2.1": "Fixed issue #3",
"6.2.2": "Fixed issue with multi digit position in the parser", "6.2.2": "Fixed issue with multi digit position in the parser",
"6.2.3": "Fixed crash issue from 6.2.2 when playing in 1.21.4", "6.2.3": "Fixed crash issue from 6.2.2 when playing in 1.21.4",
"6.2.4": "updated to 1.21.5", "6.2.4": "updated to 1.21.5"
"6.3.0": "updated to 1.21.6, Fixed bug in tokenizer"
}, },
"promos": { "promos": {
"1.21-latest": "6.2.2", "1.21-latest": "6.2.2",
@@ -19,9 +18,6 @@
"1.21.4-recommended": "6.2.3", "1.21.4-recommended": "6.2.3",
"1.21.5-latest": "6.2.4", "1.21.5-latest": "6.2.4",
"1.21.5-recommended": "6.2.4", "1.21.5-recommended": "6.2.4"
"1.21.6-latest": "6.3.0",
"1.21.6-recommended": "6.3.0"
} }
} }

1
quilt/gradle.properties Normal file
View File

@@ -0,0 +1 @@
loom.platform=quilt

View File

@@ -13,8 +13,7 @@ This is a simple mod for Forge, Fabric, and NeoForged that displays your current
3. Run `gradlew build`(Windows cmd) or `./gradlew build`(Linux, MacOS, Windows powershell) 3. Run `gradlew build`(Windows cmd) or `./gradlew build`(Linux, MacOS, Windows powershell)
4. the compiled version will be in 4. the compiled version will be in
* Fabic: `fabric/build/libs` * Fabic: `fabric/build/libs`
* NeoForge: `neoforged/build/libs` * Forge: `neoforged/build/libs`
* Forge: `forge/build/libs`
## Forge Support Transition ## Forge Support Transition
As of version 1.21 I chose to no longer support Forge in fevour of NeoForged As of version 1.21 I chose to no longer support Forge in fevour of NeoForged

View File

@@ -10,3 +10,4 @@ pluginManagement {
include("common") include("common")
include("fabric") include("fabric")
include("neoforge") include("neoforge")
include("quilt")