MC Modding
Please register and join the community!


Join the forum, it's quick and easy

MC Modding
Please register and join the community!
MC Modding
Would you like to react to this message? Create an account in a few clicks or log in to continue.

[Answered] Variable Error/import error

3 posters

MC Modding :: Help :: Help

Go down

[Answered] Variable Error/import error Empty [Answered] Variable Error/import error

Post by breakyorself 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
breakyorself
breakyorself
Member

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

Please post error code.
Static_boy123
Static_boy123
Helper

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

Post by breakyorself 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 !!
breakyorself
breakyorself
Member

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

Already have it Neutral.
breakyorself
breakyorself
Member

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

Still get compile errors
Spoiler:
breakyorself
breakyorself
Member

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

Post by Static_boy123 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.
Static_boy123
Static_boy123
Helper

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

Oh well.
breakyorself
breakyorself
Member

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

It`s on the post
breakyorself
breakyorself
Member

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

Post by Ranga179 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 : 27

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

So its fixed?
Static_boy123
Static_boy123
Helper

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

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

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

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

Posts : 60
Join date : 2011-10-19

Back to top Go down

[Answered] Variable Error/import error Empty Re: [Answered] Variable Error/import error

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

MC Modding :: Help :: Help

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