9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0286-optimize-applyMovementEmissionAndPlaySound.patch
2025-10-01 10:03:59 -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 17a4d1c55f878a2603586812c10d87f3949e35a8..d04280e45c6cfb75237d5376e9c30becfd9ad8a0 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1277,7 +1277,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;