增加渲染边界大小限制,避免了渲染过大导致卡顿
Java CI-CD with Maven / build (push) Successful in 22m16s Details

This commit is contained in:
zhangyuheng 2024-04-26 22:50:18 +08:00
parent a3f9afd711
commit 70bf7dedcc
2 changed files with 10 additions and 1 deletions

View File

@ -6,7 +6,7 @@
<groupId>cn.lunadeer</groupId>
<artifactId>Dominion</artifactId>
<version>1.21.4-beta</version>
<version>1.21.5-beta</version>
<packaging>jar</packaging>
<name>Dominion</name>

View File

@ -17,6 +17,15 @@ public class ParticleRender {
}
public static void showBoxBorder(Location loc1, Location loc2) {
int deltaX = Math.abs(loc1.getBlockX() - loc2.getBlockX());
int deltaY = Math.abs(loc1.getBlockY() - loc2.getBlockY());
int deltaZ = Math.abs(loc1.getBlockZ() - loc2.getBlockZ());
if (deltaX > 256 || deltaY > 256 || deltaZ > 256) {
XLogger.debug("渲染区域过大,为避免卡顿此渲染已跳过");
XLogger.debug("loc1: " + loc1.toString());
XLogger.debug("loc2: " + loc2.toString());
return;
}
Dominion.scheduler.region.run(Dominion.instance, (instance) -> {
if (!loc1.getWorld().equals(loc2.getWorld())) {
return;