Jump to content

Recommended Posts

Posted

EDIT: This seems to be a problem that only affects the Eclipse IDE. I have changed my *temporary* fix here to reflect the one being committed to the Forge core.

I was having a horrible time getting EnumHelper.addToolMaterial() to work for me, I must have looked at dozens of threads on various sites before I decided to see if the code itself was broken.

 

Skip to the header "The Fix" if you're not ready to hear me banter.

 

The Process

(Seemed like a fine name to me)

 

The amount of devil-worship that goes on inside this class is unspeakable. But I digress.

 

For those of you having issues getting around the following error output:

 

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader] Could not find $VALUES field for enum: net.minecraft.item.EnumToolMaterial

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader] Runtime Deobf: false

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader] Fields:

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    WOOD: net.minecraft.item.EnumToolMaterial

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    STONE: net.minecraft.item.EnumToolMaterial

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    IRON: net.minecraft.item.EnumToolMaterial

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    EMERALD: net.minecraft.item.EnumToolMaterial

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    GOLD: net.minecraft.item.EnumToolMaterial

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    harvestLevel: int

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    maxUses: int

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    efficiencyOnProperMaterial: float

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    damageVsEntity: int

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    enchantability: int

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    customCraftingMaterial: net.minecraft.item.Item

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    $SWITCH_TABLE$net$minecraft$item$EnumToolMaterial: [i

2013-04-03 23:13:03 [sEVERE] [ForgeModLoader]    ENUM$VALUES: [Lnet.minecraft.item.EnumToolMaterial;

 

 

I get this error for innocuously doing nothing but defining my material:

 

package mods.lantz;

 

import net.minecraft.item.EnumToolMaterial;

import net.minecraftforge.common.EnumHelper;

import cpw.mods.fml.common.*;

import cpw.mods.fml.common.Mod.*;

import cpw.mods.fml.common.event.*;

import cpw.mods.fml.common.network.*;

 

@Mod(modid = "Lantz", name = "Lantz' Mod", version = "0.0.0")

@NetworkMod(clientSideRequired=true, serverSideRequired=false)

public class Lantz

{

// The instance of your mod that Forge uses.

    @Instance("Lantz")

    public static Lantz instance;

   

    public static final EnumToolMaterial ADMANTIUM = EnumHelper.addToolMaterial("ADMANTIUM", 2, 2000, 8.0F, 2, 18);

   

    // Says where the client and server 'proxy' code is loaded.

    @SidedProxy(clientSide="mods.lantz.client.ClientProxy", serverSide="mods.lantz.CommonProxy")

    public static CommonProxy proxy;

   

    @PreInit

    public void preInit(FMLPreInitializationEvent event) {

            // Stub Method

    }

   

    @Init

    public void load(FMLInitializationEvent event) {

            proxy.registerRenderers();

    }

   

    @PostInit

    public void postInit(FMLPostInitializationEvent event) {

            // Stub Method

    }

}

 

 

I noticed that the last line in the error output mentioned a field named "ENUM$VALUES"

 

The Fix

 

So, I fixed the error by making the following change to EnumHelper:

// if (field.getName().equals("$VALUES")) // change to:
if (field.getName().equals("$VALUES") || field.getName().equals("ENUM$VALUES"))

 

And Voila, fixed.

 

Thoughts/Comments/Pitchforks?

Yes, my ideas can be naive. But I'm hoping that speaking my mind will inspire those who know what they are doing!

Posted

I'm glad to see that the fix had been committed.

 

Excuse my erratic knowledge of the bug base, I had trouble finding the bug previously. When will this change be available in a stable release?

Yes, my ideas can be naive. But I'm hoping that speaking my mind will inspire those who know what they are doing!

Posted

This change does not effect runtime at all this is purely a development time deal.

As it's the eclipse compiler that doesn't compile it to standard names.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Yes, I gathered that. Thanks Lex! ;D

Yes, my ideas can be naive. But I'm hoping that speaking my mind will inspire those who know what they are doing!

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.