Jump to content

Eclipse Error - The method is undefined for the type


Recommended Posts

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.

Posted

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.

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.