Code cleanup (#246)

* use CommonTransformer fields in Decoder

* Renamed classes and removed unused code
This commit is contained in:
EnZaXD 2023-05-28 15:40:02 +02:00 committed by GitHub
parent 35287e4c29
commit 01aa8fd17e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 117 additions and 124 deletions

View File

@ -49,15 +49,15 @@ public class FabricDecodeHandler extends MessageToMessageDecoder<ByteBuf> {
int decoderIndex = ctx.pipeline().names().indexOf("decompress");
if (decoderIndex == -1) return;
if (decoderIndex > ctx.pipeline().names().indexOf("via-decoder")) {
ChannelHandler encoder = ctx.pipeline().get("via-encoder");
ChannelHandler decoder = ctx.pipeline().get("via-decoder");
if (decoderIndex > ctx.pipeline().names().indexOf(CommonTransformer.HANDLER_DECODER_NAME)) {
ChannelHandler encoder = ctx.pipeline().get(CommonTransformer.HANDLER_ENCODER_NAME);
ChannelHandler decoder = ctx.pipeline().get(CommonTransformer.HANDLER_DECODER_NAME);
ctx.pipeline().remove(encoder);
ctx.pipeline().remove(decoder);
ctx.pipeline().addAfter("compress", "via-encoder", encoder);
ctx.pipeline().addAfter("decompress", "via-decoder", decoder);
ctx.pipeline().addAfter("compress", CommonTransformer.HANDLER_ENCODER_NAME, encoder);
ctx.pipeline().addAfter("decompress", CommonTransformer.HANDLER_DECODER_NAME, decoder);
}
}

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc114.commands.VRCommandHandler;
import com.viaversion.fabric.mc114.commands.VFCommandHandler;
import com.viaversion.fabric.mc114.platform.FabricPlatform;
import com.viaversion.fabric.mc114.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -48,10 +48,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -61,7 +61,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,8 +1,8 @@
package com.viaversion.fabric.mc114.platform;
import com.viaversion.fabric.mc114.providers.VRHandItemProvider;
import com.viaversion.fabric.mc114.providers.VFHandItemProvider;
import com.viaversion.fabric.mc114.providers.FabricVersionProvider;
import com.viaversion.fabric.mc114.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc114.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
@ -20,15 +20,14 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ 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;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -8,7 +8,7 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc115.commands.VRCommandHandler;
import com.viaversion.fabric.mc115.commands.VFCommandHandler;
import com.viaversion.fabric.mc115.platform.FabricPlatform;
import com.viaversion.fabric.mc115.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -48,10 +48,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -61,7 +61,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,8 +1,8 @@
package com.viaversion.fabric.mc115.platform;
import com.viaversion.fabric.mc115.providers.VRHandItemProvider;
import com.viaversion.fabric.mc115.providers.VFHandItemProvider;
import com.viaversion.fabric.mc115.providers.FabricVersionProvider;
import com.viaversion.fabric.mc115.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc115.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
@ -20,15 +20,14 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -8,7 +8,7 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc116.commands.VRCommandHandler;
import com.viaversion.fabric.mc116.commands.VFCommandHandler;
import com.viaversion.fabric.mc116.platform.FabricPlatform;
import com.viaversion.fabric.mc116.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -50,10 +50,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -63,7 +63,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,9 +1,9 @@
package com.viaversion.fabric.mc116.platform;
import com.viaversion.fabric.mc116.providers.VRHandItemProvider;
import com.viaversion.fabric.mc116.providers.VFHandItemProvider;
import com.viaversion.fabric.mc116.providers.FabricVersionProvider;
import com.viaversion.fabric.mc116.providers.VRPlayerAbilitiesProvider;
import com.viaversion.fabric.mc116.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc116.providers.VFPlayerAbilitiesProvider;
import com.viaversion.fabric.mc116.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.fabricmc.api.EnvType;
@ -22,16 +22,15 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VRPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VFPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -4,7 +4,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.minecraft.client.MinecraftClient;
public class VRPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
public class VFPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
@Override
public float getFlyingSpeed(UserConnection connection) {

View File

@ -8,7 +8,7 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc117.commands.VRCommandHandler;
import com.viaversion.fabric.mc117.commands.VFCommandHandler;
import com.viaversion.fabric.mc117.platform.FabricPlatform;
import com.viaversion.fabric.mc117.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -50,10 +50,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -63,7 +63,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,9 +1,9 @@
package com.viaversion.fabric.mc117.platform;
import com.viaversion.fabric.mc117.providers.VRHandItemProvider;
import com.viaversion.fabric.mc117.providers.VFHandItemProvider;
import com.viaversion.fabric.mc117.providers.FabricVersionProvider;
import com.viaversion.fabric.mc117.providers.VRPlayerAbilitiesProvider;
import com.viaversion.fabric.mc117.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc117.providers.VFPlayerAbilitiesProvider;
import com.viaversion.fabric.mc117.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.fabricmc.api.EnvType;
@ -22,16 +22,15 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VRPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VFPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -4,7 +4,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.minecraft.client.MinecraftClient;
public class VRPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
public class VFPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
@Override
public float getFlyingSpeed(UserConnection connection) {

View File

@ -8,7 +8,7 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc118.commands.VRCommandHandler;
import com.viaversion.fabric.mc118.commands.VFCommandHandler;
import com.viaversion.fabric.mc118.platform.FabricPlatform;
import com.viaversion.fabric.mc118.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -50,10 +50,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -63,7 +63,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,9 +1,9 @@
package com.viaversion.fabric.mc118.platform;
import com.viaversion.fabric.mc118.providers.VRHandItemProvider;
import com.viaversion.fabric.mc118.providers.VFHandItemProvider;
import com.viaversion.fabric.mc118.providers.FabricVersionProvider;
import com.viaversion.fabric.mc118.providers.VRPlayerAbilitiesProvider;
import com.viaversion.fabric.mc118.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc118.providers.VFPlayerAbilitiesProvider;
import com.viaversion.fabric.mc118.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.fabricmc.api.EnvType;
@ -22,16 +22,15 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VRPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VFPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -4,7 +4,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.minecraft.client.MinecraftClient;
public class VRPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
public class VFPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
@Override
public float getFlyingSpeed(UserConnection connection) {

View File

@ -8,7 +8,7 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc119.commands.VRCommandHandler;
import com.viaversion.fabric.mc119.commands.VFCommandHandler;
import com.viaversion.fabric.mc119.platform.FabricPlatform;
import com.viaversion.fabric.mc119.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -50,10 +50,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -63,7 +63,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,9 +1,9 @@
package com.viaversion.fabric.mc119.platform;
import com.viaversion.fabric.mc119.providers.VRHandItemProvider;
import com.viaversion.fabric.mc119.providers.VFHandItemProvider;
import com.viaversion.fabric.mc119.providers.FabricVersionProvider;
import com.viaversion.fabric.mc119.providers.VRPlayerAbilitiesProvider;
import com.viaversion.fabric.mc119.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc119.providers.VFPlayerAbilitiesProvider;
import com.viaversion.fabric.mc119.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.fabricmc.api.EnvType;
@ -22,16 +22,15 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VRPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VFPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -4,7 +4,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.minecraft.client.MinecraftClient;
public class VRPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
public class VFPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
@Override
public float getFlyingSpeed(UserConnection connection) {

View File

@ -7,7 +7,7 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -9,7 +9,7 @@ import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc120.commands.VRCommandHandler;
import com.viaversion.fabric.mc120.commands.VFCommandHandler;
import com.viaversion.fabric.mc120.platform.FabricPlatform;
import com.viaversion.fabric.mc120.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -50,10 +50,10 @@ public class ViaFabric implements ModInitializer {
.then(
RequiredArgumentBuilder
.<S, String>argument("args", StringArgumentType.greedyString())
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VRCommandHandler) Via.getManager().getCommandHandler())::suggestion)
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute)
.suggests(((VFCommandHandler) Via.getManager().getCommandHandler())::suggestion)
)
.executes(((VRCommandHandler) Via.getManager().getCommandHandler())::execute);
.executes(((VFCommandHandler) Via.getManager().getCommandHandler())::execute);
}
@Override
@ -63,7 +63,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -10,7 +10,7 @@ import com.viaversion.viaversion.commands.ViaCommandHandler;
import java.util.concurrent.CompletableFuture;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,9 +1,9 @@
package com.viaversion.fabric.mc120.platform;
import com.viaversion.fabric.mc120.providers.VRHandItemProvider;
import com.viaversion.fabric.mc120.providers.VFHandItemProvider;
import com.viaversion.fabric.mc120.providers.FabricVersionProvider;
import com.viaversion.fabric.mc120.providers.VRPlayerAbilitiesProvider;
import com.viaversion.fabric.mc120.providers.VRPlayerLookTargetProvider;
import com.viaversion.fabric.mc120.providers.VFPlayerAbilitiesProvider;
import com.viaversion.fabric.mc120.providers.VFPlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.providers.PlayerLookTargetProvider;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.fabricmc.api.EnvType;
@ -22,16 +22,15 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}
Via.getManager().getProviders().use(HandItemProvider.class, handProvider);
}
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VRPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VRPlayerLookTargetProvider());
}
Via.getManager().getProviders().use(PlayerAbilitiesProvider.class, new VFPlayerAbilitiesProvider());
Via.getManager().getProviders().use(PlayerLookTargetProvider.class, new VFPlayerLookTargetProvider());
}
@Override

View File

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public Item clientItem = null;
@Override

View File

@ -4,7 +4,7 @@ import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.provider.PlayerAbilitiesProvider;
import net.minecraft.client.MinecraftClient;
public class VRPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
public class VFPlayerAbilitiesProvider extends PlayerAbilitiesProvider {
@Override
public float getFlyingSpeed(UserConnection connection) {

View File

@ -7,7 +7,7 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
public class VRPlayerLookTargetProvider extends PlayerLookTargetProvider {
public class VFPlayerLookTargetProvider extends PlayerLookTargetProvider {
@Override
public Position getPlayerLookTarget(UserConnection info) {

View File

@ -7,7 +7,7 @@ import com.viaversion.fabric.common.platform.FabricInjector;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
import com.viaversion.fabric.mc18.commands.NMSCommandImpl;
import com.viaversion.fabric.mc18.commands.VRCommandHandler;
import com.viaversion.fabric.mc18.commands.VFCommandHandler;
import com.viaversion.fabric.mc18.platform.FabricPlatform;
import com.viaversion.fabric.mc18.platform.VFLoader;
import com.viaversion.viaversion.ViaManagerImpl;
@ -47,7 +47,7 @@ public class ViaFabric implements ModInitializer {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.commandHandler(new VFCommandHandler())
.platform(platform).build());
platform.init();

View File

@ -3,7 +3,7 @@ package com.viaversion.fabric.mc18.commands;
import com.viaversion.fabric.common.commands.subs.LeakDetectSubCommand;
import com.viaversion.viaversion.commands.ViaCommandHandler;
public class VRCommandHandler extends ViaCommandHandler {
public class VFCommandHandler extends ViaCommandHandler {
{
try {
registerSubCommand(new LeakDetectSubCommand());

View File

@ -1,6 +1,6 @@
package com.viaversion.fabric.mc18.platform;
import com.viaversion.fabric.mc18.providers.VRHandItemProvider;
import com.viaversion.fabric.mc18.providers.VFHandItemProvider;
import com.viaversion.fabric.mc18.providers.FabricVersionProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
@ -18,7 +18,7 @@ public class VFLoader implements ViaPlatformLoader {
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();
VFHandItemProvider handProvider = new VFHandItemProvider();
if (FabricLoader.getInstance().getEnvironmentType() == EnvType.CLIENT) {
handProvider.registerClientTick();
}

View File

@ -18,7 +18,7 @@ import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public class VRHandItemProvider extends HandItemProvider {
public class VFHandItemProvider extends HandItemProvider {
public final Map<UUID, Item> serverPlayers = new ConcurrentHashMap<>();
public Item clientItem = null;