Skip to content

v1.1.15 - Block tick pooling NRE fix

Choose a tag to compare

@Zaldaryon Zaldaryon released this 08 Jun 23:42

Fix NullReferenceException spam in BlockSoil.OnServerGameTick when Block Tick Pooling is active.

The pooled BlockPos was being passed by reference into BlockPosWithExtraObject, creating a race condition where the position could be overwritten before the main thread consumed it. Additionally, the Activator.CreateInstance path for constructing the wrapper object was fragile with private nested types.

Changes:

  • Cache ConstructorInfo at init instead of using Activator.CreateInstance
  • Copy position for extra-carrying ticks instead of referencing the pool
  • Skip patch entirely if the internal wrapper type can't be resolved

Reported on servers with TerrainSlabs + TerraPrety (more soil blocks = more frequent extra-carrying ticks = higher chance of hitting the race).