Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.maikyy.endgamepp.util;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
- import net.minecraftforge.event.entity.living.LivingFallEvent;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- public class PlayerHandler
- {
- //Check to see if the player has jumped
- public static boolean isJumping = false;
- //Check to see if the player has jumped a second time
- public static boolean isDoubleJumping = false;
- //Check to see if the player is able to double jump, will be dependend on items later but for now I just want the mechanics working.
- public static boolean canDoubleJump = true;
- //Check if the player is jumping, if so set the isJumping to true
- @SubscribeEvent()
- public void onEvent(LivingJumpEvent event)
- {
- EntityPlayer player = (EntityPlayer) event.entity;
- if(event.entity instanceof EntityPlayer)
- {
- isJumping = true;
- }
- }
- //Check if the player has landed, if so set the isJumping AND isDoubleJumping to false
- @SubscribeEvent()
- public void onEvent(LivingFallEvent event)
- {
- if(event.entity instanceof EntityPlayer)
- {
- isJumping = false;
- isDoubleJumping = false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment