From 29fc4b3ac8aeb3cbbbf9a9b0da09201db9ffecfa Mon Sep 17 00:00:00 2001 From: Mustafa Date: Wed, 22 Apr 2026 12:57:32 +0300 Subject: [PATCH] Add isDebugEnabled check to not evaluate toShortString Slightly more performant if debug logging not enabled. Could also use a Supplier taking overload of the .debug method, but that incurs additional lambda object creation that would most likely neglect any performance gains from not evaluating the toShortString method. --- .../mixin/bugfix/missing_block_entities/LevelChunkMixin.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/missing_block_entities/LevelChunkMixin.java b/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/missing_block_entities/LevelChunkMixin.java index 82ce81a5..d35e0bbe 100644 --- a/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/missing_block_entities/LevelChunkMixin.java +++ b/src/main/java/org/embeddedt/modernfix/common/mixin/bugfix/missing_block_entities/LevelChunkMixin.java @@ -87,7 +87,9 @@ public abstract class LevelChunkMixin extends ChunkAccess { BlockEntity blockEntity = this.getBlockEntity(pos.immutable(), LevelChunk.EntityCreationType.IMMEDIATE); String blockName = state.getBlock().toString(); if (blockEntity != null) { - ModernFix.LOGGER.debug("Created missing block entity for {} at {}", blockName, pos.toShortString()); + if (ModernFix.LOGGER.isDebugEnabled()) { + ModernFix.LOGGER.debug("Created missing block entity for {} at {}", blockName, pos.toShortString()); + } } else { ModernFix.LOGGER.error("Block entity is missing for {} at {}, but could not be created", blockName, pos.toShortString()); }