From d5814195d87be96a5092846973bf04ee577a39a4 Mon Sep 17 00:00:00 2001
From: Wuzzy <almikes@aol.com>
Date: Fri, 2 Jun 2017 23:43:39 +0200
Subject: [PATCH] Fix invisible scrollbar on first creative inv open

---
 mods/HUD/mcl_inventory/creative.lua | 2 ++
 mods/HUD/mcl_inventory/init.lua     | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua
index 39c275fb..1093a07b 100644
--- a/mods/HUD/mcl_inventory/creative.lua
+++ b/mods/HUD/mcl_inventory/creative.lua
@@ -509,6 +509,7 @@ if minetest.setting_getbool("creative_mode") then
 end
 
 minetest.register_on_joinplayer(function(player)
+	-- Initialize variables and inventory
 	local name = player:get_player_name()
 	if not players[name] then
 		players[name] = {}
@@ -517,4 +518,5 @@ minetest.register_on_joinplayer(function(player)
 		players[name].start_i = 0
 	end
 	init(player)
+	mcl_inventory.set_creative_formspec(player, 0, 1, nil, false, "nix", "")
 end)
diff --git a/mods/HUD/mcl_inventory/init.lua b/mods/HUD/mcl_inventory/init.lua
index 9dbb734c..772a75b0 100644
--- a/mods/HUD/mcl_inventory/init.lua
+++ b/mods/HUD/mcl_inventory/init.lua
@@ -168,7 +168,10 @@ minetest.register_on_joinplayer(function(player)
 		armor:update_inventory(player)
 	end
 
-	set_inventory(player)
+	-- In Creative Mode, the initial inventory setup is handled in creative.lua
+	if not minetest.setting_get("creative_mode") then
+		set_inventory(player)
+	end
 
 	--[[ Make sure the crafting grid is empty. Why? Because the player might have
 	items remaining in the crafting grid from the previous join; this is likely