[Answered] Variable Error/import error
3 posters
MC Modding :: Help :: Help
Page 1 of 1
[Answered] Variable Error/import error
In my NPC when i put the code in i got a variable error on the attackstrength =2;
attackStrength can not be resolved to a variable.
My second error is in the mod_namehere class.
The declared package "" does not match the expected package "net.minecraft.src"
- Code:
package net.minecraft.src;
public class EntityTest extends EntityCreature
{
public EntityTest(World world)
{
super(world);
texture = "/awesomecraft/Test.png";
moveSpeed = 0.5F;
attackStrength = 6;
isImmuneToFire = false;
}
protected int getDropItemId()
{
return Item.swordDiamond.shiftedIndex;
}
public boolean canBreatheUnderwater()
{
return false;
}
protected boolean canDespawn()
{
return false;
}
public void onEntityDeath()
{
//If you know what you're doing, you can make it
//do cool things. e.g. explode like creeper.
}
}
attackStrength can not be resolved to a variable.
My second error is in the mod_namehere class.
- Code:
import java.lang.reflect.Method;
import java.util.Map;
public class mod_Herobrine extends BaseMod
{
public mod_Herobrine()
{
ModLoader.RegisterEntityID(EntityTest.class, "Test", ModLoader.getUniqueEntityId());
ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.creature);
}
public void AddRenderer(Map map)
{
map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public String Version()
{
return "1.7.3";
}
}
The declared package "" does not match the expected package "net.minecraft.src"
Last edited by breakyorself on Thu Oct 20, 2011 2:32 am; edited 1 time in total
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
Please post error code.
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
Do you mean the part that has the error?
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
No the error that the compiler gave you.
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
2011-10-19 16:49 - commands.recompile - ERROR - javac.exe -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\isom\*.java src/minecraft\net\minecraft\src\*.java conf/patches/*.java failed.
2011-10-19 16:49 - commands.recompile - ERROR - Return code : 1
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - == ERRORS FOUND ==
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - warning: [options] bootstrap class path not set in conjunction with -source 1.6
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\EntityTest.java:11: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - attackStrength = 6;
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: variable attackStrength
2011-10-19 16:49 - commands.recompile - ERROR - location: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:9: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - ModLoader.RegisterEntityID(EntityTest.class, "Herobrine", ModLoader.getUniqueEntityId());
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:10: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.creature);
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:10: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.creature);
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: variable EnumCreatureType
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:15: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:15: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class RenderBiped
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:15: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class ModelBiped
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - 7 errors
2011-10-19 16:49 - commands.recompile - ERROR - 1 warning
2011-10-19 16:49 - commands.recompile - ERROR - ==================
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.checksources - WARNING - !! Can not find server sources !!
2011-10-19 16:49 - commands.recompile - ERROR - Return code : 1
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - == ERRORS FOUND ==
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - warning: [options] bootstrap class path not set in conjunction with -source 1.6
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\EntityTest.java:11: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - attackStrength = 6;
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: variable attackStrength
2011-10-19 16:49 - commands.recompile - ERROR - location: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:9: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - ModLoader.RegisterEntityID(EntityTest.class, "Herobrine", ModLoader.getUniqueEntityId());
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:10: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.creature);
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:10: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.creature);
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: variable EnumCreatureType
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:15: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class EntityTest
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:15: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class RenderBiped
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Test.java:15: error: cannot find symbol
2011-10-19 16:49 - commands.recompile - ERROR - map.put(EntityTest.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 16:49 - commands.recompile - ERROR - ^
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.recompile - ERROR - symbol: class ModelBiped
2011-10-19 16:49 - commands.recompile - ERROR - location: class mod_Test
2011-10-19 16:49 - commands.recompile - ERROR - 7 errors
2011-10-19 16:49 - commands.recompile - ERROR - 1 warning
2011-10-19 16:49 - commands.recompile - ERROR - ==================
2011-10-19 16:49 - commands.recompile - ERROR -
2011-10-19 16:49 - commands.checksources - WARNING - !! Can not find server sources !!
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
Okay lemme go over this I'll be 5 min.
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
Try updating java on your computer java.com/en/download/index.jsp
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
Already have it .
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
OH You named the file mod_Test but it should be mod_Herobrine
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
Still get compile errors
- Spoiler:
- 2011-10-19 17:23 - commands.recompile - ERROR - javac.exe -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\isom\*.java src/minecraft\net\minecraft\src\*.java conf/patches/*.java failed.
2011-10-19 17:23 - commands.recompile - ERROR - Return code : 1
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - == ERRORS FOUND ==
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - warning: [options] bootstrap class path not set in conjunction with -source 1.6
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\EntityHerobrine.java:11: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - attackStrength = 6;
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: variable attackStrength
2011-10-19 17:23 - commands.recompile - ERROR - location: class EntityHerobrine
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Herobrine.java:9: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - ModLoader.RegisterEntityID(EntityHerobrine.class, "Test", ModLoader.getUniqueEntityId());
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: class EntityHerobrine
2011-10-19 17:23 - commands.recompile - ERROR - location: class mod_Herobrine
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Herobrine.java:10: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - ModLoader.AddSpawn(EntityHerobrine.class, 8, 4, 10, EnumCreatureType.creature);
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: class EntityHerobrine
2011-10-19 17:23 - commands.recompile - ERROR - location: class mod_Herobrine
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Herobrine.java:10: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - ModLoader.AddSpawn(EntityHerobrine.class, 8, 4, 10, EnumCreatureType.creature);
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: variable EnumCreatureType
2011-10-19 17:23 - commands.recompile - ERROR - location: class mod_Herobrine
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Herobrine.java:15: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - map.put(EntityHerobrine.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: class EntityHerobrine
2011-10-19 17:23 - commands.recompile - ERROR - location: class mod_Herobrine
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Herobrine.java:15: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - map.put(EntityHerobrine.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: class RenderBiped
2011-10-19 17:23 - commands.recompile - ERROR - location: class mod_Herobrine
2011-10-19 17:23 - commands.recompile - ERROR - src\minecraft\net\minecraft\src\mod_Herobrine.java:15: error: cannot find symbol
2011-10-19 17:23 - commands.recompile - ERROR - map.put(EntityHerobrine.class, new RenderBiped(new ModelBiped(), 0.5F));
2011-10-19 17:23 - commands.recompile - ERROR - ^
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.recompile - ERROR - symbol: class ModelBiped
2011-10-19 17:23 - commands.recompile - ERROR - location: class mod_Herobrine
2011-10-19 17:23 - commands.recompile - ERROR - 7 errors
2011-10-19 17:23 - commands.recompile - ERROR - 1 warning
2011-10-19 17:23 - commands.recompile - ERROR - ==================
2011-10-19 17:23 - commands.recompile - ERROR -
2011-10-19 17:23 - commands.checksources - WARNING - !! Can not find server sources !!
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
If you changed the name in the file for EntityHerobrine then the tutorial might be outdated I could also just not know. But the name of the file Entity Herobrine should be the same in the code as it is in your file explorer.
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
Can you show me your current code please?
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
It`s on the post
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
Re: [Answered] Variable Error/import error
i think i have solved it for you.
change
to
i think its because EnumCreatureType.creature cannot attack.
so you change it to EnumCreaturType.monster.
except this means they will only spawn at night.
-EDIT-
oh and also
to
although if you want to spawn at day try doing that change and nothing to the first change
change
- Code:
ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.creature);
to
- Code:
ModLoader.AddSpawn(EntityTest.class, 8, 4, 10, EnumCreatureType.monster);
i think its because EnumCreatureType.creature cannot attack.
so you change it to EnumCreaturType.monster.
except this means they will only spawn at night.
-EDIT-
oh and also
- Code:
public class EntityTest extends EntityCreature
to
- Code:
public class EntityTest extends EntityMob
although if you want to spawn at day try doing that change and nothing to the first change
Ranga179- Member
- Posts : 9
Join date : 2011-10-19
Age : 28
Re: [Answered] Variable Error/import error
So its fixed?
Static_boy123- Helper
- Posts : 32
Join date : 2011-10-19
Age : 25
Location : Eclipse Indigo
Re: [Answered] Variable Error/import error
Still got errors but i gave up on that .
breakyorself- Member
- Posts : 60
Join date : 2011-10-19
MC Modding :: Help :: Help
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum