Jump to content

maikyy

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by maikyy

  1. Thanks, that makes sense now you say that. well ,Time to go and learn how to deal with packets
  2. So you mean where I have: @SubscribeEvent public void OnKeyInput(KeyInputEvent event) { if(!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) { if(Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed()) { if(PlayerHandler.isJumping && !PlayerHandler.isDoubleJumping && PlayerHandler.canDoubleJump) { Minecraft.getMinecraft().thePlayer.setVelocity(0.0F, 0.5F, 0.0F); Minecraft.getMinecraft().thePlayer.fallDistance = 0.0F; PlayerHandler.isDoubleJumping = true; } } } } because if I check for anything to do with the player here It crashes as soon as I jump again. That is basicly how I started it out, at first I had something like this in here: public static boolean isDoubleJumping; EntityPlayer EntityPlayer; EntityPlayer player = EntityPlayer; if(player.onground) { isDoubleJumping = false; } @SubscribeEvent public void OnKeyInput(KeyInputEvent event) { if(!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) { if(Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed()) { if(!player.onground && !isDoubleJumping) { player.setVelocity(0.0F, 0.5F, 0.0F); player.fallDistance = 0.0F; isDoubleJumping = true; } } } } But that just kept throwing errors at me so that's why I do it the other way now because that seemed to kind of work
  3. So when working on my mod I suddenly had the brilliant idea of adding a double jump. so after some work I finally got it in but there is one little problem, i want to reset my fall height as soon as you jump for the second time, now the problem comes in that i don't really know where to exactly call the 'player.falldistance' to start off here is what i got right now. PlayerHandler.class http://pastebin.com/nPr9Lz5D (Don't worry about the 'EntityPlayer player = (EntityPlayer) event.entity;' I already removed it) KeyHandler.class http://pastebin.com/RqXK7PwA And I have these two lines in my main mod class under the init MinecraftForge.EVENT_BUS.register(new PlayerHandler()); FMLCommonHandler.instance().bus().register(new KeyHandler()); And another quick note, right now when I jump the jumpheight is dependend on when I jump if that makes any sense. so when I jump for the first time and Immediatly jump again I can jump 3 blocks high, but when I jump and wait a little I can't even jump 1 block high with my second jump. so there must be something i did horribly wrong obviously needed to SET velocity and not ADD velocity Edit: Oh lol I just found out that I really did mess something up because my minecraft client was running in the background and as soon as another entity jumps my game crashes
×
×
  • Create New...

Important Information

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