Railcraft

Railcraft

34M Downloads

FluidModelRenderer block state container churn

asiekierka opened this issue · 3 comments

commented

Description of the Bug

The current FluidModelRenderer implementation creates an ExtendedBlockState container on every renderFluid call. This is incredibly sub-optimal - creating a new block state container is an expensive operation. To improve the situation, the ExtendedBlockState object should be cached, and the IExtendedBlockState grabbed from the cached ExtendedBlockState.

commented

I don't really understand all the blockstate stuff, but maybe this is the fix you meant? I just made it static final.

commented

This was a while ago...

I think I would have preferred it to be cached on first call, rather than on static initializer, but I think the renderer's static initializer won't be called before Blocks.WATER is initialized. Typically. The former would be safer IMO, but this is roughly what I meant.

Thank you!

commented

Ah, didn't think about that, but it seems to work so I'm going to call it good for now.