#Predicting the player's position on the next tick

49 messages · Page 1 of 1 (latest)

fallow loom
#

I've been trying to predict the player's position on the next tick. The Player class seems to control all the movement in the travel method, but the bulk of the movement calculation is in LivingEntity's travel method and Entity's move method. The issue is that these methods don't exactly return the resulting position as a Vec3. They just apply it to the player and return nothing. I really don't want to extract all the calculations and reproduce it on my end since that would require quite a bit of code and access wideners would be needed to even get to some of the variables and methods. Is there any way to calculate this client-side?

lunar anchor
#

you could either make a dummy player at 0 0, and call travel on it and compare its first position with the next, or
do that with your player

fallow loom
#

Wait... I can just do that completely client side?

lunar anchor
#

yep

#

I did so too

#

but you need to be in a world because who wants to make their own dummy world and whatever else a ClientPlayerEntity needs

fallow loom
#

How would I make a dummy player?

lunar anchor
#

var dummy = new ClientPlayerEntity(args)

#

i forgot what args are needed but you should be able to get them from the client

#

What's this for?

fallow loom
#

Auto sneaking on magma blocks

lunar anchor
#

.., you can also just check if you're under a magma block

fallow loom
#

I don't want to take any damage

lunar anchor
#

unless you take damage the first tick yeah

#

but this still seems very overcomplicated

fallow loom
#

ikr xd

lunar anchor
#

also

#

!!cheats

late fractalBOT
#

We do not support hacked clients, cheats, or modifications that are intended to give you the upper hand in a server, competitive or otherwise.
See rule 1 in #welcome and the Discord TOS: https://discordapp.com/terms

fallow loom
#

idk if that's really a cheat though

#

I thought of it as qol

lunar anchor
#

it gives you an advantage

#

I'd say it's fine though

fallow loom
#

The mappings are a little different (ex. LocalPlayer instead of ClientPlayerEntity) but the general premise is the same. It's better than just passing in the original player's block position but it still doesn't sneak in time on occasion. Is there any movement-related thing I'm not passing in?

#

Also, should I be killing these players after making and using them? And if so then how?

lunar anchor
#

or goes up faster than normal

lunar anchor
#

wanna see if its not something with the detecting of a magma block

fallow loom
#

The only thing I'm not showing is the return statement

lunar anchor
#

guh

#

where does it check for a magma block then

fallow loom
#

In the return statement

#

just calls copy.getBlockX, y, z and puts it in a blockpos to get the block of

#

y - 1 *

lunar anchor
#

hmm

fallow loom
#

Maybe there's a 1 tick gap between pressing sneak and sneaking?

#

so 2x copy.aiStep

lunar anchor
#

dont think so

#

then it would never work

#

you can try though

fallow loom
#

that seems to work for some reason lol

#

Idk if it's my prediction or the extra tolerance

lunar anchor
#

probably extra tolerance

fallow loom
#

also looks like it is consuming ram

lunar anchor
#

you sure?

fallow loom
#

nvm lol

#

increased ram was probabally just from logging into a world

#

Thanks for the help! Do I click Close Post to mark this as resolved?