Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.6.4] Peaceful Mob


ZaphielArchangel
 Share

Recommended Posts

I'm trying to make a my custom peaceful mob attack my custom mob.

Heres the code for the mob:

 

[spoiler=Code]package ZaphielArchangel.World.Mobs;

 

import ZaphielArchangel.TotalCorruption.BaseClass;

import ZaphielArchangel.TotalCorruption.Other.Sound;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIDefendVillage;

import net.minecraft.entity.ai.EntityAIHurtByTarget;

import net.minecraft.entity.ai.EntityAILookAtVillager;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMoveThroughVillage;

import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction;

import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.ai.EntityAIWatchClosest;

import net.minecraft.entity.monster.EntityGolem;

import net.minecraft.entity.monster.IMob;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.world.World;

 

public class Tyrael extends EntityGolem{

 

public Tyrael(World par1World) {

super(par1World);

this.experienceValue = 10;

this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true));

        this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F));

        this.tasks.addTask(3, new EntityAIMoveThroughVillage(this, 0.6D, true));

        this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));

        this.tasks.addTask(6, new EntityAIWander(this, 0.6D));

        this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));

        this.tasks.addTask(8, new EntityAILookIdle(this));

        this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));

        this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));

}

public int getTotalArmorValue()

    {

        int i = super.getTotalArmorValue() + 2;

 

        if (i > 20)

        {

            i = 20;

        }

 

        return i;

    }

protected int getDropItemId()

    {

        return BaseClass.DivineFragment.itemID;

    }

 

protected void applyEntityAttributes()

    {

        super.applyEntityAttributes();

        this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(100.0D);

        this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D);

    }

    protected void collideWithEntity(Entity par1Entity)

    {

        if (par1Entity instanceof IMob && this.getRNG().nextInt(20) == 0)

        {

            this.setAttackTarget((EntityLivingBase)par1Entity);

        }

 

        super.collideWithEntity(par1Entity);

    }

   

    public boolean canAttackClass(Class par1Class)

    {

        return super.canAttackClass(par1Class);

    }

   

}

 

 

 

HELP PLEASE

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.