game-design-driven / Create-Prepare-to-Dye

Create: Prepare to Dye an opinionated, minimalistic modpack centered around complex and interesting automation.
GNU General Public License v3.0
25 stars 19 forks source link

Extract settings with java mod #466

Open Discord-Github-Bridge opened 9 months ago

Discord-Github-Bridge commented 9 months ago

minecraft.getMinecraft().gamesettings as a variable that can be accessed in kubejs (even write to a file and read with kubejs)

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

now i can create functions in java and expose them to kubejs like so console.log(Ptdye.ptdyeUtils.isWorking());

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

returns true

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

Ptdye is like a global instance

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

engineersmith_4628 so i found where keybinds are stored

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

its options.txt in minecraft root directory

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

now need to find a way to get this file in java, cant find a function for it

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

found a way

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

ptdyeplus-1.2.2forge-1.19.2.jar

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

use that jar

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

and you can use function Ptdye.utils.getOptions() and itll return a string of all the options

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

its not formatted very well ill make it json

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

but it works

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

You'll have to probejs dump and restart vscode

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

Great job!

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

Awesome

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

https://tenor.com/view/pony-my-little-pony-mlp-apple-bloom-friendship-is-magic-gif-16587279

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

i just thought of something

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

im not sure which options.txt its getting

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

is it getting the one on the server

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

Depends on where the script that's loading the class

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

If you put it on client scripts like the ponders it should be fine

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

Minor problem - the actual ponder code only runs at reload <:betsy:1175697772880609320>

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

I guess I could look into hacking the lang file instead hmm

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

anything i can help with?

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

I'm going to research more in what I can do first - I'll hit you up if I can't find a solution that I can do on my own

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

ok

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

what are you trying to do?

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

oh your trying to get the keybind in the ponder

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

shouldnt it work like ponder code runs at reload -> get keybinds function -> set keybinds in ponder text

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

but it's client code that doesnt make sense

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

wtf

Discord-Github-Bridge commented 9 months ago

yarden.zamir on Discord says

reload is not meant for client

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

It's because ponder is ran - and "cached"

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

so the scene is "pre-rendered" of sorts

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

which allows the reversing and time skipping

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

the function basically just writes the scene - and then the scene is replayed as it was first ran

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

ah

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

and my function doesnt work in that context?

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

It works in the sense, it grabs it on the first run of the function. But then it is set in stone what it played until a reload re-runs the function

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

You mean with /kubejs reload client_scripts ? that's what I run

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

oh

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

can you do like a translation?

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

so whatever is set in stone is the translation key

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

and then do some fancy stuff with the translation file

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

the set in stone thing still applies i bet

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

Yeah that was what I was thinking - merging two translation keys e.g. command = Press %s Text.translate(command, Text.translate("perass.key"))

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

but

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

translations are even more awful with ponder

Discord-Github-Bridge commented 9 months ago

engineersmith_4628 on Discord says

they are auto generated.

Discord-Github-Bridge commented 9 months ago

kikis2111 on Discord says

perass key lmao