As far as I can tell, you cant summon the Species spectrte mobs tamed, even with the owner tag, so ive resorted to reading the source code to find the trigger event for the tamed spawning
Ive gotten so very close, but I cant figure out what to input for the 3rd var in the spawnSpectre event
const Spectre = Java.loadClass("com.ninni.species.server.entity.mob.update_3.Spectre")
const ServerLevel = Java.loadClass("net.minecraft.server.level.ServerLevel")
ForgeEvents.onEvent("net.minecraftforge.event.entity.living.MobEffectEvent$Expired", event => global.effectsSpectralibur(event));
/**
*
* @param {Internal.MobEffectEvent$Expired} event
*/
global.effectsSpectralibur = event => {
const { effectInstance, effectInstance: { descriptionId }, entity, player, ServerLevel} = event
console.log(descriptionId, effectInstance.amplifier)
try {
if (descriptionId == "effect.weapon_class.stealth" && effectInstance.amplifier > -1 && entity.mainHandItem === 'species:spectralibur') {
entity.server.scheduleInTicks(10, () => {
Spectre.spawnSpectre(ServerLevel, player, player.getOnPos(), Spectre.Type.SPECTRE, true)
Utils.server.runCommandSilent(`say it problably worked...`)
}
)
}
} catch (error) {
console.log(error)
}
}
sorce code for the mod here: https://github.com/Peculiar-Room/Species/blob/main/src/main/java/com/ninni/species/server/item/SpectraliburItem.java
returns [Server thread/ERROR] [KubeJS Server/]: startup_scripts:weapon_class/spectralibur.js#15: Error occurred while handling scheduled event callback: TypeError: Cannot call method "getOnPos" of undefined on effect end
any help is greatly appreciated