Advertisement
Guest User

Untitled

a guest
May 18th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.81 KB | None | 0 0
  1. @SubscribeEvent
  2.     fun fatigueHandler(e: LivingEvent.LivingUpdateEvent) {
  3.         if (e.entity is EntityPlayer) {
  4.             val player = e.entity as EntityPlayer
  5.             if (!player.world.isRemote)
  6.                 if (fatigueTimer++ == 180) {
  7.                     when {
  8.                         player.isSprinting -> player.getEntityAttribute(PropertiesRegistry.fatigue).baseValue -= TLDConfig.fatigueConsumeOnSprint
  9.                         player.motionX != 0.0 && player.motionY != 0.0 -> player.getEntityAttribute(PropertiesRegistry.fatigue).baseValue -= TLDConfig.fatigueConsumeOnWalk
  10.                         else -> player.getEntityAttribute(PropertiesRegistry.fatigue).baseValue -= TLDConfig.fatigueConsumeOnStand
  11.                     }
  12.                     fatigueTimer = 0
  13.                 }
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement