Mojira Archive
MCM-1311

query.is_using_item only works as intended for host player

Partner Rank: 1

Partner Team Reporting: Shapescape

Verification build: 1.16.200, 1.16.220, 1.16.200.50, 1.17.40

Summary: Detecting the use of custom items within animation controllers can be done with the query.is_using_item query, but it does not work correctly for players other than the host. At the moment it's set up so a command runs when I click an item, and for the host that is fine, but other users act as if the right click was held down, or the information about them stopping was never sent. I can see them doing an eating animation, but that is not the case on their screen. I'm assuming it's correct on their client and it's not being synced. They stop the animation and constantly running commands only if they switch to a different item.

Impact: Adding right-clickable items this way is less viable for multiplayer content. Workarounds need to be used, such as replacing the currently held item with a different one. Affects content currently in development as well as live content.

Repro Steps:

1. Enter the attached world with custom BP and RP
2. Let another player join the world
3. Give the new player the prefix:my_item, prefix:my_item_blue and prefix:my_item_red items
4. Ask them to right click the blue item once and watch it constantly execute commands, despite them not holding down the use button.

Observed results: The animation controller is acting as if it doesn't receive a false value for query.is_using_item when the non-host player stops using the item.

Expected results: The non-host player should be able to stop using the item.

 

Notes: The issue is more prevalent in cases such as implementing a gamemode switch button. If the item is replaced in the same spot, the non-host players will keep right clicking it and it'll cause them to swap between gamemodes every tick or two.

BP AC in the pack:

 

{
	"format_version": "1.10.0",
	"animation_controllers": {
		"controller.animation.player.custom_item": {
			"initial_state": "default",
			"states": {
				"default": {
					"transitions": [
						{
							"use_item": "query.get_equipped_item_name('main_hand') == 'my_item' && query.is_using_item"
						},
						{
							"use_item_blue": "query.get_equipped_item_name('main_hand') == 'my_item_blue' && query.is_using_item"
						},
						{
							"use_item_red": "query.get_equipped_item_name('main_hand') == 'my_item_red' && query.is_using_item && query.item_in_use_duration >= 200"
						}
					]
				},
				"use_item": {
					"on_entry": [
						"/say @s clicked the item"
					],
					"transitions": [
						{
							"default": "!query.is_using_item"
						}
					]
				},
				"use_item_blue": {
					"on_entry": [
						"/say @s clicked the blue item"
					],
					"transitions": [
						{
							"default": "1.0"
						}
					]
				},
				"use_item_red": {
					"on_entry": [
						"/say @s clicked the red item for 200"
					],
					"transitions": [
						{
							"default": "1.0"
						}
					]
				}
			}
		}
	}
}

 There are reports for a similar issue, but they either point out the item cooldown (which could be unrelated) or are rather hard to parse: MCM-1305, MCPE-116261, MCPE-116265

Unresolved

M

2021-03-09, 03:21 PM

2021-10-28, 03:55 PM

7

3

Future Release

-