From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: kidofcubes Date: Fri, 8 Nov 2024 00:22:44 +0800 Subject: [PATCH] Lithium: Skip unnecessary calculations if player is not flying or swing This patch is based on the following mixins: * "net/caffeinemc/mods/lithium/mixin/entity/fast_elytra_check/LivingEntityMixin.java" * "net/caffeinemc/mods/lithium/mixin/entity/fast_hand_swing/LivingEntityMixin.java" By: 2No2Name <2No2Name@web.de> As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index a2b40565395921ad293068829355275b4655cf54..9de85972ba32fd2373f70f708aa1bfc6067e6e1c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2768,6 +2768,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } protected void updateSwingTime() { + if (!this.swinging && this.swingTime == 0) return; // Leaf - Lithium - entity.fast_hand_swing int i = this.getCurrentSwingDuration(); if (this.swinging) { @@ -3746,6 +3747,7 @@ public abstract class LivingEntity extends Entity implements Attackable { } private void updateFallFlying() { + if (!this.isFallFlying()) return; // Leaf - Lithium - entity.fast_elytra_check boolean flag = this.getSharedFlag(7); if (flag && !this.onGround() && !this.isPassenger() && !this.hasEffect(MobEffects.LEVITATION)) {