Closed nivthefox closed 2 years ago
Also, if you are interested in reviewing how I have done the interop for any reason, it can be viewed here: https://github.com/SoSly/ArcaneAdditions. You'll be looking at spells/components/PolymorphComponent and effects/neutral/PolymorphEffect.
I would love to find a more appropriate way to do this interop so if you have any pointers I'm interested, but by no means do I expect you to have the time for this. :D I'll stumble by on my own and just keep making suggestions in the meanwhile.
I'd love seeing mobs being able to be morphed, I remember trying to do it before, but it didn't work. I think this would be really cool thing to add 👍
Sorry for answering so late but I was pretty busy in the last weeks... Anyways, I think there is no way to implement the morphing of mobs using my systems (because that is not what they are designed for, abilities rely on player interaction, there is a hard dependency on the Player class, etc).
Buuut... there is a much easier way of handling this (probably) which is to just replace the mob with another mob and store the NBT data of the old mob in the new mob so that the new mob can change back to the old mob (a lot of mobs in this sentence lul). In practice, you would probably have to filter out some attributes that every mob has (like position and UUID for example), and this can be done quite easily by calling the method "readAdditionalSaveData", as you can see in line 83 of the code link pasted below. Then you would have to store this data in a capability of the new mob. Finally, you would have to place the new mob at the old mob (sharing the same location and rotation) and remove the old mob from the world.
My mod is actually doing something like this when infecting villagers to become zombie villagers. The code is pretty messy though: https://github.com/Budschie/BudschieMorphMod/blob/1.18.x/src/main/java/de/budschie/bmorph/morph/functionality/configurable/TransformEntityOnDeath.java#L62-L96
_Beware though, as there is a small chance that some issues with a few mobs could occur (like for the plaguebeast entity of the rats mod) if you are unlucky (at least this mob caused a NullPointerException when you deserialize the mob with a CompoundTag that is empty. I have not actually tested this in newer versions of the mod yet and it will probably not lead to a NullPointerException if you include the right tags (which you are probably gonna do) or just tell MC to initialize a "standard" entity).
I hope that I could help you with this topic. - Budschie
That's incredibly helpful, thanks! I'll work on implementing it as you've suggested. Thanks so much!
So I'm currently writing an interop for Budschie's Morph and Mana and Artifice, turning Morph into a Spell Component called "Polymorph". I had hoped to allow for polymorphing targets other than the caster; however, because Morphs currently can only be applied to players (as far as I can tell), that seems infeasible right now. It'd be really cool if we could morph mobs, at least using the commands (and thus I could call it using some interop).