Jump to content

Recommended Posts

Posted

ok so Im making a ranged mob that, well believe or not, attacks with ranged attacks. Is there any way to change the mobs attack cycle from ranged to melee, like every two ranged attacks it attacks with a melee attack. So yeah thanks. Btw I mean cycle like when the witch throws different potions. also yes I have looked at the witch code, but I was unable to come to a conclusion on whether or not it is possible to change a mobs attack ai.

Im serious don't look at it!!

Posted

There is always a way, but at some point you are going to need to discover these things on your own. The way you do that is by breaking the problem down into smaller parts:

 

1. When does the entity attack? When the AI determines it should attack

2. Okay, look at the attack AI that you currently have - ranged, okay, well that calls #attackEntityWithRangedAttack or whatever

3. Now you need to STOP it from attacking with a ranged attack once in a while, how can you do that? Maybe by returning early from the method mentioned in #2

4. How about melee attack? When do you want that to happen, when it collides with a player, like a zombie? So add that AI

5. Repeat from step 1 but substitute the melee AI in the questions and answers

 

With a little bit of Java knowledge and good logic / problem solving skills, you can do quite a lot, but you really need to practice your skills to improve, and by practice, I mean try to solve problems on your own, get frustrated, keep trying and trying until you either solve it or can't take it anymore, then try again.

 

Only after you have really put in a solid effort (measured in at least hours if not days) should you seek help.

Posted

I have worked on this for quite awhile now but it still isn't working. here is what I have tried.

 if(this.isCollided){
           	 this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10.0D);
           	 this.attackEntityAsMob(entity);
           }else{
           	if(this.hasAttacked);

           }
           }

 

I put it under the ranged attack

Im serious don't look at it!!

Posted

I actually came up with a different method, but it has a few bugs.

 

A: it doesn't attack when its aggressive, (any mob that touches it takes damage.)

B: it doesn't work with the entity player. and I can add EntityPlayer into the method.

 

Here is the code

	protected void collideWithEntity(Entity entity)
    {
if(this.getHealth()<=3300){
    if(!this.getAggressive()){
 this.attackTimer = 10;
     this.worldObj.setEntityState(this, (byte)4);
 entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(20 + this.rand.nextInt(15)));



   
   
    }
}
super.collideWithEntity(entity);
    }  

 

What should I do

Im serious don't look at it!!

Posted

What should I do

 

What you should do is learn what you are doing. Honestly why the hell is your code such a mess, this isn't the first time I've seen you post code that has just random places with multiple blank lines for no reason. It makes the code so much more difficult for you, and other people to read. If you're using eclipse then select all the code and do Ctrl + Shift + F, this will auto-format it (It should be auto-formatted as you're writing it), if you're using intellij I'm not sure of the hotkey or if there is one.

 

As for why it doesn't attack when it's aggressive, that's pretty obvious, you have if (!this.isAggressive()), if you knew what you were doing you'd know that the entity will only attack when it's not aggressive. As for why it doesn't work with EntityPlayer, no idea. It should.

Posted

this doesn't work..

 

	protected void collideWithEntity(Entity entity) {
	if (!this.getAggressive()) {
		if (this.getHealth() <= 1000) {
			this.attackTimer = 10;
			this.worldObj.setEntityState(this, (byte) 4);
			entity.attackEntityFrom(DamageSource.causeMobDamage(this),
					(float) (20 + this.rand.nextInt(15)));

		}
	}
	super.collideWithEntity(entity);
}

 

btw I formatted it

Im serious don't look at it!!

Posted

if (!this.getAggressive()) {

Means your mob WILL NOT ATTACK when 'aggressive', i.e. it will only attack when passive, which makes no sense at all.

 

EDIT: ^^^ that part was ninja'd by TheRealMcrafter

 

Also, collideWithEntity is usually not used for mob attacks as it only applies in a very small area - why don't you give your mob an AI task for EntityAIAttackOnCollide and override attackEntityAsMob? That would make a lot more sense.

Posted

ok so I tried what cool alias said but it still isn't working for me:

package com.OlympiansMod.entity;

import java.util.Iterator;
import java.util.List;

import com.OlympiansMod.Item.ModItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
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.EntityDragon;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
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, true);
private int attackTimer;
private int healthupdate;

private static final String __OBFID = "CL_00001697";

public Zeus(World world) {
	super(world);
	{

		this.getNavigator().setAvoidsWater(true);
		this.isImmuneToFire = true;
		this.setHealth(this.getMaxHealth());
		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(4, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F));
		this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityUndead.class, 1.0F));
		this.tasks.addTask(6, new EntityAILookIdle(this));
		this.tasks.addTask(7, 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);

	if (this.getHealth() <= 1000) {
		--this.healthupdate;
	}

	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.7D);

}

public void setCombatTask() {

	{
		this.tasks.addTask(4, this.aiArrowAttack);
	}

	{
		this.tasks.addTask(4, this.aiAttackOnCollide);
	}
}

@Override
public void attackEntityWithRangedAttack(EntityLivingBase entity, float par1) {
	this.attackTimer = 10;
	this.worldObj.setEntityState(this, (byte) 4);


		this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "portal.portal", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
		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);
		if (this.getHealth() <= 1500) {
			for (int i = 0; i < 10; i++) {
				this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "portal.portal", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
				EntityThunderBolt Bolt2 = new EntityThunderBolt(
						this.worldObj, this);
				Bolt.rotationPitch -= -20.0F;
				double d0l = entity.posX + entity.motionX - this.posX + 1;
				double d1l = entity.posY + (double) entity.getEyeHeight() - 0.900000023841858D - this.posY;
				double d2l = entity.posZ + entity.motionZ - this.posZ;
				float f1l = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
				Bolt2.setThrowableHeading(d0l, d1l + (double) (f1l * 0.2F),	d2l, 0.75F, 8.0F);
				this.worldObj.spawnEntityInWorld(Bolt2);

			}

		}

	}

@Override
public boolean attackEntityAsMob(Entity entity) {
	this.attackTimer = 10;
	this.worldObj.setEntityState(this, (byte) 4);
     return entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
  
}

@SideOnly(Side.CLIENT)
public void handleHealthUpdate(byte p_70103_1_) {
	if (p_70103_1_ == 4) {
		this.attackTimer = 10;

	} else {
		super.handleHealthUpdate(p_70103_1_);
	}
}

@SideOnly(Side.CLIENT)
public int getattackTimer() {
	return this.attackTimer;

}

protected String getHurtSound() {
	return "mob.enderdragon.hit";
}


protected String getDeathSound() {
	return "mob.blaze.death";
}

protected void func_145780_a(int p_145780_1_, int p_145780_2_,
		int p_145780_3_, Block p_145780_4_) {
	this.playSound("step.cloth", 1.0F, 1.0F);
}

public void setDead() {

	for (int i = 0; i < 2; ++i) {
		worldObj.spawnParticle("lava", this.posX, this.posY, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 1, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 2, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 3, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 4, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 5, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 6, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 6,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 6,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 6,
				this.posZ, 50.0F, 50.0F, 50.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 6,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 1, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 2, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 3, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 4, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 5, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 6, this.posZ, 0.0F, 0.0F, 0.0F);
	}
	if (!this.worldObj.isRemote) {
		ZeusExtended zeus = new ZeusExtended(worldObj);
		zeus.setPosition(this.posX, this.posY, this.posZ);
		this.worldObj.spawnEntityInWorld(zeus);
		this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ,
				"ambient.weather.thunder", 10000.0F,
				0.8F + this.rand.nextFloat() * 0.2F);

	}
	super.setDead();
}
}

im probably missing something big

Im serious don't look at it!!

Posted

Yeah, you never add the tasks. Also, since you are extending EntityGolem, you inherit ALL of its AI tasks unless you call clear() on each of the task lists before adding your own.

 

every single vanilla mob uses this.tasks.addtask();

 

What do u mean?

Im serious don't look at it!!

Posted

every single vanilla mob uses this.tasks.addtask();

 

What do u mean?

Nevermind, you just extend EntityGolem, not EntityIronGolem, so that's fine, but you still need to add your AI tasks, the ones you made as class fields:

private EntityAIArrowAttack aiArrowAttack = new EntityAIArrowAttack(this, 1.0D, 20, 60, 15.0F);
private EntityAIAttackOnCollide aiAttackOnCollide = new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, true);

You never add those to your entity's task list.

Posted

Oh... yeah, that's right, sorry - I didn't see you had that in there :$

 

However, that means the entity is only either ranged OR melee - he can't be both at the same time with your code as it is. You need both AI tasks to be added at the same time, and then limit how often either one can trigger in the respective attack methods, either with your current attackTimer or some other method of tracking whether it most recently attacked via ranged or melee. Maybe you could have two attack timers.

 

The better solution would be to write your own AI class(es) to cycle between modes / only attack if the current target is within (or outside of) a certain range.

Posted

this is sort of a messy outline I made of what I want to do(you last idea)

I tried making a onupdate for distance measurement, like the witch does for whether or not it should through a potion, depending on how far away its attack target is. so this is what I have so far. btw it doesn't work.

 

package com.OlympiansMod.entity;

import java.util.Iterator;
import java.util.List;

import com.OlympiansMod.Item.ModItems;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
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.EntityDragon;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.monster.EntityGolem;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
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 int healthupdate;
private int attackMelee;;

public Zeus(World world) {
	super(world);
	{

		this.getNavigator().setAvoidsWater(true);
		this.isImmuneToFire = true;
		this.setHealth(this.getMaxHealth());
		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(4, new EntityAIWatchClosest(this, EntityPlayer.class, 1.0F));
		this.tasks.addTask(5, new EntityAIWatchClosest(this, EntityUndead.class, 1.0F));
		this.tasks.addTask(6, new EntityAILookIdle(this));
		this.tasks.addTask(7, 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);

	if (this.getHealth() <= 1000) {
		--this.healthupdate;
	}

	if (this.attackTimer > 0) {

		--this.attackTimer;
	}
	if (this.rand.nextFloat() < 0.25F && this.getAttackTarget() != null && this.getAttackTarget().getDistanceSqToEntity(this) > 121.0D)
        {
            --this.attackMelee;
        }

}

{
}

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.7D);

}

public void setCombatTask() {

	{

		this.tasks.addTask(4, this.aiArrowAttack);
	}

	{
		this.attackMelee = 10;
		this.tasks.addTask(4, this.aiAttackOnCollide);
		}
	}



@Override
public boolean attackEntityAsMob(Entity entity) {
	this.attackTimer = 10;
	this.worldObj.setEntityState(this, (byte) 4);
     return entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (7 + this.rand.nextInt(15)));
  
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase entity, float par1) {
	this.attackTimer = 10;
	this.worldObj.setEntityState(this, (byte) 4);


		this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "portal.portal", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
		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);
		if (this.getHealth() <= 1500) {
			for (int i = 0; i < 10; i++) {
				this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "portal.portal", 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
				EntityThunderBolt Bolt2 = new EntityThunderBolt(
						this.worldObj, this);
				Bolt.rotationPitch -= -20.0F;
				double d0l = entity.posX + entity.motionX - this.posX + 1;
				double d1l = entity.posY + (double) entity.getEyeHeight() - 0.900000023841858D - this.posY;
				double d2l = entity.posZ + entity.motionZ - this.posZ;
				float f1l = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
				Bolt2.setThrowableHeading(d0l, d1l + (double) (f1l * 0.2F),	d2l, 0.75F, 8.0F);
				this.worldObj.spawnEntityInWorld(Bolt2);

			}

		}

	}



@SideOnly(Side.CLIENT)
public void handleHealthUpdate(byte p_70103_1_) {
	if (p_70103_1_ == 4) {
		this.attackTimer = 10;

	} else {
		super.handleHealthUpdate(p_70103_1_);
	}
}

@SideOnly(Side.CLIENT)
public int getattackTimer() {
	return this.attackTimer;

}

protected String getHurtSound() {
	return "mob.enderdragon.hit";
}


protected String getDeathSound() {
	return "mob.blaze.death";
}

protected void func_145780_a(int p_145780_1_, int p_145780_2_,
		int p_145780_3_, Block p_145780_4_) {
	this.playSound("step.cloth", 1.0F, 1.0F);
}

public void setDead() {

	for (int i = 0; i < 2; ++i) {
		worldObj.spawnParticle("lava", this.posX, this.posY, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 1, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 2, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 3, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 4, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 5, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX, this.posY + 6, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("lava", this.posX + 1, this.posY + 6,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY, this.posZ,
				0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX, this.posY + 6,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("explode", this.posX + 1, this.posY + 6,
				this.posZ, 50.0F, 50.0F, 50.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 1,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 2,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 3,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 4,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 5,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX, this.posY + 6,
				this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 1, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 2, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 3, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 4, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 5, this.posZ, 0.0F, 0.0F, 0.0F);
		worldObj.spawnParticle("hugeexplosion", this.posX + 1,
				this.posY + 6, this.posZ, 0.0F, 0.0F, 0.0F);
	}
	if (!this.worldObj.isRemote) {
		ZeusExtended zeus = new ZeusExtended(worldObj);
		zeus.setPosition(this.posX, this.posY, this.posZ);
		this.worldObj.spawnEntityInWorld(zeus);
		this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ,
				"ambient.weather.thunder", 10000.0F,
				0.8F + this.rand.nextFloat() * 0.2F);

	}
	super.setDead();
}
}

 

 

also ingame sometimes the entity looks as though its trying to attack.

Im serious don't look at it!!

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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