Skip to content

Instantly share code, notes, and snippets.

@System-Glitch
Last active March 2, 2016 21:10
Show Gist options
  • Save System-Glitch/d7f08c0cf5645d2ef923 to your computer and use it in GitHub Desktop.
Save System-Glitch/d7f08c0cf5645d2ef923 to your computer and use it in GitHub Desktop.
//This code allows you to know if the player is critical hitting
//This has to be used in EntityDamageByEntityEvent
//"p" is the Player variable
boolean crit = ((CraftPlayer) p).getHandle().fallDistance > 0.0F && !((CraftPlayer) p).getHandle().onGround && !((CraftPlayer) p).getHandle().n_() && !((CraftPlayer) p).getHandle().isInWater() && !((CraftPlayer) p).getHandle().hasEffect(MobEffects.BLINDNESS) && !((CraftPlayer) p).getHandle().isPassenger();
crit = crit && !((CraftPlayer) p).getHandle().isSprinting();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment