public void c() { super.c(); if (this.br > 0) { --this.br; } if (this.bs > 0) { --this.bs; } if (this.motX * this.motX + this.motZ * this.motZ > 2.500000277905201E-7D && this.random.nextInt(5) == 0) { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int k = MathHelper.floor(this.locZ); int l = this.world.getTypeId(i, j, k); if (l > 0) { this.world.addParticle( "tilecrack_" + l + "_" + this.world.getData(i, j, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.random.nextFloat() - 0.5D), 0.5D, ((double) this.random.nextFloat() - 0.5D) * 4.0D); } } }
/** Called when the mob's health reaches 0. */ public void onDeath(DamageSource par1DamageSource) { if (!this.isPlayerCreated() && this.attackingPlayer != null && this.villageObj != null) { this.villageObj.setReputationForPlayer(this.attackingPlayer.getCommandSenderName(), -5); } super.onDeath(par1DamageSource); }
protected void n(Entity entity) { if (entity instanceof IMonster && this.aD().nextInt(20) == 0) { this.setGoalTarget((EntityLiving) entity); } super.n(entity); }
protected void collideWithEntity(Entity par1Entity) { if (par1Entity instanceof IMob && this.getRNG().nextInt(20) == 0) { this.setAttackTarget((EntityLivingBase) par1Entity); } super.collideWithEntity(par1Entity); }
public void die(DamageSource damagesource) { if (!this.isPlayerCreated() && this.killer != null && this.bp != null) { this.bp.a(this.killer.getName(), -5); } super.die(damagesource); }
/** * Called frequently so the entity can update its state every tick as required. For example, * zombies and skeletons use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (this.attackTimer > 0) { --this.attackTimer; } if (this.holdRoseTick > 0) { --this.holdRoseTick; } if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) { int i = MathHelper.floor_double(this.posX); int j = MathHelper.floor_double(this.posY - 0.20000000298023224D); int k = MathHelper.floor_double(this.posZ); IBlockState iblockstate = this.worldObj.getBlockState(new BlockPos(i, j, k)); Block block = iblockstate.getBlock(); if (block.getMaterial() != Material.air) { this.worldObj.spawnParticle( EnumParticleTypes.BLOCK_CRACK, this.posX + ((double) this.rand.nextFloat() - 0.5D) * (double) this.width, this.getEntityBoundingBox().minY + 0.1D, this.posZ + ((double) this.rand.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.rand.nextFloat() - 0.5D), 0.5D, ((double) this.rand.nextFloat() - 0.5D) * 4.0D, new int[] {Block.getStateId(iblockstate)}); } } }
/** * Called frequently so the entity can update its state every tick as required. For example, * zombies and skeletons use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (this.attackTimer > 0) { --this.attackTimer; } if (this.holdRoseTick > 0) { --this.holdRoseTick; } if (this.motionX * this.motionX + this.motionZ * this.motionZ > 2.500000277905201E-7D && this.rand.nextInt(5) == 0) { int var1 = MathHelper.floor_double(this.posX); int var2 = MathHelper.floor_double(this.posY - 0.20000000298023224D - (double) this.yOffset); int var3 = MathHelper.floor_double(this.posZ); int var4 = this.worldObj.getBlockId(var1, var2, var3); if (var4 > 0) { this.worldObj.spawnParticle( "tilecrack_" + var4 + "_" + this.worldObj.getBlockMetadata(var1, var2, var3), this.posX + ((double) this.rand.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.minY + 0.1D, this.posZ + ((double) this.rand.nextFloat() - 0.5D) * (double) this.width, 4.0D * ((double) this.rand.nextFloat() - 0.5D), 0.5D, ((double) this.rand.nextFloat() - 0.5D) * 4.0D); } } }
protected void collideWithEntity(Entity p_82167_1_) { if (p_82167_1_ instanceof IMob && !(p_82167_1_ instanceof EntityCreeper) && this.getRNG().nextInt(20) == 0) { this.setAttackTarget((EntityLivingBase) p_82167_1_); } super.collideWithEntity(p_82167_1_); }
public void handleStatusUpdate(byte id) { if (id == 4) { this.attackTimer = 10; this.playSound("mob.irongolem.throw", 1.0F, 1.0F); } else if (id == 11) { this.holdRoseTick = 400; } else { super.handleStatusUpdate(id); } }
public void handleHealthUpdate(byte par1) { if (par1 == 4) { this.attackTimer = 10; this.playSound("mob.irongolem.throw", 1.0F, 1.0F); } else if (par1 == 11) { this.holdRoseTick = 400; } else { super.handleHealthUpdate(par1); } }
protected void updateAITasks() { if (--this.homeCheckTimer <= 0) { this.homeCheckTimer = 70 + this.rand.nextInt(50); this.villageObj = this.worldObj.getVillageCollection().getNearestVillage(new BlockPos(this), 32); if (this.villageObj == null) { this.detachHome(); } else { BlockPos blockpos = this.villageObj.getCenter(); this.setHomePosAndDistance( blockpos, (int) ((float) this.villageObj.getVillageRadius() * 0.6F)); } } super.updateAITasks(); }
/** * Called frequently so the entity can update its state every tick as required. For example, * zombies and skeletons use this to react to sunlight and start to burn. */ public void onLivingUpdate() { super.onLivingUpdate(); if (entityToAttack == null && !hasPath() && worldObj.rand.nextInt(100) == 0 && fixai) { List list = worldObj.getEntitiesWithinAABB( net.minecraft.src.EntityMob.class, AxisAlignedBB.getBoundingBoxFromPool( posX, posY, posZ, posX + 1.0D, posY + 1.0D, posZ + 1.0D) .expand(16D, 4D, 16D)); if (!list.isEmpty()) { setTarget((Entity) list.get(worldObj.rand.nextInt(list.size()))); } } if (isWet()) { attackEntityFrom(DamageSource.drown, 1); } int i = MathHelper.floor_double(posX); int k = MathHelper.floor_double(posZ); if (worldObj.getBiomeGenForCoords(i, k).getFloatTemperature() > 1.0F) { attackEntityFrom(DamageSource.onFire, 1); } for (int j = 0; j < 4; j++) { int l = MathHelper.floor_double(posX + (double) ((float) ((j % 2) * 2 - 1) * 0.25F)); int i1 = MathHelper.floor_double(posY); int j1 = MathHelper.floor_double(posZ + (double) ((float) (((j / 2) % 2) * 2 - 1) * 0.25F)); if (worldObj.getBlockId(l, i1, j1) == 0 && worldObj.getBiomeGenForCoords(l, j1).getFloatTemperature() < 0.8F && Block.snow.canPlaceBlockAt(worldObj, l, i1, j1)) { worldObj.setBlockWithNotify(l, i1, j1, Block.snow.blockID); } } }
/** main AI tick function, replaces updateEntityActionState */ protected void updateAITick() { if (--this.homeCheckTimer <= 0) { this.homeCheckTimer = 70 + this.rand.nextInt(50); this.villageObj = this.worldObj.villageCollectionObj.findNearestVillage( MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ), 32); if (this.villageObj == null) { this.func_110177_bN(); } else { ChunkCoordinates var1 = this.villageObj.getCenter(); this.func_110171_b( var1.posX, var1.posY, var1.posZ, (int) ((float) this.villageObj.getVillageRadius() * 0.6F)); } } super.updateAITick(); }
protected void bk() { if (--this.bq <= 0) { this.bq = 70 + this.random.nextInt(50); this.bp = this.world.villages.getClosestVillage( MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32); if (this.bp == null) { this.bR(); } else { ChunkCoordinates chunkcoordinates = this.bp.getCenter(); this.b( chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) this.bp.getSize() * 0.6F)); } } super.bk(); }
protected void attackEntity(Entity entity, float f) { if (!fixai) { super.attackEntity(entity, f); } if (f < 10F) { double d = entity.posX - posX; double d1 = entity.posZ - posZ; if (attackTime == 0) { EntitySnowball entitysnowball = new EntitySnowball(worldObj, this); double d2 = (entity.posY + (double) entity.getEyeHeight()) - 1.1000000238418579D - entitysnowball.posY; float f1 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.2F; worldObj.playSoundAtEntity( this, "random.bow", 1.0F, 1.0F / (rand.nextFloat() * 0.4F + 0.8F)); worldObj.spawnEntityInWorld(entitysnowball); entitysnowball.setThrowableHeading(d, d2 + (double) f1, d1, 1.6F, 12F); attackTime = 10; } rotationYaw = (float) ((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; hasAttacked = true; } }
protected void func_110147_ax() { super.func_110147_ax(); this.func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(100.0D); this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.25D); }
protected void entityInit() { super.entityInit(); this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); }
/** (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); this.setPlayerCreated(par1NBTTagCompound.getBoolean("PlayerCreated")); }
protected void az() { super.az(); this.getAttributeInstance(GenericAttributes.a).setValue(100.0D); this.getAttributeInstance(GenericAttributes.d).setValue(0.25D); }
protected void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); }
public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.setPlayerCreated(nbttagcompound.getBoolean("PlayerCreated")); }
/** (abstract) Protected helper method to read subclass entity data from NBT. */ public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); }
/** (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); }
protected void a() { super.a(); this.datawatcher.a(16, Byte.valueOf((byte) 0)); }
public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setBoolean("PlayerCreated", this.isPlayerCreated()); }
/** (abstract) Protected helper method to write subclass entity data to NBT. */ public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); par1NBTTagCompound.setBoolean("PlayerCreated", this.isPlayerCreated()); }