Fixed network code
Everything seems to work fine now
This commit is contained in:
parent
c08fa15f40
commit
3376c1d772
2 changed files with 16 additions and 11 deletions
|
@ -173,12 +173,19 @@ public class PocketManager
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
|
|
||||||
dimensionData = new HashMap<Integer, InnerDimData>();
|
dimensionData = new HashMap<Integer, InnerDimData>();
|
||||||
rootDimensions = new ArrayList<NewDimData>();
|
rootDimensions = new ArrayList<NewDimData>();
|
||||||
dimensionIDBlackList = new ArrayList<Integer>();
|
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
|
//Register Limbo
|
||||||
DDProperties properties = DDProperties.instance();
|
DDProperties properties = DDProperties.instance();
|
||||||
registerDimension(properties.LimboDimensionID, null, false, false);
|
registerDimension(properties.LimboDimensionID, null, false, false);
|
||||||
|
@ -531,10 +538,6 @@ public class PocketManager
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Pocket dimensions are already loading!");
|
throw new IllegalStateException("Pocket dimensions are already loading!");
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoading = true;
|
|
||||||
dimensionData = new HashMap<Integer, InnerDimData>();
|
|
||||||
|
|
||||||
// Load compacted client-side dimension data
|
// Load compacted client-side dimension data
|
||||||
Compactor.readDimensions(input, new DimRegistrationCallback());
|
Compactor.readDimensions(input, new DimRegistrationCallback());
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,17 @@ import java.io.DataInputStream;
|
||||||
|
|
||||||
import net.minecraft.network.INetworkManager;
|
import net.minecraft.network.INetworkManager;
|
||||||
import net.minecraft.network.packet.Packet250CustomPayload;
|
import net.minecraft.network.packet.Packet250CustomPayload;
|
||||||
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
import StevenDimDoors.mod_pocketDim.PacketConstants;
|
import StevenDimDoors.mod_pocketDim.PacketConstants;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.watcher.IUpdateSource;
|
import StevenDimDoors.mod_pocketDim.watcher.IUpdateSource;
|
||||||
import StevenDimDoors.mod_pocketDim.watcher.IUpdateWatcher;
|
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.IPacketHandler;
|
||||||
import cpw.mods.fml.common.network.Player;
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public class ClientPacketHandler implements IPacketHandler, IUpdateSource
|
public class ClientPacketHandler implements IPacketHandler, IUpdateSource
|
||||||
{
|
{
|
||||||
|
@ -38,9 +41,8 @@ public class ClientPacketHandler implements IPacketHandler, IUpdateSource
|
||||||
if (!packet.channel.equals(PacketConstants.CHANNEL_NAME))
|
if (!packet.channel.equals(PacketConstants.CHANNEL_NAME))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If this is a memory connection, then our client is running an integrated server.
|
//Checking memory connection wasnt working for some reason, but this seems to work fine.
|
||||||
// We can tell by checking if packet size is 0.
|
if (FMLCommonHandler.instance().getMinecraftServerInstance() instanceof IntegratedServer)
|
||||||
if (manager.packetSize() == 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
Loading…
Add table
Reference in a new issue