9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 03:19:21 +00:00

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.
This commit is contained in:
Dreeam
2025-08-31 23:53:19 -04:00
committed by GitHub
parent b75efe6b13
commit d36ed6c316
37 changed files with 1 additions and 116 deletions

View File

@@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Sat, 9 Aug 2025 15:00:20 +0900
Subject: [PATCH] optimize LevelChunk#getBlockStateFinal
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index e429932a044647f931443c6761d1b39e4eb7665c..6a70665e9b8bc767ba316ada542178634e090afa 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -316,12 +316,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
public BlockState getBlockStateFinal(final int x, final int y, final int z) {
// Copied and modified from below
- final int sectionIndex = this.getSectionIndex(y);
- if (sectionIndex < 0 || sectionIndex >= this.sections.length
- || this.sections[sectionIndex].nonEmptyBlockCount == 0) {
- return Blocks.AIR.defaultBlockState();
+ // Leaf start - optimize LevelChunk#getBlockStateFinal
+ final int sectionIndex = (y >> 4) - this.minSection;
+ if (sectionIndex < 0 || sectionIndex >= this.sections.length) {
+ return AIR_BLOCKSTATE;
+ } else {
+ LevelChunkSection section = this.sections[sectionIndex];
+ if (section.nonEmptyBlockCount == 0) {
+ return AIR_BLOCKSTATE;
+ }
+ return section.states.get((y & 15) << 8 | (z & 15) << 4 | x & 15);
}
- return this.sections[sectionIndex].states.get((y & 15) << 8 | (z & 15) << 4 | x & 15);
+ // Leaf end - optimize LevelChunk#getBlockStateFinal
}
@Override