1
CODING HELP 1.5.1
So I got my code and I'm getting a few errors, I will publish the code, could someone please fix these for me, I'm a java newbie, learning off tutorails.
package net.minecraft.src;
import java.util.Random;
public class mod_minecraft extends BaseMod
{
public static final Item iridiumdust = new ItemIridiumDUst(2086).setUnlocalizedName("Iridium dust");
public void load()
{
iridiumdust.iconIndex = ModLoader.addOverride("/gui/items.png" , "/items/iridiumDust.png");
ModLoader.addName(iridiumdust, "Iridium Dust");
}
public String getVersion()
{
return "3.14159265";
}
}
Aaand another :
package net.minecraft.src;
import java.util.Random;
public class ItemIridiumDUst extends Item
{
public ItemItemIridiumDUst(int i)
{
super(i);
maxStackSize = 16;
}
public String Version()
{
return "3.14159265";
}
}
I marked the errors red, thanks for helping, note I'm a complete noob and this is the first time I ever got so far in a code !
package net.minecraft.src;
import java.util.Random;
public class mod_minecraft extends BaseMod
{
public static final Item iridiumdust = new ItemIridiumDUst(2086).setUnlocalizedName("Iridium dust");
public void load()
{
iridiumdust.iconIndex = ModLoader.addOverride("/gui/items.png" , "/items/iridiumDust.png");
ModLoader.addName(iridiumdust, "Iridium Dust");
}
public String getVersion()
{
return "3.14159265";
}
}
Aaand another :
package net.minecraft.src;
import java.util.Random;
public class ItemIridiumDUst extends Item
{
public ItemItemIridiumDUst(int i)
{
super(i);
maxStackSize = 16;
}
public String Version()
{
return "3.14159265";
}
}
I marked the errors red, thanks for helping, note I'm a complete noob and this is the first time I ever got so far in a code !
Create an account or sign in to comment.
5
1
Sorry for the double post, after some searching I saw that .setItemName() was changed to .setUnlocalizedName , I hope this helps for the people who are stuck at the same piece of code !
1
So, I completely re-wrote the mod and re-instlaled MCP as it was messed up, now I get this error.
The error seems to be in this line of code I wrote, its at setItemName :
The error seems to be in this line of code I wrote, its at setItemName :
public static final Item iridiumdust = new ItemIridiumDust(2500).setItemName("iriDust");
---- Minecraft Crash Report ----
// Ouch. That hurt :(
Time: 4/04/13 4:31
Description: Exception occured in ModLoader
java.lang.Error: Unresolved compilation problem:
The method setItemName(String) is undefined for the type ItemIridiumDust
at net.minecraft.src.mod_oreAddons.<init>(mod_oreAddons.java:7)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at net.minecraft.src.ModLoader.addMod(ModLoader.java:366)
at net.minecraft.src.ModLoader.readFromClassPath(ModLoader.java:1221)
at net.minecraft.src.ModLoader.init(ModLoader.java:779)
at net.minecraft.src.ModLoader.addAllRenderers(ModLoader.java:180)
at net.minecraft.src.RenderManager.<init>(RenderManager.java:96)
at net.minecraft.src.RenderManager.<clinit>(RenderManager.java:14)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:417)
at net.minecraft.src.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:41)
at net.minecraft.client.Minecraft.run(Minecraft.java:726)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- System Details --
Details:
Minecraft Version: 1.5.1
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_17, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 994304856 bytes (948 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 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: Start[net.minecraft.src.IPlayerUsage, ILogAgent, MinecraftFakeLauncher, ...]
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
ModLoader: Mods loaded: 1
ModLoader 1.5.1
1
Even for Java that's unattractive looking code, remember to indent as you go.
I dont have Eclipse here so i'de really need your compilers error report to debug the top few lines but "...= new ItemIridiumDUst(2086).setUnloc..." looks like a namespace access to a function call. also further down - Invocation of a superclass constructor must be the first line in the subclass constructor... try declaring itemitem id in a higher scope.
Good luck
I dont have Eclipse here so i'de really need your compilers error report to debug the top few lines but "...= new ItemIridiumDUst(2086).setUnloc..." looks like a namespace access to a function call. also further down - Invocation of a superclass constructor must be the first line in the subclass constructor... try declaring itemitem id in a higher scope.
Good luck
1
I'm a real noob when it comes to Java, but I'm learning, I analysed my client files and some things are wrong in the source code, might be because I had a few mods in my mc.jar when I set it up with mcp.
1
I fixe it a little bit but now I get this : http://puu.sh/2trfu
Here's my two codes : http://puu.sh/2trhk
: http://puu.sh/2trit
Here's my two codes : http://puu.sh/2trhk
: http://puu.sh/2trit