Created
October 1, 2017 09:51
-
-
Save triphion/ec368c553b318278b0340b46413e18a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.triphion.ancient.entity; | |
import java.util.Random; | |
import com.triphion.ancient.handlers.AncientSoundHandler; | |
import net.minecraft.block.Block; | |
import net.minecraft.block.state.IBlockState; | |
import net.minecraft.entity.EntityLiving; | |
import net.minecraft.entity.EnumCreatureAttribute; | |
import net.minecraft.entity.IEntityLivingData; | |
import net.minecraft.entity.SharedMonsterAttributes; | |
import net.minecraft.entity.ai.EntityAIAttackMelee; | |
import net.minecraft.entity.ai.EntityAIHurtByTarget; | |
import net.minecraft.entity.ai.EntityAILookIdle; | |
import net.minecraft.entity.ai.EntityAIMoveThroughVillage; | |
import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; | |
import net.minecraft.entity.ai.EntityAINearestAttackableTarget; | |
import net.minecraft.entity.ai.EntityAISwimming; | |
import net.minecraft.entity.ai.EntityAIWanderAvoidWater; | |
import net.minecraft.entity.ai.EntityAIWatchClosest; | |
import net.minecraft.entity.ai.EntityAIZombieAttack; | |
import net.minecraft.entity.monster.EntityGhast; | |
import net.minecraft.entity.monster.EntityIronGolem; | |
import net.minecraft.entity.monster.EntityMob; | |
import net.minecraft.entity.monster.EntityPigZombie; | |
import net.minecraft.entity.passive.EntityVillager; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.init.SoundEvents; | |
import net.minecraft.item.Item; | |
import net.minecraft.util.DamageSource; | |
import net.minecraft.util.SoundEvent; | |
import net.minecraft.util.datafix.DataFixer; | |
import net.minecraft.util.math.BlockPos; | |
import net.minecraft.util.math.MathHelper; | |
import net.minecraft.util.math.RayTraceResult; | |
import net.minecraft.util.math.Vec3d; | |
import net.minecraft.world.DifficultyInstance; | |
import net.minecraft.world.World; | |
public class EntityTheFrost extends EntityMob | |
{ | |
public EntityTheFrost(World worldIn) { | |
super(worldIn); | |
this.experienceValue = 50; | |
this.setSize(1, 1.8F); | |
} | |
@Override | |
protected void initEntityAI() { | |
this.tasks.addTask(0, new EntityAISwimming(this)); | |
this.tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, false)); | |
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); | |
this.tasks.addTask(7, new EntityAIWanderAvoidWater(this, 1.0D)); | |
this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); | |
this.tasks.addTask(8, new EntityAILookIdle(this)); | |
this.applyEntityAI(); | |
} | |
protected void applyEntityAI() { | |
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityPigZombie.class})); | |
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true)); | |
} | |
@Override | |
protected void applyEntityAttributes() { | |
super.applyEntityAttributes(); | |
this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).setBaseValue(3000.0D); | |
this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(600.0D); | |
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.10000002417232513D); | |
this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(95.0D); | |
this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(50.0D); | |
} | |
@Override | |
protected void entityInit() { | |
super.entityInit(); | |
} | |
public static void registerFixesTheFrost(DataFixer fixer) | |
{ | |
EntityLiving.registerFixesMob(fixer, EntityTheFrost.class); | |
} | |
@Override | |
protected SoundEvent getAmbientSound() { | |
return AncientSoundHandler.theFrossAmbient2; | |
} | |
@Override | |
protected SoundEvent getHurtSound() { | |
return AncientSoundHandler.theFrossHurt; | |
} | |
@Override | |
protected SoundEvent getDeathSound() { | |
return AncientSoundHandler.theFrossDeath; | |
} | |
protected SoundEvent getStepSound() | |
{ | |
return AncientSoundHandler.theFrossAmbient; | |
} | |
@Override | |
public void playLivingSound() { | |
this.playSound(this.getAmbientSound(), 0.15F, 1.0F); | |
} | |
@Override | |
protected void playStepSound(BlockPos pos, Block blockIn) { | |
this.playSound(this.getStepSound(), 0.15F, 1.0F); | |
} | |
@Override | |
public EnumCreatureAttribute getCreatureAttribute() { | |
return EnumCreatureAttribute.UNDEAD; | |
} | |
@Override | |
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) { | |
livingdata = super.onInitialSpawn(difficulty, livingdata); | |
this.setEquipmentBasedOnDifficulty(difficulty); | |
this.setEnchantmentBasedOnDifficulty(difficulty); | |
return livingdata; | |
} | |
@Override | |
public void onLivingUpdate() { | |
super.onLivingUpdate(); | |
} | |
@Override | |
public float getEyeHeight() { | |
return 1.6F; | |
} | |
@Override | |
protected Item getDropItem() { | |
return null; | |
} | |
@Override | |
protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier) { | |
super.dropFewItems(wasRecentlyHit, lootingModifier); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment