#Is there a way to make a custom item frame type display entity?

1 messages · Page 1 of 1 (latest)

teal bobcat
#

I have a block with an inventory component (i.e. there's a dummy entity summoned inside the block when its placed). I want to display what the content of that first inventory slot is similar to how an item frame will display the item/block you place in it. Does anyone know of a good way to tackle this challenge?

reef crescent
#

Maybe make it so the entity holds the item, and habe their hand be where yoj want it displayed? This tutorial could help with the setup: https://wiki.bedrock.dev/entities/entity-holds-item

I don't remember if there's a component to make an entity hold an item after interacting with it though, might require a script

teal bobcat
#

Oh that sounds promising. I'm going to look into that tomorrow.

teal bobcat
#

Scripting is preferred, actually. I think this is a promising tack, but I haven't figured out how to implement it yet. The link you gave me provides a means for spawning an entity with an item in its hand per a loot table, but I want to be able to give it anything.

reef crescent
#

It might be possible to make an interaction script which sees what item the player is holding, then swap it with the item the item frame entity is currently holding

#

Using world.afterEvents.playerInteractWithEntity

teal bobcat
#

I played around with the item frame, and I'm not convinced there's a way to manipulate what's in the item frame.

#

I think the entity holding an item could be the best way to go, I just can't figure out how to make it do that.

reef crescent
#

The tutorial for making an entity spawn with a held item contains the things needed to make it able to hold an item. You could then use a script to actually set the item for it. There may also be a component, but if there is I'm not aware of it (I am a bit rusty as well)

teal bobcat
#

That tutorial looks like it just adds the "minecraft:equipment" component.

#

That component doesn't seem to be accessible via scripting API for entities that aren't the player, though...

reef crescent
#

Ah, didn't realize that was true. Man