Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Do actions when jumping
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Vazelek

Do actions when jumping

By Vazelek, March 25, 2020 in Modder Support

  • Start new topic

Recommended Posts

Vazelek    0

Vazelek

Vazelek    0

  • Tree Puncher
  • Vazelek
  • Members
  • 0
  • 1 post
Posted March 25, 2020

Hey,
I am trying to learn how to mod forge 1.12.2 and I would like to succeed in detecting and doing an action when the player jumps. For this I use the LivingJumpEvent event but I'm not sure how it works. I tried to make it display a message, but this code does not work. Maybe something is missing or there is an error.
My code:

@SubscribeEvent
	public void jumpEvent(LivingJumpEvent e) {
		if(e.getEntity() instanceof EntityPlayer) {
			EntityPlayer player = (EntityPlayer) e.getEntity();
			player.sendMessage(new TextComponentString("hi"));
		}
	}


Thanks for your help

Share this post


Link to post
Share on other sites

diesieben07    7597

diesieben07

diesieben07    7597

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7597
  • 55122 posts
Posted March 25, 2020

1.12 is no longer supported on this forum.

Please update to a modern version of Minecraft to receive support.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Gubipe
      Minecraft.getMinecraft().thePlayer.swingItem(); wont attack

      By Gubipe · Posted 2 minutes ago

      I am using Minecraft.getMinecraft().thePlayer.swingItem(); and I want it to to hit players and mobs and not just swing. Right now it will swing, but it wont actually attack/damage a player or mob
    • Draco18s
      [1.16.4] License Issue..

      By Draco18s · Posted 21 minutes ago

      Seems pretty self explanatory to me.
    • BIGDog8808
      HELP! WORLD WONT WORK

      By BIGDog8808 · Posted 1 hour ago

      https://drive.google.com/drive/folders/1lIZLDI40nI-DyAqA2PUu5TP3va3Tfb2v?usp=sharing here is the link
    • DaemonUmbra
      HELP! WORLD WONT WORK

      By DaemonUmbra · Posted 1 hour ago

      Send it via google drive I guess
    • LK1905
      [1.16.4] How do I correctly sync capability data between Client and server?

      By LK1905 · Posted 1 hour ago

      Okay, I believe I've done what you have told me, and my gui does update me gaining xp.   However, theres something wrong with my sync method, as whenever it is called, it resets all xp values to zero. So the values in my gui are lost when reloading the world.   Heres the sync method in my Skills class: @Override public void sync(ServerPlayerEntity player) { if(entity instanceof ServerPlayerEntity) { PacketHandler.sendTo(new SkillsPacket(serializeNBT()), player); } }   Heres my attempt at syncing on login, in my player event handler: @SubscribeEvent public static void onPlayerConnect(PlayerLoggedInEvent event) { ServerPlayerEntity player = (ServerPlayerEntity) event.getPlayer(); if(!player.world.isRemote) { player.getCapability(SkillCapability.SKILL_CAP).ifPresent(c -> c.sync(player)); } }   Updated my git repo, here.
  • Topics

    • Gubipe
      0
      Minecraft.getMinecraft().thePlayer.swingItem(); wont attack

      By Gubipe
      Started 2 minutes ago

    • TurtlesAreHot
      2
      [1.16.4] License Issue..

      By TurtlesAreHot
      Started 1 hour ago

    • BIGDog8808
      8
      HELP! WORLD WONT WORK

      By BIGDog8808
      Started 4 hours ago

    • LK1905
      25
      [1.16.4] How do I correctly sync capability data between Client and server?

      By LK1905
      Started December 31, 2020

    • Rhayzan
      0
      [SOLVED] Dependency Failure

      By Rhayzan
      Started 1 hour ago

  • Who's Online (See full list)

    • TurtlesAreHot
    • Gubipe
    • REEEEKID4909
    • TheidenHD
    • AwesomeTy79
    • Draco18s
    • Quaint34
    • Cutewarriorlover
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Do actions when jumping
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community