diff --git a/common/net/minecraftforge/common/MinecraftForge.java b/common/net/minecraftforge/common/MinecraftForge.java index d6b533c7ef..04ba622980 100644 --- a/common/net/minecraftforge/common/MinecraftForge.java +++ b/common/net/minecraftforge/common/MinecraftForge.java @@ -1,11 +1,14 @@ package net.minecraftforge.common; +import java.lang.reflect.Constructor; import java.util.*; import net.minecraft.src.*; import net.minecraftforge.common.ForgeHooks.GrassEntry; import net.minecraftforge.common.ForgeHooks.SeedEntry; import net.minecraftforge.event.EventBus; +import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.EntityEvent; public class MinecraftForge { @@ -170,14 +173,17 @@ public class MinecraftForge Block filler = null; try { - filler = Block.class.getConstructor(int.class, Material.class).newInstance(256, Material.air); - }catch (Exception e){} - - if (filler == null) - { - throw new RuntimeException("Could not create Forge filler block"); + Constructor ctr = Block.class.getDeclaredConstructor(int.class, Material.class); + ctr.setAccessible(true); + filler = (Block)ctr.newInstance(256, Material.air); } - + catch (Exception e) + { + RuntimeException rte = new RuntimeException("Could not create Forge filler block", e); + rte.printStackTrace(); + System.exit(1); + } + for (int x = 256; x < 4096; x++) { if (Item.itemsList[x - 256] != null) diff --git a/common/net/minecraftforge/transformers/EventTransformer.java b/common/net/minecraftforge/transformers/EventTransformer.java index 2b5290156d..b0da8011cc 100644 --- a/common/net/minecraftforge/transformers/EventTransformer.java +++ b/common/net/minecraftforge/transformers/EventTransformer.java @@ -59,6 +59,7 @@ public class EventTransformer implements IClassTransformer boolean hasSetup = false; boolean hasGetListenerList = false; + boolean hasDefaultCtr = false; Type tList = Type.getType(ListenerList.class); @@ -68,13 +69,18 @@ public class EventTransformer implements IClassTransformer method.desc.equals(Type.getMethodDescriptor(VOID_TYPE)) && (method.access & ACC_PROTECTED) == ACC_PROTECTED) { - hasSetup = true; + hasSetup = true; } if (method.name.equals("getListenerList") && - method.desc.equals(Type.getMethodDescriptor(tList)) && - (method.access & ACC_PUBLIC) == ACC_PUBLIC) + method.desc.equals(Type.getMethodDescriptor(tList)) && + (method.access & ACC_PUBLIC) == ACC_PUBLIC) { - hasGetListenerList = true; + hasGetListenerList = true; + } + if (method.name.equals("") && + method.desc.equals(Type.getMethodDescriptor(VOID_TYPE))) + { + hasDefaultCtr = true; } } @@ -94,7 +100,22 @@ public class EventTransformer implements IClassTransformer //Add private static ListenerList LISTENER_LIST classNode.fields.add(new FieldNode(ACC_PRIVATE | ACC_STATIC, "LISTENER_LIST", tList.getDescriptor(), null, null)); - + + /*Add: + * public () + * { + * super(); + * } + */ + MethodNode method = new MethodNode(ASM4, ACC_PUBLIC, "", getMethodDescriptor(VOID_TYPE), null, null); + method.instructions.add(new VarInsnNode(ALOAD, 0)); + method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "", getMethodDescriptor(VOID_TYPE))); + method.instructions.add(new InsnNode(RETURN)); + if (!hasDefaultCtr) + { + classNode.methods.add(method); + } + /*Add: * protected void setup() * { @@ -106,7 +127,7 @@ public class EventTransformer implements IClassTransformer * LISTENER_LIST = new ListenerList(super.getListenerList()); * } */ - MethodNode method = new MethodNode(ASM4, ACC_PROTECTED, "setup", getMethodDescriptor(VOID_TYPE), null, null); + method = new MethodNode(ASM4, ACC_PROTECTED, "setup", getMethodDescriptor(VOID_TYPE), null, null); method.instructions.add(new VarInsnNode(ALOAD, 0)); method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "setup", getMethodDescriptor(VOID_TYPE))); method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", tList.getDescriptor())); diff --git a/fml-src-3.0.10.243.zip b/fml-src-3.0.15.247.zip similarity index 94% rename from fml-src-3.0.10.243.zip rename to fml-src-3.0.15.247.zip index 9eca692d54..3352c4f739 100644 Binary files a/fml-src-3.0.10.243.zip and b/fml-src-3.0.15.247.zip differ diff --git a/forge.py b/forge.py index ab3a650b2f..8ee135df31 100644 --- a/forge.py +++ b/forge.py @@ -89,16 +89,12 @@ def apply_forge_patches(fml_dir, mcp_dir, forge_dir, src_dir, copy_files=True): if has_client: if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft')): apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft'), src_dir) - if os.path.isdir(os.path.join(forge_dir, 'patches', 'common')): - apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'common'), src_dir, '/common/', '/minecraft/') if copy_files and os.path.isdir(os.path.join(forge_dir, 'client')): copytree(os.path.join(forge_dir, 'client'), os.path.join(src_dir, 'minecraft')) if has_server: if os.path.isdir(os.path.join(forge_dir, 'patches', 'minecraft_server')): apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'minecraft_server'), src_dir) - if os.path.isdir(os.path.join(forge_dir, 'patches', 'common')): - apply_patches(mcp_dir, os.path.join(forge_dir, 'patches', 'common'), src_dir, '/common/', '/minecraft_server/') if copy_files and os.path.isdir(os.path.join(forge_dir, 'server')): copytree(os.path.join(forge_dir, 'server'), os.path.join(src_dir, 'minecraft_server'))