Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lolmod.entitys;
- import lolmod.entitys.ai.EntityAIWalkHome;
- import lolmod.game.Game;
- import net.minecraft.block.Block;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.ai.EntityAIHurtByTarget;
- import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
- import net.minecraft.entity.monster.EntityPigZombie;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.SoundEvents;
- import net.minecraft.util.DamageSource;
- import net.minecraft.util.SoundEvent;
- import net.minecraft.util.math.BlockPos;
- import net.minecraft.world.World;
- public class EntityBluebuff extends EntityNeutral {
- private int side;
- public EntityBluebuff(World worldIn) {
- this(worldIn, Game.TEAM_BLAU);
- }
- @Override
- public void setAttackTarget(EntityLivingBase entitylivingbaseIn) {
- System.out.println("setting attack target");
- super.setAttackTarget(entitylivingbaseIn);
- }
- public EntityBluebuff(World worldIn, int side) {
- super(worldIn);
- this.side = side;
- if(this.side == Game.TEAM_BLAU)
- this.setHomePosAndDistance(Game.BLUEBUFF_WEST, 10);
- else
- this.setHomePosAndDistance(Game.BLUEBUFF_EAST, 10);
- this.setSize(0.6F, 1.95F);
- }
- @Override
- protected void initEntityAI() {
- this.tasks.addTask(1, new EntityAIWalkHome(this));
- this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[] {EntityPigZombie.class}));
- this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
- //this.targetTasks.addTask(2, new EntityAINeutralHurtByTarget(this));
- }
- @Override
- public boolean attackEntityAsMob(Entity entityIn) {
- boolean flag = entityIn.attackEntityFrom(DamageSource.causeMobDamage(this), (float)((int)this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue()));
- if(flag) {
- this.applyEnchantments(this, entityIn);
- }
- return flag;
- }
- @Override
- protected void applyEntityAttributes() {
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.30000001192092896D);
- this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(20.0D);
- this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(0D);
- this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(2.0D);
- }
- @Override
- protected void updateAITasks() {
- super.updateAITasks();
- }
- protected SoundEvent getHurtSound(DamageSource p_184601_1_) {
- return SoundEvents.ENTITY_IRONGOLEM_HURT;
- }
- protected SoundEvent getDeathSound() {
- return SoundEvents.ENTITY_IRONGOLEM_DEATH;
- }
- protected void playStepSound(BlockPos pos, Block blockIn) {
- this.playSound(SoundEvents.ENTITY_IRONGOLEM_STEP, 1.0F, 1.0F);
- }
- @Override
- public void onDeath(DamageSource cause) {
- super.onDeath(cause);
- }
- @Override
- public int getMaxSpawnedInChunk() {
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement