1

What is wrong with this code?

oceanimus 9/24/13 8:22 am
774
9/24/2013 12:03 pm
Trying to make custom armour but an error keeps popping up here in main.class :
public static Item BaconHelmet = new baconarmor(2009,armorBacon,0,0).setUnlocalizedName("BaconHelmet");
public static Item BaconChestplate = new baconarmor(2009,armorBacon,0,1).setUnlocalizedName("BaconChestplaete");
public static Item BaconLeggings = new baconarmor(2009,armorBacon,0,2).setUnlocalizedName("BaconLeggins");
public static Item BaconBoots = new baconarmor(2009,armorBacon,0,3).setUnlocalizedName("BaconBoots");

Main Class File
Click to reveal
package Bacon;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler; // used in 1.6.2
//import cpw.mods.fml.common.Mod.PreInit; // used in 1.5.2
//import cpw.mods.fml.common.Mod.Init; // used in 1.5.2
//import cpw.mods.fml.common.Mod.PostInit; // used in 1.5.2
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="BaconMod", name="BaconMod", version="0.5.0")
@NetworkMod(clientSideRequired=true)
public class main {
public final static Block BaconOre = new BaconBlock(500, Material.rock)
.setHardness(4.0F).setStepSound(Block.soundStoneFootstep)
.setUnlocalizedName("BaconOre").setCreativeTab(CreativeTabs.tabBlock);
public final static Item BaconIngot = new BaconItem(4200).setUnlocalizedName("BaconIngot").setMaxStackSize(16).setCreativeTab(CreativeTabs.tabMisc);
public static EnumToolMaterial toolBacon = EnumHelper.addToolMaterial("BACONTOOL", 3, 1000, 8.0f, 10.0f, 30);
public final static Block leaf = new Leaf(756,Material.leaves);
//start
public static Item BaconPick = new BaconPick(2000 ,toolBacon).setUnlocalizedName("BaconPick");
public static Item BaconSword = new BaconSword(2001,toolBacon).setUnlocalizedName("BaconSword");
public static Item BaconAxe = new BaconAxe(2002,toolBacon).setUnlocalizedName("BaconAxe");
public static Item BaconSpade = new BaconSpade(2003, toolBacon).setUnlocalizedName("BaconSpade");
public static Item BaconHoe = new BaconHoe(2004,toolBacon).setUnlocalizedName("BaconHoe");
//Ore Gen.
EventManager oreManager = new EventManager();

public static EnumArmorMaterial armorBacon = EnumHelper.addArmorMaterial("BACON",66,new int []{6, 9, 9, 6}, 30) ;
//end
public static Item BaconHelmet = new baconarmor(2009,armorBacon,0,0).setUnlocalizedName("BaconHelmet");
public static Item BaconChestplate = new baconarmor(2009,armorBacon,0,1).setUnlocalizedName("BaconChestplaete");
public static Item BaconLeggings = new baconarmor(2009,armorBacon,0,2).setUnlocalizedName("BaconLeggins");
public static Item BaconBoots = new baconarmor(2009,armorBacon,0,3).setUnlocalizedName("BaconBoots");




// The instance of your mod that Forge uses.
@Instance(value = "GenericModID")
public static main instance;

// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="Bacon.ClientProxy", serverSide="Bacon.CommonProxy")
public static CommonProxy proxy;

@EventHandler // used in 1.6.2
//@PreInit // used in 1.5.2
public void preInit(FMLPreInitializationEvent event) {
// Stub Method
}

@EventHandler // used in 1.6.2
//@Init // used in 1.5.2
public void load(FMLInitializationEvent event) {
proxy.registerRenderers();
GameRegistry.registerBlock(BaconOre,"BaconOre");
LanguageRegistry.addName(BaconOre, "GoldenBaconOre");
MinecraftForge.setBlockHarvestLevel(BaconOre,"pickaxe",2);
LanguageRegistry.addName(BaconIngot, "GoldenBacon");
LanguageRegistry.addName(BaconPick, "Bacon Pickaxe");
LanguageRegistry.addName(BaconSword, "Bacon Sword");
LanguageRegistry.addName(BaconAxe, "Bacon Axe");
LanguageRegistry.addName(BaconHelmet,"Bacon Helmet");
LanguageRegistry.addName(BaconChestplate,"Bacon Chestplate");
LanguageRegistry.addName(BaconLeggings,"Bacon Leggins");
LanguageRegistry.addName(BaconBoots, "Bacon Boots");
GameRegistry.registerWorldGenerator(oreManager);

LanguageRegistry.addName(BaconHoe, "Bacon Hoe");
LanguageRegistry.addName(BaconSpade, "Bacon Spade");

GameRegistry.addRecipe(new ItemStack (BaconPick,1) , new Object []{
"***", " X ", " X ", 'X',Item.stick,'*',BaconIngot
});
GameRegistry.addRecipe(new ItemStack(BaconSpade, 1),new Object[]{
" * "," X "," X ",'X', Item.stick ,'*',BaconIngot
});
GameRegistry.addRecipe(new ItemStack(BaconAxe, 1),new Object[]{
"** ","*X "," X ",'X', Item.stick ,'*',BaconIngot
});
GameRegistry.addRecipe(new ItemStack(BaconHoe),new Object[]{
"** "," X "," X ",'X',Item.stick,'*',BaconIngot
});
GameRegistry.addRecipe(new ItemStack(BaconSword),new Object[]{
"** "," X "," X ",'X',Item.stick,'*',BaconIngot
});

}

@EventHandler // used in 1.6.2
//@PostInit // used in 1.5.2
public void postInit(FMLPostInitializationEvent event) {
// Stub Method
}
}

Armor Class File
Click to reveal
package Bacon;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class baconarmor extends ItemArmor {

public baconarmor(int par1, EnumArmorMaterial par2EnumArmorMaterial,
int par3, int par4, String armornamePrefix) {
super(par1, par2EnumArmorMaterial, par3, par4);
this.material = par2EnumArmorMaterial;
par2EnumArmorMaterial.getDamageReductionAmount(par4);
this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4));
this.maxStackSize = 1;
this.setCreativeTab(CreativeTabs.tabMisc);
armornamePrefix = armorNamePrefix;

}
public String armorNamePrefix;
public EnumArmorMaterial material;

public String getArmorTexture(ItemStack stack, Entity entity, int slot, int lauyer)
{
if(stack.toString().contains("leggins")){
return "bacon" + armorNamePrefix + "_2.png";
}
if (stack.toString().contains("leggings")) if(itemID == main.BaconLeggings.itemID){
return "Bacon" + armorNamePrefix + "_2.png";
}
return "bacon:" + armorNamePrefix + "_1.png";

}


}

HELP
Posted by
oceanimus
Level 18 : Journeyman Narwhal
14

  Have something to say?

JoinSign in

23

TheCrazyPanda
09/24/2013 11:18 am
Level 13 : Journeyman Network
Bacon
1
meymazda
09/24/2013 11:16 am
Level 17 : Journeyman Network
Unsure of the language you are using, but is baconarmor defined yet? It might not be recognizing it because it doesn't know it is a variable or something.
1
oceanimus
09/24/2013 11:11 am
Level 18 : Journeyman Narwhal
GoldeNugget
oceanimus
nickfromgreeceWhats the error....

Look at the screenshot Link http://imgur.com/hX3zucu

Should you use ";" instead of ","? Not a java programmer either, but I am coding.

No due to it is listing the variables it is passing in
1
dunem666
09/24/2013 10:47 am
Level 44 : Master Network
please paste this on pastie.org and post the link please.

I dont wanna look at un formatted code but can help you
1
-Rusty-
09/24/2013 10:30 am
Level 40 : Master Procrastinator
by the looks of it, your mod is incompatible with forge ;-;

if not that well I'm no code expert...
1
nickfromgreece
09/24/2013 10:27 am
Level 54 : Grandmaster Programmer
Whats the error....
1
oceanimus
09/24/2013 10:31 am
Level 18 : Journeyman Narwhal
Look at the screenshot Link http://imgur.com/hX3zucu
1
GoldeNugget
09/24/2013 11:06 am
Level 42 : Master Giraffe
Shouldn't you use ";" instead of ","? Not a java programmer either, but I am coding.
1
Zatharel
09/24/2013 10:43 am
Level 51 : Grandmaster Sweetheart
I've never coded in java, although in languages I have coded in, there can't be any spaces. Maybe that's it.
Or I could be horribly wrong and needing to learn java .-.
1
oceanimus
09/24/2013 10:46 am
Level 18 : Journeyman Narwhal
No in java spaces dont effect it
1
Zatharel
09/24/2013 11:02 am
Level 51 : Grandmaster Sweetheart
Time to learn java then.
1
oceanimus
09/24/2013 10:24 am
Level 18 : Journeyman Narwhal
Crash Report :
Click to reveal
---- Minecraft Crash Report ----
// Quite honestly, I wouldn't worry myself about that.

Time: 9/22/13 8:24 PM
Description: There was a severe problem during mod loading that has caused the game to fail

cpw.mods.fml.common.LoaderException: java.lang.ClassNotFoundException: tutorial.generic.client.ClientProxy
at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:75)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:519)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:194)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:174)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:105)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:509)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:181)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:471)
at net.minecraft.client.Minecraft.run(Minecraft.java:806)
at net.minecraft.client.main.Main.main(Main.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:131)
at net.minecraft.launchwrapper.Launch.main(Launch.java:27)
Caused by: java.lang.ClassNotFoundException: tutorial.generic.client.ClientProxy
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:179)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at cpw.mods.fml.common.ModClassLoader.loadClass(ModClassLoader.java:58)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at cpw.mods.fml.common.ProxyInjector.inject(ProxyInjector.java:58)
... 33 more
Caused by: java.lang.NullPointerException
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:171)
... 39 more


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

-- System Details --
Details:
Minecraft Version: 1.6.4
Operating System: Mac OS X (x86_64) version 10.8.4
Java Version: 1.6.0_51, Apple Inc.
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Apple Inc.
Memory: 978484376 bytes (933 MB) / 1065025536 bytes (1015 MB) up to 1065025536 bytes (1015 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v8.11 FML v6.4.3.883 Minecraft Forge 9.11.0.883 4 mods loaded, 4 mods active
mcp{8.09} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed
FML{6.4.3.883} [Forge Mod Loader] (bin) Unloaded->Constructed
Forge{9.11.0.883} [Minecraft Forge] (bin) Unloaded->Constructed
Spanite{1.0.0} [Sphanite] (bin) Unloaded->Errored


http://imgur.com/hX3zucu <-- Link To The Problem Img
1
meymazda
09/24/2013 8:35 am
Level 17 : Journeyman Network
Context! We can't help from such a small piece of information what the problem is.
Any specific error messages or warnings or even the code surrounding this code would help.
1
nickfromgreece
09/24/2013 8:29 am
Level 54 : Grandmaster Programmer
an "error" specify that error
1
Creeper_Modder
09/24/2013 8:29 am
Level 21 : Expert Modder
Whats the crash report?
1
Snowyfox
09/24/2013 8:29 am
Level 26 : Expert Princess
Never mind, your methods are started clearly. But yeah, state the error message, please?
1
Heltrato
09/24/2013 8:28 am
Level 59 : Grandmaster System
The problem is simple mate you have the same item ID's instead

Trying to make custom armour but an error keeps popping up here in main.class :
public static Item BaconHelmet = new baconarmor(2009,armorBacon,0,0).setUnlocalizedName("BaconHelmet");
public static Item BaconChestplate = new baconarmor(2010,armorBacon,0,1).setUnlocalizedName("BaconChestplaete");
public static Item BaconLeggings = new baconarmor(2011,armorBacon,0,2).setUnlocalizedName("BaconLeggins");
public static Item BaconBoots = new baconarmor(2012,armorBacon,0,3).setUnlocalizedName("BaconBoots");

It must be 2009 , 2010 , 2011 , 2012
1
oceanimus
09/24/2013 10:26 am
Level 18 : Journeyman Narwhal
Ye fixed that still got the error :/
1
Tarvorus
09/24/2013 11:19 am
Level 9 : Apprentice Mage
Honestly, I can't fix without having it all in eclipse, but I'm too lazy to do that so just ehck these things:

1. Did you define it all right?
2. Did you define it all/
3. Are you using the mthod right?
4. Is the item ID code untaken?

If you're using a tutorial then either stop or make sure you get it exact. One little mess up can be a pain to find and fix.
1
oceanimus
09/24/2013 12:03 pm
Level 18 : Journeyman Narwhal
Just Found Out The Error *FacePalm* Turns Out The class file was called baconarmor. But in the code i wrote armourbacon ..
1
Snowyfox
09/24/2013 8:27 am
Level 26 : Expert Princess
I've never made a plugin or mod before, but, are you sure you're supposed to put "=" after the start of a method?
1
DenialMC
09/24/2013 8:27 am
Level 10 : Journeyman Modder
Can you be more specific please? What is the error message?

Daniel
1
EpicRobertA1
09/24/2013 8:27 am
Level 20 : Expert Architect
I have no idea what a single word says..
1

Welcome