Jump to content

[SOLVED] Error in putting PotionEffect on player.


Atila1091

Recommended Posts

There is a very interesting mob that I add to my mod. The source of it is in the version 1.2.5 (Very old). I can resouver all the errors of the eclipse, but I'm poblemas to add on the player PotionEffect. The code that I use is

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

and the error is: net.minecraft.entity.player.EntityPlayerMP can not be cast to net.minecraft.entity.EntityLiving

When I remove the Potion Effect my mob does not behave as it should behave.

 

The Code of the mob :

 

public class Entitynightmare extends EntitynetherBoss implements IBossDisplayData

{

World world = null;

    private int attack;

    public EntityPlayer entityplayer;

    private int stopLoop;

    private int timer;

    protected Minecraft theGame;

    private int spawnNumber;

    public boolean lastStand;

    public Entitynightmare(World var1)

    {

        super(var1);

        world = var1;

        experienceValue = 10000;

        this.isImmuneToFire = true;

        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);

}

 

/**

* 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)

    {

    this.setDead();

    }

 

    if (getHealth() >= getMaxHealth())

    {

        stopLoop = 0;

    }

 

    if (getHealth() <= 20)

    {

        if (!lastStand)

        {

            killEntitiesAround(200D);

            EntityPlayer entityplayersp = minecraft.thePlayer;

            lastStand = true;

            worldObj.playSoundAtEntity(this, "mod.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);

}

 

/**

* 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.thePlayer;

 

    if (damagesource.getEntity() instanceof EntityPlayer)

    {}

   

    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);

}

 

/**

* 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())

            {

                flag1 = true;

            }

            else

            {

                --this.posY;

                --j;

            }

        }

 

        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, "mod.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, "mod.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, "mod.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.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, "mod.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, "mod.nightmareadd", 2.0F, 1.0F);

        ((EntityLiving)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(theGame.thePlayer.posX + (double)i, theGame.thePlayer.posY, theGame.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, "mod.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);

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

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

        worldObj.playSoundAtEntity(this, "mod.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.UNDEFINED;

}

 

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);

    }

 

    /**

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

    */

    protected String getLivingSound()

    {

        return "mob.enderdragon.growl";

    }

 

    /**

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

    */

    protected String getHurtSound()

    {

        return "mob.blaze.hit";

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    protected String getDeathSound()

    {

        return "mob.endermen.death";

    }

 

[move]Please help me! :([/move]

 

Who can help please let the ready code.

 

Thank you very much.

 

Link to comment
Share on other sites

Don't cast to EntityLiving, cast to EntityLivingBase.  The class hierarchy got altered a while back.

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.

Link to comment
Share on other sites

You helped me a lot. But still the errors in my class.

 

I have a doubt and an error yet.

1- "EntityLivingBase" works for mobs.

2 Ticking entity:

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

[move]

Please help me.  :( :( :([/move]

 

If you need the source code of the mod just ask. ;)

 

More information:

 

Description: Ticking entity

 

java.lang.NullPointerException: Ticking entity

at mod.mcreator.mcreator_nightmare$Entitynightmare.attackEntity(mcreator_nightmare.java:712)

at net.minecraft.entity.EntityCreature.updateEntityActionState(EntityCreature.java:75)

at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:1989)

at net.minecraft.entity.EntityLiving.onLivingUpdate(EntityLiving.java:431)

at net.minecraft.entity.monster.EntityMob.onLivingUpdate(EntityMob.java:39)

at net.minecraft.entity.monster.EntityEnderman.onLivingUpdate(EntityEnderman.java:268)

at mod.mcreator.mcreator_EntityBoss.onLivingUpdate(mcreator_EntityBoss.java:485)

at mod.mcreator.mcreator_netherBoss$EntitynetherBoss.onLivingUpdate(mcreator_netherBoss.java:1066)

at mod.mcreator.mcreator_nightmare$Entitynightmare.onLivingUpdate(mcreator_nightmare.java:422)

at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:1816)

at net.minecraft.entity.EntityLiving.onUpdate(EntityLiving.java:250)

at net.minecraft.entity.monster.EntityMob.onUpdate(EntityMob.java:47)

at mod.mcreator.mcreator_netherBoss$EntitynetherBoss.onUpdate(mcreator_netherBoss.java:969)

at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2298)

at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:684)

at net.minecraft.world.World.updateEntity(World.java:2258)

at net.minecraft.world.World.updateEntities(World.java:2108)

at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:515)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:703)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:614)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:485)

at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:752)

 

The error points here:

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.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(theGame.thePlayer.posX + (double)i, theGame.thePlayer.posY, theGame.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);

    }

}

 

Sorry for my English, because I do not speak English. :( :(

 

Full class:

 

 

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_netherBoss.EntitynetherBoss;

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 EntityNightmareMissile extends EntityFireball

{

    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;

    }

 

    protected void func_40071_a(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;

    }

 

@Override

protected void onImpact(MovingObjectPosition p_70227_1_) {

// TODO Auto-generated method stub

 

}

}

   

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 EntitynetherBoss implements IBossDisplayData

{

World world = null;

    private int attack;

    public EntityPlayer entityplayer;

    private int stopLoop;

    private int timer;

    protected Minecraft theGame;

    private int spawnNumber;

    public boolean lastStand;

    public Entitynightmare(World var1)

    {

        super(var1);

        world = var1;

        experienceValue = 10000;

        this.isImmuneToFire = true;

        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);

}

 

/**

* 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)

    {

    this.setDead();

    }

 

    if (getHealth() >= getMaxHealth())

    {

        stopLoop = 0;

    }

 

    if (getHealth() <= 20)

    {

        if (!lastStand)

        {

            killEntitiesAround(200D);

            EntityPlayer entityplayersp = minecraft.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);

}

 

/**

* 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.thePlayer;

 

    if (damagesource.getEntity() instanceof EntityPlayer)

    {}

   

    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);

}

 

/**

* 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())

            {

                flag1 = true;

            }

            else

            {

                --this.posY;

                --j;

            }

        }

 

        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.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(theGame.thePlayer.posX + (double)i, theGame.thePlayer.posY, theGame.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.UNDEFINED;

}

 

       

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);

    }

 

    /**

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

    */

    protected String getLivingSound()

    {

        return "mob.enderdragon.growl";

    }

 

    /**

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

    */

    protected String getHurtSound()

    {

        return "mob.blaze.hit";

    }

 

    /**

    * Returns the sound this mob makes on death.

    */

    protected String getDeathSound()

    {

        return "mob.endermen.death";

    }

 

    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";

}

 

}

 

 

 

}

 

 

Link to comment
Share on other sites

[move]

Please help me.  :( :( :([/move]

 

Please don't use marquee text.  It's awful.

 

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

 

Ok, so, as far as I can tell, you're trying to reference the singleplayer...player, which you should Never Do.  Never ever ever.  While this was fine in 1.2.5, you can no longer do that, because "single player" is actually "multiplayer with one connected player, running locally."

 

Second, minecraft.thePlayer, "minecraft" here is not a variable anywhere in your class, you never declare it.  You have a

EntityPlayer entityplayer

and a

Minecraft theGame

, but no

minecraft

.  Also, you need to get rid of both of those.

 

Treat single player as multiplayer and it'll work out.  What's the clostest connected player in a single player world?  The only player available: the single player.

 

Third, I can't figure out when

f

will ever be larger than 16.  Or hell, larger than 0.  It looks like f is defined as the entity's physical height minus it's position above the void, so unless it's like 16 blocks tall, or more, f will never be greater than 16.

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.

Link to comment
Share on other sites

I can replace with:

Minecraft.getMinecraft().thePlayer;

 

Which will immediately crash a dedicated server.

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • The version of what? I just imported the MDK into Eclipse. I haven't made any edits to the Java code in it or even any other files. I haven't even gotten to changing the modid from "examplemod" yet.
    • Captain WebGenesis is a Cyber skilled hacker with special abilities and skills that enact penetration to help victims of Crypto Fraudulent activities who are faced with cyber challenges get back their lost funds. Simply file your complaint through the website (https://captainwebgenesis. com) and have all your crypto recovered back.
    • The crash log keeps saying something about the tick rate. Can someone please help me fix?   ---- Minecraft Crash Report ---- // Everything's going to plan. No, really, that was supposed to happen. Time: 2024-06-21 16:24:55 Description: Exception in server tick loop java.lang.NullPointerException: Cannot invoke "com.cobblemon.mod.common.api.conditional.RegistryLikeCondition.fits(Object, net.minecraft.core.Registry)" because "condition" is null at com.cobblemon.mod.common.api.spawning.condition.SpawningCondition.fits(SpawningCondition.java:85) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.AreaTypeSpawningCondition.fits(AreaTypeSpawningCondition.java:30) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.GroundedTypeSpawningCondition.fits(GroundedTypeSpawningCondition.java:28) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.GroundedTypeSpawningCondition.fits(GroundedTypeSpawningCondition.java:24) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.condition.SpawningCondition.isSatisfiedBy(SpawningCondition.java:68) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.detail.SpawnDetail.isSatisfiedBy(SpawnDetail.java:78) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.Spawner$DefaultImpls.getMatchingSpawns(Spawner.java:42) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner.getMatchingSpawns(TickingSpawner.java:31) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.selection.FlatContextWeightedSelector.getSelectionData(FlatContextWeightedSelector.java:79) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.selection.FlatContextWeightedSelector.select(FlatContextWeightedSelector.java:106) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.AreaSpawner.run(AreaSpawner.java:94) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.spawner.TickingSpawner.tick(TickingSpawner.java:71) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.spawning.SpawnerManager.onServerTick(SpawnerManager.java:58) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.events.ServerTickHandler.onTick(ServerTickHandler.java:20) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.Cobblemon$initialize$7.invoke(Cobblemon.java:368) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.Cobblemon$initialize$7.invoke(Cobblemon.java:368) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.reactive.ObservableSubscription.handle(ObservableSubscription.java:16) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.common.api.reactive.SimpleObservable.emit(SimpleObservable.java:39) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.forge.event.ForgePlatformEventHandler.onTick(ForgePlatformEventHandler.kt:172) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading} at com.cobblemon.mod.forge.event.__ForgePlatformEventHandler_onTick_ServerTickEvent.invoke(.dynamic) ~[Cobblemon-forge-1.5.2+1.20.1.jar%23121!/:?] {re:classloading,pl:eventbus:B} at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {} at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {} at net.minecraftforge.event.ForgeEventFactory.onPostServerTick(ForgeEventFactory.java:950) ~[forge-1.20.1-47.2.17-universal.jar%23138!/:?] {re:classloading} at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:835) ~[server-1.20.1-20230612.114412-srg.jar%23133!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[server-1.20.1-20230612.114412-srg.jar%23133!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B} at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23133!/:?] {re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,re:mixin,pl:accesstransformer:B} at java.lang.Thread.run(Thread.java:840) ~[?:?] {re:mixin}
    • okay i've managed to fix it. looks like i made the stupidest error known to man. i hadn't installed forge to the client, which i assumed only affected the launcher which wouldn't affect me because i used a third party one. evidently not. the more you know
    • tried a fresh install of above and beyond with java 8 installed. got a popup that says "Error: Unable to access jarfile forge-1.16.5-36.2.8.jar". every good programmer knows getting a different error means you've made progress!
  • Topics

×
×
  • Create New...

Important Information

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