Posted May 16, 201411 yr 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!
May 16, 201411 yr An itemstack can only hold one, and you are return one itemstack. Don't get me wrong, I see your question but... if you would like to get multiple drops you might have to return the list (I really don't know) I'll look around.
May 17, 201411 yr Maybe you should spawn in an entityItem for both of the itemstacks and return nothing
May 23, 201411 yr Author Never mind. Problem solved. If anyone's curious: https://github.com/Surseance/EnderGloves/blob/master/src/main/java/endergloves/common/item/ItemEnderGlove.java P.S. The code is a bit messy; will clean it up in a few days. It works perfectly though, so don't complain.
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.