Shnupbups / redstone-bits

GNU Lesser General Public License v3.0
7 stars 6 forks source link

Placer deducts two items at a time from inventory due to using BlockPlacementDispenserBehavior #2

Closed nicwatson closed 2 years ago

nicwatson commented 5 years ago

To reproduce:

Place a placer. Put a button on the placer. Put a stack of 64 cobblestones in the placer inventory. Press the button. Observe that one block is placed, but the size of the stack in the placer is 62.

This is due to the fact that the placer block uses Mojang's BlockPlacementDispenserBehavior which is buggy. Specifically, after invoking BlockItem.place() (and passing it an AutomaticItemPlacementContext with a reference to the ItemStack, it calls subtractAmount(1) on the same ItemStack, but place() already does that itself. Consequently, two subtractions are carried out.

This isn't really Redstone Bits' fault but overriding BlockPlacementDispenserBehavior.dispenseStack() is probably necessary to avoid the trap.

Shnupbups commented 5 years ago

Hmm, odd. I've never encountered this issue myself. Regardless, will fix next update.

The-Mr-Mango commented 5 years ago

I've got the same problem. It's still not updated :(

Hmm, odd. I've never encountered this issue myself. Regardless, will fix next update.

Btw, you did encounter this issue in your own gif (on the curseforge page of your mod)!