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