/config/sandwichable.json has a config called infoTooltipKeyBind which can be either SHIFT, CTRL, or ALT, which falls in line with KubeJS item tooltips' keys. I'd like to be able to make an if statement that can essentially reference back to this config and/or a default tooltip from Sandwichable to check for which key is enabled in the sandwichable.json config file and subsequently base which key the script checks for on that. (The third attached image is where I am with things at the current moment; a static tooltip. The fourth is an example of the tooltips from Sandwichable in-game.)
#Reference config from another mod?
40 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
you can use JsonIO to read/write the file if you know the path
Here's a simple snippet showing how to use JsonIO to read/write JSON files anywhere within the Minecraft folder:
// Reading the contents of the file from the given path
let config = JsonIO.read('kubejs/config/myawesomeconfig.json')
// Writing to an existing/new file
JsonIO.write('kubejs/config/myawesomeconfig.json', {settings: 'creeper', weirdblock: 'minecraft:end_gateway'})
Is there any way to use this to simply read a specific value rather than writing to it?
(Script attached below.)
Paste version of hamsammie_detect_info_key.js from @quick mantle
To clarify, I don't have very much scripting knowledge. I don't let myself be spoonfed, however. I might ask ChatGPT for assistance on certain sections, but I do also write my own code and correct theirs. The section from lines 13 to 25 was majorly written by them. Everything else was me or the Wiki.
I'd imagine this is likely fine since I'm not using their code in full, but if this is still a breach of rule 6, I will take it down. My main reason for even seeking help from there to begin with is because I've had questions in the past go unanswered for months, both here and in other servers which use forums for assistance.
Ironically, the one thing forums were meant to help make better actually gets worse when using forums. This is why I heavily respect servers which have a quick support channel for people who don't want to wait 9 months for an answer.
what do you mean "writing to it"?
// Writing to an existing/new file
JsonIO.write('kubejs/config/myawesomeconfig.json', {settings: 'creeper', weirdblock: 'minecraft:end_gateway'})
if you don't want to write, just don't add that line
My issue is needing to find a specific config value. I don't know how.
[16:44:22] [INFO] hamsammie_detect_info_key.js#11: undefined
[16:58:48] [INFO] hamsammie_detect_info_key.js#11: {showInfoTooltips=true, infoTooltipKeyBind=SHIFT, slowEatingLargeSandwiches=false, baseSandwichEatTime=32, itemOptions={knives=[{itemId=sandwichable:stone_kitchen_knife, value=1, sharpness=132}, {itemId=sandwichable:kitchen_knife, value=3, sharpness=850}, {itemId=sandwichable:golden_kitchen_knife, value=5, sharpness=225}, {itemId=sandwichable:diamond_kitchen_knife, value=8, sharpness=1025}, {itemId=sandwichable:netherite_kitchen_knife, value=20, sharpness=1984}, {itemId=sandwichable:glass_kitchen_knife, value=1, sharpness=0}], saltItem=sandwichable:salt, cucumberItem=sandwichable:cucumber, pickledCucumberItem=sandwichable:pickled_cucumber, burntFoodItem=sandwichable:burnt_food, burntMorselItem=sandwichable:burnt_morsel}, saltySandGenOptions={saltySand=true}, shrubGenOptions={spawnTries=10}, saltPoolGenOptions={saltPools=true, drySaltPools=true}} [java.util.LinkedHashMap]
... is this a case of cAsE sEnSiTiVe naming?
it's spelled right later on but not there, oops
propably
yup, case sensitive stuff.
Okay, so now the issue is...
... Hold $==={key}=== for info.
It should say SHIFT instead of $==={key}===.
Try this
Hold ${key} for info
Why does the example on the wiki say this if that's the case?
ItemEvents.tooltip(event => {
// ...
// Show the name of the player who owns the skull in a skulls tooltip
event.addAdvanced('minecraft:player_head', (item, advanced, text) => {
let playerName = item.nbt?.SkullOwner?.Name
if (playerName) {
text.add(Text.red(`The head of $==={playerName}===`))
}
})
// ...
})
You were right and the wiki is outdated, lol
Yeah, some of the wiki is outdated but most are still helpful.
Is everything fine now?
Seems like it. I'll need to check one more time though.
Good. You can ping me if you find other issues, or close the ticket if everything works properly.
Can do. 👍
... Hmm... It exists twice now.
I stand corrected. It seems to have been a load error. Reloading client scripts in-game fixed the duplicate.
Gonna close and re-open the game and see if it occurs again. If it does, I'll provide a client log. If it doesn't, I'll cycle my game one more time, just to be certain, but it may already be good.
Yup, duplicated again. All tooltips provided by the client are.
Gonna provide all three logs for this since some textures aren't loading when they should be either, namely my custom textures for the items piercingpaxels:upgrade_unbreakable and piercingpaxels:upgrade_restoration.
Paste version of client.log, server.log, startup.log from @quick mantle
@thin lark Silent ping in case you're already watching the chat - sorry if that's the case.
don't worry. Let me check the script and the log
If you need me to provide any other scripts based on what's shown, let me know. Some of my scripts are for a private modpack and should probably be provided via DM. (The sandwichable addon is technically one of them, but I imagine deleting the attached file will remove it from where the view link is later on, and it's also less serious of a thing to release than some of the others.)
I couldn't replicate the issue and have no clue how this happens for now. I might need to know what operation you conducted before the issue emerges
Permission to DM?