Jump to content

making an attack animation for a ranged mob [1.7.10]


Recommended Posts

so earlier I made a thread about attack animations, it did eventually get solved but im wondering, since there isn't any attack animations for ranged mobs, if its possible. I do know that it is, im pretty sure we have all seen them in other mods. how should I code this correctly?

 

entity code:

package com.OlympiansMod.entity;

import com.OlympiansMod.Item.ModItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
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.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;
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.boss.BossStatus;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class Zeus extends EntityGolem implements IBossDisplayData, IRangedAttackMob{  
 private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
 private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private int attackTimer;

    private static final String __OBFID = "CL_00001697";


public Zeus(World world) { 
	super(world);
	 {
	   this.isImmuneToFire = true;
	   this.setHealth(this.getMaxHealth());
	   this.experienceValue = 10000;
	   this.setSize(1.1F, 2F);	  
	   this.getNavigator().setAvoidsWater(true);    
	   this.tasks.addTask(1, new EntityAISwimming(this));
	   this.tasks.addTask(2, new EntityAIWander(this, 0.5D));
	   this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F));
	   this.tasks.addTask(3, new EntityAILookIdle(this));
	   this.tasks.addTask(5, new EntityAIMoveTowardsTarget(this, 0.7D, 100.0F));
	   this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
	   this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
	   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
	   
        
	   if (world != null && !world.isRemote)
        {
            this.setCombatTask();
        }
    }
	    } 
 public void onLivingUpdate()
 {
	super.onLivingUpdate();
  BossStatus.setBossStatus(this, true);
  
  {
  
  }
    {
        super.onLivingUpdate();

        if (this.attackTimer > 0)
        {
            --this.attackTimer;
        }
    }

    }
  
    


	    	   

public boolean isAIEnabled(){

	return true;
}
@Override
protected void entityInit() {
	super.entityInit();
	dataWatcher.addObject(21, (byte) 0);
}


public void setAggressive(boolean par2)
    {
        this.getDataWatcher().updateObject(21, Byte.valueOf((byte)(par2 ? 1 : 0)));
    }

   
    public boolean getAggressive()
    {
        return this.getDataWatcher().getWatchableObjectByte(21) == 1;
    }
   // protected void addRandomArmor()
    //{
       // super.addRandomArmor();
        //this.setCurrentItemOrArmor(0, new ItemStack(ModItems.MasterBolt));
    //}

	    protected void applyEntityAttributes(){
	        super.applyEntityAttributes();
	        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(70.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
	       
	    }
	    public boolean attackEntityAsMob(Entity entity)
	    {
	        this.attackTimer = 0;
	        this.worldObj.setEntityState(this, (byte)4);
	        boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(10 + this.rand.nextInt(15)));



	        this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
	        return flag;
	    }
	    
	public void setCombatTask()
	 {
	   
	      {
	      this.tasks.addTask(4, this.aiArrowAttack);
	      }
	     
	      {
	      this.tasks.addTask(4, this.aiAttackOnCollide);
	      }
	 }
   


@Override 
   public void attackEntityWithRangedAttack(EntityLivingBase entity, float par1)
    {
        if (!this.getAggressive())
        {
        	this.attackTimer = 5;
            EntityMasterBolt Bolt = new EntityMasterBolt(this.worldObj, this);
            Bolt.rotationPitch -= -20.0F;
            double d0 = entity.posX + entity.motionX - this.posX;
            double d1 = entity.posY + (double)entity.getEyeHeight() - 1.900000023841858D - this.posY;
            double d2 = entity.posZ + entity.motionZ - this.posZ;
            float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);

            
            Bolt.setThrowableHeading(d0, d1 + (double)(f1 * 0.2F), d2, 0.75F, 8.0F);
            this.worldObj.spawnEntityInWorld(Bolt);
        }
    } 
 @SideOnly(Side.CLIENT)
    public void handleHealthUpdate(byte p_70103_1_)
    
    {
        if (p_70103_1_ == 15)
        {
        	this.attackTimer = 1;
            for (int i = 0; i < this.rand.nextInt(35) + 10; ++i)
            {
                this.worldObj.spawnParticle("witchMagic", this.posX + this.rand.nextGaussian() * 0.12999999523162842D, this.boundingBox.maxY + 0.5D + this.rand.nextGaussian() * 0.12999999523162842D, this.posZ + this.rand.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D);
            }
        }
        else
        {
            super.handleHealthUpdate(p_70103_1_);
        }
    }	
       
        @SideOnly(Side.CLIENT)
        public int getAttackTimer()
        {
            return this.attackTimer;
        }
        }



        










 

Model code:

package  com.OlympiansMod.entity;



import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;

public class ZeusModel extends ModelBase
{
    protected ModelRenderer head;
    protected ModelRenderer body;
    protected ModelRenderer rightarm;
    protected ModelRenderer leftarm;
    protected ModelRenderer rightleg;
    protected ModelRenderer leftleg;
  
  public ZeusModel()
  {
    this.textureWidth = 64;
    this.textureHeight = 128;
    
      this.head = new ModelRenderer(this, 0, 0);
      this.head.mirror = true;
      this.head.addBox(-4F, -8F, -4F, 10, 10, 10);
      this.head.setRotationPoint(-1F, -10F, 0F);
      this.head.setTextureSize(64, 128);
      setRotation(this.head, 0F, 0F, 0F);

      this.body = new ModelRenderer(this, 2, 20);
      this.body.mirror = true;
      this.body.addBox(-4F, 0F, -2F, 12, 16, 6);
      this.body.setRotationPoint(-2F, -8F, 0F);
      this.body.setTextureSize(64, 128);
      setRotation(this.body, 0F, 0F, 0F);

      this.rightarm = new ModelRenderer(this, 40, 0);
      this.rightarm.mirror = true;
      this.rightarm.addBox(-3F, -2F, -2F, 6, 16, 6);
      this.rightarm.setRotationPoint(-9F, -6F, 0F);
      this.rightarm.setTextureSize(64, 128);
      setRotation(this.rightarm, 0F, 0F, 0F);

      this.leftarm = new ModelRenderer(this, 40, 22);
      this.leftarm.mirror = true;
      this.leftarm.addBox(-1F, -2F, -2F, 6, 16, 6);
      this.leftarm.setRotationPoint(7F, -6F, 0F);
      this.leftarm.setTextureSize(64, 128);
      setRotation(this.leftarm, 0F, 0F, 0F);

      this.rightleg = new ModelRenderer(this, 40, 44);
      this.rightleg.mirror = true;
      this.rightleg.addBox(-2F, 0F, -2F, 6, 16, 6);
      this.rightleg.setRotationPoint(-4F, 8F, 0F);
      this.rightleg.setTextureSize(64, 128);
      setRotation(this.rightleg, 0F, 0F, 0F);

      this.leftleg = new ModelRenderer(this, 40, 66);
      this.leftleg.mirror = true;
      this.leftleg.addBox(-2F, 0F, -2F, 6, 16, 6);
      this.leftleg.setRotationPoint(2F, 8F, 0F);
      this.leftleg.setTextureSize(64, 128);
      setRotation(this.leftleg, 0F, 0F, 0F);

  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    super.render(entity, f, f1, f2, f3, f4, f5);
    setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    this.head.render(f5);
    this.body.render(f5);
    this.rightarm.render(f5);
    this.leftarm.render(f5);
    this.rightleg.render(f5);
    this.leftleg.render(f5);
  }
  
  public static void setRotation(ModelRenderer model, float x, float y, float z)
  {
    model.rotateAngleX = x;
    model.rotateAngleY = y;
    model.rotateAngleZ = z;
  }
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
    this.head.rotateAngleY = f3 / (180F / (float)Math.PI);
    this.head.rotateAngleX = f4 / (180F / (float)Math.PI);
rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;
    rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
    leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float)Math.PI) * 1.4F * f1;
    Zeus zeus = (Zeus)entity;
    int i = zeus.getAttackTimer();

    if (i > 0)
    {
        this.rightarm.rotateAngleX =  MathHelper.cos(f * 0.6662F) * this.func_78172_a((float)i - f2, 10.0F);
        
    }


}



  private float func_78172_a(float p_78172_1_, float p_78172_2_)
  {
      return (Math.abs(p_78172_1_ % p_78172_2_ - p_78172_2_ * 0.5F) - p_78172_2_ * 0.25F) / (p_78172_2_ * 0.25F);
  }



  }


Im serious don't look at it!!

Link to comment
Share on other sites

so like this?

 

package com.OlympiansMod.entity;

import com.OlympiansMod.Item.ModItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
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.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;
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.boss.BossStatus;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class Zeus extends EntityGolem implements IBossDisplayData, IRangedAttackMob{  
 private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
 private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private int TotalWorldTime;

    private static final String __OBFID = "CL_00001697";


public Zeus(World world) { 
	super(world);
	 {
	   this.isImmuneToFire = true;
	   this.setHealth(this.getMaxHealth());
	   this.experienceValue = 10000;
	   this.setSize(1.1F, 2F);	  
	   this.getNavigator().setAvoidsWater(true);    
	   this.tasks.addTask(1, new EntityAISwimming(this));
	   this.tasks.addTask(2, new EntityAIWander(this, 0.5D));
	   this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F));
	   this.tasks.addTask(3, new EntityAILookIdle(this));
	   this.tasks.addTask(5, new EntityAIMoveTowardsTarget(this, 0.7D, 100.0F));
	   this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
	   this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
	   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
	   
        
	   if (world != null && !world.isRemote)
        {
            this.setCombatTask();
        }
    }
	    } 
 public void onLivingUpdate()
 {
	super.onLivingUpdate();
  BossStatus.setBossStatus(this, true);
  
  {
  
  }
    {
        super.onLivingUpdate();

        if (this.TotalWorldTime > 0)
        {
            --this.TotalWorldTime;
        }
    }

    }
  
    


	    	   

public boolean isAIEnabled(){

	return true;
}
@Override
protected void entityInit() {
	super.entityInit();
	dataWatcher.addObject(21, (byte) 0);
}


public void setAggressive(boolean par2)
    {
        this.getDataWatcher().updateObject(21, Byte.valueOf((byte)(par2 ? 1 : 0)));
    }

   
    public boolean getAggressive()
    {
        return this.getDataWatcher().getWatchableObjectByte(21) == 1;
    }
   // protected void addRandomArmor()
    //{
       // super.addRandomArmor();
        //this.setCurrentItemOrArmor(0, new ItemStack(ModItems.MasterBolt));
    //}

	    protected void applyEntityAttributes(){
	        super.applyEntityAttributes();
	        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(70.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
	       
	    }
	    public boolean attackEntityAsMob(Entity entity)
	    {
	        this.TotalWorldTime = 0;
	        this.worldObj.setEntityState(this, (byte)4);
	        boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(10 + this.rand.nextInt(15)));



	        this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
	        return flag;
	    }
	    
	public void setCombatTask()
	 {
	   
	      {
	      this.tasks.addTask(4, this.aiArrowAttack);
	      }
	     
	      {
	      this.tasks.addTask(4, this.aiAttackOnCollide);
	      }
	 }
   


@Override 
   public void attackEntityWithRangedAttack(EntityLivingBase entity, float par1)
    {
        if (!this.getAggressive())
        {
        	this.TotalWorldTime = 5;
            EntityMasterBolt Bolt = new EntityMasterBolt(this.worldObj, this);
            Bolt.rotationPitch -= -20.0F;
            double d0 = entity.posX + entity.motionX - this.posX;
            double d1 = entity.posY + (double)entity.getEyeHeight() - 1.900000023841858D - this.posY;
            double d2 = entity.posZ + entity.motionZ - this.posZ;
            float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);

            
            Bolt.setThrowableHeading(d0, d1 + (double)(f1 * 0.2F), d2, 0.75F, 8.0F);
            this.worldObj.spawnEntityInWorld(Bolt);
        }
    } 
 @SideOnly(Side.CLIENT)
    public void handleHealthUpdate(byte p_70103_1_)
    
    {
        if (p_70103_1_ == 15)
        {
        	this.TotalWorldTime = 1;
            for (int i = 0; i < this.rand.nextInt(35) + 10; ++i)
            {
                this.worldObj.spawnParticle("witchMagic", this.posX + this.rand.nextGaussian() * 0.12999999523162842D, this.boundingBox.maxY + 0.5D + this.rand.nextGaussian() * 0.12999999523162842D, this.posZ + this.rand.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D);
            }
        }
        else
        {
            super.handleHealthUpdate(p_70103_1_);
        }
    }	
       
        @SideOnly(Side.CLIENT)
        public int  getTotalWorldTime()
        {
            return this.TotalWorldTime;
        }
        }



        










Im serious don't look at it!!

Link to comment
Share on other sites

Why do you have your own

getTotalWorldTime()

method? It is a method in the World class you have to use, and not make your own.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

ok so how about now, it doesn't work so what am I doing wrong at this point.

package com.OlympiansMod.entity;

import com.OlympiansMod.Item.ModItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
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.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;
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.boss.BossStatus;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class Zeus extends EntityGolem implements IBossDisplayData, IRangedAttackMob{  
 private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
 private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false);
private long attackTimer;

    private static final String __OBFID = "CL_00001697";


public Zeus(World world) { 
	super(world);
	 {
	   this.isImmuneToFire = true;
	   this.setHealth(this.getMaxHealth());
	   this.experienceValue = 10000;
	   this.setSize(1.1F, 2F);	  
	   this.getNavigator().setAvoidsWater(true);    
	   this.tasks.addTask(1, new EntityAISwimming(this));
	   this.tasks.addTask(2, new EntityAIWander(this, 0.5D));
	   this.tasks.addTask(3, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F));
	   this.tasks.addTask(3, new EntityAILookIdle(this));
	   this.tasks.addTask(5, new EntityAIMoveTowardsTarget(this, 0.7D, 100.0F));
	   this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
	   this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
	   this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
	   
        
	   if (world != null && !world.isRemote)
        {
            this.setCombatTask();
        }
    }
	    } 
 public void onLivingUpdate()
 {
	super.onLivingUpdate();
  BossStatus.setBossStatus(this, true);
  
  {
  
  }
    {
        super.onLivingUpdate();

        if (this.attackTimer > 0)
        {
            --this.attackTimer;
        }
    }

    }
  
    


	    	   

public boolean isAIEnabled(){

	return true;
}
@Override
protected void entityInit() {
	super.entityInit();
	dataWatcher.addObject(21, (byte) 0);
}


public void setAggressive(boolean par2)
    {
        this.getDataWatcher().updateObject(21, Byte.valueOf((byte)(par2 ? 1 : 0)));
    }

   
    public boolean getAggressive()
    {
        return this.getDataWatcher().getWatchableObjectByte(21) == 1;
    }
   // protected void addRandomArmor()
    //{
       // super.addRandomArmor();
        //this.setCurrentItemOrArmor(0, new ItemStack(ModItems.MasterBolt));
    //}

	    protected void applyEntityAttributes(){
	        super.applyEntityAttributes();
	        this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(70.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000.0D);
	        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);
	       
	    }
	    public boolean attackEntityAsMob(Entity entity)
	    {
	        this.attackTimer = worldObj.getTotalWorldTime();
	        this.worldObj.setEntityState(this, (byte)4);
	        boolean flag = entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(10 + this.rand.nextInt(15)));



	        this.playSound("mob.irongolem.throw", 1.0F, 1.0F);
	        return flag;
	    }
	    
	public void setCombatTask()
	 {
	   
	      {
	      this.tasks.addTask(4, this.aiArrowAttack);
	      }
	     
	      {
	      this.tasks.addTask(4, this.aiAttackOnCollide);
	      }
	 }
   


@Override 
   public void attackEntityWithRangedAttack(EntityLivingBase entity, float par1)
    {
        if (!this.getAggressive())
        {
        	this.attackTimer = worldObj.getTotalWorldTime();
            EntityMasterBolt Bolt = new EntityMasterBolt(this.worldObj, this);
            Bolt.rotationPitch -= -20.0F;
            double d0 = entity.posX + entity.motionX - this.posX;
            double d1 = entity.posY + (double)entity.getEyeHeight() - 1.900000023841858D - this.posY;
            double d2 = entity.posZ + entity.motionZ - this.posZ;
            float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);

            
            Bolt.setThrowableHeading(d0, d1 + (double)(f1 * 0.2F), d2, 0.75F, 8.0F);
            this.worldObj.spawnEntityInWorld(Bolt);
        }
    } 
 @SideOnly(Side.CLIENT)
    public void handleHealthUpdate(byte p_70103_1_)
    
    {
        if (p_70103_1_ == 15)
        {
        	worldObj.getTotalWorldTime();
            for (int i = 0; i < this.rand.nextInt(35) + 10; ++i)
            {
                this.worldObj.spawnParticle("witchMagic", this.posX + this.rand.nextGaussian() * 0.12999999523162842D, this.boundingBox.maxY + 0.5D + this.rand.nextGaussian() * 0.12999999523162842D, this.posZ + this.rand.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D);
            }
        }
        else
        {
            super.handleHealthUpdate(p_70103_1_);
        }
    }	
       
        @SideOnly(Side.CLIENT)
        public long  getattackTimer()
        {
            return this.attackTimer = worldObj.getTotalWorldTime();
        }
        }




        










Im serious don't look at it!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.