Jump to content

[SOLVED] [1.7.10] I need something to control the spawn of mobs of my mob.


Recommended Posts

Posted

I need something to control the number of spawn, the mobs number and the time that the mobs are invoked. This was defined in 1.2.5 version only this:

 

    private int stopLoop;

    private int timer;

    private int spawnNumber;

 

  public EntityNightmare (World world)

    {

        Super (world);

        stopLoop = 0;

[...]

if (attack == 2 && timer == 30 && spawnNumber <= 10)

        {

            int i = rand.nextInt (10) - rand.nextInt (10);

            int j = rand.nextInt (10) - rand.nextInt (10);

 

            if (i <= 4 && i> = -4)

            {

                if (rand.nextInt (2) == 0)

                {

                    i = 5;

                }

                else

                {

                    i = -5;

                }

            }

...

Basically it does not work in newer versions. I need something to control what happens in the Picture:

aVhKgNO.jpg

The rest works perfectly.

The class code:

 

 

package mod.mcreator;//based on master condiguration

 

import cpw.mods.fml.client.*;

import cpw.mods.fml.client.registry.*;

import cpw.mods.fml.common.*;

import cpw.mods.fml.common.asm.*;

import cpw.mods.fml.common.asm.transformers.*;

import cpw.mods.fml.common.discovery.*;

import cpw.mods.fml.common.discovery.asm.*;

import cpw.mods.fml.common.event.*;

import cpw.mods.fml.common.functions.*;

import cpw.mods.fml.common.network.*;

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

import cpw.mods.fml.common.toposort.*;

import cpw.mods.fml.common.versioning.*;

import cpw.mods.fml.relauncher.*;

import cpw.mods.fml.server.*;

import mod.mcreator.mcreator_assassinAdd.EntityassassinAdd;

import mod.mcreator.mcreator_herobrine.Entityherobrine;

import mod.mcreator.mcreator_reaperAdd.EntityreaperAdd;

import net.minecraft.block.*;

import net.minecraft.block.material.*;

import net.minecraft.client.*;

import net.minecraft.client.audio.*;

import net.minecraft.client.entity.*;

import net.minecraft.client.gui.*;

import net.minecraft.client.gui.achievement.*;

import net.minecraft.client.gui.inventory.*;

import net.minecraft.client.model.*;

import net.minecraft.client.multiplayer.*;

import net.minecraft.client.particle.*;

import net.minecraft.client.renderer.*;

import net.minecraft.client.renderer.culling.*;

import net.minecraft.client.renderer.entity.*;

import net.minecraft.client.renderer.tileentity.*;

import net.minecraft.client.settings.*;

import net.minecraft.command.*;

import net.minecraft.crash.*;

import net.minecraft.creativetab.*;

import net.minecraft.dispenser.*;

import net.minecraft.enchantment.*;

import net.minecraft.entity.*;

import net.minecraft.entity.ai.*;

import net.minecraft.entity.boss.*;

import net.minecraft.entity.effect.*;

import net.minecraft.entity.item.*;

import net.minecraft.entity.monster.*;

import net.minecraft.entity.passive.*;

import net.minecraft.entity.player.*;

import net.minecraft.entity.projectile.*;

import net.minecraft.inventory.*;

import net.minecraft.item.*;

import net.minecraft.item.crafting.*;

import net.minecraft.nbt.*;

import net.minecraft.network.*;

import net.minecraft.network.rcon.*;

import net.minecraft.pathfinding.*;

import net.minecraft.potion.*;

import net.minecraft.profiler.*;

import net.minecraft.server.*;

import net.minecraft.server.dedicated.*;

import net.minecraft.server.gui.*;

import net.minecraft.server.integrated.*;

import net.minecraft.server.management.*;

import net.minecraft.src.*;

import net.minecraft.stats.*;

import net.minecraft.tileentity.*;

import net.minecraft.util.*;

import net.minecraft.village.*;

import net.minecraft.world.*;

import net.minecraft.world.biome.*;

import net.minecraft.world.chunk.*;

import net.minecraft.world.chunk.storage.*;

import net.minecraft.world.demo.*;

import net.minecraft.world.gen.*;

import net.minecraft.world.gen.feature.*;

import net.minecraft.world.gen.layer.*;

import net.minecraft.world.gen.structure.*;

import net.minecraft.world.storage.*;

import net.minecraftforge.classloading.*;

import net.minecraftforge.client.*;

import net.minecraftforge.client.event.*;

import net.minecraftforge.client.event.sound.*;

import net.minecraftforge.common.*;

import net.minecraftforge.event.*;

import net.minecraftforge.event.entity.*;

import net.minecraftforge.event.entity.item.*;

import net.minecraftforge.event.entity.living.*;

import net.minecraftforge.event.entity.minecart.*;

import net.minecraftforge.event.entity.player.*;

import net.minecraftforge.event.terraingen.*;

import net.minecraftforge.event.world.*;

import net.minecraftforge.oredict.*;

import net.minecraftforge.transformers.*;

import net.minecraft.init.*;

 

import java.util.*;

 

@SuppressWarnings("unchecked")

public class mcreator_nightmare {

 

public static class mcreator_EntityBossStatus extends Entityherobrine

{

    private int jumpTicks;

    public int cooldown;

 

    /** Used to make a creature speed up and wander away when hit. */

    protected int fleeingTick;

 

    /**

    * returns true if a creature has attacked recently only used for creepers and skeletons

    */

    protected boolean hasAttacked;

    public double spawnPointX;

    public double spawnPointY;

    public double spawnPointZ;

    public int spell;

    public int spells;

    public int prevSpell;

    public int timer;

    protected int attackStrength;

    public boolean spellDone[];

    public float fightDistance;

    public double fightDistanceFromSpawnPoint;

    public Minecraft minecraft;

    public Entity prevTarget;

    public int spellDuration;

    public String battleMusic;

    protected float health;

    public int heartsLife;

    public int heartsHalvesLife;

    protected int naturalArmorRating;

    public float getMaxHealthWithLevel;

    protected float moveSpeed;

    public float field_704_R;

 

    public mcreator_EntityBossStatus(World world)

    {

        super(world);

        spellDone = new boolean[20];

        isImmuneToFire = true;

    }

 

    /**

    * Get this Entity's EnumCreatureAttribute

    */

    public EnumCreatureAttribute getCreatureAttribute()

    {

        return EnumCreatureAttribute.UNDEFINED;

    }

 

    /**

    * knocks back this entity

    */

    public void knockBack(Entity entity, int i, double d, double d1)

    {

    }

 

    /**

    * Determines if an entity can be despawned, used on idle far away entities

    */

    protected boolean canDespawn()

    {

        return false;

    }

 

    public int doSpell(int i, int j, int k, int l)

    {

        int i1 = 0;

        float f = entityToAttack.getDistanceToEntity(this);

 

        if (f < (float)i && rand.nextInt(j) == 0 && spell == 0 && cooldown == 0)

        {

            do

            {

                spell = 1 + rand.nextInt(k);

            }

            while (spellDone[spell] || spell == prevSpell);

 

            spellDone[spell] = true;

            prevSpell = spell;

            cooldown = l;

        }

 

        return i1;

    }

 

    public boolean didAllSpells()

    {

        boolean flag = true;

        int i = 1;

 

        do

        {

            if (i >= spells + 1)

            {

                break;

            }

 

            if (!spellDone)

            {

                flag = false;

                break;

            }

 

            flag = true;

            i++;

        }

        while (true);

 

        return flag;

    }

 

    public void goToPoint(double d, double d1)

    {

        double d2 = d - posX;

        double d3 = d1 - posZ;

        double d4 = MathHelper.sqrt_double(d2 * d2 + d3 * d3);

 

        if (d4 > 0.5D)

        {

            motionX = (d2 / d4) * 0.5D * 0.50000001192092891D + motionX * 0.20000000298023224D;

            motionZ = (d3 / d4) * 0.5D * 0.50000001192092891D + motionZ * 0.20000000298023224D;

        }

        else

        {

            posX = d;

            posZ = d1;

            motionX = 0.0D;

            motionZ = 0.0D;

            moveSpeed = 0.0F;

            field_704_R = 0.0F;

        }

    }

 

    public void goToSpawnPoint()

    {

        double d = spawnPointX - posX;

        double d1 = spawnPointZ - posZ;

        double d2 = MathHelper.sqrt_double(d * d + d1 * d1);

 

        if (d2 > 0.5D)

        {

            motionX = (d / d2) * 0.5D * 0.50000001192092891D + motionX * 0.20000000298023224D;

            motionZ = (d1 / d2) * 0.5D * 0.50000001192092891D + motionZ * 0.20000000298023224D;

        }

        else

        {

            posX = spawnPointX;

            posZ = spawnPointZ;

            motionX = 0.0D;

            motionZ = 0.0D;

            moveSpeed = 0.0F;

            field_704_R = 0.0F;

        }

    }

 

    public void goToEntity(Entity entity)

    {

        double d = entity.posX - posX;

        double d1 = entity.posZ - posZ;

        double d2 = MathHelper.sqrt_double(d * d + d1 * d1);

        faceEntity(entity, 10F, 40F);

        motionX = (d / d2) * 0.5D * 0.600000011920929D + motionX * 0.20000000298023224D;

        motionZ = (d1 / d2) * 0.5D * 0.600000011920929D + motionZ * 0.20000000298023224D;

    }

 

    public boolean isAtSpawnPoint()

    {

        double d = spawnPointX - posX;

        double d1 = spawnPointZ - posZ;

        double d2 = MathHelper.sqrt_double(d * d + d1 * d1);

        return d2 < 0.20000000000000001D;

    }

 

    public void spellHandler()

    {

        if (spell != 0)

        {

            timer++;

        }

 

        if (spell == 0 && timer > 0)

        {

            timer = 0;

        }

 

        if (cooldown > 0 && spell == 0)

        {

            cooldown--;

        }

 

        if (timer < 0)

        {

            timer = 0;

        }

 

        if (cooldown < 0)

        {

            cooldown = 0;

        }

    }

 

    public void setFightDistance()

    {

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

        float f = entityplayersp.getDistanceToEntity(this);

 

        if (entityToAttack != null && f > fightDistance)

        {

            goToSpawnPoint();

            spell = 0;

            setTarget(null);

        }

        else if (f < fightDistance && entityToAttack == entityplayersp && !entityplayersp.isDead && deathTime == 0)

        {}

    }

 

    public void setFightDistanceFromSpawnPoint()

    {

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

        double d = entityplayersp.getDistance(spawnPointX, spawnPointY, spawnPointZ);

 

        if (entityToAttack != null && d > fightDistanceFromSpawnPoint)

        {

            goToSpawnPoint();

            spell = 0;

            setTarget(null);

        }

        else if (d < fightDistanceFromSpawnPoint && entityToAttack == entityplayersp && !entityplayersp.isDead && deathTime == 0)

        {}

    }

 

    public void killEntitiesAround(double d)

    {

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

        List list = worldObj.getEntitiesWithinAABBExcludingEntity(entityplayersp, boundingBox.expand(d, d, d));

 

        for (int i = 0; i < list.size(); i++)

        {

            Entity entity = (Entity)list.get(i);

 

            if (entity instanceof EntityLiving)

            {

                EntityLiving entityliving = (EntityLiving)entity;

                entityliving.attackEntityFrom(DamageSource.setExplosionSource(null), 5000);

            }

        }

    }

 

    public void repelTarget(float f, float f1)

    {

        Entity entity = entityToAttack;

 

        if (entity != null && entity.getDistanceToEntity(this) < f)

        {

            double d = entity.posX - posX;

            double d1 = entity.posZ - posZ;

            double d2;

 

            for (d2 = entity.posZ - posZ; d * d + d2 * d2 < 0.0001D; d2 = (Math.random() - Math.random()) * 0.01D)

            {

                d = (Math.random() - Math.random()) * 0.01D;

            }

 

            entity.motionX *= 2D;

            entity.motionY *= 2D;

            entity.motionZ *= 2D;

            entity.motionX += (d / (double)f) * (double)f1;

            entity.motionZ += (d2 / (double)f) * (double)f1;

        }

    }

 

    /**

    * (abstract) Protected helper method to read subclass entity data from NBT.

    */

    public void readEntityFromNBT(NBTTagCompound nbttagcompound)

    {

        super.readEntityFromNBT(nbttagcompound);

        spawnPointX = nbttagcompound.getDouble("spawnPointX");

        spawnPointY = nbttagcompound.getDouble("spawnPointY");

        spawnPointZ = nbttagcompound.getDouble("spawnPointZ");

    }

 

    /**

    * (abstract) Protected helper method to write subclass entity data to NBT.

    */

    public void writeEntityToNBT(NBTTagCompound nbttagcompound)

    {

        super.writeEntityToNBT(nbttagcompound);

        nbttagcompound.setDouble("spawnPointX", spawnPointX);

        nbttagcompound.setDouble("spawnPointY", spawnPointY);

        nbttagcompound.setDouble("spawnPointZ", spawnPointZ);

    }

 

    public boolean attackEntityAsMob(Entity entity)

    {

        int i = attackStrength;

 

        if (isPotionActive(Potion.damageBoost))

        {

            i += 3 << getActivePotionEffect(Potion.damageBoost).getAmplifier();

        }

 

        if (isPotionActive(Potion.weakness))

        {

            i -= 2 << getActivePotionEffect(Potion.weakness).getAmplifier();

        }

 

        return entity.attackEntityFrom(DamageSource.causeMobDamage(this), i);

    }

 

    /**

    * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.

    */

    protected void attackEntity(Entity entity, float f)

    {

        if (attackTime <= 0 && f < 2.0F && entity.boundingBox.maxY > boundingBox.minY && entity.boundingBox.minY < boundingBox.maxY)

        {

            attackTime = 20;

            attackEntityAsMob(entity);

        }

 

        if (entityToAttack != null)

        {

            faceEntity(entityToAttack, 10F, 40F);

        }

    }

 

    protected float getSoundPitch()

    {

        if (isChild())

        {

            return (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.5F;

        }

        else

        {

            return (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F;

        }

    }

 

    /**

    * Called when the entity is attacked.

    */

    public boolean attackEntityFrom(DamageSource damagesource, int i)

    {

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

 

        if (worldObj.isRemote || worldObj.difficultySetting == EnumDifficulty.PEACEFUL)

        {

            entityplayersp.addChatMessage(new ChatComponentText("Can't fight bosses in peaceful mode !"));

            return false;

        }

 

        entityAge = 0;

 

        if (health <= 0)

        {

            return false;

        }

 

        if (damagesource.isFireDamage() && isPotionActive(Potion.fireResistance))

        {

            return false;

        }

 

        boolean flag = true;

 

        if ((float)heartsLife > (float)heartsHalvesLife / 2.0F)

        {

            if (i <= naturalArmorRating)

            {

                return false;

            }

 

            damageEntity(damagesource, i - naturalArmorRating);

            naturalArmorRating = i;

            flag = false;

        }

        else

        {

            naturalArmorRating = i;

            prevHealth = health;

            heartsLife = heartsHalvesLife;

            damageEntity(damagesource, i);

        }

 

        attackedAtYaw = 0.0F;

        Entity entity = damagesource.getEntity();

 

        if (entity != null && (entity instanceof EntityPlayer))

        {

            recentlyHit = 60;

            attackingPlayer = (EntityPlayer)entity;

        }

 

        if (flag)

        {

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

            setBeenAttacked();

 

            if (entity != null)

            {

                double d = entity.posX - posX;

                double d1;

 

                for (d1 = entity.posZ - posZ; d * d + d1 * d1 < 0.0001D; d1 = (Math.random() - Math.random()) * 0.01D)

                {

                    d = (Math.random() - Math.random()) * 0.01D;

                }

 

                attackedAtYaw = (float)((Math.atan2(d1, d) * 180D) / Math.PI) - rotationYaw;

                knockBack(entity, i, d, d1);

            }

            else

            {

                attackedAtYaw = (int)(Math.random() * 2D) * 180;

            }

        }

 

        if (health <= 0)

        {

            if (flag)

            {

                worldObj.playSoundAtEntity(this, getDeathSound(), getSoundVolume(), getSoundPitch());

            }

 

            onDeath(damagesource);

        }

        else if (flag)

        {

            worldObj.playSoundAtEntity(this, getHurtSound(), getSoundVolume(), getSoundPitch());

        }

 

        setTarget(entityplayersp);

        prevTarget = entityplayersp;

        return true;

    }

 

    /**

    * Called when the mob's health reaches 0.

    */

    public void onDeath(DamageSource damagesource)

    {

        super.onDeath(damagesource);

        //mcreator_Globals.Eternalcraft.stopMusic();

        dropItem(Items.emerald, 2 + rand.nextInt(3));

    }

 

    /**

    * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking

    * (Animals, Spiders at day, peaceful PigZombies).

    */

    protected Entity findPlayerToAttack()

    {

        return null;

    }

 

    /**

    * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons

    * use this to react to sunlight and start to burn.

    */

    public void onLivingUpdate()

    {

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

        super.onLivingUpdate();

        float f = entityplayersp.getDistanceToEntity(this);

 

        if (health > getMaxHealth())

        {

            health = getMaxHealth();

        }

 

        if (getMaxHealthWithLevel > getMaxHealth())

        {

            getMaxHealthWithLevel = getMaxHealth();

        }

 

        if (entityplayersp.isDead && health < getMaxHealth())

        {

            heal(getMaxHealth()/ 1);

        }

 

        if (didAllSpells())

        {

            for (int i = 1; i < spells + 1; i++)

            {

                spellDone = false;

            }

        }

 

        spellHandler();

 

        if ((!canEntityBeSeen(Minecraft.getMinecraft().thePlayer) || entityToAttack == null) && !isAtSpawnPoint())

        {

            goToSpawnPoint();

        }

 

        if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL)

 

        {

            setTarget(null);

        }

 

        if (entityToAttack == entityplayersp)

        {

            mcreator_Globals.Eternalcraft.playMusic(battleMusic);

        }

        else if (health < getMaxHealth())

        {

            heal(getMaxHealth() / 10000);

        }

 

        if (fightDistance > 1.0F)

        {

            setFightDistance();

        }

 

        if (fightDistanceFromSpawnPoint > 1.0D)

        {

            setFightDistanceFromSpawnPoint();

        }

    }

}

 

public static class EntityNightmareMissile extends EntityWitherSkull

{

    public World world;

    public EntityLivingBase shootingEntity;

 

    public EntityNightmareMissile(World world1)

    {

        super(world1);

        setSize(1.2125F, 1.2125F);

    }

 

    public EntityNightmareMissile(World world1, EntityLivingBase entityliving, double d, double d1, double d2)

    {

        super(world1, entityliving, d, d1, d2);

        setSize(1.2125F, 1.2125F);

    }

 

    public EntityNightmareMissile(World world1, double d, double d1, double d2, double d3, double d4, double d5)

    {

        super(world1, d, d1, d2, d3, d4, d5);

        setSize(1.2125F, 1.2125F);

    }

 

    /**

    * Called to update the entity's position/logic.

    */

    public void onUpdate()

    {

        super.onUpdate();

        extinguish();

        worldObj.spawnParticle("largesmoke", posX, posY, posZ, 0.0D, 0.0D, 0.0D);

        motionX *= 0.90000000000000002D;

        motionZ *= 0.90000000000000002D;

        motionY *= 0.90000000000000002D;

    }

 

@Override

    protected void onImpact(MovingObjectPosition movingobjectposition)

    {

        AxisAlignedBB axisalignedbb = boundingBox.expand(4D, 2D, 4D);

        List list = worldObj.getEntitiesWithinAABB(net.minecraft.entity.EntityLivingBase.class, axisalignedbb);

 

        if (!worldObj.isRemote)

        {

            if (movingobjectposition.entityHit != null)

            {

                Entity entity;

 

                for (Iterator iterator = list.iterator(); iterator.hasNext(); ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 180, 0)))

                {

                    entity = (Entity)iterator.next();

                }

 

                if (movingobjectposition.entityHit.attackEntityFrom(DamageSource.causeFireballDamage(this, shootingEntity), 2));

            }

 

            setDead();

        }

    }

 

    /**

    * Returns true if other Entities should be prevented from moving through this Entity.

    */

    public boolean canBeCollidedWith()

    {

        return false;

    }

 

    /**

    * Called when the entity is attacked.

    */

    public boolean attackEntityFrom(DamageSource damagesource, int i)

    {

        return false;

    }

 

}

   

public class Model extends ModelBase

{

    ModelRenderer head;

    ModelRenderer body;

    ModelRenderer rightarm;

    ModelRenderer leftarm;

    ModelRenderer body2;

    ModelRenderer body3;

    ModelRenderer rightarmweapon1;

    ModelRenderer rightarmweapon2;

    ModelRenderer leftarmweapon1;

    ModelRenderer leftarmweapon2;

 

    public Model()

    {

        textureWidth = 64;

        textureHeight = 32;

        head = new ModelRenderer(this, 0, 0);

        head.addBox(-3F, -6F, -4F, 6, 6, 6);

        head.setRotationPoint(0.0F, 0.0F, 0.0F);

        head.setTextureSize(64, 32);

        setRotation(head, 0.0F, 0.0F, 0.0F);

        body = new ModelRenderer(this, 0, 12);

        body.addBox(-4F, 0.0F, -2F, 8, 6, 4);

        body.setRotationPoint(0.0F, 0.0F, 0.0F);

        body.setTextureSize(64, 32);

        setRotation(body, 0.2617994F, 0.0F, 0.0F);

        rightarm = new ModelRenderer(this, 24, 0);

        rightarm.addBox(-3F, -2F, -2F, 3, 12, 4);

        rightarm.setRotationPoint(-4F, 2.0F, 0.0F);

        rightarm.setTextureSize(64, 32);

        setRotation(rightarm, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        leftarm = new ModelRenderer(this, 24, 0);

        leftarm.addBox(0.0F, -2F, -2F, 3, 12, 4);

        leftarm.setRotationPoint(4F, 2.0F, 0.0F);

        leftarm.setTextureSize(64, 32);

        setRotation(leftarm, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        body2 = new ModelRenderer(this, 31, 23);

        body2.addBox(-3F, 6F, -2F, 6, 3, 4);

        body2.setRotationPoint(0.0F, 0.0F, 0.0F);

        body2.setTextureSize(64, 32);

        setRotation(body2, 0.2617994F, 0.0F, 0.0F);

        body3 = new ModelRenderer(this, 19, 22);

        body3.addBox(-1F, 9F, -2F, 2, 2, 4);

        body3.setRotationPoint(0.0F, 0.0F, 0.0F);

        body3.setTextureSize(64, 32);

        setRotation(body3, 0.2617994F, 0.0F, 0.0F);

        rightarmweapon1 = new ModelRenderer(this, 44, 0);

        rightarmweapon1.addBox(-4F, 1.0F, -1F, 1, 2, 2);

        rightarmweapon1.setRotationPoint(-4F, 2.0F, 0.0F);

        rightarmweapon1.setTextureSize(64, 32);

        setRotation(rightarmweapon1, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        rightarmweapon2 = new ModelRenderer(this, 38, 0);

        rightarmweapon2.addBox(-5F, -5F, -1F, 1, 21, 2);

        rightarmweapon2.setRotationPoint(-4F, 2.0F, 0.0F);

        rightarmweapon2.setTextureSize(64, 32);

        setRotation(rightarmweapon2, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        leftarmweapon1 = new ModelRenderer(this, 44, 0);

        leftarmweapon1.addBox(3F, 1.0F, -1F, 1, 2, 2);

        leftarmweapon1.setRotationPoint(4F, 2.0F, 0.0F);

        leftarmweapon1.setTextureSize(64, 32);

        setRotation(leftarmweapon1, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        leftarmweapon2 = new ModelRenderer(this, 38, 0);

        leftarmweapon2.addBox(4F, -5F, -1F, 1, 21, 2);

        leftarmweapon2.setRotationPoint(4F, 2.0F, 0.0F);

        leftarmweapon2.setTextureSize(64, 32);

        setRotation(leftarmweapon2, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

    }

 

    public Model(int i)

    {

        textureWidth = 64;

        textureHeight = 32;

        head = new ModelRenderer(this, 0, 0);

        head.addBox(-3F, -6F, -4F, 6, 6, 6, i);

        head.setRotationPoint(0.0F, 0.0F, 0.0F);

        head.setTextureSize(64, 32);

        setRotation(head, 0.0F, 0.0F, 0.0F);

        body = new ModelRenderer(this, 0, 12);

        body.addBox(-4F, 0.0F, -2F, 8, 6, 4, i);

        body.setRotationPoint(0.0F, 0.0F, 0.0F);

        body.setTextureSize(64, 32);

        setRotation(body, 0.2617994F, 0.0F, 0.0F);

        rightarm = new ModelRenderer(this, 24, 0);

        rightarm.addBox(-3F, -2F, -2F, 3, 12, 4, i);

        rightarm.setRotationPoint(-4F, 2.0F, 0.0F);

        rightarm.setTextureSize(64, 32);

        setRotation(rightarm, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        leftarm = new ModelRenderer(this, 24, 0);

        leftarm.addBox(0.0F, -2F, -2F, 3, 12, 4, i);

        leftarm.setRotationPoint(4F, 2.0F, 0.0F);

        leftarm.setTextureSize(64, 32);

        setRotation(leftarm, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        body2 = new ModelRenderer(this, 31, 23);

        body2.addBox(-3F, 6F, -2F, 6, 3, 4, i);

        body2.setRotationPoint(0.0F, 0.0F, 0.0F);

        body2.setTextureSize(64, 32);

        setRotation(body2, 0.2617994F, 0.0F, 0.0F);

        body3 = new ModelRenderer(this, 19, 22);

        body3.addBox(-1F, 9F, -2F, 2, 2, 4, i);

        body3.setRotationPoint(0.0F, 0.0F, 0.0F);

        body3.setTextureSize(64, 32);

        setRotation(body3, 0.2617994F, 0.0F, 0.0F);

        rightarmweapon1 = new ModelRenderer(this, 44, 0);

        rightarmweapon1.addBox(-4F, 1.0F, -1F, 1, 2, 2, i);

        rightarmweapon1.setRotationPoint(-4F, 2.0F, 0.0F);

        rightarmweapon1.setTextureSize(64, 32);

        setRotation(rightarmweapon1, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        rightarmweapon2 = new ModelRenderer(this, 38, 0);

        rightarmweapon2.addBox(-5F, -5F, -1F, 1, 21, 2, i);

        rightarmweapon2.setRotationPoint(-4F, 2.0F, 0.0F);

        rightarmweapon2.setTextureSize(64, 32);

        setRotation(rightarmweapon2, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        leftarmweapon1 = new ModelRenderer(this, 44, 0);

        leftarmweapon1.addBox(3F, 1.0F, -1F, 1, 2, 2, i);

        leftarmweapon1.setRotationPoint(4F, 2.0F, 0.0F);

        leftarmweapon1.setTextureSize(64, 32);

        setRotation(leftarmweapon1, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

        leftarmweapon2 = new ModelRenderer(this, 38, 0);

        leftarmweapon2.addBox(4F, -5F, -1F, 1, 21, 2, i);

        leftarmweapon2.setRotationPoint(4F, 2.0F, 0.0F);

        leftarmweapon2.setTextureSize(64, 32);

        setRotation(leftarmweapon2, -((float)Math.PI * 2F / 9F), 0.0F, 0.0F);

    }

 

    /**

    * Sets the models various rotation angles then renders the model.

    */

    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

    {

        super.render(entity, f, f1, f2, f3, f4, f5);

        setRotationAngles(f, f1, f2, f3, f4, f5);

        head.render(f5);

        body.render(f5);

        rightarm.render(f5);

        leftarm.render(f5);

        body2.render(f5);

        body3.render(f5);

        rightarmweapon1.render(f5);

        rightarmweapon2.render(f5);

        leftarmweapon1.render(f5);

        leftarmweapon2.render(f5);

    }

 

    private void setRotation(ModelRenderer modelrenderer, float f, float f1, float f2)

    {

        modelrenderer.rotateAngleX = f;

        modelrenderer.rotateAngleY = f1;

        modelrenderer.rotateAngleZ = f2;

    }

 

    /**

    * Sets the models various rotation angles.

    */

    public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5)

    {

        head.rotateAngleY = f3 / (180F / (float)Math.PI);

        head.rotateAngleX = f4 / (180F / (float)Math.PI);

    }

}

 

public static int mobid = 0;

public Object instance;

 

    public void load(){}

 

    public void generateNether(World world, Random random, int chunkX, int chunkZ){}

public void generateSurface(World world, Random random, int chunkX, int chunkZ){}

public int addFuel(ItemStack fuel){

return 0;

}

@SideOnly(Side.CLIENT)

public void registerRenderers(){

RenderingRegistry.registerEntityRenderingHandler(mcreator_nightmare.Entitynightmare.class, new RenderLiving(new mcreator_nightmare.Model(), 0){protected ResourceLocation getEntityTexture(Entity par1Entity){return new ResourceLocation("MOBnightmare.png");}

 

public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9){

super.doRender(par1EntityLiving, par2, par4, par6, par8, par9);

BossStatus.setBossStatus((Entitynightmare)par1EntityLiving, false);

}

 

});

}

public void serverLoad(FMLServerStartingEvent event){}

public void preInit(FMLPreInitializationEvent event){

int entityID = EntityRegistry.findGlobalUniqueEntityId();

mobid = entityID;

EntityRegistry.registerGlobalEntityID(mcreator_nightmare.Entitynightmare.class, "nightmare", entityID);

EntityRegistry.registerModEntity(mcreator_nightmare.Entitynightmare.class, "nightmare", entityID, instance, 64, 1, true);

EntityList.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, (0 << 16) + (0 << 8) + 51, (153 << 16) + (153 << 8) + 153));

EntityRegistry.addSpawn(mcreator_nightmare.Entitynightmare.class, 0, 3, 30, EnumCreatureType.monster , new BiomeGenBase[]{BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.taiga, BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.mushroomIsland, BiomeGenBase.mushroomIslandShore, BiomeGenBase.beach, BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.taigaHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.jungleEdge, BiomeGenBase.deepOcean, BiomeGenBase.stoneBeach, BiomeGenBase.coldBeach, BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.roofedForest, BiomeGenBase.coldTaiga, BiomeGenBase.coldTaigaHills, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.extremeHillsPlus, BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau_F, BiomeGenBase.mesaPlateau});

 

       

}

 

    /*public Entity spawnEntity(int var1, World var2, double var3, double var5, double var7)

    {

        if(var1==mobid)

                return new mcreator_nightmare.Entitynightmare(var2);

        else

                return null;

    }*/

 

 

  public static class Entitynightmare extends mcreator_EntityBossStatus implements IBossDisplayData

{

    private int attack;

    public EntityPlayer entityplayer;

    private int stopLoop;

    private int timer;

    private int spawnNumber;

    public boolean lastStand;

   

    World world = null;

    public Entitynightmare(World var1)

    {

        super(var1);

        world = var1;

        experienceValue = 10000;

        this.isImmuneToFire = true;

        moveSpeed = 0.85F;

        attackStrength = 10;

        experienceValue = 100;

        stopLoop = 0;

        isImmuneToFire = true;

        fightDistance = 200F;

        battleMusic = "NightmareMusic";

        addRandomArmor();

    }

   

    protected void applyEntityAttributes(){

    super.applyEntityAttributes();

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

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

    if(this.getEntityAttribute(SharedMonsterAttributes.attackDamage)!=null)this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10D);

    }

 

    /**

    * Returns the volume for the sounds this mob makes.

    */

    protected float getSoundVolume()

    {

        return 2.0F;

    }

 

    protected float getSoundPitch()

    {

        return (rand.nextFloat() - rand.nextFloat()) * 0.1F + 0.92F;

    }

 

    /**

    * Determines if an entity can be despawned, used on idle far away entities

    */

    protected boolean canDespawn()

    {

        return false;

    }

 

    /**

    * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons

    * use this to react to sunlight and start to burn.

    */

    public void onLivingUpdate()

    {

        super.onLivingUpdate();

 

        if (worldObj.difficultySetting == EnumDifficulty.PEACEFUL)

        {

            setDead();

        }

 

        if (Minecraft.getMinecraft().thePlayer.isDead)

        {

            killEntitiesAround(200D);

        }

 

        if (getHealth() >= getMaxHealth())

        {

            stopLoop = 0;

        }

 

        if (getHealth() <= 20)

        {

            if (!lastStand)

            {

                killEntitiesAround(200D);

                EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

                lastStand = true;

                worldObj.playSoundAtEntity(this, "EternalCraft.nightmarelaststand", 2.0F, 1.0F);

                entityplayersp.clearActivePotions();

                attackStrength = 12;

                health = 12;

            }

 

            moveSpeed = 0.92F;

        }

        else

        {

            lastStand = false;

        }

 

        worldObj.spawnParticle("largesmoke", posX + (rand.nextDouble() - 0.5D) * (double)width, posY + rand.nextDouble() * (double)height, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0.0D, 0.0D, 0.0D);

    }

 

    /**

    * Returns the sound this mob makes while it's alive.

    */

    protected String getLivingSound()

    {

        return "mob.enderdragon.growl";

    }

 

    /**

    * Called when the mob's health reaches 0.

    */

    public void onDeath(DamageSource damagesource)

    {

        super.onDeath(damagesource);

        int i = rand.nextInt(5);

        dropItem(Items.emerald, 3);

        EntityPlayerSP entityplayersp = Minecraft.getMinecraft().thePlayer;

        setDead();

 

        if (rand.nextInt(3) == 0)

        {

            dropItem(mcreator_adamantite_ingot_refined.block, 1);

        }

 

        if (i == 0)

        {

            dropItem(mcreator_adamantite_Armor.helmet, 1);

        }

 

        if (i == 1)

        {

            dropItem(mcreator_adamantite_Armor.body, 1);

        }

 

        if (i == 2)

        {

            dropItem(mcreator_adamantite_Armor.legs, 1);

        }

 

        if (i == 3)

        {

            dropItem(mcreator_adamantite_Armor.boots, 1);

        }

 

        if (i == 4)

        {

            dropItem(mcreator_adamantite_sword.block, 1);

        }

 

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

        {

            worldObj.spawnParticle("largesmoke", posX + (rand.nextDouble() - 0.5D) * (double)width, posY + rand.nextDouble() * (double)height, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0.0D, 0.0D, 0.0D);

        }

 

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

        {

            worldObj.spawnParticle("explode", posX + (rand.nextDouble() - 0.5D) * (double)width, posY + rand.nextDouble() * (double)height, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0.0D, 0.0D, 0.0D);

        }

 

        for (int l = 0; l < 20; l++)

        {

            worldObj.spawnParticle("smoke", posX + (rand.nextDouble() - 0.5D) * (double)width, posY + rand.nextDouble() * (double)height, posZ + (rand.nextDouble() - 0.5D) * (double)width, 0.0D, 0.0D, 0.0D);

        }

 

        entityplayersp.clearActivePotions();

        killEntitiesAround(200D);

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    protected String getDeathSound()

    {

        return "mob.endermen.death";

    }

 

    /**

    * Returns the sound this mob makes when it is hurt.

    */

    protected String getHurtSound()

    {

        return "mob.blaze.hit";

    }

 

    /**

    * Finds the closest player within 16 blocks to attack, or null if this Entity isn't interested in attacking

    * (Animals, Spiders at day, peaceful PigZombies).

    */

    protected Entity findPlayerToAttack()

    {

        EntityPlayer entityplayer1 = worldObj.getClosestVulnerablePlayerToEntity(this, 100D);

        return entityplayer1;

    }

 

    protected boolean teleportTo(double d, double d1, double d2)

    {

        double d3 = posX;

        double d4 = posY;

        double d5 = posZ;

        posX = d;

        posY = d1;

        posZ = d2;

        boolean flag = false;

        int i = MathHelper.floor_double(posX);

        int j = MathHelper.floor_double(posY);

        int k = MathHelper.floor_double(posZ);

 

        if (worldObj.blockExists(i, j, k))

        {

            boolean flag1 = false;

 

            while (!flag1 && j > 0)

            {

                Block block = this.worldObj.getBlock(i, j - 1, k);

 

                if (block.getMaterial().blocksMovement())

                {

                    posY--;

                    j--;

                }

                else

                {

                    flag1 = true;

                }

            }

 

            if (flag1)

            {

                setPosition(posX, posY, posZ);

 

                if (worldObj.getCollidingBoundingBoxes(this, boundingBox).size() == 0 && !worldObj.isAnyLiquid(boundingBox))

                {

                    flag = true;

                }

            }

        }

 

        if (!flag)

        {

            setPosition(d3, d4, d5);

            return false;

        }

 

        int l = 128;

 

        for (int j1 = 0; j1 < l; j1++)

        {

            double d6 = (double)j1 / ((double)l - 1.0D);

            float f = (rand.nextFloat() - 0.5F) * 0.2F;

            float f1 = (rand.nextFloat() - 0.5F) * 0.2F;

            float f2 = (rand.nextFloat() - 0.5F) * 0.2F;

            double d7 = d3 + (posX - d3) * d6 + (rand.nextDouble() - 0.5D) * (double)width * 2D;

            double d8 = d4 + (posY - d4) * d6 + rand.nextDouble() * (double)height;

            double d9 = d5 + (posZ - d5) * d6 + (rand.nextDouble() - 0.5D) * (double)width * 2D;

            worldObj.spawnParticle("largesmoke", d7, d8, d9, f, f1, f2);

            worldObj.spawnParticle("largesmoke", d7, d8, d9, f, f1, f2);

        }

 

        worldObj.playSoundAtEntity(this, "EternalCraft.nightmaredash", 2.0F, 1.0F);

        return true;

    }

 

    protected boolean teleportRandomly()

    {

        double d = posX + (rand.nextDouble() - 0.5D) * 20D;

        double d1 = posY + (double)(rand.nextInt(64) - 32);

        double d2 = posZ + (rand.nextDouble() - 0.5D) * 20D;

        return teleportTo(d, d1, d2);

    }

 

    public boolean attackEntityAsMob(Entity entity)

    {

        if (super.attackEntityAsMob(entity))

        {

            if (entity instanceof EntityLiving)

            {

                if (attackStrength == 1)

                {

                    ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 240, 0));

                    worldObj.playSoundAtEntity(this, "EternalCraft.nightmaredark", 2.0F, 1.0F);

                    attackStrength = 10;

                    moveSpeed = 0.85F;

                }

 

                if (attackStrength == 2)

                {

                    ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.confusion.id, 220, 0));

                    ((EntityLiving)entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 260, 0));

                    worldObj.playSoundAtEntity(this, "EternalCraft.nightmareconfusion", 2.0F, 1.0F);

                    attackStrength = 10;

                    moveSpeed = 0.85F;

                }

            }

 

            return true;

        }

        else

        {

            return false;

        }

    }

 

    /**

    * Called when the entity is attacked.

    */

    public boolean attackEntityFrom(DamageSource damagesource, int i)

    {

        if (rand.nextInt(5) == 0)

        {

            teleportRandomly();

        }

 

        if (attack == 2)

        {

            return false;

        }

 

        if (i > 10)

        {

            i = 10;

        }

 

        if (lastStand)

        {

            i = 1;

        }

 

        return super.attackEntityFrom(damagesource, i);

    }

 

    /**

    * Basic mob attack. Default to touch of death in EntityCreature. Overridden by each mob to define their attack.

    */

    protected void attackEntity(Entity entity, float f)

    {

        double d = entity.posX - posX;

        double d1 = entity.posZ - posZ;

        double d2 = (entity.boundingBox.minY + (double)(entity.height / 2.0F)) - (posY + (double)(height / 2.0F));

        float f1 = MathHelper.sqrt_double(d * d + d1 * d1);

        super.attackEntity(entity, f);

 

        if (f > 16F && f < 38F && attack != 2)

        {

            goToEntity(entity);

        }

 

        if (f < 16F && rand.nextInt(22) == 0 && attack != 2 || lastStand && rand.nextInt(16) == 0)

        {

            if (rand.nextInt(3) == 0)

            {

                teleportRandomly();

 

                if (rand.nextInt(3) == 0)

                {

                    EntityassassinAdd entityassassinadd = new EntityassassinAdd(worldObj);

                    entityassassinadd.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);

                    worldObj.spawnEntityInWorld(entityassassinadd);

                }

                else

                {

                    EntityreaperAdd entityreaperadd = new EntityreaperAdd(worldObj);

                    entityreaperadd.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);

 

                    if (!lastStand)

                    {

                        worldObj.spawnEntityInWorld(entityreaperadd);

                    }

                }

            }

            else

            {

                teleportRandomly();

            }

        }

 

        if (f < 16F && rand.nextInt(20) == 0 && attack != 2 && !Minecraft.getMinecraft().thePlayer.isPotionActive(Potion.blindness) && !lastStand)

        {

            attackStrength = 1;

            motionX = (d / (double)f1) * 0.5D * 5.800000011920929D + motionX * 0.20000000298023224D;

            motionZ = (d1 / (double)f1) * 0.5D * 5.800000011920929D + motionZ * 0.20000000298023224D;

            worldObj.playSoundAtEntity(this, "EternalCraft.nightmaredash", 2.0F, 1.0F);

        }

 

        if (health < 160 && stopLoop == 1)

        {

            EntityassassinAdd entityassassinadd1 = new EntityassassinAdd(worldObj);

            entityassassinadd1.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);

            worldObj.spawnEntityInWorld(entityassassinadd1);

            stopLoop = 2;

            attack = 2;

            worldObj.playSoundAtEntity(this, "EternalCraft.nightmareadd", 2.0F, 1.0F);

            ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 440, 0));

            MinecraftServer.getServer().addChatMessage(new ChatComponentText("Phase 2"));

        }

 

        if (attack == 2 && timer == 30 && spawnNumber <= 10)

        {

            int i = rand.nextInt(10) - rand.nextInt(10);

            int j = rand.nextInt(10) - rand.nextInt(10);

 

            if (i <= 4 && i >= -4)

            {

                if (rand.nextInt(2) == 0)

                {

                    i = 5;

                }

                else

                {

                    i = -5;

                }

            }

 

            if (j <= 4 && j >= -4)

            {

                if (rand.nextInt(2) == 0)

                {

                    j = 5;

                }

                else

                {

                    j = -5;

                }

            }

 

            EntityreaperAdd entityreaperadd2 = new EntityreaperAdd(worldObj);

            entityreaperadd2.setLocationAndAngles(Minecraft.getMinecraft().thePlayer.posX + (double)i, Minecraft.getMinecraft().thePlayer.posY, Minecraft.getMinecraft().thePlayer.posZ + (double)j, rand.nextFloat() * 360F, 0.0F);

            worldObj.spawnEntityInWorld(entityreaperadd2);

            spawnNumber++;

            timer = 0;

        }

 

        if (attack == 2)

        {

            moveSpeed = 0.0F;

            timer++;

        }

 

        if (attack == 2 && timer > 57)

        {

            attack = 0;

            timer = 0;

            worldObj.playSoundAtEntity(this, "EternalCraft.nightmarelaugh", 2.0F, 1.0F);

        }

 

        if (attack != 2 && !lastStand)

        {

            moveSpeed = 0.85F;

        }

 

        if (health < 250 && stopLoop == 0 && attack != 2)

        {

            EntityassassinAdd entityassassinadd2 = new EntityassassinAdd(worldObj);

            entityassassinadd2.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);

            worldObj.spawnEntityInWorld(entityassassinadd2);

            EntityreaperAdd entityreaperadd1 = new EntityreaperAdd(worldObj);

            entityreaperadd1.setLocationAndAngles(posX, posY, posZ, rotationYaw, 0.0F);

            worldObj.spawnEntityInWorld(entityreaperadd1);

            ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.confusion.id, 220, 0));

            ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(Potion.blindness.id, 260, 0));

            worldObj.playSoundAtEntity(this, "EternalCraft.nightmareconfusion", 2.0F, 1.0F);

            stopLoop = 1;

        }

 

        if (f < 16F && rand.nextInt(80) == 0 && attack != 2 && !lastStand)

        {

            worldObj.playAuxSFXAtEntity(null, 1009, (int)posX, (int)posY, (int)posZ, 0);

            float f2 = MathHelper.sqrt_float(f) * 0.5F;

            EntityNightmareMissile entitynightmaremissile = new EntityNightmareMissile(worldObj, this, d + rand.nextGaussian() * (double)f2, d2, d1 + rand.nextGaussian() * (double)f2);

            entitynightmaremissile.posY = posY + (double)(height / 2.0F) + 0.5D;

            worldObj.spawnEntityInWorld(entitynightmaremissile);

        }

    }

 

    /**

    * Get this Entity's EnumCreatureAttribute

    */

    public EnumCreatureAttribute getCreatureAttribute()

    {

        return EnumCreatureAttribute.UNDEAD;

    }

 

    protected void addRandomArmor(){

 

    }

 

    protected void dropRareDrop(int par1){

    this.dropItem(mcreator_ambrosiumShard.block, 1);

    }

 

 

    public boolean isAIEnabled()

    {

    return false;

    }

 

    /**

    * Drop 0-2 items of this living's type

    */

    protected void dropFewItems(boolean var1, int var2)

    {

    this.entityDropItem(new ItemStack(Items.nether_star), 0.0F);

    }

   

    public Entity spawnEntity(int var1, World var2, double var3, double var5, double var7)

    {

        if(var1==mobid)

                return new mcreator_nightmare.Entitynightmare(var2);

        else

                return null;

    }

   

    public void onStruckByLightning(EntityLightningBolt entityLightningBolt){

int i = (int)this.posX;

int j = (int)this.posY;

int k = (int)this.posZ;

Entity entity = this;

 

}

 

protected void fall(float l){

int i = (int)this.posX;

int j = (int)this.posY;

int k = (int)this.posZ;

super.fall(l);

Entity entity = this;

 

}

 

  public void onCriticalHit(Entity entity) {

int i = (int)this.posX;

int j = (int)this.posY;

int k = (int)this.posZ;

 

}

 

public void onKillEntity(EntityLiving entityLiving){

int i = (int)this.posX;

int j = (int)this.posY;

int k = (int)this.posZ;

Entity entity = this;

 

}

 

public boolean interact(EntityPlayer entity){

int i = (int)this.posX;

int j = (int)this.posY;

int k = (int)this.posZ;

 

return true;

}

 

public String getEntityName(){

return "nightmare";

}

}

}

 

 

Please help me.

Thank you very much.

Posted

I don't think I understand. You want spawning to be on a timer and the timer isn't working, am I correct? If I am, I've done something with time with a tile entity. I had a timer field that was an int, and I overrided updateEntity() and in this method I would decrease the timer field and if it equaled 0 it would reset the timer and call my desired function. updateEntity is called every tick (20th of a second) so the timer would be in ticks. That was with a tile entity though, but maybe there is a similar method for entities (I am away from my code at the moment). Perhaps something like onUpdateTick, I don't know what it's called.

 

Wow, this post turned out long. If this was too confusing just tell me, I will explain it better. :)

Posted

So here's your basic problem:

 

Every entity has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

 

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Each of which has its own

spawnNumber

and is allowed to spawn 10 more copies of itself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

The spawn code is right, what is wrong is that the code that spawns divides into two parts is not working, spawns the loop does not stop, and the timer does not function. Even when we decrease the number of mobs becomes large again after some time.  :(.

 

The codes are divided into two class in a single java file. it is important read the two class to understand what I tried to do.

 

-mcreator_EntityBossStatus.

-mcreator_Entitynightmare.

 

Is there any method to control the spawns number.

 

Phase 1:

3 assassin

3 reaper

 

Phase 2:

 

4 or 5 assassin

4 reaper.

Posted

The solution was to increase if (rand.nextInt (% value%) == 0)

example:

1- (rand.nextInt (20) == 0) Original,

2- (rand.nextInt (2000) == 0) modified. :P

 

Thanks for everything.

Posted

Frankly, your code is a mess and I can't figure out what it's doing.

 

btw,

 while (spellDone[spell] || spell == prevSpell);

 

if spell == prevSpell, then spellDone[spell] is going to also be true, it's a useless conditional.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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