#Script API General
1 messages · Page 100 of 1
oh it does impact performance. but really, it depends on your ways of obfuscation and how big the codebase is.
personally, i am not much of a fan of obfuscation.
but that's my opinion.
it doesn't export dimension
it exports a method to get a dimension tho
do this:
const overworld = world.getDimension('minecraft:overworld');
make sure to import world at the top
import { world } from "@minecraft/server";
Ohh ok
(or at anywhere, just before you use it)
One thing. Avoid running commands from script api as much as possible. It introduces an extra overhead as opposed to running a dedicated script api function for the same result
This works?
Idk i uhh try to grasp stuff
nope
you need to learn the basics of javascript first
i'll teach you some rn
So uhh how should i format it(u can answer this later if u want)
firstly, you can initialize let, const, and var with some value as so:
let someProperty = 23;
let, and var don't need an initial value and can be changed later.
const needs an initial value and cannot be changed later.
let, and const are scoped to their braces. for example:
try {// <-- braces
const someProperty = 83;
/* end of braces scope -->*/} catch {
}
console.log(someProperty); // fails, because it is not in the same scope, therefore you can't access it.```
So for example
Const is constant right? So like
Assuming i need it to set some property the const can be used to keep a property or smth constant
var is scoped to it's function.
for example:
function coolFunction() {// <-- function
const someProperty = 93;
}//<-- end of function
console.log(someProperty); // fails, because it is not in the same function scope, therefore you can't access it.```
yup
you can't change it's type
What about console.log?
Hmmm
i'd use console.error if you wanna make it always log regardless of your console level.
For creator gui right?
yeah
if you want, i can send you a free and good javascript course. it's on youtube.
Btw can run command work without dimension part?
Sure
eh
not really
you need a source
either an entity or a dimension or a command block
Can player be one?
and dimension is the most stable source to run commands on
yeah
the player is an entity
and so are simulated players.
So this is goods?
nope, time for the next js basics
functions and rest paramaters (cuz why not?)
Ye sure
I barely know functions lol
I think they are like pre animation from rp
say you have function like:
function openGripMenu() {
source.runCommand('say grip');
}```
you want to give it dynamic access to source, but how? you add a parameter.
```js
function openGripMenu(source/*<-- parameter*/) {
source.runCommand('say grip');
}```
nope
they are normal javascript "things" that help in modularity and keeping code clean.
Functions are basically things that allow you to input something and get a result.
then to call.
import { world } from "@minecraft/server";
function openGripMenu(source/*<-- parameter*/) {
source.runCommand('say grip');
}
world.afterEvents.worldLoad.subscribe(() => {
const overworld = world.getDimension('overworld');
/* this calls the function(runs) "openGripMenu" we defined --->*/openGripMenu(overworld/*<-- call the function with the paramter you want to give it*/);
});```
What to put on parameter part?
read the comments
I'm trying to make an attack system triggered by data event entity trigger and will be used by most of my custom entities will that be a big impact to performance issues?
eh, probably not
event based things are very performant.
So after the overworld part
I put function openGripMenu?
bro
So meaning if used by 100 entities it will cause lag issues
i'll make the comments more descriptive
yeah but it's impossible to have 100 entities get attacked in the same tick, at least under normal gameplay
plus if you optimize everything to be minimal, it wouldn't be much of an issue.
Sorry
I kinda get how it works but its just how to write it or smth
@chilly fractal can you give me a example of how to write the comments part
// single line comment, anything that comes after (on the same line) is considered a comment and cannot be escaped. example:
// e?
// multi-lined comment, anything between "/*" and "*/" are considered a comment, examples:
/* hi
hi
hi
hi*/
/*hi2*/```
i'll send you the javascript course
it's long but very, VERY important
Got it
Sure
and will pay off in the end.
Ight
Rip
What should i add it there?
just watch the course i sent you
you don't need to watch it all in one sitting
but make sure to watch it all or at least half of it.
and also i gotta go
cya
Aight
oh yeah
i gotta say something
it's a normal javascript web APIs course
but you can use the basics that are purely javascript in any javascript enviroment like nodejs and minecaft's quickjs engine.
anyway, ima go now
Heyyo you're back...
does the beacon beam have a typeId?
can i change an entity's component group using script api
can i use trigger event?
You can trigger the event related to it
alr thanks
no
does stringifying an entity and parsing it would work inside dynamic properties?
use structureManager
those objects are just instances to represent the entity
structureManager? can you lead me to some docs about it?
I've used structureManger before but I believe that one is for structures
its the script-api way of /structure
what?
oh yeah
/structure
I mean that could work too
is there any other methods?
uhm, how do u wana use the entity as data?
why do you censor script when it's literally the only normal part of addons
has anyone that has done profiling recently recall if
.getComponent(ENUM.X)
has much performance impact?
trying to think of an event-driven way to make sure player has required level for equipment, but I am concerned about checking 5 times every time a hitEntity event happens. My profiling shows 0ms but am not able to profile to fractional ms.. expecting about 20 players to be running this check at any given time. I would be checking mainhand of attacking entity, then equipment components of each slot for the receiving entity.
wish we could run deno profiling for bds lol
calling a variable sure does cost more than using string
interesting -- I would assume that is because JS does not support true enum / union types?
maybe..
its just taking the value string or enums are same on it
yeah makes sense. I guess I assumed it would be the same cost since it should just be referring to a memory location that has the string, but it really depends if it is stored on stack or heap
or if it is doing PBV or PBR
it might have a minor performance impact, for scalability I would stay with enums
More by 0.000001 ms
every little bit counts 😛 I already am using a good bit of performance budget with http / database handling
not that it would ever be noticeable to a player probably, but usually there is always a way to get something to work nearly perfectly
First you need to optimize more serious things
I get what you are saying but there is a 25ms network delay with http that is not avoidable
btw, u can store the component object in a map for brute executions
when would be the appropriate time to store that though? because it will not refer to the current component if they equip something else
what are you using on back-end site?
using getComponent() a lot is also expensive
postgres database
It's strange that it takes so long to generate one request.
framework?
that's just the end-to-end time. the actual request is not that slow but the time anything is received back is. it ranges from 25-55ms because we can't use websockets
so a new connection is established every time
keepAlive on the backend doesn't seem to care
How do you measure time?
deno/oak
when ur gona trigger a lot of methods in just a few ticks...
I think we are working on pretty similar systems
I am using Express.js with Clustering and MongoDB + Redis for storage
😅
I also have a go version of the backend but didnt see any benefit for my case
I'd keep it simple, then w8 for it to break. then do the compact coding
otherwise keep it simple
meh I have the time to test and tweak until it's good. this is my only non-work project atm
date.now() before http request
date.now() after promise is resolved - first one
I thought so..
Did you know that when you do await minecraft leaves it for other ticks. It won't pause the whole game just to wait for a response from the server
So your 50ms don't create that kind of load.
yes, but the point I was trying to put into words was that there is still a delay from when the player sees the result. for example when they open their bank, or switch bank tabs, etc, the menu can't update until it has received the item data from backend
and I don't want to cache within scriptAPI
why?
because there is a memory limit
use Redis on back-end like me
Do you have megabytes of variables there?
I need to check this limit by the way...
its 200mb. and no, not currently storing that much, but in the long term it could be so planning around that
sec lol
const a = performance.now()
const players = database.database.prepare("SELECT * FROM players").all();
const skills = database.database.prepare("SELECT skill_name, level, current_xp, remaining_xp FROM player_skills WHERE ID = 1").all();
const b = performance.now()
console.log(`${b - a}`)
0.05379999999999541ms
ignore database.database
just crap testing code
Ohh thats Cool, I also tried this ince but gave up because im stupid and will never achieve this type of smartness
packet size comes out to about 2kb counting headers for entire player profile not counting items. but multiply that by player count, then 800 items in bank per player, then auction house system, etc, is why not caching within minecraft JS
why not make it like
["mining", 1, 0, 83]
I could, just threw this together yesterday, still havent optimized the packets
player skills do get cached on the minecraft side though. just loaded once on login
then player['skill_name'] to get level etc behind a function
export function skillMenu(player: Player) {
let skillMenu = new ChestFormData('single')
skillMenu.title('§l§5Skills')
SKILL_DEFINITIONS.forEach((skill: string[], index: number) => {
skillMenu.button(index, `§l§6${skill[0].toUpperCase()}`, [`Current XP: ${player[skill[0] + "_xp"]}`,
`XP Remaining: ${player[skill[0] + "_xp_r"]}`], `${skill[1]}`, player[skill[0]])
})
skillMenu.show(player).then(response => {
if (response.canceled) return;
world.sendMessage(`${player.name} has chosen item ${response.selection}`);
})
};
do you care about back-end performance that much, so that's why you're not using any ORM or you're not familiar with any?
you gotta bind
Compress them lol, would work pefectly, use LZ like algorythms
I just dont see the need for ORM to be honest. the code i put above isn't how I will be doing it on the final version. it will have prepared statements ready to go that just take the params in the function call
the code normally understands this.stuff, when passing as callback, without the 'this'
so you gotta bind it to the instance
weird functionalities of js
but its what its
Not really, its the logic i think
it provides a bit better with DX with databases tbh
yeah it can. I've used LINQ a lot in the past and it was nice, but once upon a time I tried to force myself not rely on having something like that so almost just prefer raw statements now I guess
you know that sql has jit and everything right?
and orms dont mess up with performance
they just build a query
has a small overhead but nothing that will make the code slow
good to know. part of the reason though is that a lot of my past projects have been in different languages so never really bothered to learn one single ORM because there's been a few times it wasn't available for X language
generally the drivers are supported by any lang you can think of
but if theyre not
rust is the main offender lol
in theory you can make your own
the db server is literslly a server that waits for requests via tcp
they make a minor difference, but still they're really good
so you can simply make some requests with the query as the content
and in theory it might work
yeah, usually I would try to program with some adapter pattern so the backend wouldn't matter, just have been very lazy about it this time around 😦
minor = more chances of you fucking the code due to not knowing how to optimize it than the orm itself
i'll try it since the backend is still in early stages, any recommendations?
they are good now, but they werent a few years ago (rust ORMs)
of orm?
yes
im using drizzle for a webapp im doing
i think it's pretty straightforward
theres prisma and typeorm
well, im just talking about ts orms
normally i'd use seaorm, but its for rust
thanks. I'm not up to date on what people use these days. my peak of learning libraries was 10 years ago when I had to for work. It was exhausting keeping up so have just stuck with what I am familiar with, i'll check them out
neither i. im a system programming guy, im just learning about fullstacl because i found a jov interview which requires so
still raw query is faster
uhg good luck. I thought about switching to a webdev job a while ago but ended up just staying put. so many requirements on the job postings for different stacks. I currently do cybersec for DOD
I am not using raw queries but ORM's will always be a bit slower than raw queries
you got what i meant
there are more chances that we as developers make the code slow than an orm
bit slower but 99% of the time doesn't matter for a db server
yeah
will say, have been a bit impressed with the quickJS engine minecraft uses. was expecting bottlenecks all over but haven't really found anything deal breaking
im very triggered due to the fact that a lot of stuff on js community are simply implicit
yeah you pretty much had to learn the current stuff in school and have done it as a hobby for real projects the entire time then have some solid work to show for the interview it feels like. feels like it would take more time to catch up than it is worth
web dev is pretty hard for beginners, especially learning all more stuff when it comes to learn NPM + back-end services
it's easy if you pick one thing and stick with it. the problem comes from the "one thing to know" being different every year today
if PHP was still mainsteam in the US i'd be all over it lol
you have to learn new JavaScript framework every 2 weeks
just joking, but you have to move from one framework to another every few years
I am glad that PHP is dying
😃
every gov and uni site still using that shit
if I would eventually start working for government or any university, I would rewrite every site without using WordPress and jQuery
🤮
lmao
you just stated why you will not get hired in those
in DOD its all contracted out now anyway
which has the amazing side effect of them never understanding our actual requirements. at this point it feels like its intentional so they can keep the money tree alive
I wanna spawn it
i think the worst is that no one explain the "why" of things
and how things work
instead they just show how to use it
i like understanding what in hell is a state on react
its better than simply "oh const[state, setState] = useState(0)"
and thats all
but the concepts on the web their self is pretty simple
seriously i did struggle more learning about Arc in rust
and deadlocks
yeah, you get to know these things after coding for a bit of time
no one has ever told me that it's a val/setVal arr returning function that is calling also render every setVal call
information like this is also giving a lot for newbies tbh
i really wanted to emit the re render by my self
getting to know framework, library or even an entire language is making you a better programmer in thic topic
to batch stuff
but when I have design with UI/UX checked I can actually implement it
that just piss me so much
when talking about backend i rewlly dont think stuff are complicated
#[pin_project(project = MapProjection)]
pub struct MapFuture<'m, F: Future + 'm, O> {
#[pin]
future: F,
output: PhantomData<O>,
mapper: Option<BoxedMapper<'m, F::Output, O>>,
}
impl<'m, F: Future, O> MapFuture<'m, F, O> {
fn new<M: Mapper<'m, F::Output, O>>(future: F, mapper: M) -> Self {
Self { future, output: PhantomData, mapper: Some(Box::new(mapper)) }
}
}
impl<F: Future, O> MapProjection<'_, '_, F, O> {
fn map(&mut self, input: F::Output) -> O {
(self.mapper.take().unwrap())(input)
}
}
impl<F: Future, O> Future for MapFuture<'_, F, O> {
type Output = O;
fn poll(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Self::Output> {
let mut projection = self.as_mut().project();
let maybe_ready = projection.future.as_mut().poll(cx);
maybe_ready.map(|input| projection.map(input))
}
}
this was the worst for me in rust. manual futures
back-end is easy if you're familiar with language and database stuff
the only thig i struggle is login
it took me few hours to implement my first auth system
because no one explains what the fuck is oauth2
that's another thing that you're getting to know on your own
why not using tokio or async std?
I think all of these YouTubers are trying to make their tutorial as hard as possible to make people quit programming
same
but hey, our salary is even higher then!
just wanted to understand how it worked in the background. I use tokio today
"copy my code and trust 👍"
thats one thing i might make as well to understand
ur favourite poli... indian guy is back
all indian coding tutorial videos: https://youtube.com/playlist?list=PL6UWhLpTFLr99Ximb_KRLa9X7HyKQTpy-
i forgot how its laughing on english
but i laughed a lot
yes
most courses/tutorials, and even school does that
no need to explain it
just do this and voila there you go
then on exams all you have to do is memorize
and move on then forgot
no need to explain why it happens why you do that, why is this part important, it's all just do this and it will work
it's frustrating
gotta agree
my math teacher, when i was on 11th grade i guess(here on Brazil the system is different so im using some equivalents)
he simply used to teach "logic"
by doing that you said
i wnated to understand what an equation meant and why is that the way it is
he literally said "i think you might ask math itself then"
that's infuriating
I also got blessed by a teacher that's opposite he teaches some script/coding stuff and math, and was very in-depth however, every single one of my classmate and as well as other section he handles hated him for that.
man...
teenagers are idiots
generally people dont like studying
well, here in Brazil thats the norm
the thing is that, math, coding and that stuff is complex
I feel mentioned as an idiot in this message
nobody wants to face the truth that "hm, im dumb as hell"
i mean in general and based on what i live
if you think that doesn't apply, then it wasnt meant to you
they don't feel that sense of accomplishment once you solve a problem or a bug
i almost die due to dopamin overdose when that happens
LOL
in Poland the same
Simulated players seem to be scared of ladders being on the top most block.. I had to remove the top ladder for them to climb on it.
Learning the perspectives of why our mistake are dumb is what sparks development. If I might add
Then did u try the structureManager already?
Do someone know how to keep the player able to place block on top of one with onPlayerInteract custom component?
not possible
Hold crouch then put it on it
Im really mad now... thx
how do you set a skin to simulated players?
I don’t know
I’m trying to figure that out
test.setSkin({
personaPieces: [{
id: "",
packId: "",
productId: "",
type: PersonaPieceType.Skin,
}],
armSize: PersonaArmSize.Wide,
});```
This exists but you need the id, pack id and product id as they’re all required but I don’t have a clue on where to get those ids from
you can get your own skin data with getPlayerSkin
import { getSkinPlayer } from "@minecraft/server-gametest"
const foundPlayer = world.getAllPlayers().filter((player) => player.name === "your-name")
if (foundPlayer) test.setSkin(getSkinPlayer(foundPlayer))
What about for custom skins though?
This is just for using a skin that already exists within the world
maybe it can use some workarounds like if your just doing it solo change your skin temporarily and get that skinID then apply it to the simulatedPlayer
not sure
you have to know it's pack identifier, product's identifier and general identifier
how to get that tho?
Fr
That doesn’t help me.. I can tell what it requires from reading it (not trying to sound like a dick)
i assume packId and productId is meant for marketplace skinpacks
you can't really get it dynamicly [without using some API or other stuff]
😭 🙏
welp.. setSkin didn't work on the simulated player
Is there something other than playerLeave to run code when the host leaves the game? I am trying to remove entities on leave yet nothing i try is working. I've tried doing it in the afterEvent and also the beforeEvent with a system.run() call but I assume they're both running too late for me to do anything to the world. The same code works when running from a command so it's definitely related to when it's being called
i have resorted to creating a ticking area and removing the entities in the first playerSpawn(), even worldLoad after event doesn't work (despite it supposed to be running after the world has started ticking)
Are you aware of the "minecraft:transient" component? @somber sundial
I did not but that's exactly what i need. Thanks!
i just learned that you can write new properties to a class instance
You mean Object.prototype
Or Object.defineProperty ?
with server net would it b possible to create an ai in minecarft chat?
i mean
block.whatever = 5
you could call it later with block.whatever
Yes, either yiu use the net module or you create your own Neural Network and Train it
Ah i see
never seen someone do it tbh
ill add it to my list of projects
One has already done it
I did if as well but i failed
oh nicee
block.isSolid when?
never
their plan is to eventually split it up into what it actually represents
e.g. .isBreathable, .isSpawnable, .isRedstoneConductor
?
I doubt it will ever exit beta
probably
^^^ ?
Trapdoors, carpets, torches, light blocks, plants etc.
isSolid does exist in beta but don't expect it to exist forever
a lot of them would be
a lot of us will be jumping for joy once we see playerHurtBeforeEvent 
it honestly might scare the devs 🤣
Or player saturation component
we have access to saturation now no?
Beta
oh yeah, well that was recent so it'll be a pretty while before it becomes stable
i mean i'm quite surprised beforeChat still isn't stable yet
not sure why that's taken so long
y’all making me double check everything
It's too powerful for stable folk
i'm checking myself lmao
Im literally looking at your site rn lol
Block entities vs block dynamic components
Which would be better..
Diff usecases i believe
I thought you said dynamic props for a sec there.. I was about to say lmao
both are needed but you really can't compare them lol
Trying to remove all monster entities within a volume, and this is executing, but not picking up any monsters:
const eqo = {
families: [ "monster" ],
location: pos1,
volume: pos2,
};
for (const entity of dimension.getEntities(eqo)) {
world.sendMessage("Entity Removed");
entity.remove();
}
The "entity removed" never shows up, so that's the part that isn't executing, but I dunno why.
I made sure to put some monsters in the area
I haven't but I've read the documentatio and yes it's doable
however
I just need for the interacted entity
if in case I save a entity in that location and somehow there's another entity in there it would save 2 of them instead of just the interacted one
so it's doable but not the solution
Good point, now with the concept of array.filter u now have the entities list, replicate the copy elsewhere and reduce it to one then save that specific entity, officially
U can separate em by tags or dynamic property, they get saved as well
who know how to detect bow hit ?
projectileHitBlock, projectileHitEntity
thanks
world.afterEvents.projectileHitEntity.subscribe(({ projectile, hitEntity, damagingEntity }) => {
const wifmatscore = world.scoreboard.getObjective("kit").getScore(damagingEntity);
if (wifmatscore === 29) {
if (Math.random() <= 1) {
hitEntity.applyDamage(999, {
cause: "void",
});
}
}
});```
when i get the projectile it i had a error
and i try like this but it didnt work
what's the error
nvm
@shut vessel
world.afterEvents.projectileHitEntity.subscribe(eventData => {
const { projectile, source } = eventData;
const target = eventData.getEntityHit().entity;
if (!source || !target) return;
const wifmatscore = world.scoreboard.getObjective("kit").getScore(source);
if (wifmatscore === 29) {
target.applyDamage(999, {
cause: "void",
});
}
});```
also
Math.random() <= 1
doesn't make any sense since it will always be true, Math.random() generates a number between 0 and 0.9999
does anyone know if the new shelves use the BlockInventoryComponent?
you can check with hasComponent
yeah ik, but i can't really do it rn so that's why i asked
it does not
also why do chiseled bookshelves not drop anything lol
okay then
is there a script for making damage area something?
just use Dimension.getEntities() with the filter
no i wanna create like a dmage area like the how the create explosion works
but you can do it the way i said
will it be performance heavy?
cause most of the entities will be using it
define the location, and the maxDistance
i don't think so
it should be fine.
what if a hundred entities is using it?
well
i wanna optimize it so that it wont cause lag issues
you are going to get lag then, no doubt.
100 entities would cause lag alone anyways
you can always just implement it via the entity.json iirc
the reason im using this is because the delayed_attacking component behaviour has this bug regarding collision issues when the entity is too close it doesnt detect it as delayed_attacking thats why
if you want an explosion, you could disable it destroying blocks in the method.
if thats the issue
maybe you want a custom particle
im making a more accurate attack system that doesnt require path finding thingy
What name event blockBreak in api 2.0.0-beta
2.0.0 is no longer beta.
playerBreakBlock
In 1.21.81
well, its best to assume everyone is on latest.
But how to make it automatically added to inventory when mining a block?
why not just stringify and parse the entity object and save it to dynamic properties?
No.
try parsing it in log.
Look what's only accessible
same goes to itemStack. itemStack returns {}
also stringifying it lost lots of data.
and no you can't spawn entity by parsing it since spawnEntity requires STRING
Hence, Entity.prototype.clone() when
What does source.runCommandAsync do?
Sth similar to ```js
system.run(() => d.runCommand('say hi'))
runCommandAsync is deprecated
runCommand still works?
yeah
Dimension: Removed runCommandAsync as most commands did not actually run asynchronously. If you are looking to run a function asynchronously, please investigate using Jobs via System.runJob
from scripting 2.0 release
it can be done wherever you want in code
Mm k
@rustic ermine sorry for ping
One last
Does runCommand work like tick.json or it only runs the command once?
the command itself only runs once, but that does not stop you from making it run like a tick
system.runInterval(() => {
player.dimension.runCommand(...)
}, 20) //Once per second
etc
How do I get an array of blocks from an area similar to full but only returning an array of blocks that I can edit after
?
that would be nice.
Documentation for Script API - v1.21.90 | A BlockVolume is a simple interface to an object which
represents a 3D rectangle of a given size (in blocks) at a
world block location.
Note that these are not analogous to "min" and "max" values,
in that the vector components are not guaranteed to be in
any order.
In addition, these vector positions are...
But how to make it automatically added to inventory when mining a block?
How do I make things comma separated but if there’s a space, ignore it like eg. “hello,what, bedrock, end, hello what” = [“hello”, “what”, “bedrock”, “end”, “hello what”]
const my_string = "hello,what, bedrock, end, hello what";
const new_string = my_string.replace(", ", "§T").split("§T")
what?
This makes no sense
Please explain
what doesn't make sense about it?
What is §T??
a placeholder for the split that would not naturally occur in a string
How does that remove spaces after commas?
There’s no code that does that in there
because it replaces all ", " with §T, then splits at the §T and returns a string[] without any §T
Problem: I could just do comma with 2 spaces
probably a way to regex that but I dont have time to mess with it atm sorry
How do I make things comma separated but if there’s a space, ignore it like eg. “hello,what, bedrock, end, hello what” = [“hello”, “what”, “bedrock”, “end”, “hello what”]
But why
Why not have them input \n for new lines, if that’s your goal
Comma is simpler
How do I do this (with commas)
const my_string = "hello,what, bedrock, end, hello what";
const new_string = my_string.replace(/,\s*/g, ",").split(",");
What’s this?
regex
Ok Lemme try
textField.split(/(?:\s+|),(?:\s+|)/)
use before events player break block, cancel block break if you're in preview you can check the loot with the API Loot manager and get the item stack it returns based on item used and block mined and give it to player using addItem, but if you're in stable version use loot command
So how does it work on enchant fortune > 3
Loot command doesn't have an option for that.
The API version only
So is there any way?
Send the code, I can't just assume it especially it was cut off
import { world, system, Dimension } from "@minecraft/server"
import { ActionFormData } from "@minecraft/server-ui"
let ui
let customUi;
world.afterEvents.worldLoad.subscribe(() => {
ui = new ActionFormData()
.title("Form")
.body("")
.button("Balls")
customUi = new ActionFormData()
.title("Skibidi")
.body("")
.button("Grip")
});
world.afterEvents.itemUse.subscribe(({ source, itemStack }) => {
switch (itemStack.typeId) {
case 'ssia:attachment': customUi.show(source).then(({ canceled, Selection }) => {
if (canceled) return;
switch (source.selection) {
case 0:
source.runCommand('say Grip Equiped')
break;
}
})
}
});
Noo, you don't need to put it source.selection put it as Selection
same how you used canceled
Ight i edited them
After that?
That's all.
The case 0 is ok?
So if i press
The first button will it trigger case 0?
yes. It's index-0 based
If u want ehh
I can wait too
If i add a second button
And make case 1
Will the 2nd button trigger case 1?
Sorry for these uhh
Dumb questions
😭
Yes that's correct
W i see
There is no such a thing as a dumb question
That's how we learn, you will be stuck without knowing otherwise.
Yeah😭
Im kinda worried yall would call me dumb for these basic ahh problems(on yall atleast)
@jagged gazelle uhh sorry for ping
What now💔
Wym canceled is not defined
wha?
I hate that I'm starting to like AI for tedious things
I think this is problem
Should i uhh add a space on it
CS grads is cooked now i guess
world.afterEvents.itemUse.subscribe(({ itemStack, source: player }) => {
if (itemStack.typeId === 'minecraft:stick') {
customUi.show(player).then(({ canceled, selection }) => {
if (canceled) return;
switch (selection) {
case 0: break;
case 1: break;
}
});
}
});```
It also gave me specific examples of how certain things in scriptAPI perform, and gave a full breakdown of why. lol
I think i removed the canceled part here💀
i added an equippable cmponent in my entity and when i used script api to access the equippable component it says its undefined
since when did lore got updated to max of
100 lines and 1000 string.length
#1067535608660107284 message
thanks ill use commands
you can't access it...
I loathe mojang
Been awhile
const hmm = (raw) => new Proxy(raw, typeof raw == "function"
? {
apply(fn, thisArg, args) {
console.warn(fn.name, args);
return fn.apply(thisArg, args);
}
} : {
get(n, k) {
console.warn(k);
return n[k]
}
})
this is doable it seems
Documentation for @minecraft/server
why stirante?
Because I like his.
1-21-70-Spring-to-Life
use https://searchlog.beyondbedrock.org/ to look it up
I dont understand why my runcommand wont work
world.afterEvents.itemUse.subscribe(({ source: player, itemStack }) => {
switch (itemStack.typeId) {
case 'ssia:attachment': customUi.show(player).then((
{ canceled, Selection }) => {
if (canceled) return;
switch (Selection) {
case 0:
system.run(() => Dimension.runCommand('say Grip Attached'))
break;
}
})
}
});
how can i make my custom entity react with playerinteractwithentity
i already added the interact component
Can we not check if a block is replaceable if via the script api?
maybe dont use Dimension
use player.sendMessage instead or world.sendMessage
is it possible to disable the bundle interaction? the drop on interact?
Hey guys, so I want to summon an entity and giving it a tag at the same time any ideas how can I do that?, I tried to look in dimension.spawnEntity for perhaps any answer but I couldn't find a way to add a tag to a mob spawned through script.
Dimension.runCommand(`summon ${type} ${Math.floor(Location.x)} ${Math.floor(Location.y)-1} ${Math.floor(Location.z)-1} 180`)
const {itemStack, source} = e;
mc.system.run(() =>{
if (itemStack && itemStack.typeId == "tm:mob_container") {
sc.print("clear");
}
})
});
why the heck does this cancel bundle interaction?
SpawnEntity returns an Entoty instance so you can add a tag to it.
I can no longer drop items somehow on use
is this a bug?
oh I am going to try it rq
mc.world.beforeEvents.itemUse.subscribe((e) =>{});
this disables bundle on use, why??????
bug?
am I missing something?
@wary edge Hey, (I apologize about the ping)
Dimension.spawnEntity(`${type}`, {x: Math.floor(Location.x),y: (Math.floor(Location.y)-1),z: Math.floor(Location.z)}, {initialRotation: 180})
For some reason, it doesn't spawn the entity anymore
Hmmm
Now you said that
Maybe say command doesnt work with run command?
what's the error?
It doesn't spawn the entity anymore, for some reason when I used runCommand before it worked
there should be an error output with that
open the console
it doesn't say anything tho
btw, just to be sure, the entity identifier should be in string right?
yeah
"minecraft:zombie"
btw, is initialRotation in spawnEntity new? (I am asking this just for the possibility that my script isn't update it enough)
Yup that was the problem
bruh, but I don't want to use beta, hmmmmm
perhaps I could change its rotation by teleport
thx for the help btw
let entity = Dimension.spawnEntity(type, {x: Math.floor(Location.x), y: (Math.floor(Location.y)-1), z: Math.floor(Location.z)})
entity.addTag(`${hitEntity.getComponent('minecraft:projectile').owner.name}`)
console.warn(entity.getTags())
hmmm, for some reason it doesn't give the tag
If I recall, you need to wait 1 tick before calling getTags
and how do I wait 1 tick?
system.runTimeout(() => {}, 1)
oh thx
still didn't work
using itemUse disable the bundle.
lemme guess you used it form the import? If yes that ain't gonna work. instead use actual dimension... source.dimension.runCommand()
The ones with capital letter?
So...
player.dimension.runCommand?
its O(n)
its slow as hell
verifying for each entity on the world and seeing if theyre in a radius will suck
i got no idea on how to solve that but for sure i'd use what you said as a prototype
can always just try adding more delay until it works and see if it's consistent
you did put the console.warn inside of the timeout function also, right?
Hey, it actually worked man thanks!, it turns out there was a bug that somehow prevented the timout from running
Thanks man, it worked
WHY
I dunno...
wth
that's clearly a bug
@wary edge can you shed some light on this?
how can i make an entity target another entity
like for example i will command a zombie to target this specific player using custom commands
using script api
like i want my entity to go there
yeah i also know that but idk if its possible to set a target
imagine if all the community worked on one project
it would end up being a stressed mess
everyone has their own way of doing stuff and would just get tangled in with each other
I love how this is already discussed before (that includes me there)... It wouldn't work too btw, this type of thing already happened before and 10 members per group is already a mess, having more than that would be bad.
I forgot what JAM was that
Things happens for unexpected reasons,
but perhaps another JAM for everyone... 👀
Installation for @minecraft/server-net
Beta API module install:
npm i @minecraft/[email protected]
Preview Beta API module install:
npm i @minecraft/[email protected]
Hey guys,How do I detect a tag that starts with 'pd:' for example?
list of player's/entity's tags that start with pd:
wdym?
player.getTags().filter((tag) => tag.startsWith("pd:"))
list of every tag that player has and they have to start with pd:?
Tysm so much!
Hey guys
would anyone be so nice to help me with a Script?
I need a Tick Scheduler.
It should be able to register intervals or timeouts.
// e.g
const scheduler = new TickScheduler()
scheduler.interval(() => {}, 5) // returns an ID
works like basically like system.runInterval
but its different.
it contains scheduler.tick()
its a clock.
so i can easily stop executing .tick and the game will be paused.
I need this for my game
I need it to be optimized. not just an array with data. more like a bucket maybe
or some other algorythms
I'd appreciate any help
So you basically need the ability to pause runInterval?
pause/continue for runInterval and for runTimeout
I will make a script resource
Thank you, some human i guess*
yeah the last time there was a JAM here I was a beginner that was last year?
})
})
}
W
Thanks
Erm what the sigma?
It should open the ui
import { world, system, Dimension } from "@minecraft/server"
import { ActionFormData } from "@minecraft/server-ui"
let ui
let customUi
let scarUi
world.afterEvents.worldLoad.subscribe(() => {
ui = new ActionFormData()
.title("Form")
.body("")
.button("Balls")
customUi = new ActionFormData()
.title("Skibidi")
.body("")
.button("Grip")
.button("Scar H")
});
world.afterEvents.itemUse.subscribe(({ source: player, itemStack }) => {
switch (itemStack.typeId) {
case 'ssia:attachment': customUi.show(player).then((
{ canceled, selection }) => {
if (canceled) return;
let response = selection
switch (response) {
case 0:
system.run(() => player.dimension.runCommand('say its working'))
break;
case 1:
scarUI(player)
break;
case 3:
system.run(() => player.dimension.runCommand('give @s minecraft:diamond'))
}
})
}
});
function scarUI(player) {
world.afterEvents.worldLoad.subscribe(() => {
scarUIform = new ActionFormData()
.title("SCAR H Attachment")
.body("")
.button("Test1")
.button("test2")
.button("test3")
.button("test4")
.button("test5")
scarUi.show(player).then((
{ canceled, selection }) => {
if (canceled) return;
let response = selection
switch (response) {
case 0:
system.run(() => player.dimension.runCommand('say your sigma'))
}
})
});
}
Help pls
Wait
why would you set a worldLoadAfterEvent inside a function lol
For UI to load
you don't need those privileges to create an ActionFormData instance afaik
also player.dimension.runCommand("give @s diamond") won't work, just do player.runCommand("give @s diamond") or use native methods
I see
Bro wtf.
Ya
Worst script coding ever asked to leave #1067535608660107284 😭
import { world, system, Dimension } from "@minecraft/server"
import { ActionFormData } from "@minecraft/server-ui"
let customUi
let scarUi
world.afterEvents.worldLoad.subscribe(() => {
customUi = new ActionFormData()
.title("Skibidi")
.body("")
.button("Grip")
.button("Scar H")
scarUi = new ActionFormData()
.title("SCAR H Attachment")
.body("")
.button("Test1")
.button("test2")
.button("test3")
.button("test4")
.button("test5")
});
world.afterEvents.itemUse.subscribe(({ source: player, itemStack }) => {
if (itemStack.typeId !== 'ssia:attachment') return
customUi.show(player).then(({ canceled, selection }) => {
if (canceled) return
switch (selection) {
case 0:
player.dimension.runCommand('say its working')
break
case 1:
scarUi.show(player).then(({ canceled, selection }) => {
if (canceled) return
if (selection === 0) player.dimension.runCommand('say your sigma')
})
break
case 3:
player.dimension.runCommand('give @s minecraft:diamond')
}
})
});```
Ohh so i put the ui on
World.afterevents that i made before
So how do i add functionality for the scar ui?
literally check case 1:...
Ohh ok
Can i make more if selection?
yes.
if (selection === 1) run whatever i put in here?
W
Wait.
I'll make it cleaner because using switch inside of another switch is ugly ash
-# shh
@jagged gazelle it works now lol
Ill keep ts i guess
I made this a bit flexible, a lil bit long but it works lol...
the buttons have two required things, the name of the button which is text and funct... You use the name you put in funct to be used in the buttons_funct to adjust what it runs.
Funct? Is it functions?
that's just custom name I did.
I guess it's better you don't use that lol
uh... why is the ui in world load
But currently i need smth that works💀
So ill be sticking on the ones i currently worked on
Ye
My release schedule is wayy off now because of ts💔
hasn't this happened before?
like
some guy opening a ui with a blue apple and thanking coddy
Thats me
This ones diffrent
Basically second menu
The first one is to test functional button
Dead in the water unless I can solve either of these.. trying to mimick OSRS combat, which I have done with scriptAPI, but two entity related issues make it feel awful and wondering if anyone has a solution.
- Knock back Resistance component does nothing on the player. Makes my combat system feel awful when the player is in a timer based combat loop but gets thrown back every time enemy hits.
- If 1 is not solvable, trying to get an entity to pathfind into melee range then fire an event for script to read.. which I understand is not possible, so thought of maybe having them get into melee range then fire invisible projectiles so script can detect the collision event. That one is easy but feels weird and has the side effect of the enemy being able to "miss" outside of the normal damage negation calculation
Any inputs or recommendations? Wish we had more entity script control but meh. Is almost deal breaker enough considering going back to Java 😵💫
solution: wait till mojang add entityHit beforeEvent
Don't want to rely on that because I've been waiting for that since scriptAPI first released lol
doesn't .some method in here works same as .filter in this case?
yea its cool you can save stuff in it like a variable
im pretty sure .some returns an boolean
since when do we have skin apis
Simulated players, afaik it's not for the actual players
.getSkin should work for normal player tho right?
No, some returns a boolean
Filter is returning all elements that are returning true for applied function
is there a way to cancel damages? since theres no god dayum beforeEvents for entityHurt
😭 why
or if i just want to disable every player vs player damage?
WITHOUT weakness effect
uh, is it possible to do camerashake using scripts? like without runCommand it?
No.
alright, i have to use runCommand for it
erm teChNICaLLY
import { world } from '@minecraft/server';
function isInventoryFull(player) {
const inv = player.getComponent("minecraft:inventory");
if (!inv) return true;
const container = inv.container;
if (!container) return true;
for (let i = 0; i < container.size; i++) {
const slot = container.getItem(i);
if (!slot || slot.amount < slot.maxAmount) return false;
}
return true;
}
world.beforeEvents.playerBreakBlock.subscribe((event) => {
if (isInventoryFull(event.player)) {
event.cancel = true;
event.player.sendMessage("§cTúi đồ đầy! Không thể phá block.");
}
});
world.afterEvents.playerBreakBlock.subscribe((event) => {
const { dimension, block, player } = event;
if (!isInventoryFull(player)) {
const drops = dimension.getEntities({
type: "minecraft:item",
location: block.location,
maxDistance: 3
});
for (const item of drops) {
item.teleport(player.location);
}
}
});
My code has no errors so why can I still mine blocks when the inventory is full?
I will go to sleep and wait until tomorrow
Good night!!!
well, if any of ur slots arent entirely filled even when its not the desired block, from what i see, ur isInventoryFull func will return false.
make sure all of ur slots are fully filled, and it should work.
or u could just remove the latter part
if (!slot) //code or u might wanna check if there's that particular block in the inv and if its filled or not.
stringifying ItemStacks and then parsing them was a valid way of saving them, right?
or am i wrong?
you are wrong
idk why but i felt like it was the way
but there is a way, isn't it?
#1252014916496527380
yeah i saw that but I'd have to update it to work on 2.0.0 so i thought i could do it another way
anyway thx
👆
Nuh uh... you can store them in a normal variable and call them in itemStack related things but you can't stringify() and parse() then since it always returns {} in stringifying it.
is there a checklist for updating from scripts 1.x to 2.0?
i really don't want to just update and manually test my scripts and fix them one by one
thank you
Oh, i got it thanks
Np
world.afterEvents.dataDrivenEntityTrigger.subscribe(({ entity, eventId }) => {
if (entity.typeId === "mz:goblin_general1" && eventId === "mz:aoe1") {
const hits = entity.getEntitiesFromViewDirection({ maxDistance: 4 });
for (const hit of hits) {
const target = hit.entity;
if (target.typeId !== "mz:goblin") {
target.applyDamage(1);
}
}
}
});
does anyone have a better idea in this its an attack system
How do I go about building a block permutation from scratch? Like if I want to place a block and i need to set certain states of it how do I get the base permutation to edit or generate the permutation to feed into the setblock call?
first you get your block instance, then access its permutation via Block.permutation, then change the desired states with Permutation.withState("stateId", value), and finally use Dimension.setBlockPermutation(yourPermitationHere)
-# argument for .setBlockPermutation() has to be a BlockPermutation class instance, not Block
Oh thats not what I did but thanks for helping
I used BlockPermutation.resolve
It worked tho
I've totally forgot about it lol
yeah you can also do that
Well thanks for helping!
anyways, your doubt was about how to place the permutation in the world, right?
Day 2 Learning ScriptAPI🛏️
system.runInterval(()=>{
dimension.spawnEntity("minecraft:creeper",{x;0, y:0, z:0})
})
It's been a long long time since I experienced hang... What the hell did you do.
he used runInterval without caution
or ```js
(function bootstrap() {
bootstrap()
})();
we try to make essentials addon
use discord at least..
maybe next time when the project public we make discord server
Okay nice, wanna be friends?
🛏️
🛏️
If I want to give custom loot for a vanilla block (in this case a bed that the player breaks), should I use PlayerBreakBlockBeforeEvent or PlayerBreakBlockAfterEvent ?
Use PlayerBreakBlockBeforeEvent
So you can cancel the block break > remove the bed by script > spawn custom loot
You can’t edit the vanilla blocks btw
Really? What a shame
Yeah, there block json definition isn’t exposed yet
I see
Isnt it cool btw that Minecratft stores all Languages and lang files of every language but you will only use one for years
So many useless stuff and I cannot delete it
I wonder how unoptimized Windows is..
just try using any of the windows apis, its a ancient relic of the past and so horrible to work with
Lol
Oh i've seen this before, for what do you need Entity.target?
setting target?
I mean it's already self explanatory.
setting? it is read-only wdym by "setting"
you can only read it
description?
Huh, lol my bad
I were distracted by the read-only
but it seems like it's a accessory or how its called
They should add breed component next.
const breedComp = catgirlEntity.getComponent("minecraft:breedable");
if (!breedComp || !breedComp.isBreed) return;
while (true) breedComp.breed(targetPlayer);
indeed
interesting
It is
Run interval do not cause hang
oh yeah I forgor
I was spawning entity not looping it's self
next time I'll ouroboros some script
forgot /
must like this path,
import './attachment'
or maybe can this (untest)
import 'attachment'
Oh ok
not recommended, use it in TypeScript (compiler will handle it) or use relative paths
import "./attachment"
is better in this case
uh, just making sure*
is it possible to rotate the player head without having to teleport it?
something like this player.setRotation({x:1, y:0})?
Should work I think
setRotation doesn't work on players
not even logs
is tp facing not an option for that...
i was trying to rotate the screen without having to give the player nausea
but it kinda looks good in this way
How can I create a bedrock mining function where I hold a pickaxe and when I hold it for 7 seconds the bedrock block breaks and drops an item.
Yes I think it is difficult but after I learn it I won't need help
I was thinking the same at the moment, but docs does not mention that this method is not working for players, so I thought it might work
Is there a way to make it so if an entity is near another entity with a tag they first entity blast back the way the player/user is looking
-# I know a very random request
Can someone uhh give me example of code where if i step on a specific block it explodes💀
Its for uhh
Jump boost thing
Hint: block custom_component
import * as mc from "@minecraft/server";
mc.system.beforeEvents.startup.subscribe(e => {
e.blockComponentRegistry.registerCustomComponent("ns:cust", {
onStepOn: o => {
}
})
})
Is it possible to modify a enum?
enum in mc or enum in cmds...
Idk if anyone could help out.
Basically Im trying to tame a mob without using an item but just clicking on it. Ive treid doing it through interact and the tameable component with minecraft:air and it didnt work. Finally tried a script and I still cant get it to work. if anyone can look over it and tell me if anythings wrong
im getting no content logs, im getting no console warns when interacting wih the mob either
ive also tried this and it doesnt work
(I know theyre running because ive intentionally put parse errors in them and the game picks it up)
const { player, beforeItemStack, target } = ev;
// Empty hand?
if (!beforeItemStack) return;
do I replace if (itemStack) return; with this?
yes
i sent a snippet, not a whole code
still dont work I think
no console either
in Commands
yeah nope
its only editable on world restarts, its not dynamic
as of now, i presume
import { world } from "@minecraft/server";
const allowedMobs = [
"ve:dunk"
];
world.beforeEvents.playerInteractWithEntity.subscribe(ev => {
const { player, beforeItemStack, target } = ev;
if (!beforeItemStack) return;
if (!allowedMobs.includes(target.typeId)) return;
let tameable;
try {
system.run(() => {
tameable = target.getComponent("minecraft:tameable");
});
} catch (err) {
return;
}
if (!tameable) return;
if (tameable.isTamed) return;
let success = false;
try {
system.run(() => {
success = tameable.tame(player);
});
} catch (err) {
console.warn("Error on taming:", err);
return;
}
if (success) {
player.sendMessage(`You have tamed: ${target.id}!`);
} else {
player.sendMessage(`Couldn't tame.`);
}
});```
hb removing that if item statement, it should do sth
nope
im basically making a cat but I dont want it to require an item to tame. idk if I need to do smt specific to its behavior file either
What does world.afterEvents.worldLoad do?
i tried to use world.getDimension inside it and it told me that it doesn't have privileges
console.warn(target.getComponents().map(c => c.typeId + "\n"))
```u can try lookin at its comps
thats the thing idk if it needs to be in components or component groups, I kinda want it in groups so it can follow the player, fight for the player like dogs do, etc
well not want I need it to work like that in groups
then it wont get logged if the "cat" doesnt have the component
just use system.run
if that didn't work
?
still doesnt work
Well yeah... it should work.
So the error is somewhere else, because the same code works for me
where could it be?
that's the whole script
.......
this is stable 2.0.0 btw
Are you sure you reloaded the scripts?
i tried that first
Oh, never mind, That's another script that uses world getDimension in line 5
Insane coincidence
As I said
I didn't read the file name, just the line number
does anyone know if its possible to add the traits of an allow block to a custom block? (where you can place or break blocks only above it in adventure mode) I've tried a few ways but nothing works as soon as Im in adventure mode
No.
:sobs:
i'd create a post so others can help, as well as u not getting left out
I created a post in entities and was told to just script and got kinda ignored afterwards
We've been at this nearly a week I think
T-T
this 1 behvaior
yikes
like the mob basically requires it
if only tame actually accepts air
fr
if only i could clone myself ;-;
like theres nothing wrong with minecraft:air I dont understand
woah
why it wont work
should i reword that to "if only i have 4 arms ;-;"
is there a resource of basic playerinteract with entity script
they claim scripts is heavily documented but when you ask for examples its crickets
@hazy copper idk if this is specifically what you wanted to do but there you go
import { world } from "@minecraft/server";
const allowedMobs = ["ve:dunk"];
world.afterEvents.playerInteractWithEntity.subscribe(({ player, beforeItemStack: item, target }) => {
const tameable = target.getComponent("tameable");
if (!allowedMobs.includes(target.typeId) || !tameable || tameable.isTamed || item) return;
tameable.tame(player)
})```
Oh I was pinging my friend if he wanted to
mb
You need to use beforeEvents
You're good, also I think so Its literally jsut me trying to make follow, attack, and tamed to a player without an item
ive had a hell of a time getting it to work
why?
hold
im holding
afterEvents on interact events only fires when the interaction did something, for example you fed a cow, but if you have nothing in your hands then afterEvents simply won't fire
didn't know that
WHAT
but you can't make it sit though
t-t
WHAT??
it worked, thank you so much

Ahh.. no, if you don't have an item in your hand, it also fires...
Finally
i was abt to say that, i remember doing stuff using it the way I did it
yw, just remember that it will only work if the target has the tameable component
yes, also it should also have the tame_event set up, or else, it won't be able to sit
again thank you so much sensei goated
can you use Math.random in beforePlayerPlace components?
Yeah.
almost... But after events would also work without an item, just a successful interaction is enough...
-# nvm
yo is there a way to decrease or disable damage knockback taken on players?
the knockback_resistance component doesnt work on the player
you can use player.json or you re trying to make it player.json free?
He already used player.json based on the second message.
then just use the damage sensor and cancel the damage from entities and with the afterEvent entityHitEntity you can create your custom knockback
is there some way to debug addons other than using vscode?
I dont want to remove the damage tho thats the problem
you can also damage the player in the event so the player still gets damaged
i dont think so
can you detect the damage taken with entityHitEntity or entityHurt?
holy hell
if the extension is open source atleast imma try to create a cli for it
entityHurt only.
alr
not even worth it honestly
im for sure not using vscode
why?
how much ram you have?
have you tried to use some memory trimmer?
i didnt even know there was this on vscode
that's not from vscode its just a tool that i think compresses memory
its only for win 10 btw
i use linux
i dont think it would work then
well, the extension is open source
i might do some fork
category: this member was found in the input, but is not present in the Schema
what does this mean?
that doesn't sound like a script api issue but you're probably using the old category format
https://wiki.bedrock.dev/documentation/menu-categories
How is scripting threaded? Ive heard the system run is ran on the main thread but idk
why these errors appearing
[Scripting][error]-ReferenceError: Native property getter [World::scoreboard] does not have required privileges. at <anonymous> (combat.js:4)
[Scripting][error]-Plugin [Arise BP - 1.0.0] - [main.js] ran with error: [ReferenceError: Native property getter [World::scoreboard] does not have required privileges. at <anonymous> (combat.js:4) ]
const blockResist = world.scoreboard.getObjective('blockResist')```
I just put this
Is this at top level?
You need to put it in worldLoad event.
Yes.
damn
I cant mention blockResist outside of it tho
let blockReisist;
WorldLoad{
blockResist = blah
}
does vibrant visuals strip away the color of debug renderer?
WorldLoadAfterEvents right?
Yeah.
its everything single threaded(probably)
i dont know the internals but normally minecraft is single thread
things on mc like jobs, system.run, etc, might be added on a scheduler and run on parallel
uh, i tried using worldLoad, but it cant send messages for players for some reason
i meant javascript, not minecraft
players join after the world loads
you should use playerSpawn instead and check that initialSpawn is true
look, my issue is that the message is sent before the player join the world due to how playerSpawn works, and that makes my jsonUi images not loading sometimes
like its not always showing the images, sometimes the message is sent but without my jsonUi images
what happened to the "precise interaction" part of the wiki?
so i need to send the messages as soonest the world is fully loaded
there is a bug which stops it from working
