mirror of
https://github.com/ViaVersion/ViaFabric.git
synced 2024-12-18 15:47:46 +01:00
fabric client-side commands, update modmenu
This commit is contained in:
parent
cc4cc7f265
commit
e683756ea2
@ -37,6 +37,7 @@ repositories {
|
|||||||
maven(url = "https://server.bbkr.space/artifactory/libs-snapshot")
|
maven(url = "https://server.bbkr.space/artifactory/libs-snapshot")
|
||||||
maven(url = "https://server.bbkr.space/artifactory/libs-release")
|
maven(url = "https://server.bbkr.space/artifactory/libs-release")
|
||||||
maven(url = "https://maven.extracraftx.com")
|
maven(url = "https://maven.extracraftx.com")
|
||||||
|
maven("https://maven.terraformersmc.com/releases/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,15 +59,15 @@ dependencies {
|
|||||||
|
|
||||||
// Use 1.16 snapshot, probably intermediary will make it work on further versions
|
// Use 1.16 snapshot, probably intermediary will make it work on further versions
|
||||||
// https://modmuss50.me/fabric.html?&version=1.16
|
// https://modmuss50.me/fabric.html?&version=1.16
|
||||||
minecraft("com.mojang:minecraft:1.16.3")
|
minecraft("com.mojang:minecraft:1.16.5")
|
||||||
mappings("net.fabricmc:yarn:1.16.3+build.5:v2")
|
mappings("net.fabricmc:yarn:1.16.5+build.6:v2")
|
||||||
modImplementation("net.fabricmc:fabric-loader:0.9.3+build.207")
|
modImplementation("net.fabricmc:fabric-loader:0.11.3")
|
||||||
|
|
||||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.20.2+build.402-1.16")
|
modImplementation("net.fabricmc.fabric-api:fabric-api:0.32.5+1.16")
|
||||||
modImplementation("io.github.prospector:modmenu:1.14.5+build.30")
|
modImplementation("com.terraformersmc:modmenu:1.16.9")
|
||||||
|
|
||||||
modImplementation("io.github.cottonmc:cotton-client-commands:1.0.1+1.16-rc1")
|
//modImplementation("io.github.cottonmc:cotton-client-commands:1.0.1+1.16-rc1")
|
||||||
include("io.github.cottonmc:cotton-client-commands:1.0.1+1.16-rc1")
|
//include("io.github.cottonmc:cotton-client-commands:1.0.1+1.16-rc1")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!System.getenv()["curse_api_key"].isNullOrBlank() && branch.startsWith("mc-")) {
|
if (!System.getenv()["curse_api_key"].isNullOrBlank() && branch.startsWith("mc-")) {
|
||||||
|
@ -15,10 +15,11 @@ import com.mojang.brigadier.builder.RequiredArgumentBuilder;
|
|||||||
import io.netty.channel.DefaultEventLoop;
|
import io.netty.channel.DefaultEventLoop;
|
||||||
import io.netty.channel.EventLoop;
|
import io.netty.channel.EventLoop;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
|
||||||
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
|
||||||
import net.fabricmc.fabric.api.registry.CommandRegistry;
|
import net.fabricmc.fabric.api.registry.CommandRegistry;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.server.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import us.myles.ViaVersion.ViaManagerImpl;
|
import us.myles.ViaVersion.ViaManagerImpl;
|
||||||
import us.myles.ViaVersion.api.Via;
|
import us.myles.ViaVersion.api.Via;
|
||||||
@ -99,6 +100,7 @@ public class ViaFabric implements ModInitializer {
|
|||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("viaversion")));
|
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("viaver")));
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("vvfabric")));
|
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> dispatcher.register(command("vvfabric")));
|
||||||
|
ClientCommandManager.DISPATCHER.register(command("viafabricclient"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.github.creeper123123321.viafabric.commands;
|
package com.github.creeper123123321.viafabric.commands;
|
||||||
|
|
||||||
import io.github.cottonmc.clientcommands.CottonClientCommandSource;
|
import com.github.creeper123123321.viafabric.platform.VRPlatform;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||||
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.server.command.CommandSource;
|
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
import us.myles.ViaVersion.api.command.ViaCommandSender;
|
||||||
@ -28,9 +28,9 @@ public class NMSCommandSender implements ViaCommandSender {
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(String s) {
|
public void sendMessage(String s) {
|
||||||
if (source instanceof ServerCommandSource) {
|
if (source instanceof ServerCommandSource) {
|
||||||
((ServerCommandSource) source).sendFeedback(Text.Serializer.fromJson(legacyToJson(s)), false);
|
((ServerCommandSource) source).sendFeedback(Text.Serializer.fromJson(VRPlatform.legacyToJson(s)), false);
|
||||||
} else if (source instanceof CottonClientCommandSource) {
|
} else if (source instanceof FabricClientCommandSource) {
|
||||||
((CottonClientCommandSource) source).sendFeedback(Text.Serializer.fromJson(legacyToJson(s)), false);
|
((FabricClientCommandSource) source).sendFeedback(Text.Serializer.fromJson(VRPlatform.legacyToJson(s)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,8 +43,8 @@ public class NMSCommandSender implements ViaCommandSender {
|
|||||||
if (source instanceof ServerCommandSource) {
|
if (source instanceof ServerCommandSource) {
|
||||||
Entity entity = ((ServerCommandSource) source).getEntity();
|
Entity entity = ((ServerCommandSource) source).getEntity();
|
||||||
if (entity != null) return entity.getUuid();
|
if (entity != null) return entity.getUuid();
|
||||||
} else if (source instanceof CottonClientCommandSource) {
|
} else if (source instanceof FabricClientCommandSource) {
|
||||||
return MinecraftClient.getInstance().player.getUuid();
|
return ((FabricClientCommandSource) source).getPlayer().getUuid();
|
||||||
}
|
}
|
||||||
return UUID.fromString(getName());
|
return UUID.fromString(getName());
|
||||||
}
|
}
|
||||||
@ -53,8 +53,8 @@ public class NMSCommandSender implements ViaCommandSender {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
if (source instanceof ServerCommandSource) {
|
if (source instanceof ServerCommandSource) {
|
||||||
return ((ServerCommandSource) source).getName();
|
return ((ServerCommandSource) source).getName();
|
||||||
} else if (source instanceof CottonClientCommandSource) {
|
} else if (source instanceof FabricClientCommandSource) {
|
||||||
return MinecraftClient.getInstance().player.getEntityName();
|
return ((FabricClientCommandSource) source).getPlayer().getEntityName();
|
||||||
}
|
}
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package com.github.creeper123123321.viafabric.commands;
|
|
||||||
|
|
||||||
import com.github.creeper123123321.viafabric.ViaFabric;
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
import io.github.cottonmc.clientcommands.ClientCommandPlugin;
|
|
||||||
import io.github.cottonmc.clientcommands.CottonClientCommandSource;
|
|
||||||
|
|
||||||
public class VRClientCommands implements ClientCommandPlugin {
|
|
||||||
@Override
|
|
||||||
public void registerCommands(CommandDispatcher<CottonClientCommandSource> commandDispatcher) {
|
|
||||||
commandDispatcher.register(ViaFabric.command("viafabricclient"));
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,7 @@ import com.mojang.brigadier.arguments.StringArgumentType;
|
|||||||
import com.mojang.brigadier.context.CommandContext;
|
import com.mojang.brigadier.context.CommandContext;
|
||||||
import com.mojang.brigadier.suggestion.Suggestions;
|
import com.mojang.brigadier.suggestion.Suggestions;
|
||||||
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
||||||
import net.minecraft.server.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import us.myles.ViaVersion.commands.ViaCommandHandler;
|
import us.myles.ViaVersion.commands.ViaCommandHandler;
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
@ -61,15 +61,11 @@
|
|||||||
"main": [
|
"main": [
|
||||||
"com.github.creeper123123321.viafabric.ViaFabric"
|
"com.github.creeper123123321.viafabric.ViaFabric"
|
||||||
],
|
],
|
||||||
"cotton-client-commands": [
|
|
||||||
"com.github.creeper123123321.viafabric.commands.VRClientCommands"
|
|
||||||
],
|
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"com.github.creeper123123321.viafabric.gui.ModMenuConfig"
|
"com.github.creeper123123321.viafabric.gui.ModMenuConfig"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"depends": {
|
"depends": {
|
||||||
"cotton-client-commands": "*",
|
|
||||||
"fabricloader": ">=0.4.0",
|
"fabricloader": ">=0.4.0",
|
||||||
"fabric-resource-loader-v0": "*",
|
"fabric-resource-loader-v0": "*",
|
||||||
"minecraft": "1.16.x",
|
"minecraft": "1.16.x",
|
||||||
|
Loading…
Reference in New Issue
Block a user