Update to 1.20
This commit is contained in:
parent
2106596e9c
commit
40df5aff5a
@ -1,7 +1,7 @@
|
||||
# https://fabricmc.net/develop/
|
||||
minecraft_version=1.19.4
|
||||
minecraft_version=1.20
|
||||
yarn_mappings=build.1
|
||||
loader_version=0.14.17
|
||||
loader_version=0.14.21
|
||||
|
||||
maven_group=io.gitlab.jfronny
|
||||
archives_base_name=translater
|
||||
@ -13,6 +13,6 @@ curseforge_id=394823
|
||||
curseforge_required_dependencies=libjf
|
||||
curseforge_optional_dependencies=modmenu
|
||||
|
||||
libjf_version=3.6.0
|
||||
fabric_version=0.75.3+1.19.4
|
||||
modmenu_version=6.1.0-rc.1
|
||||
libjf_version=3.8.0
|
||||
fabric_version=0.83.0+1.20
|
||||
modmenu_version=7.0.1
|
||||
|
@ -1,23 +1,21 @@
|
||||
package io.gitlab.jfronny.translater.mixin;
|
||||
|
||||
import com.google.gson.JsonParser;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import io.gitlab.jfronny.translater.Translater;
|
||||
import io.gitlab.jfronny.translater.transformer.TransformingMap;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.FontStorage;
|
||||
import net.minecraft.client.font.FontType;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.font.*;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Overlay;
|
||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
@Mixin(SplashOverlay.class)
|
||||
@ -27,17 +25,17 @@ public abstract class SplashScreenMixin extends Overlay {
|
||||
private TextRenderer translater$textRenderer;
|
||||
|
||||
@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);
|
||||
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"))
|
||||
public void setup(CallbackInfo ci) {
|
||||
public void setup(CallbackInfo ci) throws IOException {
|
||||
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",
|
||||
"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",
|
||||
"\\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);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user