#64 bit "Time" stat

175 messages · Page 1 of 1 (latest)

void kayak
#

This is a very niche problem but a few people I know and myself are about to hit the 32 bit int limit of playtime and some of the other "time" stats and rather than going into our stats and setting them back down to 0 so we can keep track of our playtime it would be a lot easier to have a mod to just let the number count higher. Not sure how simple or hard making a mod to do that would be though

#

also, I am in 1.17.1 if that makes any difference 😅

fluid magnet
#

At a glance, it looks like it's pretty solidly an integer. A hacky fix wouldn't been too difficult - add another stat for "Time Played Overflow"

#

Oh that's a while back

#

Though stats are not really a thing that I've heard of being touched that often

void kayak
#

I mean the most preferable option would just to have the same stat continue to count up, I think another issue might arise when changing versions if it would reset down to the normal 32 bit int limit again

#

*updating versions

#

it is def a very very niche problem

fluid magnet
#

If you want, I can try a more technical explaination of what it would require

void kayak
#

sure, thought I'm not a coder so I might not understand it all

#

I know that the "time" stats are counted in ticks

#

if it was possible to convert ticks to seconds then start storing that data it would be more than enough

#

but I assume that would add some loss if you were in the middle of a second, unless you kept the tick you disconnected at stored somewhere

fluid magnet
#

That's clever, and might be more doable

fluid magnet
void kayak
#

yeahh

#

I mean it might go something like second = tick x 20 and then tick is just stored somewhere

#

because the ticks are always counted and stored into the time played

fluid magnet
#

Basically, programs remember stuff while they're running in a variable.
Java likes to know what type of stuff is stored in a variable - even before you run the program.
Changing it from an int (to a long, for example) would mean changing all the types involved for lots of different things, all while the game is running.

#

But I just got an idea

#

I might be able to finagle it to last for 14610000000 years

void kayak
#

that might just barley be enough tbh

#

🤣

fluid magnet
#

Java uses signed integers - postive and negative numbers. That means about half the possible numbers are negative.

#

What If I just stole those xd

void kayak
#

wouldn't that just double the normal int limit?

fluid magnet
#

Let's do an analogy - Say you've got a display that can show you numbers. It can only show you one number. That means 10 different numbers - 0-9

#

Then, you double the number of digits it can hold

#

100 different numbers - 00 - 99

void kayak
#

so it would be like a magnitude more essentially

fluid magnet
#

We're doing the same thing, but with 2 digits instead of 10

fluid magnet
#

Many binary orders of magnitude

#

For about 6x

#

Let me do some more research

void kayak
#

I think 14.6 billion years might be enough time then

#

they'll release earth 2 before I run out of time

fluid magnet
#

Oh it's actually a 32-bit limit. So going from 40.86 months to 81.72 months

#

Still, that's decent

void kayak
#

yeah so it doubles

#

from ~3.42 years to ~6.84 years

fluid magnet
#

Oh yeah 🤦‍♂️

#

We're only getting one more digit, the sign

#

And in binary, that means 0 or 1

#

which doubles it

void kayak
#

I mean it would give me another 3.5 years to figure out a solution lmfao

#

rn I have ~130 days before I hit the limit

#

and one of my friends already hit it

fluid magnet
#

I'm getting the source code for 1.17.1 rn, hopefully it's not too different from 1.21.5 in the stats department

void kayak
#

I assume it would be exactly the same other than a few new stats added for new stuff

fluid magnet
#

That's the hope. You'd be surprised though, things change a lot.

void kayak
fluid magnet
#

1.20.4 -> 1.20.5 broke basically everything

#

Hallelujah

#

It looks like it'll work

void kayak
fluid magnet
#

Gimme a while, I'll ping you if there's news

void kayak
#

<3

vapid stag
obtuse wolf
#

I don't think you can change it to be a long instead of an int, but you could create a different variable that is a long and mixin into all usages of that int to use your own variable instead

fluid magnet
vapid stag
#

ok yeah that makes sense I should probably get more sleep lol

amber marsh
#

I did make a mod like this a while back on the ornithe toolxhain using fabric for 1.12 I won't have time to port soon, but maybe in 3 or 4 weeks. I always wanted to port it to more versions. It has 64bit scoreboards and stats, it displays them in-game and still allow vanilla clients to connect to the server (they see the downcasted value, modded client is required to see the 64bit value). I haven't had time to release but I can make the code public tomorrow when I am at my pc if someone else is interested in porting before I find the time to port it

void kayak
#

so it just lets the stats in the stats screen count higher?

#

or is it a seperate scoreboard?

amber marsh
#

It makes the stats in the screen 64bit instead of 32bit

void kayak
#

I mean that's pretty much exactly what I need lmao

#

make number go higher

amber marsh
#

Yes but it is for 1.12 so requires porting dunno how much the relevant code changed. The same tricks and techniques I applied will probably still be useful to make the mod in 1.17, sadly I have to finish my thesis so no time for next 3 weeks or so

void kayak
#

I have ~130 days till I reach max and since I'm in 2nd place for time played WR I think it's enough time

#

Aitor already hit it but he can probs just re-edit his stats back if he wants to play with the mod

amber marsh
#

Well I am good at procrastinating so if you don't remind me, I might end up forgetting/procrastinating lol

amber marsh
void kayak
#

oh I have been out of elytra stat for ~5ish years now lmao

#

it wouldn't be counted for a record but it would be cool to see it go back up

#

I guess a question I have is, if I were to use the mod and get higher than normal stats then remove the mod what would happen?

#

would it just go back to the int limit or would it reset or go negative?

amber marsh
#

I am honestly not sure, either the game refuses to load the world bc the storage format lf the world will be slightly different bc of 32 vs 64bit (I think this most likely)
If you want to go back you probably have to run a script to downcast the values (before using the mod you need to run a script that converts the world too, dunno how hard this to integrate into he mod with datafixer)

void kayak
#

are the values stored in the normal stats file?

amber marsh
#

Yes that file gets changed

void kayak
#

well I'm very excited to see stats that haven't changed in over 5 years finally go up :D

#

soon™

void kayak
#

send in the MMM discord

#

most "legit" screenshot

plucky kettle
#

I can’t tell if anyone already agreed to make the mod but I can take a look at implementing this!

void kayak
#

pretty sure dragon already made the mod for 1.12 but has yet to port it to newer versions

fluid magnet
#

At least kind of

#

I'm making it use all of int, not migrating to a long

plucky kettle
#

Honestly might yoink the feature for my utility mod

fluid magnet
#

The way I'm doing it at least

#

It would fail to load if it was converted to a long

void kayak
#

I'm just worried about updating to a newer version and something going wrong, though I do always make backups beforehand obv

#

I assume it'll all be fine but u can never be too careful lmao

fluid magnet
#

Fair. I don't know how it would handle it, but unless stats change, it should be fine (assuming the mod is present on the new version too)

plucky kettle
#

My guess (even though I don’t have any code) is that it would roll into the negatives, which if you have the infrastructure for, can be recovered into their correct values.

fluid magnet
#

Yep, as long as the codecs are OK with it

void kayak
#

I wonder if I would have maxed out the 64 bit int limit of elyra yet

#

nevermind I just realized how much bigger the 64 int is than the 32 bit lmfao

fluid magnet
#

Got an approximate flying speed for me?

void kayak
#

well I maxed it out within the first year of playing

fluid magnet
#

I mean like m/s or blocks/second

void kayak
#

and just in the past 4 months I've used ~2 years worth of rockets

void kayak
#

on avg I think flying speed is like 50 bps

#

actually 50 is on the high end

#

I'd say 40-45 is more avg

fluid magnet
#

At 50 bps,

#

click to reveal the spoiler!

void kayak
#

hmm, so what ur saying is I'd be close

#

3 years is pretty close to 7.5 million years imo

fluid magnet
#

Very tiny_potato

fluid magnet
#

I love wolfram alpha

void kayak
#

I don't think elytra distance is counted in meters tho

#

I think it's in cm

fluid magnet
#

Nope

#

FLY_ONE_CM is the internal name

void kayak
#

yeah cm?

fluid magnet
#

Oh yeah

#

Misread

#

but yeah I calculated that

void kayak
#

ah

fluid magnet
#

Or rather wolfram did

void kayak
#

cuz 58.5 mil / 100 is totally more attainable than just 58.5 mil years

#

next goal is 64 bit int of cake eaten

fluid magnet
#

Fun!

fluid magnet
#

@void kayak I'm done! Jar is attached - no Fabric API required, but it does need Loader 0.17.0+. Technically would work server-side, but clients would see negative numbers for stats I think, so put it client-side too. I can make a repo on GitHub if you want proof that the jar was compiled from the sources I published.
@plucky kettle Sources at https://codeberg.org/skycatminepokie/stat-extender, you don't need to credit or include the MIT license.

amber marsh
void kayak
amber marsh
#

No, I will have some time from Friday onwards so then I can start porting

fluid magnet
#

Well, it's a signed int and in ticks, so it's not bad.

vocal hedge
#

I mean the 3 years in a single Minecraft world

void kayak
odd bone
#

these stats are insane

#

and why have you not slept in forever

amber marsh
# void kayak any updates on this?

Not much yet, getting slowly into it, explored the 17 code a bit to see what is different
Needed some time to touch some grass after being locked in for so long on masterthesis 😅

amber marsh
#

Porting this is a vibe, started on 101 errors, still on 101 errors after fixing several files 😅

amber marsh
#

well it is going quit okay, I am ignoring scoreboards for now and focussing on stats. Mainly have the GUI stuff left and making sure everything works

amber marsh
void kayak
#

I don't use any scoreboard mods

amber marsh
#

good, I will leave the scoreboards for what it is then, I don't play this version so I won't put effort into it if nobody needs it

#

gotta need to do some serious debugging, it fails to generate a world lmao

void kayak
amber marsh
#

great

#

datapacks

#

oman

fluid magnet
#

Heck the datapacks xd

amber marsh
#

This is something I didn't have to care for in 1.12 and fixing the stat interaction with datapacks will be a nightmare

fluid magnet
#

Don't they have to use scoreboards?

#

If you can just make it look like it's vanilla for datapacks, no damage done

amber marsh
#

They seem to exist for both scoreboard and stat?

fluid magnet
#

What do they have to access stats directly?

amber marsh
#

well I probs gonna down cast to int for now and see if the rest works

fluid magnet
amber marsh
#

idk, I have no clue what datapacks are or what they do, but wiki says you can test on the player statistics
can see if the value for a certain stat is within a range

fluid magnet
amber marsh
#
StatHandler statHandler = serverPlayerEntity.getStatHandler();

            for (Entry<Stat<?>, NumberRange.IntRange> entry : this.stats.entrySet()) {
                int i = statHandler.getStat((Stat<?>)entry.getKey());
                if (!((NumberRange.IntRange)entry.getValue()).test(i)) {
                    return false;
                }
            }

You have this check in test function in PlayerPredicate and wiki metions it too https://minecraft.wiki/w/Predicate

Minecraft Wiki

Predicates are JSON structures found in multiple different locations within data packs. They are invoked with various means to check conditions within the world. They return a pass or fail result to the invoker, who acts differently based on this result.
Predicate files are standalone data pack files that contain one or more predicates. Predicat...

#

something funny going on

amber marsh
#

gaming

amber marsh
#

everything seems to work correctly