9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-30 20:39:21 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0286-optimize-applyMovementEmissionAndPlaySound.patch
Dreeam d36ed6c316 Remove OP lock (#486)
Current implementation of OP lock is not an appropriate solution to prevent plugins that contain backdoor or malicious code. There are many ways to bypass this check to manipulate the OP list or permissions. The best way to prevent this kind of grief is to get plugins from valid and trustworthy places.
2025-08-31 23:53:19 -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 85789dfd30fe4f3b1108634e84b10f168bf6f64e..0bd4bc2d3d3edf6f7ea5e41d4049b2e0a3b3151e 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1276,7 +1276,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;