Update to 1.20
All checks were successful
ci/woodpecker/push/jfmod Pipeline was successful
ci/woodpecker/tag/jfmod Pipeline was successful

This commit is contained in:
Johannes Frohnmeyer 2023-06-09 16:59:59 +02:00
parent 2106596e9c
commit 40df5aff5a
Signed by: Johannes
GPG Key ID: E76429612C2929F4
3 changed files with 29436 additions and 29240 deletions

View File

@ -1,7 +1,7 @@
# https://fabricmc.net/develop/ # https://fabricmc.net/develop/
minecraft_version=1.19.4 minecraft_version=1.20
yarn_mappings=build.1 yarn_mappings=build.1
loader_version=0.14.17 loader_version=0.14.21
maven_group=io.gitlab.jfronny maven_group=io.gitlab.jfronny
archives_base_name=translater archives_base_name=translater
@ -13,6 +13,6 @@ curseforge_id=394823
curseforge_required_dependencies=libjf curseforge_required_dependencies=libjf
curseforge_optional_dependencies=modmenu curseforge_optional_dependencies=modmenu
libjf_version=3.6.0 libjf_version=3.8.0
fabric_version=0.75.3+1.19.4 fabric_version=0.83.0+1.20
modmenu_version=6.1.0-rc.1 modmenu_version=7.0.1

View File

@ -1,23 +1,21 @@
package io.gitlab.jfronny.translater.mixin; package io.gitlab.jfronny.translater.mixin;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import com.mojang.serialization.JsonOps;
import io.gitlab.jfronny.translater.Translater; import io.gitlab.jfronny.translater.Translater;
import io.gitlab.jfronny.translater.transformer.TransformingMap; import io.gitlab.jfronny.translater.transformer.TransformingMap;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.FontStorage; import net.minecraft.client.font.*;
import net.minecraft.client.font.FontType; import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.Overlay; import net.minecraft.client.gui.screen.Overlay;
import net.minecraft.client.gui.screen.SplashOverlay; import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@Mixin(SplashOverlay.class) @Mixin(SplashOverlay.class)
@ -27,17 +25,17 @@ public abstract class SplashScreenMixin extends Overlay {
private TextRenderer translater$textRenderer; private TextRenderer translater$textRenderer;
@Inject(at = @At("RETURN"), method = "renderProgressBar") @Inject(at = @At("RETURN"), method = "renderProgressBar")
private void renderTranslationProgress(MatrixStack matrixStack, int i, int j, int k, int l, float f, CallbackInfo ci) { private void renderTranslationProgress(DrawContext context, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
TransformingMap map = Translater.getMap(null); TransformingMap map = Translater.getMap(null);
if (map.initializing) { if (map.initializing) {
translater$textRenderer.draw(matrixStack, map.getInitProgress(), 10, 10, 0); context.drawText(translater$textRenderer, map.getInitProgress(), 10, 10, 0, false);
} }
} }
@Inject(method = "<init>", at = @At("RETURN")) @Inject(method = "<init>", at = @At("RETURN"))
public void setup(CallbackInfo ci) { public void setup(CallbackInfo ci) throws IOException {
final FontStorage fontStorage = new FontStorage(client.getTextureManager(), new Identifier("loading")); final FontStorage fontStorage = new FontStorage(client.getTextureManager(), new Identifier("loading"));
fontStorage.setFonts(Collections.singletonList(FontType.BITMAP.createLoader(JsonParser.parseString(""" Font font = JsonOps.INSTANCE.getMap(JsonParser.parseString("""
{ {
"type": "bitmap", "type": "bitmap",
"file": "minecraft:font/ascii.png", "file": "minecraft:font/ascii.png",
@ -60,7 +58,12 @@ public abstract class SplashScreenMixin extends Overlay {
"\\u03b1\\u03b2\\u0393\\u03c0\\u03a3\\u03c3\\u03bc\\u03c4\\u03a6\\u0398\\u03a9\\u03b4\\u221e\\u2205\\u2208\\u2229", "\\u03b1\\u03b2\\u0393\\u03c0\\u03a3\\u03c3\\u03bc\\u03c4\\u03a6\\u0398\\u03a9\\u03b4\\u221e\\u2205\\u2208\\u2229",
"\\u2261\\u00b1\\u2265\\u2264\\u2320\\u2321\\u00f7\\u2248\\u00b0\\u2219\\u00b7\\u221a\\u207f\\u00b2\\u25a0\\u0000" "\\u2261\\u00b1\\u2265\\u2264\\u2320\\u2321\\u00f7\\u2248\\u00b0\\u2219\\u00b7\\u221a\\u207f\\u00b2\\u25a0\\u0000"
] ]
}""").getAsJsonObject()).load(client.getResourceManager()))); }""").getAsJsonObject())
.flatMap(ml -> FontType.BITMAP.getLoaderCodec().decode(JsonOps.INSTANCE, ml))
.map(fl -> fl.build().left().orElseThrow()).get()
.left().orElseThrow()
.load(client.getResourceManager());
fontStorage.setFonts(Collections.singletonList(font));
translater$textRenderer = new TextRenderer(id -> fontStorage, false); translater$textRenderer = new TextRenderer(id -> fontStorage, false);
} }
} }

File diff suppressed because it is too large Load Diff