Chicken-Bones / ForgeMultipart

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

Can't add parts during onAdded #322

Open ElvishJerricco opened 9 years ago

ElvishJerricco commented 9 years ago

Tile conversion only allows converting into one part. If a tile is to be converted to more than one part, you'd think the best way would be by adding a second part in one part's onAdded method. But this results in glitchy behavior. For example, breaking the first part will instead break the part that was added by the first part. Then breaking the first part again will break both the first part, and whatever part triggered the tile → part conversion. I haven't tested with more than just these three parts though so that may be more specific than the actual behavior.

Chicken-Bones commented 9 years ago

Obvious solution to this is to just allow more than one part in tile conversion

On Sun, Apr 19, 2015 at 1:14 AM, ElvishJerricco notifications@github.com wrote:

Tile conversion only allows converting into one part. If a tile is to be converted to more than one part, you'd think the best way would be by adding a second part in one part's onAdded method. But this results in glitchy behavior. For example, breaking the first part will instead break the part that was added by the first part. Then breaking the first part again will break both the first part, and whatever part triggered the tile → part conversion. I haven't tested with more than just these three parts though so that may be more specific than the actual behavior.

— Reply to this email directly or view it on GitHub https://github.com/Chicken-Bones/ForgeMultipart/issues/322.

ElvishJerricco commented 9 years ago

I figured that'd be the better solution, but thought I'd outline the exact issue we were having.

ElvishJerricco commented 9 years ago

So if I wanted to try to put together a fix for this, how would you recommend the API look? If it weren't for java compatibility, I could just add a concrete method to the IPartConverter trait that packages convert(...):TMultiPart into a singleton list, and replace all calls to convert with calls to this new method. Then this method could be overriden to return any number of parts.

But Java wouldn't work with that. So I'm not exactly sure how to do this without breaking backwards compatibility and java compatibility.

Chicken-Bones commented 9 years ago

Sorry for late reply, for now, a second interface with the old one deprecated, make sure it returns a java.lang.Iterable for compatiblity