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! Well, I've been following Wuppy's modding tutorial and Eclipse has thrown me an error. I cannot seem to find what I'm missing.

I made a new class and my intention is to define the new class in the main one.

 

package com.aphex.tutorial;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

@Mod(modid = AphexMod.MODID, version = AphexMod.VERSION)
public class AphexMod
{
    public static final String MODID = "aphexmod";
    public static final String VERSION = "1.0";
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event)
    {
    	
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	AphexMod.addRecipes(); /* Error lies here */
    }

@EventHandler
    public void postInit(FMLPostInitializationEvent event)
    {
    	
    }
}

 

Here is the main class ^^

 

package com.aphex.tutorial;

import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class AphexRecipe
{

public static void addRecipes()
{

GameRegistry.addRecipe(new ItemStack(Items.oak_door, 1),
		" WW", 
		"W  ", 
		"  W", 
		'W', new ItemStack(Items.iron_ingot));

GameRegistry.addSmelting(new ItemStack(Items.oak_door), new ItemStack(Items.diamond_sword, 1), 1F);

}

}

 

^^ The recipe class.

 

Error - "The method addRecipes() is undefined for the type AphexMod. Any help appreciated.

You're trying to call

AphexMod.addRecipes

; but

AphexMod

doesn't have an

addRecipes

method,

AphexRecipe

does.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

Thank you so much, Choonster! It's embarrassing to admit that the tutorial does in fact show this. My only excuse is that it's 5.30am!

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...

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.