From d3d735d000fd26d2440056546bc10ad9cf1bbe41 Mon Sep 17 00:00:00 2001
From: modmuss50 <modmuss50@gmail.com>
Date: Mon, 12 Dec 2022 19:26:03 +0000
Subject: [PATCH] Fix previous creative tab not being restored (#2751)

---
 .../mixin/itemgroup/client/CreativeInventoryScreenMixin.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fabric-item-group-api-v1/src/client/java/net/fabricmc/fabric/mixin/itemgroup/client/CreativeInventoryScreenMixin.java b/fabric-item-group-api-v1/src/client/java/net/fabricmc/fabric/mixin/itemgroup/client/CreativeInventoryScreenMixin.java
index 6882db5b0..05d9522cb 100644
--- a/fabric-item-group-api-v1/src/client/java/net/fabricmc/fabric/mixin/itemgroup/client/CreativeInventoryScreenMixin.java
+++ b/fabric-item-group-api-v1/src/client/java/net/fabricmc/fabric/mixin/itemgroup/client/CreativeInventoryScreenMixin.java
@@ -46,6 +46,9 @@ public abstract class CreativeInventoryScreenMixin<T extends ScreenHandler> exte
 	@Shadow
 	protected abstract void setSelectedTab(ItemGroup itemGroup_1);
 
+	@Shadow
+	private static ItemGroup selectedTab;
+
 	// "static" matches selectedTab
 	private static int fabric_currentPage = 0;
 
@@ -96,7 +99,7 @@ public abstract class CreativeInventoryScreenMixin<T extends ScreenHandler> exte
 
 	@Inject(method = "init", at = @At("RETURN"))
 	private void init(CallbackInfo info) {
-		fabric_updateSelection();
+		fabric_currentPage = fabric_getPage(selectedTab);
 
 		int xpos = x + 170;
 		int ypos = y + 4;