#[SOLVED] How to set entity Velocity?

17 messages ยท Page 1 of 1 (latest)

wary prairie
#

Hi there!

I'm currently following some Tutorials to get me started in Modding for Minecraft 1.21.3. Problem is, all the Tutorials are 1.21.1 only. I've come so far, but now I hit a Roadblock.

I want to make a "Slimey" effect, that lets you climb Walls. I registered the effect and everything, and the "applyUpdateEffect" Method gets called, but i just can't get the Logic working. My Idea is to set the Player Velocity, but this does not appear to work.

If anyone could help me, it would be very nice! ๐Ÿ™‚

brazen schooner
#

have you looked at how spiders do it?

wary prairie
#

Yes, but i can't find anything usefull there, it just sets some Flag to a value, and i cant trace it further.

sharp night
#

From the looks of it that applyUpdateEffect method gets called on the server. I think you have to do entity.velocityDirty = true right after calling setVelocity

wary prairie
#

Well unfortunately this doesn't work either.

charred scroll
#

Send a velocity update packet. Let me grab the exact name rq @wary prairie

#

EntityVelocityUpdateS2CPacket

wary prairie
#

How would i send that packet, like call something in the method or what?

charred scroll
#

I think you just need to send it for players, right? Here's a line from one of my mods.
player.networkHandler.sendPacket(new EntityVelocityUpdateS2CPacket(player)); // Thanks @Wesley1808#9858 :)

wary prairie
#

Okay, thank you. I will look into that tomorrow ๐Ÿ™‚

coral field
#

player velocity is handled clientside, exclusively

#

personally i would just find where it checks if the block is climbable based on the tag and always return true. LivingEntity.travel does the horizontal collision check and checks if they are climbing

brazen schooner
#

that doesn't work for full blocks iirc

#

last time i added every block to the climbable tag it only worked for non fully cuboid blocks

coral field
#

i did point to the code that handles the collision instead of the code that checks the tag

wary prairie