#Script API General
1 messages · Page 25 of 1
Well in theory you can save these information in string for example reading alll properties of objects and values and storing them
or you can use JSON.stringify
What's your behavior pack manifest's min_version?
JSON.stringify it to store as string then use JSON.parse to convert it back
Oohs yeah
but JSON cant serialize all kinds
Itemstacks and blocktype objects
well no
You xan serialize only known api info
for example shulker contentbwill be lost
BlockType is easy
as its just string id
I know it's not possible now and I'm not looking solutions for the current version, I just wanna know if it's possible in the future
I meant block objects that store permutations and the like
?
block container?
idk permutations are very possible
but you can save only components known to API
with container there is problem with the ItemStack it sekf like i said before
entity.setDynamicProperty("test:block", entity.dimension.getBlock(entity.location))
I know
so serialize your data
I just wanna know if it'll be possible in the future
hey guys, i have a small question here: is there a way to translate, for exmaple, item lore i set in my script in .lang? like, for example, i write in my script item.v360:smiting_template.name, and translate in .lang file?
just for exmaple, is it possible?
if you know something's never gonna be undefined, just type cast it. there's those warnings for a reason, because they're general functions that can sometimes return undefiend or whatever. anyway, types aren't in javascript so it doesn't actually matter what you do with them
iirc you can disable that by setting strict to false?
I would leave strict set to true. If the type is saying it might be undefined I would review the code and types to be sure it's not user error.
you cant translate item lores, sadly
damn, thank u for letting me know
Hey guys I have question, Is it possible to get a player's xuid and device using script?
no
unless you're using server-net
but that only works on BDS
and you'll have to make http requests to the XBOX live api
an sum other shi
Oh, thanks for letting me know.
here's something you can look at for that https://den.dev/blog/convert-gamertag-to-xuid/
Device? Uhmm its available in 1.16.0-beta (not sure)
when shooting a ray down
can it skip a block?
i am multiplying the view direction with 4 and adding it to the player location and that is the ray start point
wait i am spawning it inside the block aren't i 🤦♂️
yeah nvm i solved that.
that explain the weird offset i am having
block.dimension.runCommandAsync(`execute positioned ${block.location.x} ${block.location.y} ${block.location.z} run function mana_generator`);```
How to put more commands without having to put another block.dimension.runCommandAsync?
Run functions inside the functions 🗿
Well, that is what you are already doing, in essence.
Why are you even using runcommandasync
Just run it directly with api
Depends on what mana_generator does. There are valid use cases for calling commands if, say, it interacts with a legacy command system
I mean ig but i would try and not use runcommand since its not that efficient
All API calls aren't too efficient, that's the nature of them
But if there are native methods for what a command could do, then by all means yes. It's simply clearer too
Yeah thats a valid point can’t argue with that
It detects blocks and executes other commands
I don't know of any other ways to do this.
but if you change the GamerTag xuid is still same tho
Guys, is there a way to check when the moment before the player quits the world to execute a script just right before leaving?
What are you wanting the script to do?
To remove a block and trigger an entity event
Might be worth opening a post for this question, I know there are world before events for things but I think when you do before events, they are read only.
////////////////////////////////////////////////////
world.afterEvents.projectileHitBlock.subscribe((eventData) => {
const projectile = eventData.projectile;
const hitBlockLocation = eventData.location;
const eventDimension = eventData.dimension;
const source = eventData.source;
if (projectile.typeId === "let:light_projectile") {
const block = eventDimension.getBlock(hitBlockLocation);
// Check if the block exists and if the source entity has the "light" tag
if (block && source?.hasTag("light")) {
const fillCommand = `fill ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} light_block ["block_light_level"=12] replace air`;
const summonCommand = `summon let:light_marker ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z}`;
source.runCommand(fillCommand);
source.runCommand(summonCommand);
// Set a timer to remove the light block after 100 ticks (5 seconds)
system.runTimeout(() => {
const currentBlock = eventDimension.getBlock(hitBlockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType(BlockTypes.get("minecraft:air"));
}
// Despawn the 'let:light_marker' entity at the same location
eventDimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
}, 100); // 100 ticks = 5 seconds
}
}
});```
I have this script that sets a light block and summons an entity in a specific coordinate. After 5 seconds, it'll remove the block and despawns the entity. But if the player leaves the world before that, they'll never dissapear
world.beforeEvents.playerLeave.subscribe(({ player }) => {
world.sendMessage(player.name + "has left the world"
);
});```
Will this work if there's only 1 player in the world?
yes
I have this but I know I'm missing something...
const playerDimension = player.dimension;
// First, remove the light block if it's still present at the hitBlockLocation
const currentBlock = playerDimension.getBlock(hitBlockLocation);
if (currentBlock && currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType(BlockTypes.get("minecraft:air"));
}
// Then, despawn the 'let:light_marker' entity using the event command
playerDimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
});```
the "player has left the world" message will send before when player leaves the world
You could kill the entity instead of despawning, isnt it
It's not working anyways 😭
Instead of:
currentBlock.setType(BlockTypes.get("minecraft:air"));
}
You could do:
currentBlock.setType("minecraft:air");
}
@scarlet hemlock
OK, I've changed that. But when I leave the world and open it again, the block and entity are there 😔
Does it show anything in console?
Instead of doing it on the script side, just add a timer in the entity itself which will despawn it, that timer will restart if entity is reloaded before despawning
Let me check that...
Clever. And what about the block?
Check if the script even runs first
using console.warn()
Is it a custom block?
No, it's a light block
He's trying to remove the light block by setting ot to air
Assuming that entity is also in the same location as that block, you could have that entity execute removal of that block too
Never used that. I'm sorry, I'm still learning 😦
??????
just put
console.warn('the script is working')
In top of your script
If this shows in the console, the script is running
Like this?
console.warn('the script is working')
const playerDimension = player.dimension;
// First, remove the light block if it's still present at the hitBlockLocation
const currentBlock = playerDimension.getBlock(hitBlockLocation);
if (currentBlock && currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
}
// Then, despawn the 'let:light_marker' entity using the event command
playerDimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
});```
Is not showing, so I assume is not working
On top of the whole script
Oh sry
Then yes, the script is working because I have other functions that are working
Maybe I'll just go with @unreal cove 's way, I think that should work
world.beforeEvents.playerLeave.subscribe(({ player }) => {
system.run(() => {
const currentBlock = player.dimension.getBlock(hitBlockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
};
player.dimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
})
});```
Can you try this @scarlet hemlock
Sure
OHHHHH
Also, do you know how can I summon the entity in the exact center of the light block?
wait a seccccccc
I'll wait
maybe add a .5 to the location
@prisma shard
const projectile = eventData.projectile;
const hitBlockLocation = eventData.location;
const eventDimension = eventData.dimension;
const source = eventData.source;
if (projectile.typeId === "let:light_projectile") {
const block = eventDimension.getBlock(hitBlockLocation);
// Check if the block exists and if the source entity has the "light" tag
if (block && source?.hasTag("light")) {
const fillCommand = `fill ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} light_block ["block_light_level"=12] replace air`;
const summonCommand = `summon let:light_marker ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z}`;
source.runCommand(fillCommand);
source.runCommand(summonCommand);
// Set a timer to remove the light block after 100 ticks (5 seconds)
system.runTimeout(() => {
const currentBlock = eventDimension.getBlock(hitBlockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
}
// Despawn the 'let:light_marker' entity at the same location
eventDimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
}, 100); // 100 ticks = 5 seconds
}
}
});```
Tried that, but maybe I didn't do it right:
summon let:light_marker ${hitBlockLocation.x + 0.5} ${hitBlockLocation.y + 0.5} ${hitBlockLocation.z + 0.5}
@prisma shard 👆 here's the entire code
I do not see playerLeave event in it
No sorry, I removed that
Here:
const projectile = eventData.projectile;
const hitBlockLocation = eventData.location;
const eventDimension = eventData.dimension;
const source = eventData.source;
if (projectile.typeId === "let:light_projectile") {
const block = eventDimension.getBlock(hitBlockLocation);
// Check if the block exists and if the source entity has the "light" tag
if (block && source?.hasTag("light")) {
const fillCommand = `fill ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} light_block ["block_light_level"=12] replace air`;
const summonCommand = `summon let:light_marker ${hitBlockLocation.x + 0.5} ${hitBlockLocation.y + 0.5} ${hitBlockLocation.z + 0.5}`;
source.runCommand(fillCommand);
source.runCommand(summonCommand);
// Set a timer to remove the light block after 100 ticks (5 seconds)
system.runTimeout(() => {
const currentBlock = eventDimension.getBlock(hitBlockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
}
// Despawn the 'let:light_marker' entity at the same location
eventDimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
}, 100); // 100 ticks = 5 seconds
}
}
});
world.beforeEvents.playerLeave.subscribe(({ player }) => {
system.run(() => {
const currentBlock = player.dimension.getBlock(hitBlockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
};
player.dimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
})
});```
you wanna remove the block and despawn entity 2 times?
and that won't work because the hitBlockLocation variable is declared outside of the event
Right
There's a timer that removes both elements in 5 seconds, but I also want to remove them if the player leaves before those 5 seconds
you set the variable hitBlockLocation in projectileHitBlock event, so you can't use the variable in the another event
I see that now
Hmmm i am thinking how could you use the same variable in both events
is that even possible idk
I can define a new one for this event
const blockLocation = player.location;
system.run(() => {
const currentBlock = player.dimension.getBlock(blockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
};
player.dimension.runCommandAsync(
`event entity @e[family=light_marker,x=${blockLocation.x},y=${blockLocation.y},z=${blockLocation.z},r=1] let:despawn`
);
})
});```
Hmmm but it won't work
Because I need to know where the block was placed
(it's starting to make sense for me 😅 )
bruh
Sorry! I'm actually learning by doing! 😜
there should be .center?
Like this? ${hitBlockLocation.center}
No... that can't be right, can it?
/give @s light_block_0 Do that command, and while you're holding the light block item, you can see where it's placed
Yes, that's how I figured that the entity wasn't being summoned at the center 😉
ah
where is hitBlockLocation?
const projectile = eventData.projectile;
const hitBlockLocation = eventData.location;
const eventDimension = eventData.dimension;
const source = eventData.source;
if (projectile.typeId === "let:light_projectile") {
const block = eventDimension.getBlock(hitBlockLocation);
// Check if the block exists and if the source entity has the "light" tag
if (block && source?.hasTag("light")) {
const fillCommand = `fill ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} ${hitBlockLocation.x} ${hitBlockLocation.y} ${hitBlockLocation.z} light_block ["block_light_level"=12] replace air`;
const summonCommand = `summon let:light_marker ${hitBlockLocation.x + 0.5} ${hitBlockLocation.y + 0.5} ${hitBlockLocation.z + 0.5}`;
source.runCommand(fillCommand);
source.runCommand(summonCommand);
// Set a timer to remove the light block after 100 ticks (5 seconds)
system.runTimeout(() => {
const currentBlock = eventDimension.getBlock(hitBlockLocation);
if (currentBlock.typeId === "minecraft:light_block") {
currentBlock.setType("minecraft:air");
}
// Despawn the 'let:light_marker' entity at the same location
eventDimension.runCommandAsync(
`event entity @e[family=light_marker,x=${hitBlockLocation.x},y=${hitBlockLocation.y},z=${hitBlockLocation.z},r=1] let:despawn`
);
}, 100); // 100 ticks = 5 seconds
}
}
});```
ah
Cute dog btw
Now I need to see a full body picture 🤣
at the top, replace hitBlockLocation with this
const hitBlockLocation = {
x: block.center(),
y: block.center(),
z: block.center()
}```
then try it
So adorable! She's a senior, right?
My dog has 11 y/o. I adopted him when he was 6 months old. Time flies
wow
It says "block is not defined"
oh, ye, you don't have block defined
And how should I define it?
const block = eventData.getBlockHit().block
Now it says Object did not have a native handle. interface property [x] expected type: number (failed parsing interface to Function argument [0])
1sec
sorry @scarlet hemlock I can't help. I have to go downstairs
My new dog, Freddie, can't be alone by himself
Np thanks!
guys
const item10 = inv.setItem(10, new ItemStack('minecraft:stick').lockMode == "inventory") will set a locked item?
hmm,
for (let i = 0; i > 8; i++) const slot0To9 = inv.getItem(i) will check all 9 slots?
i want to check if those 9 slots have a specific amount of an item, like if 3 of those 9 slots have dirt a function will execute
What
if (3 slots { 0 to 8 } has an item) { ,,, }
no
look, theres 9 slots in my entity, if 3 slots of those 9 has an item, it will run a function
ik
This is easy
Hold on lemme make it rq see if it works
it will not work depends on the item amount,
i mean
if one slot has 3 items in total, it will not work, it should work only when 3 slots have the same item.
So you mean
[ dirt ] [ dirt ] [ dirt ] run function?
And [ dirt x3 ] no function
yes
So we'll see what we can use
Initially I would use LocalStorage or var
To count the numbers in each slot and make them readable to the whole client
Then assign a number in a list using the item name with the amount
lemme show u an example:
O O O
P P O
O P O
= function
O P O
P O O
O O P
= function
P³ O O
O O O
O O O
= no function```
And if the list contains 3 pieces of dirt then check each value
Yea seems simple enough
If youd like to wait like 30 mins
I mean I spend hours coding
this is for your grinder block?
i spend more time on making UU
so the forge has 3 slots?
for (let i = 0; i <= 10; i++)
The for loop that you did, only works if i is more than 8
those 9 slots in the middle counted from 0 to 8
I spent days on my project that converts Minecraft animations into the /camera command or script API system.runTimeOut
what is the block being used?
is it using the custom crafting table component or something?
smelt grinded items
put the grinded inside those 9 slots
with a empty pocket
- some coals
to start melting them
does the block use this?
after a while it will turned into a liquid
no
ok so how is it storing the items?
simply inventory, + custom UI
UI schmui
entity
first slot always be 0
0, 1, 2, 3 ~ 256
maximum inventory size is 256
Yes, but are they in the correct order? Because the one on the far left could be 0, so have you checked their actual slots?
yeah thats what im asking
already checked
he said the ones in the middle are 0 to 8
Ah ok. Good
but what are these?
i changed the slots locations of the last 5 slots
Oki
those 9 slots in the middle is from 0 to 8
the rest is from 9 to 14
the script will work only on those slots from 0 to 8
the copper rod & blaze powder is just a place holders
so,
for (let i = 0; i <= 8; i++) { const slots = inv.getItem(i) should get the item from all 9 slots?
system.runInterval(() => {
const dimension = ['overworld', 'nether', 'the_end'].map(dim => {
for (const entity of world.getDimension(dim).getEntities()) {
const block = entity.dimension.getBlock(entity.location);
if (entity.typeId === 'my:entity') {
entity.nameTag = 'NameTag';
if (block?.typeId !== 'my:block' && entity?.isValid() && block?.isValid()) {
entity.triggerEvent('exe:dropInv');
system.runTimeout(() => { if (block?.typeId !== 'my:entity' && entity?.isValid() && block?.isValid()) { entity.triggerEvent('exe:despawn') } }, TicksPerSecond * 0.1);
}
const inv = entity.getComponent('inventory').container;
for (let i = 0; i <= 8; i++) {
const middleSlots = inv.getItem(i)
}
}
}
})
})```
thats the whole script actually

K I'll try and debug it
See what I can do and Ill check for any errors
What version of script API does it use?
Alr
Oki
1.16.0-beta is for preview, just so you know.
The "stable" beta is 1.15.0-beta
Current one.
The stable non beta is 1.14.0
Ik
Just making sure so there was no confusion.
Auto completion is there, if your environment is set up correctly.
chatSend is beta. You will need to use 1.15.0-beta if you wish to use it. It's not stable yet so it does not exist in 1.14.0.
Not possible. It's never existed for stable.
Then how'd it work
You must have used beta unknowingly.
I never used beta versions
Then it didn't work. So the only conclusion on how it could have worked is that you used beta.
But I js checked it says 1.11.0
just do 1.15.0-beta on bridge and it should work
Then it didn't work.
I used it for !gms !gms and !gmsp
chatSend is beta only.
Then also a sphere generator
It does not work on stable.
getComponent / inventory.getSlot thing isn't showing up on any other versions
u have to use 1.15.0-beta
Ok ok
I never used beta because the first time I did I lost my Minecraft mod on my Xbox world and there's no way to modify and the -beta was out of beta and the script didn't function
I mostly code on Xbox
So
1.11.0 Stable (BeforeEvents)
1.11.0 Stable (AfterEvents)
chatSend does not exist.
Ik
But you don't. Lol.
Don't have to keep correcting
I'm correcting so you have the correct information. It's how you grow and learn.
I'm js saying that's what I remember
is it requires chatSend thing?
I don't learn from others I learn from myself sorry not to be ignorant but I never liked learning for others
Then why are you here asking questions?
Naur I was js confused bc when I used it b4
im learning from others sometimes and from my mistakes all time
I'm not im helping him
Ive been teaching myself for over like 5 years
Only way I'm good at the things I do
And still I'm not that good
for me I started learning since they removed HCF, not that far
First ever mod I made was an scp096 mod from Funtime Lefty or as of now he calls himself Ayden P.
Me and him collabed
Then after the only person who has taught me abt mc addon's was Abdul rahixmm the creator of Ace Entities (practically one of the first ever 3D guns mod) he taught me how to make 3D guns and render them ingame when I was 10
Then I started working for BlockOps and basically became the owner and the boss
jeez
And I'm still kinda new to JavaScript
my first ever project was EpicPaladins bedrock port, i did removed it bec of the original creator decision
The first ever thing I made in JavaScript fully by myself after a month of learning took me 2 days to make was the thing I posted
A couple days ago
my first ever project made in js is this https://mcpedl.com/enhanced-breathing/
don't look at the script

This converts Minecraft animations into /camera and Script API
it hurts bec i was new on js
is javascript your first coding
language?
yah,
i feel like javascript isn't the most friendly language for beginners
the whole not having types explicitly defined or what ever can be an eyesore when working on large projects imo
unlike json-UI, its really hard and hurts
json ui is like a black box to me
but thats due to lack of documentation honestly
its all just json at the end of the day
neat!
Very cool thats mostly html and css tho and also very big jumpscare at the end
is there a way to load a chunk without using commands?
Could try an entity with the "minecraft:tick_world" component
is there no scripting alternative?
They pretty much all involve using commands to do things like add a ticking area. Then again, I didn't really get that to work with script so I wound up just teleporting myself with script to get the chunk loaded so that I could do other things then move on to the next step. Of course that was me using a script to setup a world with no other players in it.
How to get the cooldown component of an item in 'itemUse'??
Only call the function if the cooldown is = 0
I’m new to bedrock add on development. Is it possible to set the texture of a black or entity dynamically at runtime. I mean actually generating a new texture, pixel by pixel, not referencing an image in the texture folder.
It is not possible, no.
Is there a way to create a custom map item where you set the pixels?
Are you sure? Even with shaders? It was done often back in the Bukkit days.
Plugins? Sure. Addons? Nope
Best you might be able to do is a bunch of particles mimicking a texture
how can i an entity's location from player.getEntitiesFromViewDirection
player.getEntitiesFromViewDirection().forEach(entity => {const location = entity.location})
tysm
Sorry for bad spacing i wrote that out on my phone
np, thank you
does it return an array?
i only need the first entity
^
then just break the script after the first entity
alr thanks
const entities = player.getEntitiesFromViewDirection();
const firstEntity = entities.length > 0 ? entities[0] : null;
if (firstEntity) {
const location = firstEntity.location;
// Do something with the location
}
@meager zenith
thanks
Np
You can also just do player.getEntitiesFromViewDirection()[0];
const entity = player.getEntitiesFromViewDirection()[0];
if(entity) {
const loc = entity.location;
// do something
}
What would be better on this situation? I'm using BlockCustomComponent and im creating growing plants should I do
onTick: (event) => {
const { block, dimension } = event;
const blockState = block.permutation.getState('si:growth');
const tickRage = 3200 * (1 + Math.random())
let timer = 0
timer = timer + 1
if (timer = tickRage && !block.permutation.withState("si:growth", 4)) {
block.setPermutation(block.permutation.withState("si:growth", blockState + 1))
}
else null;
},
or should I
onPlace: (event) => {
const { block, dimension, previousBlock } = event;
let blockLoc = block.center()
let blockState = block.permutation.getState('si:growth');
if ( blockState == 0 ) {
const timeoutId = system.runTimeout(() => {
block.setPermutation(block.permutation.withState('si:growth', blockState + 1))
dimension.spawnParticle("minecraft:crop_growth_emitter", blockLoc)
},4200 * (1 + Math.random()))
vineTimeouts[getBlockLocationAsKeyString(block)] = timeoutId;
}
},
onPlayerDestroy: (event) => {
const { block } = event;
const blockLocationKey = getBlockLocationAsKeyString(block);
if (blockLocationKey in vineTimeouts){
system.clearRun(vineTimeouts[blockLocationKey]);
delete vineTimeouts[blockLocationKey];
}
}
which one is better?
also weird interaction with onPlace. When block state is changed onPlace is also triggered.
should I stick with the first one?
const hmmm = me.afterEvents.wondering
how can i make slots accept only a specific item?
like slot 0 can have only sticks, when the slot gets a different item it will be cancelled
is this how i import multiple scripts ??
import './gwim/gwim-form';
import './gwim/gwim-rank';
Yup
Afaik
btw can you use /ability ?
gosh the forge system is so complicated
lol
name tag, yes
my item doesn't have display name inside the json file,
and no name inside RP text file
its not renaming the item for some reason, i think i had to make it has a display name first right?
name tag will still work
make sure ur re-setting ur itemstack in slot after naming it
oh wait a moment,
it has logs, and not working at all
i fixed it by adding an invisible display name for it
Is there any way to change a mob’s target via scripting?
custom mob?
not directly but if the mob prioritize who hit hem
you can by applying damage
Can someone help me? Is there any way I can make an entity release particles? Like if I shoot a bow and the arrow comes out with particles?
animation & animation control
script api is the last option when it come to client side stuff
Oh, ok thanks
How am give enchanted item
Does the script API support Particles at all? Couldn’t see anything? Surely it would make sense to spawn a JSON-defined emitter given something happened
dimension/entity .spawnParticle
How to give enchanted armour
first set the enchantment to the itemstack
then set the item on the slot
@shrewd wedge
Ok
if (msg == "-item test") {
const inventory = player.getComponent("minecraft:inventory").container;
let itemHeld = inventory.getItem(player.selectedSlotIndex);
player.sendMessage(`${JSON.stringify(itemHeld)}`);
const equippable = player.getComponent("equippable");
const test1 = equippable.getEquipment("feet");
if (test1 !== undefined) {
player.sendMessage(`${test1.typeId}`);
}
}
})
Do you know why this not working?
anyone know why this happens? It's getting AbilitiesRangerDruid from another file
what is not working exactly
that looks fine
ah
Feet the first chat
char*
it's capital letter
Ohh
you can also use enum
What that?
import EquipmentSlot to @minecraft/server
this will show u
Okay
Thanks
Is there a way to set the data for a map item?
the only "data" that you can to an itemStack it's lockmode, durability, enchantments and dynamic properties
well, amount and nameTag tho
idk if this is off topic or not but most of you here are using github so i think it is the best place to ask
is there a better way to handle pushing addons to a repo the copying both folders to the same folder?
i can use mklink command but there has to be a better alt
how do you handle your repo?
i mean as in method, the way you do it
i just copy both the rp and bp to where the local repo is and push the changes
i can automate that with mklink but is there a better way?
hmmm im not sure if theres a better way, mostly cuz i havent touched github that far
i just let my IDE to make changes in the fork(branch) and pull request into main repo(branch)
i was uploading files manually before but i hit the limit of 100 file so i had to clone the repo and use git
Does anyone have template for connectable chairs/sofas
#1067876857103536159 should have that already,
but if ur talking abt permutation change whenever a block moved/placed, then script might help...
Ohh sorry
Can is ask where is it, I've been trying to find it for hour and I can't find it hehehe
Just like this one
#1283826268839874580 message
umm, how can i make something run for only one time inside runInterval?
if (something === true) { run something for only one time, no more }
system.runTimeout(() => { ,,, }, TicksPerSecond * 100000000) will run the thing after a decade
system.runJob(somhow) i fr don't have any idea
Inside a runInterval!
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
if (something === ture) {
const run = system.run(() => { myCommand });
system.clearRun(run)
}```?
system.runTimeout(() => {
console.log('Hello World!'
}, 10) // 10 ticks
oh
nvm
let run_flag = true;
system.runInterval(() => {
if (run_flag) {
// do whatever
run_flag = false
}
})
@untold magnet
the same runInterval will turn that into true
lemme think about something else
nvm..
it has to be something like let amount = 1; right?
if i put system.runTimeout inside a system.run, is it will run that instantly first, then it will have the runTimeout delay?
i dont think so
no it won't
system.run(() => { ,,, }, 1)?
it's outside of the interval
it will not happen only once,
that's the point isn't it?
misread
it will happen only once
if your variable is outside of the interval
you're only setting it to false inside the interval
what ", 1" for
let amount = 1;
↓ inside a runInternal
for (let i = 0; i < amount; i++) {
system.run(() => { ,,, }, i)
}```this sounds stupid too
trying to run something only once inside a runInterval
bro what
just do what I said
uhmm
why do you need system.run for that
no?
why
why
do you need it
i just want to run something inside the runInterval only once,
yeah so do what I said
ugh
as what i know, that run_flag will be always false bec of the interval, isn't it?
do it need to be inside the runInterval ?
let run_flag = true; // OUTSIDE of interval, will only be true ONCE
system.runInterval(() => {
if (run_flag) {
// everything in here only runs ONCE
run_flag = false // set the flag to false, so it doesn't ever run again
}
})
yes
no, it'll be true if you set it to true, then it'll run everything once, and then it'll be false
btw system.run is mostly only used for exiting read only mod in before events
i dont need it ig
i knew it
that for testing only tho
it should send that message whenever i place the block just like the first time, not only ONCE
its just a test to see, placing the block will spawn an entity
that entity is detected using a runInterval, the sendMessage is inside that runInterval
place block event be like:
"why i am here"
whenever this if (something === true) it will run something only once,
im not doing that buddy
this is the code:
if (something === true) {
// runSomething only once
system.runTimeout(() => { the same commamd i want to run only once but after 80s }, TicksPerSecond * 80)
}```
lemme make it clear to understand
uhh then just reset the flag when you place the block???

show your whole code, not weird abstract snippets of it
that doesn't tell us anything
dealing with block place without block place event is something new
uhh, iirc wave made a blockupdate event
const coal = entity.getDynamicProperty('coal')
if ( item9?.typeId === 'minecraft:coal') entity.setDynamicProperty('coal', true)
if (coal === true) {
//run only once
system.runTimeout(() => { if (slots9Dyc === true && slot11Dyc === true) { item9.amount -= 1 } else entity.setDynamicProperty('coal', false) }, TicksPerSecond * 80);
}```item9 = inv.getItem(9)
@slow walrus @distant tulip 
the runInterval is for the entity inventory
so? you can runInterval in the event after block place
if slot 9 has coal on it, it will run something once, and it will degrees the amount after 80s
to be honest, i want to degrees the coal amount immediately, but only once bec after 80s it will remove one coal from that slot
6 lines is really not enough to understand what you're doing
decrease*
the runInterval is for the entity inventory, like having items in specific slots will run somethings,
like having coal in slot 9 will run something instantly but only once, the same thing will ran after 80s from the first one
use containerslot if ur using runtimeout/interval
is this will explain it?
const inv = entity.getComponent('inventory').container;
const coal = entity.getDynamicProperty('coal')
if (item9.typeId === 'minecraft:coal') entity.setDynamicProperty('coal', true)
if (coal === true) {
//run only once
system.runTimeout(() => { item9.amount -= 1 }, TicksPerSecond * 80);
}```
forgot to put this const item9 = inv.getItem(9);
how about now?
const inv = event.source.getComponent("inventory").container
const item9 = inv.getSlot(9);
const coal = entity.getDynamicProperty('coal');
if (item9.hasItem() && item9.typeId === 'minecraft:coal') {
entity.setDynamicProperty('coal', true);
}
if (coal === true) {
//run only once
system.runTimeout(() => {
if (!item9.hasItem() || item9.typeId !== "minecraft:coal") return;
if (slots9Dyc === true && slot11Dyc === true) {
if (item9.amount === 1) item9.setItem();
else item9.amount -= 1;
} else entity.setDynamicProperty('coal', false);
}, TicksPerSecond * 80);
}
u put all of that inside the runTimeout, it will not decrease the item from that slot instantly once, isn't it?
that runTimeout will run one time every 80s
it will run 80s after coal === true
uhm, do want it in runInterval?
yes, looks buddy
when coal === true, it will decrease one item only one time, bec system.runTimeout will decrease the item after 80s infinitely,
hmmmm
lemme do something
make a post if u may
nvm, it has the same issue
why is it soo complicated 
custom furnace?
kinda
its a forge block, it needs coal as a fuel
i thought about something really stupid
the slot needs continuos checking, not just every 80s
when the player interacts with the block while holding flint and steel, it will light the block and make it start burning the coals,
wait a moment
if (something === true) { system.runTimeout * after 80s)
something = false will happen after 10s, is it will run that timout even if that something isn't true?
#1289561553934221382
i mean, if i turn off that something, the runTimeout will not happen right?
it still tries to timeout unless it's clearRunned
if i set that something to false before the runTimeout, it should not run the command inside it bec the section that it's in is turned off right?
lemme make the code and send it inside that post, hopefully someone will help
run, runTimeout, runInterval are like rogue code that's sent to run at scheduled tick
so u might have to save the runId to clearRun if ever the 'something' turns false
or just clearRun when u set(something, false)
Is it possible to use Dynamicproperty for an item?
What is the difference between
world.getEntity(identifier)
and
world.getDimension(MinecraftDimensionTypes.overworld).getEntities().find((x) => x.id === identifier)
cuz getEntity works on a beforeEvent but getEntities.find() doesnt
you did x.id it should be typeId, iirc id is different thing than typeId
Yes, id is a runtime id (a number)
Oh wait
It should be the same...
If you're not using a typeid instead of the numeric id
i did x.id, shoudnt be typeid
i dont want a cow
i want a specific cow
hmm, interesting
uhh, both works for me tho
world.beforeEvents.entityRemove.subscribe(({ removedEntity }) => {
console.warn(world.getEntity(removedEntity.id) + " entity found using getEntity()");
console.warn(world.getDimension(MinecraftDimensionTypes.overworld).getEntities().find((x) => x.id === removedEntity.id) + " entity found in array");
});
when a entity dies this happens
aha
Would it be possible to make a custom version of the lead? Like with a different texture, but the same behavior?
anyone alive?
yes
does this:
const coal = entity.getDynamicProperty('coal', 0)
coal++
will increase that number?
like from 0 to 1 to 2?
get not set*
no
make sense actually
so you need to set the dynamic property, and get the current value of it, and do + 1
I'll say, my brain is on fire
i thought theres a better way
what way would be "better"
run something once inside of a runInterval
idk
system.runTimeout(() => {
if (coalPrc === 0) entity.setDynamicProperty('coalPrc', 1);
if (coalPrc === 1) entity.setDynamicProperty('coalPrc', 2);
if (coalPrc === 2) entity.setDynamicProperty('coalPrc', 3);
if (coalPrc === 3) entity.setDynamicProperty('coalPrc', 4);
if (coalPrc === 4) entity.setDynamicProperty('coalPrc', 5);
if (coalPrc === 5) entity.setDynamicProperty('coalPrc', 6);
if (coalPrc === 6) entity.setDynamicProperty('coalPrc', 7);
if (coalPrc === 7) entity.setDynamicProperty('coalPrc', 8);
}, TicksPerSecond * 10);```this will change the number once every 10s
in total 70s
im wondering if i can make it better
I just told you how.
just show me how
...
no.
you already have the variable of getting the dynamic property, use that variable when setting the dynamic property and just do + 1
you are getting the current value and adding onto it.
setDynamicProperty('coal' +1)
dont mind me im stupid without my brain
you didnt use the variable.
just add the variable before the math, and you will be all set.
if (coalPrc === 0) entity.setDynamicProperty('coalPrc') + 1?
the setDynamicProperty methods requires 2 parameters.
const t17x = stupid({ as: hell })
also you still didnt use the variable.
^
buddy i just have no idea how to write it
entity.setDynamicProperty('coal', coalPrc + 1)
also in your logic this will only go up if it's 0
which makes this pointless
if this wasnt intentional, remove the if statement, or better yet, check if its defined in the if statement instead.
👋
system.runTimeout
But can I make it so that when I have a tag it waits a certain amount of time?
if(player.hasTag('hmm')) system.runTimeout
Thanks
are you asking for a delay or wait? like async
idk wdym but you can use await and runtimeout
anyone know how to get this to face where the player is facing when spawned? player.runCommandAsync(`summon myth:uppercut_spell_effect ~ ~ ~ ${PlayerViewDirection.z} 0`)
Hey I need your opinions people:
I got 3 different plants
Should I make 1 global timer and give each plant a probability to grow
OR
Should I make independent timers for each plant
which one would be better and would not have issues in the future?
Oh that event, well yeh, the array.find sure is slower than getEntity so that's prob the difference
Also, getEntities is like @e and those with hp < 0 aren't included, i think
"format_version": 2,
"header": {
"name": "§aGlitch §cPvP §eFunctions §ev1.0.2 BP§r",
"description": "Made by @untakensoulz",
"uuid": "c9abbf4e-1cd5-4869-8a1b-486fcf435708",
"version": [
1,
1,
0
],
"min_engine_version": [
1,
18,
0
]
},
"modules": [
{
"type": "data",
"uuid": "84d5a89b-8dcc-0308-a7d7-fd5f8123bba7",
"version": [
3,
6,
9
]
},
{
"type": "script",
"language": "javascript",
"entry": "scripts/main.js",
"uuid": "2fa09013-80e6-c43a-e1c7-73dafb30fdd0",
"version": "1.6.0"
}
],
"metadata": {
"authors": [
"@untakensoulz",
"Author here"
]
},
"dependencies": [
{
"description": "@minecraft/server module dependency",
"module_name": "@minecraft/server",
"version": "1.4.0-beta"
},
{
"description": "@minecraft/server-ui module dependency",
"module_name": "@minecraft/server-ui",
"version": "1.4.0"
}
]
}```
does anyone know why my manifest is tweaking this is my first time updating it 😭
Why the update is nothing specical
reading wikis for algorithms give me a brain hammorrhage
i fucking hate how "scientific" they sound bro.
USE
SWITCH
or just, you know, entity.setDynamicProperty('coalPrc', coalPrc)
How can I obtain player kills and deaths?
probably jus count them and save it using dynamic props
ugh
let coal = entity.getDynamicProperty('coal')
coal = true ← should set the value of coal into true, right?
no
already
entity.setDynamicProperty('coal', true)
i was writing that
let coal = entity.getDynamicProperty('coal')
coal = 0 ← should set the value of coal into 0?
should i use it or not?
i mean should i use it to change the value of that property or not?
if (coalPrc < 8) {
entity.setDynamicProperty("coalPrc", coalPrc + 1)
}```
okay, thanks
Is it possible to create a custom dimension through scripting API
But is it possible in addons
No
I wrote a simple API in TypeScript/JavaScript, where should I post it?
https://github.com/m0lc14kk/WebhookAPI
Just want to showcase this by a bit.
#1046947779118895114 ...
thanks
Wc
i thought theres a better way to do that
um, guys
entity.isValid() = inside loaded chunks?
!entity.isValid() = inside unloaded chunks?
i want to force the script to work on the entity when it is inside loaded chunks
Can someone help me? How do I make it so that when I click on a block holding an item in my hand it sends a message in the chat?
playerInteractWithBlock
I've already tried but it doesn't work
Ok, thanks
import { world } from '@minecraft/server';
world.afterEvents.playerInteractWithBlock.subscribe(({ itemStack, block, player }) => {
if (block?.typeId === 'minecraft:dirt' && itemStack?.typeId === 'minecraft:stick') world.sendMessage(`${player} is interacting with dirt using ${itemStack.typeId}`)
})```
idk maybe the sendMessage have issues
if it has issues just change it
youd want to use player.name instead of player
oh wait
yah i forgot
Thanks, Let me try
in the last module versions (1.15.0-beta iirc) they changed it so you should use beforeEvents if it's not a interaction registered by the game/custom component
It didn't work, it doesn't show any error but the sendMessage doesn't appear either.
@static nebula
But I'm using 1.14.0 beta
what version is your minecraft
i think
playerInteractWithBlock works only on items that can interact with blocks
like shovel can interact with dirt or axe can with wood
so it was updated in 1.14.0-beta ? gtk
u have to use itemUseOn component
How do I get an anchored position for the player? Something similar to the command 'execute as @s anchored eyes positioned ^^^0.8 '
maybe player.getHeadLocation()
The anchor part I believe is that, but what about the offset?
Maybe if I get the block in the direction of the player's view and use the vector it will work
well, buddy
i still have no idea how isValid work
isValid should make it works inside the loaded chunks only right?
!isValid will make it work inside unloaded chunks only, right?
entity.isValid() → works only inside loaded chunks
!entity.isValid() → works only inside unloaded chunks
without isValid → works inside loaded and unloaded chunks
I think I'll just use a runCommand
e.isValid()// true loaded
e.isValid()// false unloa(ded)
I don't want to spend hours making a vec-2 to vec-3 converter
I was thinking about using getRotation()
Removing z properties won't take you an hour, lol.
Considering I'm completely dumb, yes
also ur prob gona use that converter furthermore
if I were to choose to keep either promises or for while loops
it's async all the way
ppl need to learn their async await man
Promise.all
my beloved
more useful than race imo
or any of the Promise statics for that matter
i used it to collect member's approval to create a group
nice
promises is nice
second best JavaScript feature ngl
(the fist would be arrow functions)
then aboozed it like diz```js
await new Promise(r=>{ return })
what
sure ig
basically, there's resolve, reject, and abort
uh huh and?
dunno
then what were you going on about
fair
been using typed array recently
they're pretty fun
bitwise stuff makes me feel smart af lol
hopefully someday I'll have time to experiment lots with such data type
its giving an error let rotation = player.getRotation() player.runCommandAsync(`summon myth:uppercut_spell_effect ~ ~ ~ ${rotation} 0`)
is it possible to change knockback resistance?
Dude, just...
Just use ^^^1
If you're going to use commands instead of the native method, you don't even have to worry about figuring out rotations.
You should use native methods instead of commands tho
Dude, just...
Just use spawnEntity(id,{rotation:vector3})
Preferably, but I'd imagine he's new to this
there's an interface for spawn entity?
yeah?
I did not realize.
under dimension class
interface
im not talking about the method to spawn an entity
hmm?
wdym
why are you sending me this
I’m not trying to make it spawn in front of the player, I’m trying to make it spawn facing where the player is facing
use native methods
it is much easier
How can i create loop? Loop wich will run command in every 2 second
system.runInterval
you can do dimension.spawnEntity('minecraft:entity', vector3).setRotation(player.getRotation())
however, it takes time for the entity to update its rotation after being spawned sometimes.
is it player.dimension?
it says dimension undefined
nvm i was wrong here
writing from memory lol
what @thorn flicker sent i correct
well you need to get the dimension class from somewhere.
get the player's dimension.
let dimension = player.dimension would this work?
yes.
Okey but it does not work
import { system } from "@minecraft/server";
system.runInterval(() => {
system.runCommandAsync("effect @a regeneration 2 3");
}, 1);
I should replace system.runCommandAsync with something(bc it gives error)but i did not know with what.
says vector3 is undefined
because its undefined, obviously, its just a placeholder.
use the variable you made thats stores the player's dimension.
it takes a bit for the rotation to update, like I said
maybe that's what you are experiencing
oh

(its lame)
its really lame
im spam clicking the same direction and it is not changing direction lol
idk if they are going to "fix" this or not
is it even broken? I dont know, but its lame either way
lol
well thats odd
it should be
by taking time, I meant like a couple seconds
oh
my entity exists for only like half a second
i can see it turn tho
i see it spawn then rotate but face the wrong direction
fyi you can do that with CMD by doing
execute at player run summon something xyz ~~
i am using same thing and it is working fine
keep in mind the body rotation need time
you can fix that with animations
how to check if an entity is alive?
how can I communicate with my websocket server on world?
entity.isValid
like with script API?
or commands
custom entity
I used /connect and I don't really know what should I do next
Minecraft lets you connect to a websocket server when you’re in a game. The server can receive and send any commands. This lets you build a bot that you can … (well, I don’t know what it can do, let’s explore.) Minecraft has commands you can type on a chat window. For example, type / to start a command … Programming Minecraft with Websockets Rea...
also @distant tulip can you join my world i wanna test something ??
yea i know that but how ?
sure
really nice resource
ok ill send invite
I'll check this out
got it, is there any list with listeners?
elaborate please
I would like to add support for Realms for my API that I wrote today
so I have to use websockets to send somehow request to Discord
uh huh
so um, can I somehow listen to scriptevent command or smth>
you can send a tellraw to the player that has the websocket connected
the tellraw can be read from your websocket
technically I can send messages via tellraw that i'll hide using JSON-UI then
here are all events (that I know of) that can be subscribed to
which includes chat messages if that's what you're looking for
that would probably be the only way, yeah
afaik, there's no other way to send strings to websockets
I think this will be pretty easy way
PlayerMessage is the event you'll want to listen for
import { Server } from "ws";
import { v4 } from "uuid";
const wss = new Server({ port: 8080 });
wss.on('connection', (ws) => {
ws.send("WebSocket server has been started!");
ws.on('message', (message) => {
console.log(`${message}`);
ws.send(`You sent: ${message}`);
});
ws.on('close', () => {
console.log("Client has been disconnected.");
});
ws.send(
JSON.stringify({
"header": {
"version": 1,
"requestId": v4(),
"messageType": "commandRequest",
"messagePurpose": "subscribe"
},
"body": {
"eventName": "PlayerMessage"
},
})
);
});
console.log('WebSocket server is running on ws://localhost:8080');
I got some code already xD
nice 👍
I thought it was a bit harder
@distant tulip
what happened ??
i said i gtg
kinda busy
just ask here it is not a hard thing to do
oki
can anyone tell me how to make something in which if i right click an npc (custom npc) a chest ui opens up in which i can actually put items and take them out later
??
What world event recently got an option to only fire once on use ?
interactwith block/entity
Thanks!
i made a simple wrapper that you might find that this useful
https://github.com/WavePlayz/bedrock-websocket-server-wrapper/
let { Server } = require("./bwssw.js")
let server = new Server()
server.onConnect( async client => {
const { name } = client
let response = await client.runCommand( "say " + name + " joined" )
if ( await client.test( "x=0,y=0,z=0,r=5" ) ) {
client.sub( "PlayerMessage", event => {
console.log( event )
client.unsub("PlayerMessage")
} )
} else {
}
} )
server.onDisconnect( client => {
// code
} )
server.start(8089)
setInterval( async () => {
let bannedPlayers = await server.client( "tag=ban" )
bannedPlayers.forEach( client => {
client.disconnect()
} )
}, 1e3 )
I already wrote what I need, but I appreciate that
🫡
I already bought sample discord.js (Node.js) cheap host and everything is working fine
Just need some time to publish it
does the entityHurt afterEvent detect when the damage is fatal?
no
you can do this getting the health of the entity that was hurt
then you can calculate if it's fatal using this:
const hurtEntityHealth = hurtEntity.getComponent('health').currentValue;
const isFatal = (hurtEntityHealth - damage) <= 0 ? true : false;
tbh idk if that works
or just get the life, should work
const isFatal = hurtEntityHealth <= damage; 
cant you just do js const isFatal = (hurtEntityHealth <= 0);
since its entityHurt event, the currentValue for health would be after the damage anyway
didn't know that xd
ah yes
cause there's no before event yet
bruh i already want to use that event
annoying to cancel the fatal damage using json
Its possible to make a text display in block using json and script api?
Anyone
not really, the only block that can do that is the command block, you can use a invisible entity and then rename it
and u spawn it above the block
That would be cool, but what I really need is to make a display on the block texture
basically like a sign right?
Ye
not possible
is there any way to prevent a player from using / commands with scripts or regular bds?
If you don’t mind monospace text, and ascii only, you could create a texture ahead of time with each character on it ahead of time. Then, you could spawn a single particle for each letter and have it use the appropriate part of the texture. Best I can come up with. The add ons are too limited in my opinion.
Thanks
No problem. I wanted to do something similar. I though about modifying map items’ data directly but I believe that’s not possible
How can I get the player's main hand slot in a script?
const equippableComp = player.getComponent('equippable');
const item = equippableComp?.getEquipment('Mainhand');```
```js
console.warn(item.typeId)```
returns undefined if the player is not holding anything
Ok thanks
const selectedSlot = player.getComponent('equippable') const item = EquipmentSlot?.getEquipment('Mainhand'); console.warn(selectedSlot, item.typeId)
like this?
oh wait, you want the selected slot? or just the item on mainhand
The item in main hand
then you dont need anything abt slot, only that
But then how do I get the main hand item?
that gives you the main hand item
I want a code where I can know which block the player is holding at the moment but this is the first time I use scripts
umm, I got some troubles with my API
I can't listen to /tellraw
and any other commands
unless I can somehow send message as a player
okay: did some research, I can pull this out 100% for worlds, but I'm not sure about Realms yet
Is it possible to create custom buttons because I wanna create a dogdge system where I add a custom dodge button
someone help with #1290170284917395496
should I make another post when I'm updating my showcase or just push it into another message inside the thread of post?
#1289931246042087567 reference to this btw
push when its small, post when its big
thats what it says in showcase channel description
it's support for worlds/Realms
it's not that much changes, but it's a perfect for Realms/worlds
so I'm not really sure xd
When will 1.15.0 @minecraft-server will be released? 1.21.40?
Do you mean 1.16.0? 1.15.0 is released with 1.21.30.
Oh, my apologies, you mean for Stable, not Beta.
other than loops is there a change dimension detector in the script api?
There is an event listener for when a player changes dimension.
Documentation for @minecraft/server
that's beta
You didn't specify 😜
you're right, i forgot
In stable, you only have the option of looping through players.
i guess that's my only option then
let procsC ←
entity.setDynamicProperty('procsC', procsC + 1); returns a log
(procsS ?? 0) + 1
What is procsC being defined as? Is it a number?
and let procsC = entity.getDynamicProperty('procsC');
^ that if it's initialized but not defined.
LOL
Yeah
1.15.0 stable
1.21.40 maybe?
Is it just me, or does your username resemble a partition on Android?
#random lol
I'm using that method ('coalPrc' coalPrc + 1) and it works fine, but not for the second one for some reason
i mean
entity.setDynamicProperty('coalPrc', coalPrc + 1); this works just fine
Don't worry about it lol.
Partitions on Android are represented by device node names like mmcblk0, mmcblk0p1, etc., which correspond to the physical block devices and their partitions. Your name, for a brief moment, resembled that, but I couldn't recall the actual spelling of such node names until I went back to verify haha.
let procsC = entity.getDynamicProperty('procsC');
entity.setDynamicProperty('procsC', procsC + 1);
const test = entity.getDynamicProperty('procsC');
console.log(test);
This will not work, because I am declaring procsC but not defining it. It's not defined because the dynamic property it's trying to retrieve in that variable doesn't exist. Meaning that I have not created it nor defined it before attempting to get its value. When a dynamic property doesn't exist it returns undefined, thus the variable procsC will be undefined. So in the next line of code you attempt to set a value for a dynamic property called procsC by adding a variable and a number. Since procsC is undefined due to the failed attempt in the first line of code, you get an error. You can't add 1 to a variable that is not defined by a number.
Now, let's forget the example above. Let's assume you do in fact declare and define procsC in your code which you have not shown us. Then you must be sure it's a number and nothing else. You cannot mathematically add 1 to a string, vector, or any other type that is not a number without prior intervention.
Is it possible to create custom buttons because I wanna create a dogdge system where I add a custom dodge button
#1067869374410657962 until ORE-UI becomes a reality.
Nooooo my dreams are crushed😭😭😭
Back to the drawing book then 🤪
can I save .txt or any file via script api?
no, beacuse you don't have permission to modify/read files via API
the closest thing you can do is render a textField form with default value that you would like to save
and manually save it
or use WebSockets/HTTP requests to export some data and handle them by their servers
ohh these partitions
I thought about smth different
Yea lol
ugh...
if (item9?.typeId === 'minecraft:stick') item9.nameTag = 'f'
should change the item name, right?
somehow its not
why?
if its itemstack u need setitem
if (item9?.typeId === 'minecraft:stick') inv.setItem(9).nameTag = 'f'?
