Jump to content

Moving the player forward naturally [1.7.10]


southernzax

Recommended Posts

What is a way to move the clients character forward naturally? A way to get the players character to move forward as if the W key was pushed down for say 3 seconds, I am working on this puzzle idea and it's supposed to be able to be used on any server (It's for boredom and just a learning project of mine) -- and I have been trying to solve how to make the character naturally work forward from the mod but I can't seem to get it!

 

I want a sort of puzzle AI which moves the character in a predetermined fashion that the user then the user has to try to follow it, but how do I path the player like that? As in getting the clients character to move different directions, thank you very much for your help it's heavily appreciated!

Link to comment
Share on other sites

Hi

 

You might find this link useful

http://greyminecraftcoder.blogspot.com.au/2013/10/user-input.html

It's a bit dated (1.6.4) but most of it is still the same (apart from the packet names) and it should show you where to look in vanilla.

 

-TGG

 

Hey thank you it helped set me on the right track, except I now appear to be at a standstill, I am not sure if I am doing something wrong but most people seem to be able to walk the character forwards like this: "Minecraft.getMinecraft().gameSettings.keyBindForward.pressed = true;" and just kinda tell it that its true, but my forge setup doesn't seem to find .pressed to even exist! it says this "The field KeyBinding.pressed is not visible" I feel like this is something elementary I am missing but I am not quite sure what..

 

Also thank you sincerely for the help and awesome blog writeup!

Link to comment
Share on other sites

Hi

 

No worries you're welcome :)

 

The vanilla Keybinding.ispressed is private by default.  If you want to make it public, you can use an access transformer.

http://www.minecraftforge.net/wiki/Using_Access_Transformers

 

Actually I had to do exactly the same thing for a mod I'm working on; my speedytoolsmod_at.cfg contains just this single line

public net.minecraft.client.settings.KeyBinding * # All fields

 

After modifying your gradle.build you'll need to run

gradlew clean setupDecompWorkspace eclipse --refresh-dependencies.

 

After that the fields should be public.

 

You can also use Reflection.  It might be easier (or might not) - I've never used it.  The access transformer worked fine for me.

 

-TGG

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.