const def = ev.propertyRegistry;
def.registerEntityTypeDynamicProperties({
command: "string"
}, "minecraft:entity"); // für alle Entity-Typen
});
// Entity Editor öffnen
function openEntityEditor(player) {
const form = new ModalFormData()
.title("§lEntity Editor")
.textField("§eEntity Type", "z. B. minecraft:villager", "minecraft:villager")
.textField("§bDisplay Name", "z. B. §r§aShopkeeper", "§aShopkeeper")
.textField("§dCommand", "z. B. give @s diamond 1", "say Hello @s!")
.toggle("§6Spawn now?", true);
form.show(player).then(res => {
if (res.canceled) return;
const [type, nameTag, command, spawnNow] = res.formValues;
const data = {
type,
nameTag,
command,
spawnNow
};
if (spawnNow) {
const entity = player.dimension.spawnEntity(type, player.location);
entity.nameTag = nameTag;
entity.setDynamicProperty("command", command);
player.sendMessage(`§a✔ Spawned ${type} with command: §r${command}`);
} else {
player.sendMessage(`§ePreview only. No entity spawned.`);
}
});
}```
#Script API General
1 messages · Page 73 of 1
Maybe check on that code if command holds a value
What the, you don't need to register dynamicProperty like that to use them anymore. That's not even the correct event for it.
ik
so, does spawning it works?
but worldInitialize is not working
worldInitialize is called worldLoad now
import { world, system, Player } from "@minecraft/server";
function disableSprinting() {
const players = world.getAllPlayers();
for (const player of players) {
if (player.isSprinting) {
player.isSprinting = false;
}
}
}
system.runInterval(() => {
disableSprinting();
}, 1);```
So isSprinting is readOnly?
sprinting is read only
sigh
Blindness works, but it creates a distant fog (even when set to infinite)
and it doesnt stop already ongoing sprints either
yeah
I can set the players hunger with effects, but I would need to do some math and such to keep them under 6 hunger
or can you manually set hunger with minecraft:hunger
in scripting
no
yes
we lack a lot of stuff for attributes
edit the player.json
god damnit
I could do that in my environment
What would I edit to make it so the player is always at hunger 6 or less, or set their max hunger to that
in order to disable sprinting
you could remove the entirety of exhaustion too
its not hard to see what im trying to make haha
Can we directly set health btw?
thats great, that means I can make the food system accurately
Theres a gamerule for it too
or wait only natural regen
only natural regen
you can modify player.json to set all exhaustion values to 0
Would that make them not sprint too?
nope. I do this for my add-on since I removed saturation
"minecraft:exhaustion_values": {
"heal": 0,
"jump": 0,
"sprint_jump": 0,
"mine": 0,
"attack": 0,
"damage": 0,
"walk": 0,
"sprint": 0,
"swim": 0
},
well technically it's still there, but the player is always at max saturation since there is nothing that can reduce it
If I add this, I wont have a "reliable" system for removing sprint by abusing the exhaustion system though
I was going to just spam effects on a player to lock them at a hunger level below that of which allows sprinting
because there is no other way 😭
Can we set player speed? I could do that I guess, but I cant remove the sprint FOV thing
import { world, system } from "@minecraft/server";
await null;
const WALKING_SPEED = 0.1;
function capMovementSpeed() {
const players = world.getAllPlayers();
for (const player of players) {
const movement = player.getComponent("minecraft:movement");
if (movement) {
if (player.isSprinting) {
movement.setCurrentValue(WALKING_SPEED);
} else {
movement.setCurrentValue(WALKING_SPEED);
}
}
}
}
system.runInterval(() => {
capMovementSpeed();
}, 5);```
Give them hunger * 100 amplifier
And make them immune to starve damage
Cancel consumable item in beforeEvent itemUse or smt so they have 0 chance to increase their hunger
Thats what i'll do, then i'll query the health, and do the math for the end result (with a clamp for max health) and set the player health
unless we can just add health, idk. I have to check the method
"minecraft:damage_sensor": {
"triggers": {
"on_damage": {
"filters": {
"any_of": [
{
"test": "has_tag",
"subject": "self",
"value": "protect"
},
{
"test": "damage_type",
"operator": "==",
"value": "starvation"
}
]
},
"deals_damage": false
}
}
},```
Am I doing something wrong 😭
"test":"damage_type" to "test":"has_damage"
oh
"value" to starve
This works great! However when a player first joins, they can sprint for a moment until their hunger drains.
when using this:
/effect @s hunger infinite 255 true
Disable their input permission for a few seconds
Lmao, I guess so
"minecraft:damage_sensor": {
"triggers": {
"on_damage": {
"filters": {
"any_of": [
{
"test": "has_tag",
"subject": "self",
"value": "protect"
},
{
"test": "has_damage",
"operator": "==",
"value": "starve"
}
]
},
"deals_damage": false
}
}
},```
Still results in damage :\
well, there's one like this:
"minecraft:damage_sensor": {
"triggers": {
"cause": "fall",
"deals_damage": false
}
}
"minecraft:damage_sensor": {
"triggers": [
{
"on_damage": {
"filters": {
"test": "has_tag",
"subject": "self",
"value": "protect"
}
},
"deals_damage": false
},
{
"cause": "starve",
"deals_damage": false
}
]
},```
Nope :\
This is more of #1067869022273667152 but if youre on format 1.21.40 or higher its "no" not false
yeah thats a really great decision
why is this not working: const distance = player.location.distanceTo(entity.location);
Error: typeerror not a function
okay
player.location might be Vector3, but it's just an x y z interface
No unique method you could do there
should work
const dy = player.location.y - entity.location.y;
const dz = player.location.z - entity.location.z;
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
@wanton cedar
https://wiki.bedrock.dev/scripting/scripting-intro
world.afterEvents.dataDrivenEntityTrigger.subscribe(data => {
const entity = data.entity;
const id = data.eventId;
const mods = data.getModifiers();
if (id === 'example:event') {
// code
}
})
umm I need hekp
why is this just working for me not for other player (or mobile players idk)
const player = event.player;
const entity = event.target;
if (!(player instanceof Player)) return;
if (!entity || !entity.id) return;
const tagMap = getTagMap(player);
const entry = tagMap[entity.id];
if (!entry) return;
const finalTag = `${entry.tag}`;
system.run(() => {
if (player.hasTag(finalTag)) player.removeTag(finalTag);
player.addTag(finalTag);
player.sendMessage(`§aYou got tag: §e${finalTag}`);
});
event.cancel = true;
});
not about the problem you are having, but you dont need if (!(player instanceof Player)) return; because it'll always be a player.
ok but why is just one player getting the tag
anyone wanna help me out in vc 😉
what is it about
Why not just send your problem here
can someone help me pls
I don't get any errors in the logs
im very new to js and im tryna make a ui
ui is done but making the buttons work is the part im stuck on
new ActionFormData()
.title("§l§aTest")
.body("§7This is a test.")
.button("§aTest Button 1")
.button("§cTest Button 2")
.show(player)
.then(res => {
if (res.canceled) return;
if (res.selection === 0) player.sendMessage("§aYou clicked Test Button 1!");
if (res.selection === 1) player.sendMessage("§cYou clicked Test Button 2!");
});
}```
or
yeah, and hes showing you how to make the buttons do things
.title("test")
.button("test")```
ik how to make them do things but like im stuck on the thing i need it to do
"buttons work"
.button("name", "texture")
which is?
sell all items in your inventory based on prices in a map
loop through inventory -> get item -> check against map -> if item exists, clear slot and total = total + item amount * sell price
btw if u want a 1:1 copy of ur inv then use: https://github.com/Herobrine643928/Chest-UI
just looks good
okay
that is not minecraft:clock
Does anyone know why my interact event activates multiple times?
nothing's wrong with my script it just activates multiple times
if(!event.isFirstEvent) return
Has anyone used the place feature command in scripts?
It does not work.
Use the native method instead.
How do I do that?
Are there any docs on this?
what's the purpose of !(player instanceof Player)? It's not needed, same goes to !entity || !entity.id...
https://stirante.com/script/server/2.0.0-beta.1.21.80-preview.27/classes/Dimension.html#placefeature
Documentation for @minecraft/server
Pls double check if player has anything stored in getTagMap()
Thanks. I was struggling to find something like this lol.
Still looking for setting up realtime seasonal loot drop if anyone has any experience in setting up real time events
I had tried that. I'm not on PC right now to grab my code.
I do mean real time yes.
I had got it where console log was detecting whether it was the actual date. And had the seasons set up, but the drops weren't doing anything and I wasn't getting errors.
It's the event part I'm struggling with
Wdym by seasonal? Like there's a holiday in real life?
Or your own made season?
Yeah 4 holidays 2 weeks(1 before one after)of mobs having a low chance of dropping loot for that specific holiday
Eventually more but just 4 for now
Easter, 4th of July, Halloween and christmas
So technically each season
Ahh, we need to check if the current time of player is a real time holiday? Just confirmation
function getDateRangeInfo(currentDate, targetDate, range) {
const current = new Date(currentDate);
const target = new Date(targetDate);
current.setFullYear(2000);
target.setFullYear(2000);
const timeDiff = current.getTime() - target.getTime();
const absTimeDiff = Math.abs(timeDiff);
const rangesInMs = {
milliseconds: range.milliseconds || 0,
seconds: (range.seconds || 0) * 1000,
minutes: (range.minutes || 0) * 1000 * 60,
hours: (range.hours || 0) * 1000 * 60 * 60,
days: (range.days || 0) * 1000 * 60 * 60 * 24,
weeks: (range.weeks || 0) * 1000 * 60 * 60 * 24 * 7,
months: (range.months || 0) * 1000 * 60 * 60 * 24 * 30
};
const totalRangeMs = Object.values(rangesInMs).reduce((sum, val) => sum + val, 0);
const timeUnits = {
days: Math.floor(absTimeDiff / (1000 * 60 * 60 * 24)),
hours: Math.floor((absTimeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)),
minutes: Math.floor((absTimeDiff % (1000 * 60 * 60)) / (1000 * 60)),
seconds: Math.floor((absTimeDiff % (1000 * 60)) / 1000)
};
return {
isInRange: absTimeDiff <= totalRangeMs,
timeDifference: {
milliseconds: absTimeDiff,
...timeUnits
},
direction: timeDiff < 0 ? 'before' : timeDiff > 0 ? 'after' : 'same',
isPast: timeDiff > 0,
isFuture: timeDiff < 0,
isSame: timeDiff === 0
};
}
const testDates = {
christmas: new Date(2000, 11, 25),
halloween: new Date(2000, 9, 31),
newYears: new Date(2000, 0, 1),
};
const now = new Date();
console.error('Christmas info:', JSON.stringify(getDateRangeInfo(now, testDates.christmas, {days: 1})));
console.error('Halloween info:', JSON.stringify(getDateRangeInfo(now, testDates.halloween, {weeks: 2})));
console.error('Today info:', JSON.stringify(getDateRangeInfo(now, now, {days: 3})));```
I didn't include years since who would wait a whole year in Minecraft for this if in the end they can just delete the addon and wait for it to be 1 week of that time.
best thing I made so far...
WOOOOOO
I'M ALMOST FINISHED MY WEDGE BLOCKS
It's mostly powered by JS, with permutations ofc needed to change the textures of the block itself
ah, don't mind the audio
Was listening to an NBC clip
The video is mainly showing off how when you click on the block with a different item, you get the previous item used, back
That took a lot of work to just figure out
I'll try this in a minute.
The add on drops stuff year round. There's just exclusive stuff during the holiday
uh, probably a stupid question but, is it possible to detect the player saturation?
Thank you. I'll also share my code, I think I have the date stuff figured out. It's the rest of it I'm struggling with.
I absolutely love seeing happy wiggles on Minecraft. it never gets old
Haha, those were frustated wiggles xD
Since everytime you clicked it with the same block, it gives you another on the same block, which isn't supposed to happen
lol
No...
For example, the last part in the video
And I got a texture name wrong too xD
I honestly did not see the number and thought you were in creative and happy it didn't take the block since it already was copper
For the waxed copper variant
ah haha
Sorry for late but the months is index 0, so January=0 and December=11
No worries I just got home and had only just responded.
I have this set up in a case situation
So I'll give this a shot
damn, with that being said, i will have to detect it all by myself, like detecting everything that could make the player saturation goes down faster and detect the vanilla food saturation values
in general, so much work
why? Just create new system...
It's better than checking everything...
new saturation system? like the player hunger will never go down until the saturation is 0?
Also by this logic why would you even bother downloading it if youd just delete the add on after each season? It's not like you'd keep the drops they'd go too
fr.
people who are just for hype
Sorry what I meant I didn't include the year since every holiday happens every year so I don't think I need to put years
Unless you needed it, I can just do it...
I'll just check it first. As I said I do have a date system that was detecting that date. But I didn't know how to set up the event after to get the entities to drop the items during that time.
i mean, new hunger system...
i know, the player hunger will never get lower until the new custom saturation is 0.
Expected output... Obviously the time would vary...
{"isInRange":false,"timeDifference":{"milliseconds":0,"days":0,"hours":0,"minutes":0,"seconds":0},"direction":"before","isPast":false,"isFuture":true,"isSame":false}```
did you remove the time you had there lol
[Scripting][error]-Christmas info: {"isInRange":false,"timeDifference":{"milliseconds":22295412178,"days":258,"hours":1,"minutes":10,"seconds":12},"direction":"before","isPast":false,"isFuture":true,"isSame":false}
[Scripting][error]-Halloween info: {"isInRange":false,"timeDifference":{"milliseconds":17543412178,"days":203,"hours":1,"minutes":10,"seconds":12},"direction":"before","isPast":false,"isFuture":true,"isSame":false}
[Scripting][error]-Today info: {"isInRange":true,"timeDifference":{"milliseconds":0,"days":0,"hours":0,"minutes":0,"seconds":0},"direction":"same","isPast":false,"isFuture":false,"isSame":true}
ye
awesome!
christmas is so close, im disgusted lol
Thank you! could you perhaps help me set up the entities having a 1 percent chance of dropping the loot(each season has its own) on death? With 4 entities being able to drop it
use entityDie and use the function to check if the current date is in range or it's Christmas BLA BLA bla
I added, as many as possible datas so it's not useless on just Boolean.
thank you!!
you know how to grab those datas right?```js
function getDateRangeInfo() { ... }
const { isInRange, direction } = getDateRangeInfo(date, date, { days: 3 });
if (isInRange) { ... } else { ... }```
Is it possible to launch a projectile with some event?
Entity.triggerEvent('<name>')?
This is what I was saying I needed help with. Actually turning the holiday into the event. All I had gotten was console logs confirming the dates were working on mine
Thank you!
I wanted to use a method to summon a projectile
minecraft:spawn_entity is very boring
const mob = Dimension.spawnEntity();
mob.triggerEvent();
const projectile = mob.getComponent('projectile');
projectile.shoot();
projectile.owner = Entity;```
it's still the same.
lol
I don't know how to use the fact that it confirms the date as true to then make the mobs drop
const { isInRange, direction } = getDateRangeInfo(date, date, { days: 3 });
if (isInRange) { ... } else { ... }
if (direction === 'before') { ... } else { ... }```
i would use weeks: 2 for the event to last 2 weeks right?
const { isInRange, direction } = getDateRangeInfo(date, date, { weeks: 2 });
if (isInRange && direction === 'same') { ... }```
so yes lol thank you
wait, why was it before in the last one?
sorry im trying to understand howto read it as well
or understand why
That was a sample lol
i think i see, it would check if 3 days before?
i get it was a sample i was asking what that meant.
don't worry you don't really need to understand anything except for what it return...
- isInRange: A boolean that is
trueif the two dates are within the specified time range (e.g., within 2 weeks). It checks both before and after the target date by default. - direction: A string indicating whether
currentDateis'before','after', or'same'astargetDate. - isPast:
trueifcurrentDateis aftertargetDate. - isFuture:
trueifcurrentDateis beforetargetDate. - isSame:
trueif both dates are identical. - timeDifference: An object showing the difference in days, hours, minutes, seconds, and milliseconds.
thank you
i kind of did need to understand since this whole time i was asking about setting up the return because i had the dates already returning as true but didnt know how to grab them and then turn that into my event. but you just rewrote dates and i didnt understand the set up. And if i ever wanted to add to it, i have to understand why/ and what
thank you so much!
ohh lol yeah, these are the description, just read them... For grabbing just do the sample I gave ```js
const { isInRange, direction, isPast, isFuture, isSame, timeDifference } = getDateRangeInfo();
const { milliseconds, days, hours, minutes, seconds } = timeDifference;```
can someone send me ts pack setup
why is player join deprecated??
It isn't.
good cuz i just released it says everything is deprecated 😢
is it possible to remove the players hud in scripting like they cant see it like the equivalent to f1
HudVisibility
is it a component?
No scripting.
Is there a way to use scripts to diversify generating structures? As in check for more things
Such as?
Just any way to incorperate scripts into structure generation so I can make more stuff possible (I am new to this and come from java)
Then no.
What functionality is missing?
Well I'd like to check "conditions" on more than a single block where the structure will be spawned at, currently I use "grounded" and that works fine but I also don't know how to incorperate supported feature rules from the bedrock dev wiki into my feature rules for the structure I spawn so I am also looking for the limitations in general to world generation of structures
how could i implement cables? just a line which lists blocks of the same id next to each others, and when i place / break a block it modificates the line.
I thought in well, recursion, but its O(M^N) M is the sides of the block, my idea is only xz axis so its O(4^N) thats heavy as hell. Do anybody know some way better? space does not matter by now later i can improve it
Searching on web i ended with union find, must implement it tomorrow, but if anyone has some idea, ill appreciate
That sounds complicated.
What is 'line'? Is it equal to a network?
something like minecraft redstone, nothing different from that
except the fact i dont pretend making it go up or down
So nothing large? Just two blocks that need visual change for showing connection?
actually, not the visual, but the state, its simply to set a stste to "has_energy" or not. No limits of energy, the energy does not decrease, but when i break some, it tries to recalculate and set to without energy to the ones that aint connected to any energy source
in case the state is simply a number from 0 to 16, 0 as a C boolean is false, so its got no energy, any other just mean the energy intensity from the source
but then if i break some and the new "line" is not connected to any source, i must set the energy to 0
to implement the source to energize everything was actually simple, just used recursion and runJob with the O(4^N) implementation i told before, the problem is to de-energize(sorry for bad english, its been a while since i talk in english)
It's fine. Since there's energy intensity, you could use the broken cable's energy intensity to guess which adjacent cable needs to be checked.
Well, technically you can skip the check, and immediately set all those cables with lower energy intensity to 0.
that's a good idea, but it aint gonna decrease. The energy is constant and can only be increased. Just imagine a flash of light. It aint decrease its intensity, but can actually get more if another flash of light closer to you appears
if its too complicated to implement what im trying to, imma implement it this way
I see, then you could make a new one solely to track its distance from a nearby source.
hey sorry to jump in the conversation, is it possible to get the attack value specified in a entities .json file similar to the getComponent('health').currentValue
i've faced worse stuff before, imma try to implement something later and anything i come here to show. I hope that the Union Find data structure work, if not imma try to find another one
Can't.
You could aproximately guess from the damage they dealt, but still required a lot of work to anticipate multiple factors that increase the damage.
planned on doing something like guessing it, but i was wanting to do it to make a custom health system just alot of factors like entities that can oneshot the player basically
i also dont want to use some basic health boost effect thats why lol
Understandable, the vanilla health limit has a cap anyway. A custom one would be fancy, but won't guarantee compatibility with a third-party addon
yeahhhhh
its also mostly for smaller value like 1 percent lol
the only other way i can do something like that from what im thinking is to make a default repository of entities that can be updated via in game but i would like to not do that because of issues like having to define each single one lol
not at home sadly
@humble lintel can you send your VSCode extensions you have, please
waiting for an option to keep velocity on applyKnockback...
i wonder if giving entity velocity to applyKnockback method is good enough for "keeping velocity"
applyKnockback don't effect velocity afaik
it does
try applyKnockback with all zero on entityHurt event
but well, turns out, adding velocity value to applyKnockback is good enough
for vertical strength, at least
ohhh
onPlace don't have a player reference?
nvm, there is beforeOnPlayerPlace
when i used to write addons on vscode i had these
https://marketplace.visualstudio.com/items?itemName=BlockceptionLtd.blockceptionvscodeminecraftbedrockdevelopmentextension
https://marketplace.visualstudio.com/items?itemName=destruc7i0n.vscode-bedrock-definitions
https://marketplace.visualstudio.com/items?itemName=JannisX11.snowstorm
i dont remember that well but i think the first 2 ones only work when inside com.Mojang folder
Extension for Visual Studio Code - An extension that provides code completion, validations, formatters, diagnostics, cheat-sheets, code-actions, creation of files, and development tools to help develop Minecraft Bedrock content
Extension for Visual Studio Code - Go-to definitions and auto-complete for Minecraft Bedrock Edition
i have these, i askeed him bcoz he has some cool theme
and i liked it
and asked which theme he uses
does DataDrivenEntityTriggerAfterEvent fire when the event is applied or triggerEvent() is fired?
Yes.

yoo how do I do a libary?
I think with typescript and javascript(js ofc)
like waterdb,prismarinedb or herobrinws chestui
how do I make custom dash commands
Dash move (push forward)
applyKnockback?
and for making custom commands you use chatSend event
The presence of custom indicates there is a vanilla dash command.
Hence why I asked OP to clarify.
wait, nvm
what Minato you were right, why delete your messege
Triggering a dash with commands? just weird
Why not a custom item
i just assumed he meant dash move
hence why my brain ignored the command bit
OH WAIT
his way of asking the question sounds weird to my mind 😭
I also realize
Dash means '/'
That's why I asked OP to clarify.
custom dash ( / ) commands
that's slash
hmm some ppl say dash idk
According to google, this is dash: (—)
NVM
that's the horizontal line symbol
😭 he made us confuse
okay he just meant
-command
Let's not assume anymore and just wait for OP to clarify please.
is it possible to execute something right after runJob execution?
it seems to run on another thread or in parallel idk
yes
why not
because it seems to be async
and i dont know how to make the code block until it finishes
nah like you can only run something after the work of runJob finishes
not while something is happening ig?
okay i just dont know
export function* set_energized(block: Block, level: number): Generator<void, void, any> {
console.warn(OtsukiTrail.network.is_vec3_cable(block.location));
...
}```
```ts
...
onPlayerDestroy(arg0: BlockComponentPlayerDestroyEvent): void {
system.runJob(set_energized(arg0.block, 0));
console.warn("eita");
}
...
im sure it's not sync
wait where do you live
like your country
im brazilian. why do you ask?
It’s not
ah- the language you put in console.warn() i though your my country
does runJob return a promise?
If that returns a promise, you can do
.then(() => {})
annd that can fix the thing
i think it returns a pinky promise
is that ur vs code
just a number which is the id of the running job
neovide
yeah, i used to, but i switched and actually prefer it now
im havving issues with typescript code intellisense being super slow
Bro tryna rep it like it doesn’t run slow as shit for him 😭
vs code lowkey buns
its literally only typescript
like NOTHING else
im gnna check javascript
yep only typescript
what the freak
i restarted my pc like a month ago so i barely have anything on vs code
uuid generator, live server, blockception, git and snowstorm
wherer do i get minimal lsp from
as you use vscode it probably have installed ts or js by default
language server is build in
but nodeJS is not installed or any other runtimes
there is node maybe running under the vscode but not usable
its just so weird
i disabled git temporarily and its not that
all extensions as well
bros gonna start using grep only
does mattern how new the PC is
i might be out of context what exactly?
how what about ram? how much does the computer have?
my code intellisense is super slow on typescript
16gb of ddr5
but it just started happening 2 days ago
damn, how slow? Do you have like vid?
it takes around 5-10 seconds for errors to pop up/go away or to load types
the startup is alyways slwoer then its ok when you wait it loads
of not then you better reinstall VSCode or something
tried that too 😭
hmmmm
is there a way to force close chat, for like sending form menu to player
Send me a screen shot in general and let me check if there is something sus or not
wait im dumb
so the typings are sometimes fast
most of the time slow
and then u see the error pop up like 5 whole seconds after
How big is your workspace?
not big at all
nope
try loading only that folder with single proejct so we are sure its not related to it
what packages did you install? when i work with rust it starts slowing down when i have 100+ dependencies
just the minecraft ones
and as we are talking about the node modules rabbit hole, its not unusual to js require 300+ dependencies only for ts
minecraft ui and whatever the other one is
and when i remove that line thats error'd the error stays there for like 5 more seconds 😭
yea really weird
create folder on desktop and add TS file there and thry how fast it would be
oh my okay
its the project thats slowing it down @valid ice
grr
doesn't make sense though
what do you have to slow it down that much
it might load parent folders that could have crazy numbers of libs installations
there could be option to disable some kind of this stuff
actually we do have some constant files that have like 8k lines in them just for item data
convert them to JS and add .d.ts
huh
it would prevent loading this file
I don't know how the data looks like so i can't really help you more
... don't do that...
not how it works anyway
i just need something that works 😭
have you tried opening the folder that the project is in instead of a single file?
are you using global typings?
and your task manager performance is fine?
yes
do you guys know how to implement hashmap? i need to map an object to another but from js maps based on the pointers
7% cpu 70% ram
how much ram do you have
16gb
yeah its very weird
its only that project too
like i did what con master said and created a ts file in a folder on my desktop and its fine
code intellisense is fine
is it on a different drive?
Maybe try deleting the project and redownloading it from GitHub?
could yeah
yeah dont think itd make any difference anyway
re clone
eh that's pointless
Just to see 
when did you open the project for the first time?
uhh like a few months ago
i guess
actually basically a month ago since i restarted my pc
on this pc?
yes
and it's only suddenly doing this?
yes it started happening 2 days ago
you tried just like restarting ur pc?
i am using ES2020 could that be a reason?
what is a ES
it is
it does works like that TSS loads only declaration file if its available
how does @gaunt salmon works?
- send a javascript or typescript file OR send code wrapped in three backquotes with js/ts in them (like in the image show)
- right click on your message or long hold on it.
- click apps then choose Debug script
- choose version of api
- wait
thanks
how
was trying to find the video
thx
sure
then npm intellisense
can someone install mc preview cuz I get 1000 Erros
*Errors
idk If I just get thatr
can I get feedback from anyone
I was just wondering if I should make right click to harvest similar to vein mine or just harvest one by one
right click what
vein mine should be optional ig. Maybe button combination like crouch + right click
custom crops compatibility?
if they have growth state
anyone wanna help me out in vc 😇
@gega do u think i should insert the item directly into the player's inventory or no
the harvest?
yes
maybe make that optional as well.
okay
more optional stuff the better honestly, player's opinions may differ ofc
that's true
I made it so that when you right click the air it while crouching, it will switch them odes
e.permutationToPlace = permutationToPlace.withState(BlockPermutation.resolve(playerEquipment.typeId,
{
[horzhalf]: horzState,
[blockStateHalf]: state
}));
return;
so this is giving me the error of expect 2 arguments but only recieving one
and the line that it says the error is at is the }));
which is weird
also here are what the variables are
const blockStateHalf = 'minecraft:cardinal_direction';
const horzhalf = 'cmd:horizontal_half'
const state = blockToCheck.permutation.getState(blockStateHalf);
const horzState = blockToCheck.permutation.getState(horzhalf)
If world.beforeEvents.playerPlaceBlock.subscribe((event) => { is still in the beta APIs what's the correct way currently?
What do you mean by correct?
Entirely depends, vanilla or custom block?
Sorry! So many things I'm not accounting for... Just general players placing vanilla blocks. I'm working on a basic claims plugin
You'll need to use BetaAPIs or PlayerInteractWithBlock(this should work?)
if you want to cancel block being placed without before event you can just set the block to air using after even
Ah right, so interact with a block fires when placing? Is that the block being placed on or the block itself?
I could but same issue, how do I detect the placement?
world.afterEvents.playerPlaceBlock.subscrbe()
the after event isn't in beta
[index.js] ran with error: [TypeError: cannot read property 'subscribe' of undefined at <anonymous> (chat.js:13)
there are some problem with chat send in 1.18.0?
chat send is in beta only
yep
k
block placer component don't trigger custom component?
It doesnt trigger beforePlace.
Known issue.
Does 2.0.0-beta mean it needs the experiment "beta APIs" enabled in the world?
Yes,
Alr ty
do you have a bee sat on your microphone? 🤣
i have a qus now if the player died but he have a keepOnDeath item do i can get this item using script or the system will rejecte because the player is died and there is not inventory to get?
I FOUND OUT WHY
for SOME reason there was like duplicated node modules in 3 or 4 folders
so i had like double the node modules in random folders and it was looping a whole bunch
Entity die event can get inventory still
I dont think there's exactly since the IDs are unique Soo someone can be long someone short.
is there any way i can edit padEnd to notice that unicode like this "\uE121" is 3 characters instead of 1?
No, make a custom function
padEnd() will take account the length even if its a whole Unicode.
but it takes account the length of § which is 2 instead of 1
Sorry I phrased it wrong.
That's what I don't know but someone had that same problem before....
is there anyway for me to exclude those in the inanimate family in this?
'''js
world.afterEvents.entityDie.subscribe((eventData) => {
try {
const deadEntity = eventData.deadEntity;
const damagingEntity = eventData.damageSource.damagingEntity;
const deadEntityId = deadEntity.typeId;
const deadEntityLocation = deadEntity.location;
const deadEntityDimension = deadEntity.dimension;
if (deadEntityId == 'minecraft:item') return;
if (Math.random() <= 0.01) switch (true) {
case (getDateRangeInfo(Date.now(), holiDates.christmas, { weeks: 2 }).isInRange): {
eventData.deadEntity.dimension.spawnItem(new ItemStack(`minecraft:apple`, 1), eventData.deadEntity.location)
'''
Might help you...
its fine ill just adjust my padEnd sizes a little
wait.
world.afterEvents.entityDie.subscribe(({ deadEntity, damageSource: { cause, damagingEntity, damagingProjectile } }) => {
const family = deadEntity.getComponent('type_family');
if (deadEntity.typeId === 'minecraft:player' || deadEntity.typeId === 'minecraft:item' || family.hasTypeFamily('inanimate')) return;
const { dimension: deadEntityDimension, location: deadEntityLocation, typeId: deadEntityTypeId } = deadEntity;
const now = Date.now();
const christmas = getDateRangeInfo(now, holiDates.christmas, { weeks: 2 });
if (Math.random() <= 0.01) {
if (christmas.isInRange) {
deadEntityDimension.spawnItem(new ItemStack('minecraft:apple', 1), deadEntityLocation);
}
}
});```
All you're doing in the switch is just true... Just make a statement
world.afterEvents.entityDie.subscribe((eventData) => {
try {
const deadEntity = eventData.deadEntity;
const damagingEntity = eventData.damageSource.damagingEntity;
const deadEntityId = deadEntity.typeId;
const deadEntityLocation = deadEntity.location;
const deadEntityDimension = deadEntity.dimension;
if (deadEntityId == 'minecraft:item') return;
if (Math.random() <= 0.01) switch (true) {
case (getDateRangeInfo(Date.now(), holiDates.christmas, { weeks: 2 }).isInRange): {
eventData.deadEntity.dimension.spawnItem(new ItemStack(`minecraft:apple`, 1), eventData.deadEntity.location)
};
case (getDateRangeInfo(Date.now(), holiDates.easter, { weeks: 2 }).isInRange): {
eventData.deadEntity.dimension.spawnItem(new ItemStack(`minecraft:gold_ingot`, 1), eventData.deadEntity.location)
};
case (getDateRangeInfo(Date.now(), holiDates.halloween, { weeks: 2 }).isInRange): {
eventData.deadEntity.dimension.spawnItem(new ItemStack(`minecraft:diamond`, 1), eventData.deadEntity.location)
};
}
}
catch { }
})
that wasnt the whole thing
redundancy.
don't directly do the getDateRangeInfo()
^
Looks what I did in Christmas
you want me to do that everytime for each season?
how is what i have right now, including all seasons not shorter
if (christmas.isInRange) {
deadEntityDimension.spawnItem(new ItemStack('minecraft:apple', 1), deadEntityLocation);
id do this part for each season?
What I can say here is redundancy, readability is not, why use eventData if you're already made a variable deadEntityDimension??
does anyone know why /particle is not working
huh?
i have a much harder time tryingto read what you wrote
Dimension.spawnParticle() or Player.spawnParticle()...
Then don't use it, just make a variable for Christmas.
i was just trying to add the exclusion of entities with the inanimate tag to what i already had
what?
okay wait some work
I repeated this twice... Don't do this...js case (getDateRangeInfo().isInRange) {} do thisjs const christmas = getDateRangeInfo(); case (christmas.isInRange) {}
also pls code block when sending scripts.
an i repeated all im looking for is how to add the exclusion of Inanimate entities to the dead entities
Formatting Your JSON Or JS Code
Please format your code as code-blocks! This makes the text monospaced, and has support for syntax highlighting.
JSON
```json
{
"example": 123
}
```
JavaScript
```js
console.log("Hello World");
```
The character used here is the backtick. This symbol is usually at the top left of your keyboard, occupying the tilde key (~). On mobile, it will be on the second or third page of symbols.
I guess you didn't actually read the script I gave huh?
damn.
i did but like i said. to me its hard to read
anyways... Again. js const family = deadEntity.getComponent('type_family'); if (family.hasTypeFamily('inanimate')) {}
damn.... Looks like I need to stop sending scripts.
thats really black and white thought, but thank you for your help !
world.afterEvents.entityDie.subscribe((event) {
const deadEntity = event.deadEntity;
const damageSource = event.damageSource;
const cause = damageSource.cause;
const damagingEntity = damageSource.damagingEntity;
const damagingProjectile = damageSource.damagingProjectile;
const family = deadEntity.getComponent('type_family');
if (deadEntity.typeId === 'minecraft:player' || deadEntity.typeId === 'minecraft:item' || family.hasTypeFamily('inanimate')) {
return;
}
const deadEntityDimension = deadEntity.dimension;
const deadEntityLocation = deadEntity.location;
const deadEntityTypeId = deadEntity.typeId;
const now = Date.now();
const christmas = getDateRangeInfo(now, holiDates.christmas, { weeks: 2 });
if (Math.random() <= 0.01) {
if (christmas.isInRange) {
deadEntityDimension.spawnItem(new ItemStack('minecraft:apple', 1), deadEntityLocation);
}
}
});
Now, don't tell me it's still hard to read because you might need glasses now lol....
that is easier, so if i was going to add the rest of the seasons id do this for each one right?
const christmas = getDateRangeInfo(now, holiDates.christmas, { weeks: 2 });
if (Math.random() <= 0.01) {
if (christmas.isInRange) {
deadEntityDimension.spawnItem(new ItemStack('minecraft:apple', 1), deadEntityLocation);
}
}
});
Yes.
const christmas = getDateRangeInfo(now, holiDates.christmas, { weeks: 2 });
const newYear = getDateRangeInfo(now, holiDates.newYear, { weeks: 2 });
if (Math.random() <= 0.01) {
if (christmas.isInRange) {
deadEntityDimension.spawnItem(new ItemStack('minecraft:apple', 1), deadEntityLocation);
} else if (newYear.isInRange) {
deadEntityDimension.spawnItem(new ItemStack('minecraft:apple', 1), deadEntityLocation);
}
}
});
thank you !
huh? if the typeid is player or item or has family inanimate stop the code so they would be ignored by script
How do i check if a player killed a someone using a ender crystal?
thank you for explaining
try checking the damagingEntity typeId.
and "minecraft:ender_crystal" ?
yeah, just double check in in game...
Well that's new
Ohh no your mc is broki...
yep might be
I tried in my mc both preview and stable and it works fine...
can u spawn totem_particle?
like my normal particles are okay
i cant spawn particles tho that's the issue
bruh no way
it was a resource pack
yeah... The explosion thingy?
better weather
yes i see them now
idk how better weather resource pack ruins all the other particles
Like no particles spawn?
Check if there's material folder
Just curious is there a material folder??
nah they just made the particles texture transparent lol
Help
You meant this?js e.permutationToPlace = BlockPermutation.resolve(playerEquipment.typeId, { [horzhalf]: horzState, [blockStateHalf]: state }); return;
Huh thanks
using with state and BlockPermutstion instance isn't valid. I meant combining them.
Ok good to know
{ weeks: 2 } How do i format the after part?
its doing just before
like how you did isInRange, instead we use direction === 'after'
const christmas = getDateRangeInfo(now, holiDates.christmas, { weeks: 2 });
if (Math.random() <= 0.01) {
if (christmas.direction === 'after') {
// ...
}
}
});
Or that wasn't your question?
Also, didn't I sent it yesterday the description of datas it returns?
thats what i was just doing, looking for that
lol
damn ok, so i have to do the whole if, else if. ect again for the after week
- isInRange: A boolean that is
trueif the two dates are within the specified time range (e.g., within 2 weeks). - direction: A string indicating whether
currentDateis'before','after', or'same'astargetDate. - isPast:
trueifcurrentDateis aftertargetDate. - isFuture:
trueifcurrentDateis beforetargetDate. - isSame:
trueif both dates are identical. - timeDifference: An object showing the difference in days, hours, minutes, seconds, and milliseconds.
the isInRange says it checks both? but it doesnt do both?
sorry, that description was confusing the way isInRange works it uses before and after date and compare BLA BLA.
Make a post.
thank you, i was doing weird things tryin to figure it out and it was definately not that lmao
i was like week:1><week:1
Lol no you just put values there for range how far before it counted, I already made your life easier with those properties.
i know that now lol, i got the afters in there now.
and that you did, thank you very much!!
JS uses UTF16 characters, so that unicode fits into one character, however, minecraft sotres stuff as UTF8 characters, since it's written in C++, and when you convert that utf16 character to utf8, it becomes a 3 character sequence.
i have a one liner which can get the right size after its converted
gimme a sec
const utf8_size = char_code <= 0x7f ? 1 : char_code <= 0x7ff ? 2 : char_code <= 0xffff ? 3 : 4```
So I changed Halloween time to 3 12. And I just realized the log is saying it's 3 hrs past 3 12
Where I'm at it's still april 11th. Where is it pulling the time from?
wait, you used Date.now()?
use new Date()
This is just in the script you gave me yesterday. The holiday script. It's the console log
Also using the drop script you gave me now too so if it says date.now it's because that's what you sent me lol
But nothing does day date.now
sometimes I forget things lol since I'm doing other stuff
try using new Date...
Oh wait. One does say date.now
But regardless that is not what it sending the log
It's the console.error log you set up in the holiday. That is a different script and that is new Date. Already
I changed the holiday date for Halloween to 3, 12 to check something and the log came back at whatever time zone it has its already the 13th.
you're starting to make me confuse...
This
const holiDates = {
easter: new Date(2000, 3, 20),
festive: new Date(2000, 3, 6),
halloween: new Date(2000, 3, 12),
summer: new Date(2000, 7, 4),
};
const now = new Date();
console.error('Christmas info:', JSON.stringify(getDateRangeInfo(now, holiDates.festive, { days: 1 })));
console.error('Halloween info:', JSON.stringify(getDateRangeInfo(now, holiDates.halloween, { weeks: 2 })));
console.error('Today info:', JSON.stringify(getDateRangeInfo(now, now, { days: 3 })));
I used the original one and it works fine. With me...
there is nothing wrong with it, other then im trying to figure out what timezone the game is using lmao
because whatever that time zone is, its the 13th already
its not going off my timezone
hey can you log something.js console.log(new Date().getTimezoneOffset());
yes cause now im confused lol,
maybe im missing something cause that didnt send anything back
change log to error mbmb
all good, i should of seen it as well. literally put it under 3 of them that say error
says 0
ill just set all my holidays to 2 days after the holiday then
im not trying to add a config for people to set their offset
@thorn flicker are these settings enough?
is the video just a black screen or is it jus me
Restart your discord... That's client side.
I did and its still black
I don't think so
Base scripts run when reload is fired, but also when the world is loaded
how to fix this?
how do i make a button appear here ONLY for people with a certain Tag
if (player.hasTag("some_tag")) form.button("")
also you have to include this when you're handling a response from form
this goes before the responce.selection aswell?
before you're showing a form to a player and handling the response
okay ill mess around w it i just started js like 2 days ago
have a nice one then
you cns try to sue this as reference
const form = new ActionFormData().title('test');
const buttons = [
{ name: 'warp', texture: 'textures/ui/' } // Always shown button with texture
];
// Add conditional buttons with their textures
if (player.hasTag('shop')) buttons.push({ name: 'shop', texture: 'textures/ui/' });
if (player.hasTag('sell')) buttons.push({ name: 'sell', texture: 'textures/ui/' });
if (player.hasTag('invite')) buttons.push({ name: 'invite', texture: 'textures/ui/' });
// Add all buttons to the form
for (const btn of buttons) form.button(btn.name, btn.texture);
form.show(player).then(({ selection, canceled }) => {
if (canceled) return;
const choice = buttons[selection].name; // Get the button name from the array
if (choice === 'warp') {}
else if (choice === 'shop') {}
else if (choice === 'sell') {}
else if (choice === 'invite') {}
});```
@dim tuskthanks this helped
whats current scriptapi version, cuz mc got updated
what happened to .runCommandAsync
removed in 2.0.0-beta
o
are the custom command builders on ly avcailable in preview
or are they in 1.21.70
How is setPropertyOverrideForEntity used?
preview
it's runCommand right now
How to get the repawn point of a player?
You basically set a property of an entity to a certain value for only the player you have chosen. The property has to be client synced
So Player A can change the value of a creeper to make it blue only to them?
Player B still sees a regular creeper?
Can it be applied to player properties?
https://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server.Player.html#getspawnpoint
this returns DimensionLocation
interface DimensionLocation {
dimension: Dimension;
x: number;
y: number;
z: number;
}```
i have no idea why the coordinates are deconstructed
no like the vscode theme
is the Date on script accurate enough on realtime
if you mean Date Constructor it is.
and it's the only way to get realtime.
(unless you use bds and http request)
got it thanks
one last thing
how to get the Entity (which is Player constructor) by using provided playerName? since playerJoin event returns playerName and playerId
or can i just use the playerId instead to get the Player
why? Just use playerSpawn and initialSpawn property
initialSpawn is when a player joins. It's the first time the player spawns into the world
okay thanks
it's better tbh
Sorry to bother,
It gets unbearable laggy with the time running, would changing it to do seconds or min range instead of milliseconds fix that or is going to run that frequently regardless?
Dont keep checking time every tick, asd delay like 40 ticks delay or more.
Id it's runtInterval
How do I add a delay because I'm not doing anything to check the time?
Loading in it does it and then randomly there's a terrible stutter
system.runInterval/runTimeout
Is that just going to make it where it stutters on a timer basically?
Loading in is pretty bad. I'm assuming it's going to do that Everytime regardless on the timeout.
Thank you
Yeah
I cant see the video.
its just a grey screen, even when I download it
try a different format
@humble lintel its great
there's going to be a new tooltip option for modal forms in the future btw
you'll be able to hover a little icon that shows a description of an option, which will be way neater.
it's not on stable yet
it's already in-game for preview version
thats why I said in the future.
but it already exists in the game, it's not for stable yet
what I said is still valid, not everyone wants to have their addons running on preview.
preview is a good way to test new features in their add-ons
😐
it already exists in the preview, so how it's valid?
you are one of those huh
Because it can always be removed.
we know that it won't be removed
Until it becomes stable, it will always be coming soon™️
why they would even remove it?
Thats what we thought with HCF.
Anyways, not going to argue woth strangers on the internet. 🙂 You should know what VoidCell means by "in the future"
arguing for no good reason at all
it forced developers to migrate their add-ons to scripting API
the migration made Mojang developers easier to maintain new updates for creators I think
XD I would have thought you would know better now. The scripting channels are always like this.
I should've remembered this
you are right
lol
@humble lintel
maybe you can make it per-player? Maybe other players want different options.
Unless you did that already, if so nvm.
and if the host of the world does not want that, make it so they can override it in an admin version of the menu.
it didn't
you would be surprised of the amount of outdated add-ons that used to use HCF
lmao fr
🤯 Which proves my point.
A lot of HCF functuonality people thought would be coming in the future didnt!
lol
we have changed our topic to a HCF
tell me why they would remove a tooltip for modal form data components?
The itemStack.getComponent('minecraft:cooldown') returns a number or bool?
https://stirante.com/script/server/1.18.0/classes/ItemCooldownComponent.html
-# I like this site better
Documentation for @minecraft/server
Thanks
Someone have the spawner like donut smp addon
is there a way to open shulker in hand?
U could make a script where it show u a chest ui with the inventory of the skulker
Shulker
Ik but how to get shulker inventory
place it using dispenser
needs to be placed to be able to access it.
your status made me giggle thanks buddy
hi there, do someone used the camera to set a kind of security camera? javascript innerTV.camera.setCamera("minecraft:free", { offsetFromTargetCenter: testloc, targetEntity: target });
shouldn't it track the target? the camera is placed but it doesn't follow
You need to put it on a loop.
To my knowledge.
how can I change the scale of an entity bc the value is now read only
component group
yeah thats the issue
[Scripting][error]-TypeError: 'value' is read-only at <anonymous> (script/minigames/map_3.js:93)
Try lower script api version
If i put a while inside system.run it will loop until while be false?
Yeah.
True?
whats the playerDie event?
entityDie.
okay
since worldInitialize and itemComponentRegistry are deprecated, what do you use now?
system.beforeEvent.startup
can i ask about this 2 too?
aftertEvent world Initialize and playerSpawn.suscribe
startUp is only as a beforeEvent, as for playerSpawn idk why its suscribe in specific is deprecated
Use worldLoad, playerSpawn isn't deprecated.
then why os it marked like it is?
The I variant is deprecated. It inherits the normal PlayerSpawn event.
I variant?
would yall know how to get the default gamemode set for a world from within the script api?
How do i add script events to open up my guis
IPlayerSpawnAfterEventSignal > PlayerSpawnAfterEventSignal
not possible
a form?
yes
import { world, system, ItemStack, Player } from '@minecraft/server';
import { ActionFormData } from '@minecraft/server-ui';
system.afterEvents.scriptEventReceive.subscribe((event) => {
const { id, message, sourceEntity } = event
if (sourceEntity instanceof Player) {
new ActionFormData()
.title("Special Offer!")
.body("Do you want a free diamond?")
.button("Yes!")
.button("No")
.show(sourceEntity)
.then(({ selection }) => {
if (selection !== 0) return;
sourceEntity.getComponent("minecraft:inventory")?.container?.addItem(new ItemStack("minecraft:diamond", 1));
sourceEntity.sendMessage("You received a free diamond!");
})
}
})
so if i changed event to
"ticket" it would open
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/playerspawnaftereventsignal?view=minecraft-bedrock-stable
is this being removed?
No.
wdym
the methods in it are missing
I wanna Check what .subscribe provides to callbacks
What are you seeing?
I see
this is better
thanks
Damn. Thanks tho
why the blocks don't get cloned???
import { world, system, ItemStack, Player } from '@minecraft/server';
import { ActionFormData } from '@minecraft/server-ui';
system.afterEvents.scriptEventReceive.subscribe((event) => {
const { id, message, sourceEntity } = ticket
if (sourceEntity instanceof Player) {
new ActionFormData()
.title("Special Offer!")
.body("Do you want a free diamond?")
.button("Yes!")
.button("No")
.show(sourceEntity)
.then(({ selection }) => {
if (selection !== 0) return;
sourceEntity.getComponent("minecraft:inventory")?.container?.addItem(new ItemStack("minecraft:diamond", 1));
sourceEntity.sendMessage("You received a free diamond!");
})
}
})
@distant tulip
what are you trying to do
stop tagging him men...
opp 🙏
also, just do```js
if (id === 'from:open') {
}```
you think it's not annoying? Chill out in tags
why is this not working, its not cloning the thing:
if (!arenaPos1 || !arenaPos2) return null;
if (arenaClones.length >= MAX_ARENAS) return null;
const index = arenaClones.length;
const sorted = getSortedPositions(arenaPos1, arenaPos2);
const width = sorted.to.x - sorted.from.x + 1;
const height = sorted.to.y - sorted.from.y + 1;
const length = sorted.to.z - sorted.from.z + 1;
const xOffset = (width + arenaSpacing) * index;
const targetStart = {
x: arenaBase.x + xOffset,
y: arenaBase.y,
z: arenaBase.z
};
const cloneCommand = `clone ${sorted.from.x} ${sorted.from.y} ${sorted.from.z} ${sorted.to.x} ${sorted.to.y} ${sorted.to.z} ${targetStart.x} ${targetStart.y} ${targetStart.z} replace`;
world.getDimension("overworld").runCommand(cloneCommand);
const arena = {
index,
start: targetStart,
end: {
x: targetStart.x + width - 1,
y: targetStart.y + height - 1,
z: targetStart.z + length - 1
},
p1: null,
p2: null,
spawn1: null,
spawn2: null
};
arenaClones.push(arena);
return arena;```
Hello, how can I create a manifest.json file in a script manner?
oh should I do: world.getDimension("overworld").runCommand(`${cloneCommand}`);
if(event.id !== "form:open") return
you can generate manifest but converting it as a file isn't possible...
try logging like do console.error() stuff
okay
I searched online but which manifest.json generator should I use Do you have any recommendations
everything is working but not cloning
-# not trying to advertise
thanks
Wait this is good
Yes, this is very good.
really? Damn thank you, that's kinda old project and I can't see someone using it so I don't really advertise it...
how would i add that to the ui tho
to the ui?
-# psst. dark mode
-# not my problem, just enable force dark in your phone.... Lol, tho I might actually add it later
so there is no way to replicate in API the command "camera @s set minecraft:free facing targerName"?
because this command is executed once and it tracks the target
use runtInterval.
import { world } from "@minecraft/server";
function showMainForm(player) {
if(event.id !== "form:open") return
const form = new ActionFormData()
.title("Choose an option please")
.button("Names")
.button("Ranks")
.button("Clans")
.button("Cancel");
is this it?
yes, the code is not finished tho
I know, it would be the same as looping it, I thought the cameras on API had the same behavior as the commands
thats just part of my ui
but my ui activates with an item
but i'd also like it to activate with script event
@dim tusk
is this right?
how would i do /scriptevent to open this
am I able to load something before a script reloads
I want to disable players to be visible when then they are visible in XRAY
is there a way to make them visible only if a player is looking at it
like line of sight based rendering
Why do you use ? After get component and container?
It's called the optional chaining operator. It safely accesses deeply nested properties without throwing an error if one of the properties in the chain is undefined or null.
Then, use it after getComponent its a good habit ?
Whether or not you use it is purely personal preference. It doesn't necessarily mean your code is better with or without the logic.
Hmmm
Thanks
it is best used in places where you are not sure if the returned result is defined or not
Thanks
And...
Why this
world.beforeEvents.itemUse.subscribe(ev => {
system.run(() => {
equip(ev.source, ev.itemStack, ev.cancel, ev.itemStack.getComponent('minecraft:cooldown').cooldownTicks(ev.source))
})
})
Its sendig this error
[Scripting][error]-TypeError: not a function at <anonymous> (activation.js:54)
cooldownTicks is not a function
it is a number
use getCooldownTicksRemaining
link?
I think
there is not a single use of the cooldown component in the wiki
Sorry, i checked and i was wrong
I think that i need some good sleep hours
tf does it mean "Expected 4"
the docs you are looking at don't match you version
Is there a version switcher other than the one that toggles between stable and experimental?
Do we have a way of making text displays that doesnt use a custom entity?
Use amror stand or smaller entity.
Make an animation scaling them into 0
Play them using playerAnimation()
On setTimeOut uses ticks or seconds?
that don't exist, you meant runTimeout()?
And it uses ticks.
setTimeout() uses milliseconds tho it doesn't exist in Minecraft script API.
:0
Its like a timer?
things will happen after that time.
how do you import in 2.0.0-beta?
the import of the imports
import {world, system} from "@minecraft/server";```
thats it
Idk what did he meant by Import
what units is getVelocity in?
how can i offset the player's camera when riding an entity?
How does setDynamicProperties work?
wha-
today's not april fool day
setDynamicProperties( values: Record<string, string | number | boolean | Vector3>, )
the guy who made a whole database ask that how does setDynamicProperties work hmmmm.
setDynamicProperties({ 'name': value, 'name': name })
i think this is how
better to use this in typescript that way you can define them
i just didnt know what record means
i used setDynamicProperty but not properties
you mean like setProperty?
figured this out, must be in a loop
player.camera.setCamera(MinecraftCameraPresetsTypes.FollowOrbit, {
location: {
x: plyrLoc.x,
y: plyrLoc.y * viewDir.y,
z: plyrLoc.z
},
viewOffset: {
x: 0,
y: -10,
}
});
no i mean that multiple dynamic properties needs an object
setDynamicProperties({
key:value,
ket:value
})
and single dynamic property doesnt
setDynamicProperty(key,value)
oh okay
if (player.hasTag("2xSell")) {
addScore (player, "Coins", totalAmount * 2)
}
else addScore (player, "Coins", totalAmount)
return totalAmount
``` any ideas on why this dont work?
im missing a lot of context here...
everything else had worked untill i added the x2 thing
this should be self explanitory
still missing context
like what
did you get any content log
addScore(player, "Coins", totalAmount * (player.hasTag("2xSell") ? 2 : 1))
return totalAmount
if you'll have more tags like {x}xsell in the future, consider using:
const highestSellMultiplier = player.getTags().filter((tag) => /^\d+xSell$/.test(tag))?.map((tag) => +tag.split("x")[0])?.sort((a, b) => b - a) || 1
addScore(player, "Coins", totalAmount * highestSellMultiplier)
return totalAmount
I can't use await wait(5) in functions
```commandManager.addCommand("ui-builder", {description: "Open UI menu", category: "Open", format: ${commandManager.prefix}ui-builder}, ({msg,args})=>{
let plr
openUIBuilderMenu(plr)
})```
wait is function made by e
*me
nvm
does the onRandomTick requires the onTick component?
my copper pot is using the onTick component to do somethings, but i need to make it get exposed or weathered like vanilla copper
mob.villager.yes and mob.villager.no
how do I use typeId?
player.nameTag = "value" sets a nametag of player right
thanks

