Skip to content

Conversation

@Jdance-Media
Copy link

@Jdance-Media Jdance-Media commented Jan 19, 2026

Earlier I discovered that BarricadeDrop.FindByRootFast utilizes GetComponent in order to obtain the BarricadeDrop. Nelson likes to return transforms for new plants and finding barricades in a radius, so this is called fairly often.

By utilizing the NetIdRegistry and therefore its built-in dictionaries, you save 31.64 - 48% in tick speed in comparison to the FindByRootFast way. I've tested this alongside RBMKBlaze in relation to a plugin on LC and it gives a noticeable improvement.

            NetId netId = NetIdRegistry.GetTransformNetId(__instance.transform);
            if (netId == NetId.INVALID)
                return;
             netId.id--;

            BarricadeDrop drop = (BarricadeDrop)NetIdRegistry.Get(netId);

This is the new standard and improved way to get BarricadeDrop from a Transform. Tons of plugins use the old FindBarricadeByRootTransform way and it can be incredibly problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant