Fixed tickable warning message to be outside of assertions.

This commit is contained in:
KermanIsPretty 2025-01-22 19:53:33 -06:00 committed by Kerman
parent ec3230c7c6
commit 294601a6b5
2 changed files with 6 additions and 3 deletions

View File

@ -186,7 +186,10 @@ public class DynamicChunk extends Chunk {
final Block block = entry.getValue();
final BlockHandler handler = block.handler();
if (handler == null) return;
assert handler.tickable(): String.format("You cannot change the tickable state of %s during runtime!", handler.getNamespaceId());
// We cannot throw an exception as that could cause other blocks to not get properly ticked.
if (!handler.tickable()) {
LOGGER.warn("Ticking a block {} using the handler {}, but it is no longer considered tickable. Previously, it was tickable, but this is unsupported since tickable is immutable.", block, handler);
}
final Point blockPosition = CoordConversion.chunkBlockIndexGetGlobal(index, chunkX, chunkZ);
handler.tick(new BlockHandler.Tick(block, instance, blockPosition));
});

View File

@ -75,9 +75,9 @@ public interface BlockHandler {
}
/**
* Specifies if this block should be ticked.
* Specifies if this block should be ticked, this is immutable after the block is set.
* <p>
* This method is only called when the block is set.
* This method is only called during the block set and later to check immutability.
*
* @return true if this block should be ticked
*/