9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-31 12:56:29 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0286-optimize-applyMovementEmissionAndPlaySound.patch
Dreeam 3b162fb788 Move Purpur patches to first
To reduce the difficulty on maintenance and reduce chances to fix conflicts on updating
2025-10-01 18:27:42 -04:00

21 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Sat, 9 Aug 2025 15:43:00 +0900
Subject: [PATCH] optimize applyMovementEmissionAndPlaySound
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 5fbf5e01872834ce4a22fb8bfe25cc1dc4f8cf60..61d381e2b51d052f5ee9d09b5fb74fb330734302 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1275,7 +1275,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
float f1 = (float)(movement.length() * 0.6F);
float f2 = (float)(movement.horizontalDistance() * 0.6F);
BlockPos onPos = this.getOnPos();
- BlockState blockState = this.level().getBlockState(onPos);
+ BlockState blockState = this.level.getBlockStateIfLoadedUnchecked(onPos.getX(), onPos.getY(), onPos.getZ());
+ if (blockState == null) { blockState = this.level.getBlockState(onPos); }
boolean isStateClimbable = this.isStateClimbable(blockState);
this.moveDist += isStateClimbable ? f1 : f2;
this.flyDist += f1;