Moved the onlogin network message to do what it should have been doing
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package StevenDimDoors.mod_pocketDim;
|
||||
|
||||
import StevenDimDoors.mod_pocketDim.network.ClientJoinPacket;
|
||||
import StevenDimDoors.mod_pocketDim.network.DimDoorsNetwork;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -42,17 +43,14 @@ public class ConnectionHandler
|
||||
@SubscribeEvent
|
||||
public void connectionClosed(FMLNetworkEvent.ClientDisconnectionFromServerEvent event)
|
||||
{
|
||||
if(PocketManager.isConnected)
|
||||
{
|
||||
PocketManager.unload();
|
||||
}
|
||||
PocketManager.tryUnload();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerLoggedIn(PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
// Hax... please don't do this! >_<
|
||||
PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.createDimensionDataDangerously(0)));
|
||||
DimDoorsNetwork.sendToPlayer(new ClientJoinPacket(), event.player);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -119,10 +119,9 @@ public class EventHookContainer
|
||||
// fires before we can use DimensionManager and onServerStarting fires
|
||||
// after the game tries to generate terrain. If a gateway tries to
|
||||
// generate before PocketManager has initialized, we get a crash.
|
||||
if (!PocketManager.isLoaded())
|
||||
if (!event.world.isRemote && !PocketManager.isLoaded())
|
||||
{
|
||||
PocketManager.load();
|
||||
PocketManager.isConnected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -629,6 +629,13 @@ public class PocketManager
|
||||
return (ArrayList<NewDimData>) rootDimensions.clone();
|
||||
}
|
||||
|
||||
public static void tryUnload() {
|
||||
if (isConnected)
|
||||
unload();
|
||||
isLoading = false;
|
||||
isLoaded = false;
|
||||
}
|
||||
|
||||
public static void unload()
|
||||
{
|
||||
System.out.println("Unloading Pocket Dimensions...");
|
||||
|
||||
@@ -33,11 +33,11 @@ public class Compactor
|
||||
{
|
||||
output.writeInt(dimension.id());
|
||||
output.writeInt(dimension.root().id());
|
||||
output.writeInt(dimension.type().index);
|
||||
output.writeInt(dimension.linkCount());
|
||||
for (DimLink link : dimension.links())
|
||||
{
|
||||
Point4D.write(link.source(), output);
|
||||
output.writeInt(link.orientation());
|
||||
(new ClientLinkData(link)).write(output);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user