# 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

@@ -11,18 +11,13 @@ import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.vehicle.Boat;
import net.minecraft.world.phys.Vec3;
import net.minecraft.network.chat.Component;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import static me.zacharias.speedometer.Speedometer.*;
@@ -96,6 +91,39 @@ public class Client {
ClientGuiEvent.RENDER_HUD.register(Client::render);
LOGGER.info("Finished loading speedometer");
/*((IPackRepository) Minecraft.getInstance().getResourcePackRepository()).addSource(new RepositorySource() {
@Override
public void loadPacks(Consumer<Pack> consumer) {
consumer.accept(new Pack(new PackLocationInfo(
"quarter_circle_speedometer",
Component.translatable("resourcepack.speedometer.quarter_circle_speedometer"),
new PackSource() {
@Override
public Component decorate(Component component) {
return component;
}
@Override
public boolean shouldAddAutomatically() {
return false;
}
},
Optional.empty()
),
new Pack.ResourcesSupplier() {
@Override
public PackResources openPrimary(PackLocationInfo packLocationInfo) {
return packLocationInfo.;
}
@Override
public PackResources openFull(PackLocationInfo packLocationInfo, Pack.Metadata metadata) {
return null;
}
}));
}
});*/
}
private static void render(GuiGraphics graphics, DeltaTracker deltaTracker) {
@@ -239,9 +267,9 @@ public class Client {
" Total: " + lSpeed + "\n" +
"Velocity total average: " + speed + "\n" +
"Velocity total in " + speedType.name() + ": " + speedTypeSpeed + "\n" +
"Percentage point of visual speedometer: " + /*v*/"error" + "\n" +
"Degree end point: " + /*i*/"error" +"\n" +
(Config.getVisualSpeedometer()?"Visual Size: ":"Textual display") + Config.getImageSize();
"Endpoint position: (" + Debuger.x + ", " + Debuger.y + ")\n" +
"Percentage point of visual speedometer: " + Debuger.angle + "\n" +
(Config.getVisualSpeedometer()?"Visual Size: "+Config.getImageSize():"Textual display");
Color color = new Color(255, 255, 255);