Package net.minecraft.entity

Examples of net.minecraft.entity.Entity


    newCart.isDead = false;

    List<Entity> result = new ArrayList<Entity>();
    result.add(newCart);

    Entity passenger = cart.riddenByEntity;
    if(passenger != null && !(passenger instanceof EntityPlayer)) {
      Entity newPas = EntityList.createEntityByName(EntityList.getEntityString(passenger), worldserver1);
      newPas.copyDataFrom(passenger, true);
      newPas.dimension = toDimension;
      newPas.setLocationAndAngles(toX + 0.5, toY, toZ + 0.5, cart.rotationYaw, cart.rotationPitch);
      newCart.riddenByEntity = newPas;
      newPas.ridingEntity = newCart;
      result.add(newPas);
    }
    return result;
View Full Code Here


    }

    MinecraftServer minecraftserver = MinecraftServer.getServer();
    WorldServer worldserver = minecraftserver.worldServerForDimension(world.provider.dimensionId);

    Entity passenger = cart.riddenByEntity;
    if(passenger != null && !(passenger instanceof EntityPlayer)) {
      worldserver.removeEntity(passenger);
      passenger.isDead = true;
    }
    worldserver.removeEntity(cart);
View Full Code Here

    while (cartList.tagCount() > 0) {
      NBTTagList entityList = (NBTTagList) cartList.removeTag(0);
      List<Entity> ents = new ArrayList<Entity>(entityList.tagCount());
      for (int i = 0; i < entityList.tagCount(); i++) {
        NBTTagCompound entityRoot = entityList.getCompoundTagAt(i);
        Entity entity = EntityList.createEntityFromNBT(entityRoot, worldObj);
        if(entity != null) {
          ents.add(entity);
        }
      }
      cartsToSpawn.add(ents);
View Full Code Here

          boolean doTimerReset = false;

          for (int i = 0; i < spawnCount; ++i) {

            Entity entity = EntityList.createEntityByName(getEntityNameToSpawn(), getSpawnerWorld());
            if(entity == null) {
              return;
            }

            int j = getSpawnerWorld().getEntitiesWithinAABB(
                entity.getClass(),
                AxisAlignedBB.getBoundingBox(getSpawnerX(), getSpawnerY(), getSpawnerZ(), getSpawnerX() + 1,
                    getSpawnerY() + 1, getSpawnerZ() + 1).expand(spawnRange * 2, 4.0D, spawnRange * 2)).size();

            if(j >= maxNearbyEntities) {
              resetTimer();
              return;
            }

            d2 = getSpawnerX() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange;
            double d3 = getSpawnerY() + getSpawnerWorld().rand.nextInt(3) - 1;
            double d4 = getSpawnerZ() + (getSpawnerWorld().rand.nextDouble() - getSpawnerWorld().rand.nextDouble()) * spawnRange;
            EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
            entity.setLocationAndAngles(d2, d3, d4, getSpawnerWorld().rand.nextFloat() * 360.0F, 0.0F);

            if(entityliving != null && canSpawnEntity(entityliving)) {
              func_98265_a(entity);
              getSpawnerWorld().playAuxSFX(2004, getSpawnerX(), getSpawnerY(), getSpawnerZ(), 0);

View Full Code Here

      entity.setLocationAndAngles(coord.xCoord+0.5, coord.yCoord+1, coord.zCoord+0.5, entity.rotationYaw, entity.rotationPitch);
      world.updateEntityWithOptionalForce(entity, false);
      entity.setWorld(world);
      world.resetUpdateEntityTick();

      Entity e = EntityList.createEntityByName(EntityList.getEntityString(entity), world);

      if(e != null)
      {
        e.copyDataFrom(entity, true);
        world.spawnEntityInWorld(e);
        teleporter.didTeleport.add(e);
      }

      entity.isDead = true;
View Full Code Here

            if (movingobjectposition != null)
            {
                vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
            }

            Entity entity = null;
            List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
            double d0 = 0.0D;
            int l;
            float f1;

            for (l = 0; l < list.size(); ++l)
            {
                Entity entity1 = (Entity) list.get(l);

                if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
                {
                    f1 = 0.3F;
                    AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1);
                    MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31);

                    if (movingobjectposition1 != null)
                    {
                        double d1 = vec3.distanceTo(movingobjectposition1.hitVec);

                        if (d1 < d0 || d0 == 0.0D)
                        {
                            entity = entity1;
                            d0 = d1;
                        }
                    }
                }
            }

            if (entity != null)
            {
                movingobjectposition = new MovingObjectPosition(entity);
            }

            if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer)
            {
                EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;

                if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer))
                {
                    movingobjectposition = null;
                }
            }

            float f2;
            float f3;

            if (movingobjectposition != null)
            {
                if (movingobjectposition.entityHit != null)// && movingobjectposition.entityHit != shootingEntity)
                {
                    if (movingobjectposition.entityHit != shootingEntity)
                    {
                        f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ);
                        int i1 = MathHelper.ceiling_double_int(f2 * this.damage);

                        if (this.getIsCritical())
                        {
                            i1 += this.rand.nextInt(i1 / 2 + 2);
                        }

                        DamageSource damagesource = null;

                        if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman))
                        {
                            movingobjectposition.entityHit.setFire(5);
                        }

                        if (this.shootingEntity == null)
                        {
                            damagesource = DamageSource.setExplosionSource(this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1.5f, true));
                        }
                        else
                        {
                            damagesource = DamageSource.setExplosionSource(this.worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, 1.5f, true));
                        }

                        //this.kill();

                        if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1))
                        {
                            if (movingobjectposition.entityHit instanceof EntityLivingBase)
                            {
                                Entity entityliving = movingobjectposition.entityHit;

                                if (!this.worldObj.isRemote)
                                {
                                    ((EntityLivingBase) entityliving).setArrowCountInEntity(((EntityLivingBase) entityliving).getArrowCountInEntity() + 1);
                                }
View Full Code Here

      }
      else
      {
        if(!ItemSafariNet.isEmpty(storedEntity))
        {
          Entity releasedEntity = ItemSafariNet.releaseEntity(storedEntity, worldObj, (int)mop.entityHit.posX, (int)mop.entityHit.posY, (int)mop.entityHit.posZ, 1);
          if(mop.entityHit instanceof EntityLiving)
          {
            if(releasedEntity instanceof EntityLiving)
            {
              //Functional for skeletons.
View Full Code Here

    if(hit != null)
    {
      nextPos = this.worldObj.getWorldVec3Pool().getVecFromPool(hit.hitVec.xCoord, hit.hitVec.yCoord,  hit.hitVec.zCoord);
    }
   
    Entity entityHit = null;
    List<?> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,  this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
    double closestRange = 0.0D;
    double collisionRange = 0.3D;
   
    for(int l = 0; l < list.size(); ++l)
    {
      Entity e = (Entity)list.get(l);
     
      if(e.canBeCollidedWith() && (e != _owner || this.ticksInAir >= 5))
      {
        AxisAlignedBB entitybb = e.boundingBox.expand(collisionRange, collisionRange, collisionRange);
        MovingObjectPosition entityHitPos = entitybb.calculateIntercept(pos, nextPos);
       
        if(entityHitPos != null)
View Full Code Here

      if(hit != null)
      {
        nextPos = this.worldObj.getWorldVec3Pool().getVecFromPool(hit.hitVec.xCoord, hit.hitVec.yCoord,  hit.hitVec.zCoord);
      }
     
      Entity entityHit = null;
      List<?> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this,  this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
      double closestRange = 0.0D;
      double collisionRange = 0.3D;
     
      for(int i = 0, end = list.size(); i < end; ++i)
      {
        Entity e = (Entity)list.get(i);
       
        if(e.canBeCollidedWith() && (e != _owner))
        {
          AxisAlignedBB entitybb = e.boundingBox.expand(collisionRange, collisionRange, collisionRange);
          MovingObjectPosition entityHitPos = entitybb.calculateIntercept(pos, nextPos);
         
          if(entityHitPos != null)
View Full Code Here

  @Override
  public void cleanReferences()
  {
    for(int i = entitiesToGrind.size(); i-- > 0;)
    {
      Entity ent = entitiesToGrind.get(i);
      if(ent.isDead) entitiesToGrind.remove(ent);
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.entity.Entity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.