Mojira Archive
MCPE-185161

[script api]spawnEntity can`t spawn entity when “is_summonable” is set to false

Description:

The dimension.spawnentity methods throw error when try to spawn entity with component "is_summonable" set to false.

Code:
import { world} from "@minecraft/server";

export function testfunction(entity,source)

{     source.dimension.spawnEntity(entity,source.getHeadLocation()) }

world.afterEvents.itemUse.subscribe((event) =>

{     if (event.itemStack.typeId == "minecraft:stick")         testfunction("xr:entity_1",event.source,);     if (event.itemStack.typeId == "minecraft:feather")         testfunction("xr:entity_2",event.source,); }

)
 
*entity_1 has component "is_summonable" set to true while entity_2 didn`t
Steps:

1 Extract the following zip file and put it into the development behavior pack folder within minecraft.Create a world with the BP.

2 Get a stick and a feather and right click them.It throws the error message "Failed to call function 'spawnEntity'".

Results:

entity_1 was spawned successfully but entity_2 didn`t.(use command "/say @e" to check)

Expected results:

both the entity spawned successfully

 

Unresolved

XRAY3036039

2024-08-11, 01:27 AM

2024-12-14, 10:41 PM

2

3

Community Consensus

1.21.2 Hotfix, 1.21.60.24 Preview

-