Jump to content

Help with Coremod


M1kep

Recommended Posts

Hi, so I am trying to figure out how to use asm and coremods and I ran into a little problem, please help.

Console Log

2013-05-10 18:05:20 [iNFO] [ForgeModLoader] Forge Mod Loader version 5.2.5.686 for Minecraft 1.5.2 loading
2013-05-10 18:05:20 [iNFO] [ForgeModLoader] Java is Java HotSpot(TM) Client VM, version 1.6.0_43, running on Windows 7:x86:6.1, installed at D:\Program Files\Java\jdk1.6.0_43\jre
2013-05-10 18:05:20 [iNFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-05-10 18:05:20 [sEVERE] [ForgeModLoader] Unable to read the coremod jar file FoolsCraft.jar - ignoring
java.util.zip.ZipException: error in opening zip file
   at java.util.zip.ZipFile.open(Native Method)
   at java.util.zip.ZipFile.<init>(ZipFile.java:127)
   at java.util.jar.JarFile.<init>(JarFile.java:136)
   at java.util.jar.JarFile.<init>(JarFile.java:100)
   at cpw.mods.fml.relauncher.RelaunchLibraryManager.discoverCoreMods(RelaunchLibraryManager.java:358)
   at cpw.mods.fml.relauncher.RelaunchLibraryManager.handleLaunch(RelaunchLibraryManager.java:136)
   at cpw.mods.fml.relauncher.FMLRelauncher.setupHome(FMLRelauncher.java:172)
   at cpw.mods.fml.relauncher.FMLRelauncher.relaunchClient(FMLRelauncher.java:104)
   at cpw.mods.fml.relauncher.FMLRelauncher.handleClientRelaunch(FMLRelauncher.java:38)
   at net.minecraft.client.Minecraft.main(Minecraft.java:2236)
   at Start.main(Start.java:29)

FoolsCraftLoadingPlugin

package m1kep.foolscraft.asm;

import java.util.Map;

import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;

@TransformerExclusions({ "m1kep.foolscraft.asm" })
public class FoolsCraftLoadingPlugin implements IFMLLoadingPlugin {

   @Override
   public String[] getLibraryRequestClass() {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public String[] getASMTransformerClass() {
      // TODO Auto-generated method stub
      return new String[] { "m1kep.foolscraft.asm.FoolsCraftAccessTransformer" };
   }

   @Override
   public String getModContainerClass() {
      return "m1kep.foolscraft.asm.FoolsCraftModContainer";
   }

   @Override
   public String getSetupClass() {
      // TODO Auto-generated method stub
      return null;
   }

   @Override
   public void injectData(Map<String, Object> data) {
      // TODO Auto-generated method stub

   }

}

FoolsCraftAccessTransformer

package m1kep.foolscraft.asm;

import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import cpw.mods.fml.common.asm.transformers.AccessTransformer;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;

public class FoolsCraftAccessTransformer extends AccessTransformer {
   private static FoolsCraftAccessTransformer instance;
   private static List mapFiles = new LinkedList();

   public FoolsCraftAccessTransformer() throws IOException {
      super();
      instance = this;
      // add your access transformers here!
      mapFiles.add("FoolsCraft_at.cfg");
      Iterator it = mapFiles.iterator();
      while (it.hasNext()) {
         String file = (String) it.next();
         this.readMapFile(file);
      }

   }

   public static void addTransformerMap(String mapFileName) {
      if (instance == null) {
         mapFiles.add(mapFileName);
      } else {
         instance.readMapFile(mapFileName);
      }
   }

   private void readMapFile(String name) {
      System.out.println("Adding transformer map: " + name);
      try {
         // get a method from AccessTransformer
         Method e = AccessTransformer.class.getDeclaredMethod("readMapFile",
               new Class[] { String.class });
         e.setAccessible(true);
         // run it with the file given.
         e.invoke(this, new Object[] { name });

      } catch (Exception ex) {
         throw new RuntimeException(ex);
      }
   }

}

FoolsCraftModContainer

package m1kep.foolscraft.asm;

import java.util.Arrays;

import com.google.common.eventbus.Subscribe;

import net.minecraftforge.event.EventBus;
import cpw.mods.fml.common.DummyModContainer;
import cpw.mods.fml.common.LoadController;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.event.FMLServerStartingEvent;

public class FoolsCraftModContainer extends DummyModContainer {

   public FoolsCraftModContainer() {
      super(new ModMetadata());
      ModMetadata myMeta = super.getMetadata();
      myMeta.authorList = Arrays.asList(new String[] { "KeepCalm" });
      myMeta.description = "Only A Fool Would Play";
      myMeta.modId = "FoolsCraft";
      myMeta.version = "1.5.2";
      myMeta.name = "FoolsCraft";
   }

   public boolean registerBus(EventBus bus, LoadController controller) {
      bus.register(this);
      return true;
   }

   @Subscribe
   public void onServerStarting(FMLServerStartingEvent ev) {
      ev.getServer().worldServerForDimension(0).spawnHostileMobs = false;
   }
}

MANIFEST.MF

Manifest-Version: 1.0
FMLCorePlugin: m1kep.foolscraft.asm.FoolsCraftLoadingPlugin

FoolsCraft_at.cfg

public aab/E # spawnHostileMobs

The file directory of my jar is as follows

META-INF
     MANIFEST.MF
asm
     FoolsCraftModContainer.class
     FoolsCraftLoadingPlugin.class
     FoolsCraftAccessTransformer.class
FoolsCraft_at.cfg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.