Skip to content

Commit

Permalink
Use more generic item insert for flower pouch emptying
Browse files Browse the repository at this point in the history
Fixes #4008 and potential similar issues with other multiblock storages.
  • Loading branch information
TheRealWormbo committed Jul 6, 2024
1 parent 26aa18f commit b569c5b
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,13 @@ public InteractionResult useOn(UseOnContext ctx) {
Direction side = ctx.getClickedFace();

BlockEntity tile = world.getBlockEntity(pos);
if (tile != null) {
if ((ctx.getPlayer() == null || ctx.getPlayer().isSecondaryUseActive())
&& XplatAbstractions.INSTANCE.hasInventory(world, pos, side)) {
if (!world.isClientSide) {
Container tileInv;
if (tile instanceof Container container) {
tileInv = container;
} else {
return InteractionResult.FAIL;
}

Container bagInv = getInventory(ctx.getItemInHand());
for (int i = 0; i < bagInv.getContainerSize(); i++) {
ItemStack flower = bagInv.getItem(i);
ItemStack rem = HopperBlockEntity.addItem(bagInv, tileInv, flower, side);
ItemStack rem = XplatAbstractions.INSTANCE.insertToInventory(world, pos, side, flower, false);
bagInv.setItem(i, rem);
}

Expand Down

0 comments on commit b569c5b

Please sign in to comment.