/** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { EntityMoveHelper entitymovehelper = this.parentEntity.getMoveHelper(); if (!entitymovehelper.isUpdating()) { return true; } else { double d0 = entitymovehelper.getX() - this.parentEntity.posX; double d1 = entitymovehelper.getY() - this.parentEntity.posY; double d2 = entitymovehelper.getZ() - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; return d3 < 1.0D || d3 > 3600.0D; } }
public EntityLiving(World worldIn) { super(worldIn); this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = new EntityBodyHelper(this); this.navigator = this.getNewNavigator(worldIn); this.senses = new EntitySenses(this); for (int i = 0; i < this.equipmentDropChances.length; ++i) { this.equipmentDropChances[i] = 0.085F; } }
public boolean shouldExecute() { EntityMoveHelper entitymovehelper = this.parentEntity.getMoveHelper(); if (!entitymovehelper.isUpdating()) { return true; } else { double d0 = entitymovehelper.getX() - this.parentEntity.posX; double d1 = entitymovehelper.getY() - this.parentEntity.posY; double d2 = entitymovehelper.getZ() - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; return d3 < 1.0D || d3 > 3600.0D; } }
public EntityLiving(World worldIn) { super(worldIn); this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = new EntityBodyHelper(this); this.navigator = this.getNewNavigator(worldIn); this.senses = new EntitySenses(this); for (int i = 0; i < this.equipmentDropChances.length; ++i) { this.equipmentDropChances[i] = 0.085F; } UUID uuid = this.getUniqueID(); long j = uuid.getLeastSignificantBits(); this.randomMobsId = (int)(j & 2147483647L); }
public EntityLiving(World worldIn) { super(worldIn); this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = this.createBodyHelper(); this.navigator = this.getNewNavigator(worldIn); this.senses = new EntitySenses(this); Arrays.fill(this.inventoryArmorDropChances, 0.085F); Arrays.fill(this.inventoryHandsDropChances, 0.085F); if (worldIn != null && !worldIn.isRemote) { this.initEntityAI(); } UUID uuid = this.getUniqueID(); long i = uuid.getLeastSignificantBits(); this.randomMobsId = (int)(i & 2147483647L); }
public void setBombSpell(boolean bomb) { this.getDataManager().set(SPELL_BOMB, bomb); this.getNavigator().clearPathEntity(); if(bomb){ this.moveHelper=new FloatingMoveHelper(this); this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemFromData.getNewStack("bombinomicon")); this.playSound(TF2Sounds.MOB_MERASMUS_BOMBINOMICON, 3.3F, 1F); } else{ this.moveHelper=new EntityMoveHelper(this); this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, ItemStack.EMPTY); } TF2Attribute.setAttribute(this.getHeldItemMainhand(), TF2Attribute.attributes[19], bomb?0.65f:1); TF2Attribute.setAttribute(this.getHeldItemMainhand(), TF2Attribute.attributes[39], bomb?0f:0.3f); }
@Override public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - this.parentEntity.posX; double d1 = this.posY - this.parentEntity.posY; double d2 = this.posZ - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.parentEntity.getRNG().nextInt(5) + 2; d3 = MathHelper.sqrt(d3); if (this.isNotColliding(this.posX, this.posY, this.posZ, d3)) { this.parentEntity.motionX += d0 / d3 * 0.05D; this.parentEntity.motionZ += d2 / d3 * 0.05D; } else this.action = EntityMoveHelper.Action.WAIT; } } }
/** * Returns whether the EntityAIBase should begin execution. */ @Override public boolean shouldExecute() { if (this.parentEntity.begin > 0) return false; EntityMoveHelper entitymovehelper = this.parentEntity.getMoveHelper(); if (!entitymovehelper.isUpdating()) return true; else { double d0 = entitymovehelper.getX() - this.parentEntity.posX; double d1 = entitymovehelper.getY() - this.parentEntity.posY; double d2 = entitymovehelper.getZ() - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; return d3 < 1.0D || d3 > 3600.0D; } }
@Override public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - this.parentEntity.posX; double d1 = this.posY - this.parentEntity.posY; double d2 = this.posZ - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.parentEntity.getRNG().nextInt(5) + 2; d3 = MathHelper.sqrt(d3); if (this.isNotColliding(this.posX, this.posY, this.posZ, d3)) { this.parentEntity.motionX += d0 / d3 * 0.1D; this.parentEntity.motionY += d1 / d3 * 0.1D; this.parentEntity.motionZ += d2 / d3 * 0.1D; } else this.action = EntityMoveHelper.Action.WAIT; } } }
public EntityLiving(World worldIn) { super(worldIn); this.tasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.targetTasks = new EntityAITasks(worldIn != null && worldIn.theProfiler != null ? worldIn.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = this.createBodyHelper(); this.navigator = this.getNewNavigator(worldIn); this.senses = new EntitySenses(this); Arrays.fill(this.inventoryArmorDropChances, 0.085F); Arrays.fill(this.inventoryHandsDropChances, 0.085F); if (worldIn != null && !worldIn.isRemote) { this.initEntityAI(); } }
public EntityLiving(World par1World) { super(par1World); this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null); this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = new EntityBodyHelper(this); this.navigator = new PathNavigate(this, par1World); this.senses = new EntitySenses(this); for (int var2 = 0; var2 < this.equipmentDropChances.length; ++var2) { this.equipmentDropChances[var2] = 0.085F; } }
public EntityLiving(World p_i1595_1_) { super(p_i1595_1_); this.tasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null); this.targetTasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = new EntityBodyHelper(this); this.navigator = new PathNavigate(this, p_i1595_1_); this.senses = new EntitySenses(this); for (int i = 0; i < this.equipmentDropChances.length; ++i) { this.equipmentDropChances[i] = 0.085F; } }
public EntityLiving(World p_i1595_1_) { super(p_i1595_1_); this.field_70714_bg = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.field_72984_F != null?p_i1595_1_.field_72984_F:null); this.field_70715_bh = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.field_72984_F != null?p_i1595_1_.field_72984_F:null); this.field_70749_g = new EntityLookHelper(this); this.field_70765_h = new EntityMoveHelper(this); this.field_70767_i = new EntityJumpHelper(this); this.field_70762_j = new EntityBodyHelper(this); this.field_70699_by = new PathNavigate(this, p_i1595_1_); this.field_70723_bA = new EntitySenses(this); for(int var2 = 0; var2 < this.field_82174_bp.length; ++var2) { this.field_82174_bp[var2] = 0.085F; } }
public EntityLiving(World par1World) { super(par1World); this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null); this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null); this.lookHelper = new EntityLookHelper(this); this.moveHelper = new EntityMoveHelper(this); this.jumpHelper = new EntityJumpHelper(this); this.bodyHelper = new EntityBodyHelper(this); this.navigator = new PathNavigate(this, par1World); this.senses = new EntitySenses(this); for (int i = 0; i < this.equipmentDropChances.length; ++i) { this.equipmentDropChances[i] = 0.085F; } }
public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - this.parentEntity.posX; double d1 = this.posY - this.parentEntity.posY; double d2 = this.posZ - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.parentEntity.getRNG().nextInt(5) + 2; d3 = (double)MathHelper.sqrt_double(d3); if (this.isNotColliding(this.posX, this.posY, this.posZ, d3)) { this.parentEntity.motionX += d0 / d3 * 0.1D; this.parentEntity.motionY += d1 / d3 * 0.1D; this.parentEntity.motionZ += d2 / d3 * 0.1D; } else { this.action = EntityMoveHelper.Action.WAIT; } } } }
public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - this.entity.posX; double d1 = this.posY - this.entity.posY; double d2 = this.posZ - this.entity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; d3 = (double)MathHelper.sqrt(d3); if (d3 < this.entity.getEntityBoundingBox().getAverageEdgeLength()) { this.action = EntityMoveHelper.Action.WAIT; this.entity.motionX *= 0.5D; this.entity.motionY *= 0.5D; this.entity.motionZ *= 0.5D; } else { this.entity.motionX += d0 / d3 * 0.05D * this.speed; this.entity.motionY += d1 / d3 * 0.05D * this.speed; this.entity.motionZ += d2 / d3 * 0.05D * this.speed; if (this.entity.getAttackTarget() == null) { this.entity.rotationYaw = -((float)MathHelper.atan2(this.entity.motionX, this.entity.motionZ)) * (180F / (float)Math.PI); this.entity.renderYawOffset = this.entity.rotationYaw; } else { double d4 = this.entity.getAttackTarget().posX - this.entity.posX; double d5 = this.entity.getAttackTarget().posZ - this.entity.posZ; this.entity.rotationYaw = -((float)MathHelper.atan2(d4, d5)) * (180F / (float)Math.PI); this.entity.renderYawOffset = this.entity.rotationYaw; } } } }
public void onUpdateMoveHelper() { if(action == EntityMoveHelper.Action.MOVE_TO && !entity.getNavigator().noPath()) { double d0 = posX - entity.posX; double d1 = posY - entity.posY; double d2 = posZ - entity.posZ; double speed = MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2); speed = speed * entity.getEntityAttribute(SharedMonsterAttributes.FLYING_SPEED).getAttributeValue(); float flyingSpeed = (float) (this.entity.getAIMoveSpeed() + (speed - this.entity.getAIMoveSpeed()) * 0.125F); if(flyingSpeed > 1F) { flyingSpeed = 1F; } entity.setAIMoveSpeed(flyingSpeed); entity.setMoveVertical(d1 > 0.0D ? flyingSpeed : -flyingSpeed); float f = (float)(MathHelper.atan2(d2, d0) * (180D / Math.PI)) - 90.0F; this.entity.rotationYaw = this.limitAngle(this.entity.rotationYaw, f, 180F); this.entity.renderYawOffset = this.entity.rotationYaw; double d4 = (double)MathHelper.sqrt(d0 * d0 + d2 * d2); float f2 = (float)(-(MathHelper.atan2(d1, d4) * (180D / Math.PI))); this.entity.rotationPitch = this.limitAngle(this.entity.rotationPitch, f2, 180F); } else { entity.setAIMoveSpeed(0F); entity.setMoveForward(0F); entity.setMoveVertical(0F); entity.motionX *= 0.75; entity.motionY *= 0.75; entity.motionZ *= 0.75; } }
public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - EntityVex.this.posX; double d1 = this.posY - EntityVex.this.posY; double d2 = this.posZ - EntityVex.this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; d3 = (double)MathHelper.sqrt(d3); if (d3 < EntityVex.this.getEntityBoundingBox().getAverageEdgeLength()) { this.action = EntityMoveHelper.Action.WAIT; EntityVex.this.motionX *= 0.5D; EntityVex.this.motionY *= 0.5D; EntityVex.this.motionZ *= 0.5D; } else { EntityVex.this.motionX += d0 / d3 * 0.05D * this.speed; EntityVex.this.motionY += d1 / d3 * 0.05D * this.speed; EntityVex.this.motionZ += d2 / d3 * 0.05D * this.speed; if (EntityVex.this.getAttackTarget() == null) { EntityVex.this.rotationYaw = -((float)MathHelper.atan2(EntityVex.this.motionX, EntityVex.this.motionZ)) * (180F / (float)Math.PI); EntityVex.this.renderYawOffset = EntityVex.this.rotationYaw; } else { double d4 = EntityVex.this.getAttackTarget().posX - EntityVex.this.posX; double d5 = EntityVex.this.getAttackTarget().posZ - EntityVex.this.posZ; EntityVex.this.rotationYaw = -((float)MathHelper.atan2(d4, d5)) * (180F / (float)Math.PI); EntityVex.this.renderYawOffset = EntityVex.this.rotationYaw; } } } }
public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - this.parentEntity.posX; double d1 = this.posY - this.parentEntity.posY; double d2 = this.posZ - this.parentEntity.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; if (this.courseChangeCooldown-- <= 0) { this.courseChangeCooldown += this.parentEntity.getRNG().nextInt(5) + 2; d3 = (double)MathHelper.sqrt(d3); if (this.isNotColliding(this.posX, this.posY, this.posZ, d3)) { this.parentEntity.motionX += d0 / d3 * 0.1D; this.parentEntity.motionY += d1 / d3 * 0.1D; this.parentEntity.motionZ += d2 / d3 * 0.1D; } else { this.action = EntityMoveHelper.Action.WAIT; } } } }
@Override public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - EntityDevil.this.posX; double d1 = this.posY - EntityDevil.this.posY; double d2 = this.posZ - EntityDevil.this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; d3 = MathHelper.sqrt(d3); if (d3 < EntityDevil.this.getEntityBoundingBox().getAverageEdgeLength()) { this.action = EntityMoveHelper.Action.WAIT; EntityDevil.this.motionX *= 0.5D; EntityDevil.this.motionY *= 0.5D; EntityDevil.this.motionZ *= 0.5D; } else { EntityDevil.this.motionX += d0 / d3 * 0.05D * this.speed; EntityDevil.this.motionY += d1 / d3 * 0.05D * this.speed; EntityDevil.this.motionZ += d2 / d3 * 0.05D * this.speed; /*if (EntityDevil.this.getAttackTarget() == null) {*/ EntityDevil.this.rotationYaw = -((float)MathHelper.atan2(EntityDevil.this.motionX, EntityDevil.this.motionZ)) * (180F / (float)Math.PI); EntityDevil.this.renderYawOffset = EntityDevil.this.rotationYaw; /*} else { double d4 = EntityDevil.this.getAttackTarget().posX - EntityDevil.this.posX; double d5 = EntityDevil.this.getAttackTarget().posZ - EntityDevil.this.posZ; EntityDevil.this.rotationYaw = -((float)MathHelper.atan2(d4, d5)) * (180F / (float)Math.PI); EntityDevil.this.renderYawOffset = EntityDevil.this.rotationYaw; }*/ } } }
@Override public void onUpdateMoveHelper() { if (this.action == EntityMoveHelper.Action.MOVE_TO) { double d0 = this.posX - EntityAngel.this.posX; double d1 = this.posY - EntityAngel.this.posY; double d2 = this.posZ - EntityAngel.this.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; d3 = MathHelper.sqrt(d3); if (d3 < EntityAngel.this.getEntityBoundingBox().getAverageEdgeLength()) { this.action = EntityMoveHelper.Action.WAIT; EntityAngel.this.motionX *= 0.5D; EntityAngel.this.motionY *= 0.5D; EntityAngel.this.motionZ *= 0.5D; } else { EntityAngel.this.motionX += d0 / d3 * 0.05D * this.speed; EntityAngel.this.motionY += d1 / d3 * 0.05D * this.speed; EntityAngel.this.motionZ += d2 / d3 * 0.05D * this.speed; //if (EntityAngel.this.getAttackTarget() == null) //{ EntityAngel.this.rotationYaw = -((float)MathHelper.atan2(EntityAngel.this.motionX, EntityAngel.this.motionZ)) * (180F / (float)Math.PI); EntityAngel.this.renderYawOffset = EntityAngel.this.rotationYaw; /*} else { double d4 = EntityAngel.this.getAttackTarget().posX - EntityAngel.this.posX; double d5 = EntityAngel.this.getAttackTarget().posZ - EntityAngel.this.posZ; EntityAngel.this.rotationYaw = -((float)MathHelper.atan2(d4, d5)) * (180F / (float)Math.PI); EntityAngel.this.renderYawOffset = EntityAngel.this.rotationYaw; }*/ } } }
public boolean shouldExecute() { EntityMoveHelper moveHelper = this.raven.getMoveHelper(); if (!moveHelper.isUpdating()) { return true; } else { double d0 = moveHelper.getX() - this.raven.posX; double d1 = moveHelper.getY() - this.raven.posY; double d2 = moveHelper.getZ() - this.raven.posZ; double d3 = d0 * d0 + d1 * d1 + d2 * d2; return d3 < 1 || d3 > 3600; } }
public void onUpdateMoveHelper() { this.entity.rotationYawHead = this.entity.rotationYaw; this.entity.renderYawOffset = this.entity.rotationYaw; if (this.action != EntityMoveHelper.Action.MOVE_TO) this.entity.setMoveForward(0); else { this.action = EntityMoveHelper.Action.WAIT; if (this.entity.onGround) { this.entity.setAIMoveSpeed((float) (this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue())); if (this.jumpDelay-- <= 0) { this.jumpDelay = this.slime.getJumpDelay(); this.slime.getJumpHelper().setJumping(); if (this.slime.makesSoundOnJump()) { this.slime.playSound(this.slime.getJumpSound(), this.slime.getSoundVolume(), ((this.slime.getRNG().nextFloat() * 0.2F + 1) * 0.8F)); } } else { this.slime.moveStrafing = 0; this.slime.moveForward = 0; this.entity.setAIMoveSpeed(0); } } else { this.entity.setAIMoveSpeed((float) (this.speed * this.entity.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue())); } } }
public EventEntityLivingInit(EntityLiving entity, World world, EntityAITasks tasks, EntityAITasks targetTasks, EntityLookHelper lookHelper, EntityMoveHelper moveHelper, EntityJumpHelper jumpHelper, EntityBodyHelper bodyHelper, PathNavigate navigator, EntitySenses senses) { this.entity = entity; this.world = world; this.tasks = tasks; this.targetTasks = targetTasks; this.lookHelper = lookHelper; this.jumpHelper = jumpHelper; this.moveHelper = moveHelper; this.bodyHelper = bodyHelper; this.navigator = navigator; this.senses = senses; }
public EntityMoveHelper getMoveHelper() { return this.moveHelper; }