LibMultiPart icon indicating copy to clipboard operation
LibMultiPart copied to clipboard

Client-side `onAdded` called twice when loading world

Open Kneelawk opened this issue 3 years ago • 1 comments

The Issue

Currently AbstractParts' onAdded method is called twice on the client-side when the world is loaded or when ever a MultipartBlockEntity is loaded from NBT.

This seems to be caused by the PartContainer.readInitialRenderData first explicitly invoking its parts' onAdded methods and then calling its own validate method which re-invokes the parts' onAdded methods.

Potential Fix

The simplest fix seems to be just removing the explicit invocations of onAdded from the readInitialRenderData method and letting validate handle onAdded instead.

Kneelawk avatar Oct 30 '22 06:10 Kneelawk

This is probably low-priority. None of my code depends on the client-side onAdded only being called once and I don't think I've seen any other code depend on it either.

Kneelawk avatar Oct 30 '22 06:10 Kneelawk