mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-21 15:59:28 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@f9c7f2a Begin switching to JSpecify annotations (#11448) PaperMC/Paper@e3c8a8e Add PlayerInsertLecternBookEvent [1.20 port] (#7305) PaperMC/Paper@b410fe8 Configurable per-world void damage offset/damage(#11436) PaperMC/Paper@ea00be3 Do not NPE on uuid resolution in player profile (#11449)
93 lines
4.5 KiB
Diff
93 lines
4.5 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/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 9bd19182fe33346baf0b2503d90d6cd54e12df3a..5a278706582bac69a38129975351aef2f11f730d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4660,6 +4660,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/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index bdafaa87c38d7bfe15a6a3dd450c706f0efed8a8..e4986e69898b95380b0efb6a5125514a0fa8314c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -2079,19 +2079,43 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
|
|
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;
|
|
}
|
|
// 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 blockposition = this.blockPosition();
|
|
- BlockState iblockdata = this.getInBlockState();
|
|
+ // Gale start - don't load chunks to activate climbing entities
|
|
+ BlockState iblockdata;
|
|
+ if (loadChunk) {
|
|
+ iblockdata = this.getInBlockState();
|
|
+ } else {
|
|
+ iblockdata = this.getInBlockStateIfLoaded();
|
|
+ if (iblockdata == null) {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
+ // Gale end - don't load chunks to activate climbing entities
|
|
|
|
if (iblockdata.is(BlockTags.CLIMBABLE)) {
|
|
this.lastClimbablePos = Optional.of(blockposition);
|
|
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
index e648d995fe9d2b44e66cb50e3f894b3524f77fef..17b1a7a2e0b557354f0c4ea2f92d9105bcd5cf2c 100644
|
|
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
|
|
@@ -95,6 +95,7 @@ public class GaleWorldConfiguration extends ConfigurationPart {
|
|
public LoadChunks loadChunks;
|
|
public class LoadChunks extends ConfigurationPart {
|
|
public boolean toSpawnPhantoms = false; // Gale - MultiPaper - don't load chunks to spawn phantoms
|
|
+ public boolean toActivateClimbingEntities = false; // Gale - don't load chunks to activate climbing entities
|
|
}
|
|
|
|
}
|