Overhauled Server-Side Packet Handling
Threw out the complicated architecture that I'd made for synchronizing server and client data perfectly. Instead, we now send just enough data to the client and the resulting code is simpler. Some of the client-side code is also done so all packet handling should be finished soon.
This commit is contained in:
@@ -11,7 +11,6 @@ import net.minecraft.network.packet.Packet1Login;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.messages.IDataMessage;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
@@ -41,12 +40,11 @@ public class ConnectionHandler implements IConnectionHandler
|
||||
//Send information about all the registered dimensions and links to the client
|
||||
try
|
||||
{
|
||||
IDataMessage message = PocketManager.getState();
|
||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||
DataOutputStream writer = new DataOutputStream(buffer);
|
||||
writer.writeByte(PacketConstants.CLIENT_JOIN_PACKET_ID);
|
||||
message.writeToStream(writer);
|
||||
PocketManager.writePacket(writer);
|
||||
writer.close();
|
||||
packet.channel = PacketConstants.CHANNEL_NAME;
|
||||
packet.data = buffer.toByteArray();
|
||||
|
||||
Reference in New Issue
Block a user