0.2.8, make fabric commands optional

This commit is contained in:
creeper123123321 2020-08-14 12:57:21 -03:00
parent b029905968
commit 8f9d637d62
4 changed files with 45 additions and 12 deletions

View File

@ -10,7 +10,7 @@
Allows the connection to/from different Minecraft versions on your Minecraft client/server (LAN worlds too)
This mod supports 1.8.9 (in `mc-1.8` branch), 1.14.4/1.15.2 (in `mc-1.14-1.15` branch) and 1.16.x/snapshots (in `mc-1.16` branch) with Fabric Loader. Check the Minecraft version in file name when downloading from CurseForge/GitHub Releases.
This mod supports 1.8.9 (in `mc-1.8` branch), 1.14.x/1.15.x (in `mc-1.14-1.15` branch) and 1.16.x/snapshots (in `mc-1.16` branch) with Fabric Loader. Check the Minecraft version in file name when downloading from CurseForge/GitHub Releases.
Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not work with modded registry entries or registry synchronization (fabric-registry-sync mod).
@ -21,9 +21,8 @@ Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not
| ----------------------------------------- | ------------------------------------------------------------------------------------------ |
| (Bundled 3.1.0 release) ViaVersion 3.0.2+ | https://ci.viaversion.com/job/ViaVersion/ or https://ci.viaversion.com/job/ViaVersion-DEV/ |
| (Bundled) Cotton Client Commands | https://www.curseforge.com/minecraft/mc-mods/cotton-client-commands |
| Fabric Command API v1 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
| (Optional) Fabric Command API v1/v0 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
| Fabric Resource Loader v0 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
| Fabric Textures v0 | https://www.curseforge.com/minecraft/mc-mods/fabric-api |
| (Bundled) ProgrammerArtInjector | https://www.curseforge.com/minecraft/mc-mods/programmerartinjector |
**1.8.9 Dependencies:**
@ -31,7 +30,7 @@ Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not
| Dependency | Download |
| ----------------------------------------- | ------------------------------------------------------------------------------------------ |
| (Bundled 3.1.0 release) ViaVersion 3.0.2+ | https://ci.viaversion.com/job/ViaVersion/ or https://ci.viaversion.com/job/ViaVersion-DEV/ |
| Fabric Commands v0 | https://www.curseforge.com/minecraft/mc-mods/legacy-fabric-api |
| (Optional) Fabric Commands v0 | https://www.curseforge.com/minecraft/mc-mods/legacy-fabric-api |
| Fabric Resource Loader v0 | https://www.curseforge.com/minecraft/mc-mods/legacy-fabric-api |
@ -58,8 +57,8 @@ Adding [ViaBackwards](https://viaversion.com/backwards) (and optionally [ViaRewi
| Your Client | 1.8.x | 1.9.x | 1.10-1.14.4 | 1.15.x | 1.16.x |
| ----------- | ----- | ----- | ----------- | ------ | ------ |
| 1.8.9 | ✓ | ⏪ | ⟲ | ⟲ | ⟲ |
| 1.14.4 | ✓ | ✓ | ✓ | ⟲ | ⟲ |
| 1.15.2 | ✓ | ✓ | ✓ | ✓ | ⟲ |
| 1.14.x | ✓ | ✓ | ✓ | ⟲ | ⟲ |
| 1.15.x | ✓ | ✓ | ✓ | ✓ | ⟲ |
| 1.16.2 | ✓ | ✓ | ✓ | ✓ | ✓ |
✓ = [ViaVersion](https://viaversion.com) ⟲ = [ViaBackwards](https://viaversion.com/backwards) ⏪ = [ViaRewind](https://viaversion.com/rewind)

View File

@ -19,7 +19,7 @@ val branch = if (!travisBranch.isNullOrBlank()) travisBranch else try {
"unknown"
}
version = "0.2.7-SNAPSHOT+" + try {
version = "0.2.8-SNAPSHOT+" + try {
gitVersion() + "-" + branch
} catch (e: Exception) {
"unknown"
@ -89,14 +89,28 @@ curseforge {
id = "391298"
changelog = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits"
releaseType = "alpha"
addGameVersion("Java 8")
if (branch != "mc-1.8") {
addGameVersion("Java 9")
addGameVersion("Java 10")
}
when (branch) {
"mc-1.8" -> addGameVersion("1.8.9")
"mc-1.14-1.15" -> {
addGameVersion("1.14")
addGameVersion("1.14.1")
addGameVersion("1.14.2")
addGameVersion("1.14.3")
addGameVersion("1.14.4")
addGameVersion("1.15")
addGameVersion("1.15.1")
addGameVersion("1.15.2")
}
"mc-1.16" -> {
addGameVersion("1.16-SNAPSHOT")
addGameVersion("1.16")
addGameVersion("1.16.1")
addGameVersion("1.16.2")
}
}
addGameVersion("Fabric")

View File

@ -39,6 +39,7 @@ import io.netty.channel.DefaultEventLoop;
import io.netty.channel.EventLoop;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.registry.CommandRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.server.command.CommandSource;
import org.apache.logging.log4j.LogManager;
@ -93,11 +94,31 @@ public class ViaFabric implements ModInitializer {
FabricLoader.getInstance().getEntrypoints("viafabric:via_api_initialized", Runnable.class).forEach(Runnable::run);
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaversion")));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaver")));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("vvfabric")));
try {
registerCommandsV1();
} catch (NoClassDefFoundError ignored) {
try {
registerCommandsV0();
JLOGGER.info("Using Fabric Commands V0");
} catch (NoClassDefFoundError ignored2) {
JLOGGER.info("Couldn't register command as Fabric Commands isn't installed");
}
}
config = new VRConfig(FabricLoader.getInstance().getConfigDirectory().toPath().resolve("ViaFabric")
.resolve("viafabric.yml").toFile());
}
private void registerCommandsV1() {
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaversion")));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaver")));
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("vvfabric")));
}
@SuppressWarnings("deprecation")
private void registerCommandsV0() {
CommandRegistry.INSTANCE.register(false, dispatcher -> dispatcher.register(command("viaversion")));
CommandRegistry.INSTANCE.register(false, dispatcher -> dispatcher.register(command("viaver")));
CommandRegistry.INSTANCE.register(false, dispatcher -> dispatcher.register(command("vvfabric")));
}
}

View File

@ -68,9 +68,7 @@
"depends": {
"cotton-client-commands": "*",
"fabricloader": ">=0.4.0",
"fabric-textures-v0": "*",
"fabric-resource-loader-v0": "*",
"fabric-command-api-v1": "*",
"minecraft": ">1.15.2",
"programmerartinjector": "*",
"viaversion": ">3.0.1"
@ -79,6 +77,7 @@
"fabric-registry-sync-v0": "*"
},
"recommends": {
"fabric-command-api-v1": "*"
},
"icon": "assets/viafabric/textures/logo.png",
"mixins": [