From 13e5974114f759bae73f3bfd68c62ce9cfaf785e Mon Sep 17 00:00:00 2001
From: mat <github@matdoes.dev>
Date: Sun, 20 Feb 2022 21:38:14 -0600
Subject: add more stuff to profile and fix bugs

---
 src/lib/minecraft/Inventory.svelte | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

(limited to 'src/lib/minecraft/Inventory.svelte')

diff --git a/src/lib/minecraft/Inventory.svelte b/src/lib/minecraft/Inventory.svelte
index d29b1e0..3068f67 100644
--- a/src/lib/minecraft/Inventory.svelte
+++ b/src/lib/minecraft/Inventory.svelte
@@ -1,22 +1,24 @@
 <script lang="ts">
+	import type { Inventory, Item as APIItem } from '$lib/APITypes'
+
 	import Item from './Item.svelte'
 
-	export let items
+	export let items: Inventory
 	export let name = ''
 	export let pack = ''
 	export let groupLimit = 9
 
-	if (name === 'inventory')
-		// in the inventory, the first 9 items are the hotbar and should be at the end
-		items = items.slice(9).concat(items.slice(0, 9))
-
 	// each item group has 9 items
-	let itemGroups = []
+	let itemGroups: APIItem[][] = []
 	$: {
 		itemGroups = []
 		for (let i = 0; i < items.length; i += groupLimit) {
 			itemGroups.push(items.slice(i, i + groupLimit))
 		}
+		if (name === 'inventory') {
+			// in the inventory, the first 9 items are the hotbar and should be at the end
+			itemGroups = itemGroups.slice(1).concat(itemGroups.slice(0, 1))
+		}
 	}
 </script>
 
-- 
cgit 

