Package net.minecraft.entity.item

Examples of net.minecraft.entity.item.EntityItem


      }
    }

    if(manaToGet > 0 && mana >= manaToGet && !worldObj.isRemote) {
      List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1));
      EntityItem livingrock = null;
      for(EntityItem item : items)
        if(!item.isDead && item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) {
          livingrock = item;
          break;
        }

      if(livingrock != null) {
        int mana = recipe.getManaUsage();
        recieveMana(-mana);
        if(!worldObj.isRemote) {
          ItemStack output = recipe.getOutput().copy();
          EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
          worldObj.spawnEntityInWorld(outputItem);
          cooldown = 60;
        }

        for(int i = 0; i < getSizeInventory(); i++)
View Full Code Here


        ItemStack itemstack = inv.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

  public void onUpdate() {
    super.onUpdate();
    if(redstoneSignal == 0 && supertile.getWorldObj().getTotalWorldTime() % 200 == 0 && mana >= COST) {
      Random rand = supertile.getWorldObj().rand;
      ItemStack stack = ChestGenHooks.getOneItem(ChestGenHooks.DUNGEON_CHEST, rand);
      EntityItem entity = new EntityItem(supertile.getWorldObj(), supertile.xCoord - 3 + rand.nextInt(7) , supertile.yCoord + 1, supertile.zCoord - 3 + rand.nextInt(7), stack);
      entity.motionX = 0;
      entity.motionY = 0;
      entity.motionZ = 0;

      if(!supertile.getWorldObj().isRemote)
View Full Code Here

    Block blockBelow = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
    return blockBelow.isAir(worldObj, xCoord, yCoord - 1, zCoord);
  }

  public void eject(ItemStack stack, boolean redstone) {
    EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord - 0.5, zCoord + 0.5, stack);
    item.motionX = 0;
    item.motionY = 0;
    item.motionZ = 0;

    if(redstone)
View Full Code Here

            world.setBlockToAir(x, y, z);
            if(ConfigHandler.blockBreakParticles)
              entity.worldObj.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));

            for(ItemStack stack_ : items)
              world.spawnEntityInWorld(new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, stack_));
            burst.setMana(mana - 24);
          }
        }

        dead = false;
View Full Code Here

        if (movingobjectposition.entityHit != null) {
          movingobjectposition.entityHit.attackEntityFrom(DamageSource.magic, 2.0F);
          if (!worldObj.isRemote) {
            Entity item = getEntityItem().getItem().createEntity(worldObj, this, getEntityItem());
            if (item == null) {
              item = new EntityItem(worldObj, posX, posY, posZ, getEntityItem());
              worldObj.spawnEntityInWorld(item);
              item.motionX = motionX*0.25F;
              item.motionY = motionY*0.25F;
              item.motionZ = motionZ*0.25F;

            }
            else
            {
              item.motionX = motionX*0.25F;
              item.motionY = motionY*0.25F;
              item.motionZ = motionZ*0.25F;
            }
          }
          setDead();

        }
      }
    }

    Vector3 vec3m = new Vector3(motionX, motionY, motionZ);
    if (vec3m.mag() < 1.0F) {
      if (!worldObj.isRemote) {
        Entity item = getEntityItem().getItem().createEntity(worldObj, this, getEntityItem());
        if (item == null) {
          item = new EntityItem(worldObj, posX, posY, posZ, getEntityItem());
          worldObj.spawnEntityInWorld(item);
          item.motionX = motionX;
          item.motionY = motionY;
          item.motionZ = motionZ;
        }
View Full Code Here

          List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.posX + entity.width, entity.posY + entity.height, entity.posZ + entity.width));
          for(EntityItem item : items) {
            ItemStack itemstack = item.getEntityItem();
            if(itemstack != null && itemstack.getItem() == Items.bucket && !world.isRemote) {
              while(itemstack.stackSize > 0) {
                EntityItem ent = entity.entityDropItem(new ItemStack(Items.milk_bucket), 1.0F);
                ent.motionY += world.rand.nextFloat() * 0.05F;
                ent.motionX += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
                ent.motionZ += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
                itemstack.stackSize--;
              }
              item.setDead();
            }
          }
        }
      }

      Collections.shuffle(shearables);
      int sheared = 0;

      for(EntityLiving entity : shearables) {
        if(sheared > 4)
          break;

        List<ItemStack> stacks = ((IShearable) entity).onSheared(stack, world, (int) entity.posX, (int) entity.posY, (int) entity.posZ, 0);
        if(stacks != null && !world.isRemote)
          for(ItemStack wool : stacks) {
            EntityItem ent = entity.entityDropItem(wool, 1.0F);
            ent.motionY += world.rand.nextFloat() * 0.05F;
            ent.motionX += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
            ent.motionZ += (world.rand.nextFloat() - world.rand.nextFloat()) * 0.1F;
          }
        ++sheared;
 
View Full Code Here

      if(target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) {
        ArrayList<ItemStack> drops = target.onSheared(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ, 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;
        }

 
View Full Code Here

          float f = 0.7F;
          double d  = rand.nextFloat() * f + (1D - f) * 0.5;
          double d1 = rand.nextFloat() * f + (1D - f) * 0.5;
          double d2 = rand.nextFloat() * f + (1D - f) * 0.5;

          EntityItem entityitem = new EntityItem(player.worldObj, x + d, y + d1, z + d2, stack);
          entityitem.delayBeforeCanPickup = 10;
          player.worldObj.spawnEntityInWorld(entityitem);
        }

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

            stack.stackSize--;
            if(stack.stackSize == 0)
              item.setDead();

            ItemStack output = recipe.getOutput().copy();
            EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
            outputItem.age = 105;
            worldObj.spawnEntityInWorld(outputItem);
          }

          craftingFanciness();
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.