Use Rewoven api, use Tinfoil client-commands

fix #168 fix #167
This commit is contained in:
creeper123123321 2022-01-19 09:00:04 -03:00
parent af11cd38b9
commit e9bdee41e3
9 changed files with 87 additions and 72 deletions

122
README.md
View File

@ -1,4 +1,5 @@
# ViaFabric
[![ViaVersion Discord](https://img.shields.io/badge/chat-on%20discord-blue.svg)](https://viaversion.com/discord)
[![CurseForge Downloads](http://cf.way2muchnoise.eu/full_viafabric_downloads.svg)](https://viaversion.com/fabric)
[![CurseForge Versions](http://cf.way2muchnoise.eu/versions/viafabric.svg)](https://viaversion.com/fabric)
@ -10,121 +11,136 @@ Allows the connection to/from different Minecraft versions on your Minecraft cli
This mod can be installed on 1.8.9, 1.14.4, 1.15.2, 1.16.5 and 1.17.1 with Fabric Loader.
## Dependencies
| Dependency | Download |
| ---------------------------------------------- | ------------------------------------------------------------------- |
| (Bundled) ViaVersion | https://viaversion.com/ |
| (Optional) Cotton Client Commands (MC 1.14-15) | https://www.curseforge.com/minecraft/mc-mods/cotton-client-commands |
| Fabric API (MC 1.14+) | https://www.curseforge.com/minecraft/mc-mods/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 registry synchronization (fabric-registry-sync mod).
| Dependency | Download |
|-----------------------------------------------|----------------------------------------------------------------|
| (Bundled) ViaVersion | https://viaversion.com/ |
| (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 |
| Legacy Rewoven API (MC 1.8.9) | https://maven.rewovenmc.tk/net/legacyfabric/legacy-fabric-api/ |
Note: ViaVersion is designed for Vanilla Minecraft servers. It probably will not work with modded registry entries or
registry synchronization (fabric-registry-sync mod).
## ViaVersion
### How can I install ViaBackwards/ViaRewind?:
- Just drop them into mods folder. Make sure you are using versions compatible with the ViaVersion version you are using.
- Just drop them into mods folder. Make sure you are using versions compatible with the ViaVersion version you are
using.
- CurseForge links:
[ViaBackwards](https://www.curseforge.com/minecraft/mc-mods/viabackwards)
[ViaRewind](https://www.curseforge.com/minecraft/mc-mods/viarewind)
### What versions can ViaVersion, ViaBackwards and ViaRewind translate?:
- **With [ViaVersion](https://viaversion.com)**:
Your server can accept newer versions.
Your client can connect to older versions.
- **Adding [ViaBackwards](https://viaversion.com/backwards) (and optionally [ViaRewind](https://viaversion.com/rewind))**:
Your server can accept older versions.
Your client can connect to newer versions.
- **With [ViaVersion](https://viaversion.com)**:
Your server can accept newer versions. Your client can connect to older versions.
- **Adding [ViaBackwards](https://viaversion.com/backwards) (and
optionally [ViaRewind](https://viaversion.com/rewind))**:
Your server can accept older versions. Your client can connect to newer versions.
- Server-side: See https://viaversion.com/
- Client-side:
| | 1.8.x | 1.9.x | 1.10-1.14.4 | 1.15.x | 1.16.x | 1.17.x | 1.18.x |
| ------ | ----- | ----- | ----------- | ------ | ------ | ------ | ------ |
| 1.8.9 client | ✓ | ⏪ | ⟲ | ⟲ | ⟲ | ⟲ | ⟲ |
| 1.14.x client | ✓ | ✓ | ✓ | ⟲ | ⟲ | ⟲ | ⟲ |
| 1.15.x client | ✓ | ✓ | ✓ | ✓ | ⟲ | ⟲ | ⟲ |
| 1.16.x client | ✓ | ✓ | ✓ | ✓ | ✓ | ⟲ | ⟲ |
| 1.17.x client | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ⟲ |
| 1.18.x client | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
✓ = [ViaVersion](https://viaversion.com) ⟲ = [ViaBackwards](https://viaversion.com/backwards) ⏪ = [ViaRewind](https://viaversion.com/rewind)
| | 1.8.x | 1.9.x | 1.10-1.14.4 | 1.15.x | 1.16.x | 1.17.x | 1.18.x |
|---------------|-------|-------|-------------|--------|--------|--------|--------|
| 1.8.9 client | ✓ | ⏪ | ⟲ | ⟲ | ⟲ | ⟲ | ⟲ |
| 1.14.x client | ✓ | ✓ | ✓ | ⟲ | ⟲ | ⟲ | ⟲ |
| 1.15.x client | ✓ | ✓ | ✓ | ✓ | ⟲ | ⟲ | ⟲ |
| 1.16.x client | ✓ | ✓ | ✓ | ✓ | ✓ | ⟲ | ⟲ |
| 1.17.x client | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ⟲ |
| 1.18.x client | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
✓ = [ViaVersion](https://viaversion.com) ⟲ = [ViaBackwards](https://viaversion.com/backwards) ⏪
= [ViaRewind](https://viaversion.com/rewind)
### Can ViaVersion, ViaBackwards and ViaRewind support snapshots?:
- Check https://ci.viaversion.com/ for development builds with snapshot support
## Alternatives
### Client-side:
- [ClientViaVersion](https://github.com/Gerrygames/ClientViaVersion): Discontinued 5zig plugin.
- [multiconnect](https://www.curseforge.com/minecraft/mc-mods/multiconnect): Fabric mod for connecting to older versions: down to 1.11 (stable) and 1.8 (experimental).
- [multiconnect](https://www.curseforge.com/minecraft/mc-mods/multiconnect): Fabric mod for connecting to older
versions: down to 1.11 (stable) and 1.8 (experimental).
- [ViaForge](https://www.curseforge.com/minecraft/mc-mods/viaforge): Fork of ViaFabric porting it to Forge.
### Server-side
### Server-side
- [ProtocolSupport](https://protocol.support/): Bukkit plugin for older client versions (down to 1.4.7).
- [ViaVersion](https://viaversion.com): Plugin for BungeeCord, CraftBukkit, SpongeCommon and Velocity servers.
### Standalone proxy:
- [DirtMultiversion](https://github.com/DirtPowered/DirtMultiversion): Proxy allowing to connect down to Beta 1.3
with newer Minecraft client versions.
- [DirtMultiversion](https://github.com/DirtPowered/DirtMultiversion): Proxy allowing to connect down to Beta 1.3 with
newer Minecraft client versions.
- [VIAaaS](https://github.com/ViaVersion/VIAaaS): Standalone ViaVersion proxy with ViaBackwards and ViaRewind, allowing
you to connect without a mod installed on your client. Supports online mode.
### Cool things to try:
- [Geyser](https://geysermc.org/): Plugins, Fabric mod and a standalone proxy for allowing Bedrock Edition on Java Edition servers.
- [Geyser](https://geysermc.org/): Plugins, Fabric mod and a standalone proxy for allowing Bedrock Edition on Java
Edition servers.
- [PolyMc](https://github.com/TheEpicBlock/PolyMc): Fabric mods which translates modded items and blocks, allowing
vanilla to connect using resource packs.
## Commands
### Commands:
- There're 3 server-side alias ``/viaversion``, ``/vvfabric`` and ``/viaver``, and a client-side command
``/viafabricclient`` for Minecraft 1.14+ (OP permission level 3 is required for these commands, received
by [Entity Status Packet](https://wiki.vg/Entity_statuses#Player))
## Configs
### Configuration:
- ViaVersion configuration is available at ``.minecraft/config/viafabric/viaversion.yml``
- ViaFabric configuration is at ``.minecraft/config/viafabric/viafabric.yml``
### How can I disable client-side ViaFabric?:
- You can disable it in the menu or by setting global protocol version to -1 (this will keep per-server translations still enabled)
- You can disable it in the menu or by setting global protocol version to -1 (this will keep per-server translations
still enabled)
### How to use protocol detection?:
- For using globally, set the protocol to AUTO or -2. For using in a specific server: ``ddns.example.com._v-2.viafabric``
- The protocol detector will try to ping with the client native protocol version, differently than multiconnect which uses -1 version,
which may detect the native server version.
- For using globally, set the protocol to AUTO or -2. For using in a specific
server: ``ddns.example.com._v-2.viafabric``
- The protocol detector will try to ping with the client native protocol version, differently than multiconnect which
uses -1 version, which may detect the native server version.
### How can I set the version for specific servers?:
- Append ._v(VERSION).viafabric.
- Examples: ``minigame.example.com._v1_8.viafabric``, ``native.example.com._v-1.viafabric``, ``auto.example.com._v-2.viafabric``
- Append ._v(VERSION).viafabric.
- Examples: ``minigame.example.com._v1_8.viafabric``, ``native.example.com._v-1.viafabric``
, ``auto.example.com._v-2.viafabric``
## multiconnect
### Does it work with multiconnect at same time on client?:**
- Yes, ViaFabric can be used with multiconnect. ViaFabric will send to its version auto detector the closest
non-beta supported version. (multiconnect beta-supported versions are currently < 1.11))
- Yes, ViaFabric can be used with multiconnect. ViaFabric will send to its version auto detector the closest non-beta
supported version. (multiconnect beta-supported versions are currently < 1.11))
### Differences with multiconnect:
| | ViaVersion | multiconnect |
| --- | --- | --- |
| Designed for | servers | clients |
| Can be installed on | multiple client/server versions | latest client version |
| Objectives | simply implement ViaVersion | version support with fixes to version changes |
| How does it work? | modifying packets at network code | modifying client code more deeply |
| Triggering anti-cheats | very likely | less likely |
| | ViaVersion | multiconnect |
|------------------------|-----------------------------------|-----------------------------------------------|
| Designed for | servers | clients |
| Can be installed on | multiple client/server versions | latest client version |
| Objectives | simply implement ViaVersion | version support with fixes to version changes |
| How does it work? | modifying packets at network code | modifying client code more deeply |
| Triggering anti-cheats | very likely | less likely |
## 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**
**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**

View File

@ -51,8 +51,9 @@ allprojects {
maven { url = "https://repo.viaversion.com/" }
maven { url = "https://maven.fabricmc.net/" }
maven { url = "https://maven.legacyfabric.net/" }
maven { url = "https://server.bbkr.space/artifactory/libs-release" }
maven { url = "https://maven.rewovenmc.tk/" }
maven { url = "https://maven.terraformersmc.com/releases/" }
maven { url = "https://jitpack.io/"}
}
dependencies {
@ -164,6 +165,7 @@ dependencies {
include("com.viaversion:viaversion:$vvVer")
include("org.yaml:snakeyaml:$yamlVer")
include("com.github.TinfoilMC:ClientCommands:1.1.0")
subprojects.each {
include project("${it.name}:")
@ -187,8 +189,8 @@ curseforge {
displayName = "[${getBranch()}] ViaFabric " + rootProject.version
relations {
optionalDependency("fabric-api")
optionalDependency("legacy-fabric-api")
optionalDependency("cotton-client-commands")
//optionalDependency("legacy-fabric-api")
bundledDependency("cotton-client-commands")
}
}

View File

@ -4,5 +4,5 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:0.28.5+1.14")
modImplementation("io.github.prospector:modmenu:1.7.16.1.14.4+build.128")
modImplementation("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2")
modImplementation("com.github.TinfoilMC:ClientCommands:1.1.0")
}

View File

@ -4,5 +4,5 @@ dependencies {
modImplementation("net.fabricmc.fabric-api:fabric-api:0.28.5+1.15")
modImplementation("io.github.prospector:modmenu:1.10.2+build.32")
modImplementation("io.github.cottonmc:cotton-client-commands:1.0.0+1.15.2")
modImplementation("com.github.TinfoilMC:ClientCommands:1.1.0")
}

View File

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

View File

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

View File

@ -12,8 +12,7 @@ public class ModMenuConfig implements ModMenuApi {
}
@Override
// todo fix this
public Function/*<Screen, ? extends Screen>*/ getConfigScreenFactory() {
return it -> new ViaConfigScreen(((Screen) it));
public Function<Screen, ? extends Screen> getConfigScreenFactory() {
return ViaConfigScreen::new;
}
}

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.Item;
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.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.network.ClientPlayerEntity;
import net.minecraft.item.ItemStack;

View File

@ -36,7 +36,7 @@
]
},
"depends": {
"legacy-fabric-resource-loader-v1": "*",
"legacy-rewoven-resource-loader-v1": "*",
"minecraft": "1.8.x",
"viafabric": "*"
},