Fixed packet issue
This commit is contained in:
parent
841fcffcb1
commit
20ea00a0a7
3 changed files with 39 additions and 21 deletions
|
@ -10,6 +10,7 @@ import net.minecraft.network.packet.NetHandler;
|
||||||
import net.minecraft.network.packet.Packet1Login;
|
import net.minecraft.network.packet.Packet1Login;
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
@ -19,25 +20,6 @@ public class ConnectionHandler implements IConnectionHandler
|
||||||
@Override
|
@Override
|
||||||
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
|
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
|
try
|
||||||
{
|
{
|
||||||
Packet250CustomPayload packet = new Packet250CustomPayload();
|
Packet250CustomPayload packet = new Packet250CustomPayload();
|
||||||
|
@ -55,6 +37,37 @@ public class ConnectionHandler implements IConnectionHandler
|
||||||
{
|
{
|
||||||
//This shouldn't happen...
|
//This shouldn't happen...
|
||||||
e.printStackTrace();
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,4 +11,6 @@ public class PacketConstants
|
||||||
public static final byte DELETE_DIM_PACKET_ID = 3;
|
public static final byte DELETE_DIM_PACKET_ID = 3;
|
||||||
public static final byte CREATE_LINK_PACKET_ID = 4;
|
public static final byte CREATE_LINK_PACKET_ID = 4;
|
||||||
public static final byte DELETE_LINK_PACKET_ID = 5;
|
public static final byte DELETE_LINK_PACKET_ID = 5;
|
||||||
|
public static final byte CLIENT_LOGIN_DIM_REGISTER = 6;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -672,19 +672,22 @@ public class PocketManager
|
||||||
}
|
}
|
||||||
public static void readPacket(DataInputStream input) throws IOException
|
public static void readPacket(DataInputStream input) throws IOException
|
||||||
{
|
{
|
||||||
|
//TODO- figure out why this is getting called so frequently
|
||||||
if (isLoaded)
|
if (isLoaded)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Pocket dimensions have already been loaded!");
|
return;
|
||||||
}
|
}
|
||||||
if (isLoading)
|
if (isLoading)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Pocket dimensions are already loading!");
|
throw new IllegalStateException("Pocket dimensions are already loading!");
|
||||||
}
|
}
|
||||||
// Load compacted client-side dimension data
|
// Load compacted client-side dimension data
|
||||||
|
load();
|
||||||
Compactor.readDimensions(input, new DimRegistrationCallback());
|
Compactor.readDimensions(input, new DimRegistrationCallback());
|
||||||
|
|
||||||
// Register pocket dimensions
|
// Register pocket dimensions
|
||||||
DDProperties properties = DDProperties.instance();
|
DDProperties properties = DDProperties.instance();
|
||||||
|
|
||||||
registerPockets(properties);
|
registerPockets(properties);
|
||||||
|
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
|
Loading…
Reference in a new issue