Project Zomboid

Project Zomboid

Starlit Library
Errors with tooltips
I got this error:

STACK TRACE
-----------------------------------------
Callframe at: DoTooltipEmbedded
function: DoTooltip -- file: InventoryUI.lua line # 31 | MOD: Starlit Library
function: render -- file: ISToolTipInv.lua line # 110 | Vanilla
function: render -- file: KATTAJ1_TooltipFixer.lua line # 13 | MOD: KATTAJ1 Clothes Core
function: render -- file: InventoryUI.lua line # 59 | MOD: Starlit Library
function: render -- file: PseudoInsulationSave.lua line # 25 | MOD: Recut
function: render -- file: ToolTipInvOverride.lua line # 120 | MOD: Dynamic Backpack Upgrades (B42)
function: render -- file: Skill Recovery Journal Tooltip.lua line # 294 | MOD: Skill Recovery Journal

ERROR: General f:29537, t:1741564703118> ExceptionLogger.logException> Exception thrown
java.lang.reflect.InvocationTargetException at GeneratedMethodAccessor1518.invoke(null:-1).
Stack trace:
jdk.internal.reflect.GeneratedMethodAccessor1518.invoke(Unknown Source)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.base/java.lang.reflect.Method.invoke(Unknown Source)
se.krka.kahlua.integration.expose.caller.MethodCaller.call(MethodCaller.java:62)
se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:211)
se.krka.kahlua.integration.expose.LuaJavaInvoker.call(LuaJavaInvoker.java:201)
se.krka.kahlua.vm.KahluaThread.callJava(KahluaThread.java:192)
se.krka.kahlua.vm.KahluaThread.luaMainloop(KahluaThread.java:988)
se.krka.kahlua.vm.KahluaThread.call(KahluaThread.java:173)
se.krka.kahlua.vm.KahluaThread.pcall(KahluaThread.java:1963)
se.krka.kahlua.vm.KahluaThread.pcallvoid(KahluaThread.java:1805)
se.krka.kahlua.integration.LuaCaller.pcallvoid(LuaCaller.java:38)
zombie.ui.UIElement.render(UIElement.java:2004)
zombie.ui.UIManager.render(UIManager.java:418)
zombie.gameStates.IngameState.renderFrameUI(IngameState.java:1371)
zombie.gameStates.IngameState.renderframeui(IngameState.java:1358)
zombie.gameStates.IngameState.renderInternal(IngameState.java:1500)
zombie.gameStates.IngameState.render(IngameState.java:1447)
zombie.gameStates.GameStateMachine.render(GameStateMachine.java:37)
zombie.GameWindow.renderInternal(GameWindow.java:473)
zombie.GameWindow.frameStep(GameWindow.java:952)
zombie.GameWindow.run_ez(GameWindow.java:821)
zombie.GameWindow.mainThread(GameWindow.java:619)
java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "zombie.characters.IsoGameCharacter.isLiteratureRead(String)" because the return value of "zombie.ui.ObjectTooltip.getCharacter()" is null
zombie.inventory.types.Literature.DoTooltip(Literature.java:111)
zombie.inventory.InventoryItem.DoTooltipEmbedded(InventoryItem.java:962)
... 24 more

I've been trying to do my own research on errors because of the amount of other mods I use and some are bound to cause errors.

I've been using Grok to sift through all these lua files to determine where the error is and its saying Starlit Library is most likely the cause. It gave me this fix and said add a safety check and fallback to vanilla rendering for tooltips:

local old_render = ISToolTipInv.render
ISToolTipInv.render = function(self)
local item = self.item
if instanceof(item, "FluidContainer") then
old_render(self)
return
end

local itemMetatable = getmetatable(item).__index
local old_DoTooltip = itemMetatable.DoTooltip
itemMetatable.DoTooltip = function(self, tooltip)
-- Safety check: ensure character exists
if not tooltip:getCharacter() then
old_DoTooltip(self, tooltip) -- Fallback to vanilla
return
end
local layout = tooltip:beginLayout()
local isInventoryContainer = instanceof(item, "InventoryContainer")
if not isInventoryContainer then
item:DoTooltipEmbedded(tooltip, layout, 0)
else
local freeLayouts = tooltip.freeLayouts
freeLayouts:push(layout)
old_DoTooltip(self, tooltip)
end
InventoryUI.onFillItemTooltip:trigger(tooltip, layout, item)
-- Rest of the logic unchanged
if not isInventoryContainer then
local height = layout:render(tooltip.padLeft, layout.offsetY, tooltip)
tooltip:endLayout(layout)
tooltip:setHeight(height + tooltip.padBottom)
if tooltip:getWidth() < 150 then
tooltip:setWidth(150)
end
else
local padBottom = tooltip.padBottom
local height = layout:render(tooltip.padLeft, tooltip:getHeight() - padBottom, tooltip)
tooltip:setHeight(height + padBottom)
layout.items:clear()
end
end

old_render(self)
itemMetatable.DoTooltip = old_DoTooltip
end

This goes from line 14 in the InventoryUI.lua to it's "end" if your using notepad++ you'll see the green line on the left of the screen that dictates that code. Delete the existing code and replace it with whats above this paragraph. IDK if this is 100% correct but I'm no longer getting errors.

If anyone else is trying to figure out errors using Grok, the best way I've found is to say you need help with this error in what ever build your on then post the error, then post any file that pertains to the error, just copy and paste the text out of the file since you can't upload .lua files (only txt). Hopefully this helps.
< >
Showing 1-4 of 4 comments
EPRock 17 Mar @ 12:59pm 
Here is the fix: InventoryUI.lua:31

-- Safety check: ensure character exists, otherwise fallback to vanilla rendering
if not tooltip or not tooltip:getCharacter() then
if old_DoTooltip then
old_DoTooltip(self, tooltip)
end
return
end
albion  [developer] 27 Mar @ 2:00am 
this error seems to be caused by one of the other mods messing up the state of the tooltip, i cannot reproduce it without any other mods enabled. this patch, while preventing the red error, prevents the library from working correctly, so i'm not willing to implement it: it would be best to round down which mod causes the issue, and bug the author to fix it - if they're unreachable or don't want to then i would add a specific patch for that mod to the library
KATTAJ1 Cloths Core
in 42/media/lua/client/KATTAJ1_TooltipFixer.lua
skulldives 19 Apr @ 12:26pm 
FINALLY BRO ANOTHER PERSON WITH THIS ERROR I THOUGHT I WAS GOING INSANE
< >
Showing 1-4 of 4 comments
Per page: 1530 50