#Script API General
1 messages · Page 97 of 1
Yeah. I haven't noticed any lag, but wish I could figure out how to turn off the slide-in animation
I'm using it as a gui for all of my skills and work block interactions so it gets kind of old lol
I'm opening it with a button at the moment and you can notice a slight freeze when initially opening it but it could just be me 
The slide animation is done through the third_party shit in server_form
Might just depend on hardware. My server is on a Ryzen AI 370. Oh, is there a way to disable?
Never realized how much I rely on good documentation and editor suggestions until I tried JSON UI and had neither lmao
"[email protected]_screen": {
"$screen_content": "server_form.main_screen_content",
"$screen_animations": ["@server_form.exit_wait"],
"$background_animations": ["@server_form.exit_wait"],
"type": "screen",
"anchor_from": "top_left",
"anchor_to": "top_left",
"button_mappings": [
{
"from_button_id": "button.menu_cancel",
"to_button_id": "button.menu_exit",
"mapping_type": "global"
}
],
"force_render_below": true,
"size": ["100%", "100%"],
"load_screen_immediately": true,
"low_frequency_rendering": true,
"render_game_behind": true,
"render_only_when_topmost": false
},
"exit_wait": {
"anim_type": "offset",
"easing": "linear",
"duration": 0.08,
"from": [0, 0],
"to": [0, 0],
"play_event": "screen.exit_pop",
"end_event": "screen.exit_end"
}```This includes the exit_wait but you'd do the same for the entry
Thanks a lot 🙂
Nevermind, I just tested what I sent you and it does just pop in and out
There's no sliding in or out anymore lol
Thanks. It was driving me crazy. I have 23 skills, each with their own sub menu to show what gear etc different levels unlock, and their respective crafting menus / individual craft items.. so having that happen for every interaction.. uhg
I also ended up removing the furnace screen and pattern for the chest form out of mine.. See no point in having it
Does the 10 indicate the level of the skill?
That's neat. You can actually have it display the 1 but then it'll display everywhere lol
Tried 120 but it clips the text
Yeah.. back when you could get over 100 it would only ever display 99+ anyway
Yeah just thought it'd be cool. The XP can get to 200m though so can still do invisible unlocks
Only downside I see in this now is that the durability always remains green
It doesn't change colour as it reaches 0 durability 
Oh nice
only thing that would really need changed is that I just saw my lvl 99 guard technically stops you from gaining xp after 99 but should be easy to fix if you use any of it
yeah uncommenting that part is what I was looking for, thanks
also removed inventory and furnace portions and all their associated code. much much faster now
Skyblock
It looked really good for just a skyblock
that is the point 😭
that was fast, lol
only took 30 mins lmao
oh, i thought it took 5 min
well technically then i realized i forgot to add the temporary ticking area when saving the island
You are using tick_world component?
?
Well, that answer my question lol
It is not recommended to use ticking area command, it is limited
mind if i dm u rq?
Sure
anyone know off the top of their head how getEntities orders the entities?
isn't it ordered by closest to farthest
Hope so
Is this how I add effects the fire resistance works but not the resistance effects: [{ type: MinecraftEffectTypes.FireResistance, amplifier: 0, duration: 1000000 },{ type: MinecraftEffectTypes.Resistance, amplifier: 3, duration: 1000000 }] }]
How are you using that array?
If someone is wearing a full set of armor these effects are supposed to be applied
I can send the script file
This is the script
It was just the fire resistance but I also want to add the resistance
That's a hella lot of code, but in the run interval you're just applying the first effect
around line 255
entities order
Thanks
How do I apply both effects
for each loop or smth
Instead of just effects[0]
What do I put,
Can someone help me there https://discord.com/channels/523663022053392405/1391878179731279892
Please
anyone know how i can test for players killing other players
Anyone have an example code for w and s key pressed check?
Nvm, theres still no other buttons than jump and sneak
MovementVector is enough
I mean its when im riding an entity
It still should be enough? Or does movement vector not change if the player is riding?
Can i have this version of the chest ui?
Does anybody know how to add delays in run intervals
runTimeout
oh wait
oh delays in intervals
system.runInterval(() =>{
},10)
//10 is the delay in ticks iirc
guys, i need some help with my custom component. this is the script i have, and this is the custom component on my item. it doesn't want to work on logs and woods when there's is_axe tag on my item. what am i supposed to do than?
import { toolDurability } from "utility/itemDurability.js";
export const event = {
onUseOn({ block, source, usedOnBlockPermutation }, { params }) {
for (const param of params) {
if (!param.blocks.includes(usedOnBlockPermutation.type.id)) continue;
block.dimension.playSound(param.sound, block.center());
if (param.damage_tool) {
toolDurability(source);
}
break;
}
}
};```
when i add any other block to any of these arrays, everything works
Thanks
Is it possible to run a function/script using voice input? I don't care if I need to use discord or some other shenanigans I'm just curious and thinking about an addon that could use voice input (it's not proximity chat)
Yes. But goodluck.
HTTP or MCWSS to an outside tool which analyzes voice data
Alr so minecraft bedrock's javascript can accept HTTP API requests?
Yeh. BDS only
Wow didn't know that
That's fucking cool
is BDS just a normal server or do you need to follow a certain procedure? I have or atleast have access to a Minecraft Bedrock Bisect Hosting server
Would it work?
BDS is just a software you run to host an mc server.
Ok
I'll look into it, thank you a lot
https://wiki.bedrock.dev/scripting/script-net very easy to set up too
This community is the best thank you for your help
What have you tried so far?
is it possible to change npc dialogue message using script?
How to disable damage between players using ScriptAPI?
you cant.
How do I get the Minecraft player's voice input? Do I need to use discord? If I have the input I know how to setup the whole audio to text API.
in beta, you can get the NPC component.
Documentation for @minecraft/server
probably not the message directly though
How to do this together with JSON and ScriptAPI?
just use damage sensors, no script needed.
I just want to make a system that can be controlled via ScriptAPI
so use events that swap out/remove the damage sensors with component groups.
you can trigger entity events within the script api
or you can use tags, or properties, and filter them in the damage sensor filter.
entity.triggerEvent("ev")
I was looking at the player's JSON parameters, but I'm curious if there is another identifier than the tag?
I have been coding from my phone for years and now I have a computer, how can I code from the computer?
vscode + types + debugger extention
block placer doesnt fire any of the item events?
Are you doing replace block item or?
which events?
before & after itemUse, itemCompleteUse,
custom components: onUse, onCompleteUse
had use modifiers also when used onCompleteUse
complete use is for chargeable items (minecraft:food, minecraft:shooter, minecraft:throwable)
use modifiers and use animation don't do anything if the item isn't chargeable
onUse is for when the item isn't used on a block
onUseOn should work
have you tried playerPlaceBlock?
How can I send audio from a minecraft player's mic to a website using HTTP request, do I need to use discord or is there another way?
world.afterEvents.playerSpawn.subscribe(({ player }) =>
transferPlayer(player, "24.19.3.41", 24302));
what changed also what version server admin
What is this supposed to do?
Oh you replied to that
what is like version of server-admin
Sorry
i have 1.0.0 it dont work
1.0.0-beta
Does someone know?
Are you looking to create a proximity chat-esque thing?
i dont think its possible to acces the player mic from the game
Because if you're looking to play their audio inside of minecraft, you can't. Sounds have to be defined in the resource pack.
I think the best you could do with just addons is have players all in a voice chat in discord, and change their audio level based on distance by sending http requests to a discord bot.
that will not work since every player needs to ear the near players
hmm
the only way is connect it to client side script using discord browser and editing the volume values by client
Gotcha
How to fix Incorrect permission for command reload on bds im using pebblehosting
what is prediction extension name for visual studio?
Anyone know how to fix a world imported off a realm? I cant reload in it anymore so its very annoying to develop in it
Nvm I just exited the world, turned cheats off, reloaded the world, turned them on again, and boom?
Change permissons from operator to custom (w/o OP perms) and back
If that doesn't work try just member permission and then back
nvm'
Only works in server console, not chat
Can someone teach me the basics to learn scripting?
Thanks, but about the code in the script, where can I learn?
Read samples in documentation, check out other articles on this site
Mfw I've made a different version...

Ah here's the guy who know's whats up
They aren't trying prox chat, they're trying speech to text
Which then executes actions
On mc
ahhhh
Tbh you could use my program to run a speech to text inside add-ons
Still use movementVector... it still returns value.
just use mobs... They're just the same outcome.
is the node.js updated to 2.0.0? I'm trying to figure out how to reregister my custom components, but system.beforeEvents.startup isn't working
nvm I got the node updated
what is this error? All im doing is using the constructor for EnchantmentType to enumerate elsewhere
const unbreakingEnchantment = new EnchantmentType('unbreaking');
is may be because you're using it before world loads (so, not in a world load event)
That makes sense, I'll add it to an initialize event in the morning.
It would be world.afterEvents.worldLoad right?
yeah
Aight, thx for the insight
no problem
hello people I need some opinion, I got this particle however it need to be rotated do I rotate it in the script or just redraw the sprite?
what are you trying to do?
Latest addition
i want update the addon
just use variables in the particle so you could roatte it easily
Vector3 don't exist anymore... Just do { x: 0, y: 0, z: 0 }
if you plan to use math libs
it's not ENTIRELY native, you need to download a bundle to use it properly.
or use the minified version of minecraft-math by jayly
tell me what you did
??
What should I do with him?
I have a feeling a translator is being used
I was about to say... my autistic side is showing up again.
huh
what does that even mean
lol
I just woke up and I can't understand a single shyt.
ah.
I'm autistic lol
well, I understood that
Just 20%... I got tested last month
bro how to fix this
remove your import for Vector3
why does useDuration in itemStopUse event return the remaining amount of time when there is no way to check the total amount of time 🗿
what is even the point of this property
and I can't even use it because the entitySpawnEvent is ran before itemStopUse
is there a way to get the entity i interact with using a script? like if i interact with the npc, that npc will do something
we have interact event
ohhhh sht, i didn't know that xd, now i need to rewrite my whole code, thanks!
alright ima rotate it then
Sorry I didn't see the message, well what I'm trying to do is like voice activated commands
I have managed to put something up
Sorry do you know how the "@minecraft/server-net" module works?
It's just http requests and stuff
Can do something like
async function discordWebhook(webhookURL, message) {
const request = new HttpRequest(webhookURL);
request.method = HttpRequestMethod.Post;
request.headers = [
new HttpHeader('Content-Type', 'application/json')
];
const body = {
content: message,
allowed_mentions: {
parse: []
}
};
request.body = JSON.stringify(body);
const response = await http.request(request);
return response;
};
``` to access discord webhooks
Okay let's say this, I have a flask website with a form that has text input and submit input, this works on a browser, how can I simulate putting the text input and submitting with the http request
?
You can ping me if you want
Well nevermind I think I know what I did wrong, still if you have an answer I appreciate it
world.beforeEvents.playerInteractWithEntity.subscribe(ev => {
const { player, target, itemStack, } = ev;
if (target.typeId === 'minecraft:npc') {
ev.cancel = true; // cancel opening ui
// ...
}
});```
Very late lol
anyone? i also tried with world.beforeEvents.playerInteractWithBlock, but also didn't work, i need help figuring this out
Since the http module is one way, you'll need to make it 2 way using a get/response every tick
Alr thanks
Why am I getting this error?
basically you do this now
Wait can I from the site send something to Minecraft? If yes how exactly?
the error says that the function only needs to 2 values but you input 4 values instead, like that.
No. You have to reverse it by getting the MC server to get a packet
Sorry but could you send some sort of code to let my dumb brain understand?
think of it this way
Site -> MC: BufferedPacket on Site
MC -> Site: Returns BufferedPacket
Ok I kinda understand then
I hope it works because I worked too much on this bullshit tbh
I'm working on my own implementation. I just finished the MCWSS side though.
"angle is not defined" what should i do?
world.beforeEvents.itemUse.subscribe(event => {
const { source: player, itemStack: itemUsed } = event;
const vectorXZ = {
x: Math.cos(angle) * 6,
z: Math.sin(angle) * 6
};
if (itemUsed.typeId === "minecraft:feather") {
system.run(() => {
player.applyKnockback(vectorXZ, 0);
});
}
});```
define it 🤷♂️
const angle = player.getRotation().y
assuming you are using the y angle for what ever that is
oh lol
you followed the value
on yours
import { world, system } from "@minecraft/server";
world.beforeEvents.itemUse.subscribe(event => {
const { source: player, itemStack: itemUsed } = event;
const vectorXZ = {
x: view.x,
z: view.z
};
if (itemUsed.typeId === "minecraft:feather") {
system.run(() => {
player.applyKnockback(vectorXZ, 0);
});
}
});
you should take note how vectors/objects work
It works fine. Can you adjust the distance it moves forward?
When you finish can you show it to me, I need voice commands to make an add-on I've been trying to make since I stated coding 1 year ago
?
If I'm not wrong multiply both view.x and view.y
thanks
No problem I asked that question not long ago too
magnitude
Rcos(theta) & Rsin(theta)
multiplying works too don't add though
Can you add a cooldown?
is this a dash you are making?
yes
import { world, system } from "@minecraft/server";
const cooldown = 0; //cooldown variable for counting
world.beforeEvents.itemUse.subscribe(event => {
const { source: player, itemStack: itemUsed } = event;
const vectorXZ = {
x: view.x,
z: view.z
};
// added a cooldown condition if 1 then trigger then sets it to 0
if (itemUsed.typeId === "minecraft:feather" && cooldown == 1) {
cooldown = 0;
system.run(() => {
player.applyKnockback(vectorXZ, 0);
});
//this timeout wiill run in 100 ticks or 5 seconds. 1 sec / 20 ticks
system.runTimeout(() =>{
cooldown = 1;
}, 100)//100 in TICKS
}
});
It doesn't work and I don't get any errors. Is there a solution?
const cooldown = 0; //cooldown variable for counting
world.beforeEvents.itemUse.subscribe(event => {
const { source: player, itemStack: itemUsed } = event;
const view = player.getViewDirection();
const vectorXZ = {
x: view.x * 4.5,
z: view.z * 4.5
};
// added a cooldown condition if 1 then trigger then sets it to 0
if (itemUsed.typeId === "minecraft:feather" && cooldown == 1) {
cooldown = 0;
system.run(() => {
player.applyKnockback(vectorXZ, 0.5);
});
//this timeout wiill run in 100 ticks or 5 seconds. 1 sec / 20 ticks
system.runTimeout(() => {
cooldown = 1;
}, 100)//100 in TICKS
}
});``` here's the code
oh lol
change const cooldown to let cooldown
that should work
let cooldown = 0; //cooldown variable for counting
world.beforeEvents.itemUse.subscribe(event => {
const { source: player, itemStack: itemUsed } = event;
const view = player.getViewDirection();
const vectorXZ = {
x: view.x * 4.5,
z: view.z * 4.5
};
// added a cooldown condition if 1 then trigger then sets it to 0
if (itemUsed.typeId === "minecraft:feather" && cooldown == 1) {
cooldown = 0;
system.run(() => {
player.applyKnockback(vectorXZ, 0.5);
});
//this timeout wiill run in 100 ticks or 5 seconds. 1 sec / 20 ticks
system.runTimeout(() => {
cooldown = 1;
}, 100)//100 in TICKS
}
});``` Sorry it still doesn't work 😦
thanks it work
Np
check error logs if no error logs then check the logic, the logic checks if cooldown is 1 however in the top it is set to 0 so that means the condition will not be met and of course doesn't work
thanks 🙂
is it possible to lock or disable a specific hotbar slot? for example, if I lock slot 8 and the player presses the number 8 key, it won’t let them select that slot
As TypeScript or JavaScript? I updated it to TypeScript recently and I removed the Furnace UI and pattern function
Ok so you mean to disable the 8th slot?
By doing:
player.selectedSlotIndex = 1
(This will force you to always be in the 2nd slot)```
So, You can do this logic:
Detect if you've moved to the 8th slot, then save the last slot you were on.
Then if you try to get to 8th slot, at the same tick, force it to select the slot you were on which we saved. This will make it never able to choose slot 8 by always forcing player to not get to move the slot he is on.
oh okay i see, thank you!
Js
does anyone know why my script doesn't work
import { world } from "@minecraft/server"
world.afterEvents.itemCompleteUse.subscribe((event) => {
const { itemStack: item, source } = event
if (item?.typeId === "pezzacraft:pizza") {
source.addEffect("minecraft:health_boost", 100, { amplifier: 1, showParticles: false })
source.addEffect("minecraft:instant_damage", 40, { amplifier: 5 })
}
})
can you show item's JSON?
from the addon? sure
yeah
import { world } from "@minecraft/server"
world.afterEvents.itemCompleteUse.subscribe((event) => {
const { itemStack: item, source } = event
console.log(item.typeId)
if (item.typeId === "pezzacraft:pizza") {
source.addEffect("minecraft:health_boost", 100, { amplifier: 1, showParticles: false })
source.addEffect("minecraft:instant_damage", 40, { amplifier: 5 })
}
})
could you check if it logs anything?
also, item will be always defined in this event, so you don't have to use nullify operator
are you sure that you're holding the item to the end?
i asked ai for some of it
to the end?
api version? i used blockbench to make this
API version does not really matter in this case
yes
i ate it fully
trying your version
hmmm, pretty weird
maybe try using this
trying the code you gave me
then i'll try that if this doesn' twork
nope
how do i even do this i have no idea on what i'm doing
what did i do wrong here
import { world } from "@minecraft/server"
world.afterEvents.onConsume.subscribe((event) => {
const { itemStack: item, source } = event
console.log(item.typeId)
if (item.typeId === "pezzacraft:pizza") {
source.addEffect("minecraft:health_boost", 100, { amplifier: 1, showParticles: false })
source.addEffect("minecraft:instant_health", 40, { amplifier: 5 })
}
})
Would this work @round bone
Apperantally not
Ig i can't
Ok
So trying to update my scripts and block jsons currently having issues when using the components it tells me that version for the data loaded is wrong but when the script is not on the block its fine. Does that mean the script is broken?
pls work 🙏
still doesn't work
is this experimental
it needs @minecraft/server v2.0.0
is that the beta api?
no
you don't have the script module or dependency in your BP manifest
Ok
{
"format_version": 2,
"header": {
"name": "Pezzacraft Addon",
"description": "Pezzacraft Addon Behavior Pack",
"uuid": "85d22d47-9a5b-856e-e6f4-19850f00fd28",
"version": [1, 0, 0],
"min_engine_version": [1, 20, 0]
},
"metadata": {
"authors": ["qAustriaaa (@qaustriaaa)"],
"generated_with": {
"blockbench_item_wizard": ["1.2.1"]
}
},
"modules": [
{
"description": "Behavior",
"version": [1, 0, 0],
"uuid": "feb55407-756c-e5e2-842c-bf2719abda4c",
"type": "data"
},
{
"type":"script",
"language": "javascript",
"entry": "index.js",
"uuid":"bcb4a18c-8815-4354-a00a-e14fdfa9746d",
"version": [1, 0, 0]
}
],
"dependencies": [
{
"uuid": "77a6cc9b-3bf0-f22c-30cc-430562e13870",
"version": [1, 0, 0]
},
{
"module_name": "@minecraft/server",
"version": "2.0.0"
}
]
}```
send the item json?
Ok
{
"format_version": "1.20.50",
"minecraft:item": {
"description": {
"identifier": "pezzacraft:pizza",
"menu_category": {
"category": "nature",
"group": "itemGroup.name.crop"
}
},
"components": {
"minecraft:max_stack_size": 64,
"minecraft:icon": {
"texture": "pizza"
},
"minecraft:enchantable": {
"slot": "sword",
"value": 1
},
"minecraft:food": {
"nutrition": 14,
"saturation_modifier": 1.4,
"can_always_eat": true,
"effects": [
{
"name": "health_boost",
"duration": 100,
"amplifier": 1,
"chance": 1.0
},
{
"name": "instant_health",
"duration": 40,
"amplifier": 5,
"chance": 1.0
}
]
},
"minecraft:use_modifiers": {
"movement_modifier": 0.32,
"use_duration": 1.6
},
"minecraft:use_animation": "eat",
"minecraft:cooldown": {
"duration": 3,
"category": "item_wizard"
}
}
}
}
you aren't using wiki:food_effects (btw you need to change wiki to pezzacraft)
itemComponentRegistry.registerCustomComponent("pezza:food_effects", ItemFoodEffectsComponent);```
this?
yes
craft*
and update to format 1.21.90 and update the icon component:
"minecraft:icon": "pizza"
if there's a }, on the next line you need to remove that and add a comma after "pizza"
oh mb
i frogot how json worked
WHY
😭
WHY
yeah i give up
@open urchin do you know any fixes
the first error means your json file is invalid
you might have missed a comma or bracket somewhere
{
"format_version": "1.21.90",
"minecraft:item": {
"description": {
"identifier": "pezzacraft:pizza",
"menu_category": {
"category": "nature",
"group": "itemGroup.name.crop"
}
},
"components": {
"minecraft:max_stack_size": 64,
"minecraft:icon": "pizza",
},
"minecraft:enchantable": {
"slot": "sword",
"value": 1
},
"minecraft:food": {
"nutrition": 14,
"saturation_modifier": 1.4,
"can_always_eat": true,
"food:effects": [
{
"name": "health_boost",
"duration": 100,
"amplifier": 1,
"chance": 1.0
},
{
"name": "instant_health",
"duration": 40,
"amplifier": 5,
"chance": 1.0
}
]
},
"minecraft:use_modifiers": {
"movement_modifier": 0.32,
"use_duration": 1.6
},
"minecraft:use_animation": "eat",
"minecraft:cooldown": {
"duration": 3,
"category": "item_wizard"
}
}
}
}
the }, shouldn't be there
i didn't put that there
{
"format_version": "1.21.90",
"minecraft:item": {
"description": {
"identifier": "pezzacraft:pizza",
"menu_category": {
"category": "nature",
"group": "itemGroup.name.crop",
}
},
"components": {
"minecraft:max_stack_size": 64,
"minecraft:icon": "pizza",
"minecraft:enchantable": {
"slot": "sword",
"value": 1
},
now?
"itemGroup.name.crop" -> "minecraft:itemGroup.name.crop"
okay
food:effects doesn't exist in the food component, you need to use the custom component instead
"minecraft:food": {
"nutrition": 14,
"saturation_modifier": 1.4,
"can_always_eat": true
},
"pezzacraft:food_effects": [
{
"name": "health_boost",
"duration": 100,
"amplifier": 1
},
{
"name": "instant_health",
"duration": 40,
"amplifier": 5
}
]
"minecraft:food": {
"nutrition": 14,
"saturation_modifier": 1.4,
"can_always_eat": true
},
"pezzacraft:food_effects": [
{
"name": "health_boost",
"duration": 100,
"amplifier": 1
},
{
"name": "instant_health",
"duration": 40,
"amplifier": 5
}
]
``` done
{
"format_version": "1.21.90",
"minecraft:item": {
"description": {
"identifier": "pezzacraft:pizza",
"menu_category": {
"category": "nature",
"group": "minecraft:itemGroup.name.crop",
}
},
"components": {
"minecraft:max_stack_size": 64,
"minecraft:icon": "pizza",
"minecraft:enchantable": {
"slot": "sword",
"value": 1
},
"minecraft:food": {
"nutrition": 14,
"saturation_modifier": 1.4,
"can_always_eat": true
},
"pezzacraft:food_effects": [
{
"name": "health_boost",
"duration": 100,
"amplifier": 1
},
{
"name": "instant_health",
"duration": 40,
"amplifier": 5
}
]
},
"minecraft:use_modifiers": {
"movement_modifier": 0.32,
"use_duration": 1.6
},
"minecraft:use_animation": "eat",
"minecraft:cooldown": {
"duration": 3,
"category": "item_wizard"
}
}
}
}
``` full json
remove the } before the comma
this one?
yes
I don't think so
Ok
I'll show the JS too
import { system } from "@minecraft/server";
const ItemFoodEffectsComponent = {
onConsume({ source }, { params }) {
// Iterates over each object in the component's array.
for (const { name, duration, amplifier } of params) {
source.addEffect(name, duration, { amplifier });
}
},
};
system.beforeEvents.startup.subscribe(({ itemComponentRegistry }) => {
// Register the custom component for use in the item JSON file:
itemComponentRegistry.registerCustomComponent("pezzacraft:food_effects", ItemFoodEffectsComponent);
});
Any errors in this?
no
oh there's a comma after your menu category group
JSON or JS
json
You don't have to specify namespace in a group of menu category
yes you do
I saw some samples while ago that were still using grouping without a namespace
😭
@open urchin is it fixed or not??
things at the end of a json object (before a }) shouldn't have a comma after them
"description": {
"identifier": "",
"menu_category": {
"category": "",
"group": ""
}
},
why does notepad++ do this
idk i use vscode
discord did the same
bruh
can u send me a JSON if u can?
@open urchin i removed the comma you removed
Yeah no i'm FUCKING DONE WITH THIS
dude see the wiki example
and you should know the JSON structure other than asking others, which comma or bracket to add/remove
lmao
i gave up
never gonna give you up
well i retried one more time and got it
how can i get the health value of the entity?
Here you go.. it's got the Behaviour pack and Resource pack in that zip
entity.getComponent("minecraft:health").currentValue
thanks!
Thx
No problem.. let me know if you do have any problems since I didn't do extensive testing with it
I've tested runJob and I still don't understand it use
like why would I use it
Splits code up over multiple ticks, if you’re running intensive code (such as filling a large area)
The runJob method runs a generator function in small steps over multiple ticks instead of all at once. This helps avoid performance spikes and watchdog termination in Minecraft scripts. You insert yield statements to pause and resume the function.
Example
function* job () {
console.warn("hello")
yield;
}
system.runJob( job() )
runJob doesn't act same for everything. Trust me, try breaking or filling a lot of blocks at once, compare with and without runJob, And just see the performance difference.
thank you guys for your explanation <3
gguuguaga wlc
export default function ShardUI(player) {
const inventory = player.getComponent("inventory").container;
const coins = getScore(player, "Shards");
const form = new ActionFormData();
form.title("§d§l-Enchant Shop-");
form.button("Sharpness 3 Book \n§d10 Shards", "textures/items/book_written.png");
form.button("Sharpness 5 Book \n§d30 Shards", "textures/items/book_written.png");
form.button("Efficiency 3 Book \n§d10 Shards", "textures/items/book_written.png");
form.button("Efficiency 5 Book \n§d30 Shards", "textures/items/book_written.png");
form.button("Unbreaking 1 Book \n§d10 Shards", "textures/items/book_written.png");
form.button("Unbreaking 3 Book \n§d30 Shards", "textures/items/book_written.png");
form.button("Protection 2 Book \n§d10 Shards", "textures/items/book_written.png");
form.button("Protection 4 Book \n§d30 Shards", "textures/items/book_written.png");
form.button("Fortune 1 Book \n§d10 Shards", "textures/items/book_written.png");
form.button("Fortune 3 Book \n§d50 Shards", "textures/items/book_written.png");
form.button("Mending Book \n§d200 Shards", "textures/items/book_written.png");
form.show(player).then((response) => {
if (response.selection == 0) {
if (coins >= 10) {
removeScore(player, "Shards", 10);
const item = new ItemStack("enchanted_book", 1);
const enchantability = item.getComponent("enchantable");
enchantability.addEnchantment({ type: new EnchantmentType("sharpness"), level: 3 });
inventory.addItem(item);
player.sendMessage("§aPurchase Complete!");
player.playSound("note.pling", { location: player.location });
} else {
player.sendMessage("§cNot Enough Shards!");
player.playSound("note.bass", { location: player.location });
}
}```
why does this take the score but not give the item??
is it possible to increase the maximum health/attack dmg of an entity using script?
Is there a way to detect dismount in touch controls.
create component groups of what you want and events to add those component groups, then trigger the event through scripts
Using getButtonState('Sneak') don't work...
what about the event?
are you importing ItemStack from minecraft/server?
wdym
beforeEvents or afterEvents.
nope... dismount button is a different button itself in the touch.
I meant the sneak, the jump still works the same.
why... 😭
How will you get the time if you ain't running the function?
Where'd you even get the player instance
put a log message there
I think dimension.getBlockFromRaycast is broken in 2.0.0, the ray is only colliding with the bottom and northwest sides. I made a script that ricocheted a vector off teh surfaces, but now it phases through the block.
Has anyone gottem container.find() to work? I'm assuming it looks for an exact, 1:1 copy of the itemStack
I keep trying to use it to search for a stack of items
Is it possible to make a bunch of transparent images/glyphs/text stack on top of eachother in a text field?
How to get a book with enchantment
book -> enchantable component -> apply enchant
it's not broken in my side so idk
Is there sample code?
import { ItemStack, EnchantmentType } from '@minecraft/server';
const book = new ItemStack('minecraft:enchanted_book');
const enchant = book.getComponent('enchantable');
enchant.addEnchantment({ type: new EnchantmentType('unbreaking'), level: 3 });```
Thankss
hmm I think you meant the faceLocation?
what does chatGPT mean by this
maybe devs using gpt?
hrrrmm
can I get the type of block of a falling block entity?
What version of API does it use?
Did you ever figure this out
No, I’m still stuck with making the world myself first and then moving it to the server
How can i take real life hour, day and month trough script
Thx
how to get the biome where the player is currently located?
I haven't tested if it registers the correct face. I can just put a catch that translates the face location if it's getting that right at least
Done (Resolved)
Awaiting Response
there is no way to get a fully accurate value afaik
can we obtain armor resistance?
check the bug above, that's why I said faceLocation since getBlockFromRay() itself isn't broken, it never phase thru blocks... Unlike getBlockFromViewDirection() there's a point it phases thru one.
Gotchu, makes sense to be a face location issue rather than the ray itself. Makes correcting for the big easier at least
how are you using faceLocation before tho?
To get the exact location of the ray impact on the block. So I added the face location and block location vectors, and used the face it collided with to get a normal vector for reflection. It worked fine for many updates until I updated to 2.0.0
I'd show how it works in-game but I'm at work
you have the normal vector function you used?
I might try to find a way to fix it... since I did it with my chess one that the piece's isn't properly placed when moving the block in xz direction
Let's dm then
this...
but it's only in top face, I haven't tested it yet on sides.
The normal vector calculation I have is just an object index with the directions
export const faceDirectionVector = {
'Up': {x:0,y:1,z:0},
'Down': {x:0,y:-1,z:0},
'North': {x:0,y:0,z:-1},
'South': {x:0,y:0,z:1},
'East': {x:1,y:0,z:0},
'West': {x:-1,y:0,z:0}
}
hmm... how is it tampering if you use face and not faceLocation?
it isn't, the reflection vectors are working as intended, it's just the location of the collision isn't
location = Vector3.Add(raycastReturn.hit.faceLocation,raycastReturn.hit.block.location)
so on specific directions the ray collides with the back side of the block and phases through the rest of it
or at least, the face location it gives is on theback side of the block
is it still in beta?
yes
aw
there's a more manual way using molang and environment triggers
but it's unreasonable if you want to use like all biomes instead of a few specific ones
you don't need to add the block and face location
? the faceLocation is a coordinate relative to the block location, if I did just the faceLocation then all the locations would end up around the world origin
In new versions faceLocation became relative to the block
It's been that way for a while I feel. I wrote the original script 8+ months ago and it's been working ever since 2.0.0
leads me to believe it's a bug rather than a rework
I clearly remember that they moved some properties from "relative to world" to "relative to block"
I believe you, it was probably before 1.13.0 for the api bc that's when I wrote it
they were supposed to do that, but it is very bugged
I would not recommend relying on faceLocation if you're using v2.0.0+ until they (hopefully) fix it
I had no problem with this
for the time being i'm gonna try to see if I can just correct for it then
I'm pretty sure it's impossible to correct fully
is faceLocation youre trying to get?
I'll look into it. I quickly tested to see if the face returns are correct, and they are. Meaning I can isolate to the Top, South, and West sides of the block which is where the issue happens. Then just translate the incorrect faceLocation returns and it should work.
the issue is that the face location is translating improperly on the top, south, and west sides of blocks since 2.0.0
otherwise it works fine
and it's not even totally relative to block
the faceLocation shifts based on the xz coordinates of the block.
and values of 1 become 0
face location is somewhat broken... there's some complaints in reddit and bug track about this.
that's it's not truly relative to block as what they claimed
record the values of a single position if the block is place in xz, -xz, x-z, and -x-z of the block. Same face, just different locations
this was the case
I fixed it with a correction
//vector correction due to faceLocation bug in 2.0.0
let correctionVec = {x:0,y:0,z:0}
const correctionDir = ['Up','South','West']
if(correctionDir.includes(raycastReturn.hit.face)) {
correctionVec = c.faceDirectionVector[raycastReturn.hit.face]
}
the correction vector is now added to the faceLocation and it works as intended
there's still an issue which depends on if the coordinate is positive or negative but that should also be fixable
nvm I just thought it was west instead of east
replacing West with East fixed it
it is relative to the world origin
so there is like 8 states
x y z
-x y z
x -y z
x y -z
-x -y z
x -y -z
-x y -z
-x -y -z
it give you diffrent value depending on if you are in a negative axes or not
if i am not wrong, this should fix it
function getRelativePositionOriginal(faceLocation){
return {
x: faceLocation.x >= 0 ? faceLocation.x : 1 + faceLocation.x,
y: faceLocation.y >= 0 ? faceLocation.y : 1 + faceLocation.y,
z: faceLocation.z >= 0 ? faceLocation.z : 1 + faceLocation.z
}
}
hmm, something is wrong
shouldnt you use math.abs()?
yeah that's what I said too but... I forgot the y-axis lol
ok this seem to work
function getRelativePosition(faceLocation, blockLocation){
return {
x: blockLocation.x >= 0 ? faceLocation.x : 1 - faceLocation.x,
y: blockLocation.y >= 0 ? faceLocation.y : 1 - faceLocation.y,
z: blockLocation.z >= 0 ? faceLocation.z : 1 - faceLocation.z
}
}
Dang. Really wish we could enable it
Yeah there's honestly so much I feel like we're missing out on with BDS.. such as this new certificate thing that was added recently (may have no use but why do we see it), being able to host your resource pack off of the server via the cdn config isn't documented (can somewhat get it working but it's still not easy, has too many issues) and then we can't easily enable experiments (you'd expect to be able to enable/disable it in the properties like you can with vibrant visuals)
I'm sure there's plenty more stuff that we don't have access to yet, that's actually there just not documented..
Like the classic hidden op-permission-level
I do wonder what else is hiding
you mean like the terminal permission level that doesn't work anywhere but exists? i think that is just there for the terminal but i do wonder why it's visible to us if it can't be used
in server.properties if you add the line op-permission-level = 4 you are able to run server commands from game chat
like /shutdown on a server
Oh that's something in the properties? I actually didn't know that..
Doesn't that allow all clients to use it though?
it allows "Operator" players to use it
Well yeah I kinda figured that but that would definitely then require you to make custom staff tools to avoid giving out operator to anyone who shouldn't be near it
But yeah, I do wonder what else is lying around that we don't have
how do i get the type of the block that was just broken in a custom component
onPlayerBreak({ brokenBlockPermutation }) {
brokenBlockPermutation.type
}
[Scripting][error]-TypeError: cannot read property 'type' of undefined at onPlayerDestroy (main.js:60)
it's destroyedBlockPermutation in v1
huh
oh
ok
if (block.north().type.id == destroyedBlockPermutation.type.id) {
block.north().setType("air")
}
how do i make it run on more blocks
when i break it, it should break all connected ones in a chain reaction
cancelling packets via server-net seems to be going perfectly fine (totally no problems)
tried cancelling the "ChangeDimension" packet and it moved me to the new portal after walking away from the original one and randomly placed real but fake lava?
nice.. I restarted the server and spawned in the nether.. 💀 (it should never have loaded in the first place)
this is so fucking scuffed
(i tried going back through the portal)
i tp'd 3 blocks up from -2 and it sent me down!? wtf is going on.. cancelling packets are so scuffed (at least the dimension change is)
OIf you where to tell a new coder 5 things, what would you tell them related to MCBE gametest development
Umm the maxDistance of getBlockFromRay() don't support less than 1??
I tried 0.5 and doesn't eork
Everyone searching for double jump scripts will see this and get so confused
code looks fine to me
how can i detect if player click f8/paperdoll toggle?
Scripts can't do that.
is it possible to clear the /me ?
const item = new ItemStack("minecraft:enchanted_book", 1);
item.getComponent("enchantable").addEnchantment({ type: new EnchantmentType("minecraft:mending"), level: 1 });
item.nameTag = "Mending Book";``` how would i make this give bottles of strength for example??
I don't know if you can. Atleast not with the preferred scripting methods using ItemStack
There's no way to set data
actually, I'm wrong!
Is it possible to add collision to this? since tping mobs while me riding it acts like it's it doesn't have collision like it can't be drowned or suffocated...
and yes I tried Entity.tryTeleport() and checkForBlocks both didn't work.
why are you using teleport for movement and not knockback?
it doesn't work properly
I found a way already lol
You can only disable the command if you're using a Bedrock Dedicated Server, otherwise you can't do anything to stop this.
Does player.getViewDirection not exist anymore… I can’t see it in the documentation
Entity class
not only Player
Weird
simply have a vc system that drags you to nearby player vcs
🫡
lol
normalize it again
razz steals his code
especially on json uis
is there a way to check if a player is op outside of the beta module
Herobrine's Chest UI --> I now have support for enchants, custom names and 'open' and 'close' sounds to imitate a real chest. Only thing left to add is the support for potions (will only have lore support, icon will remain the same).
There is a new permission system
Are you making a fork of it or refactoring it for your private use?
It's not a fork at the moment but I'm also not planning on keeping this to myself 
The only downside at the moment is there is a significant delay when having the inventory enabled even with all forms disabled. It's just an issue with having the inventory enabled due to the amount of buttons being added. Also, the scripting is slightly different when adding the chest audio.
import { Player, world } from '@minecraft/server';
import { ChestFormData, playChestClosed } from './ChestForm/main';
async function page1(player: Player, isInitialOpen = false): Promise<void> {
const form = new ChestFormData('27');
form.title('Chest #1');
form.button(13, 'Item #1', [], 'minecraft:apple', 64, 0, true);
// Add 'chestopen' sound to the Chest Form when it first opens and when you close out of it (via the 'E' key, the close button or, the 'ESC' key)
const { canceled, selection } = await form.show(player, { playOpenSound: isInitialOpen, playCloseSound: true });
if (canceled) return;
switch (selection) {
case 13:
return page2(player);
break;
}
}
async function page2(player: Player): Promise<void> {
const form = new ChestFormData('27');
form.title('Chest #2');
form.button(13, 'Item #2', [], 'minecraft:iron_sword', 1, 50, false);
form.button(18, '§cBack', [], 'minecraft:barrier', 1, 0, false);
// Only add 'chestclose' sound as we don't want to play the 'chestopen' sound on each page
const { canceled, selection } = await form.show(player, { playCloseSound: true });
if (canceled) return;
switch (selection) {
case 13:
await playChestClosed(player); // Play 'chestclose' sound on final button (final = button that does not open into another Chest Form)
break;
case 18:
return page1(player);
}
}
world.afterEvents.itemUse.subscribe(({ itemStack: item, source }) => {
if (item.typeId !== 'minecraft:chest') return;
const player = source as Player;
page1(player, true);
});```
It does require an extra import for the chestClose sound for final buttons but other than that the sounds are built in to the chest form script itself and applied using form.show(player, { playOpenSound: isInitialOpen, playCloseSound: true });.
is there any documentation on 1.19.0 scripting api
i tried stirante website but it removed everything
The oldest is 1.19.5
Why not use v2
Too much legacy code to convert
Like?
Most stuff can be fixed easily
what's the proper way to run multiple title to update preserve text?
player.onScreenDisplay.setTitle(`update:rpg:coin:§l§g ${playerCoins}`);
player.onScreenDisplay.setTitle(`update:rpg:gem:§l§b ${playerGems}`);
player.onScreenDisplay.setTitle(`update:rpg:lvl:Level: ${playerLevel}`);
player.onScreenDisplay.setTitle(`update:rpg:xp:XP: ${playerXP}`);
player.onScreenDisplay.setTitle(`update:rpg:mana:${manaBar}`);
Just use one.
combine them in one string...
this is what happen if i do that
it's json UI part of problem not script API.
or you can do '\n'
player.onScreenDisplay.setTitle(`update:rpg:coin:§l§g ${playerCoins}\nupdate:rpg:gem:§l§b ${playerGems}\nupdate:rpg:lvl:Level: ${playerLevel}\nupdate:rpg:xp:XP: ${playerXP}\nupdate:rpg:mana:${manaBar}`);
instead of being in one like like that in image it should go.
coin
gem
lvl
xp
mana```
the way I set it up to update my elements is by running it separately
/title @s title update:rpg:coin: coin like this. how can i add a bit of delay on the onScreenDisplay i sent?
runTimeout?
it's better you edit the json UI a bit.
So you can send one total that contains your needed UI values
nice compass visual btw
that's what im using before
player.onScreenDisplay.setTitle(
`coin:§l§g ${playerCoins}§r`.padEnd(50, '\t') +
`gem:§l§b ${playerGems}§r`.padEnd(50, '\t') +
`lvl:Level: ${playerLevel}§r`.padEnd(50, '\t') +
`xp:XP: ${playerXP}/300§r`.padEnd(50, '\t') +
manaBar.padEnd(100, '\t') +
compassBar.padEnd(180, '\t') +
degreeLine.padEnd(500, '\t') +
(
` §6§lq:Quest§r\n\n` +
` §s§lActive Quest:§r\n` +
` ${questTitle}\n\n` +
` §8${questObjectives}\n\n` +
` §2${requiredItem}\n\n` +
` §sRewards:\n` +
` ${questRewards}\n\n`
).padEnd(50, '\t')
);
but anyway, i already fixed it, thank!
thanks!
That looks cool, did you use any Wrapper or Helper tools for the JSON UI?
i only use this in the blockception vscode extension for coding json ui and other stuffs
Ohh alr
BlockVolume is fun
Yep
do u guys know where we can ask for scriptapi feature?
the sign block component is lacking the glow ink method
Yea It's actually very fun
I hope we get events like when redstonePower changes and send redstonePower for custom blocks and things
Is there any class that contains location information when a player places a block?
best you do is playerPlaceBlock
const item = new ItemStack("minecraft:enchanted_book", 1);
item.getComponent("enchantable").addEnchantment({ type: new EnchantmentType("minecraft:mending"), level: 1 });
item.nameTag = "Mending Book";``` how would i make this give bottles of strength for example??
Did you ever read what I sent you
yes
the site you sent me didnt really help iwl
what does this even mean
Any ways to keep DynamicProperties after Changing the Addon?
I tried to Upload them temporary on a scoreboard objective. But then I need the script to work but what If the Addon is outdated due an new Minecraft update..
Any ideas?
I was just testing the original version and the inventory doesn't even work properly and this is what 5 slots looks like 💀
This is what my inventory actually looks like lol
I'll probably remove the 5 slot until it's fixed to look like a hopper and also delete the 1 slot and furnace ui since I don't see a use in those.. also because the 1 slot just sets a slot to the far left instead of in the middle (you would have to check for the flag in slot 1 and 5 and update the grid position and size for those uis)
I'll most likely add the pattern back though since I'm sure quite a few people actually do use that
I'd like to see a custom npc form though, that would be neat
you need to get your eyes checked
how do the new params work for the custom components?
"components": {
"my:component": {
"data": 123
}
}
const component = {
onRandomTick: ((data, { params }) => {
world.sendMessage(JSON.stringify(params)) // {"data":123}
})
}
you can set the value of the component to a boolean/string/array/object/number
"hi:component": 10
params is the value of the component
onTick(event, { params }) {
params // value is 10
}
By the way, there is a limitation on the depth of json. That is, you can't do something like this:
"my:component": {
"list": [
{
"id": "kajdfkadf",
"value": 323
}
]
}
It's done...
(just need to write out all of the potions) 
What about it?
Well, as I understand it, you need the effects of all the potions. Or am I wrong?
I'm adding potion support to Herobrine64's Chest UI...
I only need specific information
I could probably do this a much simpler way but.. it is what it is 
It will be "fun" if you want to make a translation for your addon)
could i do it for something like this const config = {
treeHeightMin: 5,
treeHeightMax: 22,
spiralInitialRadius: 2.0,
spiralRotations: 3,
spiralMinScale: 0.5,
spiralStretchFactorY: 0.5,
spiralThickness: 2,
leafScatterProbability: 0.5,
canopyLayers: 4,
canopyBaseRadius: 3,
canopyRadiusReduction: 0.7,
spineDensity: 0.2
};
Can we use script to place a block itemStack as a block in the world?
for instance if i have a chest with nbt data stored as an item stack, can i spawn it as a block in the world?
unlikely...
It seems my only option is to use structures...
Why would you want to store something in a chest as an item?
I wanted to make an addon, where you could catch fishing crates, which are renamed barrels with loot table inside them, that turns out to be impossible, so i thought of making the player catch custom blocks, that look like a vanilla barrel, and when placed i would replace them with an actual barrel with a loot table inside. and since we can't convert an item stack into a block, i will have to save each barrel in a separate structure
instead of using my itemStack database
i mean you could just make a block drop whats on a loot table when broken
yeah, but i wanted the loot chest interface
Why not make it so that when replacing a custom block with a barrel, loot would be immediately pushed into it via /loot?
i thought of that, but /loot doesn't randomly offset the items
it places the items to the barrel in order
Well, I can suggest something... This is quite "dirty" code. I use it as an alternative to lootTable in scripts. I can improve it and even put it in script-resources... If you are willing to wait a bit.....
is it a random loot offsetter?
It's also a loot generator.
Well, I can share the offset function itself.
no thanks, i have also thought of that, and didn't feel like recreating a loot generator when vanilla has it built-in
- using structures isn't too bad
Well... okay
There is also the option of using a ticking function, to replace the custom blocks in the player inventory with the actual loot barrel...
Or use the new event...
what new event?
oh! i didn't know about it
it's still in preview and beta-api though, it will take forever to release lol, i will switch to using it once it releases, thank you
is that entity inventory(page 1)?
It’s using the Chest-UI made by Herobrine64 and LeGend 077 (redesigned action form)
ohhh
I’ve just been updating it to support missing/broken features
that's what im trying to make earlier, chest style server form but i cant show the player inventory 🥲
can you add velocity to a spawned ItemStack?
yes.
ay nice
ok, do anyone knows how to remove the gravity of player properly? Player.clearVelocity() still makes the player fall like it makes it go back to old position but not stay
Set a player as operator?
edit the player JSON and remove its physics (I wouldnt dd that)
You mean set the player to creative? Wouldnt be a good solution tho
i know that way that's why I asked in script API for other ones.
No. Set operator permissions on a player.
What's this?
Pseudocode for detecting entities that the player can see, with some stipulations. Read up on WavePlayz's message for more context on what it's doing
Technically it's casting a ray to the entity's feet, so there are situations where part of the entity can be visible and it still not be detected
Why? Then he would be able to run commands
Precisely
I need to give a player who joins in with member permissions, to be given operator.
Ohh.. i thought your message i replied to was meant as an answer to Coddy..
My bad..
So basically after he joins check his playerPermissionLevel, if its member grand him Op woth player.setOp()
If im wrong take a look in the docs
so i have a block with storage. I set the permutation to air but drops its inventory. How can i avoid that?
Clear inventory of block before changing permutations
wsp
Hello here, I just want to ask how can i make a high quality item texture. Cause considering a 16x16 pixels is so low. How can I make it high-quality?
Just make the texture bigger
but does it make the item in hand bigger?
Well, and then use attachables. #1067869136606220288
but, how can i create a 16x16 pixel icon texture? do you know any software on how I can make designs
blockbench
hmmm, how am i going to detect when the weather is raining and the player is staying unde the rain?
similar to when the enderman take damage from rains, but for the player all using scripts
Isn't there a filter for that?
idk
but it doesn't differentiate between water or rain
alternatively you could cast a ray from the player head to build limit and check if there are any blocks between them
like detecting if the topMost block is air and detecting when its raining?
if (dimension.getBlockFromRay(player.location, {...player.location, y: 319}).block) return ```
i see
wont it throw logs after getting higher than the build limit?
or having logs after getting a point that will detect blocks higher than the build limit
yes, so do an overworld check first
it wont rain anywhere else tho
or use dimension.heightRange.max
but wait
raining in the desert is not a thing
it doesn't rain in the desert, so doing that while the weather is raining will cause the script to do my things even while its not raining in the desert
can someone help? #1393543367396167751
yeah, so you might want to combine it with the filter
so in order to do that, i need to spawn an entity inside the player just to get the filter
That's the best way if you don't want to modify player.json
i dont feel like it tbh, that might and will cause some issues i believe, so keeping it normal is better i believe
what i can do:
detecting the topMost block and if its raining or not
if the conditions where right, it will spawn one entity at the player location that will despawn after 1s just to detect the biome type
one tick is enough, and you could detect rain directly instead of the biome
if the biome was normal (not desert or hot biomes that doesn't rain inside) it will do my things
like spawning the entity once every 3s just to detect if its raining or not?
does your code constantly check if it's raining on the player, or does it do it in demand?
runInterval, yes.
i can limit the interval speed
like forcing it to run once every 3s or something
so what you want to do is:
spawn an entity, use the filter, to check if it's raining on it, do a system.run() to obtain a property, and delete it
like i can detect when it's raining to start the spawn interval and stop it when its not raining, the entity will detect if it has contact with rain or not to return a value to the script so the script can work and do my stuff,
oh yeah, that's a good idea
adding rain drops on the player screen when its raining
-# for my xVisuals addon
It looks good, but how did the player eyes become a glass window?
na, just some water drops on the screen, thats all
You could use my biome detector addon, and modify it to check for rain instead of biomes
currently:
73% not adding it
27% adding it
cuz i don't really think it worth the time / the hard work
and it will make the addon looks like EnhancedVisuals from java, which might causes some issues ig
you stole my gif 😡
-# jk
You should make it like detect when there is block on top of head, Even if it's raining, It should not wet the screen
Just detect if the area above players head is empty, and there is no roof, And just now detect if it's raining.
i can recreate this in like 15 minutes and i can release it for public use
I mean I said it was going to be public anyway but you do you pal
I am just curious, this is not that hard to implement potions in-game
it's okay that you're trying to make smth open-source, you might help other people that couldn't implement these features
you're making their development stage easier by your library
I have wrote a library few weeks ago, and they're using it also
how can i spaw a block with an specific state?
the block is placed but always facing south
and I don't know how to change it
setPermutation
mmm, I can't make it work, do you have any example?
nv
i did it
thanks
const targetYaw = Math.atan2(
isMoving ? lastView.x : lastView.x,
isMoving ? lastView.z : lastView.z
) * (180 / Math.PI);```
ts is stupid.
we really need a entityDismount event
For now edit the entity json.
So 1.11.0 stable API supports the latest Minecraft version right?
I mean, I know 1.19.0 is latest stable API, but I want to be sure that 1.11.0 works too?
you can use all versions
except for past beta versions
2.0.0?
Anyone know if i can dynamically stretch a particle?
With scripts
I havent really looked into it
Already existing - no. Only if you spawn a new one
Ohhh ok, thats good enough how do I stretch a new spawned particle dynamically
Ive dynamically spawned particles for landclaim already, but i have a nice custom particle thats a wall i want to stretch if the claim changes, i can respawn the particle
No issues there
Do i just use script or do I need to modify the json of the particle
import { MolangVariableMap } from "@minecraft/server";
{
const map = new MolangVariableMap();
map.setFloat('name', 15);
dimension.spawnParticle('my:particle', { x: 0, y: 0, z: 0 }, map);
}
Dang thats it
?
I was thinking we needed to add some form of json changes thank you!
And then you use v.name in molang in particle.json
Thank ypu very much
But keep in mind that if your "wall" texture has more than one color, it will look bad because the particle is stretched.
Yeah its just gonna be a see through particle one color and will change based on stuff. No worries there! Thanks
does the storage block need to be opened at least once?
It doesn't matter
PlayerPlaceBlockBeforeEvent on experimental only?
yes
one last thing how can i calculate player's distance travelled (in blocks)
yes
oh, how
when the player starts to move, get the block at the player's location, save the location of it, and when the player stops moving, do the same.
then calculate the distance between these 2 locations.
i see thanks
np
Can someone help me make a particle trail for minecarts that spawns a particle at the charts location every gt and the particle can change colour based on a few things
Yellow = acceleration to 8 m/s
green = terminal velocity (8 m/s)
red = deceleration
runInterval -> get players -> riding component -> check the entity player is riding is minecart -> check the speed by either using velocity or checking blocks traveled.
const durability = player
.getComponent("minecraft:equippable")
.getEquipment(EquipmentSlot.Mainhand)
?.getComponent("minecraft:durability").damage;
im damage an item, but its telling me that it failed to get damage property
at <anonymous> (essentials/ultramine.js:56)```
i get this when i call it in before events
but when i use system.runTimeout to do so, it sends an error saying that it failed to get damage property
durability?
minecraft/server.ItemComponentTypes Enumeration | Microsoft Learn https://share.google/m8ZQPODSqCBiFjv0i
seems like you are trying to modify the damage
Were hav i messd up at
world.beforeEvents.playerInteractWithBlock.subscribe(event => {
const player = event.player;
const block = event.block;
if (!block) return;
if (
block.location.x !== cratePosition.x ||
block.location.y !== cratePosition.y ||
block.location.z !== cratePosition.z
) return;
if (block.typeId !== crateBlockTypeId) return;
showCrateMenu(player);
event.cancel = true;
});
it says it cant show the ui dose not have the privilege
Before events cannot modify the world at all
so how i make it show the ui
do i use after
ok i got it
been a min sence i coded
Yes, or delay the UI open using system run
hey do we need rp to use translation
ok one more thing never messd with blocks how do i stop it from opinging the shulker
For that you would need to use before event with cancel
ok
yes
Thanks Hero i got it working
are you trying to modift const durability?
can you show how you modify it?
cant it be modified?
cant show the code rn
but its something like this
damage+=amount
amount being a variable
it should be modifiable
const durability = itemUsed.getComponent("durability");
durability.damage += 1;
this should modify it
Why use runInterval just to count ticks, which is only used to count ticks?
By the way, Dimension.spawnEntity always returns Entity so the test for it being != undefined is useless, you should use try/catch.
Also, the tier T is useless, since score cannot be greater than 2.147... billion
calling runCommandAsync to trigger the event to remove the entity is a bad idea. Just use Entity.remove()
Otherwise everything should work, but since you didn't say anything about the problem, I can't say more.
wth this still works at 1.21.93? I thought it was "2.1.0-beta" im confused
guys where's the guide to install node and npm packages? I forgot how
npm install @minecraft/server
remove the "-beta"
https://nodejs.org/
https://learn.microsoft.com/en-us/minecraft/creator/documents/scriptdevelopertools?view=minecraft-bedrock-stable
it still works though somehow
wow
lol I don't know why that beta works...
oh wait
LOL
sorry
wrong file
I was looking at the wrong file
💀
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]
^
what should I do?
npm.ps1 cannot be loaded because running scripts is disabled on this system.
followed this and it works now
npm i @minecraft/server@beta
npm i @minecraft/server-ui@beta
this downloads all right?
oh nvm
huh
he sent an image and deleted it
also this one downloads all version or just the latest?
Probably latest beta
can I use script-api to switch player inventory?
yes
I'm new to JS/TS. Should I use TS or JS
Js is the only acceptable in script api, you need compile TS to js
just start with js it probably wont make a diffrence while u learn
switch in the future if u want to
ik the run command i hcnaged that also it is not showing a error just not working
Which is?
i got it my addon for the custom text wasnot in the game
can you turn off auto save?
icon or the actual saving system?
the actual saving system :c
do BDS allow changing anything to it?
nope

at <anonymous> (essentials/ultramine.js:59)
export function damageItem(durability, amount, player, item, inventory) {
durability += amount;
inventory.setItem(0, item)
}
Idk why i get this error
it was working as normal before
can I make other players have my camera?
oh btw, is there a way to extend the size of the dummy name in scoreboard? (to remove that ... thingy)
The code you sent is not the cause
is there a way to get the target that an entity is currently pursuing in scripts (not in beta)? Or a way to set the target for an entity via scripts?
i've fixed it, but im encountering a constant problem, im trying to change the durability of an item, i did but when i use setItem it just resets the item durability
export function damageItem(durability, amount, player, item, inventory) {
durability += amount;
inventory.setItem(player.selectedSlotIndex, item)
}
bcs your changing a copy of the durability
pass in the component
im confused
i got the durability
from before events
and used a system.runTimeout to run the function that changes the durability
anyone?
what you are doing is editing a copy of the durability value.
pass the whole durability component to the function and use it inside
Send the whole script.
/** @param {ItemStack} item */
function applyDurabilityDamage(item, damage = 1) {
const durability = item.getComponent('durability');
if (!durability) return item;
const unbreakingLevel = item.getComponent('enchantable')?.getEnchantment('unbreaking')?.level ?? 0
if (damage > 3) {
damage *= (4 - unbreakingLevel) / 4
} else if (unbreakingLevel >= 1 + Math.floor(Math.random() * 4)) {
damage = 0
}
if (durability.maxDurability > durability.damage + damage) {
durability.damage += damage
return item
}
}
Just use this
will it set the item?
Is it not possible to setCurrentValue of an entity's health back to max if it hits min?
.resetToEffectiveMax()
nope, im using 2.0.0 and it says it's not a valid function
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]
Installation for @minecraft/server-ui
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]
I was wrong mb... It's .resetToMaxValue()
There's no .resetToEffectiveMax() it's .effectiveMax lol... Sorrey
Dose some one know what to make wheat seeds turn to grown wheat with scripting
Documentation for @minecraft/server
Thanks
Goodbye destructing addiction hello ternary addiction. 😭😭
how can I send a message to any player with an specific graphics mode?
Use the client info.
smokey can we use bp side translations
Documentation for @minecraft/server
Afaik that only works for manifest.json
ah
Is there a way to turn off player hitbox?
Can we get the effect ID that is being added using EffectAddBeforeEvent? There's effectType in it but for some reason it returns the translated string rather than the ID
no
they didn’t fix that???
Guess not
WHAT black Minato 😂
coddy everytime gets a sick pfp
custom components + blockstates are cool. got regenerating ores working. doing a runescape 2007 server. Also has randomized chance to complete mining calculated on your skill level, the skill level required to mine it, a preset chance per block, and which pick is used
uhh, can the custom item components change the item stuff via scripts? like changing its damage or name or durability
is there a native method to run scriptevent directly in js? or is it commands only?
commands only
aw alright then
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]
Installation for @minecraft/server-ui
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]
I think there was a native method
I was thinking the same, but I have checked documentation and I didn't found anything
There is actually just server only tho