Network init

This commit is contained in:
cpw authored and LexManos committed 2018-09-05 13:14:16 -07:00
1 parent b50b768852
commit d7e9217695
43 files changed
+1064 -794

No files matched your search

@@ -19,15 +19,20 @@
package net.minecraftforge.server.command;
import net.minecraft.command.ICommand;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.command.CommandSource;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
public class ForgeCommand extends CommandTreeBase
public class ForgeCommand
{
public ForgeCommand()
public ForgeCommand(CommandDispatcher<CommandSource> dispatcher)
{
dispatcher.register(LiteralArgumentBuilder.<CommandSource>literal("forge").
requires(cs->cs.func_197034_c(2)).
then(LiteralArgumentBuilder.literal("tps")).
executes(c->{c.getSource().func_197021_a(new TextComponentString("command.forge.tps.summary")); return 1;}));
/*
super.addSubcommand(new CommandTps());
super.addSubcommand(new CommandTrack());
super.addSubcommand(new CommandGenerate());
@@ -35,35 +40,6 @@ public class ForgeCommand extends CommandTreeBase
super.addSubcommand(new CommandSetDimension());
super.addSubcommand(new CommandDimensions());
super.addSubcommand(new CommandTreeHelp(this));
}
@Override
public String getName()
{
return "forge";
}
@Override
public void addSubcommand(ICommand command)
{
throw new UnsupportedOperationException("Don't add sub-commands to /forge, create your own command.");
}
@Override
public int getRequiredPermissionLevel()
{
return 0;
}
@Override
public boolean checkPermission(MinecraftServer server, ICommandSender sender)
{
return true;
}
@Override
public String getUsage(ICommandSender icommandsender)
{
return "commands.forge.usage";
*/
}
}
@@ -19,15 +19,13 @@
package net.minecraftforge.server.command;
import io.netty.channel.Channel;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.ICommandSource;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.util.text.TextComponentBase;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraft.util.text.translation.LanguageMap;
import net.minecraftforge.fml.network.ConnectionType;
import net.minecraftforge.fml.network.NetworkHooks;
@@ -39,11 +37,11 @@ public class TextComponentHelper
* Detects when sending to a vanilla client and falls back to sending english,
* since they don't have the lang data necessary to translate on the client.
*/
public static TextComponentBase createComponentTranslation(ICommandSender sender, final String translation, final Object... args)
public static TextComponentBase createComponentTranslation(ICommandSource source, final String translation, final Object... args)
{
if (isVanillaClient(sender))
if (isVanillaClient(source))
{
return new TextComponentString(I18n.translateToLocalFormatted(translation, args));
return new TextComponentString(LanguageMap.getInstance().translateKey(translation, args));
}
return new TextComponentTranslation(translation, args);
}