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) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java index 66ff13854d42c3e70e1e74cd977e928f6f85cdcf..600e107371507b081c151af26a7d3ff85c59d418 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -2825,6 +2825,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin } protected void updateSwingTime() { + if (!this.swinging && this.swingTime == 0) return; // Leaf - Lithium - entity.fast_hand_swing int currentSwingDuration = this.getCurrentSwingDuration(); if (this.swinging) { this.swingTime++; @@ -3772,6 +3773,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin protected void updateFallFlying() { this.checkFallDistanceAccumulation(); if (!this.level().isClientSide) { + if (!this.isFallFlying() && this.fallFlyTicks == 0) return; // Leaf - Lithium - entity.fast_elytra_check if (!this.canGlide()) { if (this.getSharedFlag(7) != false && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit this.setSharedFlag(7, false);