831Views3Replies

Author Options:

What is wrong with my MineCraft Mod JavaScript? Answered

I've been working on a BattleTech minecraft mod, and I need some help with my coding.

I need to make a special set of armor to actually use the 'Mechs, but when I recompiled the code, I got 36 errors. A screenshot of the code is included. I am using MCP and ModLoader for MineCraft 1.0.0

Because it is hard to read in the photo, here is the actual code:
__________________________________

package net.minecraft.src;
import java.util.Random;

public class mod_mechsuit extends BaseMod
{
public static Item helmet = (New ItemArmor(5000, 1, 5, 0).setItemName("asdf"));
public static Item chest = (New ItemArmor(5001, 9, 5, 2).setItemName("asdf"));

public mod_mechsuit()
{
  body.iconIndex = ModLoader.addOveride("/gui/items.png", "medvest.png")
  helmet.iconIndex = ModLoader.addOveride("/gui/items.png", "neurohelmet.png")
 
  ModLoader.AddRecipe(new ItemStack(body, 1), new Object[]{
  "L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
  });
  ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
  " R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
  });
 
  ModLoader.AddName(body, "MedVest")
  ModLoader.AddName(helmet, "NeuroHelmet")
  }
}

public String Version()
{
  return "3.14159265";
}
}

____________________
EDIT: The Terminal error report is as follows:
________________________
******-*******-MacBook-Pro:mcp50 ************$ bash recompile.sh
== MCP v5.0 ==
> Recompiling client...
javac -g -source 1.6 -target 1.6 -classpath "lib/:lib/*:jars/bin/minecraft.jar:jars/bin/jinput.jar:jars/bin/lwjgl.jar:jars/bin/lwjgl_util.jar" -sourcepath src/minecraft -d bin/minecraft src/minecraft/net/minecraft/client/*.java src/minecraft/net/minecraft/src/*.java  conf/patches/*.java failed.
Return code : 1

== ERRORS FOUND ==

src/minecraft/net/minecraft/src/mod_mechsuit.java:6: ')' expected
public static Item helmet = (New ItemArmor(5000, 1, 5, 0).setItemName("asdf"));
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:6: ';' expected
public static Item helmet = (New ItemArmor(5000, 1, 5, 0).setItemName("asdf"));
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:7: ')' expected
public static Item chest = (New ItemArmor(5001, 9, 5, 2).setItemName("asdf"));
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:7: ';' expected
public static Item chest = (New ItemArmor(5001, 9, 5, 2).setItemName("asdf"));
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:11: ';' expected
body.iconIndex = ModLoader.addOveride("/gui/items.png", "medvest.png")
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:12: ';' expected
helmet.iconIndex = ModLoader.addOveride("/gui/items.png", "neurohelmet.png")
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:15: '}' expected
"L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:15: ';' expected
"L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:15: ';' expected
"L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:15: ';' expected
"L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:15: not a statement
"L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:15: ';' expected
"L L","RLR","LRL" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:16: illegal start of type
});
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: <identifier> expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: illegal start of type
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: ')' expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: ';' expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: <identifier> expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: <identifier> expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: illegal start of type
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: <identifier> expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: ';' expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:17: <identifier> expected
ModLoader.AddRecipe(new ItemStack(helmet, 1), new Object[]{
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: illegal start of type
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: <identifier> expected
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: ';' expected
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: illegal start of type
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: <identifier> expected
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: ';' expected
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: illegal start of type
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: illegal start of type
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:18: ';' expected
" R ","RLR","L L" Character.valueOf ("L"), item.leather Character.valueOf ("R"),  item.redstone
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:19: class, interface, or enum expected
});
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:21: class, interface, or enum expected
ModLoader.AddName(body, "MedVest")
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:26: class, interface, or enum expected
public String Version()
^

src/minecraft/net/minecraft/src/mod_mechsuit.java:29: class, interface, or enum expected
}
^

36 errors
==================

> Done in 3.43 seconds
> Recompiling server...
!! Can not find server sources !!
_________________________

What am I doing wrong?

Link to official page:
http://www.minecraftforum.net/topic/852900-battletech-mod/

Thanks in advance!

Discussions

When you post code questions, ALWAYS post the error messages. Usually the FIRST error message is the most important, a tiny error there can propagate right through the code.

Steve

Sorry it took so long. Errors are added.

I'm guessing this will probably be a dumb mistake, based on my previous track record. (Granted, I am new to Java.)