From 20ea00a0a70a7975762feb94d75ed77eb82f563a Mon Sep 17 00:00:00 2001 From: StevenRS11 Date: Mon, 11 Nov 2013 16:36:35 -0500 Subject: [PATCH] Fixed packet issue --- .../mod_pocketDim/ConnectionHandler.java | 53 ++++++++++++------- .../mod_pocketDim/PacketConstants.java | 2 + .../mod_pocketDim/core/PocketManager.java | 5 +- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java index 07a0b778..6e0a163c 100644 --- a/StevenDimDoors/mod_pocketDim/ConnectionHandler.java +++ b/StevenDimDoors/mod_pocketDim/ConnectionHandler.java @@ -10,6 +10,7 @@ import net.minecraft.network.packet.NetHandler; import net.minecraft.network.packet.Packet1Login; import net.minecraft.network.packet.Packet250CustomPayload; import net.minecraft.server.MinecraftServer; +import net.minecraft.server.integrated.IntegratedServer; import StevenDimDoors.mod_pocketDim.core.PocketManager; import cpw.mods.fml.common.network.IConnectionHandler; import cpw.mods.fml.common.network.Player; @@ -19,25 +20,6 @@ public class ConnectionHandler implements IConnectionHandler @Override public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) { - return null; - } - - @Override - public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { } - - @Override - public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { } - - @Override - public void connectionClosed(INetworkManager manager) { } - - @Override - public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { } - - @Override - public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) - { - //Send information about all the registered dimensions and links to the client try { Packet250CustomPayload packet = new Packet250CustomPayload(); @@ -55,6 +37,37 @@ public class ConnectionHandler implements IConnectionHandler { //This shouldn't happen... e.printStackTrace(); - } + } + return null; + } + + @Override + public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) + { + + } + + @Override + public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) + { + + } + + @Override + public void connectionClosed(INetworkManager manager) + { + return; + } + + @Override + public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) + { + return; + } + + @Override + public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) + { + } } \ No newline at end of file diff --git a/StevenDimDoors/mod_pocketDim/PacketConstants.java b/StevenDimDoors/mod_pocketDim/PacketConstants.java index 847a5b09..cc172083 100644 --- a/StevenDimDoors/mod_pocketDim/PacketConstants.java +++ b/StevenDimDoors/mod_pocketDim/PacketConstants.java @@ -11,4 +11,6 @@ public class PacketConstants public static final byte DELETE_DIM_PACKET_ID = 3; public static final byte CREATE_LINK_PACKET_ID = 4; public static final byte DELETE_LINK_PACKET_ID = 5; + public static final byte CLIENT_LOGIN_DIM_REGISTER = 6; + } diff --git a/StevenDimDoors/mod_pocketDim/core/PocketManager.java b/StevenDimDoors/mod_pocketDim/core/PocketManager.java index 334b0b97..2b0358a6 100644 --- a/StevenDimDoors/mod_pocketDim/core/PocketManager.java +++ b/StevenDimDoors/mod_pocketDim/core/PocketManager.java @@ -672,19 +672,22 @@ public class PocketManager } public static void readPacket(DataInputStream input) throws IOException { + //TODO- figure out why this is getting called so frequently if (isLoaded) { - throw new IllegalStateException("Pocket dimensions have already been loaded!"); + return; } if (isLoading) { throw new IllegalStateException("Pocket dimensions are already loading!"); } // Load compacted client-side dimension data + load(); Compactor.readDimensions(input, new DimRegistrationCallback()); // Register pocket dimensions DDProperties properties = DDProperties.instance(); + registerPockets(properties); isLoaded = true;