Package net.minecraft.entity.item

Examples of net.minecraft.entity.item.EntityItem


            if (event.entityLiving.dimension == -1)
            {
                numberOfDrops = rand.nextInt((int) event.entityLiving.getMaxHealth() / 5 + event.lootingLevel);
                ItemStack leadIS = new ItemStack(ElectricExpansionItems.itemParts, Math.max(2, numberOfDrops), 10);
               
                event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, leadIS.copy()));
               
                if (rare)
                    event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ElectricExpansionItems.itemParts, 1, 7)));
            }
            else if (event.entityLiving.dimension == 1)
            {
                numberOfDrops = rand.nextInt((int) event.entityLiving.getMaxHealth() / 20 + event.lootingLevel);
                ItemStack silverIS = new ItemStack(ElectricExpansionItems.itemParts, Math.max(2, numberOfDrops), 11);
               
                event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, silverIS.copy()));
               
                if (rare)
                    event.drops.add(new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, new ItemStack(ElectricExpansionItems.itemParts, 1, 7)));
            }
           
            if (rand.nextInt(50_000) <= event.entityLiving.getMaxHealth() * (numberOfDrops + (rare ? 9 : 0)))
            {
                event.entityLiving.worldObj.createExplosion(event.entityLiving, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, 3, false);
View Full Code Here


        if (item.getType() == 0) {
            return;
        }

        EntityItem entity = new EntityItem(getWorld(), position.getX(), position.getY(), position.getZ(), ForgeUtil.toForgeItemStack(item));
        entity.delayBeforeCanPickup = 10;
        getWorld().spawnEntityInWorld(entity);
    }
View Full Code Here

      default:
        break;
       
    }
   
    EntityItem entityitem = new EntityItem(world, bp.x + dropOffsetX, bp.y + dropOffsetY, bp.z + dropOffsetZ, stack.copy());
    entityitem.motionX = 0.0D;
    if(towards != ForgeDirection.DOWN) entityitem.motionY = 0.3D;
    entityitem.motionZ = 0.0D;
    entityitem.delayBeforeCanPickup = 20;
    world.spawnEntityInWorld(entityitem);
View Full Code Here

        ItemStack itemstack = tablet.getStackInSlot(j1);

        if (itemstack != null) {
          float f = random.nextFloat() * 0.8F + 0.1F;
          float f1 = random.nextFloat() * 0.8F + 0.1F;
          EntityItem entityitem;

          for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
            int k1 = random.nextInt(21) + 10;

            if (k1 > itemstack.stackSize)
              k1 = itemstack.stackSize;

            itemstack.stackSize -= k1;
            entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
            float f3 = 0.05F;
            entityitem.motionX = (float) random.nextGaussian() * f3;
            entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
            entityitem.motionZ = (float) random.nextGaussian() * f3;

            if (itemstack.hasTagCompound())
              entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
          }
        }
      }

      //Look here if something breaks in 1.7
View Full Code Here

        ItemStack itemstack = warpGate.getStackInSlot(j1);

        if (itemstack != null) {
          float f = random.nextFloat() * 0.8F + 0.1F;
          float f1 = random.nextFloat() * 0.8F + 0.1F;
          EntityItem entityitem;

          for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
            int k1 = random.nextInt(21) + 10;

            if (k1 > itemstack.stackSize)
              k1 = itemstack.stackSize;

            itemstack.stackSize -= k1;
            entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
            float f3 = 0.05F;
            entityitem.motionX = (float) random.nextGaussian() * f3;
            entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
            entityitem.motionZ = (float) random.nextGaussian() * f3;

            if (itemstack.hasTagCompound())
              entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
          }
        }
      }

      par1World.func_147453_f(par2, par3, par4, par5);
View Full Code Here

        for (ItemStack item : ret) {
            float f = 0.7F;
            double d0 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
            double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
            double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
            EntityItem entityitem = new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, item);
            entityitem.delayBeforeCanPickup = 10;
            world.spawnEntityInWorld(entityitem);
        }

        super.breakBlock(world, x, y, z, block, metadata);
View Full Code Here

  }

  private void renderItem(TileAnimationTablet tablet) {
    ItemStack stack = tablet.getStackInSlot(0);
    if (stack != null) {
      EntityItem entityitem = new EntityItem(tablet.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
      entityitem.getEntityItem().stackSize = 1;
      entityitem.hoverStart = 0.0F;
      GL11.glPushMatrix();
      GL11.glTranslatef(0.5F, 0.55F, 0F);
      if (stack.getItem() instanceof ItemBlock)
        GL11.glScalef(2.5F, 2.5F, 2.5F);
View Full Code Here

    worldObj.playAuxSFXAtEntity(null, 2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
    worldObj.setBlockToAir(x, y, z);

    List<EntityItem> result = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - 2, y - 2, z - 2, x + 3, y + 3, z + 3));
    for (int i = 0; i < result.size(); i++) {
      EntityItem entity = result.get(i);
      if (entity.isDead || entity.getEntityItem().stackSize <= 0) {
        continue;
      }
      stacks.add(entity.getEntityItem());
      entity.worldObj.removeEntity(entity);
    }
    return stacks;
  }
View Full Code Here

              if (var13 > var9.stackSize) {
                var13 = var9.stackSize;
              }

              var9.stackSize -= var13;
              EntityItem var14 = new EntityItem(par1World, (double) ((float) x + var10), (double) ((float) y + var11),
                  (double) ((float) z + var12), new ItemStack(var9.itemID, var13, var9.getItemDamage()));

              if (var9.hasTagCompound()) {
                var14.item.setTagCompound((NBTTagCompound) var9.getTagCompound().copy());
              }
View Full Code Here

    if(doRandomSpread) {
      float f1 = 0.7F;
      double d = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
      double d1 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
      double d2 = (world.rand.nextFloat() * f1) + (1.0F - f1) * 0.5D;
      EntityItem entityitem = new EntityItem(world, x + d, y + d1, z + d2, stack);
      entityitem.delayBeforeCanPickup = 10;
      return entityitem;
    } else {
      EntityItem entityitem = new EntityItem(world, x, y, z, stack);
      entityitem.motionX = 0;
      entityitem.motionY = 0;
      entityitem.motionZ = 0;
      entityitem.delayBeforeCanPickup = 0;
      return entityitem;
View Full Code Here

TOP

Related Classes of net.minecraft.entity.item.EntityItem

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.