#Script API General

1 messages · Page 47 of 1

untold magnet
#

system.run(() => {eBlock?.withState('exe:rotation', rotation)})?

cold grove
#

You can use particles and molangVariableMaps for the pieces, just an idea flashitoGGlub

distant tulip
#

💀

#

how many lines are those

untold magnet
dim tusk
#

this is how you use it

dim tusk
#

Anyways here it is. Kinda confusing since there's no pieces yet but I added the logging in the top right... @chilly fractal

sage sparrow
#

hi there, so I have some nametag system that used to work just fine, but recently I noticed that after a player dies the nametag shows up like so:
any ideia what could cause that? that might be related to the new death screen?

mystic bluff
mystic bluff
distant tulip
sage sparrow
#

yes

#

I think this is the position when it is set to a dead body

#

but it remains after respawn for some reason

distant tulip
#

did you edit the entity file?

#

the nametag is position is relative to the entity collision box

cold grove
#

wanna see the progress, so interested 👀

untold magnet
dim tusk
grizzled storm
#

Oum hi everyone if you don't mind, is it possible to make an Custom fishing rod using Script API?and have the function of a normal fishing rod?
I'm a bit curious since I'm trying to make a custom fishing rod for an addon I'm working

grizzled storm
untold magnet
dim tusk
#

@valid ice yours is closed source?

grizzled storm
untold magnet
#

i know, the custom rope that is connected to the player is a thing on bedrock, u can make it but idk how exactly

grizzled storm
# untold magnet use a small system that will take 1 durability from the item if needed and chang...

// Handle item durability damage
function damageRod(player, item) {
const durability = item.getComponent("minecraft:durability");
if (durability) {
durability.damage(1); // Reduce durability by 1

    // If rod is broken, remove it from inventory
    if (durability.damage >= durability.maxDurability) {
        player.getComponent("minecraft:inventory").container.removeItem(item);
        player.sendMessage("Your fishing rod broke!");
    }
}

}

sick robin
#

@dim tusk can you help again with my post?

#

@untold magnet any chance you can help with my script api post

dim tusk
sick robin
#

@dim tusk here: 1323484880763490374 its that thread id I have one open

dim tusk
deep arrow
#

Its that

sick robin
#

@deep arrow yes thats it

deep arrow
#

more people needa code in typescript imo

dim tusk
deep arrow
dull shell
#

anyway to detect a players movement speed?

#

and tie it to a scoreboard

tawny jungle
#

how can I set an item slot to a quantity of one on an entity that isn't the player?

#

ive tried this but nothing seems to happen

const entity = block.dimension.spawnEntity("sci:mBContainer", block.location)
const entitySlot = entity.getComponent("inventory").container;
const book = entitySlot.addItem(playerMainHandSlot)
entitySlot.amount = 1```
chilly fractal
#

You can set it to any number (from 0 to 35) i think. [Btw entities dont have main hand slots]

shell sigil
#

Guys do you know about Mojang update that items have colors now that indicates how it's rare so is there any in script that can detect how rare I'm holding

chilly fractal
#

Make a map of all the items yourself

#

And this won't know rarity of custom items too.

shell sigil
#

Ohhh ok

dense sun
#

are there any optimisation techniques i could use for those users who face high ping in servers?

#

using script api i could pre activate a function

#

For example melee attacks

#

Higher ping gives more damage

slow walrus
chilly fractal
quick shoal
#

Wth is this

distant tulip
quick shoal
#

LoL I think it's real

empty grail
#

entity property,

use q.property in animation to set the legs animaton/position(if it possible)

use scriptApi to set the property

idk if there any scoreboard query

distant tulip
#

scoreboard query only work if it is displayed

shut citrus
#

bedrock system goal need to be simple and powerful

empty grail
shut citrus
#

it's easier than that thing

empty grail
empty grail
#

well then congrats

shut citrus
#

nope

#

i cancelled the mods

slow walrus
hushed ravine
#

How do I create a wall of blocks in all directions (starting from the center) without replacing any block?

distant tulip
#

"how do i place a bock without placing a block" is what i understood from your question

hushed ravine
#

Damn

hushed ravine
# hushed ravine Damn

I'm trying to find ways to just place a border made of blocks without collision box. I would use this to show players what's the actual safe zone

distant tulip
#

use particles
blocks are not a good idea

thorn flicker
#

yeah

hushed ravine
#

I used a bunch of border block particles iirc

distant tulip
#

or this if you want to use blocks, just make sure to use filter and remove the up and down planes

hushed ravine
distant tulip
#

same with blocks?

hushed ravine
thorn flicker
#

maybe you didn't do something correctly, because that's weird.

hushed ravine
thorn flicker
#

I doubt I would be able to help

hushed ravine
#

[tasks/player.ts]

  if (border.condition) {
    showBorderParticles(p, 20);
    p.applyDamage(2);
    p.onScreenDisplay.setActionBar(
      "§cYou're in the border. §eYou will die if you don't go back!",
    );
    return;
  }

  if (border.closeTo) {
    showBorderParticles(p, 8);
    p.onScreenDisplay.setActionBar(
      "§6You're close to the border! Going further will end your game.",
    );
    return;
  }

[index.ts]

export function showBorderParticles(player: server.Player, frequency: number = 2) {
  for (let i = 0; i < frequency; i++) {
    let position = {
      x: Math.floor(Math.random() * 5) - 2,
      y: Math.floor(Math.random() * 5) - 2,
      z: Math.floor(Math.random() * 5) - 2,
    };
    server.world
      .getDimension(MinecraftDimensionTypes.Overworld)
      .runCommand(
        "execute as " +
        player.name +
        " at @s run particle minecraft:rising_border_dust_particle " +
        `~${position.x} ~${position.y} ~${position.z}`,
      );
  }
}
thorn flicker
#

well, you shouldn't use commands

hushed ravine
#

I used to, though

#

(which is bad)

distant tulip
#

i may look into this later, no promise tho

hushed ravine
#

Alright!!

#

Also, why the hell did I use an execute as command if I could've just ran the command as the player

thorn flicker
#

but you used a command for the other part

hushed ravine
thorn flicker
#

lol

hushed ravine
#

We're talking about 2023

thorn flicker
#

well... was it actually? how long ago was this
when was spawnParticle added?

distant tulip
#

commands do spawn particles outside loaded area, right?

thorn flicker
hushed ravine
distant tulip
hushed ravine
#

Terrible Script API coder back then

thorn flicker
#

nahhh

hushed ravine
#

I would ask a bunch of questions here in this thread

#

Now I either do the stuff myself

#

Or, if I ask any question, I may solve it myself somehow

thorn flicker
#

you just needed to look at documents more and you should've been fine

#

assuming it was well documented

empty grail
#

anyone know how to convert block into color?

empty grail
thorn flicker
distant tulip
#

we all were terrible at it in some point

hushed ravine
empty grail
distant tulip
thorn flicker
#

we can get map color?

#

cool

hushed ravine
#

That's amazing

distant tulip
#

yeah

empty grail
#

oh that's amazing

thorn flicker
#

that wont always be accurate when it comes to custom blocks though.

#

not all devs define map color component...

distant tulip
#

yeah

hushed ravine
#

Unrelated, but are minimaps even possible on Bedrock?

thorn flicker
#

both were EH

empty grail
empty grail
hushed ravine
#

Dang

empty grail
#

maybe someone will make it

hushed ravine
#

Impressive stuff overall

thorn flicker
#

1 guy used json ui and loaded a structure into it

#

I think

empty grail
#

yeah using structure 3d renderer it's possible

thorn flicker
#

Im assuming they kept updating the structure every tick with scripts

thorn flicker
#

idk how performant that is though

#

probably not good...

empty grail
#

using just resource pack is impresive tho

#

oh yeah and structure renderer doesnt have to reloaded everytime isnt it

empty grail
#

typo

thorn flicker
#

oh, reloaded

hushed ravine
#

How do I use block volumes?

hushed ravine
thorn flicker
hushed ravine
thorn flicker
#

its already imported...

empty grail
thorn flicker
#

here

empty grail
#

i think it's just parameter?

hushed ravine
#

Thank you!!

#

That makes sense

empty grail
#

suprise in me it doesnt work

empty grail
#

and it's work

hushed ravine
#

I prefer doing it the right way tbh

hushed ravine
#

This doesn't really work with big distances

meager cargo
#
world.afterEvents.playerInteractWithEntity.subscribe(eventData => {
    const player = eventData.player;
    const entity = eventData.target;

    if (entity.typeId !== "test:test" || player.typeId !== "minecraft:player") return; {

        entity.runCommand("particle minecraft:huge_explosion_emitter ~ ~ ~");
        system.runTimeout(() => {
            entity.remove()
        }, 40);
    }    
});

How I can make in this script so player can Interact only one time with the entity? Because now I can Interact with it till it's removed, so if I spam button I can do it like 6 times, which is wrong.

hushed ravine
#

Whenever I use the getSurfaceBlocks method with large distances (50 for example), it will just spit out this error

#

I don't really know how to solve it

dim tusk
distant tulip
dim tusk
distant tulip
#

no
it is just a loop that get colors and pass them to particle
no additional stuff

dim tusk
distant tulip
#

20x20 map

dim tusk
#

I want 3d particles

#

Rahhh

hushed ravine
remote oyster
# hushed ravine Yeah, but how?

If you are looking to generate a border, which is what it appears to be in your image, then you could have it create the border as players come near it. This way the chunks are loaded prior to accessing the general location.

hushed ravine
#

Player have to clearly see the border. It can't just pop in like nothing

remote oyster
#

I believe the effect won't be much different as your rendering distance when you move about, but it will likely depend on how close you want them to be before you generate it.

#

@hot gust, I believe you already do something like this so maybe you can clarify.

hot gust
#

yes

#

i have a custom particle

#

then im trying to find the code

#

its a fair amount of code but creates a border lines within the world

#
// Visual Border system configuration
let worldSpawn = { x: 0, y: 64, z: 0 }; // Center of the world border
const particleEffectName = "paradox:worldborderviz";
const maxDistance = 44; // Max distance from player to spawn particles to ensure chunks are loaded
const maxParticles = 500; // Maximum number of particles to spawn
const particleLifetime = 3.5; // Lifetime of particles in seconds
const ticksPerSecond = 20; // Minecraft runs at 20 ticks per second
const spawnInterval = particleLifetime * ticksPerSecond; // Interval to spawn particles in ticks

let tickCounter = 2; // Initialize the counter
#
// Function to calculate positions for a line along the x or z axis at the world border
function calculateBorderLinePositions(borderNumber, axis, start, length, y) {
    let positions = [];
    if (axis === 'x') {
        for (let i = -length; i <= length; i++) {
            positions.push({ x: borderNumber, y: y, z: start + i });
        }
    } else if (axis === 'z') {
        for (let i = -length; i <= length; i++) {
            positions.push({ x: start + i, y: y, z: borderNumber });
        }
    }
    return positions;
}```
#
function filterPositions(playerPos, positions, maxDistance) {
    return positions.filter(position => {
        let distance = Math.sqrt(Math.pow(position.x - playerPos.x, 2) + Math.pow(position.z - playerPos.z, 2));
        return distance <= maxDistance;
    });
}```
#
    let spawned = 0;
    for (let position of positions) {
        if (spawned >= maxParticles) break;
        // Convert coordinates to integers
        let intX = Math.floor(position.x);
        let intY = Math.floor(position.y);
        let intZ = Math.floor(position.z);
        // Spawn the particle at integer coordinates
        world.getDimension(dimension).spawnParticle(effectName, { x: intX, y: intY, z: intZ });
        spawned++;
    }
}
#
    tickCounter++; // Increment the tick counter
    let worldBorderNumber = border
    if (tickCounter == 3) {
        const playerPosition = player.location;
        
        
        
        const worldBorderNumbers = [border, -border]; // Array to store both positive and negative border numbers

        // Check if player is near the x or z border number
        let particlePositions = [];
        for (let worldBorderNumber of worldBorderNumbers) {
            if (Math.abs(playerPosition.x - worldBorderNumber) < maxDistance) {
                particlePositions = particlePositions.concat(calculateBorderLinePositions(worldBorderNumber, 'x', playerPosition.z, 50, playerPosition.y));
            }
            if (Math.abs(playerPosition.z - worldBorderNumber) < maxDistance) {
                particlePositions = particlePositions.concat(calculateBorderLinePositions(worldBorderNumber, 'z', playerPosition.x, 50, playerPosition.y));
            }
        }

        // Filter the positions to those within a reasonable range of the player
        let filteredPositions = filterPositions(playerPosition, particlePositions, maxDistance);
        let currentDim = dimension;

        // Spawn a limited number of particles at the filtered positions
        spawnParticlesAtPositions(particleEffectName, filteredPositions, maxParticles,currentDim);

        tickCounter = 0; // Reset the counter after spawning particles
    }
}
#

then on a tick script i used the older paradox world border to do all this

#
if(player.dimension.id === "minecraft:overworld"){
    let dim = "minecraft:overworld"
updateParticlePositions(player,worldBorderOverworldNumber,dim);
}
if(player.dimension.id === "minecraft:nether"){
updateParticlePositions(player,worldBorderNetherNumber,player.dimension.id);
}
if(player.dimension.id === "minecraft:the_end"){
updateParticlePositions(player,worldBorderEndNumber),player.dimension.id;
}```
#

sorry for the spam lol

past blaze
#

I find it really, really, really stupid that the typeof null equals object. object!

#

why JS 🤦‍♂️

buoyant canopy
#

everything in an object

quick shoal
#

Happy new year!

sharp elbow
#

It's not that bad. You can add && param != null

distant tulip
hardy tusk
sharp elbow
#

One explanation I saw on StackOverflow suggested that null is equivalent to a null pointer. Following the expectation that pointers in a program's memory are almost always used to point to objects, then it makes sense that typeof null == 'object'

#

(In that a variable can either be assigned to a pointer of a given object type, or to null, the latter of which is intended to mean uninitialized or unspecified memory)

#

I suppose it would be more sensical if JavaScript had a more stringent type system. Then typeof in its current form would be completely irrelevant, and thus this problem would not exist, since there would be no need for an object-like type comparison—only a "is this an X (class)" comparison

hardy tusk
#

I mean you always just use Object instanceof Class

warm drum
#

is there a way to spawn entity with custom variant

wary edge
warm drum
thorn flicker
#

wouldnt be worth it imo

sage portal
#

Huh.
For some reason I thought script API could edit variants by now

#

I wouldn't know because I've just been using entity properties.

acoustic basin
#

hey guys! i need quite some help with optimizing my add-on

#

i won't be saying a lot at first, i'll go step by step, i first tried to do something myself, but i need some help now

#

firstly, and i think mostly, i had quite some system.runIntervals all around the add-on, and all the intervals that matched the same time (in ticks), i merged them in one bug script, hoping that it would stop the "hang" crash, but, ik, its not just runIntervals, it's much more, and im working on it

#

im changing a lot of scripts, removing a lot of unnecesary stuff (to be more specific, changing the stuff that i made when i didnt know scripting so well, changing all this stuff to the better, imporoved systems)

#

so, firstly, im looking for some help to stabilize these system.runInterval even more

#

maybe there's some kind of, a lil bit more optimized, alternative to it?

#

im still learning scripts, thought, im much better at them now, but i still need help, especially with optimization, anybody willing to help me out?

thorn flicker
#

lol

chilly fractal
#

Firstly

#

Any looping through arrays turn it into:

let array = /*value, comment out this line if you already have the array, but for example if you are looping through players then put `world.getPlayers()` here*/;
for (let i = 0; i < array.length; i++) {
  let element = array[i];
}```
acoustic basin
chilly fractal
#

Secondly, put the functionality in a function and call it there

#

Kk

acoustic basin
chilly fractal
#

Anyway, secondly, turn any functionality you have in loops into a function outside that loop and call it from there, for example:

system.runInterval(() => {
  // some functionality
});

Should be:

function loop() {
  // functionality
}

system.runInterval(loop);
#

Also avoid objects as much as humanely possible unless you have the indexes, for example if you have an object with each player's health for example (for example, don't actually do this lmao) and you have their id as the key, then sure you can use objects in this case, this is to avoid the Object.keys() & Object.values() & Object.entries() calls

distant tulip
acoustic basin
#

like, firstly with intervals

chilly fractal
acoustic basin
#

its late for me, my brain isnt quite braining, but its starting to brain

#

im trying to understand and i do

dim tusk
chilly fractal
#

Also if you use a variable or a function or whatever more than once, and remember this, make sure to cache it the first time and use the cached value from there. But this is completely useless if you are accessing something like system.currentTick and you want the current tick (someone asked about this a long time ago, they asked what is more performant, storing the current tick in a variable and then updating it everything or just using it instantly, and ofc the answer is to just get the property using system.currentTick, but the only use case for caching the current tick is to know when a certain event finished for timed operations).

chilly fractal
slim forum
#

Exist a way to save data on an item without cancel my use animation? (Sorry for my bad english, Im not english native speaker)

slim forum
chilly fractal
#

So then what is the problem?

slim forum
#

Im using dynamic properties

dim tusk
#

and you're correct when just checking the time cache but the actual time of the world? Why the fuck put it on the variable

slim forum
#

But, to save, we need to reset item

#

So...

dim tusk
chilly fractal
slim forum
#

When reset, the using animation glitchs

chilly fractal
#

Lock the item and make it not lost on death and hide that by turning off the showTags gamerule

acoustic basin
dim tusk
#

Hey neight!

acoustic basin
#

i'll also show the script i have

chilly fractal
#

I should go now. I still am working on the website :(

dim tusk
#

Uhuh

chilly fractal
#

I am tryna finish the big update before new years eve

dim tusk
#

me who is literally not done with my chess

chilly fractal
dim tusk
#

I literally attach an external keyboard and mouse on my phone

#

Since it's hard to constantly duplicate an object

chilly fractal
chilly fractal
steady canopy
steady canopy
#

If you were to give good programming advices at least make sure they are. Those are just your ways to do such stuff, not the correct way.

chilly fractal
#

Ohhh

dim tusk
steady canopy
#

I usually help with code snippets here

#

but explaining someone how to code

chilly fractal
#

Then zip it until you have time to provide help.

steady canopy
#

No

#

Don't get mad bud

#

It is what it is

chilly fractal
#

Then you are just attacking, not providing real help.

steady canopy
#

you're a blind trying to lead a blind

dim tusk
#

NO FUCKIN FIGHTING.... GOSH

steady canopy
#

i'm not complaining

chilly fractal
steady canopy
#

I'm TELLING that you shouldn't try to help a beginner being a beginner too

#

leave that for the biggers.

dim tusk
#

your message is literally a complaint 😭

steady canopy
#

No

chilly fractal
#

So until they actually start helping

#

They are undefined and are not in this equation

steady canopy
#

Yeah you can do whatever u want buddy it's a public chat so it's stupid saying i'm complaining bc i'm not a staff here to do something about you giving shit advices.

#

I was justt giving my opinion

#

from an objetive pov

#

that's it

dim tusk
steady canopy
#

it is what it is

chilly fractal
#

It indeed is what it is.

steady canopy
#

hm

#

Good advices would be for example... Use guard clauses instead of nested if statements

#

Something like that

#

but

#

Making a separated function to put it inside the runInterval

chilly fractal
#

Some people just pop outta nowhere and start claiming stuff is horrible and bad without providing "the real advise".

steady canopy
#

??

dim tusk
#

see? You're complaining, you're not just telling the right thing

steady canopy
#

You wanted a real advice there it is

chilly fractal
#

Sure but it has complaining too

steady canopy
#

bruh

#

Bro doesn't even know what's a complaint

chilly fractal
#

And it usually does nothing in performance, if you want performance you'd use a ternary operator.

#

Its just for better readability.

steady canopy
dim tusk
#

if you're not satisfied with someone's advice why not give better advice to the other guy instead of saying "I don't have time" but also have time to tell the guy who doesn't need advice and advice 🤷

steady canopy
#

If you weren't a beginner you wouldn't have said that.

chilly fractal
steady canopy
#

Ternary operators aren't for all cases

chilly fractal
#

I can make them for all cases.

steady canopy
#

imagine doing 6 conditions in a single line just because "you wanna use ternary operator in all cases"

#

that's crazy

chilly fractal
#

Yeah i do that

#

Its okay tbh

steady canopy
#

and loses all the sense of that "better readability" you talking about

steady canopy
#

anyways

#

im outta this convo

#

no point on talking to a beginner

chilly fractal
#

I am telling you you are providing better readability not performance and he was asking about performance

#

Also you can put the tenary operator on multiple lines btw

steady canopy
#

Using ternary operrators isn't more performant than guard clauses 💀

#

you're just trying to prove a point that doesn't exist

chilly fractal
#

💀

dim tusk
#

Umm, yeah bro really have time arguing with you instead of giving the guy who actually needed help and advice 😑....

steady canopy
chilly fractal
dim tusk
steady canopy
dim tusk
steady canopy
steady canopy
chilly fractal
neat hazel
#

Which one is right?
player.getGamemode("creative")
or
player.getGamemode == "creative"

chilly fractal
steady canopy
#

none of them

chilly fractal
neat hazel
#

Oh, thnks

wheat condor
steady canopy
#

bro thinks he's part of the justice league

chilly fractal
neat hazel
dim tusk
#

yeah, they have a love and hate relationship.

steady canopy
#

L

dim tusk
#

But only 20% love

chilly fractal
chilly fractal
wheat condor
#

Brothers be arguing on who give a the best code advice

steady canopy
chilly fractal
steady canopy
#

i was arguing about why u SHOULDN'T give bad advices to beginners

chilly fractal
chilly fractal
steady canopy
#

Low iq 😭🙏

#

bro doesn't even know what to say anymore

#

we have Albert Einstein around

wheat condor
chilly fractal
steady canopy
chilly fractal
wheat condor
chilly fractal
steady canopy
steady canopy
chilly fractal
#

Yes whatever i say, its better then whatever the crap comes out of your mouth or your stupid little discord account.

steady canopy
#

Bro got so mad that he's even insulting 🙏

dim tusk
#

Hey, why is it me who doesn't have an enemy... Can I have one?

steady canopy
#

Low iq

#

definitely

chilly fractal
#

Thanks for admitting finally.

steady canopy
#

Bro's iq is so low that he didn't even realize i was talking 'bout him 💀

steady canopy
#

that's mad crazy

chilly fractal
wheat condor
#

We got Anonymus 2015 ahh hacker vs script veteran 🍿

steady canopy
#

im just talking about ur low iq

#

stay mad

chilly fractal
chilly fractal
wheat condor
#

Bro cringe levels are going crazy please stop this 🛑

steady canopy
#

Ok now im actually outta this convo ion wanna get banned, think wtv u wanna think bro, at the end of the day, it's whatever, im a software engineer and you're a kid growing up trying to learn a programming language just to create addons for minecraft 🙏 (i also create Addons but that's not the only thing i do)

dim tusk
chilly fractal
dim tusk
dim tusk
#

Bro got hurt so bad he spammed an emoji?

chilly fractal
dim tusk
#

Either way ginkn with your lives

steady canopy
#

cya

dim tusk
#

there's better things to do than this stupid little shit

steady canopy
chilly fractal
steady canopy
#

was for that guy who thinks he full stack

steady canopy
dim tusk
#

Ay ay.. stop it

chilly fractal
wheat condor
chilly fractal
dim tusk
#

I'm literally calling a mod.
-# nah I'm not I'm a scaredy cat lol

wheat condor
#

Mods should add a channel to argue

dim tusk
wheat condor
#

Useless channel

remote oyster
dim tusk
#

ehh... Kinda forget bro made two enemies

remote oyster
#

Very few things will bother me. People like him are one of them. I'm not in favor of sitting idle when it comes around either.

#

I'll call it like I see it.

thorn flicker
#

Honestly, you need to stop putting so much energy into arguing with people online.

#

its not worth it.

remote oyster
#

I won't argue. I'll just correct. Turning a blind eye isn't healthy either. Unless a mod handles the behavior then someone needs to point it out to them.

thorn flicker
wheat condor
dim tusk
remote oyster
thorn flicker
#

don't let people get you mad like that.

#

especially online.

remote oyster
#

Agreed.

dim tusk
#

Rage baiting at it's finest

thorn flicker
wheat condor
remote oyster
#

Or is there a misunderstanding on the difference between arguments and corrections?

thorn flicker
#

corrections can be a form of argumentation.

#

this right here is turning into argument lol

#

arguing about what an argument is

#

funny

thorn flicker
remote oyster
#

Arguments is another form of fighting. One which I have no intention of doing. However, I will stand firm on my actions. Emotions do not factor in with my decision to hold someone accountable. I could care less about ones emotions on the matter. If you are wrong then you are wrong.

acoustic basin
#

its scripting channel =P

#

chao chao

thorn flicker
dim tusk
#

People complain they're getting cyber bullied, just turn off your WiFi

thorn flicker
#

or just, dont respond

acoustic basin
dim tusk
#

True, if you can't handle the heat don't feed it even more... You're just gonna burn in the end

thorn flicker
#

even though they never can admit they are mad or emotionally affected.

acoustic basin
#

console.warn('Happy New Year everyone!')

thorn flicker
#

not yettt

#

for me anyway

acoustic basin
#

for me almost

#

just saying ahead

thorn flicker
#

gotta go

wheat condor
thorn flicker
#

ill try to talk to you tomorrow vlad

acoustic basin
thorn flicker
dim tusk
chilly fractal
sharp elbow
chilly fractal
#

You're welcome.

dim tusk
#

Sprunkles approved?

#

🤔

#

Bet.

sharp elbow
#

The number of times people have gotten confused because their error says at <anonymous> when they could have been naming their routines ...

remote oyster
#

Lol

chilly fractal
#

Idk i feel like they have hacks lol, i also feel that when i get my calculations right

dim tusk
chilly fractal
dim tusk
#

This guy is a certified, nerd and a chill guy

chilly fractal
#

He hacked the education system and was taught in home, unlike others.

#

He used to fail so many times

chilly fractal
#

Yet he became the most smartest man

dim tusk
#

he learns from his mistakes

chilly fractal
#

Yessir

dim tusk
#

Just like Tony stark.

chilly fractal
#

Yessir

wheat condor
slim forum
#

Can I get the slot from itemStack?

#

Without using getComponent('inventory')

deep arrow
#

Probably not

slim forum
#

Thanks

cold grove
wheat condor
cold grove
#

She asked for slot

chilly fractal
cold grove
#

Not me

chilly fractal
wheat condor
#

Oh

slim forum
#

My item not duplicated again

empty grail
#

is there a way to get texture from block ?
using script api of course

empty grail
quick shoal
#

Just paste the path

dim tusk
#

Son of god can someone help me with the molangVariableMap()?
-# me first time using this

#

how do I add a variable to the particle?

#

nvm oof

#

I just need to read the docs lmfao

errant plover
#

[Scripting][error]-Plugin [pack.name - 1.0.0] - [main.js] ran with error: [SyntaxError: Could not find export 'ModelFormData' in module '@minecraft/server-ui']

anyone know how to fix im following a tutorial by using a compass it opens a gui, this happend when i /reload

dim tusk
errant plover
#

add what, this is my first day scripting so if im kinda stupid thats why

dim tusk
# errant plover add what, this is my first day scripting so if im kinda stupid thats why
{
    "format_version": 2,
    "header": {
        "name": "",
        "description": "",
        "uuid": "",
        "version": [0, 0, 1],
        "min_engine_version": [1, 21, 60]
    },
    "modules": [
        {
            "description": "behavior",
            "version": [0, 0, 1],
            "uuid": "",
            "type": "script",
            "language": "javascript",
            "entry": "scripts/main.js"
        }
    ],
    "dependencies": [
        {
            "description": "server",
            "module_name": "@minecraft/server",
            "version": "1.18.0-beta"
        },
        {
            "description": "server-ui",
            "module_name": "@minecraft/server-ui",
            "version": "1.4.0-beta"
        },
        {
            "description": "debug-utilities",
            "module_name": "@minecraft/debug-utilities",
            "version": "1.0.0-beta"
        },
        {
            "description": "resource",
            "uuid": "",
            "version": [0, 0, 1]
        }
    ]
}```
#

Here. A sample

errant plover
#

this is mine rn

#
{
    "format_version": 2,
    "metadata": {
        "authors": [
            "hello"
        ],
        "generated_with": {
            "bridge": [
                "2.7.42"
            ],
            "dash": [
                "0.11.7"
            ]
        }
    },
    "header": {
        "name": "pack.name",
        "description": "pack.description",
        "min_engine_version": [
            1,
            21,
            0
        ],
        "uuid": "a432d459-24d6-40ea-9241-c7236fb6e2b3",
        "version": [
            1,
            0,
            1
        ]
    },
    "modules": [
        {
            "type": "data",
            "uuid": "37352f7b-47a5-4570-87e6-f9b09b040efd",
            "version": [
                1,
                0,
                0
            ]
        },
        {
            "type": "script",
            "language": "javascript",
            "uuid": "8d827430-cba9-4991-b00c-026f9cc394ae",
            "entry": "scripts/main.js",
            "version": [
                1,
                0,
                0
            ]
        }
    ],
    "dependencies": [
        {
            "module_name": "@minecraft/server",
            "version": "1.17.0-beta"
        },
        {
            "module_name": "@minecraft/server-ui",
            "version": "1.4.0-beta"
        }
    ]
}
errant plover
#

put what wrong

dim tusk
#

ModalFormData not Model

errant plover
#

oh

#

my bad

errant plover
errant plover
#

world.beforeEvents.itemUse.subscribe(data => {
let player = data.source
let title = "title of your gui"
if (data.itemStack.typeId == "minecraft:compass") system.run(() => main(player))
just wondering what this does

cold grove
dim tusk
errant plover
#

ok

#

what do i need to write for me to right click a sword so it give me an effect?

errant plover
#

diamond sword

dim tusk
#

If custom use custom components if vanilla use before events of itemUse

errant plover
#

player.runCommandAsync why is the async there?

#

nvm

granite cape
errant plover
#

in world.sendMessage("") how do i make it send "given "PLAYERSNAME" strength 5 for 5 seconds?

quick shoal
dim tusk
#

Just add a space if you use +

#

They will look like this. If you don't add spaces after each string

giveCoddystrength 5 for 5 second```
quick shoal
#
world.sendMessage('given ' + player.name + 'strength 5 for 5 seconds');
errant plover
#

i had already tried world.sendMessage(given ${player.name} strength 5 for 5 seconds); and it didnt work which is when i asked the question but i realised i used " instead of `

#

so i fixed it and alll better

dim tusk
thorn flicker
dim tusk
#

Happy new year BTW

thorn flicker
#

15 mins.

#

its not new years for me yet lol

dim tusk
#

What time is there?

#

Nvm what's your time zone

thorn flicker
#

EST

dim tusk
thorn flicker
dim tusk
cold grove
#

Happy 2013 guys

somber echo
dim tusk
#

Lmao

dim tusk
unique dragon
tawny jungle
#

so system.currentTick % (40) === 0 will run every 40 ticks in runInterval, but how could I delay until 40 ticks after an event, and run every 40 ticks perpetually after?

supple yoke
#

rate my code, how can i improve this?

import {world as W, system as S} from "@minecraft/server"
let [m,d,s,c,f] = [[],
  _=>1 << W.getPlayers()[0].selectedSlotIndex,
  (s,b)=> W.getDimension("overworld").runCommand(`setblock ${s >> 6} -59 ${s & 31 >> 1} ${b}`) && s,
  (p,h)=> p && c(m[p]) || p == (h ?? p) && p,
  (p,h,a)=> S.runTimeout( _=>{
    m[s(h, "green_concrete")] = p
    s(a, "red_concrete") != h && (m[s(c(p), "air")] = 0) || (a = Math.floor(Math.random() * 999) & 990 + 1)
    !c(p,h) && f(h, (h + (d() & 66) - (d() & 132 >> 1)) & 991, a)
  }, 4)
]
f(1,3,3)
noble bolt
#

i dont understand shit

#

what kind of naming scheme is that

knotty plaza
supple yoke
#

oops i wrote this without an lsp, seems like i missed a ,

knotty plaza
#

Looks like what the compiler would make

round bone
supple yoke
#

also fyi, this is a snake clone

celest abyss
#

Is there anything to detect if a player has a certain scoreboard number?

somber echo
#

world.scoreboard.getObjective('objective')?.getScore(player);

slim spear
#

and why is it using runCommand

#

also it's running it off of the first player in the world?

supple yoke
#

and runcommand is shorter than setblockpermutation

#

actually

#

maybe not, I'll test it later

gusty bramble
#

Is it possible to stop containers from dropping their items when broken? (/gamerule dotilrdrops does not do this in case anyone suggests it)

knotty plaza
acoustic basin
#

(and sorry for ping)

acoustic basin
hushed ravine
acoustic basin
#

guys i have a script, where im trying to make so my entity transformed into another one, for example, here

const entityList = [
    'minecraft:pig',
    'minecraft:hoglin',
    'minecraft:cow',
    'minecraft:frog',
    'minecraft:villager_v2',
    'minecraft:piglin',
    'minecraft:slime',
    'minecraft:allay'
]

const mutatedEntityList = [
    'minecraft:hoglin',
    'minecraft:zoglin',
    'minecraft:ravager',
    'v360:warped_frog',
    'minecraft:vindicator',
    'minecraft:zombie_pigman',
    'minecraft:magma_cube',
    'minecraft:vex'
]


function mutateEntity() {
    for (let i = 0; i < entityList.length; i++) {
    }
}

for (const player of world.getPlayers()) {
        world.getDimension(player.dimension.id).getEntities().forEach((entity) => {
            if (entityList.includes(entity.typeId) && entity.hasTag('v360:warping_stage1')) {
            }
        })
    }```

 i have 2 lists of entities, and list of transformed entities. i want to make it so for example, first entity from `entityList` spawns the first entity from `mutatedEntityList`, or, for example, piglin, it's the sixth entity in the `entityList`, so it has to spawn sixth entity from `mutatedEntityList`, which is zombie pigman. currently im stuck with this, and i need help figuring out the rest
dim tusk
acoustic basin
dim tusk
dim tusk
# acoustic basin but what's after that?
const transform = {
   'minecraft:creeper': 'minecraft:sheep',
   'minecraft:skeleton': 'minecraft:tnt'
};

for (const entity of world.getDimension().getEntities()) {
   if (transform.includes(entity.typeId) && entity.hasTag('transform')) {
      const targetType = transform[entity.typeId];
      console.warn(`${entity.typeId} into ${targetType}`);
   }
}```
#

Sorry it took awhile, I'm eating my dinner rn

acoustic basin
dim tusk
#

sorry, replace includes with hasOwnProperty, I forgot includes only works on arrays

distant tulip
#

👀

import { world, system } from "@minecraft/server";

const mutateTo = {
    'minecraft:pig':"minecraft:hoglin",
    'minecraft:hoglin':"minecraft:zoglin",
    'minecraft:cow':"minecraft:ravager",
    'minecraft:frog':"v360:warped_frog",
    'minecraft:villager_v2':"minecraft:vindicator",
    'minecraft:piglin':"minecraft:zombie_pigman",
    'minecraft:slime':"minecraft:magma_cube",
    'minecraft:allay':"minecraft:vex"
}

const entities = Object.keys(mutateTo)
const allDimensions = [ 'overworld', 'nether', 'the_end' ];
const dimensions = allDimensions.map(dimension => world.getDimension(dimension));


function mutateEntity(entity) {
    const type = mutateTo[entity.typeId]
    if(!type) throw new Error("Entity type not found for mutation");
    
    const {location,dimension,nameTag} = entity.location
    const rot = entity.getRotation()
    const vel = entity.getVelocity()
    
    entity.remove()

    const mutatedEntity = dimension.spawnEntity(type,location)
    mutatedEntity.setRotation(rot)
    mutatedEntity.applyImpulse(vel)
    mutatedEntity.nameTag = nameTag
}

system.runInterval(()=>{
    for(let dimension of dimensions){
        for(let entity of dimension.getEntities()){
            if(!entities.includes(entity.typeId)) continue
            if(entity.hasTag('v360:warping_stage1')) mutateEntity(entity)
        }
    }
},5)
dim tusk
hot gust
hushed ravine
acoustic basin
#

my entity transforms

#

thank u sooooo much!!

dim tusk
hot gust
hushed ravine
hot gust
#

No

hushed ravine
#

Alright

#

I'll test this then

#

Thank you!!

distant tulip
hushed ravine
#

@hot gust what about the particles?

dim tusk
acoustic basin
#

i can learn from this

hot gust
hushed ravine
#

Sorry. I meant that I don't have the particle file, and I'm not really experienced with particles myself (haven't created any particle)

hot gust
#

Oh i see yeah youd need a resource pack you could replace the custom one with one of the vanilla particles

hushed ravine
hot gust
#

Im away at the moment but can dm you the pack later

hot gust
hushed ravine
#

Alright!!

#

Thanks

warm drum
#

anyone know why the .getComponent("minecraft:is_charged") doesnt work on creeper?

amber granite
#

Idk because, maybe its for crossbow only ☠️ @warm drum

warm drum
distant tulip
fervent topaz
#

@granite badger how to keep the script blocks to persist through reloads of the world

distant tulip
#

pinging someone limits the amount of people who can help you from everyone online here to just one person

fervent topaz
#

yes he made the script blocks

#

so he would know

dim tusk
#

Expect he'll respond 7 hours later

fervent topaz
#

and thats fine

granite badger
fervent topaz
#

i mean how can i make the blocks code persist through reloads

granite badger
fervent topaz
#

ok thanks for the help jayly

inland merlin
#

does teleporting an entity 9999999 999999 99999999 to get rid of it forever cause a memory leak or add memory to the world?

should i be teleporting them to a location and adding a tag to despawn them based on a despawn component group in the json of the entity?

it hasn't seemed to cause issues before just trying to clean up some code and make it more efficent

#

im updating my leefy spawners addon

jolly veldt
#

Could you elaborate on what you're trying to do?

#

So far, teleporting an entity below bedrock seems more optimal

valid ice
#

.remove() best

inland merlin
#

lol

valid ice
#

Yar

inland merlin
#

no shot....

valid ice
#

Like .kill() but without death effect or loot

inland merlin
#

dang i've been outta the loop

valid ice
#

Entity just simply ceases to exist

inland merlin
#

perfect all i need

#

thank you

jolly veldt
inland merlin
#

well that works very well... alot less processing thank the lord.. performance for sure

inland merlin
#

. ,,N, V BBBBBBBBBBBBBBBBBBBBB,, ,BG,B

#

WWWWWW99

jolly veldt
#

I'll allow myself to guess: A cat on a keyboard

inland merlin
#

ojnn pm,;p//// '''''

jolly veldt
#

😭

wary edge
#

o/ Hi Leefy's cat.

inland merlin
#

lol my kid

#

oops

#

hope yall had fun

jolly veldt
#

It was a very meaningful conversation

inland merlin
#

sounds good haha

#

i had to clean up some melted carmel on a couch since someone sat on a milkyway and melted the entire kind size bar

#

then my kid 18 month old, decided to go full leefy and put headphones on as well and type like an artist

jolly veldt
inland merlin
#

my wife felt horrible lol, she had to put her pants/trousers in the laundry

#

lmao

jolly veldt
#

Ok this is getting off topic, i shall not elaborate further

inland merlin
#

sounds good. anyways, i've been updating my code for an addon i have.. its getting sorta laggy overtime, and i've figured out a bunch of places that have helped alot.

#

reducing any memory leaks as well

inland merlin
#

they currenlty spawn in only at one direction after killing my entities

#

ill have to test i suppose

#

this is what im am reffering to... when killing they always spawn in facing one direction, and there was a issue in the past...

jolly veldt
#

(ignore the Netherite)

inland merlin
#

oh haha

valid ice
#

I think the best you’ll get is setRotation

inland merlin
#

awh okay

#

i am planning on adding more entities

#

but wanna make sure functionality in servers is not gonna cause lagg

#

which it doesn't

#

for the most part...

keen laurel
#

I'm trying to repeat the logic on spawners where if you right click a spawn egg onto it, it changes it to that type of spawner. I already have it so it reads which mob it is from the itemUseOn event... but how can I store the data on the block?

inland merlin
#

wait a sec...

for rotation

#

initial might be able to get inherited

#

seems newer or im just way outdated myself

keen laurel
#

you could just use /summon right

inland merlin
#

maybe you can use itemDynamicProperties?

keen laurel
#

can't do that, i'm putting it inside a structure block to be saved

inland merlin
#

due to cap

inland merlin
#

thats not a bad idea

keen laurel
#

I was trying just event.block.setPermutation(server.BlockPermutation.resolve("block:block_name", {mob: mobType})) (with the correct name ofc) but I guess I don't understand how I'm suppsoed to allow this permutation to work?

inland merlin
#

hmmm interesting

#

i haven't really worked with permutations recently

keen laurel
#

maybe this is more of a blocks question then scripting

inland merlin
#

well, your talking about hard coded permutations right

valid ice
#

Permutations are definitely worth looking into

#

I use them for my spawners, no entities involved (besides the ones spawned, ofc)

inland merlin
#

Less blocks to create smaller addon

#

I would assume

#

Easier to expand on

valid ice
#

I still have 1 block per spawner

#

Each is a separate block

#

But they all run off the same custom component & permutation names so it’s easy to expand upon

keen laurel
#

i realized I needed to add the states lmao

#

code was fine

#

max of 16 states (for one state) :/ unfortunate

dim tusk
#

16 values for 1 state and 32 states for a block

#

your block can't have more than 65k permutation and the world shouldn't have that many permutation too

paper atlas
#

Is it possible to make an entity atack in area applying knockback and damage that could be possible to block with the shields??

I need it for a boss but idk if thats even possible with scripts

help plz

#

for this kind of attacks

#

i was thinking in using tags

errant plover
#

what is .subscribe used for?

quick shoal
#

for exp

world.afterEvents.itemUse.subscribe(({ source: player, itemStack }) => {}) 
errant plover
#

if you subscribe to an event it does it?

quick shoal
#

Uhm

#

event is don't exist, U can put any custom name after subscribe

#
world.afterEvents.itemUse.subscribe((abc) => {}) 
errant plover
quick shoal
quick shoal
#
const { itemStack, player } = abc;
#

Or

const itemStack = abc.itemStack
#

Also U can directly use

if (abc.itemStack.typeId)
errant plover
#

whats the abc

quick shoal
#

Not specific U can custom it

errant plover
#

but like what do you put there

quick shoal
errant plover
#

instead of abc

#

do you put an item name?

quick shoal
#

U can use any word

errant plover
#

an event?

quick shoal
#

All event callbacks can use any word

valid ice
#

The code listens for nothing when you first start, and you can tell it to listen or unlisten to events based on what you want it to do

quick shoal
#

The professionals explanation

valid ice
#

Fake it till ya make it Fingerguns

errant plover
#

ok

errant plover
# valid ice The code listens for nothing when you first start, and you can tell it to listen...

so would this work

import { world, system } from "@minecraft/server"
console.warn(`index.js has loaded\nYour code has worked!!`)
world.beforeEvents.itemUse.subscribe(data => {
    let player = data.source
    if (data.itemStack.typeId == "minecraft:diamond_sword") system.run(() => main(player))
    
      function main() {
        player.runCommandAsync("/effect @s strength 10 255")
        world.sendMessage(`Gave ${player.nameTag} Strength 255 for 10 seconds`)
        player.sendMessage(`§l§7Im so cool`)
      }
    })
quick shoal
#

Yea

errant plover
#

i copied most of this btw

valid ice
#

idk, try it and see

quick shoal
#

U can just do like this

gaunt salmonBOT
# errant plover so would this work ```js import { world, system } from "@minecraft/server" cons...

Debug result for [code](#1067535608660107284 message)

Compiler Result

Compiler found 1 errors:

<REPL0>.js:5:83 - error TS2554: Expected 0 arguments, but got 1.

5     if (data.itemStack.typeId == "minecraft:diamond_sword") system.run(() => main(player))
                                                                                    ~~~~~~

Lint Result

ESLint results:

<REPL0>.js

8:9 warning The /effect command can be fully replaced with the Entity.addEffect api in the @minecraft/server module. See https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/entity#addeffect for more information. minecraft-linting/avoid-unnecessary-command

quick shoal
#
const { source: player, itemStack } = data;
quick shoal
errant plover
quick shoal
valid ice
#

Keeping variables separate makes it more readable, especially if you're learning

errant plover
#

is the max effect you can give through a script 255?

#

strength in this case

valid ice
#

yar

#

command limits

dim tusk
errant plover
valid ice
#

entity hurt event?

dim tusk
#

get the item used then boom

errant plover
#

how

valid ice
#

world.afterEvents.entityHurt.subscribe(data => {
console.warn('Damage dealt: ' + data.damage)
})

errant plover
# valid ice world.afterEvents.entityHurt.subscribe(data => { console.warn('Damage dealt:...

[Scripting][warning]-index.js has loaded
Your code has worked!!

[Scripting][warning]-main.js loaded

[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)

[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)

[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)

[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)

[Scripting][warning]-index.js has loaded
Your code has worked!!

[Scripting][warning]-main.js loaded

[Scripting][warning]-index.js has loaded
Your code has worked!!

[Scripting][warning]-main.js loaded

[Scripting][warning]-Damage dealt: 1.6743704204155438e+30

not even that much damage

errant plover
#

Damage dealt: 1.6743704204155438e+30

dim tusk
errant plover
#

?

valid ice
#

player not being initalized is because you don't have it as a parameter in the function you declared (main)

errant plover
#

in main()
i need to write let player = data.source

#

?

valid ice
#

Yes

#

And you do not need to do main(player) you can just do main()

errant plover
valid ice
#

The variable is not defined

errant plover
#

oh

#

everything still works

errant plover
valid ice
#

try

import { world, system } from "@minecraft/server"
console.warn(`index.js has loaded\nYour code has worked!!`)
world.beforeEvents.itemUse.subscribe(data => {
    let player = data.source
    if (data.itemStack.typeId == "minecraft:diamond_sword") system.run(() => {
        player.runCommandAsync("/effect @s strength 10 255")
        world.sendMessage(`Gave ${player.nameTag} Strength 255 for 10 seconds`)
        player.sendMessage(`§l§7Im so cool`)
        })
    })
errant plover
#

oh good idea

valid ice
#

Or disable it's AI by editing the BP file

errant plover
#

would it work on the ender dragon

valid ice
#

nop

#

Only if it's touching the ground

dim tusk
#

slowness won't work on the ender dragon, edit it's vanilla file...

#

or you can tp it constantly 🤷

errant plover
quick shoal
dim tusk
errant plover
dim tusk
#

Read some documentation to know more

#

Do not jump directly to this

errant plover
dim tusk
errant plover
dim tusk
errant plover
errant plover
dim tusk
errant plover
#

prob

dim tusk
#

Lemme see it

errant plover
#
world.afterEvents.entityHurt.subscribe(data => {
  console.warn('You dealt: ' +  data.damage + ` to a` + data.hurtEntity.nameTag)
})
dim tusk
errant plover
#

it says you dealt 3878387 to a

dim tusk
errant plover
#

[Scripting][warning]-You dealt: 1.6743704204155438e+30 to a

[Scripting][warning]-You dealt: 1.6743704204155438e+30 to a

dim tusk
#

wym by name the actual naem of entity or the id?

errant plover
#

chicken and warden

dim tusk
#

i mean by id is minecraft:warden

errant plover
dim tusk
#
world.afterEvents.entityHurt.subscribe(data => {
  console.warn('You dealt: ' +  data.damage + ` to a` + data.hurtEntity.typeId)
})```
errant plover
#

it worked thanks for your help

lament tree
#

Anyone knows how much does System run affects to performance?
And if theres a way to optimize it

dim tusk
lament tree
#

Alr
Thanks!

cinder shadow
#

Can we still not detect whether an itemStack has custom components?

cinder shadow
#

😔 guess I'll just give them all item tags

#

damn I'm really just reliving all of the problems I already had whenever I try to mess with something after taking a break

#
world.sendMessage(`hasTag:${eventData.itemStack.hasTag("grimy")}`)
world.sendMessage(`getTags:${JSON.stringify(eventData.itemStack.getTags())}`)```
#

funny times

#

and as I remember, you have to specify an identifier in the itemStack's tag for it to be recognizable with HasTag

#

such a weird quirk

dim tusk
#

I was about to say that lol...

#

been a while since I saw you here man...

cinder shadow
#

blame good games

dim tusk
cinder shadow
#

I hardly play Minecraft

dim tusk
#

tho Minecraft is a sandbox game can't blame you

cinder shadow
#

my year in review had nearly 10x the amount of time spent in preview than stable

dim tusk
#

I play marvel rivals and rdr2

#

-# yes, I still play rdr2

narrow patio
#

Is it possible to deop a player using script api

scarlet lynx
#

wait no

#

it's

#

player.setOp(false)

#

I think

narrow patio
#

o

#

For me it doesn't show up

deep arrow
#

Would dynamic properties be the best database system for mass quantities of data?

valid ice
#

Yes- just note string properties have a limit of 32767 characters

errant plover
#

ran my pack and got an error, ive got no idea what it means tho?

[Scripting][error]-Plugin [§l§3Scripting_Pack_V! - 1.0.3] - [index.js] ran with error: [ReferenceError: Module [minecraft/server.js] not found. Native module error or file not found.]

quick shoal
#

...

#

how U import

#
import { world, system } from '@minecraft/server';
errant plover
#

also because world.afterEvents.playerBreakBlock.subscribe(function(data) {
is a thing is world.beforeEvents.playerBreakBlock.subscribe(function(data) {

#

import { world } from "minecraft/server"

#

oh no @

quick shoal
errant plover
#

sorry

quick shoal
cinder shadow
#

Can someone remind me how you set nameTag for an item with lang file %?

noble bolt
cinder shadow
#

guess I need to get fancy

cinder shadow
#

damn, I can't even read the items name

deep arrow
bright dove
#

How do you apply knockback just enough so that you get a 'pull upward' effect ?

stark kestrel
#

is this error related to script api or json ui

bright dove
stark kestrel
#

ty

shell sigil
#

Anyone Master in javaScript, css and json.UI here I have a question if you gonna translate the
{
"binding_type": "view",
"source_property_name": "((#title_text - 'Custom Form') = #title_text)",
"target_property_name": "#visible"

    }

In the JavaScript code Do you think it's like if else statement

dim tusk
slow walrus
#

actually

shell sigil
#

Rate my code guys I make it more readble and understandable

#

My addon name is better level mechanic

#

I think I'm the only one here using only mobile Android phone for coding and making add-on

shell sigil
#

How's my code

dim tusk
#

I mean does it work?

shell sigil
#

Yes.

dim tusk
#

And format it pls... My demon side is waking up

#

Your code can be simplified

shell sigil
#

How

#

I mean yea

#

I making it more least code

dim tusk
#

some variables yeah...

shell sigil
#

I see this in hive server where a chest Open without clicking it instead just holding a item how is that happen anyone have the file code

shut citrus
#

minecraft mobs in future

remote oyster
# shell sigil Rate my code guys I make it more readble and understandable

One thing to keep in mind, though not necessarily a requirement, is the potential impact of destructuring event objects. If you intend to modify the properties or structure of the original object directly, destructuring can be problematic. This is because the newly created variables are separate from the original object and cannot be used to make changes to it.

wheat condor
#

how do i check if a player has some ui opened?

#

like crafting table or chest?

dim tusk
dim tusk
crude bridge
#

hi

#

ive made this script that flag u when u have speed but when i go -x, -z the script ignore me how can i fix?

#
Minecraft.system.runInterval(() => {
    [...world.getPlayers()].forEach(player => {
        const playerVelocity = player.getVelocity();
        console.warn(playerVelocity.x)

        if(playerVelocity.x < -0.390 || playerVelocity.z < -0.390 && !player.isJumping) {
            world.sendMessage('§4velocity flag' + playerVelocity.x)
        }
    })
}, );
warm mason
crude bridge
warm mason
tawny reef
#

please help my manifest not work
{
"format_version": 2,
"header": {
"name": "ElysiumMinage",
"description": "ElysiumMinage Script Pack",
"uuid": "7983f147-4ba9-4b0e-81b6-08202c43b8b1",
"version": [1, 0, 0],
"min_engine_version": [1, 20, 0]
},
"metadata": {
"authors": ["shadowbubble"],
"generated_with": {
"blockbench_item_wizard": ["1.1.0"],
"blockbench_block_wizard": ["1.2.2"]
}
},
"modules": [
{
"type": "script",
"entry": "scripts/main.js",
"uuid": "072153b0-0716-43a7-9ebe-1118953fe17e",
"version": [0, 1, 0]
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.17.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.4.0-beta"
}
]
}

dim tusk
crude bridge
#

How can i detect if a player has a effect and the level of the effect

dim tusk
crude bridge
#

Uhhh thx to everyone

thorn flicker
tawny reef
#

okay its good

nimble schooner
#

Why does itemStack.getLore() not return a string??

#

@dim tusk

#

But it returns a function for me 😭

warm mason
chilly fractal
# nimble schooner Why does itemStack.getLore() not return a string??

My scripty senses are tingling!
What are u doin? If you are doing const lore = item.getLore() then i am here to break to you, it return an ARRAY of STRINGS not a STRING.
The correct way to do this (if you want the first element in that lore [first line]) then do: const lore = item?.getLore()[0];, btw the added ? Is to make sure item is not undefined when accessing so it doesn't throw an error :)

dim tusk
#

it's an array not a normal string

chilly fractal
#

Also hey coddy

#

I finally finished the indexedDB and the image encoding and decoding and the navbar and everything!

chilly fractal
#

By encoding i meant turning it into a base64 version after the user cozyly decides what part of their image they want an avatar then i fetch the image, centerize it, keep only what they see and nothing less and nothing more, compress it into jpeg with lost .1 of it's original quality becuz base64 versions of images are roughly 30% larger then the original image (not 30, more like 33.73083, ofc depends) and then sends the encoded version to backend!

#

Basically the backend part is the most easiest part of the website, front end is so fking complex and just making everything user friendly and secure and great and legal is so hard!

chilly fractal
#

Huh?

#

Idk.

quick vapor
#

i aint been coding for like the past like year, where can i find newest manifest and everything i need to hop back on, tryna start from scratch

chilly fractal
# chilly fractal Idk.

It's handled by the browser. You can't expect me to actually fking edit the quality manually frfr

chilly fractal
#

Or read through ms documentation

#

(It will have latest types)

dim tusk
#
{
    "format_version": 2,
    "header": {
        "name": "",
        "description": "",
        "uuid": "",
        "version": [0, 0, 1],
        "min_engine_version": [1, 21, 60]
    },
    "modules": [
        {
            "description": "behavior",
            "version": [0, 0, 1],
            "uuid": "",
            "type": "script",
            "language": "javascript",
            "entry": "scripts/main.js"
        }
    ],
    "dependencies": [
        {
            "description": "server",
            "module_name": "@minecraft/server",
            "version": "1.18.0-beta"
        },
        {
            "description": "server-ui",
            "module_name": "@minecraft/server-ui",
            "version": "1.4.0-beta"
        },
        {
            "description": "debug-utilities",
            "module_name": "@minecraft/debug-utilities",
            "version": "1.0.0-beta"
        },
        {
            "description": "resource",
            "uuid": "",
            "version": [0, 0, 1]
        }
    ]
}```
#

here's a manifest

quick vapor
#

u saint

dim tusk
#

Nothing really changed much

quick vapor
#

any huge advancements added?

#

like is hitEnitity a beforeEvent now

#

ik people been waiting on that for a while

dim tusk
chilly fractal
dim tusk
#

we can detect WASD now even if the movement is disabled same goes to jump and sneak

quick vapor
#

damn

quick vapor
#

thats huge

#

quick thing whats the command to download all the packages or wtv

dim tusk
quick vapor
#

thas chill

chilly fractal
#

npm i @minecraft/server

quick vapor
#

ty

dim tusk
#

For reference I am literally playing with my self to check how chess works and if mine matches to the actual one 😭