The Error log was full log.
I followed coolgooner's tutorial,
and this is my code:
StellarClassTransformer:
package stellarium.core;
import java.io.*;
import java.util.zip.*;
import cpw.mods.fml.relauncher.IClassTransformer;
public class StellarClassTransformer implements IClassTransformer {
@Override
public byte[] transform(String name, String transformedName, byte[] bytes) {
if (name.equals("acn") || name.equals("net.minecraft.world.WorldProvider")) {
System.out.println("********* INSIDE WorldProvider TRANSFORMER ABOUT TO PATCH: " + name);
bytes = patchClassInJar(name, bytes, name, StellarLoadingPlugin.location);
}
if (name.equals("bfq") || name.equals("net.minecraft.client.renderer.EntityRenderer")) {
System.out.println("********* INSIDE EntityRenderer TRANSFORMER ABOUT TO PATCH: " + name);
bytes = patchClassInJar(name, bytes, name, StellarLoadingPlugin.location);
}
return bytes;
}
public byte[] patchClassInJar(String name, byte[] bytes, String ObfName, File location) {
try {
//open the jar as zip
ZipFile zip = new ZipFile(location);
ZipEntry entry = zip.getEntry(name.replace('.', '/') + ".class");
if (entry == null) {
System.out.println(name + " not found in " + location.getName());
} else {
//serialize the class file into the bytes array
InputStream zin = zip.getInputStream(entry);
bytes = new byte[(int) entry.getSize()];
zin.read(bytes);
zin.close();
System.out.println("[" + "StellariumCore" + "]: " + "Class " + name + " patched!");
}
zip.close();
} catch (Exception e) {
throw new RuntimeException("Error overriding " + name + " from " + location.getName(), e);
}
//return the new bytes
return bytes;
}
}
StellarLoadingPlugin:
package stellarium.core;
import java.io.File;
import java.util.Map;
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
public class StellarLoadingPlugin implements IFMLLoadingPlugin {
public static File location;
@Override
public String[] getLibraryRequestClass() {
// TODO Auto-generated method stub
return null;
}
@Override
public String[] getASMTransformerClass() {
return new String[]{StellarClassTransformer.class.getName()};
}
@Override
public String getModContainerClass() {
// TODO Auto-generated method stub
return StellarDummyContainer.class.getName();
}
@Override
public String getSetupClass() {
// TODO Auto-generated method stub
return null;
}
@Override
public void injectData(Map<String, Object> data) {
location = (File) data.get("coremodLocation");
}
}
StellarDummyContainer:
package stellarium.core;
import java.util.Arrays;
import com.google.common.eventbus.Subscribe;
import com.google.common.eventbus.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.FMLConstructionEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
public class StellarDummyContainer extends DummyModContainer {
public StellarDummyContainer() {
super(new ModMetadata());
ModMetadata meta = getMetadata();
meta.modId = "StellariumCore";
meta.name = "StellariumCore";
meta.version = "0.0.0";
meta.credits = "Not Decided";
meta.authorList = Arrays.asList("Abastro");
meta.description = "";
meta.url = "http://blog.naver.com/abab9579";
meta.updateUrl = "";
meta.screenshots = new String[0];
meta.logoFile = "";
}
@Override
public boolean registerBus(EventBus bus, LoadController controller) {
bus.register(this);
return true;
}
@Subscribe
public void modConstruction(FMLConstructionEvent evt){
}
@Subscribe
public void preInit(FMLPreInitializationEvent evt) {
}
@Subscribe
public void init(FMLInitializationEvent evt) {
}
@Subscribe
public void postInit(FMLPostInitializationEvent evt) {
}
}