Some beginnings of a network again.

This commit is contained in:
cpw authored and LexManos committed 2018-09-05 12:31:47 -07:00
1 parent d0ab0e166c
commit 4636365e30
21 files changed
+433 -75

No files matched your search

@@ -23,12 +23,13 @@ import io.netty.channel.Channel;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.NetworkManager;
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.minecraftforge.fml.network.ConnectionType;
import net.minecraftforge.fml.network.NetworkHooks;
public class TextComponentHelper
{
@@ -52,13 +53,8 @@ public class TextComponentHelper
if (sender instanceof EntityPlayerMP)
{
EntityPlayerMP playerMP = (EntityPlayerMP) sender;
NetHandlerPlayServer connection = playerMP.connection;
if (connection != null)
{
NetworkManager netManager = connection.netManager;
Channel channel = netManager.channel();
return !channel.attr(NetworkRegistry.FML_MARKER).get();
}
NetHandlerPlayServer channel = playerMP.connection;
return NetworkHooks.getConnectionType(channel) == ConnectionType.VANILLA;
}
return false;
}