From 410fe684ec3981f687198036a75b985e12a3087b Mon Sep 17 00:00:00 2001 From: tom lee Date: Tue, 25 Jan 2022 18:25:46 +0800 Subject: [PATCH] Changed how blockUpdate works --- src/main/java/com/seibel/lod/core/api/ClientApi.java | 2 +- src/main/java/com/seibel/lod/core/api/EventApi.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/api/ClientApi.java b/src/main/java/com/seibel/lod/core/api/ClientApi.java index 5ef431a07..db222f892 100644 --- a/src/main/java/com/seibel/lod/core/api/ClientApi.java +++ b/src/main/java/com/seibel/lod/core/api/ClientApi.java @@ -95,7 +95,7 @@ public class ClientApi } private final ConcurrentHashMap.KeySetView generating = ConcurrentHashMap.newKeySet(); - private final ConcurrentHashMap.KeySetView toBeLoaded = ConcurrentHashMap.newKeySet(); + public final ConcurrentHashMap.KeySetView toBeLoaded = ConcurrentHashMap.newKeySet(); public void clientChunkLoadEvent(IChunkWrapper chunk, IWorldWrapper world) { diff --git a/src/main/java/com/seibel/lod/core/api/EventApi.java b/src/main/java/com/seibel/lod/core/api/EventApi.java index e6e7778f8..eaffb8a96 100644 --- a/src/main/java/com/seibel/lod/core/api/EventApi.java +++ b/src/main/java/com/seibel/lod/core/api/EventApi.java @@ -21,6 +21,7 @@ package com.seibel.lod.core.api; import org.lwjgl.glfw.GLFW; +import com.seibel.lod.core.api.ClientApi.LagSpikeCatcher; import com.seibel.lod.core.builders.lodBuilding.LodBuilder; import com.seibel.lod.core.builders.worldGeneration.LodWorldGenerator; import com.seibel.lod.core.enums.WorldType; @@ -171,8 +172,11 @@ public class EventApi public void blockChangeEvent(IChunkWrapper chunk, IDimensionTypeWrapper dimType) { + if (dimType != MC.getCurrentDimension()) return; // recreate the LOD where the blocks were changed - ApiShared.lodBuilder.generateLodNodeAsync(chunk, ApiShared.lodWorld, dimType); + LagSpikeCatcher blockChangeUpdate = new LagSpikeCatcher(); + ClientApi.INSTANCE.toBeLoaded.add(chunk.getLongChunkPos()); + blockChangeUpdate.end("clientChunkLoad"); }