Skip to content

Conversation

@ThisIsBrady
Copy link
Member

@ThisIsBrady ThisIsBrady commented Aug 13, 2025

This PR refactors PlayerEntity into a HumanoidEntityBase in preparation for mobs that share the model and gear slots with it (Zombie, Husk, Drowned).

  • Moved Player model to HumanoidEntityBase class
  • Updated armor texture paths
  • Updated to also load armor items from the new equipment NBT tag (1.21.5)
  • Moved inventory loading from PlayerEntityData to HumanoidEntityBase

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.

@leMaik
Copy link
Member

leMaik commented Aug 16, 2025

Is this about entities that can have items? I like Bukkit's InventoryHolder interface name for that. They also have LivingEntity, which is anything that lives, but that's probably irrelevant for Chunky. 🤔
Make make the gear slots dynamic, eg. add getGearSlots() and setGearSlot(String slot, ??? item) or something like that? Are there entities that have other gear slots than the player?

The rest looks good. Regarding NBT and texture path changes: Just make sure that we are compatible with older Minecraft versions too.

@ThisIsBrady
Copy link
Member Author

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.

@leMaik
Copy link
Member

leMaik commented Sep 3, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants