mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
Virtual thread for User Authenticator (#191)
This commit is contained in:
59
patches/server/0121-Cache-tile-entity-position.patch
Normal file
59
patches/server/0121-Cache-tile-entity-position.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
||||
Date: Fri, 25 Oct 2024 22:27:07 -0400
|
||||
Subject: [PATCH] Cache tile entity position
|
||||
|
||||
Check if there is a way to cache isRemoved without problem
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 06a969587f25748d4e29036e1b73ab8ff27fe12f..2d4650b8c6b2d51df7eb70b08b9a12caee6458a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -1038,13 +1038,16 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private class RebindableTickingBlockEntityWrapper implements TickingBlockEntity {
|
||||
|
||||
private TickingBlockEntity ticker;
|
||||
+ private BlockPos cachedPos; // Leaf - Cache tile entity position
|
||||
|
||||
RebindableTickingBlockEntityWrapper(final LevelChunk wrapped, final TickingBlockEntity tickingblockentity) {
|
||||
this.ticker = tickingblockentity;
|
||||
+ this.cachedPos = this.ticker.getPos(); // Leaf - Cache tile entity position
|
||||
}
|
||||
|
||||
void rebind(TickingBlockEntity wrapped) {
|
||||
this.ticker = wrapped;
|
||||
+ this.cachedPos = this.ticker.getPos(); // Leaf - Cache tile entity position
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1059,7 +1062,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
- return this.ticker.getPos();
|
||||
+ return this.cachedPos; // Leaf - Cache tile entity position
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1077,10 +1080,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
private final T blockEntity;
|
||||
private final BlockEntityTicker<T> ticker;
|
||||
private boolean loggedInvalidBlockState;
|
||||
+ private BlockPos cachedPos; // Leaf - Cache tile entity position
|
||||
|
||||
BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) {
|
||||
this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
|
||||
this.ticker = blockentityticker;
|
||||
+ this.cachedPos = this.blockEntity.getBlockPos(); // Leaf - Cache tile entity position
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1126,7 +1131,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
- return this.blockEntity.getBlockPos();
|
||||
+ return this.cachedPos; // Leaf - Cache tile entity position
|
||||
}
|
||||
|
||||
@Override
|
||||
Reference in New Issue
Block a user