JoeFoxe / Hexerei-1.18

20 stars 12 forks source link

"Angle" in Coffer should probably be in NBT instead of blockstate #23

Closed Bluberry-Kat closed 2 years ago

Bluberry-Kat commented 2 years ago

Blockstates are a pretty wasteful way to do what you're doing here — assuming Angle is only present for the Coffer's renderer
Each blockstate is a reference to a new block model, even if you don't write a model for that state
Given angle has 180 variants, and the Coffer can face 4 directions, and can be waterlogged (2 states, since it's a boolean)
That's 1,440 models allocated per Coffer!
And with 17 coffers, that's over 10,000 models sitting in memory that aren't even being used. Ouch!

Instead of using an "angle" blockstate, you could write to NBT instead.
This has a couple benefits, most relevantly performance-related.

JoeFoxe commented 2 years ago

fixed this in the next update, this was one of my first ever tile entities so bear with me haha I wasnt sure at the time how to store data properly as I never programmed in java before and never modded before so it was all very new to me :D