Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -17,6 +17,7 @@ import net.minecraftforge.common.network.ForgePacket;
|
||||
import net.minecraftforge.common.network.packet.DimensionRegisterPacket;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.watcher.ClientDimData;
|
||||
import cpw.mods.fml.common.network.IConnectionHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
|
||||
@@ -31,10 +32,11 @@ public class ConnectionHandler implements IConnectionHandler
|
||||
{
|
||||
Packet250CustomPayload[] pkt = ForgePacket.makePacketSet(new DimensionRegisterPacket(data.id(), DimensionManager.getProviderType(data.id())));
|
||||
manager.addToSendQueue(pkt[0]);
|
||||
|
||||
}
|
||||
catch(Exception E)
|
||||
{
|
||||
|
||||
E.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +66,7 @@ public class ConnectionHandler implements IConnectionHandler
|
||||
@Override
|
||||
public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager)
|
||||
{
|
||||
//Send information about all the registered dimensions and links to the client
|
||||
PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.getDimensionData(0)));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -100,6 +100,8 @@ public class EventHookContainer
|
||||
Point4D destination = new Point4D((int) (coords.posX+entity.posX), coords.posY, (int) (coords.posZ+entity.posZ ), mod_pocketDim.properties.LimboDimensionID);
|
||||
DDTeleporter.teleportEntity(player, destination, false);
|
||||
player.setHealth(player.getMaxHealth());
|
||||
player.extinguish();
|
||||
player.clearActivePotions();
|
||||
event.setCanceled(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ public class DDTeleporter
|
||||
{
|
||||
// We need to do all this special stuff to move a player between dimensions.
|
||||
//Give the client the dimensionData for the destination
|
||||
PocketManager.dimWatcher.onCreated(new ClientDimData(PocketManager.getDimensionData(destination.getDimension())));
|
||||
PocketManager.getDimwatcher().onCreated(new ClientDimData(PocketManager.getDimensionData(destination.getDimension())));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -214,8 +214,8 @@ public class PocketManager
|
||||
* Set as true if we are a client that has connected to a dedicated server
|
||||
*/
|
||||
public static volatile boolean isConnected = false;
|
||||
public static final UpdateWatcherProxy<ClientLinkData> linkWatcher = new UpdateWatcherProxy<ClientLinkData>();
|
||||
static final UpdateWatcherProxy<ClientDimData> dimWatcher = new UpdateWatcherProxy<ClientDimData>();
|
||||
private static final UpdateWatcherProxy<ClientLinkData> linkWatcher = new UpdateWatcherProxy<ClientLinkData>();
|
||||
private static final UpdateWatcherProxy<ClientDimData> dimWatcher = new UpdateWatcherProxy<ClientDimData>();
|
||||
private static ArrayList<NewDimData> rootDimensions = null;
|
||||
|
||||
//HashMap that maps all the dimension IDs registered with DimDoors to their DD data.
|
||||
@@ -253,6 +253,7 @@ public class PocketManager
|
||||
//Shouldnt try to load everything if we are a client
|
||||
//This was preventing onPacket from loading properly
|
||||
isLoading=false;
|
||||
isLoaded=true;
|
||||
return;
|
||||
}
|
||||
//Register Limbo
|
||||
@@ -298,7 +299,7 @@ public class PocketManager
|
||||
|
||||
}
|
||||
PocketManager.dimensionData.put(dimData.id, dimData);
|
||||
dimWatcher.onCreated(new ClientDimData(dimData));
|
||||
getDimwatcher().onCreated(new ClientDimData(dimData));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -340,7 +341,7 @@ public class PocketManager
|
||||
|
||||
dimensionData.remove(dimensionID);
|
||||
// Raise the dim deleted event
|
||||
dimWatcher.onDeleted(new ClientDimData(dimension));
|
||||
getDimwatcher().onDeleted(new ClientDimData(dimension));
|
||||
dimension.clear();
|
||||
return true;
|
||||
}
|
||||
@@ -530,7 +531,7 @@ public class PocketManager
|
||||
{
|
||||
rootDimensions.add(dimension);
|
||||
}
|
||||
dimWatcher.onCreated(new ClientDimData(dimension));
|
||||
getDimwatcher().onCreated(new ClientDimData(dimension));
|
||||
|
||||
return dimension;
|
||||
}
|
||||
@@ -656,12 +657,11 @@ public class PocketManager
|
||||
}
|
||||
public static void registerDimWatcher(IUpdateWatcher<ClientDimData> watcher)
|
||||
{
|
||||
dimWatcher.registerReceiver(watcher);
|
||||
getDimwatcher().registerReceiver(watcher);
|
||||
}
|
||||
|
||||
public static boolean unregisterDimWatcher(IUpdateWatcher<ClientDimData> watcher)
|
||||
{
|
||||
return dimWatcher.unregisterReceiver(watcher);
|
||||
return getDimwatcher().unregisterReceiver(watcher);
|
||||
}
|
||||
|
||||
public static void registerLinkWatcher(IUpdateWatcher<ClientLinkData> watcher)
|
||||
@@ -721,4 +721,9 @@ public class PocketManager
|
||||
isLoading = false;
|
||||
isConnected = true;
|
||||
}
|
||||
|
||||
public static UpdateWatcherProxy<ClientDimData> getDimwatcher()
|
||||
{
|
||||
return dimWatcher;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user