Package net.minecraft.entity.item

Examples of net.minecraft.entity.item.EntityItem


        {
            int meta = world.getBlockMetadata(x, y, z);
            if (meta >= 12)
            {
                world.setBlock(x, y, z, this, meta - 4, 3);
                EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.berryItem, 1, meta - 12));
                world.spawnEntityInWorld(entityitem);
                if (!(player instanceof FakePlayer))
                    entityitem.onCollideWithPlayer(player);
            }
        }
    }
View Full Code Here


                        EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));

                Random rand = new Random();
                for (ItemStack stack : drops)
                {
                    EntityItem ent = entity.entityDropItem(stack, 1.0F);
                    ent.motionY += rand.nextFloat() * 0.05F;
                    ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
                    ent.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
                }
                itemstack.damageItem(1, entity);
View Full Code Here

                {
                    float f = 0.7F;
                    double d = rand.nextFloat() * f + (1.0F - f) * 0.5D;
                    double d1 = rand.nextFloat() * f + (1.0F - f) * 0.5D;
                    double d2 = rand.nextFloat() * f + (1.0F - f) * 0.5D;
                    EntityItem entityitem = new EntityItem(player.worldObj, x + d, y + d1, z + d2, stack);
                    entityitem.delayBeforeCanPickup = 10;
                    player.worldObj.spawnEntityInWorld(entityitem);
                }

                itemstack.damageItem(1, player);
View Full Code Here

    this.invalidate();
  }

  public void dropItem(ItemStack item)
  {
    EntityItem entityitem = new EntityItem(worldObj, (double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D, item);
    entityitem.delayBeforeCanPickup = 10;
    worldObj.spawnEntityInWorld(entityitem);
  }
View Full Code Here

          if(amountToDrop > itemstack.stackSize)
          {
            amountToDrop = itemstack.stackSize;
          }
          itemstack.stackSize -= amountToDrop;
          EntityItem entityitem = new EntityItem(world, (float)x + xOffset, (float)y + yOffset, (float)z + zOffset, new ItemStack(itemstack.getItem(), amountToDrop, itemstack.getItemDamage()));
          if(itemstack.getTagCompound() != null)
          {
            entityitem.getEntityItem().setTagCompound(itemstack.getTagCompound());
          }
          float motionMultiplier = 0.05F;
          entityitem.motionX = (float)world.rand.nextGaussian() * motionMultiplier;
          entityitem.motionY = (float)world.rand.nextGaussian() * motionMultiplier + 0.2F;
          entityitem.motionZ = (float)world.rand.nextGaussian() * motionMultiplier;
 
View Full Code Here

          if(amountToDrop > itemstack.stackSize)
          {
            amountToDrop = itemstack.stackSize;
          }
          itemstack.stackSize -= amountToDrop;
          EntityItem entityitem = new EntityItem(world, (float)x + xOffset, (float)y + yOffset, (float)z + zOffset, new ItemStack(itemstack.getItem(), amountToDrop, itemstack.getItemDamage()));
          if(itemstack.getTagCompound() != null)
          {
            entityitem.getEntityItem().setTagCompound(itemstack.getTagCompound());
          }
          float motionMultiplier = 0.05F;
          entityitem.motionX = (float)world.rand.nextGaussian() * motionMultiplier;
          entityitem.motionY = (float)world.rand.nextGaussian() * motionMultiplier + 0.2F;
          entityitem.motionZ = (float)world.rand.nextGaussian() * motionMultiplier;
 
View Full Code Here

      this.attackEntityFrom(DamageSource.generic, 50);
     
      if(!worldObj.isRemote)
      {
        ItemStack meats = new ItemStack(MineFactoryReloadedCore.meatNuggetRawItem, worldObj.rand.nextInt(12) + size);
        EntityItem e = new EntityItem(worldObj, posX, posY, posZ, meats);
        e.motionX = rand.nextDouble() - 0.5D;
        e.motionY = rand.nextDouble() - 0.5D;
        e.motionZ = rand.nextDouble() - 0.5D;
        worldObj.spawnEntityInWorld(e);
      }
View Full Code Here

 
  private void dropAsStack(ItemStack stack)
  {
    if(!worldObj.isRemote && stack != null)
    {
      EntityItem ei = new EntityItem(worldObj, posX, posY, posZ, stack);
      if(stack.getTagCompound() != null)
      {
        ei.getEntityItem().setTagCompound(stack.getTagCompound());
      }
      ei.delayBeforeCanPickup = 40;
      worldObj.spawnEntityInWorld(ei);
    }
    setDead();
View Full Code Here

  }

  public void dropItems(ArrayList<EntityItem> drops) {
    for (int i = 0; i < 4; ++i) {
      if (this.stackList[i] != null) {
        EntityItem ei = new EntityItem(player.get().worldObj,
            player.get().posX, player.get().posY
                + player.get().eyeHeight, player.get().posZ,
            this.stackList[i].copy());
        ei.delayBeforeCanPickup = 40;
        float f1 = player.get().worldObj.rand.nextFloat() * 0.5F;
 
View Full Code Here

   */
  protected abstract void selfDestroy();

  public void dropItem(ItemStack item)
  {
    EntityItem entityitem = new EntityItem(worldObj, (double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D, item);
    entityitem.delayBeforeCanPickup = 10;
    worldObj.spawnEntityInWorld(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.