# 6.2 release

## Notes
- This release addes the ablility to provide your own or a speedometer made by someone else and not the 2 option I(The developer) provides as hard coded features

## Added:
- Resorcepack source for visual speedometer
- Added documentation for resourcepack setup [resourcepack.md](https://github.com/zaze06/Speedometer/blob/master/resourcepack.md)
- Override config for speedometer pointer (only works if it's not an image)

## Fixes:
- Fixed [#2](https://github.com/zaze06/Speedometer/issues/2)

## TO-DO:

## Resourcepack
This release contains a base resourcepack that shuld be like the old one, but there is also an optinaly downloadible resourcepack from GitHub, and as a additinal file in this release on Github and Modrith

## Code notes
This push updates the development envirment to 1.21.1, but fabric is tested and works on 1.21 still
This commit is contained in:
2024-10-10 09:10:57 +02:00
parent f48a4aaf6c
commit 95222c1c95
24 changed files with 403 additions and 78 deletions

View File

@@ -3,24 +3,37 @@ package me.zacharias.speedometer.fabric;
import me.zacharias.speedometer.Speedometer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.minecraft.ChatFormatting;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.RepositorySource;
import net.minecraft.server.packs.resources.ResourceManager;
import org.intellij.lang.annotations.Identifier;
import java.awt.*;
import java.util.HashSet;
import java.util.Set;
import static me.zacharias.speedometer.Speedometer.LOGGER;
import static me.zacharias.speedometer.Speedometer.MOD_ID;
public class SpeedometerFabric implements ModInitializer {
@Override
public void onInitialize() {
Speedometer.init();
//Minecraft.getInstance().getResourcePackRepository().addPack()
ResourceManagerHelper.get(PackType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
/**
* Register the reload listener for the speedometers
* This is required since i haven't found how to put this in the Architecture Abstraction layer(Common module)
* TODO: Find a way to put this in the Abstraction layer
* @param resourceManager The event that is fired when the client reloads resources
*/
@Override
public void onResourceManagerReload(ResourceManager resourceManager) {
Speedometer.loadSpeedometers(resourceManager);
@@ -28,7 +41,7 @@ public class SpeedometerFabric implements ModInitializer {
@Override
public ResourceLocation getFabricId() {
return ResourceLocation.fromNamespaceAndPath("speedometer", "Loading the visual speedometers");
return ResourceLocation.fromNamespaceAndPath("speedometer", "visual_speedometer_reload_listener");
}
});
}

View File

@@ -15,7 +15,7 @@
"icon": "icon.png",
"environment": "client",
"entrypoint": {
"entrypoints": {
"main": ["me.zacharias.speedometer.fabric.SpeedometerFabric"]
},
"depends": {

View File

@@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 34,
"description": "speedometer resources"
}
}