mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 20:52:34 +00:00
Some beginnings of a network again.
This commit is contained in:
1 parent
d0ab0e166c
commit
4636365e30
21 files changed
+433
-75
No files matched your search
@@ -583,7 +583,7 @@ public class FMLCommonHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
manager.channel().attr(NetworkRegistry.FML_MARKER).set(packet.hasFMLMarker());
|
||||
manager.channel().attr(net.minecraftforge.fml.network.NetworkRegistry.FML_MARKER).set(packet.hasFMLMarker());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,6 @@ public class NetworkRegistry
|
||||
public static final AttributeKey<LogicalSide> CHANNEL_SOURCE = AttributeKey.valueOf("fml:channelSource");
|
||||
public static final AttributeKey<ModContainer> MOD_CONTAINER = AttributeKey.valueOf("fml:modContainer");
|
||||
public static final AttributeKey<INetHandler> NET_HANDLER = AttributeKey.valueOf("fml:netHandler");
|
||||
public static final AttributeKey<String> FML_MARKER = AttributeKey.valueOf("fml:versionMarker");
|
||||
|
||||
// Version 1: ServerHello only contains this value as a byte
|
||||
// Version 2: ServerHello additionally contains a 4 byte (int) dimension for the logging in client
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> im
|
||||
public void serverToClientHandshake(EntityPlayerMP player)
|
||||
{
|
||||
this.player = player;
|
||||
Boolean fml = this.manager.channel().attr(NetworkRegistry.FML_MARKER).get();
|
||||
Boolean fml = this.manager.channel().attr(net.minecraftforge.fml.network.NetworkRegistry.FML_MARKER).get();
|
||||
if (fml != null && fml)
|
||||
{
|
||||
//FML on client, send server hello
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package net.minecraftforge.fml.common.network.simpleimpl;
|
||||
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.network.simple.MessageContext;
|
||||
|
||||
/**
|
||||
* A message handler based on {@link IMessage}. Implement and override {@link #onMessage(IMessage, MessageContext)} to
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.network.simpleimpl;
|
||||
|
||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraft.network.NetHandlerPlayServer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
/**
|
||||
* Context for the {@link IMessageHandler}
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public class MessageContext {
|
||||
/**
|
||||
* The {@link INetHandler} for this message. It could be a client or server handler, depending
|
||||
* on the {@link #side} received.
|
||||
*/
|
||||
public final INetHandler netHandler;
|
||||
|
||||
/**
|
||||
* The Dist this message has been received on
|
||||
*/
|
||||
public final Dist side;
|
||||
/**
|
||||
* @param netHandler
|
||||
*/
|
||||
MessageContext(INetHandler netHandler, Dist side)
|
||||
{
|
||||
this.netHandler = netHandler;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
public NetHandlerPlayServer getServerHandler()
|
||||
{
|
||||
return (NetHandlerPlayServer) netHandler;
|
||||
}
|
||||
|
||||
public NetHandlerPlayClient getClientHandler()
|
||||
{
|
||||
return (NetHandlerPlayClient) netHandler;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
package net.minecraftforge.fml.common.network.simpleimpl;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import net.minecraftforge.fml.network.simple.MessageContext;
|
||||
|
||||
import net.minecraft.network.INetHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
|
||||
Reference in new issue
Block a user