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