MC Modding
Please register and join the community!

[Answered] Variable Error/import error

MC Modding :: Help :: Help

View previous topic View next topic Go down

[Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 1:17 am

In my NPC when i put the code in i got a variable error on the attackstrength =2;
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.
        }
}
That`s in my entity class and the error says:
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";
    }
}
On import java.lang.reflect.Method; it says:
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
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 1:27 am

Please post error code.
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 1:35 am

Do you mean the part that has the error?
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 1:43 am

No the error that the compiler gave you.
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 1:53 am

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 !!
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 1:59 am

Okay lemme go over this I'll be 5 min.
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 2:08 am

Try updating java on your computer java.com/en/download/index.jsp
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 2:10 am

Already have it Neutral.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 2:20 am

OH You named the file mod_Test but it should be mod_Herobrine
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 2:24 am

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 !!
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 2:28 am

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.
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 2:32 am

Oh well.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 2:33 am

Can you show me your current code please?
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Thu Oct 20, 2011 5:18 am

It`s on the post
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Ranga179 on Thu Oct 20, 2011 12:26 pm

i think i have solved it for you.
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. Smile

-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 Razz

Ranga179
Member

Posts : 9
Join date : 2011-10-19
Age : 21

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Static_boy123 on Thu Oct 20, 2011 2:47 pm

So its fixed?
avatar
Static_boy123
Helper

Posts : 32
Join date : 2011-10-19
Age : 18
Location : Eclipse Indigo

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by breakyorself on Fri Oct 21, 2011 3:03 am

Still got errors but i gave up on that Neutral.
avatar
breakyorself
Member

Posts : 60
Join date : 2011-10-19

View user profile

Back to top Go down

Re: [Answered] Variable Error/import error

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


MC Modding :: Help :: Help

 
Permissions in this forum:
You cannot reply to topics in this forum