Fixed network code

Everything seems to work fine now
This commit is contained in:
StevenRS11 2013-10-16 19:48:45 -04:00
parent c08fa15f40
commit 3376c1d772
2 changed files with 16 additions and 11 deletions

View file

@ -173,12 +173,19 @@ public class PocketManager
{
return;
}
isLoading = true;
dimensionData = new HashMap<Integer, InnerDimData>();
rootDimensions = new ArrayList<NewDimData>();
dimensionIDBlackList = new ArrayList<Integer>();
if(FMLCommonHandler.instance().getEffectiveSide().isClient())
{
//Shouldnt try to load everything if we are a client
//This was preventing onPacket from loading properly
isLoading=false;
return;
}
//Register Limbo
DDProperties properties = DDProperties.instance();
registerDimension(properties.LimboDimensionID, null, false, false);
@ -531,10 +538,6 @@ public class PocketManager
{
throw new IllegalStateException("Pocket dimensions are already loading!");
}
isLoading = true;
dimensionData = new HashMap<Integer, InnerDimData>();
// Load compacted client-side dimension data
Compactor.readDimensions(input, new DimRegistrationCallback());

View file

@ -5,14 +5,17 @@ import java.io.DataInputStream;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.server.integrated.IntegratedServer;
import StevenDimDoors.mod_pocketDim.PacketConstants;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.util.Point4D;
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
import StevenDimDoors.mod_pocketDim.watcher.IUpdateSource;
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
public class ClientPacketHandler implements IPacketHandler, IUpdateSource
{
@ -38,9 +41,8 @@ public class ClientPacketHandler implements IPacketHandler, IUpdateSource
if (!packet.channel.equals(PacketConstants.CHANNEL_NAME))
return;
// If this is a memory connection, then our client is running an integrated server.
// We can tell by checking if packet size is 0.
if (manager.packetSize() == 0)
//Checking memory connection wasnt working for some reason, but this seems to work fine.
if (FMLCommonHandler.instance().getMinecraftServerInstance() instanceof IntegratedServer)
return;
try