provide modmenu config for viafabric id

This commit is contained in:
creeper123123321 2021-05-31 18:11:13 -03:00
parent 9b21962c30
commit 36097d42da
19 changed files with 64 additions and 40 deletions

View File

@ -26,7 +26,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;
import java.util.stream.IntStream;
public abstract class VFVersionProvider extends BaseVersionProvider {
public abstract class AbstractFabricVersionProvider extends BaseVersionProvider {
private int[] multiconnectSupportedVersions = null;
{

View File

@ -3,7 +3,7 @@ package com.viaversion.fabric.mc114;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.mc114.commands.VRCommandHandler;
import com.viaversion.fabric.mc114.platform.FabricInjector;
import com.viaversion.fabric.mc114.platform.VRLoader;
import com.viaversion.fabric.mc114.platform.VFLoader;
import com.viaversion.fabric.mc114.platform.FabricPlatform;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
@ -65,7 +65,7 @@ public class ViaFabric implements ModInitializer {
public void onInitialize() {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VRLoader())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.platform(new FabricPlatform()).build());

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc114.platform;
import com.viaversion.fabric.mc114.providers.VRHandItemProvider;
import com.viaversion.fabric.mc114.providers.VRVersionProvider;
import com.viaversion.fabric.mc114.providers.FabricVersionProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import com.viaversion.viaversion.api.Via;
@ -11,11 +11,11 @@ import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
public class VRLoader implements ViaPlatformLoader {
public class VFLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
Via.getManager().getProviders().use(VersionProvider.class, new VRVersionProvider());
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc114.providers;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.provider.VFVersionProvider;
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
import com.viaversion.fabric.mc114.ViaFabric;
import com.viaversion.fabric.mc114.service.ProtocolAutoDetector;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -10,7 +10,7 @@ import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;
public class VRVersionProvider extends VFVersionProvider {
public class FabricVersionProvider extends AbstractFabricVersionProvider {
@Override
protected Logger getLogger() {
return ViaFabric.JLOGGER;

View File

@ -10,7 +10,7 @@ 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.platform.FabricInjector;
import com.viaversion.fabric.mc115.platform.VRLoader;
import com.viaversion.fabric.mc115.platform.VFLoader;
import com.viaversion.fabric.mc115.platform.FabricPlatform;
import com.viaversion.viaversion.ViaManagerImpl;
import com.viaversion.viaversion.api.Via;
@ -65,7 +65,7 @@ public class ViaFabric implements ModInitializer {
public void onInitialize() {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VRLoader())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.platform(new FabricPlatform()).build());

View File

@ -1,8 +1,11 @@
package com.viaversion.fabric.mc115.gui;
import com.google.common.collect.ImmutableMap;
import io.github.prospector.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi;
import java.util.Map;
public class ModMenuConfig implements ModMenuApi {
@Override
public String getModId() {
@ -13,4 +16,9 @@ public class ModMenuConfig implements ModMenuApi {
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return ViaConfigScreen::new;
}
@Override
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
return ImmutableMap.of("viafabric", getModConfigScreenFactory());
}
}

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc115.platform;
import com.viaversion.fabric.mc115.providers.VRHandItemProvider;
import com.viaversion.fabric.mc115.providers.VRVersionProvider;
import com.viaversion.fabric.mc115.providers.FabricVersionProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import com.viaversion.viaversion.api.Via;
@ -11,11 +11,11 @@ import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
public class VRLoader implements ViaPlatformLoader {
public class VFLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
Via.getManager().getProviders().use(VersionProvider.class, new VRVersionProvider());
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc115.providers;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.provider.VFVersionProvider;
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
import com.viaversion.fabric.mc115.ViaFabric;
import com.viaversion.fabric.mc115.service.ProtocolAutoDetector;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -12,7 +12,7 @@ import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;
public class VRVersionProvider extends VFVersionProvider {
public class FabricVersionProvider extends AbstractFabricVersionProvider {
@Override
protected Logger getLogger() {

View File

@ -3,7 +3,7 @@ package com.viaversion.fabric.mc116;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.mc116.commands.VRCommandHandler;
import com.viaversion.fabric.mc116.platform.FabricInjector;
import com.viaversion.fabric.mc116.platform.VRLoader;
import com.viaversion.fabric.mc116.platform.VFLoader;
import com.viaversion.fabric.mc116.platform.FabricPlatform;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
@ -66,7 +66,7 @@ public class ViaFabric implements ModInitializer {
public void onInitialize() {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VRLoader())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.platform(new FabricPlatform()).build());

View File

@ -1,11 +1,19 @@
package com.viaversion.fabric.mc116.gui;
import io.github.prospector.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi;
import com.google.common.collect.ImmutableMap;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import java.util.Map;
public class ModMenuConfig implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return ViaConfigScreen::new;
}
@Override
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
return ImmutableMap.of("viafabric", getModConfigScreenFactory());
}
}

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc116.platform;
import com.viaversion.fabric.mc116.providers.VRHandItemProvider;
import com.viaversion.fabric.mc116.providers.VRVersionProvider;
import com.viaversion.fabric.mc116.providers.FabricVersionProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import com.viaversion.viaversion.api.Via;
@ -11,11 +11,11 @@ import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
public class VRLoader implements ViaPlatformLoader {
public class VFLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
Via.getManager().getProviders().use(VersionProvider.class, new VRVersionProvider());
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc116.providers;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.provider.VFVersionProvider;
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
import com.viaversion.fabric.mc116.ViaFabric;
import com.viaversion.fabric.mc116.service.ProtocolAutoDetector;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -12,7 +12,7 @@ import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;
public class VRVersionProvider extends VFVersionProvider {
public class FabricVersionProvider extends AbstractFabricVersionProvider {
@Override
protected Logger getLogger() {

View File

@ -3,7 +3,7 @@ package com.viaversion.fabric.mc117;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.mc117.commands.VRCommandHandler;
import com.viaversion.fabric.mc117.platform.FabricInjector;
import com.viaversion.fabric.mc117.platform.VRLoader;
import com.viaversion.fabric.mc117.platform.VFLoader;
import com.viaversion.fabric.mc117.platform.FabricPlatform;
import com.viaversion.fabric.common.protocol.HostnameParserProtocol;
import com.viaversion.fabric.common.util.JLoggerToLog4j;
@ -66,7 +66,7 @@ public class ViaFabric implements ModInitializer {
public void onInitialize() {
Via.init(ViaManagerImpl.builder()
.injector(new FabricInjector())
.loader(new VRLoader())
.loader(new VFLoader())
.commandHandler(new VRCommandHandler())
.platform(new FabricPlatform()).build());

View File

@ -1,11 +1,19 @@
package com.viaversion.fabric.mc117.gui;
import io.github.prospector.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi;
import com.google.common.collect.ImmutableMap;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import java.util.Map;
public class ModMenuConfig implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return ViaConfigScreen::new;
}
@Override
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
return ImmutableMap.of("viafabric", getModConfigScreenFactory());
}
}

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc117.platform;
import com.viaversion.fabric.mc117.providers.VRHandItemProvider;
import com.viaversion.fabric.mc117.providers.VRVersionProvider;
import com.viaversion.fabric.mc117.providers.FabricVersionProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import com.viaversion.viaversion.api.Via;
@ -11,11 +11,11 @@ import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
public class VRLoader implements ViaPlatformLoader {
public class VFLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
Via.getManager().getProviders().use(VersionProvider.class, new VRVersionProvider());
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc117.providers;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.provider.VFVersionProvider;
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
import com.viaversion.fabric.mc117.ViaFabric;
import com.viaversion.fabric.mc117.service.ProtocolAutoDetector;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -12,7 +12,7 @@ import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;
public class VRVersionProvider extends VFVersionProvider {
public class FabricVersionProvider extends AbstractFabricVersionProvider {
@Override
protected Logger getLogger() {
return ViaFabric.JLOGGER;

View File

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

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc18.platform;
import com.viaversion.fabric.mc18.providers.VRHandItemProvider;
import com.viaversion.fabric.mc18.providers.VRVersionProvider;
import com.viaversion.fabric.mc18.providers.FabricVersionProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.loader.api.FabricLoader;
import com.viaversion.viaversion.api.Via;
@ -11,11 +11,11 @@ import com.viaversion.viaversion.api.protocol.version.VersionProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.HandItemProvider;
import com.viaversion.viaversion.protocols.protocol1_9to1_8.providers.MovementTransmitterProvider;
public class VRLoader implements ViaPlatformLoader {
public class VFLoader implements ViaPlatformLoader {
@Override
public void load() {
Via.getManager().getProviders().use(MovementTransmitterProvider.class, new BungeeMovementTransmitter());
Via.getManager().getProviders().use(VersionProvider.class, new VRVersionProvider());
Via.getManager().getProviders().use(VersionProvider.class, new FabricVersionProvider());
if (Via.getPlatform().getConf().isItemCache()) {
VRHandItemProvider handProvider = new VRHandItemProvider();

View File

@ -1,7 +1,7 @@
package com.viaversion.fabric.mc18.providers;
import com.viaversion.fabric.common.config.VFConfig;
import com.viaversion.fabric.common.provider.VFVersionProvider;
import com.viaversion.fabric.common.provider.AbstractFabricVersionProvider;
import com.viaversion.fabric.mc18.ViaFabric;
import com.viaversion.fabric.mc18.service.ProtocolAutoDetector;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@ -10,7 +10,7 @@ import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
import java.util.logging.Logger;
public class VRVersionProvider extends VFVersionProvider {
public class FabricVersionProvider extends AbstractFabricVersionProvider {
@Override
protected Logger getLogger() {
return ViaFabric.JLOGGER;