Page 1 of 1
on_put_item What Item?
Posted: Fri Dec 02, 2016 8:02 pm
by matjojo
I'd like to know what item was used when placing an entity, I think it'd be most useful for the on_put_item event, but a second would be the on_built_entity event, although that does not really have to be with an item.
Re: on_put_item What Item?
Posted: Fri Dec 02, 2016 9:34 pm
by Rseding91
The item is the item in the players cursor.
Re: on_put_item What Item?
Posted: Sat Dec 03, 2016 12:49 am
by matjojo
Rseding91 wrote:The item is the item in the players cursor.
Oww, so it goes about like this: On put item> on entity build> item taken from cursor?
Re: on_put_item What Item?
Posted: Sat Dec 03, 2016 12:54 am
by Rseding91
matjojo wrote:Rseding91 wrote:The item is the item in the players cursor.
Oww, so it goes about like this: On put item> on entity build> item taken from cursor?
yes.
Re: on_put_item What Item?
Posted: Tue Dec 06, 2016 6:27 am
by Mooncat
Ah, damn. I forgot the cursor stack holds the item for building the entity. (I knew it when making Creative Mode, but then forgot it when making new mods.)
Would you mind adding description about this on the doc please?
Edit: oh wait! I think the order above is incorrect.
It should be: on_put_item -> item taken from cursor -> on_built_entity
If the player has spent the last item, cursor stack will be invalid for read in on_built_entity. In that case, it is not possible to know which item was used to build the entity.
Maybe it is related as well:
placed_item in on_built_entity/on_robot_built_entity
Re: on_put_item What Item?
Posted: Thu Dec 08, 2016 9:04 am
by bobingabout
Well, you do have access to who built the entity, as well as the entity type. Unless you have more than one item definition to place the same entity, it shouldn't be an issue. But in that case, why would you have multiple items to place the same entity type?
Re: on_put_item What Item?
Posted: Thu Dec 08, 2016 10:50 am
by matjojo
bobingabout wrote:Well, you do have access to who built the entity, as well as the entity type. Unless you have more than one item definition to place the same entity, it shouldn't be an issue. But in that case, why would you have multiple items to place the same entity type?
I'm not really concerned why someone would make it so, i want my nod to work when someone does do it.