Hello all! I really need some help figuring out what is wrong with my code. I am trying to make a mod that adds reinforced swords to the game and I have edited the EnumToolMaterial.java file and I made a mod_reinforcements.java file. These two files contain the code below. The error I am getting in EnumToolMaterial.java is as follows: The constructor EnumToolMaterial(int, int, float, double, int) is undefined!
I am using eclipse to tell me the errors I get but I can't seem to fix it no matter what I try. Thanks for your help!
package net.minecraft.src;
import java.util.Random;
public class mod_reinforcements extends BaseMod
{
public static final Item reinwood = new ItemSword(2001, EnumToolMaterial.RWOOD).setIconCoord(3, 4).setItemName("reinwood");
public void load()
{
reinwood.iconIndex = ModLoader.addOverride("/gui/items.png", "/items/rein_wood.png");
ModLoader.addName(reinwood, "Reinforced Wood Sword");
ModLoader.addRecipe(new ItemStack(reinwood, 1), new Object[]{
" ", "&*&", " ", Character.valueOf('*'), Item.swordWood, Character.valueOf('&'), Block.cobblestone,
Character.valueOf('X'), Item.stick});
}
public String getVersion()
{
return "Blade Reinforcements V1.0";
}
}
This is the code for my mod_reinforcements.java file.
package net.minecraft.src;
public enum EnumToolMaterial
{
WOOD(0, 59, 2.0F, 0, 15),
STONE(1, 131, 4F, 1, 5),
IRON(2, 250, 6F, 2, 14),
EMERALD(3, 1561, 8F, 3, 10),
GOLD(0, 32, 12F, 0, 22),
RWOOD(1, 175, 3F, 0.5, 15);
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
private final int harvestLevel;
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
private final int maxUses;
/**
* The strength of this tool material against blocks which it is effective against.
*/
private final float efficiencyOnProperMaterial;
/** Damage versus entities. */
private final int damageVsEntity;
/** Defines the natural enchantability factor of the material. */
private final int enchantability;
private EnumToolMaterial(int par3, int par4, float par5, int par6, int par7)
{
harvestLevel = par3;
maxUses = par4;
efficiencyOnProperMaterial = par5;
damageVsEntity = par6;
enchantability = par7;
}
/**
* The number of uses this material allows. (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
*/
public int getMaxUses()
{
return maxUses;
}
/**
* The strength of this tool material against blocks which it is effective against.
*/
public float getEfficiencyOnProperMaterial()
{
return efficiencyOnProperMaterial;
}
/**
* Damage versus entities.
*/
public int getDamageVsEntity()
{
return damageVsEntity;
}
/**
* The level of material this tool can harvest (3 = DIAMOND, 2 = IRON, 1 = STONE, 0 = IRON/GOLD)
*/
public int getHarvestLevel()
{
return harvestLevel;
}
/**
* Return the natural enchantability factor of the material.
*/
public int getEnchantability()
{
return enchantability;
}
}
This is the code for my EnumToolMaterial.java file.
Thanks so much man!!! I have a question though. If the error is: The constructor EnumToolMaterial(int, int, float, double, int) is undefined!
and the 4th number is a double, shouldn't it be able to be a decimal? Anyway, it worked, so thank you SOOOOO much for the help!
Thanks so much man!!! I have a question though. If the error is: The constructor EnumToolMaterial(int, int, float, double, int) is undefined!
and the 4th number is a double, shouldn't it be able to be a decimal? Anyway, it worked, so thank you SOOOOO much for the help!
A decimal is a double.
EnumToolMaterial is defined with the parameters (int, int, float, int int). When you try to use EnumToolMaterial(int, int, float, double, int), it treats that as an entirely different method, which doesn't exist.
The Meaning of Life, the Universe, and Everything.
Join Date:
1/18/2011
Posts:
256
Minecraft:
Plecks
Member Details
According to the line in the constructor (efficiencyOnProperMaterial = par5; where par5 is the float), yes. The 'F' however is just so the compiler knows the number is a float, not an int.
I am using eclipse to tell me the errors I get but I can't seem to fix it no matter what I try. Thanks for your help!
This is the code for my mod_reinforcements.java file.
This is the code for my EnumToolMaterial.java file.
Once again, thanks for all your help!
Just as the error says, the arguments are incorrect. Change 0.5 to an integer and it should work.
and the 4th number is a double, shouldn't it be able to be a decimal? Anyway, it worked, so thank you SOOOOO much for the help!
A decimal is a double.
EnumToolMaterial is defined with the parameters (int, int, float, int int). When you try to use EnumToolMaterial(int, int, float, double, int), it treats that as an entirely different method, which doesn't exist.
I just took the Minecraft Noob test! Check out what I scored. Think you can beat me?!
To take the test, check out
https://minecraftnoobtest.com/test.php
Don't click this link, HE is haunting it...