Jump to content

Recommended Posts

Posted

hey guys, im trying to make a coremod for 1.6.2 but when i insert the coremod into the mods folders and launch the game i get a ClassNotFoundException on cpw.mods.fml.common.asm.FMLSanityChecker

 

my log:

 

  Reveal hidden contents

 

 

my IFMLoadingPlugin:

package com.hydroflame.asm2;

import java.io.File;
import java.util.Map;

import cpw.mods.fml.relauncher.IFMLLoadingPlugin;

public class ForgeRevCore implements IFMLLoadingPlugin{

public static File location;
@Override
@Deprecated
public String[] getLibraryRequestClass() {
	return null;
}

@Override
public String[] getASMTransformerClass() {
	System.out.println("returning the transformer class");
	return new String[]{ForgeRevTransformer.class.getName()};
}

@Override
public String getModContainerClass() {
	return null;
}

@Override
public String getSetupClass() {
	return null;
}

@Override
public void injectData(Map<String, Object> data) {
	System.out.println("setting the location file");
	location = (File) data.get("coremodLocation");
}

}

 

transformer class:

package com.hydroflame.asm2;

import java.io.File;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

import net.minecraft.launchwrapper.IClassTransformer;

public class ForgeRevTransformer implements IClassTransformer {

@Override
public byte[] transform(String name, String obfName, byte[] bytecode) {
	if (name.equals("net.minecraft.client.Minecraft")||name.equals("ats")) {
		bytecode = patchClassInJar(name, bytecode, obfName, ForgeRevCore.location);
	}
	return null;
}

private byte[] patchClassInJar(String name, byte[] bytes, String ObfName,
		File location) {
	try {
		// open the jar as zip
		ZipFile zip = new ZipFile(location);
		// find the file inside the zip that is called te.class or
		// net.minecraft.entity.monster.EntityCreeper.class
		// replacing the . to / so it would look for
		// net/minecraft/entity/monster/EntityCreeper.class
		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("[" + "ForgeRevCore" + "]: " + "Class "+ name + " patched!");
		}
		zip.close();
	} catch (Exception e) {
		throw new RuntimeException("Error overriding " + name + " from "+ location.getName(), e);
	}

	// return the new bytes
	return bytes;
}

}

 

coremod.jar structure:

*META-INF

**MANIFEST.MF

*ats.class

*net

**minecraft

***client

****Minecraft.class

 

i looked into versions/1.6.2-Forge9.10.0.804 and effectivelly the class is not there but i used the installer.

 

not sure why/where i screwed up

 

i based my method off this tutorial:

http://www.minecraftforum.net/topic/1854988-tutorial-162-changing-vanilla-without-editing-base-classes-coremods-and-events-very-advanced/

the "replcaing a whole miencraft class" part

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

i might be wrong but i kindof doubt that because it would mean that people would HAVE to add option to launch. Afaik mods/coremods are suppose to be a drag n drop thing and adding this kind of option inside the coremod wouldnt make sens as java is already launched when this file is read.

 

maybe im wrong though

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

From Optifine installation:

Click "Edit Profile"

- Select the checkbox "JVM Arguments" and in the field next to it add

"-Dfml.ignoreInvalidMinecraftCertificates=true -Dfml.ignorePatchDiscrepancies=true"

- Click "Save Profile"

Posted

because im pretty sure that its not required as i havnt seen mention of that anywhere

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
  On 8/4/2013 at 11:32 PM, GotoLink said:

Are you sure you can return null there ?

@Override
public String getModContainerClass() {
	return null;
}

@Override
public String getSetupClass() {
	return null;
}

 

Mod container class is only required if you want to have mod metadata. In which case he doesn't (I know this because I do). Stup class... I made a coremod for 1.6.2 and didn't have that running either. So no its not needed. A coremod is like a paxel. It is a lot of different functions all put together. In this case though, all those methods are like the mould needed for the paxel, but I only want the shovel part of it. I also only have that mould. So I only fill in the shovel section. Simple as that.

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Posted

ding ding ding, bonus point to GotoLink because im an idiot who cant search properly, i am returning null in my transform method meaning every class that gets through will be erased causing the class to simply not exists

 

xD derp mode enabled

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
  On 8/5/2013 at 12:50 AM, GotoLink said:

Well maybe you can help him more than i ?

 

I found this thread with same issue here

 

Not really :P

 

  Quote

ding ding ding, bonus point to GotoLink because im an idiot who cant search properly, i am returning null in my transform method meaning every class that gets through will be erased causing the class to simply not exists

 

xD derp mode enabled

 

Well, not quite the methods that affected the transformer classes, but still. Good call Gotolink :D

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Posted

Forge has a coremods folder in the .minecraft directory. I'm pretty sure your mod should go in there. In your main post, you stated that you placed the mod in the mods folder.

Posted

all good ^^

 

to future reader, if you need to change "net.minecraft.client.Minecraft" via ASM, good luck ^^ i was never able to do it i foudn another way around doing what i wanted (version 1.6.2)

at least its not feasable via replacing the whole class

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • just rewatched the tutorial and my code is exactly the same as kaupenjoe's.  the item is added into the game but like i said to start it doesnt have a texture or a proper name for whatever reason.
    • yes the name is en_us.json and it is in resources -> assests -> testmod -> lang folders.  i have checked my code and am pretty confident that the code itself is correct.  i even tried loading the project in eclipse and it has the same problems, I think i will just rewatch the whole tutorial and will give an update on the situation.
    • same error, I also tried removing Valkyrian skies as well because I noticed it coming up a lot in the debug log errors
    • Hey man,    i have only been modding Minecraft for a few days but maybe I can help you. First of all make sure to follow every step of Kaupenjoe's tutorial, I found it to been very helpful and complete. The game uses the raw translation key for the item (in your case "item.testmod.alexandrite") if it can't find the correct lang file. Make sure it's name is "en_us.json" and it is saved under "ressources" -> "assets" -> "testmod".
    • whenever I try to get this item to render into the game it appears with the not texture purple and black squares and calls itself by the lang translation file path instead of the name i gave it.   { "item.testmod.alexandrite": "Alexandrite" } this is the lang json file package net.Hurst.testmod.item; import net.Hurst.testmod.TestMod; import net.minecraft.world.item.Item; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class ModItems { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, TestMod.MOD_ID); public static final RegistryObject<Item> ALEXANDRITE = ITEMS.register("alexandrite", () -> new Item(new Item.Properties())); public static void register(IEventBus eventBus){ ITEMS.register(eventBus); } } this is my ModItems.java file package net.Hurst.testmod; import com.mojang.logging.LogUtils; import net.Hurst.testmod.item.ModItems; import net.minecraft.world.item.CreativeModeTabs; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.BuildCreativeModeTabContentsEvent; import net.minecraftforge.event.server.ServerStartingEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.slf4j.Logger; // The value here should match an entry in the META-INF/mods.toml file @Mod(TestMod.MOD_ID) public class TestMod { public static final String MOD_ID = "testmod"; private static final Logger LOGGER = LogUtils.getLogger(); public TestMod() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(this::commonSetup); ModItems.register(modEventBus); MinecraftForge.EVENT_BUS.register(this); modEventBus.addListener(this::addCreative); ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, Config.SPEC); } private void commonSetup(final FMLCommonSetupEvent event) { } // Add the example block item to the building blocks tab private void addCreative(BuildCreativeModeTabContentsEvent event) { if(event.getTabKey() == CreativeModeTabs.INGREDIENTS){ event.accept(ModItems.ALEXANDRITE); } } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(ServerStartingEvent event) { } // You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent @Mod.EventBusSubscriber(modid = MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public static class ClientModEvents { @SubscribeEvent public static void onClientSetup(FMLClientSetupEvent event) { } } } this is my TestMod.java file { "parent": "minecraft:item/generated", "textures": { "layer0": "testmod:item/generated" } } this is my model file for the item. I am using intellij 2025.1.2 with fdk 1.21 and java 21 I would appreciate the help.
  • Topics

×
×
  • Create New...

Important Information

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