#CuriosAPI
42 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
ProbeJS lying to me 😠
you have to convert player to mcplayer
ah i got it
getEquippedCurios(player.minecraftPlayer) or whatever it is
i was literally thinking of that xd
what is the difference between mcplayer and player
easier to not have to think about with 1.19 since you're playing with minecraft classes not kjs classes
in 1.18 everything is wrapped by kubejs, it's not the actual minecraft version of the thing
you can see it from your error that it can't find the method for dev.latvian.mods.kubejs.player.ServerPlayerJS which is the kubejs wrapped player
there is a method for searching directly for an item vs iterating over all the curios
https://github.com/TheIllusiveC4/Curios/blob/1.18.x/src/main/java/top/theillusivec4/curios/api/type/util/ICuriosHelper.java#L125
[20:43:00] [ERR ] Error occurred while handling event 'player.tick': The choice of Java method top.theillusivec4.curios.common.CuriosHelper.findCurios matching JavaScript argument types (net.minecraft.server.level.ServerPlayer,net.minecraft.network.chat.TranslatableComponent) is ambiguous; candidate methods are: interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,net.minecraft.world.item.Item) interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,java.lang.String[]) (server_scripts:curios.js#13)
my log filled with this
[20:43:47] [ERR ] Error occurred while handling event 'player.tick': The choice of Java method top.theillusivec4.curios.common.CuriosHelper.findCurios matching JavaScript argument types (net.minecraft.server.level.ServerPlayer,dev.latvian.mods.kubejs.item.ItemStackJS) is ambiguous; candidate methods are: interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,net.minecraft.world.item.Item) interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,java.lang.String[]) (server_scripts:curios.js#13)
this is the correct error
dev.latvian.mods.kubejs.item.ItemStackJS is not equal to net.minecraft.world.item.Item 
item.item same idea as player
either pass in Item.of('magicfeather:magicfeather').item or do findCurios(player, item.item)
[21:00:12] [ERR ] Error occurred while handling event 'player.tick': The choice of Java method top.theillusivec4.curios.common.CuriosHelper.findCurios matching JavaScript argument types (net.minecraft.server.level.ServerPlayer,string) is ambiguous; candidate methods are: interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,net.minecraft.world.item.Item) interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,java.lang.String[]) (server_scripts:curios.js#13)
it wants an array
😩
i changed it from findCurios() to findCurio()
[21:05:30] [ERR ] Error occurred while handling event 'player.tick': The choice of Java method top.theillusivec4.curios.common.CuriosHelper.findCurios matching JavaScript argument types (net.minecraft.server.level.ServerPlayer,be.ephys.magicfeather.ItemMagicFeather) is ambiguous; candidate methods are: interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,net.minecraft.world.item.Item) interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,java.lang.String[]) (server_scripts:curios.js#14) now it gives me this
thought you said you swapped to findCurio
[21:07:31] [ERR ] Error occurred while handling event 'player.tick': Can't find method top.theillusivec4.curios.common.CuriosHelper.findCurio(net.minecraft.server.level.ServerPlayer,be.ephys.magicfeather.ItemMagicFeather). (server_scripts:curios.js#14)
try this....
onEvent('player.tick', event => {
let player = event.minecraftPlayer
if (curiosSearcher(player, Item.of('magicfeather:magicfeather'))) {
player.setCustomName('Magic Feather')
}
}
function curiosSearcher(player, item) {
let curios = $CuriosAPI.getCuriosHelper().findCurios(player, (itemstack) => item.test(itemstack))
console.log(curios)
return true
}
now i am reloading this
Error occurred while handling event 'player.tick': The choice of Java method top.theillusivec4.curios.common.CuriosHelper.findCurios matching JavaScript argument types (net.minecraft.server.level.ServerPlayer,function) is ambiguous; candidate methods are: interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,net.minecraft.world.item.Item) interface java.util.List findCurios(net.minecraft.world.entity.LivingEntity,java.lang.String[]) (server_scripts:curios.js#14)
let item = Item.of('magicfeather:magicfeather').item.asItem() maybe adding .asItem() does something
grrrr, okay we'll do the signature method
neeeext
try this....
onEvent('player.tick', event => {
let player = event.minecraftPlayer
if (curiosSearcher(player, Item.of('magicfeather:magicfeather'))) {
player.setCustomName('Magic Feather')
}
}
function curiosSearcher(player, item) {
let curios = $CuriosAPI.getCuriosHelper()['findCurios(net.minecraft.world.entity.LivingEntity,net.minecraft.world.item.Item)'](player, item.item)
console.log(curios)
return true
}
I have an exemple using player nbt, but I assume you want to use Java classes right?
yes
finaly it didn't gave any errros but it returns empty list and i need to give player effect instead of setting name
@native pivot Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!
kek