• 0

    posted a message on How to make an Entity spawn on a horse

    bump

    Posted in: Modification Development
  • 0

    posted a message on How to make an Entity spawn on a horse

    I changed the 3's to 4's and still no spawn

    Posted in: Modification Development
  • 0

    posted a message on How to make an Entity spawn on a horse

    Now I have this, still no spawn


    package percyjackson;

    import com.steampunk.percyjackson.Percyjackson;

    import java.util.List;
    import java.util.Random;

    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityCreature;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.EntityAIAttackOnCollide;
    import net.minecraft.entity.ai.EntityAIBreakDoor;
    import net.minecraft.entity.ai.EntityAIHurtByTarget;
    import net.minecraft.entity.ai.EntityAILookIdle;
    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
    import net.minecraft.entity.ai.EntityAISwimming;
    import net.minecraft.entity.ai.EntityAITasks;
    import net.minecraft.entity.ai.EntityAIWander;
    import net.minecraft.entity.ai.EntityAIWatchClosest;
    import net.minecraft.entity.ai.attributes.IAttributeInstance;
    import net.minecraft.entity.monster.EntityCaveSpider;
    import net.minecraft.entity.monster.EntityCreeper;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.entity.monster.EntitySilverfish;
    import net.minecraft.entity.monster.EntitySkeleton;
    import net.minecraft.entity.monster.EntitySpider;
    import net.minecraft.entity.monster.EntityZombie;
    import net.minecraft.entity.passive.EntityHorse;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.pathfinding.PathNavigate;
    import net.minecraft.world.World;

    public class EntityRoman
    extends EntityMob
    {
    protected boolean isAIEnabled()
    {
    return true;
    }

    private boolean firstUpdate = true;
    private boolean isMounted = false;

    private boolean spawned = false;
    private EntityLivingBase lastAttackTarget = null;

    protected void applyEntityAttributes()
    {
    super.applyEntityAttributes();
    getEntityAttribute(SharedMonsterAttributes.maxHealth)
    .setBaseValue(50.0D);
    getEntityAttribute(SharedMonsterAttributes.followRange)
    .setBaseValue(50.0D);
    getEntityAttribute(SharedMonsterAttributes.knockbackResistance)
    .setBaseValue(0.25D);
    getEntityAttribute(SharedMonsterAttributes.movementSpeed)
    .setBaseValue(0.35D);
    getEntityAttribute(SharedMonsterAttributes.attackDamage)
    .setBaseValue(4.0D);
    }

    public EntityRoman(World par1World)
    {
    super(par1World);

    this.getNavigator().setAvoidsWater(true);
    boolean flag = getNavigator().getCanBreakDoors();
    this.getNavigator().setBreakDoors(true);
    this.getNavigator().setEnterDoors(true);
    this.getNavigator().setCanSwim(true);
    this.getNavigator().getPathSearchRange();
    this.clearAITasks();
    this.isImmuneToFire = true;

    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this,
    EntityGreek.class, 1.0D, true));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this,
    EntityZombie.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this,
    EntitySkeleton.class, 1.0D, true));
    this.tasks.addTask(5, new EntityAIAttackOnCollide(this,
    EntitySpider.class, 1.0D, true));
    this.tasks.addTask(6, new EntityAIAttackOnCollide(this,
    EntityCreeper.class, 1.0D, true));
    this.tasks.addTask(7, new EntityAIAttackOnCollide(this,
    EntityCaveSpider.class, 1.0D, true));
    this.tasks.addTask(8, new EntityAIAttackOnCollide(this,
    EntitySilverfish.class, 1.0D, true));
    this.tasks.addTask(10, new EntityAIBreakDoor(this));
    this.tasks.addTask(11, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(12, new EntityAIWatchClosest(this,
    EntityPlayer.class, 6.0F));
    this.tasks.addTask(13, new EntityAILookIdle(this));

    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityGreek.class, 0, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this,
    EntityZombie.class, 0, true));
    this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this,
    EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this,
    EntityCreeper.class, 0, true));
    this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this,
    EntitySpider.class, 0, true));
    this.targetTasks.addTask(7, new EntityAINearestAttackableTarget(this,
    EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(8, new EntityAINearestAttackableTarget(this,
    EntitySilverfish.class, 0, true));

    }

    protected void clearAITasks()
    {
    this.tasks.taskEntries.clear();
    this.targetTasks.taskEntries.clear();
    }

    protected Item getDropItem()
    {
    Random d = new Random();
    int chance = d.nextInt(3);
    int type = d.nextInt(3);
    Item weap = null;
    if(type == 0 && chance == 0){
    weap = Percyjackson.Gladius;
    }

    return weap;

    }

    private void spawnMount() {
    if (ridingEntity != null || !spawned) {
    return;
    }

    EntityHorse mount = null;
    if (true) {
    mount = new EntityHorse(worldObj);
    mount.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);
    mount.onSpawnWithEgg((IEntityLivingData) null);
    //NB: don;t check for entity collisions as we know the knight will collide
    }

    if (mount != null) {
    setCanPickUpLoot(false);
    worldObj.spawnEntityInWorld(mount);
    mountEntity(mount);
    }

    }



    private boolean isRidingMount() {
    return isRiding() && ridingEntity.getClass() == EntityHorse.class;
    }

    @Override
    public void onLivingUpdate() {
    super.onLivingUpdate();

    Random d = new Random();
    int chance = d.nextInt(3);
    int type = d.nextInt(3);

    if (chance == 3 && type == 3) {
    spawnMount();
    }

    if (isRidingMount()) {
    EntityLiving entLiving = ((EntityLiving) ridingEntity);
    if (lastAttackTarget != getAttackTarget() || firstUpdate) {
    lastAttackTarget = getAttackTarget();
    }
    }
    firstUpdate = false;
    if (isBurning() && isRidingMount()) {
    ridingEntity.setFire(8);
    }
    }


    public ItemStack getHeldItem()
    {
    return new ItemStack(Percyjackson.Gladius);
    }

    }

    Posted in: Modification Development
  • 0

    posted a message on How to make an Entity spawn on a horse

    What link?

    Posted in: Modification Development
  • 0

    posted a message on How to make an Entity spawn on a horse

    Where should I put that line?

    Posted in: Modification Development
  • 0

    posted a message on How to make an Entity spawn on a horse

    Hey Choonster!!! Thanks for your help! You got me on the right track...One problem, it doesn't spawn on a horse!


    package percyjackson;

    import com.steampunk.percyjackson.Percyjackson;

    import java.util.List;
    import java.util.Random;

    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityCreature;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.IEntityLivingData;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.EntityAIAttackOnCollide;
    import net.minecraft.entity.ai.EntityAIBreakDoor;
    import net.minecraft.entity.ai.EntityAIHurtByTarget;
    import net.minecraft.entity.ai.EntityAILookIdle;
    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
    import net.minecraft.entity.ai.EntityAISwimming;
    import net.minecraft.entity.ai.EntityAITasks;
    import net.minecraft.entity.ai.EntityAIWander;
    import net.minecraft.entity.ai.EntityAIWatchClosest;
    import net.minecraft.entity.ai.attributes.IAttributeInstance;
    import net.minecraft.entity.monster.EntityCaveSpider;
    import net.minecraft.entity.monster.EntityCreeper;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.entity.monster.EntitySilverfish;
    import net.minecraft.entity.monster.EntitySkeleton;
    import net.minecraft.entity.monster.EntitySpider;
    import net.minecraft.entity.monster.EntityZombie;
    import net.minecraft.entity.passive.EntityHorse;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.pathfinding.PathNavigate;
    import net.minecraft.world.World;

    public class EntityRoman
    extends EntityMob
    {
    protected boolean isAIEnabled()
    {
    return true;
    }

    private boolean firstUpdate = true;
    private boolean isMounted = false;

    private boolean spawned = false;
    private EntityLivingBase lastAttackTarget = null;

    protected void applyEntityAttributes()
    {
    super.applyEntityAttributes();
    getEntityAttribute(SharedMonsterAttributes.maxHealth)
    .setBaseValue(50.0D);
    getEntityAttribute(SharedMonsterAttributes.followRange)
    .setBaseValue(50.0D);
    getEntityAttribute(SharedMonsterAttributes.knockbackResistance)
    .setBaseValue(0.25D);
    getEntityAttribute(SharedMonsterAttributes.movementSpeed)
    .setBaseValue(0.35D);
    getEntityAttribute(SharedMonsterAttributes.attackDamage)
    .setBaseValue(4.0D);
    }

    public EntityRoman(World par1World)
    {
    super(par1World);

    this.getNavigator().setAvoidsWater(true);
    boolean flag = getNavigator().getCanBreakDoors();
    this.getNavigator().setBreakDoors(true);
    this.getNavigator().setEnterDoors(true);
    this.getNavigator().setCanSwim(true);
    this.getNavigator().getPathSearchRange();
    this.clearAITasks();
    this.isImmuneToFire = true;

    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this,
    EntityGreek.class, 1.0D, true));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this,
    EntityZombie.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this,
    EntitySkeleton.class, 1.0D, true));
    this.tasks.addTask(5, new EntityAIAttackOnCollide(this,
    EntitySpider.class, 1.0D, true));
    this.tasks.addTask(6, new EntityAIAttackOnCollide(this,
    EntityCreeper.class, 1.0D, true));
    this.tasks.addTask(7, new EntityAIAttackOnCollide(this,
    EntityCaveSpider.class, 1.0D, true));
    this.tasks.addTask(8, new EntityAIAttackOnCollide(this,
    EntitySilverfish.class, 1.0D, true));
    this.tasks.addTask(10, new EntityAIBreakDoor(this));
    this.tasks.addTask(11, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(12, new EntityAIWatchClosest(this,
    EntityPlayer.class, 6.0F));
    this.tasks.addTask(13, new EntityAILookIdle(this));

    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityGreek.class, 0, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this,
    EntityZombie.class, 0, true));
    this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this,
    EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this,
    EntityCreeper.class, 0, true));
    this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this,
    EntitySpider.class, 0, true));
    this.targetTasks.addTask(7, new EntityAINearestAttackableTarget(this,
    EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(8, new EntityAINearestAttackableTarget(this,
    EntitySilverfish.class, 0, true));

    }

    protected void clearAITasks()
    {
    this.tasks.taskEntries.clear();
    this.targetTasks.taskEntries.clear();
    }

    protected Item getDropItem()
    {
    Random d = new Random();
    int chance = d.nextInt(3);
    int type = d.nextInt(3);
    Item weap = null;
    if(type == 0 && chance == 0){
    weap = Percyjackson.Gladius;
    }

    return weap;

    }

    private void spawnMount() {
    if (ridingEntity != null || !spawned) {
    return;
    }

    EntityHorse mount = null;
    if (true) {
    mount = new EntityHorse(worldObj);
    mount.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);
    mount.onSpawnWithEgg((IEntityLivingData) null);
    //NB: don;t check for entity collisions as we know the knight will collide
    }
    }



    private boolean isRidingMount() {
    return isRiding() && ridingEntity.getClass() == EntityHorse.class;
    }

    @Override
    public void onLivingUpdate() {
    super.onLivingUpdate();

    Random d = new Random();
    int chance = d.nextInt(3);
    int type = d.nextInt(3);

    if (chance == 3 && type == 3) {
    spawnMount();
    }

    if (isRidingMount()) {
    EntityLiving entLiving = ((EntityLiving) ridingEntity);
    if (lastAttackTarget != getAttackTarget() || firstUpdate) {
    lastAttackTarget = getAttackTarget();
    }
    }
    firstUpdate = false;
    if (isBurning() && isRidingMount()) {
    ridingEntity.setFire(8);
    }
    }

    public ItemStack getHeldItem()
    {
    return new ItemStack(Percyjackson.Gladius);
    }

    }

    Posted in: Modification Development
  • 0

    posted a message on How to make an Entity spawn on a horse

    I have been working on a roman and I want to make it spawn on a horse. I looked through the documentation and the APIs and found nothing.


    Regards

    Thomas

    Posted in: Modification Development
  • 0

    posted a message on Make mob randomly spawn with a sword or bow

    I'm really sorry to be such a noob, but now the greek spawns with no weapon...Here is my class:


    package percyjackson;

    import com.steampunk.percyjackson.Percyjackson;

    import java.util.List;
    import java.util.Random;

    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.IRangedAttackMob;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.EntityAIArrowAttack;
    import net.minecraft.entity.ai.EntityAIAttackOnCollide;
    import net.minecraft.entity.ai.EntityAIBreakDoor;
    import net.minecraft.entity.ai.EntityAIHurtByTarget;
    import net.minecraft.entity.ai.EntityAILookIdle;
    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
    import net.minecraft.entity.ai.EntityAISwimming;
    import net.minecraft.entity.ai.EntityAITasks;
    import net.minecraft.entity.ai.EntityAIWander;
    import net.minecraft.entity.ai.EntityAIWatchClosest;
    import net.minecraft.entity.ai.attributes.IAttributeInstance;
    import net.minecraft.entity.monster.EntityCaveSpider;
    import net.minecraft.entity.monster.EntityCreeper;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.entity.monster.EntitySilverfish;
    import net.minecraft.entity.monster.EntitySkeleton;
    import net.minecraft.entity.monster.EntitySpider;
    import net.minecraft.entity.monster.EntityZombie;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.pathfinding.PathNavigate;
    import net.minecraft.world.World;

    public class EntityGreek extends EntityMob implements IRangedAttackMob {

    protected boolean isAIEnabled() {
    return true;
    }

    public EntityGreek(World par1World) {
    super(par1World);
    getNavigator().setAvoidsWater(true);
    getNavigator().setBreakDoors(true);
    getNavigator().setEnterDoors(true);
    getNavigator().setCanSwim(true);
    getNavigator().getPathSearchRange();
    clearAITasks();
    this.isImmuneToFire(); //what is this for? Did you mean to do the below line? If so, un comment it.
    // this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(5, new EntityAILookIdle(this));
    //Target Tasks
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityRoman.class, 0, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, true));
    this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntityCreeper.class, 0, true));
    this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this, EntitySpider.class, 0, true));
    this.targetTasks.addTask(7, new EntityAINearestAttackableTarget(this, EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(8, new EntityAINearestAttackableTarget(this, EntitySilverfish.class, 0, true));
    }

    protected void addRandomArmor(){
    super.addRandomArmor();
    Random r = new Random();
    int type = r.nextInt(2);
    if(type == 0){
    this.setCurrentItemOrArmor(0, new ItemStack(Percyjackson.xiphos));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityLivingBase.class, 1.0D, true));
    }else{
    this.setCurrentItemOrArmor(0, new ItemStack(Percyjackson.greekBow));
    this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F));
    }
    }

    @Override
    protected void applyEntityAttributes(){

    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D);
    this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(50.0D);
    this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.25D);
    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D);
    this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
    }

    protected void clearAITasks(){

    tasks.taskEntries.clear();
    targetTasks.taskEntries.clear();
    }

    @Override
    public void attackEntityWithRangedAttack(EntityLivingBase var1, float var2) {
    // TODO Auto-generated method stub

    }
    }

    What am I doing wrong?

    Posted in: Modification Development
  • 0

    posted a message on Make mob randomly spawn with a sword or bow

    Hello there!

    I know that I asked this question before, but it didn't exactly work. I also know that its been a while but I stopped modding in like February but I just got right back into it.


    OK. So my question is, why the EntityGreek spawns but only ever with a sword and not a bow. Here is my class:


    package percyjackson;

    import com.example.percyjackson.Percyjackson;

    import java.util.List;
    import java.util.Random;

    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.IRangedAttackMob;
    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.EntityAIArrowAttack;
    import net.minecraft.entity.ai.EntityAIAttackOnCollide;
    import net.minecraft.entity.ai.EntityAIBreakDoor;
    import net.minecraft.entity.ai.EntityAIHurtByTarget;
    import net.minecraft.entity.ai.EntityAILookIdle;
    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
    import net.minecraft.entity.ai.EntityAISwimming;
    import net.minecraft.entity.ai.EntityAITasks;
    import net.minecraft.entity.ai.EntityAIWander;
    import net.minecraft.entity.ai.EntityAIWatchClosest;
    import net.minecraft.entity.ai.attributes.IAttributeInstance;
    import net.minecraft.entity.monster.EntityCaveSpider;
    import net.minecraft.entity.monster.EntityCreeper;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.entity.monster.EntitySilverfish;
    import net.minecraft.entity.monster.EntitySkeleton;
    import net.minecraft.entity.monster.EntitySpider;
    import net.minecraft.entity.monster.EntityZombie;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.pathfinding.PathNavigate;
    import net.minecraft.world.World;

    public class EntityGreek extends EntityMob implements IRangedAttackMob {

    protected boolean isAIEnabled() {
    return true;
    }

    private boolean isArcher;

    public EntityGreek(World par1World) {
    super(par1World);
    getNavigator().setAvoidsWater(true);
    getNavigator().setBreakDoors(true);
    getNavigator().setEnterDoors(true);
    getNavigator().setCanSwim(true);
    getNavigator().getPathSearchRange();
    clearAITasks();
    this.isImmuneToFire(); //what is this for? Did you mean to do the below line? If so, un comment it.
    // this.isImmuneToFire = true;
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(5, new EntityAILookIdle(this));
    //Target Tasks
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityRoman.class, 0, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityZombie.class, 0, true));
    this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntityCreeper.class, 0, true));
    this.targetTasks.addTask(6, new EntityAINearestAttackableTarget(this, EntitySpider.class, 0, true));
    this.targetTasks.addTask(7, new EntityAINearestAttackableTarget(this, EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(8, new EntityAINearestAttackableTarget(this, EntitySilverfish.class, 0, true));
    isArcher = new Random().nextBoolean();


    if(par1World != null && !par1World.isRemote)
    {
    this.setCombatTask();
    }
    }

    @Override
    protected void applyEntityAttributes(){

    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D);
    this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(50.0D);
    this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.65D);
    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D);
    this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0D);
    }

    protected void clearAITasks(){

    tasks.taskEntries.clear();
    targetTasks.taskEntries.clear();
    }

    @Override
    public void attackEntityWithRangedAttack(EntityLivingBase var1, float var2) {
    // TODO Auto-generated method stub

    }

    public void setCombatTask(){

    if(isArcher)
    {
    this.tasks.addTask(2, new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F));
    }
    else
    {
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityLivingBase.class, 1.0D, true));
    }
    }

    }






    Posted in: Modification Development
  • 0

    posted a message on Ranged attack mob not working!
    Like, it does't spawn when I tell it too. It used to, but when I added the chance to hold a bow, it stopped spawning.
    Posted in: Modification Development
  • 0

    posted a message on Ranged attack mob not working!
    So I want my Greek to have a chance of having a greek bow or xiphos when he spawns. But here's my class..its not working.






    package percyjackson;

    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.IRangedAttackMob;

    import java.util.Random;

    import net.minecraft.entity.SharedMonsterAttributes;
    import net.minecraft.entity.ai.EntityAIArrowAttack;
    import net.minecraft.entity.ai.EntityAIAttackOnCollide;
    import net.minecraft.entity.ai.EntityAIHurtByTarget;
    import net.minecraft.entity.ai.EntityAILookIdle;
    import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
    import net.minecraft.entity.ai.EntityAISwimming;
    import net.minecraft.entity.ai.EntityAIWander;
    import net.minecraft.entity.ai.EntityAIWatchClosest;
    import net.minecraft.entity.ai.attributes.IAttribute;
    import net.minecraft.entity.ai.attributes.RangedAttribute;
    import net.minecraft.entity.monster.EntityCaveSpider;
    import net.minecraft.entity.monster.EntityCreeper;
    import net.minecraft.entity.monster.EntityMob;
    import net.minecraft.entity.monster.EntitySilverfish;
    import net.minecraft.entity.monster.EntitySkeleton;
    import net.minecraft.entity.monster.EntitySpider;
    import net.minecraft.entity.monster.EntityZombie;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.DamageSource;
    import net.minecraft.world.World;
    import net.minecraftforge.common.MinecraftForge;
    import percyjackson.GreekEvent.SummonGreekEvent;

    import com.example.percyjackson.Percyjackson;

    public abstract class EntityGreek extends EntityMob implements IRangedAttackMob {

    Random rand = new Random();

    int i = rand.nextInt(1);

    private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);

    @Override
    protected boolean isAIEnabled() {
    return true;
    }

    @Override
    protected void applyEntityAttributes() {
    super.applyEntityAttributes();
    this.getEntityAttribute(SharedMonsterAttributes.maxHealth)
    .setBaseValue(30.0D);
    this.getEntityAttribute(SharedMonsterAttributes.followRange)
    .setBaseValue(50.0D);
    this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance)
    .setBaseValue(0.65D);
    this.getEntityAttribute(SharedMonsterAttributes.movementSpeed)
    .setBaseValue(0.25D);
    this.getEntityAttribute(SharedMonsterAttributes.attackDamage)
    .setBaseValue(4.0D);
    }

    public void swordTasks(){
    getNavigator().setAvoidsWater(true);
    getNavigator().setBreakDoors(true);
    getNavigator().setEnterDoors(true);
    getNavigator().setCanSwim(true);
    getNavigator().getPathSearchRange();
    clearAITasks(); // clear any tasks assigned in super classes
    this.tasks.addTask(0, new EntityAISwimming(this));
    // the leap and the collide together form an actual attack
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this,
    EntityRoman.class, 1.0D, true));
    this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(4, new EntityAIWatchClosest(this,
    EntityPlayer.class, 6.0F));
    this.tasks.addTask(5, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityRoman.class, 0, true));
    this.isImmuneToFire();
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityZombie.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityCreeper.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntitySpider.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntitySilverfish.class, 0, true));
    }

    public void archerTasks(){
    getNavigator().setAvoidsWater(true);
    getNavigator().setBreakDoors(true);
    getNavigator().setEnterDoors(true);
    getNavigator().setCanSwim(true);
    getNavigator().getPathSearchRange();
    clearAITasks(); // clear any tasks assigned in super classes
    this.tasks.addTask(0, new EntityAISwimming(this));
    // the leap and the collide together form an actual attack
    this.tasks.addTask(2, aiArrowAttack);
    this.tasks.addTask(3, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(4, new EntityAIWatchClosest(this,
    EntityPlayer.class, 6.0F));
    this.tasks.addTask(5, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityRoman.class, 0, true));
    this.isImmuneToFire();
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityZombie.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntitySkeleton.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityCreeper.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntitySpider.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntityCaveSpider.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this,
    EntitySilverfish.class, 0, true));
    }

    public EntityGreek(World par1World) {
    super(par1World);
    if (par1World != null && !par1World.isRemote && i >= 1){
    this.archerTasks();
    }else if (par1World != null && !par1World.isRemote && i <= 1){
    this.swordTasks();
    }

    }

    protected void clearAITasks() {
    tasks.taskEntries.clear();
    targetTasks.taskEntries.clear();
    }

    public ItemStack getHeldItem() {
    if (i <= 0){
    return new ItemStack(Percyjackson.xiphos);
    }else if (i >= 1){
    return new ItemStack(Percyjackson.greekBow);
    } else {
    return null;
    }
    }
    }




    Posted in: Modification Development
  • 0

    posted a message on How to make an entity attack if attacked
    didn't really help.....I need it to attack anything that attacks it.
    Posted in: Modification Development
  • 0

    posted a message on Techne Problem
    @Jabelar: If you're reading this, I'd like to know how .addChind() works. I have an entity with a horn and when I write head.addChild(horn3) only the head shows up on the entity.
    Posted in: Modification Development
  • 0

    posted a message on Techne Problem
    how do you move the texture offset?
    Posted in: Modification Development
  • 0

    posted a message on Techne Problem
    So I have this entity called a satyr and the skin is all messed up! the texture map works and everything but look at the screen shot.

    And the texturemap won't support it.
    Posted in: Modification Development
  • To post a comment, please or register a new account.