Package net.minecraft.entity

Examples of net.minecraft.entity.Entity


    List<?> list = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(
        Minecraft.getMinecraft().renderViewEntity,
        Minecraft.getMinecraft().renderViewEntity.boundingBox.addCoord(playerLook.xCoord * range, playerLook.yCoord * range, playerLook.zCoord * range).expand(1, 1, 1));
   
    double entityDistTotal = blockDist;
    Entity pointedEntity = null;
    for(int i = 0; i < list.size(); ++i)
    {
      Entity entity = (Entity)list.get(i);
     
      if(entity.canBeCollidedWith())
      {
        double entitySize = entity.getCollisionBorderSize();
        AxisAlignedBB axisalignedbb = entity.boundingBox.expand(entitySize, entitySize, entitySize);
        MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(playerPos, playerLookRel);
       
        if(axisalignedbb.isVecInside(playerPos))
        {
View Full Code Here


    if(world.isRemote)
    {
      return null;
    }
   
    Entity spawnedCreature;
    int blockId = world.getBlockId(x, y, z);
    x += Facing.offsetsXForSide[side];
    y += Facing.offsetsYForSide[side];
    z += Facing.offsetsZForSide[side];
    double spawnOffsetY = 0.0D;
View Full Code Here

    return spawnedCreature;
  }

  private static Entity spawnCreature(World world, NBTTagCompound mobTag, double x, double y, double z, int side)
  {
    Entity e;
    if(mobTag.getBoolean("hide"))
    {
      List<RandomMob> mobs = new ArrayList<RandomMob>();
     
      for(IRandomMobProvider p : MFRRegistry.getRandomMobProviders())
      {
        System.out.println("Adding mobs from " + p.getClass().getName());
        mobs.addAll(p.getRandomMobs(world));
      }
      e = ((RandomMob)WeightedRandom.getRandomItem(world.rand, mobs)).getMob();
    }
    else
    {
      NBTTagList pos = mobTag.getTagList("Pos");
      ((NBTTagDouble)pos.tagAt(0)).data = x;
      ((NBTTagDouble)pos.tagAt(1)).data = y;
      ((NBTTagDouble)pos.tagAt(2)).data = z;
     
      e = EntityList.createEntityFromNBT(mobTag, world);
      if (e != null)
      {
        if(e instanceof EntityLiving)
        {
          ((EntityLiving)e).initCreature();
        }
       
        e.readFromNBT(mobTag);
      }
    }
   
    if(e != null)
    {

      int offsetX = Facing.offsetsXForSide[side];
      int offsetY = side == 0 ? -1 : 0;
      int offsetZ = Facing.offsetsZForSide[side];
      AxisAlignedBB bb =  e.boundingBox;
     
      e.setLocationAndAngles(x + (bb.maxX - bb.minX) * 0.5 * offsetX,
          y + (bb.maxY - bb.minY) * 0.5 * offsetY,
          z + (bb.maxZ - bb.minZ) * 0.5 * offsetZ,
          world.rand.nextFloat() * 360.0F, 0.0F);
     
      world.spawnEntityInWorld(e);
      if(e instanceof EntityLiving)
      {
        ((EntityLiving)e).playLivingSound();
      }
     
      Entity riddenByEntity = e.riddenByEntity;
      while(riddenByEntity != null)
      {
        riddenByEntity.setLocationAndAngles(x, y, z, world.rand.nextFloat() * 360.0F, 0.0F);
       
        world.spawnEntityInWorld(riddenByEntity);
        if(riddenByEntity instanceof EntityLiving)
        {
          ((EntityLiving)riddenByEntity).playLivingSound();
View Full Code Here

    {
      return null;
    }
    else
    {
      Entity e = EntityList.createEntityByID(mobId, world);
     
      if (e != null)
      {
        e.setLocationAndAngles(x, y, z, world.rand.nextFloat() * 360.0F, 0.0F);
        ((EntityLiving)e).initCreature();
        world.spawnEntityInWorld(e);
        ((EntityLiving)e).playLivingSound();
      }
     
View Full Code Here

    if(count != getMaxItemUseDuration(stack) && count % 5 == 0) {
      int range = 12;
      List<IShearable> sheep = player.worldObj.getEntitiesWithinAABB(IShearable.class, AxisAlignedBB.getBoundingBox(player.posX - range, player.posY - range, player.posZ - range, player.posX + range, player.posY + range, player.posZ + range));
      if(sheep.size() > 0) {
        for(IShearable target : sheep) {
          Entity entity = (Entity) target;
          if(target.isShearable(stack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ)) {
            ArrayList<ItemStack> drops = target.onSheared(stack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack));

            Random rand = new Random();
            for(ItemStack drop : drops) {
              EntityItem ent = entity.entityDropItem(drop, 1.0F);
              ent.motionY += rand.nextFloat() * 0.05F;
              ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
              ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
            }

 
View Full Code Here

    drawBar(x, y, bgRect.x, bgRect.y, bgRect.width, bgRect.height, true);
    drawBar(xf, yf, fgRect.x, fgRect.y, fw, fgRect.height, false);
    mc.fontRenderer.drawStringWithShadow(name, tx, y - 10, 0xA2018C);
    GL11.glDisable(GL11.GL_BLEND);
   
    Entity e = (Entity) currentBoss;
    EntityPlayer p = mc.thePlayer;
    if(e.isDead || !p.worldObj.loadedEntityList.contains(e) || MathHelper.pointDistanceSpace(e.posX, e.posY, e.posZ, p.posX, p.posY, p.posZ) > 32)
      currentBoss = null;
  }
View Full Code Here

  static double interpPosX;
  static double interpPosY;
  static double interpPosZ;

  private static Vector3 getRelativeViewVector(Vector3 pos) {
    Entity renderEntity = Minecraft.getMinecraft().renderViewEntity;
    return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
  }
View Full Code Here

    profiler.startSection("botania-particles");
    ParticleRenderDispatcher.dispatch();
    profiler.startSection("lightning");

    float frame = event.partialTicks;
    Entity entity = Minecraft.getMinecraft().thePlayer;
    TextureManager render = Minecraft.getMinecraft().renderEngine;

    interpPosX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * frame;
    interpPosY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * frame;
    interpPosZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * frame;
 
View Full Code Here

        float m = 0.02F;
        Botania.proxy.setWispFXDepthTest(false);
        Botania.proxy.wispFX(player.worldObj, x + (float) Math.random(), y + (float) Math.random(), z + (float) Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5), m * (float) (Math.random() - 0.5));
      } else {
        int id = Integer.parseInt(token);
        Entity e = player.worldObj.getEntityByID(id);

        if(e != null && Math.random() < 0.6) {
          Botania.proxy.setWispFXDepthTest(Math.random() < 0.6);
          Botania.proxy.wispFX(player.worldObj, e.posX + (float) (Math.random() * 0.5 - 0.25) * 0.45F, e.posY + e.height, e.posZ + (float) (Math.random() * 0.5 - 0.25) * 0.45F, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.15F + 0.05F * (float) Math.random(), -0.05F - 0.03F * (float) Math.random());
        }
View Full Code Here

  public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
    int targetID = ItemNBTHelper.getInt(stack, TAG_TARGET, -1);
    int ticksCooldown = ItemNBTHelper.getInt(stack, TAG_TICKS_COOLDOWN, 0);
    double length = ItemNBTHelper.getDouble(stack, TAG_DIST, -1);
    if(ticksCooldown == 0) {
      Entity item = null;
      if(targetID != -1 && player.worldObj.getEntityByID(targetID) != null) {
        Entity taritem = player.worldObj.getEntityByID(targetID);

        boolean found = false;
        Vector3 target = Vector3.fromEntityCenter(player);
        List<Entity> entities = new ArrayList<Entity>();
        int distance = 1;
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.