Jump to content

Recommended Posts

Posted

Titles says it all...

I DID implement IBossDisplayData. Is that not enough?

 

Entity code:

 

 

package com.fandomcraft.entity;

 

import java.util.UUID;

 

import net.minecraft.command.IEntitySelector;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityAgeable;

import net.minecraft.entity.EntityList;

import net.minecraft.entity.EntityLiving;

import net.minecraft.entity.EntityLivingBase;

import net.minecraft.entity.EnumCreatureAttribute;

import net.minecraft.entity.SharedMonsterAttributes;

import net.minecraft.entity.ai.EntityAIAttackOnCollide;

import net.minecraft.entity.ai.EntityAIAvoidEntity;

import net.minecraft.entity.ai.EntityAIFollowOwner;

import net.minecraft.entity.ai.EntityAILookIdle;

import net.minecraft.entity.ai.EntityAIMate;

import net.minecraft.entity.ai.EntityAIMoveTowardsTarget;

import net.minecraft.entity.ai.EntityAINearestAttackableTarget;

import net.minecraft.entity.ai.EntityAIPanic;

import net.minecraft.entity.ai.EntityAISwimming;

import net.minecraft.entity.ai.EntityAITempt;

import net.minecraft.entity.ai.EntityAIWander;

import net.minecraft.entity.monster.EntityMob;

import net.minecraft.entity.monster.IMob;

import net.minecraft.entity.passive.EntityAnimal;

import net.minecraft.entity.passive.EntityOcelot;

import net.minecraft.entity.passive.EntityTameable;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntityArrow;

import net.minecraft.entity.ai.EntityAIFollowOwner;

import net.minecraft.entity.boss.IBossDisplayData;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.DamageSource;

import net.minecraft.world.World;

 

import com.fandomcraft.main.Main;

 

import cpw.mods.fml.common.registry.EntityRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class EntityChaosBoss extends EntityMob implements IBossDisplayData

{

    private int attackTimer;

private EntityAITempt aiTempt;

    protected void fall(float p_70069_1_) {}

   

    private static final IEntitySelector attackEntitySelector = new IEntitySelector()

    {

        public boolean isEntityApplicable(Entity p_82704_1_)

        {

            return p_82704_1_ instanceof EntityLivingBase && ((EntityLivingBase)p_82704_1_).getCreatureAttribute() != EnumCreatureAttribute.UNDEAD;

        }

    };

 

public EntityChaosBoss(World world)

{

super(world);

this.setSize(1F, 5F);

        this.getNavigator().setAvoidsWater(true);

this.tasks.addTask(0, new EntityAIWander(this, 0.3D));

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

        this.tasks.addTask(2, this.aiTempt = new EntityAITempt(this, 0.6D, Items.bone, true));

        this.tasks.addTask(3, new EntityAIAttackOnCollide(this, 2.0D, true));

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

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

        this.isImmuneToFire = true;

        this.experienceValue = 100;

}

 

    protected String getHurtSound()

    {

        return "mob.wither.hurt";

    }

 

    protected String getDeathSound()

    {

        return "mob.wither.death";

    }

    protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)

    {

        if (p_70628_1_)

        {

            int j = this.rand.nextInt(3 + p_70628_2_);

 

            for (int k = 0; k < j; ++k)

            {

                this.dropItem(Main.ring, 1);

            }

        }

    }

    @SideOnly(Side.CLIENT)

    public int getAttackTimer()

    {

        return this.attackTimer;

    }

    public int getTotalArmorValue()

    {

        return 4;

    }

    public boolean isArmored()

    {

        return this.getHealth() <= this.getMaxHealth() / 2.0F;

    }

   

 

    protected void collideWithEntity(Entity p_82167_1_)

    {

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

        {

            this.setAttackTarget((EntityLivingBase)p_82167_1_);

        }

 

        super.collideWithEntity(p_82167_1_);

    }

    public boolean attackEntityAsMob(Entity p_70652_1_)

    {

        this.attackTimer = 10;

        this.worldObj.setEntityState(this, (byte)4);

        boolean flag = p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float)(7 + this.rand.nextInt(15)));

 

        if (flag)

        {

            p_70652_1_.motionY += 0.4000000059604645D;

        }

 

        this.playSound("fandomcraft:attack2", 1.0F, 1.0F);

        return flag;

    }

   

    protected Item getDropItem()

    {

        return Main.ring;

    }

   

public static void mainRegistry()

{

registerEntity();

}

 

private static void registerEntity()

{

createEntity(EntityChaosBoss.class, "ChaosBoss", 0xABFFF4, 0xFF00EE);

}

 

public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour)

{

int id = EntityRegistry.findGlobalUniqueEntityId();

EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);

EntityRegistry.registerModEntity(entityClass, entityName, id, Main.instance, 64, 1, true);

createEgg(id, solidColour, spotColour);

}

 

private static void createEgg(int id, int solidColour, int spotColour)

{

EntityList.entityEggs.put(Integer.valueOf(id), new EntityList.EntityEggInfo(id, solidColour, spotColour));

}

 

public boolean isAIenabled()

{

return true;

}

 

protected void applyEntityAttributes()

{

super.applyEntityAttributes();

 

this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(800D);

this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.5D);

this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(32D);

}

 

 

}

 

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.