Entity Documentation - has_component
Returns true when the subject entity contains the named component.
Parameters
Name | Default Value | Type | Description |
---|---|---|---|
value | not set | String | (Required) The component name to look for |
Nested Table
Note
has_component
can also use subject
and operator parameters but they are optional.
subject
Options | Description |
---|---|
block | The block involved with the interaction. |
damager | The damaging entity involved with the interaction. |
other | The other member of an interaction, not the caller. |
parent | The caller's current parent. |
player | The player involved with the interaction. |
self | The entity or object calling the test |
target | The caller's current target. |
operator
Options | Description |
---|---|
!= | Test for inequality. |
< | Test for less-than the value. |
<= | Test for less-than or equal to the value. |
<> | Test for inequality. |
= | Test for equality. |
== | Test for equality. |
> | Test for greater-than the value. |
>= | Test for greater-than or equal to the value. |
equals | Test for equality. |
not | Test for inequality. |
Examples
Full
{ "test": "has_component", "subject": "self", "operator": "equals", "value": "minecraft:explode" }
Short (using Defaults)
{ "test": "has_component", "value": "minecraft:explode" }
Vanilla entities examples
zombie pigman
{
"test": "has_component", "subject": "other", "value": "minecraft:is_baby"
}
Vanilla entities using has_component
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for