Progress on Rewriting Packet Handling
Continued building a system for transferring the complete internal states of our dimensions from the server to the client. However, Steven suggested that clients only need minimal data to operate properly, as opposed to the server. My motivation for this more complicated system was the concern that minimal information wouldn't be enough. I'm going to commit my progress, then tear it down and write a much simpler version.
This commit is contained in:
@@ -7,8 +7,8 @@ import java.io.IOException;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.IOpaqueMessage;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
|
||||
import StevenDimDoors.mod_pocketDim.messages.IDataMessage;
|
||||
import StevenDimDoors.mod_pocketDim.messages.IUpdateWatcher;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
@@ -30,19 +30,19 @@ public class ServerPacketHandler implements IPacketHandler
|
||||
private class DimWatcher implements IUpdateWatcher
|
||||
{
|
||||
@Override
|
||||
public void onCreated(IOpaqueMessage message)
|
||||
public void onCreated(IDataMessage message)
|
||||
{
|
||||
sendMessageToAllPlayers(PacketConstants.CREATE_DIM_PACKET_ID, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdated(IOpaqueMessage message)
|
||||
public void onUpdated(IDataMessage message)
|
||||
{
|
||||
sendMessageToAllPlayers(PacketConstants.UPDATE_DIM_PACKET_ID, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(IOpaqueMessage message)
|
||||
public void onDeleted(IDataMessage message)
|
||||
{
|
||||
sendMessageToAllPlayers(PacketConstants.DELETE_DIM_PACKET_ID, message);
|
||||
}
|
||||
@@ -51,25 +51,25 @@ public class ServerPacketHandler implements IPacketHandler
|
||||
private class LinkWatcher implements IUpdateWatcher
|
||||
{
|
||||
@Override
|
||||
public void onCreated(IOpaqueMessage message)
|
||||
public void onCreated(IDataMessage message)
|
||||
{
|
||||
sendMessageToAllPlayers(PacketConstants.CREATE_LINK_PACKET_ID, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdated(IOpaqueMessage message)
|
||||
public void onUpdated(IDataMessage message)
|
||||
{
|
||||
sendMessageToAllPlayers(PacketConstants.UPDATE_LINK_PACKET_ID, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeleted(IOpaqueMessage message)
|
||||
public void onDeleted(IDataMessage message)
|
||||
{
|
||||
sendMessageToAllPlayers(PacketConstants.DELETE_LINK_PACKET_ID, message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendMessageToAllPlayers(byte id, IOpaqueMessage message)
|
||||
private static void sendMessageToAllPlayers(byte id, IDataMessage message)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user