#Script API General
1 messages · Page 122 of 1
its okey to feel dumb
I think every person on this server has felt dumb at some point. Coding can be pretty humbling
And a lot of the "rules" with Mojang api don't make obvious sense
I only love coding because I always talk inside my head so solving code problems and making logics is kinda satisfying for me
Tbh I don't have someone to talk to everyday, I'm alone, I'm always talking to myself, bored, so I code
So I don't know if it's right that I chose BSIT as my career course, is it my passion to code, or is it just me being bored and lonely
That I just stuck myself in the phone everyday doing coding
And my only happiness is when I created something amazing for the first time even if its small
Because nothing in my life has something special to be happy about except this coding
Dam what am I saying
Bro , u didn't see c++ developers code
Whenever i see it i feel so f dumb
Like they fix 10issues/second
And write big texts in small amount of time
I need like 10 days ro do this simple thing
Logic is the framework of the universe for that it s satisfying
Eh I've even taught C++. A long time ago. A lot of the blowhards knew the least.
Learning means constantly having to face "I don't know" and "that doesn't seem to make any sense". So does debugging.
And it's always hard esp at the start.
My course got everyone to learn a really unfamiliar difficult language as the first subject bc so many people came to it with C and thought they knew everything. This way, they would be humbled and learn. I did.
So I always want to encourage people who are starting out. And even people who know C++ might not know why their custom skin isn't loading (I didn't til I searched).
Bro c is nothing compared to c++
Not bro, but yeah, I know. Object oriented was a whole new game.
Yeah
- i found something interesting in c++
Whenever u ask experienced person about thing, it tell u that the behaviour in underfined or something
Like
i++ + i ;
Or something it tells u it have undefined behaviour due to the c++ different compilers
Like there is gcc and clang
And another one
It s uncertain unlike other programming language
And u need to think twice before coding anything
Yeah it's to do with optimisation, you have to code very carefully and precisely because the compiler will not make checks. If you don't tell it exactly what it wants, you'll get undefined behaviour, and then the compiler is free to interpret that however it wants - because you weren't precise enough.
It really is a high-level portable assembly language, the object oriented and so forth provides a bit of abstraction but it's really pretty close to the metal. (Does make it more efficient than the java language though.)
i++ + i isn't valid code because the C++ standard says this is between two sequence points (I believe it's a bit more complicated now) - so there's no particular order set out to compile between these points (in this statement). Which comes first? The incrementing of i++ or the adding of i to itself?
The precision is because C++ must map onto all hardware with a guarantee that it will run the same every time with defined behaviour, with exactly what you've told it to do. If you give it things that don't make sense, and it had to guarantee it would have the same defined behaviour regardless of compiler, it would have to emulate on some hardware, insert runtime checks, interfere with some of the bare-metal optimisations. So it doesn't hold your hand. Different languages have different purposes. I still appreciate python even though it's crap for big projects, because it makes everything so easy. But there's a reason Cython is so common in libraries, because Python is not that fast.
...sorry, that's kinda off topic, i do be yapping.
Eh, anyway, good luck with the server! Gotta go.
Thx
Is there a way to save a value into a stackable item like a dynamic property?
can we use async in customCommands?
Whats the best way to detect in the player interact with block event if they are placing a block or just interacting?
async (event, action) => {
``` I'm trying to use it but I get a error
This function must return CustomCommandResult | undefined, and when you make a function asynchronous it returns Promise anyway
so, u can't
I used system.run(async () => {})
world.afterEvents.playerPlaceBlock, but it's in beta
yes but thats the issue, they both run when placing a block
I want to check if they are placing a block in the interact event so I have a system the only runs on interaction and not placing a block
hmm
Best I can think of is just making a list of interactable blocks and checking if it's in that list
But I'd rather not
There is a lot
Thought maybe check if the item is placeable on the block but that would also be a lot
playerPlaceBlock fires before playerInteractWithBlock, so you could use that to check
/** @type {WeakMap<import('@minecraft/server').Player, Number>} */
const PlayerPlacedLastBlockTick = new WeakMap();
world.afterEvents.playerPlaceBlock.subscribe(data => {
PlayerPlacedLastBlockTick.set(data.player, system.currentTick);
});
world.afterEvents.playerInteractWithBlock.subscribe(data => {
if (PlayerPlacedLastBlockTick.get(data.player) == system.currentTick) console.warn('Placing');
else console.warn('Interacting');
});
@wicked girder
it does not so this system doesnt work
I literally tested it
still dont get it how is that usefull
Its not useful to you then but useful for those who need pack settings.
is there away to grow sapling with script?
What's the component to add armor to mobs?
you cant
you need to use the replaceItem command
because you can only get the equippable component on players
no
Define grow
like crops you can set there permutation
just place the feature to create the tree in the place of the sapling
Ohh yeah I forgot that /place exist thank you
no problem
also i think you have to grab it from bds server since there isnt no feature mentioned in minecraft place syntax]
or the resource you created.
lol
is there away to foce the feature to be placed?
Use placeFeature
I did
but it doesnt let me placing the tree even though there is something onto of the location
What is the error?
do placeFeature(feature, locaiton, true) and wrap it in trycatch to get the error
[Scripting][error]-Error: minecraft:oak_tree_feature could not be placed. The following features had failures:
minecraft:tree_feature: Trunk could not be placed
at <anonymous> (growFeature.js:44)
There's the issue, seems like will need to modify the feature to allow it to be placed there
how?
Just, modify that feature's JSON file.
is the best thing to create a new feature? or edit the already exsting one
Up to you.
If I change the default one does it apply to every tree type?
I get an error
[Entity][error]-Missing identifier in spawn rule file
[Entity][error]- Failed to load spawn rules
That has nothing to do with the Features.
you have to remove the sapling block before you place it
Ik but thats not the only issue if there is a tree nearby it wont work
could you please send me the docs for it?
That’s a common thing for saplings
Trees can’t grow if they are near another one
but I want to remove that I'm making faster grow when you spam sneaking
If you're making something like skyblock, afaik they also dont grow if there is something blocking it.
So you cant modify it
I never said that, I said that even in skyblock this is WAI. If you want it to override you would need to learn features.
how so? Is there any docs about features?
yes but its easier to learn watching how minecraft does them and how other people do that
can you provide any files?
Does anyone know why rotation during teleport() doesn't work?
Is it only me that finds (arg, arg)=>{..} satisfying
should work, probably the input thats incorrect
is it possible now to see whats inside a player's echest
no
is it possible to make ridden enttiy moves using applyImpulse?
entity.applyDamage(trueDamage, { cause: "entityAttack"})
Im using It correctly?
trueDamage is a var
Wdym it’s Not json UI and it doesn’t lag when you stop the loop
I found out i was doing set input permissions to true every tick and that was causing desync in movement between client and server
Does anyone know what is the class of vector3?
isn't it like {x: ?, y: ?, z: ?}
like the class for import or smth
It doesn't need imports
It's basically like an interface (template object)
Means you need to type it as {x: int, y: int, z: int}.
While vector2 is just {x: int, y: int}.
int is number type value
Hi guys , so i applied the "min_engine" solution in the player.entity.json , but now the skins get showen but player dosen't get animated
How to fix it plz ☠️
ohh
hi guys how do you keep a function running repeatedly?
runInterval
Just askin how do you add it on a function?
Define the function
Then call the function in the runInterval
isn't this what tick.json is for?
oh wait I'm in the scripting channel lol, thought this was just add-ons
It should be correct, maybe rotation is not applied during the dimension transfer?
Use system.runInterval(void, number/ticks)
For example:
system.runInterval(()=>{
world.sendMessage("Hello")
}, 20 //20 ticks is 1 second)
//This will send hello every 1 second/20 ticks
I've used teleport across dimensions storing rotation value just needs Vector2 with x and y cords so it definitely works
yes I set the rotation but it seems that the player does not rotate, he remains with the same rotation he had in the overworld
How are you passing the values? Within a function call or storing to DPS? Perhaps seeing the code will help too if you post here or create a thread others and chime in too
Now I'm trying again in game to see if it actually doesn't work
It doesn't work, I'm trying but the rotation doesn't seem to have any effect.
Oh so like this?
system.runInterval (() => {example my function here}, 20)
I fixed, thanks
Yes, you can customize the 20 also
Horrifying tests
Guys is it possible to override border block behaviour?
he scammed you if he charged more than $15 for that
is it possible to check if a player has chat open or not?
I see thanks
how do i stop system.runInterval?
put the interval on a variable first then use system.clearRun(variable name)
For example:
const rep = system.runInterval(()=>{
world.sendMessage("Hello")
},20)
system.clearRun(rep)
For example with condition:
let i = 0
const rep = system.runInterval(()=>{
i++
world.sendMessage("Hello")
if(i > 5) system.clearRun(rep)
},20)
hi just one last if multiple player are using system.runInterval and one says trigger system.clearRun will runInterval stop for all?
Depends on the logic of your code, what is it that you type
world.afterEvents.itemUse.subscribe(ev => {
const { source: player, itemStack } = ev
if (itemStack.typeId !== gun) return
const shoot = system.runInterval(() => {
shootProjectile('arrow', player.dimension, player.getHeadLocation(), player.getViewDirection(), {
power: 10,
uncertainty: 0 + recoil,
owner: player
})
}, 2)
recoil + 2
world.afterEvents.itemStopUse.subscribe(ev => {
const { source: player, itemStack } = ev
if (itemStack.typeId !== gun) return
system.clearRun(shoot)
if (recoil > 2) recoil = 0
})
})
kinda like this
if it gets to system.clearRun will it clear on all player
because its directly linked to system ehh
That will not work because you can't call the variable shoot from other function inside the other function because it's private
Scope variable must be public to be able to call it on itemStopUse
If your purpose is to stop the repeating function on itenStopUse, you gotta adjust to other methods
so this script wont stop other players?
ye?
no?
@stray spoke ye btw dw its alr infact thats what i intend
My suggested formula is
On item use -> Activate run interval "shoot" -> if player has tag "stop" -> clearRun "shoot" and clear tag "stop"
On item stop use -> player add tag "stop"
Using an event within an event is very bad unless you use unsubscribe later.
Yeah I don't really do that also, unless if I put it in export function and use it on main
hmmm i see
btw guys just asking how do you export (if thats what its called) a function from other js
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the import declaration or dynamic import. The value of an imported binding is subject to change in the module that exports it — when a module updates the value of a binding that it exports, the update will be ...
Do yall think I can use custom command registry event ingame, or it's just for startup
For example I'll activate adding custom commands if I itemUse
I'm sure this won't work
Alright thanks
@warm mason pardon me but how do you define an item on setDynamicProperty
dynamic properties can't save ItemStack
They only support string, number, boolean and Vector3
huh they changed it now?
They never could
so what abt this then?
Aand?
It doesn't say that it can save ItemStack
Or
Wait
Do you mean how to set a dp on an item?
yes
oh
And if u make any changes in ItemStack u need to set it back to the inventory
so where do i define the item i wanna put dynamic property
Wdym "define item"?
it kept asking me to define the item\
Show code
import { world, system, Dimension, ItemStack } from "@minecraft/server"
import { shootProjectile } from 'bullet.js'
const gun = "vdg:akm"
let recoil = 1
const item = "vdg:akm"
ItemStack.setDynamicProperty('vd:akammo', 30)
world.afterEvents.itemUse.subscribe(ev => {
const { source: player, itemStack } = ev
if (itemStack.typeId !== gun) return
if ('vd:akammo' != 0) return
const shoot = system.runInterval(() => {
shootProjectile('arrow', player.dimension, player.getHeadLocation(), player.getViewDirection(), {
power: 10,
uncertainty: 0 + recoil,
owner: player
})
}, 2)
recoil + 2
'vd:akammo' - 1
world.afterEvents.itemStopUse.subscribe(ev => {
const { source: player, itemStack } = ev
if (itemStack.typeId !== gun) return
system.clearRun(shoot)
if (recoil > 2) recoil = 0
})
})
idk i tried making an item const
setDynamicProperty is not a static method
You need an instance to use it
Like
const item = new ItemStack("stick");
item.setDynamicProperty("id", 123);
oh
so i define it through itemStack thing
uhh idk whats wrong
const gun = "vdg:akm"
let recoil = 1
const item = new ItemStack("vdg:akm");
item.setDynamicProperty("vd:akammo", 30);
i see
I really thought it was only string
can i add glint to an item without actually enchanting it in the first place
Create a copy of this item with "minecraft:glint": true or via attachables, but this cannot be done via script
oh okay thanks
import { system, world } from "@minecraft/server";
system.afterEvents.scriptEventReceive.subscribe((event) => {
const { id, sourceEntity } = event;
if (id !== "jockey:riding" || !sourceEntity || !sourceEntity.isValid) {
return;
}
try {
const viewDirection = sourceEntity.getViewDirection();
const horizontalStrength = 1.5;
const verticalStrength = 0.5;
const impulseVector = {
x: viewDirection.x * horizontalStrength,
y: verticalStrength,
z: viewDirection.z * horizontalStrength
};
sourceEntity.applyImpulse(impulseVector);
} catch (error) {
console.warn(`Error in jockey:riding: ${error}`);
}
});```
im trying to do a script where it only makes the entity move on the ground by the applied impulse but instead, when you trigger the event using /scriptevent it launches the entity in mid air for a bit.
any solutions?
my map addon probably also looks like this
did you just copy pasted a script?
i wasn't sure if typing them as abbreviations would work so there's that
no that's not the point
There is a VerticalStrength and you are asking why the entity is getting moved up
oh so that's why. maybe i forgot to exclude it earlier
💀
what I've said is just to make coding less typing and concise atleast
It doesn't relate to the api
How can i use a const/let from other file? I want to make a let checker that checks if its raining, and I need onWeatherChange event to update the let to the actual weather, but how can I use this let on another file?
You gotta use export and importit to the file uouwant to use it
for example
//test.js
export const word = "Hello"
Then in hour main.js
import {word} from 'path/to/test.js' //replace this
console.log(word)
So I just make this:
file1:
import .. //mc imports
export let weather = “clear”;
world.afterEvents.onWeatherChange.subscribe((e) => {
weather = e.weather
});
File2:
import .. // mc imports
import { weather } from “scripts/file1.js”;
console.log(weather);
?
It works with other files that aren’t the main? Cuz I need it for a lot of systems. Also, do I have to register it at main file too?
Yes and yes
How can I get the name that the player sees when selecting the item?
No i told him to customise some add-ons and do something
Another doubt: can I put more than one world after/before Event into 1 file?
That's very bad, since my stats are artificial
Assuming a limit were to even exist, There's no amount of events that wouldn't be allowed in one file
You'd probably reach a word limit before that
nah im kidding it never does a script warning even if it is a huge process
Right, But it is good to keep all code into one event, Since all the events just tries to run at same time
He means events in general in the same file too
ok
Which includes situations like 2 entirely different types of events on the same file
Objectively wrong statement
Not wrong at all
Maybe you think that cuz u would do the same
Take advatange of someone who doesn't know how easy it is to fix those errors and charge hella money
You right in one thing and is that is more ethical than a scamm
But scamm also can be taken as taking advantage of someone bc they dont know the real value of something
It's like someone has a diamond worth millions and you convince him that it's a fake diamond to buy it cheaper
It's a scamm
Arguing with you is pointless xd
I'd say the same about you tbh
You said it is a scam and at the same time it is not a scam
I didnt say it was not
I said its more ethical than a scamm
lol
Diferrent things
So what is it if not a scam
It is a scamm
It's in the middle of both
That is how freelancing works
Same as everything else
It’s like saying diamonds is a scam
Like 90% was bought by one company
The scamm occurs when u try to hide the truth about it's value
Not a scam just overpriced
Didn’t I just tell about diamonds?
Diamonds are cheap
Their value has been increased by one company
And yet people buy it and are happy
Same about Rolexes cars and basically everything
Same as me charging marketplace 25 euros an hour and not 15 dollars for one project
That's why we should ask @last latch for commissions
Okay. I asked because I tried a time ago and bridge stop auto-completing on the second event, so I assumed it had.
Hillo guys so i gotta ask
What is the msot effecient way to make an area forbidden to enter by certain players
Like border block does
Is your area a regular hexahedron?
☠️ damn i mean hexahedron volume
Volume? Wasnt that area?
Y is useless in this case, so i think you must look within area things
Maybe , yeah Y isn't useless
So you want to block players to go up/down too?
Yep
Oh
Totally forbidden
Okie
Like if u enter it it will tp u to the last loc
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]
What if you do this:
i will use tpPlayer for simple. This method doesn’t exist.
const loc = player.location;
if (loc.x > 100) tpPlayer(100, loc.y, loc.z)
if (loc.x < -100) tpPlayer(-100, loc.y, loc.z)
if (loc.y > 100) tpPlayer(loc.x, 100, loc.z)
if (loc.y < -100) tpPlayer(loc.x, -100, loc.z)
if (loc.z > 100) tpPlayer(loc.x, loc.y, 100)
if (loc.z < -100) tpPlayer(loc.x, loc.y, -100)
I used a cube with side value of 200, and centered.
For example
Which event i must put it in ?
System.runInterval
One min, i will create the script for ya
Thx u
import { world, system } from “@minecraft/server”;
system.runInterval(() => {
for (const player of world.getAllPlayers()) {
const { x, y, z } = player.location;
if (x > 100) player.runCommand(`tp ${player.nameTag} 100 ${y} ${z}`)
if (x < -100) player.runCommand(`tp ${player.nameTag} -100 ${y} ${z}`)
if (y > 100) player.runCommand(`tp ${player.nameTag} ${x} 100 ${z}`)
if (y < -100) player.runCommand(`tp ${player.nameTag} ${x} -100 ${z}`)
if (z > 100) player.runCommand(`tp ${player.nameTag} ${x} ${y} 100`)
if (z < -100) player.runCommand(`tp ${player.nameTag} ${x} ${y} -100`)
}
}, 5);
Np
*I forgot to put the interval
(Already edited)
you can do player.teleport instead of runCommand
This exists?
yeah
Oh
@amber granite
do u have npm types
like this
Ah that makes sense
You might've just been experiencing a random glitch from bridge or had an error
Or something else that I don't know, since I write several events in the same file all the time
Yes, possibly.
Thank u
Np
Node Package Manager
how do i update @minecraft/core-build-tasks
mine's still deployinmg my projects to the mc uwp folder
im so confused bro
i literally manually edited the package to remove any trace of uwp paths
and it still somehow
manages
to deploy there
Install a certain version of a package?
wjat
npm i @minecraft/[email protected]
how do i fix the just script bro
core-build-tasks is somehow told im on mc uwp
but im not
so now its trying to deploy there
and im not specifying it anywhere
Isn't it more related to #1339727065846648906 ?
why would it be
idk what editor-mode is
i'm using core-build-tasks to deploy my typescript project
Why do you need a library to deploy your TypeScript project?
Just compile it down to JS or use tool like Regolith
This one also sends everything directly into Minecraft
You can opt it in .vscode/ directory I think
yeh i can
but the mc product type was defined there
thats why searching for 8weky/uwp didnt find anything useful
xd
😅
@carchi77 ma boy i was looking for u
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]
You make yourself complicated by retyping the x y z on message instead of calling the variables, and atleast make a loop for it since It's the same message format and hundreds range
import { world, system } from "@minecraft/server";
const clamp = (v, min, max) => Math.max(min, Math.min(max, v));
system.runInterval(() => {
for (const p of world.getAllPlayers()) {
const { x, y, z } = p.location;
const nx = clamp(x, -100, 100);
const ny = clamp(y, -100, 100);
const nz = clamp(z, -100, 100);
if (x !== nx || y !== ny || z !== nz) {
p.teleport({x: nx, y: ny, z: nz})
}
}
}, 5);
shudders Using runCommand
Og yeah I forgot
Guys is carish77 is wake up ?
Baffles me that JS still doesn't have a built in clamp function.
I need him in important thing about his better boats add-on
There is this technology called Direct Message which you can use.
Yeah. Im not very familiar with area/volume logic as I don’t use it often
Noticed some new important stuff in minecraft-server, whats up with the SetBookContentsFunction class and others like it?
is there any specific requirements to use dynamic properties?
I tried using it and all of my scripts stopped working
No. Any content log?
yeah, but almost all of them are related to block scripts
let me try checking for ones that stand out
yeah no clue
all of the content log error is only filled with missing blocks error
and all of those blocks have custom components
so I wonder what I'm doing wrong
does it have to be in the main js file perhaps?
when I removed the dynamic property thing it starts to work again
No.
What's the dynamic property code?
Oh that's a hint.
Is your custom comp9nents failing to register
yes
export function MONEY_EXCHANGE_DYNAMIC_PROPERTY(){
const moneyPerItem = moneyPerItem ?? 1000;
const itemPerMoney = itemPerMoney ?? 1000;
const setMoneyPerItem = world.setDynamicProperty('felix:money_per_item', moneyPerItem);
const setItemPerMoney = world.setDynamicProperty('felix:item_per_money', itemPerMoney);
return moneyPerItem, itemPerMoney;
}
MONEY_EXCHANGE_DYNAMIC_PROPERTY();```
here's the function
Debug result for [code](#1067535608660107284 message)
Compiler found 1 errors:
[36m<REPL0>.js[0m:[33m6[0m:[33m12[0m - [31merror[0m[30m TS2695: [0mLeft side of comma operator is unused and has no side effects.
[7m6[0m return moneyPerItem, itemPerMoney;
[7m [0m [31m ~~~~~~~~~~~~[0m
There are no errors from ESLint.
If I recall, it seems you're calling this function at the top level which isn't allowed. Needs to be called in worldLoad
Is this code simplified cuz that's not valid syntax...
was worldLoad replaced by something else or is it still this
it's only the function, so it doesn't work as expected
In js you can't have multiple "things" returned from a function like tuple
oh
Well
I see
You can do [a, b]
I canr think of any language that allows this
python
did this and it works
cool
thank you smokey
wait does that mean I can't use it to change the dynamic property value in other functions then?
if so then that sucks
You can. It just needs to be in a stage where the world is loaded.
and they can change without world reload?
Yes.
hell yeah
python, go and i beleive lua can have tuple return values
Just to be clear, we are talking about the syntax return a, b, c right?
i dont mean in a rude way but do you know what a tuple is? Just so we're on the same page
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.
Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries.
All of these are Tuples, yet they require it to be defined via their object or using []
Indeed, funny thing i learned something i didnt know before with that ts example
didnt know you could do that
how to add custom hotbar/ slot in player's inventory?
What does the getComponent read on hunger, the current have of missing hams or the left ones?
ye
I want to add a secret hotbar to store specific items
you can't
Does anyone know how to make an entity render much farther away?
#1067869022273667152
yeah there is a way i saw
lemme find it
a guy named ItzRiyo found a secret method to add another hotbar slot, but i don't know if the slot is fully functional
btw #1067869374410657962 would be perfect place for this
and how do I add the slot itself?
Even modifying the inventory component in player.json doesn't help, as far as I remember
I have no idea either
Ohhh
found it
Inventory Tweaks V0.1 RELEASE | Texture Pack for Minecraft Bedrock Edition
subs to my 2nd channel for sneak peaks
https://youtube.com/@hiwatashi157
🔴 Subscribe if you want another resource pack because i will make it until i run out of ideas!
❔ If you have any ideas, you can send it to the comments in my video!
...
Well, you could also try equippable component, but I'm not sure
hmm
@warm mason
hmmm
also if ur downloading the pack to see how it works, download this latest one, the one video i sent was outdated
https://www.youtube.com/watch?v=jZsInYzB4ag&t=136s
Utility Inventory V0.3 RELEASE - Texture Pack for Minecraft Bedrock Edition
subs to my 2nd channel for sneak peaks
https://youtube.com/@hiwatashi157
🔴 Subscribe if you want another texture pack because i will make it until i run out of ideas!
❔ If you have any ideas, you can send it to the comments in my video!
...
real
still an hour wait lol
and no I didnt want to see how it worked, I dont look at others people files, I just wanted to use it for a min
and see if it was just a resource pack
it is xd
If it's just a resource pack, it's useless for creators
More of a cheat than an additional slot for something
cant it be both
You can't do anything with this slot. Like, literally nothing
wdym
Even entity equipment slots have more options
You can't get it, you can't set it or anything like that
I see how its how a problem for creators specifically yeah
That's why I say it's more of a cheat because even Minecraft doesn't see it as a slot
no one is gonna argue this is not cheating
yea
and if they do...
Well, that's not what we need anyway
well would be lovely if we could access it like a slot API, but.. it's just meant for survival worlds who want to keep their items not lost after dying.
so like a safe pocket in arc raiders
or whatever its called
also merry christmas to whoever celebrates it
Did y’all check if it works or just speculated?
Adding new slots crashes the client, so new slots seems like crap
well im not waiting an hour just to download it.
You can literally leave the site open in the background
well I didnt.
you could always do it yourself
Noo
how do i summon fireworks that explode?
trying to make something match the beacon how does it looks?
?
pretty awesome
but I'm confused
is it pointing to a location?
or is it pointing to what will happen when you use a move/ability??
Why no one is online today ☠️
It's Christmas dude.
Oh , we don't have Christmas in my country ☠️
One question: how can I make it so that when I crouch and right-click on an entity, it disappears and an item appears in its place using scripts?
Item appears like spawn it?
So the item appears lying on the ground right where the entity disappeared.
import { world, system, ItemStack } from '@minecraft/server';
world.beforeEvents.playerInteractWithEntity.subscribe(({ target, player, itemStack, beforeItemStack, isFirstEvent }) => {
if (target.typeId !== 'minecraft:armor_stand' || !player.isSneaking || !isFirstEvent) return;
system.run(() => {
target.dimension.spawnItem(new ItemStack('minecraft:stick'), target.location);
target.remove();
});
});```
I'm having a problem with this line
target.dimension.spawnItem(new ItemStack('minecraft:stick'), target.location)
Oh sorry, i forgot... Flip the order of the spawn and the remove
Spawn first then remove
I think it would be better to use an entity for this case
It works fine, the thing is it works even if you just right-click, but I need it to happen when you crouch and right-click because the entity I want is mountable.
if (target.typeId !== 'minecraft:armor_stand' && !player.isSneaking && !isFirstEvent) return;```
It still happens that when you right-click, the entity transforms into a stick figure without needing to crouch.
remove ! before the sneaking
something did
world.beforeEvents.playerInteractWithEntity.subscribe(({ target, player, itemStack, beforeItemStack, isFirstEvent }) => {
if (target.typeId !== 'minecraft:armor_stand' && player.isSneaking && !isFirstEvent) return;
system.run(() => {
target.dimension.spawnItem(new ItemStack('minecraft:stick'), target.location)
target.remove();
});
});```
did what?
It continues to drop a stick just by right-clicking on the entity without needing to crouch.
Pretty sure you need to use || not &&
if (target.typeId !== 'minecraft:armor_stand' || !player.isSneaking || !isFirstEvent) return;```
Nothing happens when I crouch down and right-click on the entity, nor does anything happen when I simply right-click.
i already have the flag as an enity even if i want to make this effect or becone effect as an entity how can i do that
it is a waypoint addon
you should use an entity or a particle for that instead
How do I make an entity disappear when I right-click and leave an object on the ground? For example, if I have the Admin tag and right-click on an armor stand, it disappears and leaves a stick. How do I do this?
The people you asked before quite literally gave you the code.
Yes, but now I need it to be with a tag because the previous method didn't work for me.
I recommend actually learning the api.
yes it helped me
Is possible tô cancel the /kill command like the beforeChatSend, event.cancel
Something like that?
You can only technically disable the kill command if you use a Bedrock Server. Otherwise no, you won't be able to disable/cancel it
Hello, I'm trying to make a dash that propels the player into the direction he's looking, but the applyKnockback function changed and now I don't quite know how to take the y axis into consideration. Can anybody help?
const dir2 = player.getViewDirection();
player.applyKnockback({x: dir2.x*6.5, z: dir2.z*6.5}, 0.5);
you can use applyImpluse btw
applyImpulse(vector: Vector3): void
Parameters
vector: Vector3
Impulse vector.
Returns void
Remarks
Applies impulse vector to the current velocity of the entity.```
https://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server.Player.html#applyimpulse
applyKnockback(horzontalForce: VectorXZ, verticalStrength: number): void
Parameters
horizontalForce: VectorXZ
verticalStrength: number
Knockback strength for the vertical vector.```
here if u need the applyKnockback one
ohhh yeah thanks
no worries, you're welcome
how do you minus a number on item dynamic property?
what
so i have a item that uses dynamic property how do you minus the value on a dynamic property
const prop = item.getDynamicProperty('key');
if (typeof prop === 'number') item.setDynamicProperty('key', prop - 1);
i still don't think i understand what you mean, but i believe that's what you want
ill try
hi just asking again how do you use getDynamicProperty
uh
world.afterEvents.worldLoad.subscribe(() => {
const item = new ItemStack("vdg:akm");
const ammo = item.setDynamicProperty('vd:akammo', 30);
world.afterEvents.itemUse.subscribe(gn => {
const { source: player, itemStack } = gn
if (typeof ammo === 'number') item.setDynamicProperty('vd:akammo', ammo - 1)
if (item.getDynamicProperty('vd:akammo') == 0) empty + 1
})
})
just source.getDynamicProperty('key'): value
idk if this is right
uh no i don't think
wait I'm not too sure
gimme a second to verify if the dps are saved on the item entity or the item
this ones saved on itemStack idk if thats right
ight ill check on it
world.afterEvents.playerSpawn.subscribe((data) => {
const { player, initialSpawn } = data;
if (!initialSpawn) return;
const inv = player.getComponent('inventory')?.container;
if (!inv) return;
const itemStack = new ItemStack("vdg:akm");
itemStack.setDynamicProperty('vd:akammo', 30);
inv.addItem(itemStack);
});
world.afterEvents.itemUse.subscribe(data => {
const { source: player, itemStack } = data
const ammo = itemStack.getDynamicProperty('vd:akammo');
if (typeof ammo === 'number') {
itemStack.setDynamicProperty('vd:akammo', ammo - 1);
if (ammo <= 0)
itemStack.setDynamicProperty('vd:akammo', null);
}
})```
here, i don't have time to explain all the details
but you shouldn't nest event subscriptions
you can subscribe to events even before the world load
you should NOT mix local variables and such across events unless seriously needed (it's not needed in this case)
ohh so thats what im missing the inventory
you tried to give the player a gun with 30 bullets based on the world load event but that won't exactly work, you need to add it to the inventory
yes that i didnt knew you have to add it on inventory first
and then you tried to access that item across the itemUse event which is just plain wrong
i recommend you watch a JavaScript course from someone like say BroCode (personal favourite, but you can watch anyone else)
and then brush up on the API things: https://jaylydev.github.io/scriptapi-docs/latest/modules/_minecraft_server.html
ye i alr watched his 12 hour video altho just some few parts
ill try this thanks
no worries
yeah but you should focus on the initial parts first. the web stuff is completely optional, you should focus on the definitions, keywords, and operators
ye
is there a node js library that deals with level.dat and/or db files?
i want to move a lot of structure files from one world to another, and i don't want to do it manually everytime or export them 1 by 1 with structure blocks.
Use amulet. Also not a scripting question.
i kinda need if for a scripting api project, i didn't know amulet was a node js library?
Null or Undefined if i wanted to check if the used item is "minecraft:air"
i mean like if the item in mainhand is empty
is this wrong..? Im not sure how to use the new tryTeleport.
function teleportPlayers(island) {
const players = world.getPlayers();
for (const player of players) {
const tpStatus = player.tryTeleport(island.origin);
if (debugging) {
if (tpStatus) {
console.log(${player.name} teleported Successfully);
} else {
console.log(${player.name} teleport Failed);
}
}
}
}
do i need to call it?
yeah it is
origin: { x: 0, y: 64, z: 0 }
do i need to import vector3 and declare a new instance of it or can I just use a dictionary with x, y, and z keys?
ok.. well dang..
Hello guys anyone knows hwo to mimic border_blocks
What
Just check if the item is falsy
Null undefined false 0
if (!item) should work
if you need to know for whatever reason whether its null or undefined check what the method you’re using is intended to return
I am still lost on how to use this. I dont even know if its working because my console logs arent showing up.
undefined or null works because they're empty.
make sure the log file is enabled and for this time only use error to check if it really logs
yo the log says "it cannot read property getScore of undefined at anonymous" which is "player"
world.afterEvents.playerSwingStart.subscribe((event) => {
const player = event.player
const m1 = event.swingSource
if (player && m1 === "Attack") {
world.scoreboard.getObjective("left").setScore(player, 1)
}
})```
wait nvm i forgot to add the scoreboard thought i had it
now how can i make it wait some ticks to run a 2nd function
My ahh ran /tickingarea list and now the game crashed 😢😢😢
Should i be concerned
I thought my system was sound but i guess not
that doesnt make sense
how could beforeevent be asynchronous and grab data before tick update
it errors without it so
crashes my world
Argument of type '(data: AsyncPlayerJoinBeforeEvent) => void' is not assignable to parameter of type '(arg0: AsyncPlayerJoinBeforeEvent) => Promise<void>'.
Type 'void' is not assignable to type 'Promise<void>'.ts(2345)
(parameter) data: AsyncPlayerJoinBeforeEvent
what version of @minecraft/server is this
{
"dependencies": {
"@minecraft/server": "^2.5.0-beta.1.21.131-stable",
"@minecraft/server-admin": "^1.0.0-beta.1.21.131-stable",
"@minecraft/server-ui": "^2.1.0-beta.1.21.131-stable"
}
}
its in server-admin
ah
used to work now it doesnt
well it returns a promise
normal because its asynchronous
unless the docs say otherwise youre not meant to be able to resolve it to anything meaningful
Promise<void> wont give you anything meaningful
because its
just void
it used to actually return the pfid now it returns absolutely nothing
same as a function returning nothing
do the docs still say that
if not then they removed it
nope
supposed to work for worlds too
atleast it did
now theres no good way of "permanently" storing data via hardcoded ids 💀
average script api update
Contains types related to administering a Bedrock Dedicated Server. These types allow for the configuration of variables and secrets in JSON files in the Bedrock Dedicated Server folder. These types cannot be used on Minecraft clients or within Minecraft Realms.
but this used to work for worlds
i legit used it
i had old data saved on worlds
in a dynamic property
and doesnt that only apply for variables and secrets? not any of the before events
yeah they simply restricted it to server use only 💀 holy stupid
isn't just .id unique
I may not have brain gentlemens but i have a question
the numeric id -29283472398 shit
Is border block is a tickable block ?
only to the world
yes
how do you do that
genuinely wondering
is it straightforward to extract dynamic properties from world or no
i mean i dont need to export the data but i dont have any other way to properly store data with a static id now
What does that mean.
get xuid
you cant on worlds
create ur own id system
Border block does tick ?
do dynamic properties stay on players that have changed their username
so i can just generate a UUID on that players properties and just grab it via join
but idk what im doing in my world atm is i have kv pairs id-username saved in a dynamic property
yeah i was doing that too
well yes but you might as well use their id
what is the difference
true
itll be different on a different world anyway
unless you seed generation by their username, but then that means their id is basically their username just in a different format ...
i would store their pfid as the key and data + username in the values
so it wont protect against gamertag changes
yeah i thought of that too
yeah dont do that
its basically a stupid way of indexing by their username
just pointless abstraction
i might just switch to server stuff
i just wish we could securely grab xuid with server-net
understandable
movement wise only?
movement and the camera
like they cant move while someone is controling them
disable all movements of the player you're trying to control and use inputInfo to control directional movement, jump, and sneak.
For the camera I'm not really sure since .setRotation() doesn't work on players afaik
what can only rotate the player is tp
yo anyone know how to silence this typing issue without just slapping a good'ol as x
?
BP/scripts/staffs/necromancer.ts(53,50): error TS2345: Argument of type '"staffs:skeleton" | "staffs:wither_skeleton" | "staffs:zombie"' is not assignable to parameter of type 'VanillaEntityIdentifier'.
Type '"staffs:skeleton"' is not assignable to type 'VanillaEntityIdentifier'.```
silence mentioned
Looks like VanillaEntityIdentifier can take an EntityType. So I suppose you could create one using EntityTypes.get()
In the parameter just add as any at the end of the value, or as VanillaEntityIdentifier if better
@midnight ridge https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/itemdurabilitycomponent?view=minecraft-bedrock-stable
What method is this? If it's spawnEntity just do spawnEntity<string>(id)
Is 54525 bytes a lot
For dynamic properties
Nvm thats nothing bro the fuck
Why does my shit lag so bad when im saving data
bad code
how
not much you can do wrong i think
i parse the dp and edit the parsed ver then autosave every 60 sec or so depends what data it is
n divide it into chunks with ~32k bytes max
is the data for the player?
if so just directly access the data and cache it so ur not constantly saving that many characters
thats exactly
whati m
doing
thats why i said i parse it and edit it
but no its not just players
cosmetics , market, trades, audits, logs, price history, events
shit ton
of stuff
more than that
yeah idk 54k bytes isnt a lot
they gotta see all the data possible yo
this will be like 2 gigabytes if it actually scales
wait is the form lagging when u open it?
no
it lags when shit autosaves
the form doesnt do anything with dp it just fetches data and calculates
maybe itll lag for some people therec can be up to 33 buttons on these
Can't you respawn if you die in hardcore via script?
Hmmm , I don't guess so
I'm trying to set survival mode via scripts but it doesn't work, is there any data that can be modified to reset death?
Yes i guess
U mean event ?
const itemStack = player.getComponent("minecraft:inventory").container.getItem(slotIndex);
if(itemStack.hasComponent("minecraft:charged_item")) {
const chargedComp = itemStack.getComponent("minecraft:charged_item");
if(chargedComp.isCharged) {
console.log("The item is charged!");
} else {
console.log("The item is not charged.");
}
}
where did u even get that information??
can u send me the docs...
One min
itemcomponent docs
huh nvm
that component doesnt exist
It doesn't exists brudda, that's why I asked for docs 😭
cause maybe I'm tripping since I can't find it in docs and my notes lmao
Oh fr ☠️
I thought it existed
Maybe i had Mandela effect or something
do server-admin works in realms? just wanna use transferPlayer from realm to server
love and hate dynamic properties man
Make that we can use it on blocks and stackable items, we don't have a problem after that...
or only me.
that would be nice yeah
the other one is that it would be nice if it worked for me
I love ur clippy pfp
I'm gone for months and they still haven't added a breeding component.
that's fine since they added item pickup detection and before event entity hit
my ass doesn't need to deal with damage sensors anymore
it's spawnEntity, thanks for your response
yeah i clarified i didn't wanna resort to that in the message.. thanks for the response tho!
thank you for your response, i'll be trying that too!
oh haha, i guess i summoned THE SILENCE by accident, my bad
Silence mentioned
another silence mentioned
Are you just always online?
How do you normally respond so fast 😭
waiting for interesting questions...
I have an entity that rides the player with an animation to position it behind the player
I want the entity to always face the player's direction as though it were connected to the player's actual geometry but whenever I face a certain angle range it faces another direction. The video below shows the problem more clearly
How can I remedy this?
Can scripts even remedy this or is it more of another type of solution?
Any ideas are sincerely appreciated
maybe try doing entity.setRotation(player.getRotation())
hmmm
idk man
setRotation is very slow to sync with the client
At least use properties
Although I would think about getting the player's rotation through Molang and doing this thing on the client side
How do you get it through molang?
idk
maybe query.bone_rotation would work
I thought we couldn't access other entities in molang
use client-synced properties and animations then
To be clear, does that work through getting the view direction of the riding entity, setting that as a property, and using an animation to set that as the look at animation direction?
Wait.. You're using player.json, right?
Then how did you make your entity ride on the player?
I gave it the parrot family
Cause parrots ride players
SmokeyStack accidentally gave me the idea some months ago and I've remembered ever since
Then look at how the parrot code works
Ok so everything is dictated by the player.json file due to the rideable component
how can I get custom commands params, like on that example:
import { world, system, CommandPermissionLevel, CustomCommandParamType } from "@minecraft/server";
system.runInterval(() => {
let message = world.getDynamicProperty('aca:message');
let time = world.getDynamicProperty('aca:messageTime');
if (message === undefined) message = '';
for (const player of world.getAllPlayers()) {
player.onScreenDisplay.setActionBar(`${message}\n` + 'aaaaaaa o aaaaaaa');
}
if (time === 1 && message !== '') world.setDynamicProperty('aca:message', '');
world.setDynamicProperty('aca:messageTime', (time - 1));
}, 1);
system.beforeEvents.startup.subscribe((d) => {
const messageCommand = {
name: "aca:message",
description: "sets a message to appear on actionbar",
permissionLevel: CommandPermissionLevel.GameDirectors,
mandatoryParameters: [{ type: CustomCommandParamType.String, name: "aca:message" }],
optionalParameters: [{ type: CustomCommandParamType.Integer, name: "aca:time" }]
};
d.customCommandRegistry.registerCommand(messageCommand, (c) => {
world.setDynamicProperty('aca:message', messageParam;
const messageTime = timeParam * 20 || 100;
world.setDynamicProperty('aca:messageTime',messageTime)
});
});
I rarely talk and online, how can you say so
Btw how to get the owner of the world's Player class
I've seen like 3 instances of you responding between immediately and 5 min later to being summoned
For me, I always late reply lol. I don't know how you find me that fast
charged item component please
I guess we're going to have to agree to disagree since I don't know how you find yourself slow XD
I'm Silenced for a reason
Lol
Have you checked the shooter component
what I meant was able to detect charged items using script.
Do you know if the bow reacts to the itemUse event
everything reacts with item use
Well then you can fake it
Nooo, u don't understand lol
CROSSBOW type of charged
You can still fake it 🙃
sigh
I'm not a dumbass not to know that, WHAT I'M SAYING IS A DIRECT WAY
just boolean if an item is charged that's it.
I already know how to check it in a different way btw lmao
params are indexed iirc, not sure tho lmao
checked and aparently you just need to put the param name. At the end of the day it was the most intuitive option
Im pretty sure the crossbow is hardcoded to an extent so I don't believe it to be possible, unfortunately
ive been seeing this alot in js
but just asking
what does store means?
well, made that and still didnt work:
import { world, system, CommandPermissionLevel, CustomCommandParamType } from "@minecraft/server";
system.runInterval(() => {
let message = world.getDynamicProperty('aca:message') || '';
let time = world.getDynamicProperty('aca:messageTime') || 0;
if (message === undefined) message = '';
for (const player of world.getAllPlayers()) {
player.onScreenDisplay.setActionBar(`${message}\n` + 'aaaaaaa o aaaaaaa');
}
if (time === 1 && message !== '') world.setDynamicProperty('aca:message', '');
if (time >= 1) world.setDynamicProperty('aca:messageTime', (time - 1));
}, 1);
system.beforeEvents.startup.subscribe((d) => {
const messageCommand = {
name: "aca:message",
description: "sets a message to appear on actionbar",
permissionLevel: CommandPermissionLevel.GameDirectors,
cheatsRequired: true,
mandatoryParameters: [{ type: CustomCommandParamType.String, name: 'messageParam' }],
optionalParameters: [{ type: CustomCommandParamType.Integer, name: 'timeParam' }]
};
d.customCommandRegistry.registerCommand(messageCommand, messageHandler)
function messageHandler(messageParam, timeParam) {
world.setDynamicProperty('aca:message', messageParam);
const messageTime = timeParam * 20 || 100;
world.setDynamicProperty('aca:messageTime', messageTime)
}
});
Well, like saving some values
import { world, CommandPermissionLevel } from "@minecraft/server";
function getHost() {
return world.getAllPlayers().find(player => player.commandPermissionLevel == CommandPermissionLevel.Host);
}
i see
@warm mason sorry for ping but is there a good way to add some sort of tick delay?
ive been experimenting with runInterval for a while but doesnt seem to work very well\
wdym it doesn't work well?
been trying to make a sort of a tick delay using variables like 1 and 0
every tick of 2 it sets the variable to 1
but after that it goes back to 0
show code
w8 w8
const go = system.runInterval(() => {
delay = 1
}, 2)
delay = 0 ```
im planning to use it for something that uses if (delay === 0) return
@warm mason sorry for ping but just asking is ts code even viable in the first place?
Do you want the code to execute once after N ticks, or to execute it repeatedly every N ticks?
idk, I use js
once after n ticks because if i use this code on runInterval it wont work the way i intend it
Is it possible to force a player to select a specific hotbar slot?
@warm mason just one last is it possible to export world.afterEvents stuff?
player.selectedSlotIndex = 4;
for example
hm?
i want to use a dynamic property i made on another js
is it possible?
Dynamic properties are accessible from any file like everything else
hmmm
ill try
thanks btww
is there a way to detect whenever a player hits the air?
are there some chances oreUI will be compatible with scripting?
yessirr
i don't have the link to the message
but there's a DDUI class
thank god
what's that?
data driven user interface
it's not how you think it is tho
it's not react code
and it's not HTML
it's more like, cleaner JSON defined UI
so its just as bad as json ui?
and script API getting the power to show/hide and do some stuff with the UIs
noooo
it's waaaaay better
it's very easy to understand
gimme a sec
only show/hide or also edit in real time
i'll get the link of the message
you can't confirm that
also that i think, i am just saying based on the class def
true, but why would they make a DDUI class in the first place with such methods?
seems pointless if not usable
#1448357215932121249 message
#1448357215932121249 message
con master is
oh wait
you meant actual world gen
not script api based world gen
mb
That's very cool is this like the equivalent of document.getElement ...... ?
no my guy
we don't edit nor interact with the web code
it's declarative
so its easier to create uis but its the same as json ui?
no dude
what does declarative mean
It currently seems like the DDUI files will allow you to create your own screen layouts in JSON using vanilla Ore UI elements as well as inserting Ore UI elements into vanilla screens at different "extension points" that the developers add
you still use JSON for the UI yes, declarative based system means a system that accepts u declaring information (like say a set of instructions, rules, etc.) and does actions (like making the UI) based on said data.
JSON UI != DDUI
they both use the data format JSON for declaring the UIs but their formats are completely different.
yeah that's basically it
i mean, are we sure those are screens and not just spaces like how json ui have namespace
yes, i mean why else bother creating a class named DDUI that lets ScriptAPI interact with UIs?
could be just inserting panels into screens
only time will tell
i guess so
Why does the arguments in my custom command only returns the first one even tho it has two parameters, also ingame it shows two. The Target is the first one, the second one is the Minutes:
The code:
data.customCommandRegistry.registerCommand({
name: format("givevip"),
description: "give a vip to specific player for a limited time",
permissionLevel: 1,
mandatoryParameters: [
{
name: "player",
type: "PlayerSelector"
},
{
name: "minutes",
type: "Integer"
}
]
}, (origin,arg)=>{
const [target,mins] = arg;
const player = origin.sourceEntity;
//... other codes
(origin, targets, mins)=>{
const target = targets[0];
const player = origin.sourceEntity;
well, u can do this:
(origin, ...args)=>{
const [targets,mins] = args;
const target = targets[0];
const player = origin.sourceEntity;
made adjustments but the command message doesnt shows:
import { world, system, CommandPermissionLevel, CustomCommandParamType } from "@minecraft/server";
system.runInterval(() => {
let message = world.getDynamicProperty('aca:message') ?? '';
let time = world.getDynamicProperty('aca:messageTime') ?? 0;
if (message === undefined) message = '';
for (const player of world.getAllPlayers()) {
player.onScreenDisplay.setActionBar(`${message}\n` + 'aaaaaaa o aaaaaaa');
}
if (time === 1 && message !== '') world.setDynamicProperty('aca:message', '');
if (time >= 1) world.setDynamicProperty('aca:messageTime', (time - 1));
}, 1);
system.beforeEvents.startup.subscribe((d) => {
const messageCommand = {
name: "aca:message",
description: "sets a message to appear on actionbar",
permissionLevel: CommandPermissionLevel.GameDirectors,
cheatsRequired: true,
mandatoryParameters: [{ type: CustomCommandParamType.String, name: 'messageParam' }],
optionalParameters: [{ type: CustomCommandParamType.Integer, name: 'timeParam' }]
};
d.customCommandRegistry.registerCommand(messageCommand, messageHandler)
function messageHandler(origin, args) {
const message = args.messageParam;
const time = args.timeParam;
world.setDynamicProperty('aca:message', message);
const messageTime = time >= 0 ? time * 20 : 100;
world.setDynamicProperty('aca:messageTime', messageTime)
}
});```
because DPs are stored under one big NBT tag in the leveldb, so it has to resave everything when you write one DP
if it's a server' then I'd recommend using an external DB with a http API
can't do that on worlds though
or realms
unless with a bot
i mean technically
if i write a custom dll
i could make it poll values from the game's memory that correspond to http requests the script wants to make
like entity tags
but that would be very very difficult
at that point id rather run a server
but everything is possible if u put ur mind to it
Is there a way to force disabled the auto jump settings with scripts api?
Any explanation for this error?
function ShowCommandMenus(Player){
const A = new ModalFormData().title("Command Menus").textField("Enter Here!");
const Response = A.show(Player);if(Response.canceled)return;
const Command = Response.formValues[0].trim();if(!Command)return;
const ConfirmA = new MessageFormData().title("Command Menus").body("Confirm Command Registry?").button1("True").button2("False");
const ConfirmResponse = ConfirmA.show(Player);if(ConfirmResponse.canceled||ConfirmResponse.selection==1)return;
try{Player.runCommand(Command);Player.sendMessage(`Execute ${Command} Successful!`)}catch(e){Player.sendMessage("Command Error!")};
};
it says:
[Scripting][error]-TypeError: Incorrect number of arguments to function. Expected 2-3, received 1 at ShowCommandMenus(Js.8) at <anonymous>(js.4).
here's the .js 4
AE.itemUse.subscribe(({itemStack:A,source:B})=>{if(B.nameTag!=="Mech Protector")return;if(A.typeId=="minecraft:stick"&&B.isSneaking)ShowCommandMenus(B);});
My dyslexia love this so much...
and my UpperCase typing love this also
the error is self explanatory
look in the line the error is pointing to, if there is a function there, it is expecting 2 or 3 arguments but you only giving it 1