LV Drill (and possibly other tools?) missing material enchantment information in tooltip

,

This is a fairly minor thing I noticed when digging through my toolchest.
GregTech assigns tools made of Spectre Iron (a material from Random Things) the Silk Touch I enchant.
I have both a Pickaxe and Mining Drill (LV) made of Spectre Iron, but only the Pickaxe shows that it has Silk Touch I:

I considered the possibility that the reason I wasn’t seeing the enchantment on the tooltip was because (for whatever reason) the Drill didn’t have it (despite being made of a material that should bestow that enchant on every valid tool made with it), but I ruled that out by using the drill to harvest a glass pane, which it successfully collected.

This may affect other tools as well - I haven’t tested (those two tools and a shovel are the only GregTech tools I have made of Spectre Iron).

Edit:
I’m also noticing that it says one is unburnable and the other isn’t. I’m not sure if the tooltip is wrong about that.

2 Likes

Hrrm, I suspect the Issue is that the Tool is electric and that it changes the Tooltip in a way that kills the Vanilla Silk Touch Tooltip somehow.

2 Likes

So I found the Issue I think, something in my Tooltips crashed if the Tool does not have a normal Handle, which in case of Electric Tools is easy to see. Lovely when Vanilla Tooltips Crash without any hint of an Exception or StackTrace or ANYTHING AT ALL!

:gregory: This Version should probably be working for you. ^^

(note 1: The scary sounding Description is only there to make sure people don’t use that Version lightly.)

(note 2: if you use this Version more often, make sure your Browser didn’t cache the Download)

3 Likes

Okay, I finally had some time recently to give that version a try (snapshot, downloaded 5/3/21 @ 8:06 AM UTC) but it appears the information is still missing from the tooltip:

no-enchants-2

I also double-checked to make sure I was running the snapshot:

2 Likes

I have to make sure that this did not happen, it is quite difficult to check for, and the Browsers are not transparent about this at all…

2 Likes

I don’t think that’s the case. This is the first time I’ve downloaded a snapshot version of GregTech in years. I also have Firefox set up to clear my cache every time I exit the browser, so there’s that as well.

I also checked the commit hash (574aedd8) from the in-game version string (see the second screenshot in my previous post above) and it matched this commit in the GregTech 6 repository on GitHub:

commit 574aedd8c32f4a1bab775417f94062fc7d35ffd3
Author: Gregorius Techneticies <gregoriustech@gmail.com>
Date:   Mon May 3 07:46:27 2021 +0200

    This should fix Tooltips crashing without throwing any exceptions

As for the problem of people downloading a cached version of GregTech, you may be able to fix that by using a cache-breaker / cache-buster. The simplest way I can think of to accomplish that is to replace the link to the snapshot .jar on the secret download page with a <script> on the page that writes that same link, but with a query parameter (cb) whose value is the current Unix timestamp:

document.write( `<a href="https://gregtech.mechaenetia.com/com/gregoriust/gregtech/gregtech_1.7.10/SNAPSHOT/gregtech_1.7.10-SNAPSHOT.jar?cb=${Date.now()}">Download</a>` );

Alternatively, there are special headers (like Cache-Control) that can be used tell browsers not to cache a requested resource. You can accomplish that by configuring your webserver to send that header when that specific URL / a URL beneath the snapshot directory is requested. I’m not as well versed with Cache-Control and its related headers however so I doubt I could be of much help there.

2 Likes

Yeah we did that one recently, so I am not sure if it worked or not. Well, guess I need to look at those Tools again…

Edit: I’m testing like mad and I simply cannot find the reason why it doesn’t work for specifically all electric Tools, and ONLY the electric Tools. Like I made getEnergyStats return null for everything and suddenly the Tooltips show Enchantments… And yes I even tried removing all Mods including NEI, so that only gregtech.jar was in the Mods Folder…

2 Likes

Okay I ran out of Ideas, gonna need to use the nuclear option…


@OvermindDL1 So Electric GT6 Tools do not display Enchantments in their Tooltips for whatever reason.
The trigger is literally them being electric, non-electric Tools work just fine, including electric Tools that I took the electric Properties away from!
And it happens even if absolutely no other Mods, not even NEI, are installed.
The Formatting of the Strings did not seem to be the Issue either.
All my Tooltip related Functions are in a try/catch just to make sure a muted Crash is not the reason either.
I even thought of there being some Client/Server shenanigans going on, but I do not think those are the case either…

2 Likes

Already long done, lol.

So what I’m hearing is I should set up my workspace again tomorrow so I can debug into it? I’ll need you to give me precise instructions tomorrow then on how to replicate it in the various conditions.

2 Likes

Thanks to OvermindDL1 for making me feel stupid on that one, I really should have Ctrl+F-ed for “ench” in my Code just to make sure I dont touch Enchantments anywhere, because there was an old bit of GT5 Code that removed Enchantments, and it happened to be called during getIcon() of all things, meaning it only wiped Enchantments on the Client Side…

Anyways it is fixed now. ^^

2 Likes

That was fun to debug though, lol. Half the time I spent trying to figure out ‘why’ that code was removing the enchantment data once I field-access-breakpoint figured out that it was wiping it every-single-frame. ^.^;

Technically it would show the enchantments on the first frame after the item got synched from the server to the client, but it would be gone again the next frame, lol. (EDIT1: well if the game happened to tick between the network thread update and a frame update)

EDIT2: Also for note, you can grab and test it yourself @theJ89 by grabbing that latest snapshot/secret version again.

2 Likes

Confirmed fixed in latest snapshot! :+1:
no-enchants-4

2 Likes