本文整理汇总了Java中net.minecraft.network.login.client.CPacketLoginStart类的典型用法代码示例。如果您正苦于以下问题:Java CPacketLoginStart类的具体用法?Java CPacketLoginStart怎么用?Java CPacketLoginStart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CPacketLoginStart类属于net.minecraft.network.login.client包,在下文中一共展示了CPacketLoginStart类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processLoginStart
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
@Override
public void processLoginStart(CPacketLoginStart packetIn) {
super.processLoginStart(packetIn);
if (myNetworkManager == null) {
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(PatchList.PATCH_ENTITYPLAYERSP, false);
return;
}
NetworkManager manager = ReflectionHelper.get(ObfuscatedField.Minecraft_myNetworkManager, myNetworkManager, Minecraft.getMinecraft());
if (manager == null) {
PatchManager.instance().getGlobalAppliedPatches().setPatchSuccessfullyApplied(PatchList.PATCH_ENTITYPLAYERSP, false);
return;
}
manager.setNetHandler(new NetHandlerLoginClient(manager, Minecraft.getMinecraft(), null));
}
示例2: oAuth
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
public static void oAuth(OAuthCallback callback) {
new Thread(() -> {
try {
InetAddress inetaddress = InetAddress.getByName(ip);
OAuthNetworkManager manager = OAuthNetworkManager.createNetworkManagerAndConnect(inetaddress, port,
Minecraft.getMinecraft().gameSettings.isUsingNativeTransport(), callback);
manager.setNetHandler(new OAuthNetHandler(manager, Minecraft.getMinecraft(), null, callback));
manager.sendPacket(new C00Handshake(ip, port, EnumConnectionState.LOGIN));
manager.sendPacket(new CPacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
} catch (Exception ex) {
callback.callback(false, "", "");
}
}).start();
}
示例3: processLoginStart
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
public void processLoginStart(CPacketLoginStart packetIn)
{
Validate.validState(this.currentLoginState == NetHandlerLoginServer.LoginState.HELLO, "Unexpected hello packet", new Object[0]);
this.loginGameProfile = packetIn.getProfile();
if (this.server.isServerInOnlineMode() && !this.networkManager.isLocalChannel())
{
this.currentLoginState = NetHandlerLoginServer.LoginState.KEY;
this.networkManager.sendPacket(new SPacketEncryptionRequest("", this.server.getKeyPair().getPublic(), this.verifyToken));
}
else
{
this.currentLoginState = NetHandlerLoginServer.LoginState.READY_TO_ACCEPT;
}
}
示例4: connect
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
private void connect(String ip, int port) throws UnknownHostException {
InetAddress inetaddress = InetAddress.getByName(ip);
Minecraft minecraft = Minecraft.getMinecraft();
boolean isUsingNativeTransport = minecraft.gameSettings.isUsingNativeTransport();
GuiScreen previousGuiScreen = null;
// The following code is copied from
// net.minecraft.client.multiplayer.GuiConnecting.connect(String, int)
NetworkManager networkManager =
NetworkManager.createNetworkManagerAndConnect(inetaddress, port, isUsingNativeTransport);
networkManager
.setNetHandler(new NetHandlerLoginClient(networkManager, minecraft, previousGuiScreen));
networkManager.sendPacket(new C00Handshake(316, ip, port, EnumConnectionState.LOGIN, true));
networkManager.sendPacket(new CPacketLoginStart(minecraft.getSession().getProfile()));
}
示例5: connect
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
public void connect(final String p_connect_1_, final int p_connect_2_)
{
Realms.setConnectedToRealms(true);
(new Thread("Realms-connect-task")
{
public void run()
{
InetAddress inetaddress = null;
try
{
inetaddress = InetAddress.getByName(p_connect_1_);
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection = NetworkManager.createNetworkManagerAndConnect(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.isUsingNativeTransport());
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection.sendPacket(new C00Handshake(316, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN));
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection.sendPacket(new CPacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception)
{
Realms.clearResourcePack();
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
}
catch (Exception exception)
{
Realms.clearResourcePack();
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
String s = exception.toString();
if (inetaddress != null)
{
String s1 = inetaddress + ":" + p_connect_2_;
s = s.replaceAll(s1, "");
}
Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
}
}
}).start();
}
示例6: connect
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
private void connect(final String ip, final int port)
{
LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(port)});
(new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet())
{
public void run()
{
InetAddress inetaddress = null;
try
{
if (GuiConnecting.this.cancel)
{
return;
}
inetaddress = InetAddress.getByName(ip);
GuiConnecting.this.networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, GuiConnecting.this.mc.gameSettings.isUsingNativeTransport());
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
GuiConnecting.this.networkManager.sendPacket(new C00Handshake(GuiScreenProtocol.proto, ip, port, EnumConnectionState.LOGIN));
GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception)
{
if (GuiConnecting.this.cancel)
{
return;
}
GuiConnecting.LOGGER.error((String)"Couldn\'t connect to server", (Throwable)unknownhostexception);
GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"})));
}
catch (Exception exception)
{
if (GuiConnecting.this.cancel)
{
return;
}
GuiConnecting.LOGGER.error((String)"Couldn\'t connect to server", (Throwable)exception);
String s = exception.toString();
if (inetaddress != null)
{
String s1 = inetaddress + ":" + port;
s = s.replaceAll(s1, "");
}
GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
}
}
}).start();
}
示例7: connect
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
public void connect(final String p_connect_1_, final int p_connect_2_)
{
Realms.setConnectedToRealms(true);
(new Thread("Realms-connect-task")
{
public void run()
{
InetAddress inetaddress = null;
try
{
net.minecraftforge.fml.client.FMLClientHandler.instance().connectToRealmsServer(p_connect_1_, p_connect_2_);
inetaddress = InetAddress.getByName(p_connect_1_);
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection = NetworkManager.createNetworkManagerAndConnect(inetaddress, p_connect_2_, Minecraft.getMinecraft().gameSettings.isUsingNativeTransport());
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection.setNetHandler(new NetHandlerLoginClient(RealmsConnect.this.connection, Minecraft.getMinecraft(), RealmsConnect.this.onlineScreen.getProxy()));
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection.sendPacket(new C00Handshake(210, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true));
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.this.connection.sendPacket(new CPacketLoginStart(Minecraft.getMinecraft().getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception)
{
Realms.clearResourcePack();
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)unknownhostexception);
Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host \'" + p_connect_1_ + "\'"})));
}
catch (Exception exception)
{
Realms.clearResourcePack();
if (RealmsConnect.this.aborted)
{
return;
}
RealmsConnect.LOGGER.error((String)"Couldn\'t connect to world", (Throwable)exception);
String s = exception.toString();
if (inetaddress != null)
{
String s1 = inetaddress + ":" + p_connect_2_;
s = s.replaceAll(s1, "");
}
Realms.setScreen(new DisconnectedRealmsScreen(RealmsConnect.this.onlineScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
}
}
}).start();
}
示例8: connect
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
private void connect(final String ip, final int port)
{
LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(port)});
(new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet())
{
public void run()
{
InetAddress inetaddress = null;
try
{
if (GuiConnecting.this.cancel)
{
return;
}
inetaddress = InetAddress.getByName(ip);
GuiConnecting.this.networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, GuiConnecting.this.mc.gameSettings.isUsingNativeTransport());
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
GuiConnecting.this.networkManager.sendPacket(new C00Handshake(210, ip, port, EnumConnectionState.LOGIN, true));
GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception)
{
if (GuiConnecting.this.cancel)
{
return;
}
GuiConnecting.LOGGER.error((String)"Couldn\'t connect to server", (Throwable)unknownhostexception);
GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"})));
}
catch (Exception exception)
{
if (GuiConnecting.this.cancel)
{
return;
}
GuiConnecting.LOGGER.error((String)"Couldn\'t connect to server", (Throwable)exception);
String s = exception.toString();
if (inetaddress != null)
{
String s1 = inetaddress + ":" + port;
s = s.replaceAll(s1, "");
}
GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
}
}
}).start();
}
示例9: connect
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
private void connect(final String ip, final int port) {
LOGGER.info("Connecting to {}, {}", new Object[] {ip, Integer.valueOf(port)});
new Thread("Server Connector #" + CONNECTION_ID.incrementAndGet()) {
@Override
public void run() {
InetAddress inetaddress = null;
try {
if (GuiConnecting.this.cancel)
return;
inetaddress = InetAddress.getByName(ip);
GuiConnecting.this.networkManager = NetworkManager.createNetworkManagerAndConnect(inetaddress, port, GuiConnecting.this.mc.gameSettings.isUsingNativeTransport());
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
GuiConnecting.this.networkManager.sendPacket(new C00Handshake(ip, port, EnumConnectionState.LOGIN, true));
GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception) {
if (GuiConnecting.this.cancel)
return;
GuiConnecting.LOGGER.error("Couldn\'t connect to server", unknownhostexception);
GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {"Unknown host"})));
}
catch (Exception exception) {
if (GuiConnecting.this.cancel)
return;
GuiConnecting.LOGGER.error("Couldn\'t connect to server", exception);
String s = exception.toString();
if (inetaddress != null) {
String s1 = inetaddress + ":" + port;
s = s.replaceAll(s1, "");
}
GuiConnecting.this.mc.displayGuiScreen(new GuiDisconnected(GuiConnecting.this.previousGuiScreen, "connect.failed", new TextComponentTranslation("disconnect.genericReason", new Object[] {s})));
}
}
}.start();
}
示例10: processLoginStart
import net.minecraft.network.login.client.CPacketLoginStart; //导入依赖的package包/类
void processLoginStart(CPacketLoginStart packetIn);