Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- fun fatigueHandler(e: LivingEvent.LivingUpdateEvent) {
- if (e.entity is EntityPlayer) {
- val player = e.entity as EntityPlayer
- if (!player.world.isRemote)
- if (fatigueTimer++ == 180) {
- when {
- player.isSprinting -> player.getEntityAttribute(PropertiesRegistry.fatigue).baseValue -= TLDConfig.fatigueConsumeOnSprint
- player.motionX != 0.0 && player.motionY != 0.0 -> player.getEntityAttribute(PropertiesRegistry.fatigue).baseValue -= TLDConfig.fatigueConsumeOnWalk
- else -> player.getEntityAttribute(PropertiesRegistry.fatigue).baseValue -= TLDConfig.fatigueConsumeOnStand
- }
- fatigueTimer = 0
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement