Jump to content

Recommended Posts

Posted

I've spent counless hours of checking my code to see if i mispelled anything wrong but i didn't

My MineralzItems.init and

MineralzItems.register are still red for no freaking reason and I keep getting crash reports that doesnt make any sense.

I'm so frustated by those stupid problems i think i might give up making mods.

 

This are all the Classes I got so far.

 

Mineralz

package com.quizer9o8.mineralz;

import com.quizer9o8.mineralz.Reference.MineralzItems;
import com.quizer9o8.mineralz.proxy.CommonProxy;

import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class Mineralz {

@Instance
public static Mineralz instance;

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	System.out.println("Pre Init");

	MineralzItems.init();
	MineralzItems.register();
}

@EventHandler
public void init(FMLInitializationEvent event)
{
	System.out.println("Init");
	proxy.init();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
	System.out.println("Post Init");
}
}

 

Reference

package com.quizer9o8.mineralz;

import com.quizer9o8.mineralz.items.ItemAmethyst;

public class Reference {

public static final String MOD_ID = "mineralz";
public static final String NAME = "Mineralz";
public static final String VERSION = "1.0.0";
public static final String ACCEPTED_VERSIONS = "[1.9.4]";

public static final String CLIENT_PROXY_CLASS = "com.quizer9o8.mineralz.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "com.quizer9o8.mineralz.proxy.ServerProxy";

public static enum MineralzItems {
	AMETHYST("amethyst", "ItemAmethyst");

	private String unlocalizedName;
	private String registryName;

	MineralzItems(String unlocalizedName, String registryName) {
		this.unlocalizedName = unlocalizedName;
		this.registryName = registryName;
	}

	public String getUnlocalizedName(){
		return unlocalizedName;
	}

	public String getRegistryName(){
		return registryName;
	}
}
}

 

MineralzItems

package com.quizer9o8.mineralz.init;

import com.quizer9o8.mineralz.Reference;
import com.quizer9o8.mineralz.items.ItemAmethyst;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class MineralzItems {

public static Item amethyst;

public static void init() {
	amethyst = new ItemAmethyst();
}

public static void register() {
	GameRegistry.register(amethyst);

}

public static void registerRenders() {
	registerRender(amethyst);
}

private static void registerRender(Item item) {
	Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));
}
} 

 

ClientProxy

package com.quizer9o8.mineralz.proxy;

import com.quizer9o8.mineralz.init.MineralzItems;

public class ClientProxy implements CommonProxy {

@Override
public void init() {
MineralzItems.registerRenders();	
}          

}

 

CommonProxy

package com.quizer9o8.mineralz.proxy;

public interface CommonProxy {

public void init();
}

 

ServerProxy

package com.quizer9o8.mineralz.proxy;

public class ServerProxy implements CommonProxy {

@Override
public void init() {

}

}

 

Crash Report

---- Minecraft Crash Report ----
// I let you down. Sorry 

Time: 14-7-16 11:18
Description: There was a severe problem during mod loading that has caused the game to fail

net.minecraftforge.fml.common.LoaderException: java.lang.Error: Unresolved compilation problems: 
The method init() is undefined for the type Reference.MineralzItems
The method register() is undefined for the type Reference.MineralzItems

at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:179)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:589)
at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:249)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:475)
at net.minecraft.client.Minecraft.run(Minecraft.java:384)
at net.minecraft.client.main.Main.main(Main.java:118)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
at GradleStart.main(GradleStart.java:26)
Caused by: java.lang.Error: Unresolved compilation problems: 
The method init() is undefined for the type Reference.MineralzItems
The method register() is undefined for the type Reference.MineralzItems

at com.quizer9o8.mineralz.Mineralz.preInit(Mineralz.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:568)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:228)
at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:206)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:135)
at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:586)
... 16 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- System Details --
Details:
Minecraft Version: 1.9.4
Operating System: Windows 10 (amd64) version 10.0
Java Version: 1.8.0_92, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 831742760 bytes (793 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP 9.28 Powered by Forge 12.17.0.1976 4 mods loaded, 4 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored
UCH	mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) 
UCH	FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.9.4-12.17.0.1976.jar) 
UCH	Forge{12.17.0.1976} [Minecraft Forge] (forgeSrc-1.9.4-12.17.0.1976.jar) 
UCE	mineralz{1.0.0} [Mineralz] (bin) 
Loaded coremods (and transformers): 
GL info: ' Vendor: 'Intel' Version: '4.4.0 - Build 10.18.15.4278' Renderer: 'Intel(R) HD Graphics 5500'

Posted

Change the name of you static enum MineralzItems or your class MineralzItems. Since they are the same name and contain static properties the compiler can not figure out which one to use.

 

The error tells you.

 

The method init() is undefined for the type Reference.MineralzItems

 

init() is undefined for your enum MineralzItems which is in the class Reference.

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.