#Help with ProbeJS setup

262 messages · Page 1 of 1 (latest)

warm arch
#

Hi, setting up my VSCode with ProbeJS. I've run /probejs dump and opened up the folder, but I'm not getting proper autocompletions, I don't think?
using the example from the Basic Custom Mechanics tutorial, for example, I'm not seeing any of item.entity_interact's methods on the list

tame parrotBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

warm arch
#

soulless wait i made a typo let me make sure that that's not all that was

#

okay yeah

#

doing something like Item. does bring up a list of methods though

river hedge
#

you misspelled interaction btw

#

oh wait

#

lol i just saw nvm

warm arch
#

lol and that was after i thought i fixed the first typo

#

nono still not working though

versed pewter
#

for me I setup probejs in minecraft, ran minecraft, ran the probejs commands, then went and opened the root directory of minecraft in vscode

#

and it works wonderfully

river hedge
#

did you open the modpack folder itself or the kubejs folder?

warm arch
#

ahh am i meant to open the root directory?

river hedge
#

try that ye

warm arch
#

hm. no dice

versed pewter
#

correct goto your .minecraft folder and open in vscode

warm arch
#

wait

#

no

#

sorry i didn't save the typo fix

#

lol

versed pewter
#

u sure you ran the probejs in game

warm arch
#

several times!

cyan badger
#

press f1
and enter TypeScript: Restart TS Server

warm arch
#

Nothing :(

versed pewter
#

if all else fails reboot hehe

cyan badger
#

or try restart vscode

warm arch
#

Restarted VSCode as well

#

probejs is generating

cyan badger
#

Developer: Reload Windows

warm arch
#

like i said, if i type something like Item then it does show stuff

versed pewter
#

Mango do you think there is a vscode addin missing?

cyan badger
#

check files in minecraft/.vscode/

warm arch
#

i'll reboot ig just to see. ntellij has definitely done stuff like that to me before lol

#

oh ok one sec

cyan badger
river hedge
#

but it doesn't require it

cyan badger
versed pewter
#

chthonolyne are you editing a .js or .json file?

#

shouldn't matter tho should it

warm arch
#

Ag still nothing

#

yes, a .js

cyan badger
#

Can you screenshot the whole screen?

warm arch
#

I'm working in the autogenerated server script.js rn

cyan badger
warm arch
#

Well what confused me was that things do show up

versed pewter
#

when you ctrl+space do you get a dropdown... yeah thats the list

#

so it does work then

cyan badger
#

ctrl + i?

warm arch
#

just grabbed the probejs addon and noticed this

cyan badger
#

can you send logs?

warm arch
#

yeah, one moment

#

where are intellij's logs?

#

soprry

#

vscode*

#

or do you mean mc logs

river hedge
#

mc logs

cyan badger
#

i mean game log

#

logs/latest.log

warm arch
#

sorry about there mess there a bunch of broken datapacks in there atm eto
it'd be.. weird if that was what was causing issues but

#

let me try loading up a world without them just in case

cyan badger
#

try to delete the line 16 and run command again?

warm arch
#

that's just because of the stuff im testing atm

#

one sec though

cyan badger
#

@warm arch wait a min...

warm arch
#

hm?

cyan badger
#

event name should be item.entity_interact

#

not item.entity_interaction

warm arch
#

there's a mistake in the tutorial

#

but in any case

cyan badger
#

so weird

warm arch
#

dyin here

#

just generated again without the datapacks and still no dice

rocky marsh
#

in 1.18, probe will not generate typings for events which haven't been posted yet, try interacting with an entity and run the dump again

warm arch
#

oh that sounds very much like it could be the cause

#

That's a little evil

#

why does it Do that sobby

rocky marsh
#

1.18 didn't have the fancy 6.0 (6.1?) feature of events being registered, so no way to identify them beforehand

warm arch
#

where can i access the more full docs online?

river hedge
#

source

brazen nestBOT
#
KubeJS Source

Because of the current state of proper KubeJS docs (eta: 5 years) the best way to find all the methods you can use is to read the source code.

Don't worry though, its not that scary! You just need to know the correct things to look for in the correct places.

The buttons below will guide you through reading a bit of source code.

warm arch
#

Alright, thanks

#

so if i want probejs to be any good i should...

#

Open chests, close chests, interact with entities, etc etc, then generate?

#

I feel like this is the kind of thing that should really be in the tutorial as opposed to saying it just works

#

It acts as if when you first set up ProbeJS it will just have all this stuff by default

#

oh.. this didn't help actually

#

recipes works though.. so i imagine that must be the cause

rocky marsh
#

uh, go to the events.d.ts file and search for item.entity_interact?

warm arch
#

Oh wait no it doesn;t work on recipes I'm not sure what I saw that amde me think that

#

This is wack

rocky marsh
#

try restarting vsc guess

warm arch
#

already have a few times

#

is there no like.. collection of pregenerated files for 1.18? even if it's just assuming an otherwise vanilla game?

rocky marsh
#

not that I know of

warm arch
#

how exasperating

#

guess im spending the next hour going down the list and trying to find ways to set off every event soulless

#

as far as the source, i imagine things have changed in 1.19 and up

#

is there a link to the 1.18 source?

rocky marsh
#

kube or probe?

warm arch
#

the github branches are just labelled with ids

#

kube i think?

#

Whichever source is the intended way to get information on the different methods

rocky marsh
#

yeah, use the 1802 branch

warm arch
#

thx

#

ah i see

#

i was thrown off by the numbering

#

but looking at it now i see they are labelled

frail flax
#

uh

#

its item.entity_interact

#

not item.entity_interaction

warm arch
#

we addressed this already it's still broken

frail flax
#

oh mb

warm arch
#

and the tutorial for some reason says to use entity_interaction 😭

#

all good

frail flax
#

odd

warm arch
#

wait omg

frail flax
#

did it show you how to set up probejs too?

#

oh?

warm arch
#

that WASNT my typo i know I copy pasted

#

entity_interation im crying

#

this still doesnt solve my root issue i just think it is funny

warm arch
frail flax
#

how old is the tutorial

warm arch
#

last updated nine monthsa go it's what's recommended for 1.18 afaik

#

i have bones to pick with this tutorial

frail flax
#

??kjswiki

brazen nestBOT
rocky marsh
# warm arch

I hate the old wiki so much
its a horrible mis-mash of 1.16, 1.18, and some 1.19 stuff that its not event woth using expect for the bare basics

frail flax
#

if it doesnt match with the current 1.18 wiki then its wrong

warm arch
#

the probejs tutorial page is from that wiki

#

tbc

frail flax
#

is it in the server scripts btw?

warm arch
#

Yeah

#

The event list is useful but it doesn't include event methods, which is the thing i actually particularly need

frail flax
#

what are you trying to do specifically with the entity interact event?

warm arch
#

i was only using entity interact to follow the tutorial and get a feel for kubejs and javascript

#

the tutorial's example is milking a goat

frail flax
#

i see

warm arch
#

my actual use case is a bunch of different stuff but my test run was gonna be giving players blindness when outside of given bounds

#

then teleporting them ~5k blocks opposite the direction they are facing

frail flax
#

you mean when they're far away from spawn?

warm arch
#

Mm

#

roughly

frail flax
#

how far we talking?

warm arch
#

we have a 6k x 6k map but we use the outside of the map for things so world barrier isn't an option
We used to use world wrapping but Immersive Portals was killing server performance in arcane and dark ways so we scrapped it

frail flax
#

hmm

warm arch
#

I could do this with datapacks but I'm hoping that we can move away from datapacks by using KubeJS scripting instead

#

with a combination of Celestial's fog and blindness I'm replacing world wrapping with dense fog that teleports you to the opposite end of the map when you've boated far enough

frail flax
#

it would probably be a player tick event then

warm arch
#

oh right you cant teleport boats so probably will involve killing the boat entity first, then teleporting the player, then giving them a boat item (or if it's within kubejs' power, mounting them on the boat again)

#

yeah

river hedge
#

wym you can't teleport boats?

warm arch
#

That I recall, teleporting a boat with a player in doesn't work

frail flax
#

he probably means you cant teleport the player while they're in the boat

warm arch
#

she angel

#

but yeah

#

exactly

frail flax
#

oh sorry

river hedge
#

you'd probably need to teleport only the boat

warm arch
#

so are all the events scattered in here? or is there a specific package i need to look in

warm arch
river hedge
#

because riders move with their mounts

warm arch
#

boats are sparkles special

river hedge
#

what if you do both?

warm arch
#

It doesn't
I've worked with it before unfortunately

river hedge
#

oof

warm arch
#

minecarts are a different story but something about how boats are set up makes them an exception

warm arch
frail flax
#

i wonder if its possible to dismount a boat with kubejs

#

btw

rocky marsh
frail flax
#

ah i see

rocky marsh
#

err... dismountRidingEntity() becasue reasons

frail flax
warm arch
#

okay, so just tbc, it is just a matter of trawling that main package

frail flax
#

.stopRiding()

warm arch
#

hella

frail flax
warm arch
#

It's a square bound

#

I'd be very surprised it it couldnt be done though

#

get player position, check if they are between minimum and maximum x / y

frail flax
#
if (event.entity.x >= 5000 || event.entity.z >= 5000){
        //dostuff
    }else if (event.entity.x <= -5000 || event.entity.z <= -5000){
        //dostuff
    }```
#

here we go, this will detect the full square

warm arch
#

where is the list of events in the source?

warm arch
frail flax
#

yea

#

im writing you up a script, sec

warm arch
#

you really don't need to

#

I appreciate it but my other question is more pressing

frail flax
#

what question

frail flax
warm arch
#

Mm

#

So I can see the methods available from player.tick, etc

frail flax
#

oh you mean the methods for player.tick

#

btw your probe isnt working maybe cause you dont have the vsc plugin installed

warm arch
#

I do

frail flax
#

probejs vsc plugin

#

oh

#

its working for me, weird

#

i can link you the github, sec

warm arch
#

that'd be great. I've been browsing it but I can't find the player.tick event

#

Or really where any of the events are listed
I've found PlayerJS but that's for the player object best I can tell

frail flax
#

link me what youre looking at

#

the wiki?

warm arch
#

..no, the github

frail flax
#

yea link me what youre looking at

frail flax
#

ty

warm arch
#

I think this would be best served by a new post

frail flax
warm arch
#

link?

frail flax
#

er no not the github something even better

#
event.player.tell(Object.keys(event.player))```
#

sec ill impliment this into an easy way to see this, this will tell you(could also console log it) all the objects

warm arch
#

hm. neat. You don't need to make anything for me though.

frail flax
#
onEvent('item.right_click', event => {
    const {item,player,item:{id}} = event
    player.tell(Object.keys(event.player))
    console.log(Object.keys(event))
})```
#

i dont mind

#

why do you not want me to make anything for you

#

seems like youre really bent on it lol

warm arch
#

Because I find it more useful to get at the information at the source, as it were :P

frail flax
#

well this is the source

#

try this script out, it will tell you all the object keys

warm arch
#

alright

frail flax
warm arch
#

this was what i had found earlier yes

#

I linked it, actually

frail flax
#

rofl

#

i tried

frail flax
# warm arch this was what i had found earlier yes

heres a working script with some examples of methods being used js onEvent('player.tick', event => { const {player,server,player:{x,y,z,persistentData}} = event persistentData.timer = (++persistentData.timer) % 20 //only runs this once every 20 ticks if (persistentData.timer != 1) {return} if (x >= 5000 || z >= 5000){ console.log('someone is out of bounds!') player.teleportTo('minecraft:overworld',0,100,4990,0,0) server.runCommandSilent('say test') }else if (x <= -5000 || z <= -5000){ console.log('someone is out of bounds!') player.teleportTo('minecraft:overworld',0,100,4990,0,0) server.runCommandSilent('say test') } }) //Initiates timer persistent data on login onEvent('player.logged_in', event => {event.player.persistentData.timer = 0})

#

if their x/z coord is more than 5k then they'll get teleported to a specified location, you can also run commands if that makes it easier for you to manage

warm arch
#

Neat

frail flax
#

the teleport method is actually in there on that page

warm arch
#

it is, yes

frail flax
#

though its really .teleport(dimension,x,y,z,yaw,pitch)

#

ye

#

is probe still not working even in the events i sent?

frail flax
# warm arch it is, yes

watch this first tutorial i send you, skip to like 30 seconds in where it talks about how to install probejs, maybe theres a step you skipped without realizing itpeeposhrug

#

??tutorial

brazen nestBOT
frail flax
#

the custom blocks/items/effects

warm arch
#

gonna generate off a clean game as discussed in the other thread