#Script API General

1 messages Β· Page 92 of 1

scarlet sable
#

How do I allow all types?

#

Doesn't matter if it's a number , boolean, word whatever

#

I use the same one but I think for your case it's better yo separate them

#

Ehhh I don't get it lol

woven loom
#

fov tween

scarlet sable
#

What's that?

woven loom
#

Look at the video again, the field of view changes over time.

scarlet sable
#

Nah like what is it used for

woven loom
#

ccinematic shots?

scarlet sable
#

Oh

#

Fair

scarlet sable
woven loom
#

strings

wary edge
#

Unfortunately does not allow selectors.

halcyon phoenix
#

that's trippy as heck

#

it's like on of those AI generated vids

scarlet sable
scarlet sable
vast grove
#

Yeah. MC commands are annoying when using just a number for a string value. You can type
"1" and it'll accept it.

scarlet sable
#

Bruh that's stupid

#

Is there a way around it?

vast grove
#

No clue. Unless you can do an overload

hidden orbit
#

hello! there is on bedrock an "inventoryclick event" like java plugin? i need to set a set of item in the inventory of the player who him can't remove or move from their inventory

jolly citrus
vast grove
#

Just lock the item...

jolly citrus
#

it'll take a toll on performance for sure tho

#

you can compare container properties between ticks and then fire a custom event when a change is detected

#

but yea for your task do what sinevector said

#

you can make items undroppable, unmovable etc. in bedrock

hidden orbit
#

with components? (im new in scripting on bedrock)

jolly citrus
jolly citrus
# hidden orbit with components? (im new in scripting on bedrock)

Learn how to lock items in Minecraft slot or inventory, locking an item means you can't drop it, move it, craft with it etc. So you could also call this video how to get items the player can't drop, or how to get items the player can't craft with.

This works on all Minecraft bedrock editions: PS4, PS5, Xbox, Switch, Windows PC & MCPE / Pocket E...

β–Ά Play video
tardy pivot
#

why does the block still drop?

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

world.beforeEvents.playerBreakBlock.subscribe(eventData => {
  system.run(() => {
      const player = eventData.player;
      const block = eventData.block;
      const isCreative = player.getGameMode() === GameMode.creative;
      
    if (block.typeId.includes("paint_overlay") && !isCreative) {
      eventData.cancel = true;
      block.setType("minecraft:air");
    };
  });
});
wary edge
tardy pivot
#

i also had the block's loot to empty

#

noted thanks

round bone
#

stirng is probably the closest one

distant tulip
wary edge
distant tulip
#

oh, yeah

scarlet sable
distant tulip
#

subcommand or type any/onOf would have helped here

warped blaze
#

is there a way to use infinite duration in .addEffect()? i mean true infinite, not a large number

round bone
#

or use intervals

wintry bane
#

Imagine the script API having toggles in settings. Actual add-on configs section. Couldn't imagine.

warped blaze
warped blaze
wintry bane
#

screw modals. "Settings" item feels so gross

acoustic basin
#

Block custom component event beforeOnPlayerPlace is now called when an item using replace_block_item is set to true for V2.0.0 and higher custom components

is this fix going to be stable in 1.21.90, of it's for v2.1.0-beta?

tight bloom
#
system.runInterval(() => {
    for (let player of world.getPlayers()) {

        if (player.dimension.id == "minecraft:the_end" && player.hasTag('ender_colleague') && player.isSprinting && !player.isGliding && !player.isInWater) {
            const loc = player.getHeadLocation()
            const lowestBlock = player.dimension.getBlockFromRay({ x: loc.x, y: loc.y - 2, z: loc.z }, { x: loc.x, y: loc.y - 10, z: loc.z }, { maxDistance: 12 })
            if (lowestBlock.block.isAir && player.getGameMode() != "creative" && player.getGameMode() != "spectator") {
                player.applyKnockback(player.getVelocity().x, player.getVelocity().z, 0.1, 0.05)
            }
        }

    }
}, 0)```
[Scripting][error]-TypeError: cannot read property 'block' of undefined    at <anonymous> (entity_or_block_gametest.js:23)
#

I've defined lowestBlock with seemingly proper parameters... am I using getBlockFromRay properly? The intention is to detect if there are no blocks below the player(within maxdistance)

woven loom
#

if there is no block then ray cast will just give u no value

tight bloom
#

does air not count towards being a block?

#

even if not, there is ground below me when this error occurs

woven loom
#

nope

#

const lowestBlock = player.dimension.getBlockFromRay({ x: loc.x, y: loc.y - 2, z: loc.z }, { x: loc.x, y: loc.y - 10, z: loc.z }, { maxDistance: 12 })

if (lowestBlock?.block == null) return

        if (lowestBlock.block.isAir && player.getGameMode() != "creative" && player.getGameMode() != "spectator") {
tight bloom
#

with this change, it doesn't trigger anything

#

there seems to be something wrong with the raycast in general?

woven loom
#

no,

#

also ur params for raycast is so wrong,

tight bloom
#

how so?

woven loom
#

direction supposed to me unit vector

#

const lowestBlock = player.dimension.getBlockFromRay({ x: loc.x, y: loc.y - 2, z: loc.z }, { x: 0, y: -1, z: 0 }, { maxDistance: 12 })

#

@tight bloom

tight bloom
#

gotcha, that makes sense

#

with that change, I've reconfigured it to work! Thanks!

woven loom
#

πŸ‘

jolly citrus
#

what would be the least resource demanding way to prevent entities from entering specific areas

#

or like if they do enter an area theyre not allowed to be in then just remove them i dont care about whether or not theyre in the world anymore at that point

#

do i just get entities -> if entity in this area then remove it ?

#

seems like it'd be pretty bad on performance when theres lots of players in different chunks tho

jolly citrus
#

this is how im implementing it atm

  if (tickIndex % 20 === 0) {
    const overworld = world.getDimension("overworld");
    const nether = world.getDimension("nether");
    const end = world.getDimension("the_end");

    const entitiesOverworld = overworld.getEntities();
    const entitiesNether = nether.getEntities();
    const entitiesEnd = end.getEntities();

    entitiesOverworld.forEach((entity) => {
      if (blacklistedEntities.has(entity.typeId)) {
        if (!ClaimManager.entityHasPermissionAtPosition("minecraft:overworld", entity, entity.location)) {
          entity.remove();
        }
      }
    });

    entitiesNether.forEach((entity) => {
      if (blacklistedEntities.has(entity.typeId)) {
        if (!ClaimManager.entityHasPermissionAtPosition("minecraft:nether", entity, entity.location)) {
          entity.remove();
        }
      }
    });

    entitiesEnd.forEach((entity) => {
      if (blacklistedEntities.has(entity.typeId)) {
        if (!ClaimManager.entityHasPermissionAtPosition("minecraft:the_end", entity, entity.location)) {
          entity.remove();
        }
      }
    });
  }
woven loom
scarlet sable
deep quiver
distant tulip
scarlet sable
#

ye I wish it did

steady canopy
#

Because with a controller/mouse you can drag items with the CursorInventory but in touch screens you can't

jolly citrus
# woven loom reverse the logic loop areas for entity and remove the with commands
if (tickIndex % 100 === 0) {
    const dimensions = [
      { id: "minecraft:overworld", dim: world.getDimension("overworld") },
      { id: "minecraft:nether", dim: world.getDimension("nether") },
      { id: "minecraft:the_end", dim: world.getDimension("the_end") },
    ];

    for (const { id: dimensionId, dim } of dimensions) {
      const claims = ClaimManager.getAllClaims(dimensionId as DimensionIdentifier).filter(
        (claim) => claim.allowMobs === false
      );

      for (const claim of claims) {
        const corners = ClaimUtils.getClaimCornersFromClaim(claim);
        const minX = Math.min(corners.topLeft.x, corners.bottomLeft.x);
        const maxX = Math.max(corners.topRight.x, corners.bottomRight.x);
        const minZ = Math.min(corners.topLeft.z, corners.topRight.z);
        const maxZ = Math.max(corners.bottomLeft.z, corners.bottomRight.z);

        const dx = maxX - minX;
        const dz = maxZ - minZ;
        const y = -120; /* covers all y */
        const dy = 320; /* covers all y */

        for (const typeId of blacklistedEntities) {
          dim.runCommand(`kill @e[type=${typeId},x=${minX},y=${y},z=${minZ},dx=${dx},dy=${dy},dz=${dz}]`);
        }
      }
    }
  }

yes?

#

except that i should probably tp them instead of /kill is this the way u were thinking of

#

or at least somewhat close

jolly citrus
uncut lynx
#

gosh after 4 days i got load/save properly done

uncut lynx
woven loom
#

yes

uncut lynx
#
...
function *killBlacklistedEntitiesInClaim(claim, blacklistedEntities) {
    const corners = ClaimUtils.getClaimCornersFromClaim(claim);
    const minX = Math.min(corners.topLeft.x, corners.bottomLeft.x);
    const maxX = Math.max(corners.topRight.x, corners.bottomRight.x);
    const minZ = Math.min(corners.topLeft.z, corners.topRight.z);
    const maxZ = Math.max(corners.bottomLeft.z, corners.bottomRight.z);

    const dx = maxX - minX;
    const dz = maxZ - minZ;
    const y = -120; /* covers all y */
    const dy = 320; /* covers all y */
    for (const typeId of blacklistedEntities) {
        dim.runCommand(`kill @e[type=${typeId},x=${minX},y=${y},z=${minZ},dx=${dx},dy=${dy},dz=${dz}]`);
        yield;
    }
}
...
if (tickIndex % 1 === 0 /* remove the if idk just so u notice that the if NO LONGER NEEDED */) {
    const dimensions = [
        { id: "minecraft:overworld", dim: world.getDimension("overworld") },
        { id: "minecraft:nether", dim: world.getDimension("nether") },
        { id: "minecraft:the_end", dim: world.getDimension("the_end") },
    ];

    for (const { id: dimensionId, dim } of dimensions) {
        const claims = ClaimManager.getAllClaims(dimensionId as DimensionIdentifier).filter(
            (claim) => claim.allowMobs === false
        );

        for (const claim of claims) {
            const corners = ClaimUtils.getClaimCornersFromClaim(claim);
            const minX = Math.min(corners.topLeft.x, corners.bottomLeft.x);
            const maxX = Math.max(corners.topRight.x, corners.bottomRight.x);
            const minZ = Math.min(corners.topLeft.z, corners.topRight.z);
            const maxZ = Math.max(corners.bottomLeft.z, corners.bottomRight.z);

            const dx = maxX - minX;
            const dz = maxZ - minZ;
            const y = -120; /* covers all y */
            const dy = 320; /* covers all y */
            system.runJob(killBlacklistedEntitiesInClaim(claim, blacklistedEntities))
        }
    }
}```
#

here u go

#

u might want to yield less often

#

or based on time (as i do)

sharp elbow
#

There's a syntax error at const job = in killBlacklistedEntitiesInClaim

uncut lynx
#

such an ai answer

#

but yes

sharp elbow
#

There should be a better way to go about this than runCommand. What we're essentially looking for is collision detection, right?

#

I wonder if building some kind of quadtree/octree would be overkill for something like this

uncut lynx
# uncut lynx or based on time (as i do)

(i am not saying it is anything of a good advice.) for my complex calculations, i use time-based yielding:

...
const lastYieldTime = Date.now();
... 
// (in some loop)
if (Date.now() - lastYieldTime >= 10 /* ms, note up to 50ms per tick, so be considerate, depends on the workload */) {
  yield;
  lastYieldTime = Date.now();
...```
uncut lynx
#

i don't know much context about the problem

#

can you tell me in short?

sharp elbow
#

Does the job system have some sort of priority for its jobs? Like if the job system prioritizes executing older jobs before moving on to newer ones

uncut lynx
#

but u can be selfish and take e.g. 40ms for urself

#

by time based yielding

#

(as i do but we dont talk bout that)

sharp elbow
#

I worry that, if new jobs are added to the stack, it could prevent old jobs from ever completing. Certain claims could, in theory, never kill entities because of the order they are iterated in / of running "out of time" before that job gets its turn to continue

uncut lynx
uncut lynx
#

and still complete

#

with others

#

runnin too

#

also do i go full selfish and do 50ms for myself?

#

in the meantime

#

please inform me about the context

native patio
#

Maybe try using RunCommand

inland merlin
#

Don't use the async version of runCommandAsync use runCommand

#

If your using beta api

#

Stable can use runCommandAsync still i believe

halcyon phoenix
silver agate
#

Ok, thanks everyone

sterile epoch
#

is there a way to add lore to an item without having to scan the inventory and add it manually in a runInterval

woven loom
#

as long as u have the itemstack object u can

amber granite
#

Hello

full idol
#

I updated my behaviour pack a few days ago on a realm, and all the old dynamic properties are gone? Do they get cleared somehow?

distant tulip
#

they are linked to it

full idol
distant tulip
full idol
distant tulip
#

it was like this from the start

#

it is a good thing
you don't want other add-ons editing each other data

#

-# unless you do

full idol
distant tulip
#

well, that's odd indeed then

#

can you share your world?

full idol
#

Uhhh unfortunately not, it's a realm which is now too big to download

#

I really wish I could check the data

#

Maybe when removing the old version it deletes the dynamic property?

distant tulip
#

maybe get all the dp in the world and log them to see whats there

#

could be a corruption thing too, so maybe use a backup

full idol
#

I don't really have free access to do loads of testing which is a pain but I mean, if it's gone, I'll just have to be careful for next time.

#

Is it likely that removing a BP removes its dynamic properties?

distant tulip
#

not sure about that one

full idol
#

Alrighty, thank you

#

I'll test and see

distant tulip
#

@honest spear do you have any idea?
if a world had some dp and you removed the bp then loaded the world, do they get deleted or stay in case you re-applied it

full idol
#

I think the world file is multiple gigabytes at this point so corruption is very likely

honest spear
distant tulip
#

alright, i will keep that in mind to test it next time i can
thanks

halcyon phoenix
#

hello people I need help on importing my own libraries

I have 1.js that exports values and functions and 2.js that imports those values and function, how'd I do that? just Importing it doesn't work

#

it says native module error not found

#

I believe before I can just import it, did something change?

distant tulip
halcyon phoenix
#

oh wait it works now

#

my lib was so big I thought it just use basic stuff I forgot it has afterEvents too and I didn't import minecraft/server

#

it's all goods now

slate loom
#

Guys how to combine scripts without crashing them with each other

#

Because there is this weapons which are special specifically spartan weaponry some of the weapons can absorb damage apply damage when certain events are met and more but it's in different scripts and there's so many of them how will I combine them?

vast grove
#

You'll need to elaborate further by it's in different scripts and there's so many of them

full idol
#

I have no clue where else to ask this, but I feel like this is the smartest bedrock community I know of. Where do I report duplication bugs? Just stick it on Mojira? idk if they want sensitive bugs reported privately

sharp elbow
#

Any sensitive bugs will be marked as Private by a moderator.

#

Although I think there is the option to report a Private bug at the time of creation?

full idol
#

Thank you!

wary edge
#

Yes.

somber cedar
sterile epoch
#

like how do I add lore without a loop

cyan basin
#

does anyone know why my npm wont install my packages?

#

ive added a package json file to my directory with the latest beta packages but when running npm i in the console or vsc it just seems to keep loading and never installs

#

i just tried restarting my pc and just nothing is working with it anymore but was working earlier

chrome gyro
#
system.runInterval(() => {
    const dimensions = ["overworld", "nether", "the_end"];
    dimensions.forEach((dimension) => {
    const player = world.getDimension(dimension).getPlayers()
    player.forEach(players => {
    const entity = world.getDimension(dimension).getEntities({ families: ["cnb_ppl_entity"], })
    if (players.dimension.getBlock(players.location) == undefined) return;
    
    entitys.forEach(entity => {
            if (players.dimension.getBlock(entitys.location) == undefined) return;
            console.error(success)
        })
      })
    })
  })

So I have entities that need a command loaded from them once every tick, but the issue is that if two players get close to eachother they will end up increasing the load on the system 2x. Any ideas how to prevent it from having double the load?

scarlet sable
#

or used to be a thing at least

#

how did you do that btw?

steady canopy
#

Right now you can't drag items in mobile

#

Not sure if that was a feature before.

woven loom
#

in a loop

scarlet sable
#

Nah it 100% was

scarlet sable
#

Ty

thorn ocean
#

Alright, question. Is there anyway to translate an entity's typeId, insert it into a string and use it generally?

chrome gyro
thorn ocean
chrome gyro
#

If you post it I should be able to help better.

#

You should be able to put it in a string and add it to the lore, I've done this recently.

thorn ocean
chrome gyro
chrome gyro
#

I was using giveItem

#
system.runInterval(() => {
    const dimensions = ["overworld", "nether", "the_end"];
    dimensions.forEach((dimension) => {
    const players = world.getDimension(dimension).getPlayers()
        players.forEach((player) => {
            if (player.hasTag('dropitem')) {
            const entitys = world.getDimension(dimension).getEntities({ families: ["sheep"], })
            entitys.forEach((entity) => {
                const entityid = entity.typeId
                const loc = entity.location
                    giveItem1(player, "minecraft:stick", loc, dimension, `${entityid}`);
                    player.runCommandAsync(`tag @s remove dropitem`);
                })
            }
        })
    })
})


function giveItem1(player, itemId, loc, dimension, lore) {
    const { container } = player.getComponent('inventory');
    if (container.emptySlotsCount === 0) return;


    const newitem = new ItemStack(itemId, 1);
    newitem.setLore([
        "Captured " + lore
    ]);
        system.run(() => container.addItem(newitem) );
}

Idk if this helps, but this is how it works with addItem

#

@thorn ocean

scarlet sable
#

my addon randomly doesn't work

#

no errors no changes

#

literally just relogged

chrome gyro
#

Is spawnItem experimental?

scarlet sable
chrome gyro
# thorn ocean Well this is what I had currently: ```let name = ''; name = "%entity." + ent...
system.runInterval(() => {
    const dimensions = ["overworld", "nether", "the_end"];
    dimensions.forEach((dimension) => {
    const players = world.getDimension(dimension).getPlayers()
        players.forEach((player) => {
            if (player.hasTag('dropitem')) {
            const entitys = world.getDimension(dimension).getEntities({ families: ["sheep"], })
            entitys.forEach((entity) => {
                if (entity.dimension.getBlock(entity.location) == undefined) return;
                const entityid = entity.typeId
                const loc = entity.location
                const lore = `${entityid}`
                const newitem = new ItemStack("minecraft:stick", 1);
                newitem.setLore([
                    "Captured " + lore
                ]);
                entity.dimension.spawnItem(newitem, loc)
                    player.runCommandAsync(`tag @s remove dropitem`);
                })
            }
        })
    })
})

Oh I was using location, not what was executing it XD. Here this should work.

chrome gyro
#

How do get you get variables from a function? I have a bunch of scoreboards I'm constantly getting numbers from that I want to make available everywhere.

#

return?

sterile epoch
chrome gyro
#

Thanks, then presumably I would have to unpack it on the other side with [#]?

sterile epoch
#

?

chrome gyro
#

It's a group of scores, not just one, just trying to figure out how I would separate them after it returns them

sterile epoch
#

you can have a getScore function like this:

export function getScore(target, scoreboard) {
  try {
    return world.scoreboard.getObjective(scoreboard).getScore(target);
  } catch (e) {
    console.warn(`Error in getScore for ${target?.name ?? target}, ${e}`);
    return 0;
  }
}

and then use it like this:

import { getScore } from "./file path";

const kills = getScore(player, "kills");
if (kills > 5) {
  //...
}
chrome gyro
#
function getscores(
        //time
        const timeobj = world.scoreboard.getObjective(`time`);
        const time = (timeobj?.getScore('variableholder') ?? 0);
        //time2
        const time2obj = world.scoreboard.getObjective(`time2`);
        const time2 = (time2obj?.getScore('variableholder') ?? 0);
        //time3
        const time3obj = world.scoreboard.getObjective(`time3`);
        const time3 = (time3obj?.getScore('variableholder') ?? 0);
    return (time, time2, time3)
)

...where im refferencing it
        const gettimescores = getscores()
          const time = gettimescores[0]
          const time2 = gettimescores[1]
          const time3 = gettimescores[2]

Does that makes sense?

#

Can I grab them all as a group though?

sterile epoch
#

yes, let me modify it real quick

chrome gyro
sterile epoch
#
export function getScore(target, scoreboard) {
  if (Array.isArray(scoreboard)) {
    return scoreboard.map(obj => {
      try {
        return world.scoreboard.getObjective(obj).getScore(target);
      } catch (e) {
        console.warn(`Error in getScore for ${target?.name ?? target}, objective: ${obj}: ${e}`);
        return 0;
      }
    });
  }
  try {
    return world.scoreboard.getObjective(scoreboard).getScore(target);
  } catch (e) {
    console.warn(`Error in getScore for ${target?.name ?? target}, ${e}`);
    return 0;
  }
}

usage example:

const [time,time2,time3] = getScore(player, ["time", "time2", "time3"]);
#

sorry that took so long typing on mobile takes ages

chrome gyro
#

haha no problem... ok going to take me a sec to unpack this. Awesome.

chrome gyro
sly valve
chrome gyro
sly valve
#

So they shouuldnt be undefined

chrome gyro
#

Ok, that's good. I must have missed something when passing it over to the function. Thank you!

sly valve
#

Maybe try debugging

#

Basically adding some console.logs over the code

chrome gyro
#

I'll probably do that in the function. I think that's probably where it's disconnected.

sly valve
#

Like

function someFunction(arg1) {
  console.log(`${this.name} got called with input: ${this.arguments.join(", ")}`);
}
chrome gyro
#

Nice, Coddy showed me I can also use console.error() and pop in the variable. Does this give more info?

sly valve
#

Well info, error or warn, wont really change the shown content

#

But yes

#

You can use warn/error

chrome gyro
#

Oh! wow I'm dum... I found it:

sly valve
#

And show any content you have, or just a wimple text to be sure that its even getting called

sly valve
chrome gyro
#
export function getscores(itemname, scores) {
...
//scores got here
...
                    if (Array.isArray(scores)) {
                        return scores.map(obj => {
                          return[ time, time1, time2 ]
                          //^^^^ Forgot the second return
}
#

Getting the full container now

sly valve
#

Yes you did, if scores is not an array, it will return undefined

#

And the second return ofc

chrome gyro
#

All the variables are passing over thankfully. Oh yeah, no worries I have that setup right too, with "" around all the variable names. Thank you for helping!

sly valve
#

Btw of you ever use TS, this mistake wont happen again

full idol
#

How do you make the semi-transparent walls I've seen in some addons which are used to indicate areas or locked areas? Sorry for the bright screenshot, this is all I got

chrome gyro
halcyon phoenix
#

do we have a built in method to scan blocks in a chunk?

distant tulip
hidden orbit
#

is chatsend event still in beta?

halcyon phoenix
distant tulip
distant tulip
halcyon phoenix
#

Thanks a lot Minato🫑

distant tulip
#

np
you can just do
{from:vec3, to: vec3}

halcyon phoenix
#

how would you store an array in a dynamicProperty? stringify and parse?

steady canopy
#

that's how you do it

#

same for objects

halcyon phoenix
#

alright

#

it's fine to an array that might contain more than 1000 variables right? array[1000]?

ivory bough
#
system.runInterval(() => {
    const tbsEntities = [
        "space:null",
        "space:integrity",
        "space:the_broken_end",
        "space:herobrine",
        "space:far_away",
        "space:no_texture",
       "space:nothing_is_watching",
        "space:hetzer",
        "space:r2",
        "space:circuit",
        "space:sub_anomaly_1"
    ];

    tbsEntities.forEach(type => {
        const entities = overworld.getEntities({ typeId: type });
        if (entities.length > 1) {
            const entitiesToDespawn = entities.slice(1);
            entitiesToDespawn.forEach(tbs => {
                tbs.triggerEvent("despawn");
            });
        }
    });
});

Why does this trigger event on all entities?

steady canopy
ivory bough
#

Nvm my brain isn't working properly

halcyon phoenix
steady canopy
amber granite
#

My bad

loud bone
loud bone
cyan basin
#

don't we love trying to use the @minecraft/ packages on bds and it doesn't want to work πŸ’€

#

doesn't matter where I place them it wants to cry about events not being there or HttpRequestMethod not existing :/

wary edge
cyan basin
#
{
  "dependencies": {
    "@minecraft/server": "^2.0.0-beta.1.21.84-stable",
    "@minecraft/server-admin": "^1.0.0-beta.1.21.84-stable",
    "@minecraft/server-net": "^1.0.0-beta.1.21.84-stable",
    "@minecraft/server-ui": "^2.0.0-beta.1.21.84-stable"
  }
}```
#

Got them all installed.. I tried on the root of the server and inside the Behavior Pack itself and neither want to work

wary edge
#

What does the intellisense error say?

cyan basin
#

I just have these errors for my code but nothing else so far.. and the HttpRequestMethod wants to use the actual one of POST, GET, etc. instead of .Post, .Get, etc.. but when I go to the before events it shows playerPlaceBlock in there :/

#

I've tried restarting vsc and even my pc after installing the packages and it just wants to be weird about it

wary edge
#

The npm packages dependencies might be outdated that you need to add an override.

cyan basin
#

Outdated? I'm grabbing all the latest ones from npmjs though.. shouldn't it just work out of the box?

wary edge
#

If that works then the issue is the other packages.

cyan basin
#

okay yeah i just installed them fresh and that seemed to have fixed it. for some reason the server package was originally being installed with an rc version of 1.21.9. after removing them all its now installing as the correct version

#

just weird since the package json has the versions in there so it should grab what its finding not installing some weird version of the preview.. even since it's labeled -stable

uncut lynx
#

DUH i spent 2+ days just getting large cogwheel perpendicular meshing right

#

yes, i've tried ChatGPT, Claude.AI, Gemini, DeepSeek, they just give bunch of crap

full idol
north frigate
#

imagine using c++ with script api

uncut lynx
dawn zealot
#

havent done this in a minute, but how do i test for the player has actually loaded into the server/world/realm

prisma shard
dawn zealot
#

im just trying to open a UI

prisma shard
dawn zealot
#

i mean for each individual player

#

each pklayer that joins mb

prisma shard
#

uhh or maybe playerSpawn

dawn zealot
#

im using that, but that doesnt detect them loading in

prisma shard
prisma shard
#

noooooo

dawn zealot
round bone
#
import { world } from "@minecraft/server"

world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
    if (!initialSpawn) return

    form.show(player)
})
dawn zealot
#

yea but that doesnt open the menu when they have loaded in

round bone
#

just show a form to a player

dawn zealot
#

yeah. i did

round bone
#

can you show me your code?

dawn zealot
#
world.afterEvents.playerSpawn.subscribe((data) => {
    const player = data.player;
    if (!data.initialSpawn) return

    world.sendMessage(`Β§7Welcome back Β§f${player.name} Β§7to Β§fΒ§kWΒ§r Β§bBreeze Β§3PvP Β§fΒ§kW`)
    player.runCommand(`scoreboard players add @s season_one 0`)
    player.teleport({ x: 1000, y: 69, z: 1000 }, { facingLocation: { x: 1000, y: 69, z: 999 } })

    rules(player)

    if (getScore(player, "season_one") == 0) {
    }
})
#

ignore the runcommand

#

that will be native soon lmao

prisma shard
#

Does that message send

dawn zealot
#

yeah

round bone
prisma shard
#

Then that's issue of your form

dawn zealot
# round bone can you show me `rules` function?
import { ActionFormData } from "@minecraft/server-ui";

export function rules(player) {
    const form = new ActionFormData()
        .title("Welcome back!")
        .body("Β§ltest")
        .button("understood!", "textures/items/writable_book")

    form.show(player).then(response => {
        if (response.canceled) return;
        switch (response.selection) {
        }
    });
}
prisma shard
#

Yeah okay

round bone
#

everything is okay in this code

#

are you importing rules to the file that listener is in?

prisma shard
#

moreover do you get any errors

dawn zealot
#

nope

dawn zealot
#

i jus tthink it cant show because the player isnt loaded in yet

prisma shard
#

I m not into forms ui stuff so I can't tell about the rules functions lol

round bone
#

you can use forceShow function instead a regular show method

prisma shard
#

Yep

dawn zealot
round bone
#
import { FormCancelationReason } from "@minecraft/server"

export const forceShow = async (player, form) => {
    while (true) {
        const responseData = await form.show(player)
        if (responseData.cancelationReason !== FormCancelationReason.UserBusy) return responseData
    }
}
dawn zealot
#

eh

prisma shard
#

A force show form example

dawn zealot
#

how am i gonna forceshow it if its not even showing in the first place

prisma shard
#

mhh

valid ice
#

Force show keeps attempting to display it to the player until they are not busy

#

playerSpawn event fires when the player loads in, but that doesn't mean the UI is fully loaded, so the player is considered "busy" when the form gets canceled

dawn zealot
sick robin
midnight crane
#

I want to make it so if your holding a specific item and you hit an entity it runs a command

sick robin
dawn zealot
#

i got it working already but ty

sick robin
midnight crane
sick robin
fading sand
#

Is there any way to make an event run when the environent light level changes without running an script the whole time?

#

And without player json ofc

chrome gyro
full idol
#

Ah, it does need to be very big

#

Marking out huge areas

#

Particle outlines aren't ideal

leaden elbow
#

how to force close ui in server ui

scarlet sable
#

how do custom components work?

wary edge
full idol
# chrome gyro Sorry I meant geo, could be an entity Geo but the problem with that is it doesn’...

I'm not too sure, this is the rough thing, except it doesn't necessarily need to be a box. https://youtu.be/mt00Eu6TRt4?si=Ws_a0aUH8JgaJYhm&t=156

This is a Minecraft Marketplace Add-On called Land Claims by Cubical. It costs 660 Minecoins. This is a showcase with no commentary.

Protect your builds, maximize security and log off safely with the Land Claims Add-On!

  • Create LAND CLAIMS and EXTEND them when your builds get bigger for additional security
  • INVITE FRIENDS and assign diffe...
β–Ά Play video
#

It looks like just a flat plane

wary edge
#

Yeah it's likely just an entity.

full idol
wary edge
#

It's just using an animation likely.

scarlet sable
wary edge
full idol
scarlet sable
#

is it possible to make a block that can update itself with custom components

wary edge
scarlet sable
#

Because I'm trying to make functional custom walls

#

But they need to self update if that makes sense

#

Using the api to update them doesn't work as entendes

wary edge
#

I need more elaboration but that sounds like using onTick to check every tick for certain conditions then do stuff.

scarlet sable
#

Is there any documents about the onTick?

wary edge
chrome gyro
wary edge
full idol
# wary edge Yes.

Sorry, do you have any recommendations for which docs to check for this?

wary edge
full idol
#

Alright, thanks

leaden elbow
#

how to force close UI

marsh pebble
leaden elbow
leaden elbow
#

oh

#

okay then thanks

marsh pebble
#

@leaden elbow

#

wait

#

arent u that one json ui person from realm hub

#

i saw your post earlier today lmao

leaden elbow
#

yep lol

#

im not into scripting anymore and im practicing to make an ingame loading screen

marsh pebble
#

i only know c# .ps1 css and html

leaden elbow
#

thats why i wanna force close server form

marsh pebble
#

js is too hard

#

ANMD JSON

#

IO HATE JSON

leaden elbow
#

json is tuff

#

no cap

#

too complicated

marsh pebble
#

can we go to dms rq

leaden elbow
#

kk

distant tulip
#

anyone played around enough with custom command? am i missing something in this? or do you have any suggestions?

woven loom
#

u should add desc to perms levels

#

and theme looks like lm studio xd

distant tulip
#

it doesn't have one? it is just a number

woven loom
#

ye

distant tulip
#

why should it have desc

distant tulip
granite badger
wheat condor
distant tulip
#

it doesn't really matter, but i think you should have used the enum after registerEnum in your example, i was looking for where you used it after that but i found it before, kinda weird imo

prisma shard
distant tulip
#

streak?, It's been a while since i made anything πŸ˜…

prisma shard
#

anyway

wheat condor
#

?,

distant tulip
#

ok, shut up

wheat condor
#

i found that funny

prisma shard
#

😭 bruh

distant tulip
#

it kinda is, lol

wheat condor
#

remembers me of how my dad types

distant tulip
#

πŸ‘

prisma shard
safe stream
prisma shard
wheat condor
#

this is getting off topic i feel the SmokeyStacks aura getting near this chat

distant tulip
prisma shard
#

what...

#

Doesn't it have a callback

wheat condor
#

yes?,

safe stream
#

yeah

prisma shard
#

() => {

}

safe stream
distant tulip
#

that is what the function for

wheat condor
#

we KNOW what a callback is

wheat condor
prisma shard
#

I mean like you can add a box where a specific function will run if the command is ran

wheat condor
prisma shard
#

And it will generate code like
() =>{
theFunctionUserWantedToRun()
}

prisma shard
distant tulip
#

actually, no it is a bad idea
-# i am lazy

prisma shard
#

hahahahaha ok

wheat condor
prisma shard
#

it's so hot cya gys

wheat condor
prisma shard
wheat condor
#

what's the temp?

#

temp is short for temperature for whos new to the chat

prisma shard
#

temp leak

#

xd d x dxdxs xd

#

calc is sort for calcium for who is new to chat

distant tulip
#

35Β° c
a bit cold

slate loom
#

Can I ask something what is the language for script API?

distant tulip
#

javascript

prisma shard
wheat condor
#

34Β°C

slate loom
prisma shard
wheat condor
#

minato is near me

distant tulip
distant tulip
prisma shard
#

Is morroco near Italy? (Can we move to offtopic )

prisma shard
#

ah oka

#

I am the one who lives apart further away from everyone πŸ˜”

#

πŸ₯€ .

prisma shard
distant tulip
slate loom
#

Who from philipines here?

wheat condor
prisma shard
distant tulip
#

most people are

slate loom
#

Wait who is coddy sorry?

wheat condor
distant tulip
slate loom
#

@dim tusk is this him? Sorry for ping

prisma shard
#

Bruh yes

distant tulip
#

he said he is having a hard time

prisma shard
#

ig

slate loom
#

Ohhhhh is he a super great scripter?

prisma shard
#

not than Minato

#

xd

distant tulip
#

he is

wheat condor
#

holy glazer

dim tusk
#

Yes?

prisma shard
#

YOOOOO

#

What

#

What

slate loom
#

Oh no

slate loom
prisma shard
wheat condor
#

finest is the minato's n1 fanboy

dim tusk
prisma shard
#

He from Philippines I think

#

thats why lol

slate loom
#

We're just messaging

wheat condor
#

good reason for pinging

dim tusk
#

Aww... Okie.

slate loom
#

I'm very sorry

dim tusk
#

Nah that's fine, I rarely open my DC now

distant tulip
dim tusk
#

I still code tho not just javascript anymore, I moved to C++ rn

distant tulip
prisma shard
wheat condor
#

no one glazing me for making some really good script resources

dim tusk
distant tulip
wheat condor
#

jk it was becouse finest was glazing you

distant tulip
#

ok, yeah you actually have some great stuff there

dim tusk
#

So any good stuff rn?

wheat condor
dim tusk
#

I read the changelog and docs but not really making scripts

dim tusk
distant tulip
#

applyimulse for player

#

hmm

dim tusk
wheat condor
#

custom commands, startup and shutdown events, a LOT of new methods for functions

dim tusk
dim tusk
wheat condor
#

hungerbar editing

dim tusk
distant tulip
#

fov_set

wheat condor
dim tusk
#

I'll be reading docs and changelog again if I have time...

#

goodbye again, just tag me again to summon me...

distant tulip
wheat condor
#

bruh

#

what a scam

distant tulip
distant tulip
dim tusk
distant tulip
#

nope

wheat condor
dim tusk
#

damn, to those people I gatekeep because of my situation... I'm sorry lol

wheat condor
#

client side scripts for camera, interface, animations, textures, would be the best thing mojang can add

distant tulip
#

imagine we can attach camera to anchor

slate loom
#

How do u guys even make scripts?

dim tusk
wheat condor
slate loom
#

Like genuinely how is there a app dedicated to doing that?

distant tulip
#

you are on pc or phone

dim tusk
slate loom
dim tusk
#

I don't use Vscode tho lol, I use notepad++

slate loom
wheat condor
dim tusk
distant tulip
slate loom
wheat condor
dim tusk
#

Oh wait Minato remember I made a plugin for notepad++ to have auto completion for scripts like vscode?

wheat condor
#

if you re a noob and you dont want to waste time setupping things bridge is better

slate loom
dim tusk
distant tulip
#

can't find dingsel post

dim tusk
#

As an app itself? No, but as a website yes

dim tusk
wheat condor
#

minecraft bedrock camera is so bad, its so static \

#

it used to move when you pressed jump now it doesnt

dim tusk
#

byeee guys see you again. I'll be on hiatus again.

slate loom
#

Why does Mojang doesn't want to add script API already and no beta api

wheat condor
#

bye coddy

halcyon phoenix
#

what's the difference of setDynamicProperties and setDynamicProperty?

dim tusk
wheat condor
dim tusk
dim tusk
halcyon phoenix
#

how do I do the multiple one? ({id, value}, {id, value})

#

I see

#

thanks

#

it's helpful I guess

#

it doesn't bloat my script with repeatitions

dim tusk
wheat condor
dim tusk
#

It is still like property just that you don't make multiple ones.

slate loom
#

Bro is still a pro even if he changed language

prisma shard
dim tusk
#

If you check my old messages

#

I help a lot of people like every day not exaggerating

slate loom
prisma shard
#

coddy said 2 times 'bye' but still messaging, which means coddy wants to stay with us for a while 😭 don't leave us

slate loom
dim tusk
#

You need to learn without relying that much on others.

dim tusk
#

I mean by asking too much sorry

#

Especially if people don't know the answer, that's where back reading comes in.

dim tusk
#

a lot of things changed so my old scripts might be unreliable but you can still ask here for clarification.

native patio
#

Okay

halcyon phoenix
#

how do I use script debugger?

wheat condor
true isle
scarlet sable
#

yep

#
const TickComp ={
    OnTick(event){
         wall_Manager.updateWallsAround(event.block)
    }
}

world.beforeEvents.worldInitialize.subscribe(({ blockComponentRegistry }) => {
  blockComponentRegistry.registerCustomComponent(
    "grass:custom_wall",
    TickComp
  );});
#

is this right?

#

because it doesn't work

open urchin
#

onTick, not OnTick

scarlet sable
#

typo

#

nice it actually works

halcyon phoenix
#

what's one way to get a chunk location?

#

I want to iterate from the player.location

halcyon phoenix
#

it's fine now

remote oyster
bold stratus
#

how to cancel player attack to any entity with script?

halcyon phoenix
#

no event for it

bold stratus
#

so how do I cancel it if there no event for it?

prisma shard
#

There is no beforeEvent for entityHutEntity

#

No way to cancel hits with scripts

true isle
scarlet sable
#

If you use after and before events weird glitches pop up

#

And you'll have to make systems that check every vertical and horizontal axis

#

It's just too laggy

fickle kiln
#

Finding who can make a good scripts like expert I can paid weekly depend of how much money per hour like 10$-20$ per hour

grand needle
#
const blood = offHand.typeId.replace("occultismus_arcanus:blood_bottle", "");
           
            if(item?.typeId === "occultismus_arcanus:needle" && offHand?.typeId.startsWith("occultismus_arcanus:blood_bottle")){
                
            
                const bloodUpdate = new ItemStack(`occultismus_arcanus:blood_bottle${String(Number(blood) + 1).padStart(2, "0")}`, 1);
                equippable.setEquipment(EquipmentSlot.Offhand, bloodUpdate);
                console.warn("New item:", bloodUpdate.typeId);
            }

Does anyone know why the item doesn't change?

gilded shadow
#

also make sure it has privileges if that codes runs on read only tick

#

system.run(callback)

grand needle
gilded shadow
#

oh okay

halcyon phoenix
#

is it possible to manipulate the text displays/ nametag? such as size, orientation and background color

fallow minnow
#

Nope

halcyon phoenix
fallow minnow
#

you can fully redo it if u want

#

like

#

use particles or something

#

or an entity

#

and put it above the thingy u wanna do

halcyon phoenix
#

does setDynamicProperty cleara all or just adds it?

#

they are both the same right? the setProperty and the setProperties

granite cape
prisma shard
#

uhh what is a enum in slash comand

#

never used it

#

i just undertstand parameters

#

but what does a enum do

sterile epoch
# prisma shard but what does a enum do

it's like custom parameters.

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

system.beforeEvents.startUp.subscribe(({ customCommandRegistry: c }) => {
  c.registerEnum("example:warp_locs", ["spawn", "shop", "idk"]);

  c.registerCommand({
    name: "example:warp",
    mandatoryParameters: [
      {
        type: CustomCommandParamType.Enum,
        name: "example:warp_locs"
      }
    ]
  }, (dontcare, warpLoc) => {
    if (warpLoc === "spawn") {
      //...
    }
  });
});

for example

nova flame
#

could someone help me please lol

sterile epoch
prisma shard
nova flame
#

i would call it a problem its just a lack of knowledge

#
const plotSpot = player.getDynamicProperty('islandPosition')
                        world.structureManager.place("server:island3", player.dimension, plotSpot);```
#

how would i make the structure appear 3 blocks away from plotspot

#

like the way ~~~ works in commands

little hull
#

is this possible? can someone help me how to do it

sterile epoch
#

offset the coordinates, like

const { x, y, z } = player.getDynamicProperty("islandPosition");

world.structureManager.place("server:island3", player.dimension, { x: x+3, y: y, z: z }); // or whatever coordinate you're offsetting
halcyon phoenix
#

why json? I meant on script

distant gulch
#

With player interact with block event(i forgot the name) can you cancel the event? Like if i have a end portal and i activate it it counts as a interaction

nova flame
#
function createLeaderboardMenu(player) {
    const form = new ModalFormData();

    form.title('Β§f-=- Β§dLeader Boards Β§f-=-Β§r');
    form.textField('Β§dDisplay Name:Β§r', 'e.g. Β§d-Money-Β§r');
    form.textField('Β§fScoreboard Variable To Display:Β§r', 'e.g. Money');
    form.slider('Β§dThe amount of time measured in game ticks it the leaderboard pauses between updating Values\nΒ§d( Β§fThe lower The Laggier! Β§d)Β§r\n\nΒ§dRefresh TimeΒ§r', 20, 1000, 20, 200);
    form.slider('\nΒ§dThe amount of score the player needs to be included on the leaderboard\n( Β§fThe lower the laggier!Β§d )Β§r\n\nΒ§dScore BufferΒ§r', 0, 20, 1, 10);
    form.submitButton('Β§dApplyΒ§r');```
#

anyone know whats wrong??

#

line 45 is the first form.slider btw

knotty plaza
nova flame
#

dang it

#

@knotty plazawould you know what i have to change?

knotty plaza
nova flame
#

thanks man

little hull
#
system.runInterval(() => {
  for (const player of world.getAllPlayers()) {
    if (player.hasTag("logic_done")) continue;

    const traumaScore = getScore(player, "Trauma");
    const daysScore = getScore(player, "Days");

    if (traumaScore >= 100 || daysScore >= 7) {
      player.teleport(fixedSpawnLocation, world.getDimension("overworld"));
      player.runCommandAsync("structure load smile ~-16.5~-2~-16.5 0_degrees none true");
      player.addEffect("darkness", 2, { amplifier: 255, showParticles: false });
      player.runCommandAsync("function movenot");
      player.playSound("laugh", { volume: 1.0, pitch: 1.0 });
      player.addTag("finalDay");
      player.addTag("logic_done");
    }
  }
}, 20);```i wanna create a random 20 blocks ofset in the fixed spawn location like everytime the any player fullfills the condition the the fixed position will move 20 blocks randomly right or left or back and forward i wanna save it through a scoreboard so that the offset will keep increasing like 40 to 60 etc. is that possible cause i dont want the player generating an arena and boss overlapping at each other
night acorn
#

this is the 99999th message in this post

sharp elbow
#

And you are approximately the 30th person to have said that!

#

It's a bug with Discord's client. I guess it refuses to count beyond 100,000 messages in a given thread.

wary edge
vast grove
#

Chance. It sometimes says that. It sometimes says the other.

lyric kestrel
#
world.beforeEvents.playerPlaceBlock.subscribe(e=>{
    console.log("working");
    
})```
#

Anyone know why I'm getting the error "cannot read property subscribe of undefined"

#

Apparently playerPlaceBlock is undefined?

#

hmm, I guess there's no beforeEvent for it?

#

I'm confused because the autocomplete showed there was

#

It works fine with afterEvents

lyric kestrel
#

ah, I thought I was on beta API

#

Had to recheck

#

Thank you

meager zenith
#

is ItemStack.hasTag() broken?

#

it returns false everytime

meager zenith
#
world.beforeEvents.itemUse.subscribe(fr => {

  const food = fr.itemStack;
  const player = fr.source;

  console.warn(food.getTags())
  console.warn(player.hasTag("origins:vegetarian_custom"))
  console.warn(food.hasTag("is_carnivore_food"))
});
wary edge
meager zenith
#

yep i did food.getTags().includes()

#

let me try with a namespace

#

still the same result

distant tulip
#

getTags and log the result to confirm

wary edge
open urchin
#

it works

meager zenith
#

yea that's the first console.warn is for unless warn and log are diff somehow

open urchin
#

if no namespace is given to hasTag then it assumes minecraft:

#

as long as you specify a namespace it will work

meager zenith
open urchin
#

send the script

meager zenith
#

oh wait

#

ok i forgot to change the actual warn func

meager zenith
open urchin
#

btw how would is_carnivore_food differ from the vanilla is_meat tag

meager zenith
distant tulip
#

scriptevent

valid ice
#

system.currentTick "pauses" when the game isn't running, yes? Like if the world is not being played or the game is paused?

prisma shard
valid ice
cyan basin
#

Could you technically make a "paused for ..." timer if you wanted to?

#

Or do scripts also completely stop running?

#

Like when you unpause it says in chat or something "You were paused for 23 minutes and 17 seconds" Shrug

#

Seems pointless but why not lmao

wary edge
prisma shard
glacial widget
#

Is having a few non repeat commands in your world bad?

sterile epoch
#

and this was 255 of each, so commands really aren't that laggy in general

cinder shadow
#

when logs have "minecraft:logs_that_burn" as a tag but planks don't have "minecraft:planks_that_burn" πŸ˜”

vast rune
#

how can i check for consecutive entity interactions? for example, if i interact with an entity, itll be first, and then if i interact with another entity that will be the second

wary edge
vast rune
#

i thought of nesting playerInteractWithEntity but that doesnt work

halcyon phoenix
#

is it possible to manipulate the UV of a particle through script via variables?

#

are particle variables molang queries?

halcyon phoenix
#

welp

#

I did some research and I cam to a conclusion that it's impossible

rare dawn
#

I want to be taught the script API πŸ˜…

vast grove
#

learn JS

honest spear
#

real

wintry bane
#

Getting data using tags vs getting data using an object

#

What's better?

#

The object can be updated using Jigarbov's "add-on payload ecosystem", it's just a const in this example.

vast grove
#

object, unless you want something other than script api to access it.

halcyon phoenix
#

can RC be manipulated through script?

granite cape
#

i wanna make better faction

vast grove
#

What?

granite cape
#

i mean essentials, I don't know how many times I failed to make essentials addon

worldly heath
#

is it possible to detect lightlevel using scripts only? or do I need environment_sensor

little hull
#
const playerName = player.id;
      player.dimension.spawnEntity("mz:smile", player.location, {
        tags: [`owner_${playerName}`],
      });```   is this the correct way of adding a specific tag to the entity spawned?
knotty plaza
rare dawn
sharp elbow
#

@rare dawn Here's the bullet point breakdown of what I recommend learning:

  • First understand that JavaScript is a bizarre, hybrid language that incorporates many different patterns. There's a hundred ways to do a thousand thingsβ€”everyone will do things slightly differently. You should focus on writing straightforward, easy-to-understand code, even if everybody else criticizes you for being "too verbose".
  • Come to understand some basic JavaScript concepts:
  • Come to understand that the Scripting API is structured around an object-oriented pattern.
    • Making changes to the world almost always involves invoking a certain object method (function).
    • Accessing the object you want (e.g. an item in a slot in the player's inventory) involves using either a property or a method on an object to acquire another object. (e.g. world -> player -> inventory component -> container -> slot -> item).
    • Certain constructs will require creating class instances, like making new ItemStacks for setting items in an inventory.
#

And of course, study by reading other people's code. There are a ton of threads in this forum you can consult for reference; you might be able to find whatever problem you want to solve by just searching this forum.

#

After setting up the development environment, you'll want to start with doing something specific. Some easy ones I recommend are applying effects to all pigs every so often, and damaging the player when they begin sneaking.

woven loom
#

starter template js npx create-mc-bedrock

prisma shard
#

To be honest, the #1067535712372654091 needs a cleaning. It has become a mess. And now it's hard to find the most useful resources. Posts such as a Item Database is too useful. Why not pin them? Also deleting the posts that accidentally go for ask help in the channel in the resources channel.

woven loom
#

can u link them

#

i will delete it

prisma shard
#

Sure

prisma shard
woven loom
#

?/

#

i can lock too

prisma shard
#

Uh

#

idk..

woven loom
#

all the help threads should be deleted

prisma shard
# woven loom i can lock too

I mean.. sorry if I said something wrong bcz I am not a mod. But locking the post just remains the forum channel, deleting could be a best choice?

#

I mostly see them only being locked

woven loom
#

well thats not a channel for help anyway

woven loom
#

list them in one msg

prisma shard
#

ah mb ok

marsh pebble
#

no

#

but

prisma shard
#

It's sometimes hard to find the useful resources in a thousands of posts

woven loom
#

uh not sure about that

prisma shard
#

Alr. No problem no need pinning it

distant tulip
#

name your posts better
discord search is shit, but you can add some keywords to your title
that may help

woven loom
#

maybe we can have a single channel that reference good stuff and no one can chat in it

#

i mean post

prisma shard
#

good idea but really idk

woven loom
#

i think deleted all of them

turbid delta
#

does anyone know the standard things bots check on xbox profiles to mitigate crashers?

woven loom
#

if i missed any let me know

north frigate
#

does async work with scrip api?

prisma shard
north frigate
#

let's gooo

prisma shard
#

example of using async in events

vast rune
#

i have code that checks for entities in runInterval however i have a function which processes those entites and uses system.waitTicks(); my problem is, how do i wait ticks inside runInterval? or just are there other ways of accomplishing this?

#

also, i need to have the function constantly running

silent tide
#

Moved methods StructureManager.placeJigsaw and StructureManager.placeJigsawStructure from beta to 1.19.0
So does this mean that Jigsaws are stable now?

#

From the Bedrock Update 1.21.80 in May

prisma shard
vast rune
#

tysm

prisma shard
# vast rune tysm

I could be wrong so You should try it testing out, and also use runTimeout instead of await system.waitTicks or do .then() maybe

vast rune
#

k

steady canopy
#

Pinning a channel where all the good resources are briefly explained and the link to it.

woven loom
halcyon phoenix
halcyon phoenix
#

on molangVairableMap, what does setVector3 does?

#

is just a vairable that a particle can read?

halcyon phoenix
#

YES

remote oyster
distant tulip
#

People that there work didn't get included there will just fell like there work was a waste of time

woven loom
#

hmm

remote oyster
#

I only brought it up because it's a common practice I see on xda-developers and although it can be nice and convenient to have a central location for finding stuff, maintenance was not pleasant and it was only a matter of time until it died off and was no longer being managed.

woven loom
#

Many people can edit the post text if it is sent via a webhook or bot.

honest spear
#

I want to know more context, are you talking about #1067535712372654091 being dogsh*

#

I don't think that much stuff is bad in there, but i don't really check them daily

granite badger
#

Unfortuantly there isn't a balance between writing good quality code and letting everyone post whatever they want.

We used to maintain a GitHub repo that lets everyone with a GitHub account share their high quality code, but the entry requirement was a bit too strict and no one contributes now.

Second solution is to let everyone here post whatever they want in #1067535712372654091, and now people are complaining most resources there aren't useful.

woven loom
#

there are good stuff tho

granite badger
#

we should've had a repo that does this for minecraft addons instead lol

woven loom
#

hmm

remote oyster
distant tulip
#

the search can be weird sometimes tbh, it try to give you words close to your search and don't prioritize the words themself

people should just keep track of good posts in a text file or a private server

woven loom
#

discord search is shid ngl

untold magnet
#

hmm, how can i detect something using percentages?
like %50

#

-# im trying to detect the players health using percentages instead of numbers

woven loom
#

(Current value / max value) x 100

slow walrus
#

have a list that has like "verified" resources that you should look through first, and then if you can't find what you need there then you could checkout script-resources

untold magnet
slow walrus
#

that gives you their health percent

untold magnet
#

good ig

#

also,

#

how can i detect the thrown potion? like detecting the instant health potion

woven loom
#

Projectile

woven loom
#

??????????

#

how do i fix this

open urchin
woven loom
#

yes

open urchin
#

what's the entry set to in the manifest

woven loom
#

index.js

#

Every time I zip a file and send it to the computer, the game doesn't detect it

#

Why does it not detect it?

round bone
full idol
#

What's the best way to add orbital player spectating? It would be used on a realm to have an orbital camera following any player on the realm. Do I need to get the viewing player's character to follow, or can the camera go to chunks loaded by another player?

vast grove
#

Orbital camera code requires a bit of math to do but there are resources online that already have it written. As for going into unloaded chunks, no, you need to tp the player to the other player they're currently spectating in spectator mode or something

#

Chunks only load around the local player, other players cannot see another player's loaded chunks.

full idol
#

Alrighty! Thanks so much I'll give it a go

#

Oh, would it be like, really simple to just show exactly what the other person sees, like copy their first person instead?

final ocean
#

Hi

#

I have a bug I don't know how to fix

#

[Scripting][warning]-Error showing main menu: ReferenceError: Native function [ActionFormData::show] does not have required privileges.

native patio
untold magnet
wheat condor
valid ice
#

Anyone know how to get js errors to map to ts

ivory bough
#

Why does my script file not work in bds server? I added the file to development_behavior_packs and added its uuid to the world behavior_packs.json and the bds/valid_packs.json. but it still doesn't work. I even added an intentional error but it doesn't show

thorn ocean
#

Is there any tutorials on how to use custom components Version 2?

full idol
#

New version just dropped and I assume just switching 2.0.0-beta to 2.1.0-beta is the fix?

#

Can there not be an implementation to automatically work on update?

open urchin
#

that would probably result in people forgetting about the dependency and never updating the version from beta even when APIs become stable

full idol
# wary edge Wdym?

Like, on a realm, it's a pain to switch over packs when lots of people want to just hop right in to the new update. It'd be ideal if a pack could have a backup dependency which can be the new version when it's ready.

full idol
#

So you add 2.1.0-beta to the manifest, and it switches when the realm restarts for the new update

#

Beta is just so much better

nova flame
#

yo guys

#

how do i make this work backwards

#

i want it to only appear for those without the tag

#
if (player.hasTag("r:3:Β§eREBORN")) form.button
distant tulip
nova flame
#

thanks

#
const defaultRank = "Β§7Member"

world.beforeEvents.chatSend.subscribe((data) => {
    const currentRank = data.sender.getDynamicProperty("rank") ?? defaultRank;
    const message = data.message;

    world.sendMessage(`Β§8[Β§r${currentRank}Β§rΒ§8]Β§r <${data.sender.name}Β§r> ${message}`);
    data.cancel = true;
})```
#

What changed

#

worked like 20 mins ago

#

update broke it

distant tulip
#

beta api on?

nova flame
#

nope

#

lol

#

thanks

#

i thought everything that was beta in the previous version became base in the next

vast rune
#

wait does getState() still exist? i dont see it

fervent topaz
#

how do u make a command without namespace

open urchin
#

Namespaces are needed for add-on compatibility
If the name of the command without the namespace is not in use, an alias for the command will be registered e.g. /example:command can be written as /command
You shouldn't use the version without the namespace outside of chat

fervent topaz
open urchin
#

you can't

fervent topaz
#

bro this is so scuffed

full idol
#

Where are the patch notes for going between 2.0.0-beta and 2.1.0-beta? Looks like setGamemode changed

nova flame
#

anyone know whats up with transferPlayer after the nethernet thing was added

#

@granite badger Idk how u update ur docs so fast but thank you mate

#

Legend

cyan basin
glacial widget
#

Is anyone else getting the problem of where you cant jump and you float while walking. this new update?

fast wind
#

Where can you find the soundIds for dimension.playSound()?

#

My bad found them

somber onyx
#

hi, someone knows how to update this piece of script, it has not been working since the last update.
I found the line of the patch note but I can’t find the solution
@minecraft/server-admin Updated transferPlayer to support NetherNet transfers. It now takes either a hostname/port combination or a NetherNet ID

system.runInterval(() => {
    let allPlayers = world.getAllPlayers()
    allPlayers.forEach(p => {
        transferPlayer(p,"my ip", my port)
    });
})
open urchin
somber onyx
untold magnet
final ocean
cyan basin
#

Well that's how that would work.. if form.show() requires privileges then you do system.run(() => form.show())

untold magnet
#

hmmm, is it possible to make a sound playing and only one specific player can hear it?

#

just like music or something

wary edge
#

player.playSound

untold magnet
#

so none will ever hear the sound beside that player,

#

right?

#

good, ig..

#

anyways

woven loom
#

hey @distant tulip can you just disable the custom select widget by default. it mostly doesnt work, and is very annoying

old scarab
#

uhh I think I found a bug in the latest scripting

inland merlin
#

So many issues with "stable" in vv

old scarab
#

For some reason TransferPlayer is all messed up

#

I need help badly 😭

thorn ocean
#

I just flattened all the custom components, but now all my blocks have missing textures.

distant tulip
#

alr, i will see what i can do

distant tulip
#

should be done

lone thistle
#

Anti-dupe with scripts is now better with 1.21.90

untold garnet
#

is .isOp() gone in 2.1.0-beta?

#

it was in 2.0.0-beta

drowsy scaffold
distant tulip
inland merlin
#

Hmm try this,

system.run(() => {
    try {
        transferPlayer(player, { hostname: ip, port: port });
    } catch (error) {
        player.sendMessage(`Β§cTransfer failed: ${error.message}`);
        return {
            status: CustomCommandStatus.Failure,
        };
    }
});```

See if this helps
old scarab
#

I got it fixed

cyan basin
#

Is there actually any way of enabling experiments on servers without having to move the world to your game and then back?

#

Trying to enable the Beta APIs but it can be a pain to keep moving worlds back and forth to servers

woven loom
untold garnet
#

everyone can use /myCommand
but operators can use /myCommand edit

#

like that?

distant tulip
#

thanks for the feedback

woven loom
alpine wigeon
#

mojang screwed up fake chat commands

woven loom
#

?

alpine wigeon
#
world.beforeEvents.chatSend.subscribe((eventData) => {
    const player = eventData.sender;
    switch (eventData.message) {
        case "!gmc":
            eventData.cancel = true;
            player.runCommandAsync("gamemode c");
            break;
        case "!gms":
            eventData.cancel = true;
            player.runCommandAsync("gamemode s");
            break;
        default:
            break;
    }
});
woven loom
#

what happened

alpine wigeon
#

some error with 'subscribe'

#

[Scripting][error]-TypeError: cannot read property 'subscribe' of undefined at <anonymous> (lootgamerule.js:3)

[Scripting][error]-Plugin [Minecraft but I get a random item every minute - 1.0.0] - [lootgamerule.js] ran with error: [TypeError: cannot read property 'subscribe' of undefined at <anonymous> (lootgamerule.js:3)
]

#

what is it now?
do you know?

halcyon phoenix
woven loom
#

wierd

alpine wigeon
#

used to

halcyon phoenix
alpine wigeon
#

ahh nvm i figured it out

halcyon phoenix
#

what was the issue?

alpine wigeon
#

i'm not using 2.1.0-beta

halcyon phoenix
#

lmao

gaunt salmonBOT
tardy pivot
#

the bug for local coordinates in facelocation still exists for me

snow jungle
#

transferPlayer now disabled on realms?

snow jungle
old scarab
snow jungle
old scarab
#

i did?

snow jungle
#

):

old scarab
#

not on realms

wary edge
cyan basin
# old scarab yes

damn.. they're trying super hard to not allow players to join via realms huh?

ivory bough
abstract cave
#

How do i install npm packages into vscode?

vast grove
#

You use the terminal....

abstract cave
#

idk

vast grove
#

`Ctrl+``

#

Weird formatting

#

Ctrl+`

abstract cave