#/probejs dump isnt working, is there something else I can use?
72 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Paste version of latest.log from @tawny hedge
you can try to use kjs borealis
This mod adds a form of "documentation" to KubeJS using the mod Borealis as a means of accessing that documentation.
It adds a homepage to Borealis that allows anyone to get the details of a class file loaded on the client/server.
Im having no luck at all
just trying to find how to loop through the inventory nd check the item id and nbt
you can use e.player.inventory.find(item) to get the slot its in (returns -1 if its not in the inventory)
and you can use e.player.inventory.get(slot) to get the item in that slot
You can try my experimental hosted version of Borealis here:
https://hunter19823.github.io/kubejsoffline/1.18.2/forge/
Specifically a player's inventory:
https://hunter19823.github.io/kubejsoffline/1.18.2/forge/#7603
its taking its sweet time loading
works fine for me
does it have getters? I cant find them anywhere
like ItemStack.id

first method
:p
yea, I saw that
KubeJS Offline, and borealis don't show "beans", however they are still there
Anytime you see A.getX, A.setX, A.isX, you can do A.x as a shortcut
It cannot, no, but I wanted to mention the distinction still.
ah
oh, yes, you did
and ive now coded this, which is probably messier than it needs to be, and I havent tested yet
onEvent('player.tick',event => {
if (event.player.inventory.find('kubejs:trader_bucket') == -1) return
let mainHand = false
if (event.player.mainHandItem == {item: 'kubejs:trader_bucket', nbt: event.level.time % 20}) {
mainHand = true
event.player.playSound('minecraft:entity.wandering_trader.ambient', 20)
}
if (event.player.offHandItem.id == 'kubejs:trader_bucket') event.player.playSound('minecraft:entity.wandering_trader.ambient', 20)
for (let i = 0; i < 9; i++) {
if (event.player.inventory == {item: 'kubejs:trader_bucket', nbt: event.level.time % 20}) {
if (mainHand) mainHand = false
else event.player.playSound('minecraft:entity.wandering_trader.ambient', 15)
}
}
for (let i = 9; i < 36; i++) {
if (event.player.inventory.get(i) == {item: 'kubejs:trader_bucket', nbt: event.level.time % 20}) event.player.playSound('minecraft:entity.wandering_trader.ambient', 10)
}
})```
I know I like the concept, im porting the event over from ctr
Is your goal to play a sound if they hold an item in their main hand?
you use Item.of()
if (event.player.inventory == {item: 'kubejs:trader_bucket', nbt: event.level.time % 20})
an inventory cannot equal to an item
That’s a typo, it’s supposed to be inventory.get(i)
I’ve checked it works for making the item at least, it will have the server time mod 20 from when it was made, ie the tick in the second
It’s to have each copy of the item have a chance to play a sound, with different volumes depending on whether it’s in the hand, hotbar, or inventory
Also that code is from before I add in the random parameter bc I forgot
It’s supposed to have a chance of playing a sound once per second
Here is an idea:
find the slot number of the item in your inventory, then play the sound based on that slot number.
Well I need to check every item in the inventory
To see if it’s nbt matches
I have some already working ctr code that does this(tho for 1.16)
And I’m pretty much just trying to port that
but why do you check all slots
and not just directly the slot with the item in it...?

There could be multiple copies of the item in the inventory
.find returns an int, not an int[], so I can’t check multiple slots with it
Is your goal such that multiple items = higher pitch/duration in the same tick?
It’s multiple items = higher volume
And each item's slot counts towards the volume?
Yea, each seperate item that triggers should make it louder, I haven’t implemented that yet though
onEvent('player.tick', event=> {
if(event.level.time % 20 == 0){
let volume = 0;
for(let i=0; i<event.player.inventory.size; i++){
let slot = event.player.inventory.get(i).id == 'kubejs:trader_bucket' ? i : 0;
volume += slot;
}
event.player.playSound('minecraft:entity.wandering_trader.ambient', volume)
}
});
That doesn't involve slot numbers, which was what they wanted to affect the volume
well they said the number of items influences the volume
more items = higher volume
number of items is given by count
If it's number of items, then yes count would be better, if it's slot position, then you must loop through the items
im going off of this
Also items in hand or hotbar give a higher multiplier
good lord 
Though with .count I can only loop through the hotbar vs the rest of the inventory too
@tawny hedge Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!

