Merge ChickenBones pull into FML - adds player trackers
This commit is contained in:
commit
213cc63eca
5 changed files with 77 additions and 5 deletions
|
@ -14,13 +14,19 @@
|
|||
|
||||
package cpw.mods.fml.common;
|
||||
|
||||
import net.minecraft.src.EntityPlayer;
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
*
|
||||
*/
|
||||
public interface IPlayerTracker
|
||||
{
|
||||
void onPlayerLogin(Object player);
|
||||
void onPlayerLogout(Object player);
|
||||
void onPlayerChangedDimension(Object player);
|
||||
void onPlayerLogin(EntityPlayer player);
|
||||
|
||||
void onPlayerLogout(EntityPlayer player);
|
||||
|
||||
void onPlayerChangedDimension(EntityPlayer player);
|
||||
|
||||
void onPlayerRespawn(EntityPlayer player);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import cpw.mods.fml.common.ModContainer;
|
|||
import cpw.mods.fml.common.discovery.ASMDataTable;
|
||||
import cpw.mods.fml.common.network.FMLPacket.Type;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration;
|
||||
|
||||
public class FMLNetworkHandler
|
||||
|
@ -246,6 +247,7 @@ public class FMLNetworkHandler
|
|||
public static void handlePlayerLogin(EntityPlayerMP player, NetServerHandler netHandler, NetworkManager manager)
|
||||
{
|
||||
NetworkRegistry.instance().playerLoggedIn(player, netHandler, manager);
|
||||
GameRegistry.onPlayerLogin(player);
|
||||
}
|
||||
|
||||
public Map<Integer, NetworkModHandler> getNetworkIdMap()
|
||||
|
|
|
@ -29,6 +29,7 @@ import cpw.mods.fml.common.ICraftingHandler;
|
|||
import cpw.mods.fml.common.IDispenseHandler;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.IPickupNotifier;
|
||||
import cpw.mods.fml.common.IPlayerTracker;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderException;
|
||||
|
@ -45,6 +46,7 @@ public class GameRegistry
|
|||
private static List<ICraftingHandler> craftingHandlers = Lists.newArrayList();
|
||||
private static List<IDispenseHandler> dispenserHandlers = Lists.newArrayList();
|
||||
private static List<IPickupNotifier> pickupHandlers = Lists.newArrayList();
|
||||
private static List<IPlayerTracker> playerTrackers = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Register a world generator - something that inserts new block types into the world
|
||||
|
@ -259,4 +261,33 @@ public class GameRegistry
|
|||
notify.notifyPickup(item, player);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerPlayerTracker(IPlayerTracker tracker)
|
||||
{
|
||||
playerTrackers.add(tracker);
|
||||
}
|
||||
|
||||
public static void onPlayerLogin(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerLogin(player);
|
||||
}
|
||||
|
||||
public static void onPlayerLogout(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerLogout(player);
|
||||
}
|
||||
|
||||
public static void onPlayerChangedDimension(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerChangedDimension(player);
|
||||
}
|
||||
|
||||
public static void onPlayerRespawn(EntityPlayer player)
|
||||
{
|
||||
for(IPlayerTracker tracker : playerTrackers)
|
||||
tracker.onPlayerRespawn(player);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,6 +218,13 @@ def setup_fml(fml_dir, mcp_dir):
|
|||
self.logger.info(' Forge config detected')
|
||||
forkcmd += ' "%s"' % forge_cfg
|
||||
|
||||
for dirname, dirnames, filenames in os.walk(os.path.join(mcp_dir, 'forge', 'accesstransformers')):
|
||||
for filename in filenames:
|
||||
accesstransformer = os.path.join(dirname, filename)
|
||||
if os.path.isfile(accesstransformer):
|
||||
self.logger.info(' Access Transformer "%s" detected' % filename)
|
||||
forkcmd += ' "%s"' % accesstransformer
|
||||
|
||||
if not runcmd(self, forkcmd):
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
--- ../src-base/common/net/minecraft/src/ServerConfigurationManager.java
|
||||
+++ ../src-work/common/net/minecraft/src/ServerConfigurationManager.java
|
||||
@@ -11,6 +11,9 @@
|
||||
@@ -11,6 +11,10 @@
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
+
|
||||
+import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||
+import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
+import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public abstract class ServerConfigurationManager
|
||||
@@ -80,6 +83,7 @@
|
||||
@@ -80,6 +84,7 @@
|
||||
}
|
||||
|
||||
p_72355_2_.func_71116_b();
|
||||
|
@ -18,3 +19,28 @@
|
|||
}
|
||||
|
||||
public void func_72364_a(WorldServer[] p_72364_1_)
|
||||
@@ -153,6 +158,7 @@
|
||||
|
||||
public void func_72367_e(EntityPlayerMP p_72367_1_)
|
||||
{
|
||||
+ GameRegistry.onPlayerLogout(p_72367_1_);
|
||||
this.func_72391_b(p_72367_1_);
|
||||
WorldServer var2 = p_72367_1_.func_71121_q();
|
||||
var2.func_72900_e(p_72367_1_);
|
||||
@@ -301,6 +307,7 @@
|
||||
var7.func_72838_d(var6);
|
||||
this.field_72404_b.add(var6);
|
||||
var6.func_71116_b();
|
||||
+ GameRegistry.onPlayerRespawn(var6);
|
||||
return var6;
|
||||
}
|
||||
|
||||
@@ -380,6 +387,8 @@
|
||||
PotionEffect var13 = (PotionEffect)var14.next();
|
||||
p_72356_1_.field_71135_a.func_72567_b(new Packet41EntityEffect(p_72356_1_.field_70157_k, var13));
|
||||
}
|
||||
+
|
||||
+ GameRegistry.onPlayerChangedDimension(p_72356_1_);
|
||||
}
|
||||
|
||||
public void func_72374_b()
|
||||
|
|
Loading…
Reference in a new issue