Abstract PlayerEntity in preparation for other mobs#1826
Abstract PlayerEntity in preparation for other mobs#1826ThisIsBrady wants to merge 4 commits intochunky-dev:masterfrom
Conversation
Moves armor NBT data to be owned by the Entity class instead of PlayerEntityData.
|
Is this about entities that can have items? I like Bukkit's The rest looks good. Regarding NBT and texture path changes: Just make sure that we are compatible with older Minecraft versions too. |
|
I was mostly thinking about the entities that are essentially just reskinned Player entities (zombie, husk, etc), but abstracting out inventory in general would be a good idea, I think. The new Mannequin entity would also fall into this category and could just extend this class. Lots of entities use gear slots, technically all mobs have the nbt tags for it now (see https://minecraft.wiki/w/Entity_format#Mobs as of 25w03a). Skeletons use it for bows, zombie-likes have it for weapon/armor, etc. Looks like the pig uses them for saddles now instead of a dedicated tag, which I'll need to go back and add. |
|
I'd rather not create dependencies between unrelated entities based on how they look. Maybe we can give all of them a common Gear field (composition over inheritance) and create interfaces for shared properties like inventories, the fact that they have poseable body parts etc. The mannequin is an exception here because it literally is the same as a player but with an additional tag for configuration (if you don't use the profile tag). That could actually extend Player imho. |
This PR refactors PlayerEntity into a HumanoidEntityBase in preparation for mobs that share the model and gear slots with it (Zombie, Husk, Drowned).
equipmentNBT tag (1.21.5)Looking for review, especially regarding PlayerEntityData. I'd like to fully remove that class to have the PlayerEntity/HumanoidEntity classes own that data, but world loading needs to load some of it before the Entities are actually constructed.