mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-23 00:39:22 +00:00
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 286356ccb4f6938a857a58d4478f00aa84f00ee1..206f8e45b3ba1c0b1f25246b61cb6a2d7fe0a0fd 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -4509,6 +4509,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
return this.feetBlockState;
|
|
}
|
|
|
|
+ // Gale start - don't load chunks to activate climbing entities
|
|
+ public @Nullable BlockState getFeetBlockStateIfLoaded() {
|
|
+ if (this.feetBlockState == null) {
|
|
+ this.feetBlockState = this.level.getBlockStateIfLoaded(this.blockPosition());
|
|
+ }
|
|
+
|
|
+ return this.feetBlockState;
|
|
+ }
|
|
+ // 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 2f252bbe2946ea3228933b4b8c91a4e46fe99705..a35891723fad4fe984566c41cdd728004f8f371e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1979,19 +1979,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.getFeetBlockState();
|
|
+ // Gale start - don't load chunks to activate climbing entities
|
|
+ BlockState iblockdata;
|
|
+ if (loadChunk) {
|
|
+ iblockdata = this.getFeetBlockState();
|
|
+ } else {
|
|
+ iblockdata = this.getFeetBlockStateIfLoaded();
|
|
+ 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 566d33b127879c4c84557fce4ea4eb1c8c1130d5..3bcfcbb9bf085192c55aae58ddb231fb18dcabcd 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
|
|
}
|
|
|
|
}
|