Jump to content

[1.15.2] [Solved] How to simulate a space press?


Xing

Recommended Posts

I'm very new to modding(3 days), so i might ask some dopey questions. 

 

My code looks like this: 

if (entityName.equals(playerName)) {
    KeyBinding.onTick(minecraft.gameSettings.keyBindJump.getKey());
    KeyBinding.onTick(minecraft.gameSettings.keyBindDrop.getKey());
}

When the player got hurt, the player jump and drop the item in hand. 

 

The drop works properly, but the jump doesn't want to activate. 

if I do the to string:

System.out.println(minecraft.gameSettings.keyBindDrop.toString());
System.out.println(minecraft.gameSettings.keyBindJump.getKey().toString());

the console seems right to me

net.minecraft.client.settings.KeyBinding@4a4ef86a
key.keyboard.space

 

 

Minecraft version 1.15.2

Forge version: forge-1.15.2-31.2.0-mdk 

Edited by Xing
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.