#(yyykilla_3) Limit the movement of items across the slots
37 messages · Page 1 of 1 (latest)
(yyykilla_3) Limit the movement of items across the slots
Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
Hmmm.
This is a custom inventory from the looks, I'm assuming a chest inventory.
If I'm correct, it'll try to find the first empty slot available and put it in unless it's a special inventory like a furnace with fuel/food intake.
You're either going to want to check the first empty slot of the inventory, and cancel the event and manually move the item yourself.
Or just cancel the event and move the item yourself anyways while checking if the proper slots are empty.
!t inventorytag.first_empty
Returns the location of the first empty slot.
Returns -1 if the inventory is full.
ElementTag(Number)
!c inventory
item
inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)
Edits the inventory of a player, NPC, or chest.
Use this command to edit the state of inventories.
By default, the destination inventory is the current attached player's inventory.
If you are copying, swapping, removing from (including via "keep" and "exclude"), adding to, moving, or filling inventories,
you'll need both destination and origin inventories.
Origin inventories may be specified as a list of ItemTags, but destinations must be actual InventoryTags.
Using "open", "clear", or "update" only require a destination.
"Update" also req...
Which sounds like the exact same thing that I just said, but the overall goal is the same.
If you`re using 1.21.4+ version, you can place on "unused" slots any item with component "hide_tooltip" - https://minecraft.wiki/w/Data_component_format#tooltip_display
Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.
Data components are used in various places, including the player's inventory, container block enti...
Not sure how that relates to trying to force items only in specific slots?
You can put in unused such items and then minecraft itself will put in the right slots
But what about the other slots that are suppose to take in different items from the looks of things? Are you suggesting those should be filled with no tooltip items as well?
Slots that should accept items will remain empty, and where slots do not accept items, there will be the item with the desired component
If the first three inventory slots that they've circled are filled, then a shift clicked item will go into the far right inventory slot if it's not currently filled.
Same with the bottom row.
I'm a little confused about what you wrote
The original user is trying to make it so when shift clicking an item, it will only go in those six slots.
On the assumption that this isn't a mod and is a denizen custom inventory using a 36 slot inventory, if those first three slots are filled with items and they shift-click an item from the player inventory, it will go onto the far right slot that's X'd off currently in their preview.
I know what you're trying to get across though, about the spaces inbetween the slots that aren't suppose to show at all.
I haven't read what you wrote yet, but all that circled in blue should be filled with items with the hide component
As suggest though, you'll have to check those specific slots if they're empty/currently have items in them. And manually move them yourself via the - inventory command.
oh ye, I see what you mean
with hide tooltip items info will not be displayed
but the far right slot would be a problem. it would work perfectly for the first three slots
Sorry for late answer.
All not visible slots are indeed paper with no item model or tooltip visible
It is a 4 line chest, vanilla one, just with texture above
Okay, i didnt thought that shift click is ALWAYS a move event
you cant shift click without wanting to move items
A suggest was still given regarding this.
- check if slots available
- if yes - determine canceled, take item:<c.item>, inventory set ...
?
Yeah. Cancel item, inventory set the clicked slot to air (define item before to preserve item data), inventory set to the proper slot that was empty.
This is gonna get a little more complicated when the inventory slot isn't empty, but isn't completely full of an items quantity that can still be accepted, so you'll need to compensate for that.