Giving hand item copies stack size bug

Submitted by Anonymous (not verified) on Fri, 04/12/2019 - 14:32
Upvotes: 1
Issue description

When you copy hand in 1.8.3 and state you want to return one item the stack size is not added to the code, it just copies the stack size in your hand so you end up doubling up to a stack of 64 then after that it copies a full stack.

 

	public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			System.err.println("Failed to load dependency entity for procedure testblockOnBlockRightClicked!");
			return;
		}
		Entity entity = (Entity) dependencies.get("entity");
		if (entity instanceof EntityPlayer)
			ItemHandlerHelper.giveItemToPlayer(((EntityPlayer) entity),
					((entity instanceof EntityLivingBase) ? ((EntityLivingBase) entity).getHeldItemMainhand() : null));
	}

The stack size is missing from the code above, but the producer makes you believe a stack side has been set, this seems to only happen when you use the from hand option
if your given a new item it sets the item with a stack size.

https://i.imgur.com/waMTqqk.png
 

	public static void executeProcedure(java.util.HashMap<String, Object> dependencies) {
		if (dependencies.get("entity") == null) {
			System.err.println("Failed to load dependency entity for procedure testblockOnBlockRightClicked!");
			return;
		}
		Entity entity = (Entity) dependencies.get("entity");
		if (entity instanceof EntityPlayer)
			ItemHandlerHelper.giveItemToPlayer(((EntityPlayer) entity),
					((entity instanceof EntityLivingBase) ? ((EntityLivingBase) entity).getHeldItemMainhand() : null));

		// new item has a stack amount			
		if (entity instanceof EntityPlayer)
			ItemHandlerHelper.giveItemToPlayer(((EntityPlayer) entity), new ItemStack(Blocks.SLIME_BLOCK, (int) (1)));
	}

It seems you have over looked the stack size in the get hand option or at least some anitation saying stack size will depend on held size.

Issue comments

Submitted by Klemen on Sun, 04/14/2019 - 18:59

I can confirm this bug. We will try to fix it ASAP.

This one I haven't been able to find a work around for as of yet so if you come up with a fix before hand please hit us back :)

Submitted by Klemen on Mon, 04/15/2019 - 18:28

Will make sure to do so!

Submitted by Klemen on Sat, 06/22/2019 - 10:16

This bug will be fixed in MCreator 1.9.0.