Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello, so title says it all. I tried creating a mod without @ Mod annotation by extending the main class with DummyModContainer. My code looks like this:

TestMod.java (Main class)

package me.vert3xo.testmod;

import com.google.common.eventbus.EventBus;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.LoadController;
import net.minecraftforge.fml.common.ModMetadata;

import java.util.Collections;

public class TestMod extends DummyModContainer {

    public static final String MOD_ID = "testmod";
    public static final String MOD_NAME = "Test Mod";
    public static final String VERSION = "1.0";

    public TestMod() {
        super(new ModMetadata());
        ModMetadata meta = getMetadata();
        meta.modId = MOD_ID;
        meta.name = MOD_NAME;
        meta.version = VERSION;
        meta.authorList = Collections.singletonList("Vert3xo");
    }

    @Override
    public boolean registerBus(EventBus bus, LoadController controller) {
        return true;
    }

}

ModLoader.java (implements IFMLLoadingPlugin)

package me.vert3xo.testmod;

import me.vert3xo.testmod.asm.ClassTransformer;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;

import java.util.Map;

@IFMLLoadingPlugin.Name("Test Mod")
@IFMLLoadingPlugin.MCVersion("1.8.9")
public class ModLoader implements IFMLLoadingPlugin {
    @Override
    public String[] getASMTransformerClass() {
        return new String[]{
                ClassTransformer.class.getName()
        };
    }

    @Override
    public String getModContainerClass() {
        return TestMod.class.getName();
    }

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

    @Override
    public void injectData(Map<String, Object> data) {

    }

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

ClassTransformer.java (implements IClassTransformer)

package me.vert3xo.testmod.asm;

import net.minecraft.launchwrapper.IClassTransformer;

public class ClassTransformer implements IClassTransformer {
    @Override
    public byte[] transform(String s, String s1, byte[] bytes) {
        return new byte[0];
    }
}

And I have also added this to my build.gradle (copied it from MouseDelayFix mod)

jar
        {
            manifest
                    {
                        attributes("FMLCorePlugin": "me.vert3xo.testmod.ModLoader")
                    }
        }

With this ^ in my build.gradle I can't even start the client, it gives me this error message:

Execution failed for task ':runClient'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_241\bin\java.exe'' finished with non-zero exit value 1

For now I don't want this mod to do anything, I just want to see "4 mods loaded" when I run the client. What am I doing wrong (except trying to even do this without much experience)?

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.