function random(ary){
    return ary[Math.floor(Math.random()*ary.length)];
}

var golemType = [
'andesite','basalt','blackstone','bone','bookshelf','brick','clay','coal','concrete','coral','crafting','crying_obsidian','diamond','diorite','dispenser','dried_kelp','emerald','end_stone','furnace','glass','glowstone','gold','granite','hay','honey','honeycomb','ice','lapis','leaves','log','magma','melon','mushroom','nether_brick','nether_wart','netherite','obsidian','prismarine','purpur','quartz','redstone','redstone_lamp','sandstone','sea_lantern','shroomlight','slime','smooth_stone','sponge','stem','terracotta','tnt','wool'
];

events.listen('item.right_click', event => {
	
  if (event.item.id == 'kubejs:golem_summoner') {
	if (event.player.world.isOverworld()) {
	  
	event.player.playSound('astralsorcery:perk_unseal');
	event.server.schedule(15, event.server, function (callback) {
	callback.server.runCommandSilent(`execute as ${event.player.name} in ${event.player.world.dimension} run golem ${random(golemType)} ${Math.round(event.player.x)} ${Math.round(event.player.y)} ${Math.round(event.player.z)}`);
	  })
	if (!event.player.isCreativeMode()) {
	event.item.setCount(event.item.getCount() - 1)
	}
	}
	}
});