Chicken-Bones / ForgeMultipart

An API for dynamically handling different functional parts in the one block space.
Other
119 stars 56 forks source link

BlockMultipart does not create a tile entity on setBlock #395

Open Ivorforce opened 7 years ago

Ivorforce commented 7 years ago

Situation

BlockMultipart overrides the hasTileEntity method, but doesn't overwrite createTileEntity.

Problem

This is not strictly illegal, but very cumbersome for my situation.

For Recurrent Complex (in which I save and load structures from files) I first set the block, and then tell it to load its data from the original tile entity's NBT.

Proposed Solution

You might argue that I should just call setTileEntity, but I don't dare to for data integrity's reasons. A block might have different tile entities based on version, and if I force-set it I am opening myself up to crashes.

However, FMP doesn't create its own tile entities and thus I can't get it to load from NBT - in fact, the true problem is that nothing about the block tells me it wants a TileMultipart. I'd need some way to know that without hardcoding, and to keep clean with vanilla blocks usually provide one via createTileEntity.

Edit: I am now aware that FMP generates runtime TE classes - however a dummy can be produced and interacted with, until it can later be replaced by the generated class, re-using the data from the dummy.

Open to other suggestions.