promotional bannermobile promotional banner

TFMG Electricity Performance Patch

Fixes the per-tick electrical network rebuild loop and the quadratic network update in Create: The Factory Must Grow.
Back to Files

TFMG Electricity Performance Patch 1.1.0

File nametfmgfix-1.1.0.jar
Uploader
mzgmzg
Uploaded
Aug 8, 2026
Downloads
14
Size
8.0 KB
Mod Loaders
NeoForge
File ID
8603755
Type
R
Release
Supported game versions
  • 1.21.1

Curse Maven Snippet

NeoForge

implementation "curse.maven:tfmg-electricity-performance-patch-1624822:8603755"

Learn more about Curse Maven

What's new

1.1.0 — three goggle tooltip crashes

Adds crash fixes. Nothing from 1.0.0 changed; the four electrical-network performance fixes behave exactly as before.

The crash

Looking at a steel tank through Engineer's Goggles and breaking a block of it takes the client down:

java.lang.NullPointerException: Cannot invoke
  "SteelTankBlockEntity.getBlockPos()" because the return value of
  "SteelTankBlockEntity.getControllerBE()" is null
    at tfmg/…/SteelTankBlockEntity.addToGoggleTooltip(SteelTankBlockEntity.java:423)
    at create/…/GoggleOverlayRenderer.renderOverlay(GoggleOverlayRenderer.java:111)

SteelTankBlockEntity.addToGoggleTooltip ends with

level.getCapability(Capabilities.FluidHandler.BLOCK, getControllerBE().getBlockPos(), null)

and getControllerBE() returns null whenever the block entity at the recorded controller position is gone or is no longer a steel tank — precisely the state every remaining block of the multiblock is in for the frames between one of its blocks being broken and connectivity being recomputed. The tooltip runs on the render thread, so the NPE is fatal rather than logged.

The null is a legitimate, expected value, and TFMG guards against it everywhere else: FireboxBlockEntity, VatBlockEntity and BlastStoveBlockEntity all open their tooltip with if (getControllerBE() == null) return false. The steel tank is missing that one line.

What 1.1.0 changes

Three tooltips, all the same defect:

1. SteelTankBlockEntity.addToGoggleTooltip — returns false when there is no controller, matching what TFMG's own other multiblocks do. There is nothing to display for a tank with no controller anyway; the capability lookup it was about to perform was for the controller's inventory. This is the crash above.

2. DistillationControllerBlockEntity.addToGoggleTooltip — reads the heat level off the tank behind it as tank.getControllerBE().activeHeat, with no null check, so pointing goggles at a distillation controller crashes the same way when that tank's controller is missing. Here the tank is a neighbour rather than this block entity and the rest of the tooltip is perfectly valid, so instead of suppressing the tooltip the lookup falls back to the tank itself. activeHeat exists on every steel tank, so for the frames the multiblock is unsettled the tooltip shows the local block's value instead of the controller's — off by one block for a fraction of a second, against a crash.

3. RegularEngineBlockEntity.addToGoggleTooltip — a non-controller engine block forwards its tooltip with if (!isController()) return getControllerBE().addToGoggleTooltip(…), and that getControllerBE() is null for the same reason. Not seen in a crash report yet; it is the identical unguarded call and costs four lines to close.

Not changed

DistillationControllerBlockEntity.manageRecipe() and SteelTankBlockEntity.evaluate() dereference getControllerBE() without a guard too, but those are server tick paths where a null would mean the multiblock logic is already in a state this patch should not paper over. They are left alone deliberately.

Compatibility

Same as 1.0.0 — TFMG 1.2.0, Minecraft 1.21.1, NeoForge 21.1.x. Mixins only, no content touched. "defaultRequire": 1 still applies: if a future TFMG version changes any of these methods the game fails to start with a clear Mixin error rather than silently reverting to the crash.

This mod has no additional files