Finalize the 1.16.5 backport
Please note that tab completions do not fully work as intended yet
This commit is contained in:
parent
dfc8cf6cf9
commit
d15b8a8786
14 changed files with 64 additions and 75 deletions
|
@ -8,10 +8,11 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
|||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.text.ClickEvent;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.minecraft.text.Texts;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.command.CommandRegistryAccess;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import land.chipmunk.chipmunkmod.commands.*;
|
||||
|
@ -20,6 +21,8 @@ public class CommandManager {
|
|||
public CommandDispatcher<FabricClientCommandSource> dispatcher = new CommandDispatcher<>();
|
||||
public String prefix;
|
||||
|
||||
public static CommandManager INSTANCE;
|
||||
|
||||
public CommandManager (String prefix) {
|
||||
this.prefix = prefix;
|
||||
|
||||
|
@ -28,7 +31,7 @@ public class CommandManager {
|
|||
UsernameCommand.register(this.dispatcher);
|
||||
CloopCommand.register(this.dispatcher);
|
||||
ValidateCommand.register(this.dispatcher);
|
||||
ItemCommand.register(this.dispatcher, commandRegistryAccess);
|
||||
ItemCommand.register(this.dispatcher);
|
||||
SayCommand.register(this.dispatcher);
|
||||
}
|
||||
|
||||
|
@ -57,20 +60,20 @@ public class CommandManager {
|
|||
if (input == null || _cursor < 0) {
|
||||
return null;
|
||||
}
|
||||
final MutableText text = Text.literal("")
|
||||
final MutableText text = new LiteralText("")
|
||||
.formatted(Formatting.GRAY);
|
||||
text.setStyle(text.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, prefix + input)));
|
||||
|
||||
final int cursor = Math.min(input.length(), _cursor);
|
||||
|
||||
if (cursor > CommandSyntaxException.CONTEXT_AMOUNT) {
|
||||
text.append(Text.literal("..."));
|
||||
text.append(new LiteralText("..."));
|
||||
}
|
||||
|
||||
text
|
||||
.append(Text.literal(input.substring(Math.max(0, cursor - CommandSyntaxException.CONTEXT_AMOUNT), cursor)))
|
||||
.append(Text.literal(input.substring(cursor)).formatted(Formatting.RED, Formatting.UNDERLINE))
|
||||
.append(Text.translatable("command.context.here").formatted(Formatting.RED, Formatting.ITALIC));
|
||||
.append(new LiteralText(input.substring(Math.max(0, cursor - CommandSyntaxException.CONTEXT_AMOUNT), cursor)))
|
||||
.append(new LiteralText(input.substring(cursor)).formatted(Formatting.RED, Formatting.UNDERLINE))
|
||||
.append(new TranslatableText("command.context.here").formatted(Formatting.RED, Formatting.ITALIC));
|
||||
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,13 @@ import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
|||
import static com.mojang.brigadier.arguments.IntegerArgumentType.integer;
|
||||
import static com.mojang.brigadier.arguments.IntegerArgumentType.getInteger;
|
||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import land.chipmunk.chipmunkmod.modules.CommandLoopManager;
|
||||
import java.util.List;
|
||||
|
||||
public class CloopCommand {
|
||||
private static final DynamicCommandExceptionType INVALID_CLOOP_ID_EXCEPTION = new DynamicCommandExceptionType(id -> Text.translatable("Invalid cloop id: %s", Text.literal(String.valueOf(id))));
|
||||
private static final DynamicCommandExceptionType INVALID_CLOOP_ID_EXCEPTION = new DynamicCommandExceptionType(id -> new TranslatableText("Invalid cloop id: %s", new LiteralText(String.valueOf(id))));
|
||||
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
dispatcher.register(
|
||||
|
@ -59,7 +60,7 @@ public class CloopCommand {
|
|||
|
||||
int id = CommandLoopManager.INSTANCE.loopCommand(command, interval);
|
||||
|
||||
source.sendFeedback(Text.translatable("Successfully created a loop for command '%s' with id %s", Text.literal(command), Text.literal(String.valueOf(id))));
|
||||
source.sendFeedback(new TranslatableText("Successfully created a loop for command '%s' with id %s", new LiteralText(command), new LiteralText(String.valueOf(id))));
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@ public class CloopCommand {
|
|||
|
||||
manager.removeAndStop(id);
|
||||
|
||||
source.sendFeedback(Text.translatable("Successfully removed loop with id %s", Text.literal(String.valueOf(id))));
|
||||
source.sendFeedback(new TranslatableText("Successfully removed loop with id %s", new LiteralText(String.valueOf(id))));
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class CloopCommand {
|
|||
|
||||
manager.clearLoops();
|
||||
|
||||
source.sendFeedback(Text.translatable("Successfully cleared all command loops"));
|
||||
source.sendFeedback(new TranslatableText("Successfully cleared all command loops"));
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -92,12 +93,12 @@ public class CloopCommand {
|
|||
|
||||
int id = 0;
|
||||
for (CommandLoopManager.CommandLoop loop : loops) {
|
||||
source.sendFeedback(Text.translatable("%s: %s (%s)", Text.literal(String.valueOf(id)), Text.literal(loop.command()), Text.literal(String.valueOf(loop.interval()))));
|
||||
source.sendFeedback(new TranslatableText("%s: %s (%s)", new LiteralText(String.valueOf(id)), new LiteralText(loop.command()), new LiteralText(String.valueOf(loop.interval()))));
|
||||
id++;
|
||||
}
|
||||
|
||||
if (id == 0) {
|
||||
source.sendFeedback(Text.translatable("No command loops are currently running"));
|
||||
source.sendFeedback(new TranslatableText("No command loops are currently running"));
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
|
|
@ -14,7 +14,8 @@ import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
|
||||
public class ItemCommand {
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
|
@ -41,14 +42,14 @@ public class ItemCommand {
|
|||
|
||||
final ItemStack stack = getItemStackArgument(context, "item").createStack(count, false);
|
||||
|
||||
int slot = 36 + client.player.getInventory().selectedSlot;
|
||||
int slot = 36 + client.player.inventory.selectedSlot;
|
||||
|
||||
client.getNetworkHandler().getConnection().send(new CreativeInventoryActionC2SPacket(slot, stack));
|
||||
|
||||
source.sendFeedback(
|
||||
Text.translatable(
|
||||
new TranslatableText(
|
||||
"Replaced your held item with %s %s",
|
||||
Text.literal(String.valueOf(count)),
|
||||
new LiteralText(String.valueOf(count)),
|
||||
stack.toHoverableText()
|
||||
)
|
||||
);
|
||||
|
|
|
@ -8,7 +8,6 @@ import static land.chipmunk.chipmunkmod.command.CommandManager.argument;
|
|||
import static com.mojang.brigadier.arguments.StringArgumentType.greedyString;
|
||||
import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class SayCommand {
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
|
@ -23,7 +22,7 @@ public class SayCommand {
|
|||
|
||||
public static int say (CommandContext<FabricClientCommandSource> context) {
|
||||
final FabricClientCommandSource source = context.getSource();
|
||||
source.getClient().getNetworkHandler().sendChatMessage(getString(context, "message"));
|
||||
source.getPlayer().sendChatMessage(getString(context, "message"));
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.mojang.brigadier.CommandDispatcher;
|
|||
import com.mojang.brigadier.context.CommandContext;
|
||||
import static land.chipmunk.chipmunkmod.command.CommandManager.literal;
|
||||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.LiteralText;
|
||||
|
||||
public class TestCommand {
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
|
@ -17,7 +17,7 @@ public class TestCommand {
|
|||
|
||||
public static int helloWorld (CommandContext<FabricClientCommandSource> context) {
|
||||
final FabricClientCommandSource source = context.getSource();
|
||||
source.sendFeedback(Text.literal("Hello, world!"));
|
||||
source.sendFeedback(new LiteralText("Hello, world!"));
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
|
|||
import net.minecraft.client.network.ServerInfo;
|
||||
import net.minecraft.client.network.ServerAddress;
|
||||
import net.minecraft.client.util.Session;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
import java.util.Optional;
|
||||
|
@ -23,7 +23,7 @@ import land.chipmunk.chipmunkmod.mixin.MinecraftClientAccessor;
|
|||
|
||||
public class UsernameCommand {
|
||||
private static final Session ORIGINAL_SESSION = ((MinecraftClientAccessor) MinecraftClient.getInstance()).session();
|
||||
private static final SimpleCommandExceptionType USERNAME_TOO_LONG = new SimpleCommandExceptionType(Text.translatable("The specified username is longer than 16 characters"));
|
||||
private static final SimpleCommandExceptionType USERNAME_TOO_LONG = new SimpleCommandExceptionType(new TranslatableText("The specified username is longer than 16 characters"));
|
||||
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
dispatcher.register(
|
||||
|
@ -45,7 +45,7 @@ public class UsernameCommand {
|
|||
public static int updateUsername (CommandContext<FabricClientCommandSource> context) throws CommandSyntaxException {
|
||||
final String username = getString(context, "username");
|
||||
if (username.length() > 16) throw USERNAME_TOO_LONG.create();
|
||||
final Session session = new Session(username, "", "", Optional.empty(), Optional.empty(), Session.AccountType.MOJANG);
|
||||
final Session session = new Session(username, "", "", "");
|
||||
return updateSession(context, session);
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,8 @@ public class UsernameCommand {
|
|||
final ServerInfo info = client.getCurrentServerEntry();
|
||||
client.world.disconnect();
|
||||
client.disconnect();
|
||||
ConnectScreen.connect(new MultiplayerScreen(new TitleScreen()), client, ServerAddress.parse(info.address), info);
|
||||
final ServerAddress address = ServerAddress.parse(info.address);
|
||||
new ConnectScreen(new MultiplayerScreen(new TitleScreen()), client, info);
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import static com.mojang.brigadier.arguments.StringArgumentType.getString;
|
|||
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import java.util.Arrays;
|
||||
|
@ -23,7 +23,7 @@ import land.chipmunk.chipmunkmod.Configuration;
|
|||
import land.chipmunk.chipmunkmod.util.Hexadecimal;
|
||||
|
||||
public class ValidateCommand {
|
||||
private static final SimpleCommandExceptionType UNSPECIFIED_KEY = new SimpleCommandExceptionType(Text.literal("The key of the bot is unspecified (null), did you incorrectly add it to your config?"));
|
||||
private static final SimpleCommandExceptionType UNSPECIFIED_KEY = new SimpleCommandExceptionType(new LiteralText("The key of the bot is unspecified (null), did you incorrectly add it to your config?"));
|
||||
|
||||
public static void register (CommandDispatcher<FabricClientCommandSource> dispatcher) {
|
||||
dispatcher.register(
|
||||
|
@ -41,7 +41,6 @@ public class ValidateCommand {
|
|||
final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.hbot;
|
||||
final String command = getString(context, "command");
|
||||
final MinecraftClient client = context.getSource().getClient();
|
||||
final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler();
|
||||
|
||||
final String prefix = info.prefix;
|
||||
final String key = info.key;
|
||||
|
@ -55,9 +54,9 @@ public class ValidateCommand {
|
|||
BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4));
|
||||
String stringHash = bigInt.toString(Character.MAX_RADIX);
|
||||
|
||||
networkHandler.sendChatMessage(prefix + command + " " + stringHash);
|
||||
client.player.sendChatMessage(prefix + command + " " + stringHash);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create();
|
||||
throw new SimpleCommandExceptionType(new LiteralText(e.getMessage())).create();
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
@ -67,7 +66,6 @@ public class ValidateCommand {
|
|||
final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.sbot;
|
||||
final String command = getString(context, "command");
|
||||
final MinecraftClient client = context.getSource().getClient();
|
||||
final ClientPlayNetworkHandler networkHandler = client.getNetworkHandler();
|
||||
|
||||
final String prefix = info.prefix;
|
||||
final String key = info.key;
|
||||
|
@ -81,9 +79,9 @@ public class ValidateCommand {
|
|||
BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4));
|
||||
String stringHash = bigInt.toString(Character.MAX_RADIX);
|
||||
|
||||
networkHandler.sendChatMessage(prefix + command + " " + stringHash);
|
||||
client.player.sendChatMessage(prefix + command + " " + stringHash);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create();
|
||||
throw new SimpleCommandExceptionType(new LiteralText(e.getMessage())).create();
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
@ -92,7 +90,7 @@ public class ValidateCommand {
|
|||
public static int chomens (CommandContext<FabricClientCommandSource> context) throws CommandSyntaxException {
|
||||
final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.chomens;
|
||||
final String command = getString(context, "command");
|
||||
final ClientPlayNetworkHandler networkHandler = context.getSource().getClient().getNetworkHandler();
|
||||
final MinecraftClient client = context.getSource().getClient();
|
||||
|
||||
final String prefix = info.prefix;
|
||||
final String key = info.key;
|
||||
|
@ -106,9 +104,9 @@ public class ValidateCommand {
|
|||
String stringHash = Hexadecimal.encode(hash).substring(0, 16);
|
||||
|
||||
String[] arguments = command.split(" ");
|
||||
networkHandler.sendChatMessage(prefix + arguments[0] + " " + stringHash + " " + String.join(" ", Arrays.copyOfRange(arguments, 1, arguments.length)));
|
||||
client.player.sendChatMessage(prefix + arguments[0] + " " + stringHash + " " + String.join(" ", Arrays.copyOfRange(arguments, 1, arguments.length)));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create();
|
||||
throw new SimpleCommandExceptionType(new LiteralText(e.getMessage())).create();
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
@ -117,7 +115,7 @@ public class ValidateCommand {
|
|||
public static int kittycorp (CommandContext<FabricClientCommandSource> context) throws CommandSyntaxException {
|
||||
final Configuration.BotInfo info = ChipmunkMod.CONFIG.bots.kittycorp;
|
||||
final String command = getString(context, "command");
|
||||
final ClientPlayNetworkHandler networkHandler = context.getSource().getClient().getNetworkHandler();
|
||||
final MinecraftClient client = context.getSource().getClient();
|
||||
|
||||
final String prefix = info.prefix;
|
||||
final String key = info.key;
|
||||
|
@ -131,9 +129,9 @@ public class ValidateCommand {
|
|||
BigInteger bigInt = new BigInteger(1, Arrays.copyOfRange(hash, 0, 4));
|
||||
String stringHash = bigInt.toString(Character.MAX_RADIX);
|
||||
|
||||
networkHandler.sendChatMessage(prefix + command + " " + stringHash);
|
||||
client.player.sendChatMessage(prefix + command + " " + stringHash);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new SimpleCommandExceptionType(Text.literal(e.getMessage())).create();
|
||||
throw new SimpleCommandExceptionType(new LiteralText(e.getMessage())).create();
|
||||
}
|
||||
|
||||
return Command.SINGLE_SUCCESS;
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
package land.chipmunk.chipmunkmod.mixin;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import land.chipmunk.chipmunkmod.command.CommandManager;
|
||||
|
||||
@Mixin(net.minecraft.client.gui.screen.ChatScreen.class)
|
||||
public class ChatScreenMixin {
|
||||
@Inject(at = @At("HEAD"), method = "sendMessage", cancellable = true)
|
||||
public void sendMessage(String chatText, boolean addToHistory, CallbackInfoReturnable<Boolean> cir) {
|
||||
final CommandManager commandManager = CommandManager.INSTANCE;
|
||||
|
||||
if (chatText.startsWith(commandManager.prefix)) {
|
||||
commandManager.executeCommand(chatText.substring(commandManager.prefix.length()));
|
||||
|
||||
if (addToHistory) MinecraftClient.getInstance().inGameHud.getChatHud().addToMessageHistory(chatText);
|
||||
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,8 +11,8 @@ import net.minecraft.client.MinecraftClient;
|
|||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec2f;
|
||||
import land.chipmunk.chipmunkmod.modules.CommandCore;
|
||||
import land.chipmunk.chipmunkmod.command.CommandManager;
|
||||
|
||||
@Mixin(ClientPlayerEntity.class)
|
||||
public class ClientPlayerEntityMixin {
|
||||
|
@ -28,7 +28,18 @@ public class ClientPlayerEntityMixin {
|
|||
|
||||
final BlockPos origin = CommandCore.INSTANCE.origin();
|
||||
if (origin == null) { CommandCore.INSTANCE.move(position); return; }
|
||||
final int distance = (int) Math.sqrt(new Vec2f(origin.getX() / 16, origin.getZ() / 16).distanceSquared(new Vec2f((int) position.getX() / 16, (int) position.getZ() / 16)));
|
||||
if (distance > world.getSimulationDistance()) CommandCore.INSTANCE.move(position);
|
||||
final int distance = (int) Math.hypot(origin.getX() / 16 - (int) position.getX() / 16, origin.getZ() / 16 - (int) position.getZ() / 16);
|
||||
if (distance > 4) CommandCore.INSTANCE.move(position);
|
||||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "sendChatMessage", cancellable = true)
|
||||
private void sendChatMessage (String message, CallbackInfo ci) {
|
||||
final CommandManager commandManager = CommandManager.INSTANCE;
|
||||
|
||||
if (message.startsWith(commandManager.prefix)) {
|
||||
commandManager.executeCommand(message.substring(commandManager.prefix.length()));
|
||||
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,8 @@ public class CommandSuggestorMixin {
|
|||
@Shadow
|
||||
public boolean slashOptional;
|
||||
|
||||
@Shadow
|
||||
public void show (boolean narrateFirstSuggestion) {}
|
||||
// @Shadow
|
||||
// public void show () {}
|
||||
|
||||
@Shadow
|
||||
final TextFieldWidget textField;
|
||||
|
@ -52,6 +52,6 @@ public class CommandSuggestorMixin {
|
|||
final FabricClientCommandSource commandSource = (FabricClientCommandSource) client.getNetworkHandler().getCommandSource();
|
||||
|
||||
pendingSuggestions = dispatcher.getCompletionSuggestions(dispatcher.parse(reader, commandSource), cursor);
|
||||
show(true);
|
||||
// show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class CommandCore {
|
|||
relEnd.getZ() + origin.getZ()
|
||||
);
|
||||
|
||||
client.getNetworkHandler().sendChatCommand(command);
|
||||
client.player.sendChatMessage("/" + command);
|
||||
}
|
||||
|
||||
public void incrementCurrentBlock () {
|
||||
|
|
|
@ -52,8 +52,8 @@ public class SelfCare {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!player.hasPermissionLevel(2)) { if (serverHasCommand("op")) networkHandler.sendChatCommand("op @s[type=player]"); }
|
||||
else if (!client.player.isCreative()) networkHandler.sendChatCommand("gamemode creative");
|
||||
if (!player.hasPermissionLevel(2)) { if (serverHasCommand("op")) player.sendChatMessage("/op @s[type=player]"); }
|
||||
else if (!client.player.isCreative()) player.sendChatMessage("/gamemode creative");
|
||||
}
|
||||
|
||||
// TODO: Move this into a separate class related to server info gathering (and yes, I plan on making this d y n a m i c and require little to no configuration for most servers)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
"ChatScreenMixin",
|
||||
"CommandSuggestorMixin",
|
||||
"ClientPlayerEntityMixin",
|
||||
"ClientPlayNetworkHandlerMixin",
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.14.11",
|
||||
"fabric-api": "*",
|
||||
"fabric": "*",
|
||||
"minecraft": "~1.16.5",
|
||||
"java": ">=17"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue