Minecraft:Slot sources: Difference between revisions
From SAS Gaming Wiki
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| Line 79: | Line 79: | ||
|{{HistoryLine||1.21.11|dev=25w44a|Added slot sources.}} | |{{HistoryLine||1.21.11|dev=25w44a|Added slot sources.}} | ||
|{{HistoryLine|upcoming java}} | |{{HistoryLine|upcoming java}} | ||
|{{HistoryLine||26.3|dev= | |{{HistoryLine||26.3|dev=snap1|Slot sources can now be defined as files inside a datapack, within the {{cd|slot_source}} folder.|{{cd|minecraft:contents}} is no longer restricted to only selecting non-empty slots.|Added {{cd|minecraft:reference}}.|Changed {{cd|minecraft:slot_range}}.}} | ||
|{{HistoryLine|||dev=snap4|Removed {{cd|minecraft:reference}}.}} | |||
}} | }} | ||
Revision as of 11:13, 18 July 2026
Template:Improve lead Template:Wip Slot sources allow the location of any Minecraft:inventory slot to be specified within Minecraft:data packs and the arguments of Minecraft:commands.
Format
Slot sources are JSON objects, with the following fields.
type: the slot source type.<type-specific>: additional fields depending on the type.
minecraft:emptyType- Empty selection containing no slots.
minecraft:groupType- Merges several slot sources into one, with the resulting selection containing all slots from each slot source provided.
- If a slot is included in more than one slot source, it will be repeated in the resulting slot source.
- e.g.
[a, b] + [c, a]->[a, b, c, a]
- Format:
terms: list of slot sources to join.
- Can alternatively be written inline as a list of slot sources.
- Merges several slot sources into one, with the resulting selection containing all slots from each slot source provided.
minecraft:slot_rangeType- Selects slots within a slot range from the inventory of an entity or block entity.
- Mirrors the behavior of the
fromargument of the/itemcommand. - Format:
source: an entity or block entity from which the slots will be sourced, from loot context.- Can be
block_entity, this,attacking_entity,last_damage_player,direct_attacker,target_entity, orinteracting_entity
- Can be
slots: a slot range in the format of<slot_type>or<slot_type>.<slot_number>(e.g.armor.chestorcontainer.*).
minecraft:contentsType- Selects all non-empty slots from the inventory component of one or more items.
- If no item is stored inside that component, the resulting selection will be empty.
- The location of the item(s) whose inventory component to use is specified by another slot source.
- If the slot source includes more than one item with that component, the resulting selections will be merged identically as with the
minecraft:grouptype. - e.g.
Bundle [a, b] + Shulker Box [c, d]->[a, b, c, d]
- If the slot source includes more than one item with that component, the resulting selections will be merged identically as with the
- Format:
component: the inventory component to target.- Allowed values are
minecraft:bundle_contents,minecraft:charged_projectiles, andminecraft:container
- Allowed values are
slot_source: a slot source containing slots with item(s) to target.
- Selects all non-empty slots from the inventory component of one or more items.
minecraft:filteredType- Applies a filter to the selected slots, excluding any non-matching slots from the resulting selection.
- Format:
item_filter: an item predicate to match against the items in each slot.slot_source: the slot source to filter.
minecraft:limit_slotsType- Limits the number of slots provided, with the resulting selection containing at most that number of slots.
- Any slots bringing the number of slots above that limit will be excluded, in order of inclusion.
- e.g.
[a, b, c, d]->[a, b, c]if the limit is set to3
- Format:
limit: integer, the maximum number of slots to include in the resulting selection.slot_source: the slot source to limit.
- Limits the number of slots provided, with the resulting selection containing at most that number of slots.
- Example slot source selecting every slot with more than 16 items from the hotbar and armor slots of an entity:<syntaxhighlight lang="json">
{
"type": "minecraft:filtered",
"item_filter": {
"count": {
"min": 16
}
},
"slot_source": [
{
"type": "minecraft:slot_range",
"source": "this",
"slots": "hotbar.*"
},
{
"type": "minecraft:slot_range",
"source": "this",
"slots": "armor.*"
}
]
} </syntaxhighlight>
History
Template:Navbox Java Edition technical
Minecraft:de:Inventarplatzquelle Minecraft:ja:スロット供与子 Minecraft:pt:Fontes de espaço Minecraft:ru:Источники слотов Minecraft:zh:槽位源