#Script API General
1 messages · Page 84 of 1
thanks
oh okay my bad i havent looked into entities i just assumed because in the enum i was looking earlier and seen in the equipment slot enum
yeah, some stuff show in the types but throw errors when used
yeh makes sense im still new to bedrock and picking apart the api myself
oh i wonder if its a planned feature in beta, as the body enum was added to beta
probably, there is also some stuff that work on entities and not player
like applyImpuls and clearVelocity, both have been added to the player in the last preview
How to make player double jump
bruh
to make my code flow better & easier to manage i've set up a system where i globally store the necessary data extracted from dynamic properties on my world in their own variables & then make any updates during runtime to that variable, and autosave this data back to the dynamic property every 30 seconds
but i have an issue i'm worried about, what happens if the world crashes or i forget to run some form of save command (whatever i decide to set up) before leaving the world? how do i protect the data against these cases
is there any sort of event that can be listened for when the player saves & quits the world
yo @fallow carbon can you help me fix the code now?
BRO i already said stop pinging ppl randomly like that!
proof (1) - he always pings him like that
proof (2)
i mean bruh
briefly to say, You can just send the problem and code, here. There are a lot of other people who can help you, He might not have time always
nah he was helping me put a file into vs
code
and he told me to wait till later
so thats why i pinged him
can i make available command parameters change depending on what the other parameters inputted by the user are
no
can command names include spaces
idk
no
Will we be able to add spaces in 1.21.90
no
why u need that
Multiple related commands
Faction commands
Warp commands
/f home /f sethome
what ur looking for is sub commands
Do those exist
not yet
Will they
but u can mimic that
yea
How
use enums
In what way will i make use of enums here
sub cmds
Telling me to use enums isnt very helpful mate sorry theres so many kinds
ye
well enums aren't great if your subcommands need different parameters
Oh right cos they do
So is this just for like
no picky
aliases
because you can't change the next parameter if you change enum
like lets say you want /f home <number> and /f create <string> then that wont work
obviously you wont have home as a number but you get what i mean
the best way of doing it for now i'd probably say just do something like /f:claim, f:home, etc..
then just make two commands with
/namespace:f-home
/namespace:f-sethome 😎
or this.. it kinda makes more sense to be like this but whatever you prefer 🤷
Ugly
not conventional
what happened if other pack use the same namespace btw
Ugh, - and not _
Namespaces themselves being required in commands is unconventional
Custom commands as they are now arent any better than custom chat based command systems
Icl
the annoying thing rn is in preview it does hide the namespace but it also shows the namespace.. hopefully we'll be able to hide them with a flag or something
like when doing name: 'f:claim' it'll show both /f:claim and /claim in chat
Simply use a single parameter and parse it like you would with chat commands.
The custom command pros: auto close chat 👍
Or just do f:home
If I do that it's just better I resort to using chat based commands ....
that's like the biggest benefit that slash commands bring to user experience
Ur wish
being able to automatically fill in info and see what it's actually used for
Does it break if other packs have the same identifier?
idk dont ask me
several people are typing... ahhh nostalgia. this channel used to be so active
the only reason why you would want to use /commands if you continue to do it like is so that chat automatically closes for you
thats the trafe-off ig
It won't register
is it with the same identifier? i thought it was if the identifier and the command name already exists
Does it prioritize too? Like how resource pack priority mechanic?
IG is based on order in setting.
i kinda wish we could have been able to modify existing commands so that we could disbale /me and shit or at least just be able to do something like .unregisterCommand or something
why
yeah
the abuse that comes from /me and /say is so bad
Custom Command
- pros: Auto completion, description, close the chat.
- cons: limited typing rules.
Chat Command
- pros: fweedom
- cons: need memorization, can't close chat.
doesn't custom servers disable those somehow?
yeah but not everyone uses custom servers or know how to disable commands if not done already
Custom command and chatSend both have pros and cons. It is up to you and your userbase to decide which one to use
plus I'm more used to sticking with vanilla server anyway
the only server software i ever managed to use was bdsx
and it doesn't look like that's coming back anytime soon
i would use something like serenity but that's missing a lot of survival features and their api isn't user friendly. then endstone is in python.. (i don't know python or c++)
i wanted to look into making my own bds-based server software while hooking into the server and modifying the packets myself but i don't enough yet and i don't even want to think about messing with raknet and everything else for custom bds software
You can change the permission level a command requires with the commands.json file without custom server software
Well you have to add it yourself
#1043783205096009768 message
#937091818603048971 message
Is it possible for me to test if the player presses any of these buttons?
No, you'll have to get the movement velocity.
Hmm
https://youtu.be/C0u_n9lMd6k?si=5llr6cRnZJIdbN00
I want to do something like this
Check CraftersMC Development Logs #2: https://craftersmc.net/threads/3860/
Whichever button the player presses, the aim will turn to that side and go there.
Is this possible?
You can use the camera command and contrlscheme for that.
Controlscheme?
New command.
The camera command contains so many things, how can I make an angle like this?
I suggest reading the docs and playing around.
projectiles are entities right?
where can i find the documentation for it?
Installation for @minecraft/server
Latest API module install:
npm i @minecraft/[email protected]
Beta API module install:
npm i @minecraft/[email protected]
Preview API module install:
npm i @minecraft/[email protected]
Preview Beta API module install:
npm i @minecraft/[email protected]
oops
Actually, you can.
Detect item spawning on entitySpawn, set a dynamic property with the current Date.now() on the entity.
is that in the minecraft stable?
how do i check for a left click using scripting?
you can only do it if they target a block or entity
if they click the air, you can't detect it
{
"format_version": "1.21.80",
"minecraft:block": {
"description": {
"identifier": "um:storge",
"menu_category": {
"category": "construction"
}
},
"components": {
"minecraft:display_name": "Storage Controller"
},
"minecraft:tick": {
"interval_range": [
20,
20
]
},
"um:tick": {},
"um:try": {
}
}
}
My block code
system.beforeEvents.startup.subscribe(e => {
e.blockComponentRegistry.registerCustomComponent("um:try", {
onTick: (even, pera) => {
const { block, dimension } = event;
world.sendMessage("hiiii")
}
})
})
SCRIPT
This code don't work. How can i fix this script or block json
your block json has a bracket in the wrong spot
How can fix
{
"format_version": "1.21.80",
"minecraft:block": {
"description": {
"identifier": "um:storge",
"menu_category": {
"category": "construction"
}
},
"components": {
"minecraft:display_name": "Storage Controller",
"minecraft:tick": {
"interval_range": [
20,
20
]
},
"um:tick": {},
"um:try": {
}
}
}
}
you will have to fix the spacing though lol
Thanks
Maybe change format_version to 1.21.70 or something?
do you have the custom components v2 experimental toggle enabled?
the format_version does not have to match the game version
CC v2 requires 1.21.80 or higher.
k
then maybe he forgot the experimental toggle
{
"format_version": 2,
"header": {
"name": "custom component",
"description": "Unknown Mcpe YT",
"min_engine_version": [
1,
21,
80
],
"uuid": "5bc601a6-cb6f-11ef-9cd2-0242ac120222",
"version": [
1,
0,
0
]
},
"modules": [
{
"type": "data",
"uuid": "65456f64-cb6f-11ef-9cd2-0242ac120222",
"version": [
1,
0,
0
]
},
{
"type": "script",
"language": "javascript",
"uuid": "6f4e8fea-cb6f-11ef-9cd2-0242ac120222",
"entry": "scripts/main.js",
"version": [
1,
0,
0
]
}
],
"dependencies": [
{
"uuid": "dd302710-e8d0-44b4-82ff-96da6bbc2222",
"version": [1, 0, 0]
},
{
"module_name": "@minecraft/server",
"version": "2.0.0-beta"
}
]
}
you forgot to register the um:tick component
I try
what could gega be spending so long typing lol
Have you tried, copying, deleting, pasting, and pasting again (replacing)?
-# It refreshes the file. Android often has a weird bug where file often don't register their existence to Minecraft
Work bro thanks 👍
no the issue is he didn't register it
👍
What?!?!?
system.runInterval(() => {
for (const player of world.getPlayers()) {
const inputInfo = player.inputInfo;
const movement = inputInfo.getMovementVector();
const normalizedX = Math.abs(movement.x) > 0.2 ? Math.sign(movement.y) : 0;
const normalizedY = Math.abs(movement.y) > 0.2 ? Math.sign(movement.y) : 0;
if (normalizedY > 0) console.error('forward');
else if (normalizedY < 0) console.error('backward');
if (normalizedX > 0) console.error('left');
else if (normalizedX < 0) console.error('right');
}
});
world.afterEvents.playerButtonInput.subscribe((event) => {
const player = event.player;
const button = event.button;
const button_state = event.newButtonState;
// Detect when the player presses the Jump button
if (button == "Jump" && button_state == "Pressed") {
player.runCommand("say jump");
}
// Detect when the player presses the Sneak button
if (button == "Sneak" && button_state == "Pressed") {
player.runCommand("say sneak");
}
});```
You can ofcourse detect clicking these buttons.
Not sure why Smokey said "No"
That is movement, not directly clicking the button. You cannot tell if its WASD or touchscreen.
hmm
what's the most optinal coordinates for a pseudo-dimension?
Not really a scripting question.
oh my bad
Does anyone have a function that returns true if it finds a block between two vector3 coordinates?
Is it possible to change the direction the player is looking?
How to change the player's camera to face an entity?
only through teleportation.
entity.setRotation() does not work on players
same answer
in the teleport method, there's a facingLocation property
Do I have to use the viewDirection or the location of my entity in that?
But when I do it this way I can't move
you have no other option.
player.teleport(playerLoc, {
facingLocation: {
x: targetLoc.x,
y: targetLoc.y,
z: targetLoc.z
},
dimension: world.getDimension("overworld")
});
?
How can I fix this?
I just told you there's no other option.
you cannot fix that.

Hi
Someone has the chest ui without inventory made by herobrine?
I dont find the github
so
applyImpulse is valid for player now but doesn't work properly
if you will apply impulse {x: 0.2, y: 0, z: 0} to player then player moving will look like moving using a piston
ok that is genuienly perfect
do you mind sending th script part that does that
how do I make script when player join then gave them "Joined" tag
world.afterEvents.playerSpawn.subscribe(data => {
const player = data.player;
if (player.hasTag('joined')) return;
/*
code...
*/
player.addTag('joined')
})
add initialSpawn there
it doesn't matter, but better than running a code when not needed
Pointless
import { world } from '@minecraft/server';
world.afterEvents.playerSpawn.subscribe((event)=>{
if(!event.initialSpawn) return
event.player.addTag('Joined')
})
it is not
you are running hasTag on a player that already have it, that what pointless
The person needs the joined tag explicitly to do something when a player first joins. So you need to check for the joined tag so that the code is not executed if the tag already exists.
You'll have to check for the tag anyway, so initialSpawn is useless.
this come to what is he faster check initialSpawn or hasTag
one is a property that the event already have the other is a function that you are getting data from
so i would say that initialSpawn is better for this case
Congratulations, you saved 0.00001 ms
well, my point still stand no matter how small the result is
#1019692489596215388 message
is there a limit of how many dynamic properties a world can have
how would i make it run a function after the player joins?
import { world } from '@minecraft/server';
world.afterEvents.playerSpawn.subscribe((event)=>{
if(!event.initialSpawn) return
event.player.addTag('Joined')
//run function here probably
})
#1067535608660107284 message
yeah but idk how to run the function
Do you need to run the code only the first time a player joins or every time?
are scoreboards persistent?
?
to see if i have to do every time or not
import { world } from '@minecraft/server';
world.afterEvents.playerSpawn.subscribe((event)=>{
if (!event.initialSpawn) return;
const player = event.player
// code
})
no
there's limit on saving properties per tick
What do scoreboards do in this topic?
i wanted it to run a mcfunction that initializes many scoreboards for the player when they join
i also dont know how to make the code run mcfunctions
since ive never done scripting
import { world } from '@minecraft/server';
const scoreboards = [
"score1",
"score2",
"asdhajsdh"
]
world.afterEvents.playerSpawn.subscribe((event)=>{
if (!event.initialSpawn) return;
const player = event.player
for (let scoreName of scoreboards) {
const score = world.scoreboard.getObjective(scoreName) || world.scoreboard.addObjective(scoreName)
if (score.getScore(player) == undefined) score.addScore(player, 0)
}
}
I wish the new destruction particle component system would just fall back on the block texture if a custom one isnt provided because to add different particle texture and block textures on each permutation is alot longer lol
any existing posts regarding updating durability when the item gets used? thanks in advance
for the repeating commands, would i have to do that in a script where it runs a function each tick or is there just a way to do repeating in mcfunctions?
#repeat
titleraw @a[hasitem={item=genb10:iron_battleaxe_cooldown,location=slot.weapon.mainhand}] actionbar {"rawtext":[{"text":"Cooldown: "},{"score":{"name":"*","objective":"iron_battleaxe_cd"}}]}
#chain
execute as @a unless entity @s[scores={iron_battleaxe_cd=0..}] run scoreboard players set @s iron_battleaxe_cd 0
# make sure that this checks for left click instead of crouch
execute as @a[hasitem={item=genb10:iron_battleaxe,location=slot.weapon.mainhand},scores={iron_battleaxe_cd=0}] at @s unless entity @s[y=~1.5,dy=0] run scoreboard players set @s iron_battleaxe_cd 1.1
execute as @a[hasitem={item=genb10:iron_battleaxe,location=slot.weapon.mainhand},scores={iron_battleaxe_cd=1.1}] at @s run replaceitem entity @s slot.weapon.mainhand 0 genb10:iron_battleaxe_cooldown
execute as @a[scores={iron_battleaxe_cd=1.1}] at @s run playsound mace.smash_air @a[r=15]
scoreboard players set @a[scores={iron_battleaxe_cd=1.1}] iron_battleaxe_cd 1
#repeat every 2 ticks
scoreboard players add @e[scores={iron_battleaxe_cd=0.1..}] iron_battleaxe_cd -0.1
How many can be saved per tick
10-20megabytes
Of data ?
yes
that’s the maximum that can be saved during yield of 1 tick ?
Not a problem then
That’s plenty
I can make it spread the save process i have set up throughout multiple ticks anyway
Huh
Ok
Where does that limit even come from bro
What is supposed to prevent us from saving 21mb of data in a single minute’s time
if you save like 15 megabytes(number > 10megabytes) then you get error in log
Oh
Maybe that’s ab it of a problem then
Autosaving every 30 secs
I store player and faction data on rhe world so
Im not sure it would ever exceed 10mb but itd suck if it does
why dont you just use custom json file then you dont have those limits
where can I learn scripting? since youtube tutorial always using old version
Script api can’t read or write to files
can it now
If you already know how to code somewhat well in other languages (or frameworks)
Learn javascript syntax, njs and just read script api docs
Why are you sending a whole essay in script api general
Ok not anymore
if you mean me, i wasnt typing i think it says im tying when i quickly tab in and out of discord lol
Yes I do mean you and thanks for this confession
Lowkey i was waiting on you to reply to this bc im not sure if im right
Last time I checked it cant access
oh yeh looking around it doesn't seem so in the sandboxed addon environment, I've only been looking at the API's a week or so
Hello I'm back.
is there any way to stop left click or prevent it? like a weapon hit?
Wuzzup coddy long time no see
anybody has done this before?
Fully disable? I don't think so, dealing no damage yeh.
Halo, depression really hit.
Does entityHit before event works?
what if I tp it on itself before the knockback applies
how's the recovery?
It doesn't exist tho.
bad.
welp as long as you're moving don't stop and keep going, things will get better
Just make your own damage system :D
what about knockback?
?
Well, it's not such a simple thing... So, you need to think a lot about how you're going to do it.
world.afterEvents.entityHitBlock
world.afterEvents.entityHitEntity
yeah I'm thinkin of on hit it will just tp the entity back to the location where it was hit
actually hasTag does take a decent amount of time to run, so he probably saved more like 0.25 ms
I decided to find out. I got an average value of 0.008 MS
hmmmm
so more than you said
if the player has a ton of tags, it might take even longer
I said it figuratively. But damn, it essentially changes almost nothing.
try with the maximum number of tags
use a script to add a ton of random tags to yourself
so you hit the tag limit
then test it
and see how long it takes
Even if it takes 2 MS it won't be a problem
actually it will
if you have enough players online, that could be a HUGE problem
I know because I have ran a dedicated server
when you have 20 players online, it has very little room for overhead
so 2 MS could cause a small lag spike
then if a bunch of people join at once it will cause a big lag spike
2 MS is A LOT in terms of scripts
-_-
since if the total of Minecraft + scripts is more than 50 MS, you get lag
the further above 50 MS it goes, the more lag you have
you should ALWAYS try to AVOID that kind of lag whenever possible
A player joining itself causes lags. These 2ms are literally nothing compared to the rest. + there must be an unrealistically huge list of tags for it to take 2ms
If it was in some interval or frequently called event I would understand. But it is in playerSpawn. It is not a frequent event.
And in his case, he'd be better off abandoning mcfunctions in the first place rather than worrying about, oh my god, 0.008 millisecond slowdowns.
scripts are NOT mcfunctions
there file extension is .js, or .ts, NOT .mcfunction
🤯 What I meant was that if he wants to optimize the addon, he first needs to abandon mcfunctions and last of all think about how to optimize the use of ONE method that is called once every 500 years.
no that would actually be much worse
because it will run when not needed
while with the event callback it only runs when necessary
Do you understand that you are now trying to tell me that calling one method, the execution of which takes ~0.008 ms, is really bad and we need to optimize it as soon as possible?
Moreover, this function is not called often.
just take the small performance improvement bruh
if a performance optimization is that easy, just do it 💀
that is what I have been trying to get at
If only it had any effect...
It is not about why would you use it when it doesn't save that much performance, it is about why would you not use it.
it may never help but it is the best way of doing things. You don't want to end up with little stuff that's add up over the development time.
I always do micro optimisations if they don’t really take long to do and don’t make the code horribly ugly
32k bytes can be saved in one dynamic property. Specefically 32767. And talking about the whole world, how much dynamic property it can have, Depends on your device.
You can have up to 128^32k properties.
mmm cool
Which is impossible to reach
So in short there's no limit
^
So there's no limit
Virtually no.
Okay thank you
Source?
Permutation?
128 refer to the chars in ASCII?
what about UTF-8, there is 127 character there that can be stored in 1 byte
Somebody told me about the amount of data you can save to properties in a minute's time is limited to 10mb
Can someone confirm this is true
Yes
Does it like actually hard reset some sort of limit every minute
Oh
Why is this mechanism even set up
what purpose is it meant to serve
It's more of a warning. It won't prevent you from writing to the property.
Oh
So nothing willa ctually break
?
Cuz ppl like us exists xD
Nah, so long as your string doesn't exceed 32767 lol.
How much lag does saving large amounts of data actually cause
More data mor elag
It ultimately depends on the hardware.
we did more than that and it worked fine
Well mine isn't bad but it isn't great either
16gb ram and decent ssd
Best way to test is on a mobile device. If performance is good there then you know you will be fine elsewhere.
It affects other players??
not me , the host?
If I host a world and others play on it will it affect them
Clients should be fine ig
I thought it's just on my end
or i mean obviously the lag that my machine experiences will also be visible in tps and stuff but i meant that their phones dont have to do any sort of tasks when I save stuff
right
When you do heavy tasks it has the potential to slow down the host and create latency for those connected.
Yes so to me that means it doesn't affect them
If your machine is good then it ultimately comes down to their ping and your service being provided lol.
is there an npm package i can install for scripting v2
Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.. Latest version: 1.19.0, last published: 18 days ago. Start using @minecraft/server in your project by running npm i @minecraft/server. There are 70 other projects in the npm registry using @minecraft/server.
That's just one of them.
thank you!
I am trying to learn custom compnenets v2 but it isn't working for me
system.beforeEvents.startup.subscribe(e=>{
e.itemComponentRegistry.registerCustomComponent("ms:bj_dz",{
onConsume(e)
{
const player = e.source;
const item = e.itemStack;
const bj = world.scoreboard.getObjective('bjc');
const bjd = world.scoreboard.getObjective('bjcd');
bj.addScore(player,1);
bjd.setScore(player,100);
}
});
});
it's showing me this error
I haven't personally messed with it but I do know there is an experimental setting that needs to be enabled for the World in order to use that
You have beta API enabled? Your manifest also targets 2.0.0-beta?
yes
You have CC v2 toggle enabled?
Either the manifest is targeting the wrong version or there is an improper import within your script. May need to show both for clarity.
That's good.
import { system, world } from "@minecraft/server";
system.beforeEvents.startup.subscribe(e=>{
e.itemComponentRegistry.registerCustomComponent("ms:bj_dz",{
onConsume(e)
{
const player = e.source;
const item = e.itemStack;
const bj = world.scoreboard.getObjective('bjc');
const bjd = world.scoreboard.getObjective('bjcd');
bj.addScore(player,1);
bjd.setScore(player,100);
}
});
});
idk what else is wrong
which file is that?
That's a bit odd. Your manifest is good and the script is good.
berry_juice.js but i have imported it in main.js
the error is not in that file
import "./initial.js";
import "./berry_juice.js";
it's in initial.js
* @deprecated This class is deprecated and will be removed in 2.0.0.
*
* Contains information and methods that can be used at the
* initialization of the scripting environment for a World.
*/
export class WorldInitializeAfterEvent {
private constructor();
}
So if that is deprecated in 2.0.0, how do i do this? (I'm so stuck i looked at src code please help)
world.afterEvents.worldLoad.subscribe((event) => {
world.sendMessage("World has loaded!");
event.blockComponentRegistry.registerCustomComponent("createbedrock:creative_motor_interaction", CreativeMotorInteractionComponent);
});```
i want to use 2.0.0-beta
system.beforeEvents.startup
because they're made for stable
Alright then i use the wiki as mild inspiration now? lmao
The MS docs do.
Tell me where
You'll have to wait until 1.21.90 releases for info specific to 2.0.0 on the wiki
Thanks, i did not search for 2.0.0 specifically (i assumed ms docs overall are updated)
Also how do i correctly (i am confused by now) apply that custom component to block
if "minecraft:custom_components" is deprecated
Sometimes I find it easier to refer to the github source version of the official docs, I find the main one not very well linked and laid out. https://github.com/MicrosoftDocs/minecraft-creator/tree/main/creator
And the doc is saying that "minecraft:custom_components" is a way to go
while bridge v2 is saying otherwise
and to finish it, nothing of the custom component besides registering works
oh yeah mc is saying it is deprecated too
NOW it worked
so they deprecated it...
without anything to replace it to
obviously
Custom Components V2.
... how do i use those?
Requires the experimental setting to be enabled. For scripting it requires v2.0.0 and Beta API
I'm honestly unsure. I haven't touched it personally so maybe someone familiar with it can answer you.
Read the articlr I sent.
Ohhh
Alright, this apparently does not work when i do 1.21.80 insetad of 1.21.40???
https://pastebin.com/gwqnX8QW
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
you need to give the component a value, could just be an empty object
"createbedrock:creative_motor_interaction": {}
Is there a way to detect if a player unlocks a recipe? Asking for a friend 😅
why am i getting this error
[Scripting][error]-SyntaxError: exported variable 'getPrimaryEquippedHat' does not exist
[Scripting][error]-Plugin [Just Cosmetics - 1.0.0] - [main.js] ran with error: [SyntaxError: exported variable 'getPrimaryEquippedHat' does not exist]
i've searched my whole addon for getPrimaryEquippedHat to triple check its not anywhere else and its not
Also how do i store some sort of info block-wise
Youll have ti store it via entities or world dynamic properties. We do not have block dp yet.
i tried exporting it even though im not trying to get it anywhere else still has the error
It'll lag like crazy with entities and idk how do i do it world dynamic properties with multiple blocks of same type?
i have this mcfunction that runs every tick and it causes lag so i hate it. How would i make a script to check if execute as @a[hasitem={item=genb10:iron_battleaxe,location=slot.weapon.mainhand},scores={iron_battleaxe_cd=0}] at @s unless entity @s[y=~1.5,dy=0] is true, it runs the mcfunction?
hopefully the lag is reduced since it only checks one thing every tick instead of many
I would save the coordinates of said block. Its a bit hacky but it gets the job done. Entities will definitely lag if you have lots of thsie blocks.
@echo tinsel I don't see anything like export { getPrimaryEquippedHat }; or export in front of any of your functions
Alright please tutor me onto this
You just have to learn serialization really. #1067535712372654091 should have some examples from past works. The gist of it is you place said block or whatever and you make the coordinates the key and then the value is a json object with whatever you need.
I want form slider to modify the said data
im actually going crazy cause i tried to just remove it but appearantly i am still calling for it somewherem but its not happy when i export it eitehr
holy typos batman
Yeah something is trying to "import" it so its asking for the export
ive used the search to search for it anywhere else and no where else has it.
i have this mcfunction that runs every tick and it causes lag so i hate it. How would i make a script to check if execute as @a[hasitem={item=genb10:iron_battleaxe,location=slot.weapon.mainhand},scores={iron_battleaxe_cd=0}] at @s unless entity @s[y=~1.5,dy=0] is true, it runs the mcfunction?
import { system, world } from "@minecraft/server";
system.runInterval(() => {
for (const player of world.getAllPlayers()) {
if (player.isSneaking) continue;
const sb = world.scoreboard.getObjective("iron_battleaxe_cd");
const score = sb?.getScore(player);
if (score != 0) continue;
const item = player.getComponent("equippable")?.getEquipment("Mainhand");
if (item?.typeId != "genb10:iron_battleaxe") continue;
const { x, z } = player.location;
const y = player.location.y + 1.5;
const entityCheck = player.dimension.getEntities({
location: { x, y, z },
maxDistance: 0.5
});
if (entityCheck.length > 0) continue;
player.runCommand("function your_function_name");
}
}, 1);
(I'm assuming the unless entity thing is a crouch detection)
yeah, im going to make it a hitting mob detection later
this should run automatically when the world starts too right
yeah
if i were to add more items with cooldowns, do i need a new file with altered stuff or could i just build off this
you can just build off this
after +1hr i got Modal Form working, now how do i store the per-block info?
guys how to test when a player place a block ?
With custom components
i tried this world.beforeEvents.playerPlaceBlock
Are u using 2.0.0-beta?
who ?
Scroll up in this thread
cozmozZz
How do i ?
import { world, system, WorldLoadAfterEvent, GameMode, Player, Block, Direction, Dimension, BlockComponentPlayerInteractEvent } from "@minecraft/server"
import { ModalFormData } from "@minecraft/server-ui"
const CreativeMotorInteractionComponent = {
onPlayerInteract(event) {
const player = event.player;
const block = event.block;
const face = event.face;
const faceLocation = event.faceLocation;
const dimension = event.dimension;
const CreativeMotorInteractiveUIChangePWMForm = new ModalFormData()
.title("Change Speed in PWM")
.slider("Speed in PWM", -255, 255)
.submitButton("Submit");
const result = CreativeMotorInteractiveUIChangePWMForm.show(player);
result.then((value) => {
if (value.canceled) {
return;
}
else {
world.getDimension("overworld").runCommand("/say " + value.formValues[0]);
}
});
}
};
system.beforeEvents.startup.subscribe((event) => {
event.blockComponentRegistry.registerCustomComponent("createbedrock:creative_motor_interaction", CreativeMotorInteractionComponent);
});```
I have this currently
Also i'd love to use typescript with bridge. v2
damn why is the form name so long ☠️
also most of those imports are not needed
oh
and removed type annotations
??????
I wanna store the pwm block-wise (maybe with location idk)
you know how i can put a cooldown on ender pearl ?
does the engine have weakrefs? i think imma need for dont cause memory leaks
it should
custom components?
yeah
onPlayerDestroy
There is a special branch, isn't there?
I alr got it so nvm
import { system, world } from "@minecraft/server";
system.runInterval(() => {
for (const player of world.getAllPlayers()) {
const item = player.getComponent("equippable")?.getEquipment("Mainhand");
//Iron Battleaxe
if (item?.typeId == "genb10:iron_battleaxe") {
const sb = world.scoreboard.getObjective("battleaxe_cd");
const score = sb?.getScore(player);
if (player.isSneaking) continue;
if (score <= 0) continue;
const { x, z } = player.location;
const y = player.location.y + 1.5;
const entityCheck = player.dimension.getEntities({
location: { x, y, z },
maxDistance: 0.5
});
if (entityCheck.length > 0) continue;
player.runCommand("function battleaxe_cooldown");
}
player.runCommand("function cooldown_scoreboards");
}
}, 1000);
are there any errors in the content log?
doesnt show, but not sure if i have it off or not, lemme check
you can view the history at the bottom of the setting page
how do i turn it on?
it's in creator in the settings, should be like "enable content log gui" (set it to "warn")
alr lemee test

Guys, should I download it?
Double it and give it to the next person
💀
oookaaayyy
[item][warning]-Item 'genb10:battleaxe_cooldown' has already been overridden by a pack higher in the pack stack!
[Commands][warning]-Function cooldown_scoreboards failed to load correctly with error(s):
[Commands][warning]-Error on line 2: command failed to parse with error 'Syntax error: unexpected "genb10:iron_battleaxe_cooldown" : at "tem={item=>>genb10:iron_battleaxe_cooldown<<,location="'
@sterile epoch
i can send all related files if that helps
resolved last one
the top error just seems self explanatory
function cooldown_scoreboards:
scoreboard players add @e[scores={iron_battleaxe_cd=1..}] iron_battleaxe_cd -1
titleraw @a[hasitem={item=genb10:battleaxe_cooldown,location=slot.weapon.mainhand}] actionbar {"rawtext":[{"text":"Cooldown: "},{"score":{"name":"*","objective":"iron_battleaxe_cd"}}]}
#you can ignore this
scoreboard players add @e[scores={thunder_staff_cd=1..}] thunder_staff_cd -1
titleraw @a[hasitem={item=genb10:thunder_staff,location=slot.weapon.mainhand}] actionbar {"rawtext":[{"text":"Cooldown: "},{"score":{"name":"*","objective":"thunder_staff_cd"}}]}
i have no other active packs
since this is just a cool down you might as well make it an actual cool down like enderpearls
with the cool down component
huh... Weird
i would probably restart minecraft, but it takes years to load into the world on my ipad
did you fix all the errors except the override one?
i fixed third one, second one thers an error somewhere that i dont know
i provided the code if you could help
there's no syntax error here
what's the min engine version in your manifest
1.21.80
idk then cuz I don't see any syntax errors
this original code should work as intended right
yh
can you try my modpack so i know if its a me issue
sure DM me the brproject
Is there a way to find the biome a block is in? Even if in the beta scripting
Get the block state.
How?
Block.permutation.getState
Wdym?
https://stirante.com/script/server/1.19.0/index.html
I recommend reading the docs. You would want to get the dimension, getBlock at xyz, then access the permutation property and use that ti access getState
Documentation for @minecraft/server
Oh then
https://stirante.com/script/
And select beta
You can also modify the url to use specific versions.
Oh, thanks
@wary edge yo smokey
You know that server for mcbe commissions?
Could you invite me?
anyone know how to make a armor stand hold a item?
What am I doing wrong here? It shows TypeError: not a function. I am using scripting 2.0.0-beta
world.afterEvents.playerSpawn.subscribe((event) => {
const player = event.player;
const dim = world.getDimension("overworld");
const pos = player.location;
const x = Math.floor(pos.x);
const z = Math.floor(pos.z);
const block = dim.getTopMostBlock({ x, z });
if (block) {
const y = block.location.y;
const id = block.typeId;
console.warn(`[TEST] Top block at (${x}, ${z}) is ${id} at Y=${y}`);
} else {
console.warn(`[TEST] No topmost block found at (${x}, ${z})`);
}
});```
getTopMostBlock should be getTopmostBlock.
Documentation for @minecraft/server
Thanks, its those minor errors that can be most annoying to find
It happens.
that is why you should be using TypeScript lol
why does the player selector argument in a custom command not return an array of players
because it is badly designed
I thought it did?
nah I'm testing a fling command and it returns each player separately in the args array, so I've had to push them to a new array if it's a player class
ts so annoying
Hmm, care to share an example?
registry.registerCommand(flingCmdInfo, ({ sourceEntity: player }, args) => {
if (!(player instanceof Player)) return;
console.warn(JSON.stringify(args));
console.warn(JSON.stringify(args[0]));
let playerList = [];
for (const arg of args) {
if (arg instanceof Player) playerList.push(arg);
}
const flingStrength = { low: 1, med: 2, strong: 5 };
if (playerList.length == 0)
return { status: CustomCommandStatus.Failure, message: "§cNo targets matched selector." }
for (const selected of playerList) {
try {
system.run(() => selected.applyKnockback({ x: 0, z: 0 }, flingStrength));
player.sendMessage(`§a${args[1]} flung ${selected.name}!`);
} catch (e) {
player.sendMessage(`§cFailed to fling ${selected.name}: ${e}`);
}
}
return { status: CustomCommandStatus.Success }
})
and in the console:
[Scripting][warning]-[{"id":"-8589934591","typeId":"minecraft:player"},{"id":"-261993005041","typeId":"minecraft:player"}]
[Scripting][warning]-{"id":"-8589934591","typeId":"minecraft:player"}
you can see args[0] is 1 of the players in the @a selector
just stupid design
Can you show your object for flingCmdInfo?
Maybe try with more parameters?
const flingCmdInfo = {
name: "cz:fling",
description: "Flign sum1",
permissionLevel: CommandPermissionLevel.Admin,
mandatoryParameters: [
{
name: "target",
type: CustomCommandParamType.PlayerSelector
},
{
name: "cz:fling_power",
type: CustomCommandParamType.Enum
}
]
}
??
does nothing
show result
error because idk why my custom command enum isn't working
try just a string parameter
it is
oh ok
enum ≠ string
string can be any text
enum must be one of the preset values
use string
but now I don't get the auto completion
I'm on mobile and not at a pc so visual clarity isn't as easy on my eyes. Try this though.
registry.registerCommand(flingCmdInfo, ({ sourceEntity: player }, targetPlayers, power) => {
if (!(player instanceof Player)) return;
const flingStrength = { low: 1, med: 2, strong: 5 };
if (!Array.isArray(targetPlayers) || targetPlayers.length === 0)
return { status: CustomCommandStatus.Failure, message: "§cNo targets matched selector." };
for (const selected of targetPlayers) {
try {
system.run(() => selected.applyKnockback({ x: 0, z: 0 }, flingStrength[power] ?? 1));
player.sendMessage(`§a${power} flung ${selected.name}!`);
} catch (e) {
player.sendMessage(`§cFailed to fling ${selected.name}: ${e}`);
}
}
return { status: CustomCommandStatus.Success };
});
it is only temporary
to test what happens
gtg
oh wow it worked! thanks
but I'm a little confused, it says the second callback parameter is an array of arguments
nevermind I read it wrong 
To be fair, it's a bit confusing even after you familiarize yourself with it. I have to take a step back and think about it myself lol.
onPlayerDestroy(event) {
const { block, dimension } = event;
const permutation = block.permutation;
const contentStack = permutation.getState("tap:content_stack");
const pressState = permutation.getState("tap:press_state");
const pressContent = permutation.getState("tap:press_content");
console.warn(`onPlayerDestroy called with contentStack=${contentStack}, pressState=${pressState}, pressContent=${pressContent}`);
// Do nothing if no content or fully pressed
if (contentStack === 0) {
console.warn("No content in stack, skipping drop.");
return;
}
if (pressState === 2) {
console.warn("Press state is fully pressed (2), skipping drop.");
return;
}
const unpressedCount = Math.max(0, contentStack - pressState);
console.warn(`Calculated unpressedCount = ${unpressedCount}`);
if (unpressedCount <= 0) {
console.warn("Unpressed count is zero or less, skipping drop.");
return;
}
let dropItemId = null;
if (pressContent === 1) {
dropItemId = "minecraft:raw_copper"; // olives
} else if (pressContent === 2) {
dropItemId = "minecraft:raw_iron"; // grapes
} else if (pressContent === 3) {
dropItemId = "minecraft:raw_gold"; // white grapes
} else {
console.warn(`Unknown pressContent value: ${pressContent}, no item will be dropped.`);
}
if (dropItemId) {
console.warn(`Spawning item ${dropItemId} x${unpressedCount}`);
dimension.spawnItem(new ItemStack(dropItemId, unpressedCount), block.center());
}
}
my block doesnt drop any items when mined
Any Design related ideas?
try debugging, could be that one condition cancels the whole script
[Scripting][warning]-onPlayerDestroy called with contentStack=undefined, pressState=undefined, pressContent=undefined
[Scripting][warning]-Calculated unpressedCount = NaN
[Scripting][warning]-Unknown pressContent value: undefined, no item will be dropped.
thats a warning, not an error.
Have you defined the block states on the block json?
yes
use brokenBlockPermutation. the block you're referencing have technically turned into air
Hey Gegaaa
I thought you left the server
thank you! ill try it
:( why
Idk, maybe cus im too blind
:( anyways, 2 questions
Can you help me
and is kal'tsit okay?
@random flint Sorry for pinging
Don't ping people that does not have [@] in their nicknane
Alright thanks for the advice
you just did it again...
How could i use TS with bridge. v2?
is there a way to get which slot was player's mainhand
player.selectedSlotIndex
ty
correct me if im wrong
playerInteractWithEntity
beforeEvents works if it interacts with an entity?
and afterEvent works if minecraft:interact component gets triggered?
yes
it says structureManager doesn't have privilege
you have to bypass privilege
why did they do this?
/**
* Remember to import system from "@minecraft/server";
* import { system } from "@minecraft/server";
*/
system.run(() => {
placeStructure(location, dimension.id, difficulty)
})
beforeEvents are supposted to be read-only
they shouldn't change anything in the same tick when the event has been triggered
so that life doesn't seem like a bed of roses
well dang
Using system.run is not that difficult
yep I used it a alot when I started scripting
it's pretty common to use it
Thanks to that guy who told me to use coord-based block data storage, with set/getDynamicProperty, my addon would've burned everybody's pc's with entities...
How do i rotate the block's texture via javascript
????
Note i have 511 different rotation speeds i want to use
511????? why so many
i have RPM from -255 to 255
are you making create mod or something??
Yes xD
oof
It's gonna take me year or so
not possible
yikes
soo how can i rotate the block at all
part visibility
you might have to make custom geometries and cycle through them
there's probably a better way but that's the first thing i think of
hmm
511 different geometries are u proposing?
the max you can do is 32
you only need as many geometries as how smooth you want the animation to be
Darn
Well in Create pretty much every block rotates in some or other way
actually, i might be wrong, you can combine states
so i'd need 511 geos * the functional blocks
wdym?
Yeah i can just use dynamic properties or whatever to know which one is it the state, but i want to know how to rotate the block
part visibility i guess and change it every tick
but that causes lag
Do u know how my onTick function looks like?
no
what's the best way to check if the player has beta-api enabled?
Yeah let's just say ...
ugh....
you can only have 32 state
so that leave you with 32^32
possible condition you can use at part visibility
run a beta function in a try catch
i mean the experiment
yeah?
that should be enough tho right?
that's 1.4615016373309029182036848327163e+48 states
that the best case scenario, never tried to go to that extend
if addon is requesting -beta version and beta-api experiment isnt enabled it just doesnt load scripts
so turn on beta
uh 32*32
my bad
1024
welp, try it and hope for the best
it'll be tedious and painful
and you will suffer greatly
but if it works, it will have all been worth it
This is already painful
2 blocks take up 400 lines of javascript
creative motor and half-functioning shaft
B R U H
400 lines? for what
Once i'm done with the shaft and i make stressometer/speedometer to confirm it works
i'll send it
also i guess no animations for now
yeah, each rotation and it bone
and the show them with
q.state('id:state1') == 0 && q.state('id:state2') == 0
q.state('id:state1') == 0 && q.state('id:state2') == 1
//...
q.state('id:state1') == 15 && q.state('id:state1') == 15
worse part is i now have to make the speedometer and stressometer otherwise i dont know anything about it
Gosh
how many functional blocks are there in create?
isnt it better to spawn an entity with the animation when the block is spawned so its easier to animate?
like end crystals but with a block hitbox
u know how many shafts sometimes are there?
shafts are super used
might be more efficient even
wdym by shafts?
u never played create ig
what's create?
Very Cool java mod
oof
ohh that addons with a lot of machinery
Yeah
ye
never played but i ve seen a lot of showcases/gameplay
well entity is the best option
Duh 200+ blocks * 32 textures
That'd take up a nice amount of disk space
How to detect if the world is in multiplayer? Detecting the number players won't work since I want to make players have a join message if in singleplayer and I don't wanna repeat the same message while in multiplayer
Alr no animation it is
with entities you dont have to load the server for the animation, and its all rendered from the client.
The lag be like
imagine 40 shafts, 20 fans, sth like that
already 60 entities
Also yay implementing entities!!!!!!!!!!!!
u know what
animations are the last of my priority
you can create multiple entities so if there is a 5 block shaft line you can use 1 entity
but if they have a shaft then a box then a shaft then a box then a ...
it would take a lot of entities still
Yeah
Hmm
you can also use animated textures to simulate a rotation
then you have to have 512 textures
PER BLOCK
So I imported a file to vsc but the words are in some weird format that I can’t understand can anyone help me
and animated textures on custom geometry seems to be broken
also you can't control when the animated texture moves or what frame it's on
actually its just a copy paste rotating 45 degrees you just do like fire
what if instead of increments of 1rpm, you used increments of like 8 or 16 rmp
that would cut the state count down significantly
But that would be piece of crap of a mod
bedrock is not a place to create complex addons
This is a challenge for me not just another bedrock addon
I wanted to see what was possible with such limitations
For a long time
well you'll have to do a lot of reverse engeneering and exploiting
why
I am just practically "inspired" by real create
it is so different
And if i wanted to, i'd just look at src code
is it possible to use getEntities outside render distance?
welp turns out you cannot
it returns an empty array
no becouse they despawn and they are not persistent entities
what are some workarounds?
im trying to get all of the enderman in the end...
is there any function that is similar to ticking area?
Hey, so I have never used minecraft server editor. But does it work on singleplayer worlds or bds only?
even if you render the chunks you cant get entities that were there
ahhh I see so a player must manually load it
the opposite
when you load the world there will spawn new entities
it needs to be ticking
this means that all the world needs to be ticking (impossible)
how do I add dynamic properties to them if I can't even get them?
when the player loads them add dynamic properties so they never despawn
you cant get entities in a never loaded chunk becouse no entity ever spawned
Good Morning guys
goodevening
good evening
:(
european core
is there any alternative to this?
Well is 15:09 for me :)
you can add a name tag or edit all entities .json file to never despawnm
Can anyone answer this?
bruh
i never used server editor idk
but i dont think so
world.getDimension(block.dimension.id).runCommand('say DEBUG LOG') be saving my life rn fr
I am spawning a structure with an entity that has a name tag does that not count?
specifically armor stand
Just do
world.sendMessage(""):
good point
features cant spawn entities
world.getDimension(block.dimension.id)💀
structure manager?
yes
Overkill i guess
but not a prebuilt structure from the pack
need to add another getDimension
Ye, and a tellraw instead of /say
world.getDimension(world.getDimension(block.dimension.id).id)
Y'all will lose it when u see my main.js
Please dont...
when you see a runCommand() just press CTRL + X
is there anything similar to ticking area on scripts?
#1364195448017125406
In fact, it is not the API function.
Guys, Im doing a Tower Defense in Minecraft and I want to add Custom Icons (unicodes).. can someone help me in DMs? (ik its resource related but yeah)
Its a great idea
what an ancient language
Is there a way to find the biome of a location?
We all started with this))
@sly valve can you help me rq
For the main.js sake, how can i cleanly write
a = sh_t();
if (a == undefined)
{
a = 0;
}
```?
Sure
Ill ping you when I can, give me some minutes
nah
const sys = server.registerSystem(0, 0);
const a = sh_t() ?? 0
thanks
AI moment
bet
a = sh_t || 0
nope
?? basically means: if it didnt get the value assume its 0
not AI
Bet, baby
that's legacy scripting API
So which one || or ??
Doesnt really matters
Then I'm just not that old
okay
Depends on the return value
?? is more strict, it checks if the value is null or undefined. || checks if it's falsy, either works unless you're dealing with potentially falsy values like 0 or false
|| = runs if the value is "" or 0 or false
?? = runs ONLY if the value is null or undefined
So gotta go my fresh guys.
@fresh current Ill Ping you when im able to
Thanks !
unc moment
I'm so glad we have the new scripting API, the old one was utter pain
only thing I miss is custom UI
there was CUSTOM UI????
ModalFormData? ActionFormData?
Then it's useless
But the new OreUI
not talking about OreUI, legacy scripting predates that
"new" bruh it was announced 4 years ago and its slowly getting in the game
The final version that had custom UI docs:
https://bedrock.dev/docs/1.18.0.0/1.18.10.4/UI
oreUi.addEffect('speed', 999999999999, { amplifier: 255 })
ok these docs were bad
The old system looks more low-level
here's a video that used that UI system
https://www.youtube.com/watch?v=IFH6wJj4cw4
I've added a "Quarry Planner" block, which allows you to set the size of the quarry to build, and it also requires the player to actually build the quarry structure instead of it just appearing out of nowhere. :)
If you've got any ideas on how building a quarry could be improved, leave them in the comments below so I can see! :D
(Thanks for all ...
Like custom components
ehhh, it was super finicky to work with
what does preload do in tickigarea?
I think that just makes it try to load the tickingarea quicker than usual, never really bothered to experiment with it
@wheat condor spawning a ticking area does work and then removing it after it was placed that's fine right?
you cant add a tickingarea if the world isnt alredy ticking there
what?
you can add tickingarea only in alredy loaded chunks
meaning that you cant load a chunk far away randomly
uhhhhh.....
what's the problem
I created a new world the end is still unvisited
so I created a tickingarea using
'execute in the end' then genereated my maze, and it worked....
the maze ussrs getEntities to check for armor stands placed by the structureManger
were you in the end?
@plain pecan dont leavee us alone!
wanna try it?
nver seen this feature
didnt test recently but when i tried to do that it didnt work
so it works?
yeah
That is just wild haha.
this was the script
|| need another world.events.tick ||
indeed
what does this do?
I approve of this message.
try to shift the location for example by 1000 in X or Z
would that stop working?
That is not true
holy hell why 512 possible values?
isnt that too much?
Create mod bro
@uncut lynx instead of the -255 values, can't you replace them with a "rotation" variable?
Like clockwise, anti-clockwise
And then you'd just need 256 speed variables
instead of 511
That doesn't solve anything
Pretty sure they use block entities for that no?
Your best bet is to jist wait for block entity support so you can render the block as an entity which allows for animations.
Sounds like skill issue
(I also got a problem...)
The issue was just that I changed the way some of my data was structured and i forgot to update the places where i fetch stuff related to it
i fixed it
heh
I moved all of my files but the import didnt changed automatically...
anyways
Can someone help me with Entity.applyImpulse
My entire progress fits within 1 minute video
still better than nothing
Thanks that is actually quite positive (:
Thos is crazy for one day
What
Commands.instance.registerCommand(
"who",
"View information about a team",
"<teamName: string>",
[],
1,
"teams",
({ args, sender }: { sender: CustomPlayer; args: { [key: string]: any } }) => {
const teamName = args.teamName as string;
if (teamName) {
console.log(`Viewing info of team: ${teamName}`);
const team = TeamUtils.getTeamByName(teamName);
if (team) {
let onlines = new Set();
for (const key of team.members.keys()) {
if (globalThis.GlobalCustomPlayers.has(key)) {
onlines.add(key);
}
}
const leader: TeamMember[] = [];
const coLeaders: TeamMember[] = [];
const captains: TeamMember[] = [];
const members: TeamMember[] = [];
for (const member of team.members.values()) {
switch (member.rank) {
case "leader":
leader.push(member);
break;
case "coleader":
coLeaders.push(member);
break;
case "captain":
captains.push(member);
break;
case "member":
members.push(member);
break;
}
}
const formatMember = (_member: TeamMember) => {
const nameColor = onlines.has(_member.playerId) ? "§a" : "§7";
return `${nameColor}${
globalThis.GlobalPlayerNames.get(_member.playerId) ?? _member.playerId
}§r§e[${nameColor}${_member.kills}§r§e]§r`;
};
const message = [
` `,
`§9${team.name} §7[${onlines.size}/${team.members.size}] §3- §eHQ: §f${
team.hq ? [team.hq.x, team.hq.z].map((n) => n.toFixed(0)).join(", ") : "Not Set"
}`,
`§eLeader: ${leader.map(formatMember).join("§r§e,§r") || "None"}`,
`§eCo-Leaders: ${coLeaders.map(formatMember).join("§r§e,§r") || "None"}`,
`§eCaptains: ${captains.map(formatMember).join("§r§e,§r") || "None"}`,
`§eMembers: ${members.map(formatMember).join("§r§e,§r") || "None"}`,
`§eBalance: §6${team.balance.toFixed(2)}g`,
`§ePoints: §c${team.points}`,
`§eDeaths until Raidable: ${TeamUtils.formatDtr(team.dtr)}`,
];
const timeUntilRegen = team.regenTime - Date.now();
if (timeUntilRegen > 0) {
message.push(`§eTime until Regen: §9${StringUtils.formatMillisecondsToText(timeUntilRegen)}`);
}
message.push(` `);
world.sendMessage(message.join("\n"));
} else {
sender.player.sendMessage(`Team ${teamName} does not exist.`);
}
} else {
}
}
);
It took me 45 mins
To make this command
And it didnt even work after that i spent another 15 fixing it
Hmm
But i mean it wasnt 45 mins of full work
Well i spent 18 hours
Yea but u made some crazy stuff in that time
Mines just a command
Its meant to be simple
What
Idk what that’s supposed to mean
Neither am I i made everything myself
Every library if theres any used is made by me
Oh are you Ju? What happened to your account
Yes I am. Well, let's say something happened
yk what i'mma just do one generic animation per block
so how do i do that state thing?
(my) Debug screen from Wish, any ideas what I should/could add?
yooo could someone tell me how i can make this code run when the event "eventname" is triggered, rn its working as intended but i dont think it works when the event is triggered
const EventDetector = {
"eventName": {
}
}
world.afterEvents.dataDrivenEntityTrigger.subscribe((data => {
world.afterEvents.dataDrivenEntityTrigger.subscribe((event) => {
let entity = event.source;
if (EventDetector[data.eventId] != undefined && entity != undefined) {
system.runTimeout(() => {
entity.runCommand("playsound supernova.spawn @a");
entity.runCommand("particle moo:stars1");
entity.runCommand("particle moo:stars2");
entity.runCommand("particle moo:stars3");
entity.runCommand("particle moo:stars4");
entity.runCommand("particle moo:large-void");
entity.runCommand("particle moo:fog");
entity.runCommand("particle moo:fog2");
entity.runCommand("particle moo:black-hole");
entity.runCommand("particle moo:black-hole-dust");
}, 0)
}
})
}
));```
|| Today is nested event day I guess ||
why do you use /spoiler?
please stop using entity.runCommand
lol
why is that
Alright behold of my 400 lines of code for 2 darn blocks:
https://pastebin.com/iMQQkjMM
Here's my behaviour:
place creative motor
place shaft in front
shaft gets speed 0 (bcz of undefined stuff)
break shaft
replace shaft
shaft has correct speed???
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
right, ty
const { dimension, location } = entity;
['particle1', 'particle2', ...'particle999'].forEach(id => {
dimension.spawnParticle(id, location)
})
looks awful and commands are heavy to run
this is a better and flexible version
Have u seen my onTick functions?
i do NOT want to see them