#Is it possible to access the EntityEquippableComponent of a non-player entity?
1 messages · Page 1 of 1 (latest)
show code
This is still a bit of a test run that got blocked by an error, so there's not a whole lot going on. I've got this:
import {system, world, EntityEquippableComponent} from "@minecraft/server";
console.warn(`Player is holding ${owner.getComponent(EntityEquippableComponent.componentId).getEquipment("Mainhand").typeId}`);
console.warn(`Wolf has ${wolf.getComponent(EntityEquippableComponent.componentId).getEquipment("Head").typeId}` equipped);
I can confirm that owner and wolf are valid entities, set elsewhere in the script.
Running this results in this error, caught by a try/catch
Having said all of that, I'll see if I can get a more testable code sample. This script has a ton of irrelevant code, so I can't just put it all here lol
They temporarily made it inaccessible to entities that are not a Player. Until further notice.
I believe in 1.20.20.
console.warn(wolf.getComponents().map(c=>c.typeId.substr(10)).join("\n"))
I usually just display the entity's stuff
Ah, I see. That's unfortunate, but at least I'm glad I'm not going crazy lol
That's the version where they implemented the change.
EntityEquipmentInventoryComponent is currently limited to Players only. However, we hope to reintroduce this component for mobs in a future update
console.warn(JSON.stringify(world.getDimension("overworld")
.getEntities().reduce((o, e) => {
o[e.typeId.replace('minecraft:', '')] = e
.getComponents().map(c => c?.typeId.substring(10))
return o
}, {}), null, 3))
Cool, thanks! That'll be really helpful for future tests 
I see. Hmm.. well, hopefully they can get that working again soon.
For now, might have to stick with the current workaround ¯_(ツ)_/¯
On the bright side, you know you aren't going crazy 🤣