Darkhax-Minecraft / Tips

Adds tips to loading screens of Minecraft.
GNU Lesser General Public License v2.1
50 stars 47 forks source link

[Suggestion] Add the ability to disable tips for certain screens #137

Closed lumiscosity closed 8 months ago

lumiscosity commented 1 year ago

See title.

Sentinaut commented 8 months ago

I was just about to comment this suggestion, I would love to have tips only on the loading screens and not pause screens

Darkhax commented 8 months ago

This is a pretty complicated feature to add as screens do not have unique names or identifiers that users can reliably target. Mods with similar features use the class name of the screen but these are not consistent across mod loaders which can be confusing. They are also not visible to players or well documented. I've tried my best to implement this on 1.20.4 but plan to do this better when Mojang finally adds screen IDs.

To use this feature, you need to add the canonical name of the class to the ignoredScreens section of the config file. The canonical name for your modloader and environment will be printed to the log when tips entries are loaded. It will also show if the entry has been disabled by your config file. You can get this for 1.20.4 in version 15.0.4.

Example

NOTE: The screen names here are from development. While there may be some overlap you should always check the names for yourself by looking at your log file. Do not blindly trust these screen names.

tips.json

{
  "defaultCycleTime": 5000,
  "ignoredNamespaces": [],
  "ignoredTips": [],
  "ignoredScreens": [
    "net.minecraft.client.gui.screens.DeathScreen",
    "net.minecraft.client.gui.screens.PauseScreen"
  ]
}

latest.log

[19:31:36] [Render thread/INFO] [Tips/]: Loaded 81 tips. Took 4.4692ms.
[19:31:36] [Render thread/INFO] [Tips/]: The following screens have been registered to the tips mod.
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.DisconnectedScreen' Enabled: 'true'
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.LevelLoadingScreen' Enabled: 'true'
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.PauseScreen' Enabled: 'false'
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.ConnectScreen' Enabled: 'true'
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.ProgressScreen' Enabled: 'true'
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.DeathScreen' Enabled: 'false'
[19:31:36] [Render thread/INFO] [Tips/]: Screen: 'net.minecraft.client.gui.screens.GenericDirtMessageScreen' Enabled: 'true'
ToppyTopology commented 8 months ago

hello sorry if I asked but will these 1.20.4 changes be backported to 1.20.1?