Posted March 31, 20205 yr 1.15.2 As the title states ^ Any help would be greatly appreciated, this is my first mod! I currently have it set to a keypress, here's my code: public class DodgeEvent { @SubscribeEvent public void onKeyInput(KeyInputEvent event) { if (Keybinds.dodge.isPressed()) { PlayerEntity player = Minecraft.getInstance().player; /* Things I'm messing around with: float rotation = player.cameraYaw; Vec3d look = player.getLookVec(); System.out.println(rotation + "and" + look.x + "" + look.y); player.addVelocity(look.x, 0, look.y); */ } } } I have a feeling it has something to do with player.moveForward and player.moveStrafe although I can't find any recent documentation on this. Thank you in advance for your help! I'm completely lost! Edited March 31, 20205 yr by ultra_reemun Grammar
March 31, 20205 yr 55 minutes ago, ultra_reemun said: Any help would be greatly appreciated, this is my first mod! This is a little more complicated than what you have tried. When the key is pressed down you will need to send a packet to the server. The packet will say hey this player has pressed this button. The server will verify any other conditions then proceed with the appropriate response. In your case it will change the velocity of the player. Now Minecraft uses xVel, yVel, and zVel so you likely need to use trig depending on exactly what you want to do. PlayerEntity::moveForward and PlayerEntity::moveStrafe are from what I can tell multipliers on the actual motion values. And any change you do to them will be imperceptible because they are changed immediately before the entity moves. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 1, 20205 yr Author 8 hours ago, Animefan8888 said: This is a little more complicated than what you have tried. When the key is pressed down you will need to send a packet to the server. The packet will say hey this player has pressed this button. The server will verify any other conditions then proceed with the appropriate response. In your case it will change the velocity of the player. Now Minecraft uses xVel, yVel, and zVel so you likely need to use trig depending on exactly what you want to do. PlayerEntity::moveForward and PlayerEntity::moveStrafe are from what I can tell multipliers on the actual motion values. And any change you do to them will be imperceptible because they are changed immediately before the entity moves. Thank you! That's really helped. I've managed to use the code from a snowball to get me started, although I'm still not too experienced in sending packets so I'll look into that now.
April 1, 20205 yr Hi This example project might be of some help with custom packets (see mbe60) https://github.com/TheGreyGhost/MinecraftByExample -TGG
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.