#API and Chat Editing

114 messages · Page 1 of 1 (latest)

gusty cove
#

How do I take information from a github repository?? I need it so I can change certain things about my mod without having to recompile it every time for every single version.

#

API and Chat Editing

craggy breach
#

Wdym take information from a Github repo?

gusty cove
#

Also something else is that I want to know how to edit chat messages sent by other people, obviously this would not be visible by anyone else but it'd be useful

gusty cove
#

takes text

#

and turns it into code

#

its an array that gets implemented whenever you launch the mod

wild geyser
#

you know code needs to be compiled right?

gusty cove
#

yeah

#

but

#

listen

#

It looks at the API

gusty cove
#

and takes information from there

wild geyser
#

and what is this information exactly?

gusty cove
#

Its an array

craggy breach
#

What do you want exactly?

#

And why

wild geyser
#

and what is this array used for?

gusty cove
#

its for a chat replacement system that I want to be able to change easily without editing the code

#

I've done a similar thing before just not in java so im hoping its possible but if its not then thats sad

wild geyser
#

okay can you show that?

craggy breach
#

So you want an array somewhere so you can change variables in your mod without having to recompile every time?

#

Sounds like a config file

wild geyser
#

so basically a config

craggy breach
#

Check out malilib or cloth config (I recommend the latter)

wild geyser
#

you can't use a library for this if you're pulling the config outside of the game

gusty cove
#

it was a rhythm game

craggy breach
#

What the fuck

gusty cove
#

and that shows the timing for when each beat was

craggy breach
#

Okay uhh

#

This is json right?

gusty cove
#

uhh idk

#

i think its a txt file

#

yeah its txt

craggy breach
#

Okay it is

#

It is json

#

It's json parsable

gusty cove
#

its txt though

craggy breach
gusty cove
#

The file is literally txt

craggy breach
#

Doesn't matter

#

Then I'd get the text from github, put it in a string and use gson or Jackson or something to parse it

gusty cove
#

how?

craggy breach
#

Uh idk

gusty cove
#

thats what Im asking

#

oh

#

ok

wild geyser
#

you don't need to use the github api, you can make a raw content url and use that

gusty cove
#

how??

wild geyser
#

what do you want me to provide?

gusty cove
#

I just dont know how to get information from an API, thats all I need

craggy breach
#

Dicedpixels just said you dont need one

wild geyser
#

you don't need the api, raw urls are static

gusty cove
#

what is that though?

#

and how can I change it later?

craggy breach
#

You ever have a big text file on github and it says "too big, view raw"?

#

Yeah that view raw link is the raw content url

gusty cove
#

nope it was on an mp3 file

wild geyser
#

huh

craggy breach
gusty cove
#

uhh okay, how do i get to that?

#

when its not big

wild geyser
#

raw urls don't change, you can change the file content and the url will still point you the same file

craggy breach
gusty cove
#

how do I do that though, I dont normally use APIs

craggy breach
#

User and repo probably stay the same for you

gusty cove
#

oh yeah the URL, I understand now but like, how do I read from that inside the code?

wild geyser
#

yes

gusty cove
#

bearly

craggy breach
#

For example:
in your mod, you do String s = getData("https://rawcontent.github.com/kr1viah/MCmath/gradle.properties"), then, if its a valid url and getData exists (it probably does but idk it, google what it should be) in your string s you'll have the grade.properties of my mod's source code

wild geyser
gusty cove
#

I'm trying to learn it

wild geyser
#

this is not even minecraft modding at this point, it's intermediate level java

#

yes, learn first, then you'll understand what we're saying

gusty cove
#

Thats how I learnt python, I just made stuff until I knew it

craggy breach
#

Well I barely know java too I just know how to program ;)

wild geyser
gusty cove
#

same

gusty cove
craggy breach
gusty cove
#

nothing complex

craggy breach
#

But anyways

gusty cove
#

anyway yeah that sounds about right i'll try it

wild geyser
#

(if you know programming, you won't be asking this question to begin with)

#

this is basically reading content from a URL

gusty cove
craggy breach
craggy breach
gusty cove
#

oh that doesnt count as an API?

#

well...

#

I didnt know that

craggy breach
#

We told you

craggy breach
wild geyser
#

it would be the exact same if it was an API TE_Shrug

craggy breach
#

Pretty much yeah

#

Maybe you need authentication but still it's reading URLs

wild geyser
#

yes

gusty cove
#

Application programming interface sounds like what i'm dealing with

#

so

craggy breach
#

Who cares what it's called you have a solution now

gusty cove
#

is there settings I have to change because getData doesnt work, do I need to import something?

wild geyser
#

what

craggy breach
#

Read

gusty cove
#

getData is not a real thing

craggy breach
#

Again, read

#

It probably does but idk it google what it should be

gusty cove
#

what am I misssing?

#

oh ok

wild geyser
#

it's.. pseudo code...