9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-21 07:59:26 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0093-Cache-tile-entity-position.patch
Dreeam d06fb16da3 Updated Upstream (Paper/Gale/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@30fdfb1a [ci/skip] Fix docs for DamageResistant (#11992)
PaperMC/Paper@6b7650d8 Only add goat horn once (#12001)
PaperMC/Paper@30046e04 Fix a rare crash with a concurrent modification of scaled health attributes (#12002)
PaperMC/Paper@88bbead1 Flush regionfiles on save configuration option
PaperMC/Paper@336ea9df Check for empty when sending equipment changes (#12008)
PaperMC/Paper@939bb782 Add RayTraceConfigurationBuilder (#11907)
PaperMC/Paper@81bb82f5 Fix wrong piston world border check (#12007)
PaperMC/Paper@ce95b5d6 Use proper default for setting null display background color (#12010)
PaperMC/Paper@2477f1f6 [ci/skip] fix and improvements for docs in ConsumeEffect component (#11998)
PaperMC/Paper@fb5b173c Add PlayerClientLoadedWorldEvent (#11940)
PaperMC/Paper@3af5e771 Add Player#give (#11995)
PaperMC/Paper@7e21cb81 fix PlayerChangedMainHandEvent javadoc (#12020)
PaperMC/Paper@5a34bf04 Correctly retrun true for empty input shapes in EntityGetter#isUnobstructed
PaperMC/Paper@a392d475 Make Watchdog thread extend TickThread

Gale Changes:
Dreeam-qwq/Gale@f9080a7e Updated Upstream (Paper)
Dreeam-qwq/Gale@ff0596c1 [ci/skip] Fix upstream commit sh on mac
Dreeam-qwq/Gale@24970274 [ci/skip] Hermanez - Wutaf
Dreeam-qwq/Gale@85eabf60 [ci/skip] cleanup
Dreeam-qwq/Gale@7d9faf00 [ci/skip] cleanup & drop xor-shift random
Dreeam-qwq/Gale@7af04981 [ci/skip] cleanup
Dreeam-qwq/Gale@4d5d39df [ci/skip] Remove useless params standardize in upstream commit generator
Dreeam-qwq/Gale@964f16ff Updated Upstream (Paper)
Dreeam-qwq/Gale@0566a223 [ci/skip] cleanup
Dreeam-qwq/Gale@5e3f6740 [ci/skip] cleanup work finished
Dreeam-qwq/Gale@98a66cfb Updated Upstream (Paper)
Dreeam-qwq/Gale@f7736578 [ci/skip] Update upstreamCommit.sh
Dreeam-qwq/Gale@1c46c816 Updated Upstream (Paper)
Dreeam-qwq/Gale@2b0a4c09 [ci/skip] Skip tests during auto update validate phase

Purpur Changes:
PurpurMC/Purpur@4a0a86b9 Updated Upstream (Paper)
PurpurMC/Purpur@7399988c Fix hover in /plugins
PurpurMC/Purpur@5e5857dc [ci/skip] modify ci skip references in paper upstream commits
PurpurMC/Purpur@5583a3f1 Updated Upstream (Paper)
2025-01-27 20:08:18 -05:00

60 lines
2.5 KiB
Diff

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
Dreeam TODO: Check if there is a way to cache isRemoved without problem
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 290163335cf3967e2745442fd7d4d4fa16fb7bc0..238e015d4ff5fabb99e569118f253366d545d269 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -936,10 +936,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
private final T blockEntity;
private final BlockEntityTicker<T> ticker;
private boolean loggedInvalidBlockState;
+ private final BlockPos cachedPos; // Leaf - Cache tile entity position
BoundTickingBlockEntity(final T blockEntity, final BlockEntityTicker<T> ticker) {
this.blockEntity = blockEntity;
this.ticker = ticker;
+ this.cachedPos = this.blockEntity.getBlockPos(); // Leaf - Cache tile entity position
}
@Override
@@ -980,7 +982,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
@@ -1007,13 +1009,16 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
static class RebindableTickingBlockEntityWrapper implements TickingBlockEntity {
private TickingBlockEntity ticker;
+ private BlockPos cachedPos; // Leaf - Cache tile entity position
RebindableTickingBlockEntityWrapper(TickingBlockEntity ticker) {
this.ticker = ticker;
+ this.cachedPos = this.ticker.getPos(); // Leaf - Cache tile entity position
}
void rebind(TickingBlockEntity ticker) {
this.ticker = ticker;
+ this.cachedPos = this.ticker.getPos(); // Leaf - Cache tile entity position
}
@Override
@@ -1028,7 +1033,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