This commit is contained in:
James Seibel
2025-01-19 17:42:45 -06:00
4 changed files with 17 additions and 11 deletions
@@ -1437,7 +1437,7 @@ public class Config
.build();
public static ConfigEntry<EDhApiLoggerMode> logWorldGenLoadEvent = new ConfigEntry.Builder<EDhApiLoggerMode>()
.setChatCommandName("logging.logWorldGenPerformance")
.setChatCommandName("logging.logWorldGenLoadEvent")
.set(EDhApiLoggerMode.LOG_ERROR_TO_CHAT_AND_INFO_TO_FILE)
.comment(""
+ "If enabled, the mod will log information about the world generation process. \n"
@@ -134,17 +134,18 @@ public class DhClientLevel extends AbstractDhLevel implements IDhClientLevel
return;
}
try
try (FullDataSourceV2DTO dataSourceDto = this.networkState.fullDataPayloadReceiver.decodeDataSourceAndReleaseBuffer(message.payload))
{
FullDataSourceV2DTO dataSourceDto = this.networkState.fullDataPayloadReceiver.decodeDataSourceAndReleaseBuffer(message.payload);
if (!message.isSameLevelAs(this.levelWrapper))
{
return;
}
this.updateBeaconBeamsForSectionPos(dataSourceDto.pos, message.payload.beaconBeams);
this.updateDataSourcesAsync(dataSourceDto.createDataSource(this.levelWrapper));
try (FullDataSourceV2 fullDataSource = dataSourceDto.createDataSource(this.levelWrapper))
{
this.updateDataSourcesAsync(fullDataSource);
}
}
catch (Exception e)
{
@@ -232,6 +232,7 @@ public abstract class AbstractFullDataNetworkRequestQueue implements IDebugRende
if (executor == null)
{
LOGGER.warn("Unable to handle FullDataPayload - getNetworkCompressionExecutor() is null");
dataSourceDto.close();
return null;
}
@@ -249,6 +250,10 @@ public abstract class AbstractFullDataNetworkRequestQueue implements IDebugRende
{
throw new RuntimeException(e);
}
finally
{
dataSourceDto.close();
}
}, executor);
}
else
@@ -271,7 +276,7 @@ public abstract class AbstractFullDataNetworkRequestQueue implements IDebugRende
}
catch (RateLimitedException e)
{
LOGGER.warn("Rate limited by server, re-queueing task [" + DhSectionPos.toString(sectionPos) + "]: " + e.getMessage());
LOGGER.info("Rate limited by server, re-queueing task [" + DhSectionPos.toString(sectionPos) + "]: " + e.getMessage());
// Skip all requests for 1 second
this.rateLimiter.acquireAll();
@@ -9,7 +9,7 @@ import io.netty.buffer.ByteBuf;
import java.io.Closeable;
import java.util.*;
import java.util.function.BiFunction;
import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -82,7 +82,7 @@ public class SessionConfig implements INetworkObject
// entry registration //
//====================//
private static <T> void registerConfigEntry(ConfigEntry<T> configEntry, BiFunction<T, T, T> valueConstrainer)
private static <T> void registerConfigEntry(ConfigEntry<T> configEntry, BinaryOperator<T> valueConstrainer)
{
CONFIG_ENTRIES.compute(Objects.requireNonNull(configEntry.getChatCommandName()), (key, existingEntry) -> {
if (existingEntry != null)
@@ -170,13 +170,13 @@ public class SessionConfig implements INetworkObject
private static class Entry
{
public final ConfigEntry<Object> supplier;
public final BiFunction<Object, Object, Object> valueConstrainer;
public final BinaryOperator<Object> valueConstrainer;
@SuppressWarnings("unchecked")
private <T> Entry(ConfigEntry<T> supplier, BiFunction<T, T, T> valueConstrainer)
private <T> Entry(ConfigEntry<T> supplier, BinaryOperator<T> valueConstrainer)
{
this.supplier = (ConfigEntry<Object>) supplier;
this.valueConstrainer = (BiFunction<Object, Object, Object>) valueConstrainer;
this.valueConstrainer = (BinaryOperator<Object>) valueConstrainer;
}
}