Jump to content

ItemStacks for Multiple Block Drops


MrArcane111

Recommended Posts

Howdy, folks. Here's my problem:

 

I created my own method for grabbing a block's drops.

public static ItemStack getDroppedItemStack(World world, EntityLivingBase entityLiving, Block block, int x, int y, int z)
{
ArrayList<ItemStack>drops = block.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), EnchantmentHelper.getFortuneModifier(entityLiving));
ItemStack is = null;

for (int size = 0; size < drops.size(); size++)
{
	is = (ItemStack)drops.get(size);
}

return is;
}

 

The problem is, however, that when I am adding these drops to a given inventory (in an item's onBlockDestroyed method), I am only getting one of the drops. Understandably so because I am only returning ONE instance of an ItemStack, which cannot handle two.

 

So my question is: how DOES one return two ItemStacks for multiple drops (i.e. wheat) of a block? Do I make a second ItemStack to copy? I don't know. Anyway, thanks for the help!

 

;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.