From 0806bc7b2290c956bf79525d67938d4768a89e93 Mon Sep 17 00:00:00 2001 From: Chicken Bones Date: Thu, 23 Aug 2012 06:28:53 +1000 Subject: [PATCH 01/12] Added IPlayerTracker hooks --- .../cpw/mods/fml/common/IPlayerTracker.java | 9 +++-- .../fml/common/registry/GameRegistry.java | 31 +++++++++++++++++ .../src/ServerConfigurationManager.java.patch | 33 +++++++++++++++++-- 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/IPlayerTracker.java b/fml/common/cpw/mods/fml/common/IPlayerTracker.java index 1d404b582..8e4bdc744 100644 --- a/fml/common/cpw/mods/fml/common/IPlayerTracker.java +++ b/fml/common/cpw/mods/fml/common/IPlayerTracker.java @@ -14,13 +14,16 @@ 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); } diff --git a/fml/common/cpw/mods/fml/common/registry/GameRegistry.java b/fml/common/cpw/mods/fml/common/registry/GameRegistry.java index 384a0527b..5336622c4 100644 --- a/fml/common/cpw/mods/fml/common/registry/GameRegistry.java +++ b/fml/common/cpw/mods/fml/common/registry/GameRegistry.java @@ -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 craftingHandlers = Lists.newArrayList(); private static List dispenserHandlers = Lists.newArrayList(); private static List pickupHandlers = Lists.newArrayList(); + private static List 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); + } } diff --git a/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch b/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch index 43721e8c0..e99e49e40 100644 --- a/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch +++ b/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch @@ -1,20 +1,47 @@ --- ../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,8 @@ } p_72355_2_.func_71116_b(); -+ FMLNetworkHandler.handlePlayerLogin(p_72355_2_, var6, p_72355_1_); ++ FMLNetworkHandler.handlePlayerLogin(p_72355_2_, var6, p_72355_1_); ++ GameRegistry.onPlayerLogin(p_72355_2_); } public void func_72364_a(WorldServer[] p_72364_1_) +@@ -153,6 +159,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 +308,7 @@ + var7.func_72838_d(var6); + this.field_72404_b.add(var6); + var6.func_71116_b(); ++ GameRegistry.onPlayerRespawn(var6); + return var6; + } + +@@ -380,6 +388,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() From fe263206e2af3a495491433e3457c19f62b15b0f Mon Sep 17 00:00:00 2001 From: Chicken Bones Date: Thu, 23 Aug 2012 06:31:00 +1000 Subject: [PATCH 02/12] FML will now search '/forge/accesstransformers' for user defined access transformer config files to be applied during forge setup --- fml/install/fml.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fml/install/fml.py b/fml/install/fml.py index c02b3c829..3cf11f045 100644 --- a/fml/install/fml.py +++ b/fml/install/fml.py @@ -217,6 +217,13 @@ def setup_fml(fml_dir, mcp_dir): if os.path.isfile(forge_cfg): 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) From ebc1aea5d2880a6f6bae5cb006bbb2767aef0487 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 09:43:32 -0400 Subject: [PATCH 03/12] Null protection for ticks() -- probably should uses EnumSet.noneOf() but you can also use null now to stop ticking. closes #77 --- .../cpw/mods/fml/common/FMLCommonHandler.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/FMLCommonHandler.java b/fml/common/cpw/mods/fml/common/FMLCommonHandler.java index a24d3d5ee..c8eaf5a91 100644 --- a/fml/common/cpw/mods/fml/common/FMLCommonHandler.java +++ b/fml/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -29,6 +29,7 @@ import net.minecraft.src.ServerListenThread; import net.minecraft.src.ThreadServerApplication; import net.minecraft.src.World; +import com.google.common.base.Objects; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; @@ -96,7 +97,7 @@ public class FMLCommonHandler } for (IScheduledTickHandler ticker : scheduledTicks) { - EnumSet ticksToRun = EnumSet.copyOf(ticker.ticks()); + EnumSet ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class))); ticksToRun.removeAll(EnumSet.complementOf(ticks)); if (!ticksToRun.isEmpty()) { @@ -115,7 +116,7 @@ public class FMLCommonHandler } for (IScheduledTickHandler ticker : scheduledTicks) { - EnumSet ticksToRun = EnumSet.copyOf(ticker.ticks()); + EnumSet ticksToRun = EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class))); ticksToRun.removeAll(EnumSet.complementOf(ticks)); if (!ticksToRun.isEmpty()) { @@ -166,9 +167,9 @@ public class FMLCommonHandler /** * Return the effective side for the context in the game. This is dependent - * on thread analysis to try and determine whether the code is running in the + * on thread analysis to try and determine whether the code is running in the * server or not. Use at your own risk - * + * * @return */ public Side getEffectiveSide() @@ -178,7 +179,7 @@ public class FMLCommonHandler { return Side.SERVER; } - + return Side.CLIENT; } /** @@ -391,7 +392,7 @@ public class FMLCommonHandler { crashCallables.add(callable); } - + public void enhanceCrashReport(CrashReport crashReport) { for (ICrashCallable call: crashCallables) From 5330afb78eea2e966548bbc46ebc674903969a8a Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 11:12:26 -0400 Subject: [PATCH 04/12] Update build to not bother building client jar. Universal is everything now. --- fml/build.xml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/fml/build.xml b/fml/build.xml index bb28586dc..24c6459dd 100644 --- a/fml/build.xml +++ b/fml/build.xml @@ -89,7 +89,7 @@ - + @@ -137,11 +137,7 @@ - - - - - + @@ -171,7 +167,7 @@ - + @@ -352,7 +348,7 @@ - + From 550c206997ff605278dcd52041261a25c208cce8 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 11:48:30 -0400 Subject: [PATCH 05/12] Fix LAN to try hard to find a real network interface, not just localhost most of the time --- .../IntegratedServerListenThread.java.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 fml/patches/minecraft/net/minecraft/src/IntegratedServerListenThread.java.patch diff --git a/fml/patches/minecraft/net/minecraft/src/IntegratedServerListenThread.java.patch b/fml/patches/minecraft/net/minecraft/src/IntegratedServerListenThread.java.patch new file mode 100644 index 000000000..4d909ffab --- /dev/null +++ b/fml/patches/minecraft/net/minecraft/src/IntegratedServerListenThread.java.patch @@ -0,0 +1,49 @@ +--- ../src-base/minecraft/net/minecraft/src/IntegratedServerListenThread.java ++++ ../src-work/minecraft/net/minecraft/src/IntegratedServerListenThread.java +@@ -4,6 +4,12 @@ + import cpw.mods.fml.common.asm.SideOnly; + import java.io.IOException; + import java.net.InetAddress; ++import java.net.NetworkInterface; ++import java.util.Collections; ++ ++import com.google.common.collect.Iterators; ++import com.google.common.collect.Lists; ++ + import net.minecraft.server.MinecraftServer; + + @SideOnly(Side.CLIENT) +@@ -48,7 +54,32 @@ + + try + { +- this.field_71757_g = new ServerListenThread(this, InetAddress.getLocalHost(), var1); ++ InetAddress add = null; ++ NetworkInterface notLocal = null; ++ for (NetworkInterface ni : Collections.list(NetworkInterface.getNetworkInterfaces())) ++ { ++ if (!ni.isLoopback() && ni.isUp()) ++ { ++ notLocal = ni; ++ break; ++ } ++ } ++ if (notLocal != null) ++ { ++ for (InetAddress inadd : Collections.list(notLocal.getInetAddresses())) ++ { ++ if (inadd.getAddress().length == 4) ++ { ++ add = inadd; ++ break; ++ } ++ } ++ } ++ if (add == null) ++ { ++ add = InetAddress.getLocalHost(); ++ } ++ this.field_71757_g = new ServerListenThread(this, add, var1); + this.field_71757_g.start(); + } + catch (IOException var3) From be7b413beca25a47e9b1d60717fe9c1a7342bdb1 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 11:50:03 -0400 Subject: [PATCH 06/12] Move villager trading hook up a bit. thanks sengir. --- .../common/net/minecraft/src/EntityVillager.java.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fml/patches/common/net/minecraft/src/EntityVillager.java.patch b/fml/patches/common/net/minecraft/src/EntityVillager.java.patch index 57abc0897..1a56302ac 100644 --- a/fml/patches/common/net/minecraft/src/EntityVillager.java.patch +++ b/fml/patches/common/net/minecraft/src/EntityVillager.java.patch @@ -18,12 +18,12 @@ } } -@@ -400,6 +402,8 @@ +@@ -393,6 +395,8 @@ + func_70949_b(var2, Item.field_77782_ar.field_77779_bT, this.field_70146_Z, 0.3F); + func_70949_b(var2, Item.field_77734_bj.field_77779_bT, this.field_70146_Z, 0.3F); } - - Collections.shuffle(var2); + + VillagerRegistry.manageVillagerTrades(var2, this, this.func_70946_n(), this.field_70146_Z); - if (this.field_70963_i == null) + if (var2.isEmpty()) { From d544e56ec372703507e0eb93e47f899c09662616 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 15:11:43 -0400 Subject: [PATCH 07/12] Add in a helper on the server start event for adding commands to the server. --- .../cpw/mods/fml/common/event/FMLServerStartingEvent.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fml/common/cpw/mods/fml/common/event/FMLServerStartingEvent.java b/fml/common/cpw/mods/fml/common/event/FMLServerStartingEvent.java index 9cfec4b72..d9c8ff6e5 100644 --- a/fml/common/cpw/mods/fml/common/event/FMLServerStartingEvent.java +++ b/fml/common/cpw/mods/fml/common/event/FMLServerStartingEvent.java @@ -1,6 +1,8 @@ package cpw.mods.fml.common.event; import net.minecraft.server.MinecraftServer; +import net.minecraft.src.CommandHandler; +import net.minecraft.src.ICommand; import cpw.mods.fml.common.LoaderState.ModState; public class FMLServerStartingEvent extends FMLStateEvent @@ -23,4 +25,10 @@ public class FMLServerStartingEvent extends FMLStateEvent { return server; } + + public void registerServerCommand(ICommand command) + { + CommandHandler ch = (CommandHandler) getServer().func_71187_D(); + ch.func_71560_a(command); + } } From 5233ae520dd6c056b04b050c9f5f90e2dc066a11 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 15:11:59 -0400 Subject: [PATCH 08/12] Fix up entity spawning - hopefully they won't warp anymore. --- fml/client/cpw/mods/fml/client/FMLClientHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fml/client/cpw/mods/fml/client/FMLClientHandler.java b/fml/client/cpw/mods/fml/client/FMLClientHandler.java index 908ad06ec..fefcc5d5d 100644 --- a/fml/client/cpw/mods/fml/client/FMLClientHandler.java +++ b/fml/client/cpw/mods/fml/client/FMLClientHandler.java @@ -278,7 +278,7 @@ public class FMLClientHandler implements IFMLSidedHandler } entity.field_70157_k = packet.entityId; - entity.func_70056_a(packet.scaledX, packet.scaledY, packet.scaledZ, packet.scaledYaw, packet.scaledPitch, 1); + entity.func_70012_b(packet.scaledX, packet.scaledY, packet.scaledZ, packet.scaledYaw, packet.scaledPitch); if (entity instanceof EntityLiving) { From af104b81f29e738b91964aab66aab721c6b808cc Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 17:27:06 -0400 Subject: [PATCH 09/12] Fix textures not applying properly --- .../cpw/mods/fml/client/FMLTextureFX.java | 3 +- .../net/minecraft/src/ModTextureStatic.java | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/fml/client/cpw/mods/fml/client/FMLTextureFX.java b/fml/client/cpw/mods/fml/client/FMLTextureFX.java index 7f088181e..a2091c6a7 100644 --- a/fml/client/cpw/mods/fml/client/FMLTextureFX.java +++ b/fml/client/cpw/mods/fml/client/FMLTextureFX.java @@ -22,6 +22,7 @@ import net.minecraft.src.RenderEngine; import net.minecraft.src.TextureFX; import net.minecraft.src.TexturePackBase; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; public class FMLTextureFX extends TextureFX implements ITextureFX { @@ -30,7 +31,7 @@ public class FMLTextureFX extends TextureFX implements ITextureFX public int tileSizeMask = 15; public int tileSizeSquareMask = 255; public boolean errored = false; - protected Logger log = FMLCommonHandler.instance().getFMLLogger(); + protected Logger log = FMLLog.getLogger(); public FMLTextureFX(int icon) { diff --git a/fml/client/net/minecraft/src/ModTextureStatic.java b/fml/client/net/minecraft/src/ModTextureStatic.java index e11112781..86e695873 100644 --- a/fml/client/net/minecraft/src/ModTextureStatic.java +++ b/fml/client/net/minecraft/src/ModTextureStatic.java @@ -33,30 +33,30 @@ public class ModTextureStatic extends FMLTextureFX private int storedSize; private BufferedImage overrideData = null; private int needApply = 2; - - + + public ModTextureStatic(int icon, int target, BufferedImage image) { this(icon, 1, target, image); } - public ModTextureStatic(int icon, int size, int target, BufferedImage image) + public ModTextureStatic(int icon, int size, int target, BufferedImage image) { this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image); } - + public ModTextureStatic(int icon, int size, String target, BufferedImage image) { super(icon); RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o; - + targetTex = target; storedSize = size; field_76849_e = size; field_76847_f = re.func_78341_b(target); overrideData = image; } - + @Override public void setup() { @@ -80,16 +80,17 @@ public class ModTextureStatic extends FMLTextureFX update(); } - - public void func_783_a() + + @Override + public void func_76846_a() { if (oldanaglyph != field_76851_c) { update(); } - // This makes it so we only apply the texture to the target texture when we need to, - //due to the fact that update is called when the Effect is first registered, we actually - //need to wait for the next one. + // This makes it so we only apply the texture to the target texture when we need to, + //due to the fact that update is called when the Effect is first registered, we actually + //need to wait for the next one. field_76849_e = (needApply == 0 ? 0 : storedSize); if (needApply > 0) { @@ -97,11 +98,12 @@ public class ModTextureStatic extends FMLTextureFX } } - public void func_782_a(RenderEngine p_782_1_) + @Override + public void func_76845_a(RenderEngine p_76845_1_) { - GL11.glBindTexture(GL_TEXTURE_2D, p_782_1_.func_78341_b(targetTex)); + GL11.glBindTexture(GL_TEXTURE_2D, p_76845_1_.func_78341_b(targetTex)); } - + public void update() { needApply = 2; @@ -126,7 +128,7 @@ public class ModTextureStatic extends FMLTextureFX oldanaglyph = field_76851_c; } - + //Implementation of http://scale2x.sourceforge.net/algorithm.html public static BufferedImage scale2x(BufferedImage image) { @@ -170,9 +172,9 @@ public class ModTextureStatic extends FMLTextureFX return tmp; } - + @Override - public String toString() + public String toString() { return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b); } From 9bfa7acf0d82ee6a8452fac455ddc50a89a14cc9 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 17:36:26 -0400 Subject: [PATCH 10/12] More precise error handling when an invalid class is present --- .../common/discovery/DirectoryDiscoverer.java | 7 +++++++ .../fml/common/discovery/JarDiscoverer.java | 12 +++++++++++- .../common/discovery/asm/ASMModParser.java | 19 +++++++++++++++---- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java index c8a8f3999..055786a6e 100644 --- a/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/DirectoryDiscoverer.java @@ -5,12 +5,14 @@ import java.io.FileFilter; import java.io.FileInputStream; import java.util.Arrays; import java.util.List; +import java.util.logging.Level; import java.util.regex.Matcher; import com.google.common.base.Throwables; import com.google.common.collect.Lists; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.MetadataCollection; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainerFactory; @@ -85,6 +87,11 @@ public class DirectoryDiscoverer implements ITypeDiscoverer modParser = new ASMModParser(fis); fis.close(); } + catch (LoaderException e) + { + FMLLog.log(Level.SEVERE, e, "There was a problem reading the file %s - probably this is a corrupt file", file.getPath()); + throw e; + } catch (Exception e) { Throwables.propagate(e); diff --git a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java index a8bcd7cd6..7d021fc83 100644 --- a/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java +++ b/fml/common/cpw/mods/fml/common/discovery/JarDiscoverer.java @@ -10,6 +10,7 @@ import java.util.zip.ZipFile; import com.google.common.collect.Lists; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.MetadataCollection; import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainerFactory; @@ -44,7 +45,16 @@ public class JarDiscoverer implements ITypeDiscoverer Matcher match = classFile.matcher(ze.getName()); if (match.matches()) { - ASMModParser modParser = new ASMModParser(jar.getInputStream(ze)); + ASMModParser modParser; + try + { + modParser = new ASMModParser(jar.getInputStream(ze)); + } + catch (LoaderException e) + { + FMLLog.log(Level.SEVERE, e, "There was a problem reading the entry %s in the jar %s - probably a corrupt zip", ze.getName(), candidate.getModContainer().getPath()); + throw e; + } modParser.validate(); modParser.sendToTable(table, candidate); ModContainer container = ModContainerFactory.instance().build(modParser, candidate.getModContainer(), candidate); diff --git a/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java b/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java index 02058276a..03254c3f3 100644 --- a/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java +++ b/fml/common/cpw/mods/fml/common/discovery/asm/ASMModParser.java @@ -3,6 +3,7 @@ package cpw.mods.fml.common.discovery.asm; import java.io.IOException; import java.io.InputStream; import java.util.LinkedList; +import java.util.logging.Level; import net.minecraft.src.BaseMod; @@ -12,6 +13,8 @@ import org.objectweb.asm.Type; import com.google.common.base.Objects; import com.google.common.collect.Lists; +import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.discovery.ASMDataTable; import cpw.mods.fml.common.discovery.ModCandidate; @@ -31,8 +34,16 @@ public class ASMModParser public ASMModParser(InputStream stream) throws IOException { - ClassReader reader = new ClassReader(stream); - reader.accept(new ModClassVisitor(this), 0); + try + { + ClassReader reader = new ClassReader(stream); + reader.accept(new ModClassVisitor(this), 0); + } + catch (Exception ex) + { + FMLLog.log(Level.SEVERE, ex, "Unable to read a class file correctly"); + throw new LoaderException(ex); + } } public void beginNewTypeName(String typeQName, int classVersion, String superClassQName) @@ -132,13 +143,13 @@ public class ASMModParser public void addAnnotationEnumProperty(String name, String desc, String value) { annotations.getFirst().addEnumProperty(name, desc, value); - + } public void endArray() { annotations.getFirst().endArray(); - + } public void addSubAnnotation(String name, String desc) From 8f6883da8e0f1ca60e277e45cb2aa7eb65ec4567 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 17:58:46 -0400 Subject: [PATCH 11/12] Tweak patches and hooks slightly --- .../mods/fml/common/network/FMLNetworkHandler.java | 2 ++ .../src/ServerConfigurationManager.java.patch | 13 ++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java b/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java index 80a990198..687ebc43c 100644 --- a/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java +++ b/fml/common/cpw/mods/fml/common/network/FMLNetworkHandler.java @@ -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 getNetworkIdMap() diff --git a/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch b/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch index e99e49e40..5dce1c86d 100644 --- a/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch +++ b/fml/patches/common/net/minecraft/src/ServerConfigurationManager.java.patch @@ -11,16 +11,15 @@ import net.minecraft.server.MinecraftServer; public abstract class ServerConfigurationManager -@@ -80,6 +84,8 @@ +@@ -80,6 +84,7 @@ } p_72355_2_.func_71116_b(); -+ FMLNetworkHandler.handlePlayerLogin(p_72355_2_, var6, p_72355_1_); -+ GameRegistry.onPlayerLogin(p_72355_2_); ++ FMLNetworkHandler.handlePlayerLogin(p_72355_2_, var6, p_72355_1_); } public void func_72364_a(WorldServer[] p_72364_1_) -@@ -153,6 +159,7 @@ +@@ -153,6 +158,7 @@ public void func_72367_e(EntityPlayerMP p_72367_1_) { @@ -28,7 +27,7 @@ this.func_72391_b(p_72367_1_); WorldServer var2 = p_72367_1_.func_71121_q(); var2.func_72900_e(p_72367_1_); -@@ -301,6 +308,7 @@ +@@ -301,6 +307,7 @@ var7.func_72838_d(var6); this.field_72404_b.add(var6); var6.func_71116_b(); @@ -36,11 +35,11 @@ return var6; } -@@ -380,6 +388,8 @@ +@@ -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_); } From 908a57f3c475d36acd05cc9592147a668badf180 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 22 Aug 2012 18:00:38 -0400 Subject: [PATCH 12/12] Fix formatting --- fml/common/cpw/mods/fml/common/IPlayerTracker.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fml/common/cpw/mods/fml/common/IPlayerTracker.java b/fml/common/cpw/mods/fml/common/IPlayerTracker.java index 8e4bdc744..eff8c7844 100644 --- a/fml/common/cpw/mods/fml/common/IPlayerTracker.java +++ b/fml/common/cpw/mods/fml/common/IPlayerTracker.java @@ -23,7 +23,10 @@ import net.minecraft.src.EntityPlayer; public interface IPlayerTracker { void onPlayerLogin(EntityPlayer player); + void onPlayerLogout(EntityPlayer player); + void onPlayerChangedDimension(EntityPlayer player); - void onPlayerRespawn(EntityPlayer player); + + void onPlayerRespawn(EntityPlayer player); }