Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.EternIsles.boss.kror;
- import net.EternIsles.common.eternisles;
- import net.EternIsles.izer.Itemizer;
- import net.EternIsles.izer.Weaponizer;
- import net.minecraft.block.Block;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLiving;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.monster.EntityMob;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.projectile.EntityArrow;
- import net.minecraft.entity.projectile.EntityThrowable;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.Vec3;
- import net.minecraft.world.EnumDifficulty;
- import net.minecraft.world.World;
- public class EntityKror extends EntityMob {
- private int musicTick = 1;
- public EntityKror(World par1World) {
- super(par1World);
- this.setSize(4.8F, 5.1F);
- // TODO Auto-generated constructor stub
- }
- protected String getLivingSound() {
- return "eternisles:KrorLiving";
- }
- protected String getDeathSound() {
- return "eternisles:KrorDeath";
- }
- protected String getHurtSound() {
- return "eternisles:KrorLiving";
- }
- @Override
- protected void func_145780_a(int p_145780_1_, int p_145780_2_, int p_145780_3_, Block p_145780_4_) {
- this.playSound("eternisles:HeavyStep", 0.85F, 1.0F);
- }
- @Override
- protected void dropFewItems(boolean par1, int par2) {
- }
- @Override
- public void onDeath(DamageSource d) {
- super.onDeath(d);
- if(worldObj.isRemote){
- eternisles.sendMessageToAll("Kror has crumbled apart.");
- }
- }
- @Override
- public void onLivingUpdate() {
- super.onLivingUpdate();
- this.musicTick--;
- if (this.musicTick == 0){
- this.musicTick = 310;
- this.playSound("eternisles:MusicKror", 2.80F, 1.0F);
- }
- EntityPlayer var1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 64.0D);
- if (var1 == null)
- return;
- else
- {
- Vec3 var3 = var1.getLook(1.0F).normalize();
- Vec3 var4 = Vec3.createVectorHelper(this.posX - var1.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - var1.posY + (double)var1.getEyeHeight(), this.posZ - var1.posZ);
- double var5 = var4.lengthVector();
- var4 = var4.normalize();
- double var7 = var3.dotProduct(var4);
- if( var7 > 1.0D - 0.025D / var5 && var1.canEntityBeSeen(this))
- {
- var1.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 80, 50));
- }
- }
- }
- protected Entity findPlayerToAttack() {
- EntityPlayer entityPlayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 16.0D);
- return entityPlayer != null && this.canEntityBeSeen(entityPlayer) ? entityPlayer : null;
- }
- public void applyEntityAttributes() {
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(60.0D);
- this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(52.0D);
- this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(1.0D);
- this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.8D);
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2200.0D);
- }
- @Override
- public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
- Entity entity;
- entity = par1DamageSource.getSourceOfDamage();
- if (entity instanceof EntityThrowable) {
- ((EntityThrowable) entity).getThrower().attackEntityFrom(DamageSource.causeMobDamage(this), par2/3);
- }
- if (entity instanceof EntityArrow) {
- par1DamageSource.getEntity().attackEntityFrom(DamageSource.causeMobDamage(this), par2/3);
- }
- return super.attackEntityFrom(par1DamageSource, par2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement