Skip to content

Commit 016b1d7

Browse files
committed
Fix Shulker content discovery
1 parent 5964ab5 commit 016b1d7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/main/kotlin/com/lambda/util/item/ItemStackUtils.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.lambda.util.item
1919

2020
import com.lambda.util.collections.Cacheable.Companion.cacheable
21+
import net.minecraft.component.ComponentType
2122
import net.minecraft.component.DataComponentTypes
2223
import net.minecraft.component.type.AttributeModifiersComponent
2324
import net.minecraft.entity.EquipmentSlot
@@ -104,15 +105,8 @@ object ItemStackUtils {
104105
return listOf(copyWithCount(maxCount), copyWithCount(remainder))
105106
}
106107

107-
// TODO: Find another way
108108
val ItemStack.shulkerBoxContents: List<ItemStack> by cacheable { stack ->
109-
/*BlockItem.getBlockEntityNbt(stack)?.takeIf {
110-
it.contains("Items", NbtElement.LIST_TYPE.toInt())
111-
}?.let {
112-
val list = DefaultedList.ofSize(27, ItemStack.EMPTY)
113-
Inventories.readNbt(it, list)
114-
list
115-
} ?: */emptyList()
109+
stack.components.get(DataComponentTypes.CONTAINER)?.stream()?.toList() ?: emptyList()
116110
}
117111

118112
/**

0 commit comments

Comments
 (0)