9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-30 12:29:13 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0074-Don-t-load-chunks-to-activate-climbing-entities.patch
Dreeam ccf2f9c0d2 Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a9399451 Fixup sendAllDataToRemote calls
PaperMC/Paper@cb47e018 Remove more dead code, fix pre-existing desync when cancelling and closing container
PaperMC/Paper@40764534 Specify the class loader when loading services (#12829)
PaperMC/Paper@1bf6364b Update Mache for horse decompile fix
PaperMC/Paper@76fb5060 Add vanilla error message to precondition for DialogBaseImpl (#12831)

Purpur Changes:
PurpurMC/Purpur@5b26bab8 Updated Upstream (Paper)
PurpurMC/Purpur@8734844b sigh...
PurpurMC/Purpur@09ea9cb9 fix mobs not burning in daylight (#1689)
PurpurMC/Purpur@4d5a8e6e Updated Upstream (Paper)
PurpurMC/Purpur@7dbe4153 Add support for "/chase", a disabled Minecraft command. (#1690)
PurpurMC/Purpur@11c030a8 Updated Upstream (Paper)
2025-07-12 18:14:29 +08:00

81 lines
3.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Sun, 25 Dec 2022 19:39:38 +0100
Subject: [PATCH] Don't load chunks to activate climbing entities
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 79c88dae33c0b1f27064d388e4c6ec7501d3313e..fa6a565e308cdf356855172621dcd7d8c3237403 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4873,6 +4873,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.inBlockState;
}
+ // Gale start - don't load chunks to activate climbing entities
+ public @Nullable BlockState getInBlockStateIfLoaded() {
+ if (this.inBlockState == null) {
+ this.inBlockState = this.level.getBlockStateIfLoaded(this.blockPosition());
+ }
+
+ return this.inBlockState;
+ }
+ // Gale end - don't load chunks to activate climbing entities
+
public ChunkPos chunkPosition() {
return this.chunkPosition;
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 80e250ce17f315ddaa783624413397f56b52f5b9..ae2e0afb0c36fc5512dcea3d15997a737e91de11 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2129,8 +2129,17 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
public boolean onClimbableCached() {
if (!this.blockPosition().equals(this.lastClimbingPosition)) {
- this.cachedOnClimbable = this.onClimbable();
- this.lastClimbingPosition = this.blockPosition();
+ // Gale start - don't load chunks to activate climbing entities
+ Boolean onClimbableIfLoaded = this.onClimbable(this.level().galeConfig().smallOptimizations.loadChunks.toActivateClimbingEntities);
+
+ if (onClimbableIfLoaded != null) {
+ this.cachedOnClimbable = onClimbableIfLoaded;
+ this.lastClimbingPosition = this.blockPosition();
+ } else {
+ this.cachedOnClimbable = false;
+ this.lastClimbingPosition = null;
+ }
+ // Gale end - don't load chunks to activate climbing entities
}
return this.cachedOnClimbable;
@@ -2138,11 +2147,25 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
// Gale end - Airplane - cache on climbable check
public boolean onClimbable() {
+ // Gale start - don't load chunks to activate climbing entities
+ return onClimbable(true);
+ }
+
+ public Boolean onClimbable(boolean loadChunk) {
+ // Gale end - don't load chunks to activate climbing entities
if (this.isSpectator()) {
return false;
} else {
BlockPos blockPos = this.blockPosition();
- BlockState inBlockState = this.getInBlockState();
+ // Gale start - don't load chunks to activate climbing
+ BlockState inBlockState;
+ if (loadChunk) {
+ inBlockState = this.getInBlockState();
+ } else {
+ inBlockState = this.getInBlockStateIfLoaded();
+ if (inBlockState == null) return null;
+ }
+ // Gale end - don't load chunks to activate climbing entities
if (inBlockState.is(BlockTags.CLIMBABLE)) {
this.lastClimbablePos = Optional.of(blockPos);
return true;