MouseTweaks icon indicating copy to clipboard operation
MouseTweaks copied to clipboard

Mouse tweaks scrolling deletes items with Minecolonies

Open Raycoms opened this issue 5 years ago • 6 comments

Initial bug report: https://github.com/ldtteam/minecolonies/issues/6078

It's because Minecolonies copies the stack on setStackInSlot.

Raycoms avatar Nov 15 '20 15:11 Raycoms

Might be better to fix in Minecolonies. Generally you don't want things like this to be possible from the client side (Mouse Tweaks is clientside-only).

YaLTeR avatar Nov 15 '20 15:11 YaLTeR

That's strange because shift clicking etc works perfectly fine. Even shifting over several stacks which should have a similar behaviour.

Raycoms avatar Nov 15 '20 15:11 Raycoms

    @Override
    public void setStackInSlot(final int slot, @Nonnull final ItemStack stack)
    {
        mainInventory.set(slot, stack.copy());
    }

Basically because we copy here, the scrolling to insert breaks.

Raycoms avatar Nov 15 '20 15:11 Raycoms

How do other inventories do it?

YaLTeR avatar Nov 15 '20 15:11 YaLTeR

Also FYI Mouse Tweaks doesn't (and can't) directly manipulate containers with setStackInSlot; it implements all its features by simulating button presses using handleMouseClick.

YaLTeR avatar Nov 15 '20 15:11 YaLTeR

Vanilla mostly sets the stack directly, but they don't track inventory changes as we need it. We're tracking the contents of the inventories to avoid changing contents and us not noticing things are gone or new.

Raycoms avatar Nov 15 '20 15:11 Raycoms