mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 17:09:29 +00:00
fix mob spawning over limit
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: hayanesuru <hayanesuru@outlook.jp>
|
||||
Date: Fri, 23 May 2025 15:57:42 +0900
|
||||
Subject: [PATCH] optimize getEntityStatus
|
||||
|
||||
|
||||
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
|
||||
index 2d24d03bbdb5ee0d862cbfff2219f58afffafe12..703bf9c2a56b262e2719a1787584de537b8f12e0 100644
|
||||
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
|
||||
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
|
||||
@@ -93,8 +93,14 @@ public abstract class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
- final Visibility visibility = EntityLookup.getEntityStatus(entity);
|
||||
- return visibility.isAccessible() ? entity : null;
|
||||
+ // Leaf start - optimize getEntityStatus
|
||||
+ final FullChunkStatus entityStatus = ((ChunkSystemEntity) entity).moonrise$getChunkStatus();
|
||||
+ return switch (entityStatus) {
|
||||
+ case INACCESSIBLE -> null;
|
||||
+ case FULL, BLOCK_TICKING, ENTITY_TICKING -> entity;
|
||||
+ case null -> null;
|
||||
+ };
|
||||
+ // Leaf end - optimize getEntityStatus
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -398,7 +404,14 @@ public abstract class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
return Visibility.TICKING;
|
||||
}
|
||||
final FullChunkStatus entityStatus = ((ChunkSystemEntity)entity).moonrise$getChunkStatus();
|
||||
- return Visibility.fromFullChunkStatus(entityStatus == null ? FullChunkStatus.INACCESSIBLE : entityStatus);
|
||||
+ // Leaf start - optimize getEntityStatus
|
||||
+ return switch (entityStatus) {
|
||||
+ case INACCESSIBLE -> Visibility.HIDDEN;
|
||||
+ case FULL, BLOCK_TICKING -> Visibility.TRACKED;
|
||||
+ case ENTITY_TICKING -> Visibility.TICKING;
|
||||
+ case null -> Visibility.HIDDEN;
|
||||
+ };
|
||||
+ // Leaf end - optimize getEntityStatus
|
||||
}
|
||||
|
||||
protected boolean addEntity(final Entity entity, final boolean fromDisk, final boolean event) {
|
||||
Reference in New Issue
Block a user