Skip to content

Commit

Permalink
inventory.slot: better list vs non-list discrimination
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 14, 2022
1 parent 76eac9c commit 24ebe0b
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -2052,8 +2052,8 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName(
// @attribute <InventoryTag.slot[<#>|...]>
// @returns ObjectTag
// @description
// If one slot is specified, returns the ItemTag in the specified slot.
// If more than one slot is specified, returns a ListTag(ItemTag) of the item in each given slot.
// If just a single slot is specified, returns the ItemTag in the specified slot.
// If a list is specified, returns a ListTag(ItemTag) of the item in each given slot.
// -->
tagProcessor.registerTag(ObjectTag.class, "slot", (attribute, object) -> {
if (!attribute.hasParam()) {
Expand All @@ -2066,7 +2066,7 @@ else if (meta.hasDisplayName() && CoreUtilities.toLowerCase(meta.getDisplayName(
}
return null;
}
else if (slots.size() == 1) {
else if (slots.size() == 1 && !attribute.getParamObject().shouldBeType(ListTag.class)) {
int slot = SlotHelper.nameToIndexFor(attribute.getParam(), object.getInventory().getHolder());
if (slot < 0) {
slot = 0;
Expand Down

0 comments on commit 24ebe0b

Please sign in to comment.