update legacy fabric api, lang autogen

This commit is contained in:
creeper123123321 2022-01-26 09:05:18 -03:00
parent 0381c595b8
commit b463b48312
26 changed files with 64 additions and 186 deletions

View File

@ -1,13 +1,17 @@
# Contributing # Contributing
## Language Files ## Language Files
Language files are under ``src/main/resources/assets/viafabric/lang/``. Please create/edit both ``.json`` and ``.lang`` files.
Language files are under ``src/main/resources/assets/viafabric/lang/``. Please edit ``.json`` files. Create a ``.lang``
with ``${nameofjson}``, so the build script can convert automatically to the old format.
Use capitalization rules from your language. Try to be consistent with Minecraft language files. Use capitalization rules from your language. Try to be consistent with Minecraft language files.
Please check in-game string length. Note that abbreviations may cause issues with the screen reader. Please check in-game string length. Note that abbreviations may cause issues with the screen reader.
Take a look at UN's guidelines for Gender-inclusive language: https://www.un.org/en/gender-inclusive-language/guidelines.shtml Take a look at UN's guidelines for Gender-inclusive
language: https://www.un.org/en/gender-inclusive-language/guidelines.shtml
## Source Code ## Source Code
Use 4 spaces, run code cleanup and ``optipng`` on new png files. Use 4 spaces, run code cleanup and ``optipng`` on new png files.

View File

@ -18,7 +18,7 @@ This mod can be installed on 1.8.9, 1.14.4, 1.15.2, 1.16.5 and 1.17.1 with Fabri
| (Bundled) ViaVersion | https://viaversion.com/ | | (Bundled) ViaVersion | https://viaversion.com/ |
| (Bundled) Cotton Client Commands (MC 1.14-15) | https://jitpack.io/#TinfoilMC/ClientCommands | | (Bundled) Cotton Client Commands (MC 1.14-15) | https://jitpack.io/#TinfoilMC/ClientCommands |
| Fabric API (MC 1.14+) | https://www.curseforge.com/minecraft/mc-mods/fabric-api | | Fabric API (MC 1.14+) | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
| Legacy Rewoven API (MC 1.8.9) | https://maven.rewovenmc.tk/net/legacyfabric/legacy-fabric-api/ | | Legacy Fabric API (MC 1.8.9) | https://www.curseforge.com/minecraft/mc-mods/legacy-fabric-api |
Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not work with modded registry entries or Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not work with modded registry entries or
registry synchronization (fabric-registry-sync mod). registry synchronization (fabric-registry-sync mod).

View File

@ -1,7 +1,9 @@
// todo migrate this code to kotlin // todo migrate this code to kotlin
import com.google.gson.JsonParser
import net.fabricmc.loom.task.RemapJarTask import net.fabricmc.loom.task.RemapJarTask
import org.apache.tools.ant.filters.ReplaceTokens
import java.nio.file.Files
// Stolen https://github.com/FabricMC/fabric/blob/1.17/build.gradle // Stolen https://github.com/FabricMC/fabric/blob/1.17/build.gradle
plugins { plugins {
@ -51,9 +53,8 @@ allprojects {
maven { url = "https://repo.viaversion.com/" } maven { url = "https://repo.viaversion.com/" }
maven { url = "https://maven.fabricmc.net/" } maven { url = "https://maven.fabricmc.net/" }
maven { url = "https://maven.legacyfabric.net/" } maven { url = "https://maven.legacyfabric.net/" }
maven { url = "https://maven.rewovenmc.tk/" }
maven { url = "https://maven.terraformersmc.com/releases/" } maven { url = "https://maven.terraformersmc.com/releases/" }
maven { url = "https://jitpack.io/"} maven { url = "https://jitpack.io/" }
} }
dependencies { dependencies {
@ -66,10 +67,7 @@ allprojects {
processResources { processResources {
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
filter(ReplaceTokens, tokens: [ it.expand(rootProject.properties)
version : rootProject.version,
description: rootProject.description
])
} }
} }
@ -172,6 +170,22 @@ dependencies {
} }
} }
processResources {
filesMatching("assets/*/lang/*.lang") {
HashMap<String, String> langMap = new HashMap<>()
Files.list(rootProject.file("src/main/resources/assets/viafabric/lang").toPath())
.filter(path -> path.toString().endsWith(".json"))
.forEach(path -> {
String legacyFile = "\n" + String.join("\n", JsonParser
.parseReader(Files.newBufferedReader(path)).asJsonObject.entrySet().stream()
.map(entry -> entry.key + "=" + entry.value.asString)
.toArray(String[]::new))
langMap.put(path.getFileName().toString().replace(".json", ""), legacyFile)
})
it.expand(langMap)
}
}
curseforge { curseforge {
if (ENV.CURSEFORGE_API_KEY) { if (ENV.CURSEFORGE_API_KEY) {
apiKey = ENV.CURSEFORGE_API_KEY apiKey = ENV.CURSEFORGE_API_KEY

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Protokoll Version # Autogenerated ${de_de}
gui.enable_client_side_button=ViaVersion aktivieren
gui.enable_client_side.question=Bist du dir sicher, dass du den clientseitigen Modus aktivieren möchtest?
gui.enable_client_side.warning=Ich kann nicht garantieren, dass diese Mod auf jedem (oder überhaupt einem) Server erlaubt ist. Diese Mod könnte eventuell Probleme mit Anti-Cheat Plugins hervorrufen. VERWENDUNG AUF EIGENE GEFAHR.
gui.enable_client_side.enable=Aktivieren
gui.viafabric_config.title=ViaFabric-Konfigurationen
gui.client_side.enable=Clientseitig aktivieren
gui.client_side.disable=Clientseitig deaktivieren
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=VIA Button ausblenden
gui.hide_via_button.disable=VIA Button anzeigen
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Protocol Version # Autogenerated ${en_us}
gui.enable_client_side_button=Enable ViaVersion
gui.enable_client_side.question=Are you sure you want to enable client-side mode?
gui.enable_client_side.warning=I cannot guarantee that this mod is allowed on every (or even any) server. This mod may cause problems with anti-cheat plugins. USE AT OWN RISK.
gui.enable_client_side.enable=Enable
gui.viafabric_config.title=ViaFabric Configurations
gui.client_side.enable=Enable client-side
gui.client_side.disable=Disable client-side
gui.ping_version.translated"=VIA: %s
gui.hide_via_button.enable=Hide VIA button
gui.hide_via_button.disable=Show VIA button
gui.via_button="VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Versión del protocolo # Autogenerated ${es_es}
gui.enable_client_side_button=Activar ViaVersion
gui.enable_client_side.question=¿Estás seguro de que quieres habilitar el modo de lado del cliente?
gui.enable_client_side.warning=No puedo garantizar que este mod esté permitido en todos (o incluso en cualquier) los servidores. Este mod puede causar problemas con los plugins anti-cheat. EL USO DE ESTE MOD ES BAJO SU PROPIO RIESGO.
gui.enable_client_side.enable=Activar
gui.viafabric_config.title=Configuraciones de ViaFabric
gui.client_side.enable=Activar el lado del cliente
gui.client_side.disable=Desactivar el lado del cliente
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Ocultar el botón VIA
gui.hide_via_button.disable=Mostrar el botón VIA
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Protokolli versioon # Autogenerated ${et_ee}
gui.enable_client_side_button=Luba ViaVersion
gui.enable_client_side.question=Kas soovid kindlasti lubada kliendipoolse režiimi?
gui.enable_client_side.warning=Ma ei saa garanteerida selle modi lubamist igas (mistahes) serveris. See mod võib põhjustada sohivastaste pluginatega probleeme. KASUTA OMAL VASTUTUSEL.
gui.enable_client_side.enable=Luba
gui.viafabric_config.title=ViaFabricu seadistused
gui.client_side.enable=Luba kliendipoolne
gui.client_side.disable=Keela kliendipoolne
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Peida VIA nupp
gui.hide_via_button.disable=Kuva VIA nuppu
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Version du protocole # Autogenerated ${fr_fr}
gui.enable_client_side_button=Activer ViaVersion
gui.enable_client_side.question=Êtes vous sûr de vouloir activer le mode coté client ?
gui.enable_client_side.warning=Je ne peux pas vous garantir que ce mod est autorisé dans tous (ou même aucun) serveur. Ce mod peut causer des problèmes avec les plugin anti-cheat. À UTILISEZ À VOS RISQUES ET PERILS.
gui.enable_client_side.enable=Activer
gui.viafabric_config.title=Configuration de ViaFabric
gui.client_side.enable=Activer coté client
gui.client_side.disable=Désactiver coté client
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Cacher le bouton VIA
gui.hide_via_button.disable=Montrer le bouton VIA
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Versione del protocollo # Autogenerated ${it_it}
gui.enable_client_side_button=Attivare ViaVersion
gui.enable_client_side.question=Siete sicuri di voler attivare la modalità lato cliente?
gui.enable_client_side.warning=Non posso garantire che questo mod sia consentito su ogni server (o anche solo su uno qualsiasi). Questo mod può causare problemi con i plugin anti-cheat. USO A PROPRIO RISCHIO E PERICOLO.
gui.enable_client_side.enable=Attivare
gui.viafabric_config.title=Configurazioni ViaFabric
gui.client_side.enable=Attivare lato cliente
gui.client_side.disable=Disattivare lato cliente
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Nascondi il pulsante VIA
gui.hide_via_button.disable=Mostra il pulsante VIA
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=プロトコルバージョン # Autogenerated ${ja_jp}
gui.enable_client_side_button=ViaVersionを有効にする
gui.enable_client_side.question=本当にクライアントサイドモードを有効にしますか?
gui.enable_client_side.warning=私はこのMODがすべての(あるいはどのサーバーでも)許可されていることを保証することはできません。このMODはアンチチートプラグインの問題を引き起こす可能性があります。自己責任で使用してください。
gui.enable_client_side.enable=有効化
gui.viafabric_config.title=ViaFabricの構成
gui.client_side.enable=クライアント側を有効にする
gui.client_side.disable=クライアント側を無効にする
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=VIAボタンを隠す
gui.hide_via_button.disable=VIAボタンを表示
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Protocolversie # Autogenerated ${nl_nl}
gui.enable_client_side_button=Schakel ViaVersion in
gui.enable_client_side.question=Weet u zeker dat u de client-side modus wilt inschakelen?
gui.enable_client_side.warning=Ik kan niet garanderen dat deze mod op elke (of zelfs maar één) server is toegestaan. Deze mod kan problemen veroorzaken met anti-cheat plugins. GEBRUIK OP EIGEN RISICO.
gui.enable_client_side.enable=Schakel in
gui.viafabric_config.title=ViaFabric-configuraties
gui.client_side.enable=Klantenservice inschakelen
gui.client_side.disable=Cliëntenservice uitschakelen
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=VIA-knop verbergen
gui.hide_via_button.disable=Toon VIA-knop
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Wersja protokołu # Autogenerated ${pl_pl}
gui.enable_client_side_button=Włącz ViaVersion
gui.enable_client_side.question=Jesteś pewien, że chcesz włączyć tryb client-side?
gui.enable_client_side.warning=Nie możemy zagwarantować, że ten mod jest dozwolony na każdym (lub jakimkolwiek) serwerze. Ten mod może powodować problemy z anty-cheatami. UŻYWASZ NA WŁASNE RYZYKO!.
gui.enable_client_side.enable=Włączyć
gui.viafabric_config.title=Konfiguracje ViaFabric
gui.client_side.enable=Włączenie po stronie klienta
gui.client_side.disable=Wyłączenie po stronie klienta
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Ukrycie przycisku VIA
gui.hide_via_button.disable=Pokaż przycisk VIA
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Versão do protocolo # Autogenerated ${pt_br}
gui.enable_client_side_button=Habilitar ViaVersion
gui.enable_client_side.question=Você tem certeza de que deseja habilitar o modo cliente?
gui.enable_client_side.warning=Não posso garantir que este mod seja permitido em todos os (ou mesmo em quaisquer) servidores. Esse poderá causar problemas com plugins anti-trapaça. USE POR SUA PRÓPRIA CONTA E RISCO.
gui.enable_client_side.enable=Habilitar
gui.viafabric_config.title=Configurações de ViaFabric
gui.client_side.enable=Habilitar modo cliente
gui.client_side.disable=Desativar modo cliente
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Esconder botão VIA
gui.hide_via_button.disable=Mostrar botão VIA
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Версия протокола # Autogenerated ${ru_ru}
gui.enable_client_side_button=Включить ViaVersion
gui.enable_client_side.question=Вы уверены, что хотите включить режим: На стороне клиента?
gui.enable_client_side.warning=Я не могу гарантировать, что этот мод разрешён любом (или хотя бы) сервере. Этот мод может вызывать проблемы с Античит плагинами. ИСПОЛЬЗУЙТЕ НА СВОЙ СТРАХ И РИСК.
gui.enable_client_side.enable=Включить
gui.viafabric_config.title=Конфигурация ViaFabric
gui.client_side.enable=Включить на стороне клиента
gui.client_side.disable=Отключить на стороне клиента
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=Скрыть кнопку VIA
gui.hide_via_button.disable=Показать кнопку VIA
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=Protokol Versiyonu # Autogenerated ${tr_tr}
gui.enable_client_side_button=ViaVersion'u aktive et
gui.enable_client_side.question=Alıcı-tarafı modunu aktive etmek istediğinize min misiniz?
gui.enable_client_side.warning=Bu modun her ( veya herhangi ) bir sunucuda izin verildiğine garanti veremem. Bu mod anti-cheat pluginleriyle sorunlara yol açabilir. KENDİ RİSKİNİZDE KULLANIN.
gui.enable_client_side.enable=Aktive et
gui.viafabric_config.title=ViaFabric Konfigürasyonu
gui.client_side.enable=Alıcı-tarafı aktive et
gui.client_side.disable=Alıcı-tarafı devre dışı bırak
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=VIA tuşunu gizle
gui.hide_via_button.disable=VIA tuşunu göster
gui.via_button=VIA

View File

@ -1,12 +1 @@
gui.protocol_version_field.name=协议版本 # Autogenerated ${zh_cn}
gui.enable_client_side_button=启用 ViaVersion
gui.enable_client_side.question=您确定要启用客户端模式?
gui.enable_client_side.warning=我无法保证所有(甚至任何一个)服务器允许您使用这个 mod。这个 mod 可能被反作弊插件作出误判。使用后果自负。
gui.enable_client_side.enable=启用
gui.viafabric_config.title=ViaFabric配置
gui.client_side.enable=启用客户端
gui.client_side.disable=禁用客户端
gui.ping_version.translated=VIA: %s
gui.hide_via_button.enable=隐藏VIA按钮
gui.hide_via_button.disable=显示VIA按钮
gui.via_button=VIA

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric", "id": "viafabric",
"name": "ViaFabric", "name": "ViaFabric",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric-mc114", "id": "viafabric-mc114",
"name": "ViaFabric for 1.14", "name": "ViaFabric for 1.14",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric-mc115", "id": "viafabric-mc115",
"name": "ViaFabric for 1.15", "name": "ViaFabric for 1.15",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric-mc116", "id": "viafabric-mc116",
"name": "ViaFabric for 1.16", "name": "ViaFabric for 1.16",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric-mc117", "id": "viafabric-mc117",
"name": "ViaFabric for 1.17", "name": "ViaFabric for 1.17",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric-mc118", "id": "viafabric-mc118",
"name": "ViaFabric for 1.18", "name": "ViaFabric for 1.18",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",

View File

@ -2,7 +2,9 @@ dependencies {
minecraft("com.mojang:minecraft:1.8.9") minecraft("com.mojang:minecraft:1.8.9")
mappings("net.fabricmc:yarn:1.8.9+build.202112162000:v2") mappings("net.fabricmc:yarn:1.8.9+build.202112162000:v2")
modImplementation("net.legacyfabric.legacy-fabric-api:rewoven-api:1.0.0+1.8.9") modImplementation("net.legacyfabric.legacy-fabric-api:legacy-fabric-api:1.2.2+1.8.9") {
exclude(module = "fabric-loader-1.8.9")
}
modImplementation("io.github.boogiemonster1o1:rewoven-modmenu:1.0.0+1.8.9") { modImplementation("io.github.boogiemonster1o1:rewoven-modmenu:1.0.0+1.8.9") {
isTransitive = false isTransitive = false
} }

View File

@ -14,11 +14,11 @@ import com.viaversion.viaversion.ViaManagerImpl;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.MappingDataLoader; import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import io.github.legacyrewoven.api.registry.CommandRegistry;
import io.netty.channel.EventLoop; import io.netty.channel.EventLoop;
import io.netty.channel.local.LocalEventLoopGroup; import io.netty.channel.local.LocalEventLoopGroup;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.legacyfabric.fabric.api.registry.CommandRegistry;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -72,7 +72,8 @@ public class ViaFabric implements ModInitializer {
private void registerCommandsV0() { private void registerCommandsV0() {
try { try {
CommandRegistry.INSTANCE.register(new NMSCommandImpl(Via.getManager().getCommandHandler())); // todo fix this, legacy fabric mapping is broken
//CommandRegistry.INSTANCE.register(new NMSCommandImpl(Via.getManager().getCommandHandler()));
} catch (NoClassDefFoundError ignored2) { } catch (NoClassDefFoundError ignored2) {
JLOGGER.info("Couldn't register command as Fabric Commands isn't installed"); JLOGGER.info("Couldn't register command as Fabric Commands isn't installed");
} }

View File

@ -5,10 +5,10 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.DataItem; import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider; import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import io.github.legacyrewoven.api.client.event.lifecycle.v1.ClientTickEvents;
import io.github.legacyrewoven.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.legacyfabric.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.legacyfabric.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;

View File

@ -2,8 +2,8 @@
"schemaVersion": 1, "schemaVersion": 1,
"id": "viafabric-mc18", "id": "viafabric-mc18",
"name": "ViaFabric for 1.8", "name": "ViaFabric for 1.8",
"version": "@version@", "version": "${version}",
"description": "@description@", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://viaversion.com/fabric", "homepage": "https://viaversion.com/fabric",