#Script API General

1 messages · Page 71 of 1

cyan basin
#

I think for the function you had mentioned you might want to try the worldLoad first.

heavy cairn
#

This is also not working
const overworld = world.getDimension("minecraft:overworld");

warped blaze
cyan basin
devout dune
#

Hey I am trying to run some logic on a delay, after world initialization. But ive had instances of players loading at different times, so the logic isnt always triggering.

#

just using this 120 tick condition. I know i could also use system.runTimeout?

#

I was hoping for something like onPlayerFullyLoaded

wary edge
woven loom
#

👍❤️

untold magnet
#

( my marketplace heads addon )

devout dune
#

Any ideas?

untold magnet
#

uhh, how am i going to use scoreboards to make my 2 separate addons work together?
my main thirst addon should detect the player scoreboard, that scoreboard will not be available until u activate both addons.

#

like the second addon will add the scoreboards,

#

hmm, lemme think about it a little bit

untold magnet
#

meh doesn't worth it.

round bone
unique acorn
#

oof

onyx lantern
#

how does it work that the parameter for the shoot() method decides both speed and direction of the projectile?

#

I'm trying to make an entity shoot a projectile towards it's target using scripts

#

and using their view direction doesn't work very nice, it just never hits the player

#

anyone has any clues on how to make this work?

oak lynx
#

try multiplying the view direction by the power you want to shoot with

drowsy scaffold
#

anyone know if there's a way to delay the time before an itemStack can be picked up? if you summon an itemStack currently you can just instantly pick it up

leaden elbow
#

how can i get the name of the entity with provided typeId? and also can it be used in custom mobs?

warped blaze
leaden elbow
#

yeah i guess

#

like for example

#

minecraft:cow returns Cow, while custom:mob returns Mob Name

#

just did split string but i dont think its an accurate mobname when it goes with custom mobs

warped blaze
#

on preview

#

last preview added .localizationKey property

leaden elbow
#

so that return its name?

warped blaze
onyx lantern
warped blaze
#

supposing cow is not undefined and is a valid entity

distant tulip
#

Is that a thing

frozen vine
#

Is it possible for me to use an item on a cake with a candle and instead of him eating the cake he lights the candle?

warped blaze
frozen vine
# distant tulip I guess

yes, it is possible to change this, the problem is that the action of eating happens, so I wanted to know if it is possible to kind of cancel it

distant tulip
#

Just cancel the block interaction

north rapids
#

is there any way to get the weather?

frozen vine
frozen vine
frozen vine
# frozen vine Yea

I think so, because an example of a trident here on the server uses this for one of the enchantments

distant tulip
north rapids
#

ok

unique acorn
north rapids
#

i guess i'll use the event

#

ty

#

I'm making a temperature system 💀

unique acorn
#

very cool

north rapids
#

when I finish I'll show ya

frozen vine
#

Enchantments have a component, is it possible to add them to items without adding the enchantment directly?

unique acorn
#

no

#

unless if you re-code the behavior they do

frozen vine
unique acorn
#

same thing, u need the component to add enchantmets to an item

#

unless if you

  1. re-code the enchantment
  2. use an nbt editor
frozen vine
#

oh yes, it's because looking at the files, the cart with tnt collects the fire aspect component, if it were possible to add this it would help me with my item

#

But, thanks

north rapids
#

try to use the entityHurt event to get the item and the cart. Then fire the event that make the cart ignite

granite cape
#

how to contribute scriptapi devepment?

sharp elbow
#

It's closed source. But if you want to see it improve:

  • Engage with the community, and encourage good coding practice and good behavior. Be humble, ethical, and educated, and always be ready to learn and teach.
  • Make and discuss suggestions. The API devs are in various communities, and on occasion they might poke their heads in and take inspiration from the userbase.
  • Fill out surveys. These go out every so often, and they are a great way to give feedback directly to Mojang.
viscid horizon
#

properties in an entity’s behavior file are connected to a dynamic property in a script correct?

viscid horizon
#

is there a way to?

wary edge
#

Just use the normal property method.

viscid horizon
#

i have a fake health system in a script that uses dynamic properties and i want to reassign the value of that property with the bp property in events

#

@wary edge ?

valid ice
granite cape
#

all need handle priviallage now😑

valid ice
#

I don’t really know how to visually show that

#

Dynamic properties are exclusive to scripts
Entity properties can be accessed in behaviours, scripts and resources

viscid horizon
valid ice
#

They are 100% not connected to each other

slow walrus
valid ice
#

Was persistence ever a problem?

modest oasis
#

hello Im new to scripting, does world.beforeEvents.entityHurt.subscribe exist? if not, what are alternatives

#

I want to cancel player attack on certain condition

distant tulip
#

in script api at least

shy leaf
#

can JavaScript Map store Entity?

#

or should i just use Set

distant tulip
#

they can store entities, yes

shy leaf
#

nice

#

what about WeakMap though? i forgot what it does

distant tulip
#

same, it is just like Map but with garbage collection

shy leaf
#

aye ty for the answer

distant tulip
#

np

#

actually, some function in Map don't exist in WeakMap

#

keep that in mind

shy leaf
distant tulip
#

alr

shy leaf
#

WELP

#

...should i just use entity's id instead?

#

actually, let me use Set for this...

distant tulip
valid ice
shy leaf
distant tulip
#

i guess that because weak map don't have these functions
.size, .keys(), .values(), .entries()

shy leaf
#

well damn

#

time to use ID then'

distant tulip
#

just remember to clean up the set

shy leaf
#

aaargh

#

ill just use Map then

#

.delete() should be enough for cleanup, right?

distant tulip
#

yep

shy leaf
#

alright

viscid horizon
#

wait a minute

#

i can just ditch dynamic properties and use regular old properties instead because they exist in script AND bp

boreal siren
#

How can you prevent a player from breaking a block on the territory, but the block that he himself placed could be broken?

patent bane
#

I'm trying to make an addon which makes items which have "reinforced" in their lore have a 10% to not lose durability when used to attack or mine. Is this possible in ScriptAPI? How can I do it?

fallen cape
#

Not the best solution, but ehh we have no other way to check which player placed the block

hybrid island
#

what happend to applyknockback

dim tusk
hybrid island
dim tusk
hybrid island
#

strength*

#

ok

#

ima try

dim tusk
# hybrid island ima try

Fromjs Player.applyKnockback(x, z, horizontalStrength, verticalStrength)intojs Player.applyKnockback({ x: x * horizontalStrength, z: z * horizontalStrength }, verticalStrength)

hybrid island
#

ok wait

prisma shard
warped kelp
#

Can Player.applyKnockback work on entities?

hybrid island
#

i cant seem to make it work

hybrid island
sterile epoch
#

im not good at regex, how would I go about only getting text between double quotes

hybrid island
#

maybe this will work

YOURVARIABLE.match(/["'](.*?)["']/g).map(m => m.slice(1, -1));
hybrid island
glacial widget
#

how would i cancel blocks dropping after block is broken?

unique acorn
distant tulip
woven canopy
glacial widget
glacial widget
#

Like a entity.kill()

warped kelp
distant tulip
unique acorn
distant tulip
#

yeah

oak lynx
#

preview today right?

distant tulip
#

yeah

shy leaf
#

i hope theres some good stuffs

oak lynx
#

getBlocks()

#

please please please

shy leaf
#

also just a question, does instanceof Player not count for SimulatedPlayer if theres no gametest module?

oak lynx
#

never used gametest

shy leaf
#

rip

cold grove
#

Yes!!!@shy leaf

cold grove
shy leaf
#

was that an answer to the

shy leaf
#

oh yeah

#

thanks

#

i thought you were cheering out of nowhere

cold grove
#

Missclicked and mentioned you instead of replying

onyx lantern
#

anyone know when custom components v2 are going to be released for stable?

wary edge
onyx lantern
#

I know

#

but like

#

is it going to be this year?

glacial widget
glacial widget
#

I mine coal are and coal still drops

wary edge
prisma shard
shy leaf
#

that sounds like a #1067869374410657962 question

#

though yeah, i do know how to

#

but its json ui so its also painful to do one

#

yeah give me a second

#

i made a resource pack that changes tooltip anims a few months ago

#

let me get the vanilla ui first, i forgot the default values

#

this should be better for knowing the anims

#

nice

boreal siren
prisma shard
#
  • runInterval expects a callback
  • world.getPlayers(), you don't need dimension there
  • you call a function like this ammoUpdate(), you didn't put the brackets
#
system.runInterval(() => {
  ammoUpdate()
}, 2);

function ammoUpdate() {
    const players = world.getPlayers();
    players.forEach(player => {
        let ammo = primaryammo.getScore(player);
        let maxammo = primarymaxammo.getScore(player);
        let helditem = player.getComponent('equippable').getEquipmentSlot('Mainhand').getItem();
        if (helditem) {
            let itemName = helditem.nameTag;
            system.run(() => {
                helditem.nameTag = `§r${itemName} §7(${ammo}/${maxammo})`;
            });
        }
    });
}
#

try this

#

does it show any error in game console

distant tulip
#

helditem is a copy of the item and not the actual item in your inventory

#

setItem

shy leaf
#

you already do get the actual item

shy leaf
#

since youre getting a new copy of the ItemStack from getItem()

distant tulip
#

setEquipment*

shy leaf
#

oh wait

#

yeah youre using equipment comp nvm

distant tulip
#

yeah, same thing but he is using the equipment component

broken dagger
#
player.runCommandAsync("execute as @s[tag=slot2] run scoreboard players set @s slot2 1");
broken dagger
unique acorn
#

runCommand()

broken dagger
glacial widget
prisma shard
glacial widget
# prisma shard ofc it does??!
world.beforeEvents.playerBreakBlock.subscribe(({player, block, itemStack,  cancel}) => {
   const inventory = player.getComponent("inventory").container
    
    if(block.typeId === "minecraft:coal_ore"){
        cancel = true

        system.run(() =>{
            block.setType("minecraft:air");
            const coal = new ItemStack("minecraft:coal_ore", 1)
            const coalPrice = items.get("minecraft:coal_ore")
            coal.nameTag = `§a$${coalPrice}`
            inventory.addItem(coal)
        })
    }
})
#

i cant define entity in this event

prisma shard
granite badger
#

hello to my script api docs users, do y'all want this search layout or prefer the current one?

glacial widget
distant tulip
unique acorn
granite badger
glacial widget
#

maybe type: [] is not the right syntax

distant tulip
#

remove []

glacial widget
unique acorn
#

just the part where you kill it

midnight ridge
#

how can i make the user cant throw an item?

glacial widget
timid zenith
#

I'm getting error in this

}).catch()

valid ice
#

Without any further context, one can only assume you are missing opening brackets

dim tusk
valid ice
#

You have an open } brace and an open ) brace

#

More context of your code would be nice

#

Showing ten characters and saying there's an error is extremely unhelpful

cinder shadow
#

are we able to get anything about what smithing templates were used on equipment via itemStacks? I'm not seeing anything

cinder shadow
#

🗿

#

well that's a problem

viscid horizon
#

hey so uh it keeps saying that the player doesn’t have properties even though it does

#

in my content logs

#

are there any requirements i need to meet or something

viscid horizon
dim tusk
#

Just send it here.

viscid horizon
# dim tusk Just send it here.

import { world, system, Player, Dimension } from '@minecraft/server';

const player = world.getPlayers()[0]; // player
const players = world.getAllPlayers()
const entity = world.getDimension('overworld').getEntities()

const scoreboard = world.scoreboard; // scoreboard

world.afterEvents.projectileHitEntity.subscribe((e) => {
const projectile = e.projectile;
const target = e.getEntityHit()?.entity;
const instigator = e.source;
const entity = world.getDimension('overworld').getEntities()

let targetHp = target.getProperty('fakehp');
if (targetHp === undefined) {
    world.getDimension('overworld').getEntities().forEach((entity) => {
        entity.setProperty("fakehp", 100);
    });
}

const playerScore = score.getScore(instigator);


let damage = 0;
if (projectile?.typeId === 'ata:buckshot') {
    damage = 100;
} else if (projectile?.typeId === 'minecraft:snowball') {
    damage = 20;
} else if (projectile?.typeId === 'ata:pissbullet') {
    damage = 25
}


if (team !== 2) {
    world.sendMessage("Friendly fire detected!");
    return; 
}


if (targetHp <= 0) {
    world.sendMessage("No health detected for the target.");
    return;
}


if (targetHp > damage) {
    target.setProperty('fakehp', targetHp - damage); // Apply damage to target
    instigator.onScreenDisplay.setTitle("§r+", {
        stayDuration: 3,
        fadeInDuration: 0.1,
        fadeOutDuration: 0.5
    });
} else if (targetHp <= damage) {
    target.setProperty('fakehp', 0); // Set target health to 0 (dead)
  
    instigator.onScreenDisplay.setTitle("§c-X-§r", {
        stayDuration: 3,
        fadeInDuration: 0.1,
        fadeOutDuration: 0.5,
        subtitle: "+1"
    });
    world.sendMessage(`${instigator.name} killed ${target.name}.`);
}

});

#

Also I ran testfor @e[has_property={ata:fakehp=true}] into a repeating command block and it didn’t return anything so that might be something too

dim tusk
#

Means your entity is the problem

#

Not your script.

viscid horizon
#

i mean yeah cuz the player.json has properties but the game says otherwise

#

it says it doesn’t have any properties

dim tusk
#

if the commands doesn't work, it's a sign that there's a problem in entity itself.

viscid horizon
#

there shouldn’t be

dim tusk
#

You are the problem lol, it should include the namespace.

viscid horizon
#

am i the problem

dim tusk
#

ata:fakehp

#

not fakehp alone.

viscid horizon
#

coulda sworn i accounted for the namespace tho

#

where is the error anyway

dim tusk
#

you used fakehp without namespace

viscid horizon
#

damn

#

let me see if what i do will fix it

#

maybe i am stupid

#

@dim tusk even with that fixed i don’t think the properties in the json wants to cooperate

humble lintel
#

Doesn anyone know how to visualize profilerfiles in realtime when testing code?

viscid horizon
#

im starting to think the player.JSON just doesn’t support actor properties or something

#

i’ve tried initializing ata:fakehp with setProperty and using behavior events

viscid horizon
#

i’ve tried doing scoreboards for fake health in the scripts but sometimes they don’t sync up in the actual game and q.scoreboard can’t be used for rp so if this doesn’t work im just gonna use regular vanilla hp

dim tusk
#

I tried mine and it works fine.

viscid horizon
dim tusk
#

ok, when you do the command in chat not command block does it show the properties or nah

viscid horizon
#

guessing it’s because it thinks the player doesn’t have those properties

dim tusk
#

noo, that's not what I meant, if you the command in chat it shows the available properties

#

/testfor @a[has_property={

#

If you do this it shows them.

viscid horizon
#

the properties exist in the game but not for the plauer for some reason

final ocean
#

How to fix ???

ivory bough
#

How to get the render distance of the player(not max render distance)?

past coyote
#
lockCamera() {
    const cameraLocation = {
        x: this.player.location.x,
        y: this.player.location.y + 1.6,
        z: this.player.location.z
    };

    console.log("Setting camera at: x=" + cameraLocation.x + ", y=" + cameraLocation.y + ", z=" + cameraLocation.z);
    console.log("Facing NPC ID:", this.npc.id);

    try {
        this.player.camera.setCamera("minecraft:free", {
            facingEntity: this.npc,
            location: cameraLocation,
            easeOptions: {
                easeTime: 0.5,
                easeType: "linear"
            }
        });
        console.log("Camera set successfully (no fov)");
    } catch (error) {
        console.error("Camera set failed:", error);
    }
}```
#

So I dont really understand, im trying to make the camera pan over and lock on to the NPC

#

but for some reason it just goes to 0 0 0 (or somewhere far under the map)

#

The correct coordinates are being passed, but the camera never actually goes to the camera location

timid zenith
distant gulch
#

i'm trying to make the damage reduction for my custom armor horse using script but the damage not get reduce. Can someone help pls

unique acorn
lilac glacier
#

can anyone help me with this

#

since the new update has dropped

#

they changed the parameters for applyKnockback

#

and now idk how to apply verticalStrength.

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


system.afterEvents.scriptEventReceive.subscribe(({ sourceEntity, id }) => {
  const view = sourceEntity.getViewDirection();
  const target = sourceEntity?.target;
  console.error(id);

  switch (id) {
    case 'cod:event_knockback':
      if (target) sourceEntity.applyKnockback({ x: view.x * 8.5, z: view.z * 8.5 }, 0.1);
      break;

    case 'cod:event_charge':
      if (target) sourceEntity.applyKnockback({ x: view.x * 10.5, z: view.z * 10.5 }, 0.1);
      break;

    default: break;
  }
});```
#

the mob that uses it jumps like this atm

unique acorn
#

the 0.1 is the vertical strength

lilac glacier
#

ah alr

distant gulch
prisma shard
#

but don't worry, me and @unique acorn are make a entity hurt before event 😎 so you can cancel damage

shut citrus
#

any example using this module?

#

idk how to use it

prisma shard
#

YO WTF

#

the knockback is real weird after update

thorn ocean
wise raft
#

How can I ensure that my block ticks randomly more often?

buoyant canopy
#

this is a general JavaScript question, i want to use an expression as a condition for an if statement, similar to this: ```js
if ({
const n = true
return n
}) {
...
}

This syntax is obviously wrong, how can i make it work?
buoyant canopy
#

my actual expression is kinda more complex than that, i want to check if a container exists in a location and if it does check if it has items

distant tulip
#

use a callback
() => {
const n = true;
return n;
})()

buoyant canopy
#

i have the expression but I can't be brothered to copy it all to my mobile

distant tulip
#

if((() => {
const n = true;
return n;
})())

buoyant canopy
distant tulip
#

wdym

open urchin
#

i feel like doing this would be easier

const n = true;

if (n) {
}
buoyant canopy
# distant tulip wdym

oh, wait i had to move the () outside the other ()
i had it like this
(()=>{}())
it needed to be like this
(()=>{})()

wary edge
#
let n = 2;
if(n=1) console.log(10);

Works as well.

distant tulip
wary edge
#

Or ideally a function if it's complicated.

open urchin
#
function containerExists(location) {
  // ...
}

if (containerExists(location)) {
  // ...
}
buoyant canopy
distant tulip
#

sound like you are complicating it a bit, also eval() can and should be avoided

buoyant canopy
#
const queries= {
  cobblestone: `player.runCommand(testfor @s[hasitem = {item:cobblestone}]).successCount`
}

for (let query of Object.keys(queries)) {
  if eval(queries[query]) complete(query)
}```
buoyant canopy
open urchin
#
const queries= {
  cobblestone: () => player.runCommand("testfor @s[hasitem = {item:cobblestone}]").successCount
}
woven loom
#

just make a parser

buoyant canopy
open urchin
#

you could give the functions any context they need using arguments

const queries= {
  cobblestone: ({ player }) => player.runCommand("testfor @s[hasitem = {item:cobblestone}]").successCount
}
buoyant canopy
#

i will try that

#

i think i am too deep to change everything now...

#

i got over 60 achievements written

buoyant canopy
#

it works, i guess i have replace them all now

cold grove
distant tulip
#

one testfor command VS 36 iteration of getItem

oak lynx
#

wait can i register commands like this?
/help:e
/spawn:e
/lobby:e

oak lynx
#

i really dislike the namespace requirement

unique acorn
#

it's still in preview tho so stuff could be changed shrug

round bone
round bone
woven loom
#

??

prime zenith
#

Thats my cyphercon rank

blissful briar
#

nice

ivory bough
#
system.runInterval(() => {
  for (const entity of overworld.getEntities({ type: 'minecraft:zombie' })) {
    const velocity = entity.getVelocity();
    if (velocity.x === 0 && velocity.y === 0 && velocity.z === 0) continue;

    const loc = entity.location;
    const min = { x: Math.floor(loc.x) - 2, y: Math.floor(loc.y) - 2, z: Math.floor(loc.z) - 2 };
    const max = { x: Math.floor(loc.x) + 2, y: Math.floor(loc.y) + 2, z: Math.floor(loc.z) + 2 };

    const blocks = Array.from(overworld.getBlocks(new BlockVolume(min, max), {}).getBlockLocationIterator());
    for (let i = 0, limit = Math.min(4, blocks.length); i < limit; i++) {
      overworld.setBlockType(blocks.splice(Math.floor(Math.random() * blocks.length), 1)[0], 'minecraft:oak_log');
    }
  }
}, 1);

Why doesn't this work? My entity doesn't stop replacing blocks after it has already replaced 4 blocks

ivory bough
#

Also,

console.error(JSON.stringify(blocks.splice(Math.floor(Math.random() * blocks.length), 1)[0]));

this returns xyz coordinates for some odd reason

shy leaf
#

you could check which part went wrong that way

ivory bough
shy leaf
#

try running it another after one and see if it replaces or not

ivory bough
#

Ok, I set the interval to 50 instead of like 1 and it works now. I think I should make the interval the amount of time he takes to move 1 block

round bone
#

loop is stopping, but it's mounted in the next tick

prisma shard
#

hmm

#

can someone help

#

with some complex

#

So

#

i want to place 1 each block inside of each chunks

#

suppose i set A BlockVolume

#

from a location and to another locaitons

#

It will calculate the whole chunks between those two locations

#

And then place 1 block in those each chunks

#

@distant tulip

distant tulip
#

nothing complex about that

floor(coordination/16)*16 and here is your chunk origin

prisma shard
#

UH

#

hmm

#

I want to get the middle of the chunk

distant tulip
#

add 8 to that

prisma shard
#

it would get whole chunk of two locations first (also those chunks between the location), then get the middle of each

prisma shard
#

2 coords

#

so it get "each " chunks

#

between them

prisma shard
distant tulip
#

You need to loop through the coords by iteration of 16

#

From one end to the other

prisma shard
#

hmm lemme use my brain 1 sec

prisma shard
# distant tulip You need to loop through the coords by iteration of 16
async function getBlockAtChunkCenters(volume) {
    const { from, to } = volume;
    const xMin = Math.min(from.x, to.x);
    const xMax = Math.max(from.x, to.x);
    const yMin = Math.min(from.y, to.y);
    const yMax = Math.max(from.y, to.y);
    const zMin = Math.min(from.z, to.z);
    const zMax = Math.max(from.z, to.z);


    for (let x = xMin; x <= xMax; x += 16) {
        for (let y = yMin; y <= yMax; y += 16) {
            for (let z = zMin; z <= zMax; z += 16) {

                const centerX = Math.floor(x / 16) * 16 + 8;
                const centerY = Math.floor(y / 16) * 16 + 8;
                const centerZ = Math.floor(z / 16) * 16 + 8;


                const blockLocation = { x: centerX, y: centerY, z: centerZ };
                // get block at middle of each chunk
                await getBlock(blockLocation)  
            }
        }
    }
}
#

:)) this was chatGPt , i told him, as you said, and got this

#

is this right

granite badger
prisma shard
#

huh

prisma shard
prisma shard
#

it crashes my world

#

i tested

#

nah dont work

#

It still returns the "Unloaded chunk " error

#

you see that

#

await getBlock(blockLocation)

#

In the getBlock function

#

I am adding a tickarea

#

So the chunk loads

#
export async function getBlock(location, dim = world.getDimension("overworld")) {
    let block, { x, y, z } = location;
    const getBlock = dim.getBlock.bind(dim, location);
    try { if (!(block = getBlock())) throw null; else return block }
    catch {
        system.run(() => {
            dim.runCommand(`tickingarea add circle ${~~x} ${~~y} ${~~z} 0 "${x},${y},${z}"`);
            let remove = () => dim.runCommand(`tickingarea remove "${x},${y},${z}"`);
                return new Promise(async resolve => {
                    system.runJob(function* () {

                        let trials = 1e3;
                            do {
                                block = getBlock();
                                if (!--trials) yield void remove();
                            } while (!block);
                        remove();
                    return resolve(block);
                }())
            })
        })
    }
};
#

but still not work

#

unloaded chunk

#

idk why

#

minato pls help

granite badger
#

tickingarea only loads upon player goes there once

prisma shard
#

oh

#

hmm

#

thats unfortunate

distant tulip
#

there is a preload parameter

prisma shard
#

huh

#

confused what u mean

distant tulip
#

type the command in game and see

prisma shard
#

idk what is a preload param

#

and i did type happen nothgn

#

dude i am an idiot

distant tulip
#

just add true to the end of the command

distant tulip
oak lynx
#

wow someone is using getBlock

prisma shard
#

njmjhiojh

#

@distant tulip dude i'm tired, im trying to make a worldEdit
my game just keeps crashing the scripts hangs, when i try to fill alot of blocks 😭
can you please just take the whole script
i saw did some one fill large areas, he was doing it each chunk after a delay, so it wouldn't crash the gamegame

prisma shard
distant tulip
#

what are you doing to cause it

warped kelp
#

Is there a way to detect if an entity is riding something, and if they're not riding something, they'll get removed?

prisma shard
#

first break block then go far away and right click to select another position

#

then to fillBlocks do !set {blockId}

glacial widget
#

How would I cancel players from taking items out of a item frame?

#

i tried beforeEvents playerBreakBlock, doesnt work well. Asking to see if there is any other ways

stuck ibex
#

Is there a way to get the translated name of the item? ItemStack.nameTag just returns undefined when it haven't been edited yet

open urchin
#

you could then use something like this to display the name

player.sendMessage({ translate: itemStack.localizationKey })
stuck ibex
open urchin
#

why

stuck ibex
#

So i can mess around with the names

#

and set it with .nameTag

open urchin
#

I don't think that's possible

#

without manually including the name of every item in your scripts

stuck ibex
#

Even so i don't think its worth it since it can be changed

#

that sucks

rapid nimbus
#

Successfully fixed dimension title (I used the Fast Loading Screen texture pack so I got an error when going through the portal, I encourage everyone not to use this texture pack to avoid errors when going through the dimensional portal (Building Terrain Interface, etc...)

remote oyster
#

||

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. ~ Brian Kernigha
||

oak lynx
#

what js version is Minecraft using I want to use Temporal

distant tulip
#

quick js

oak lynx
honest spear
unique acorn
unique acorn
# distant tulip

I thought that was a spoiled text, I clicked it then realized it's an image lol

#

you didn't have to do that tho smh

distant tulip
#

lol

cinder shadow
crude bridge
#

i dont find the random tp script in script resources can someone # it for me

#

nvm

#

i found it

shut vessel
#

Do you know what argument the eventData.sender was changed to?

warped blaze
shut vessel
#

I find it weird

prisma shard
shut vessel
wary edge
warped blaze
shut vessel
warped blaze
thorn flicker
shut vessel
thorn flicker
#

oh

#

im dumb

thorn flicker
shut vessel
#

understandable

#

like that ?

thorn flicker
#

also you are using system.run like its supposed be for sending messages

#

i think you are confused

#

Smokeystack was telling you to wrap the method in system.run and titi was suggesting to use the sendMessage method instead of the command method.

snow jungle
#

.

sharp elbow
#

People suggest "wrapping" the runCommand method in a system.run call to defer its execution until later in the tick, to where the world state can be modified.

#

It's like invoking any other function:

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

function sayHiToEveryone() {
  for (const player of world.getAllPlayers()) {
    player.isValid && player.sendMessage("Hi!");
  }
}

// System.run call, given the sayHiToEveryone function as a callback
system.run(sayHiToEveryone);
#

Although the pattern suggested was system.run(() => { code ...});, since folks here like unnamed arrow functions.

lyric kestrel
#

I am starting to hate making my Frame Blocks

warped blaze
warped blaze
sharp elbow
#

These two are mechanically similar. Just comes down to coding style.

if (condition) action;
condition && action;
#

In JavaScript, the && operator will only evaluate the second half of the expression if the first half is truthy

warped blaze
#

i didn't even know that was possible xd

sharp elbow
#

You've likely already used a similar form of that with the || operator, where the second half is evaluated only if the first half is falsy (as in foo = bar || {};)

warped blaze
#

didn't remember seeing that on the js course but looks familiar

sharp elbow
#

But of course, I would recommend the if statements for more complex control flow or for readability. Like if you need a block to execute code in, or to use else (ternaries technically work but IMO it is poor form)

leaden elbow
#

how to check for dropped item from broken block? getItemStack sometimes returns undefined when block is not the same as dropped item (like diamond ore drops diamond). so how can i check for dropped item in that location where block is broken?

drowsy scaffold
#

how do I make a small particle with MolangVariableMap?

drowsy scaffold
#

I don't think there is a native method to get an instance of what the block would drop if broke currentlyh

glacial widget
#

How would I cancel players from taking items out of a item frame?
i tried beforeEvents playerBreakBlock, doesnt work well. Asking to see if there is any other ways

drowsy scaffold
sharp elbow
drowsy scaffold
#

gotcha, thanks

stuck ibex
#

playerSpawn is deprecated, is there any current alternatives?

woven loom
#

What? Why?

stuck ibex
woven loom
#

😶

wary edge
stuck ibex
#

Seems intentional

unique acorn
#

what version is that

#

I'm using 1.21.80.25 and it isn't showing it

rapid nimbus
warped blaze
stuck ibex
rapid nimbus
rapid nimbus
warped blaze
stuck ibex
rapid nimbus
shut citrus
#

@rapid nimbus

rapid nimbus
warped blaze
rapid nimbus
rapid nimbus
rapid nimbus
shut citrus
#

bro có chơi sever ko

spring dove
#

im trynna develop an addon for couple months now, and i was wondering if it was better staying on 1.18.0 or dealing with breakable stuff from 2.0.0 beta

spring dove
#

Yeah, but i left scripting in 1.14.0-beta and now that i came back i dont know why my addon's scripts don't work anymore

#

i changed the manifest to 1.18.0

wary edge
spring dove
#

Aight, but there's an error when im trying to use beta too, idk why

#

`[Scripting][error]-Plugin [Starlight UHC [BP] - 1.0.0] - failed to create context.

[Scripting][error]-Plugin [Starlight UHC [BP]] - version conflict for module [@minecraft/server].
[2.0.0-beta] requested by [Starlight UHC [BP] - 1.0.0],
[1.3.0] requested by [@minecraft/server-ui - 1.3.0]

[Scripting][error]-Plugin [Starlight UHC [BP]] - version conflict for module [@minecraft/server].
[2.0.0-beta] requested by [Starlight UHC [BP] - 1.0.0],
[1.2.0] requested by [@minecraft/server-ui - 1.1.0]

[Scripting][error]-Plugin [Starlight UHC [BP] - 1.0.0] - run failed, no runtime or context available.`

wary edge
spring dove
#

beta?

wary edge
#

Yeah.

spring dove
wary edge
#

Yeah.

spring dove
#

oh my god, well now ill have to re do everything

#

one last question

#

This is not how you install the Node.js right

wary edge
#

Thats right. Though youre in the wrong directory...probably.

spring dove
#

im having a bad time using visual studio and i dont remember how to open the right terminal

#

bc i click there

#

but opens this

#

or maybe i dont have node js LOL

#

bruh what

#

im a hacker, i made it work

rigid surge
#

how do i make a development pack for minecraft preview?

ivory bough
#
const overworld = world.getDimension("overworld");
const notexture = overworld.getEntities({ typeId: "space:no_texture" })[0];
const loc = notexture.location;

It says cannot read properly of undefined "location" in the line in which I am defining loc variable

dim tusk
dim tusk
# ivory bough Yes

Is that a global variable or in a runInterval? Since it doesn't make sense why would it return undefined of locations if the entity in the first place exists

flat barn
#

Is microsoft fucking kidding me?

patent bane
#

lmfao

wise raft
#

How can I spawn a particle that moves upwards?

distant tulip
wise raft
distant tulip
#

use
v.name.x v.name.y v.name.z in the particle direction
and use
MVM.setVector3({x,y,z})

honest spear
#

haha

#

you need to know more about particles than script api

distant tulip
#

snowstorm simplify it by a lot

honest spear
#

here is steps i recommend for you

  • Learn How to create custom particles
  • Learn how to use variables in custom particles
#
  • Use MlangVariableMap in Script API (optional)
honest spear
wise raft
#

I want to use vanilla Particles

honest spear
wise raft
#

why? :c

honest spear
#

bc vanila particles doesn't have variable like speed and direction

#

particle system in Bedrock is completely different from Java

warped blaze
honest spear
#

i think some have a variables for colors

honest spear
#

but like i said you have to know the JSON Molang particle system

#

its not about Script API at that point, thats my opinion

wise raft
honest spear
#

afaik

#

but like @distant tulip said there are few that has direction variable

distant tulip
wise raft
#

alright

honest spear
#

well you can use custom particle with vanilla texture

#

its not a big deal, but it requires reasource pack thats only downside i see

long cargo
#
import { world } from "@minecraft/server";

const PrimeKey = "§\ue111";
const getSubId = (id, name = "") => name + PrimeKey + id;

export class Database extends Map {
    constructor(id = Database.name) {
        super();
        JSON.parse(String( world.getDynamicProperty(this.id = getSubId(id, Database.name)) ?? "[]"))?.forEach(
            rawKey => this.set(rawKey,  world.getDynamicProperty(getSubId(PrimeKey + rawKey, this.id))))
    }
    clear() {
        for (const rawKey of this.keys()) {
            world.setDynamicProperty(getSubId(PrimeKey + rawKey, this.id), null);
        }
        world.setDynamicProperty(this.id, "[]");
        return super.clear();
    }
    
    delete(rawKey) {
        world.setDynamicProperty(getSubId(PrimeKey + rawKey, this.id));
        return super.delete(rawKey);
    }
    propertyKeys() {
        const primedKeys = [...super.keys()].map(rawKey => getSubId(PrimeKey + rawKey, this.id));
        return world.getDynamicPropertyIds().filter(propKey => primedKeys.includes(propKey));
    }
    get(rawKey) {
        return  world.getDynamicProperty(getSubId(PrimeKey + rawKey, this.id))
    }
    set(rawKey, data) {
        let primedKey = getSubId(PrimeKey + rawKey, this.id);
        if (!data && !"stringbooleanumber".includes(typeof data)) {
            super.delete(rawKey);
            world.setDynamicProperty(this.id, JSON.stringify([...super.keys()]));
            return world.setDynamicProperty(primedKey), this;
        }
        if (!super.has(rawKey)) {
            super.set(rawKey, data);
            world.setDynamicProperty(this.id, JSON.stringify([...super.keys()]));
        } else super.set(rawKey, data);
        world.setDynamicProperty(primedKey, data);
        return this;
    }
};

[Scripting][error]-ReferenceError: Native function [World::getDynamicProperty] does not have required privileges. at Database (Modules/Database.js:9)
at <anonymous> (Crate.js:38)

help me fix it

round bone
#

in this case: world is not initialized yet, that's why it's throwing up an error

sharp elbow
#

You have to execute your Database construction inside world.afterEvents.worldLoad

import { Database } from "./database";

var database;

function loadEntry() {
  database = new Database("hi");
}

world.afterEvents.worldLoad.subscribe();
deep quiver
#

var is crazy

winter plaza
#
import * as mc from '@minecraft/server';

mc.world.beforeEvents.chatSend.subscribe(data => {
    const
        player = data.sender,
        message = data.message;
    if (player.hasTag("uchiha")) {
        data.cancel = true;
        world.say(`<${player.name} §cUchiha§f> ${message}`);
    }
});
#

api 1.18.0, It's not working, what's the error?

unique acorn
#

chatSend is only in beta api btw

#

so that's the issue

winter plaza
#

beta?

#

noooo

#

😦

crude bridge
#

@hazy copper ask here dont be shy

prisma shard
hazy copper
#

I asked you 😭

crude bridge
#

lol

hazy copper
#

😭

prisma shard
#

use beta api script version, in your manifest

round bone
random flint
round bone
#

but doesn't they throw up an error?

round bone
distant tulip
#

It always was the case

round bone
distant tulip
#

It is

round bone
#

calling World::sendMessage or Player.sendMessage does not throw error without any privileges in beforeEvents

#

for 1.x.x versions

distant tulip
#

weird

dense sun
#

can we multithread some loops in script api?

random flint
echo tinsel
#

Is there a quick script for all mobs excluding those in the inanimate family to have a 1% chance of dropping a custom item when they die?

rapid nimbus
#

Vietnamese Languages on Traveler's Titles Bedrock Addon

random flint
# echo tinsel Is there a quick script for all mobs excluding those in the inanimate family to ...

//entityDie afterEvent:

if (!deadEntity.isValid) return;
if (deadEntity.matches({ families: [ "inanimate" ] })) return;
itemDrop(deadEntity.location,deadEntity.dimension)

//itemDrop(location,dimension) function:
if (Math.random() < 0.01) {
const itemStack = new ItemStack("apple",1);
dimension.spawnItem(location);
}

//entityRemove beforeEvent:
//handle special case like projectile, armor stand, minecarts, item entity (those who has instant despawn after dying)

if (removedEntity.matches({ families: [ "inanimate" ] })) return;
const { location, dimension } = removedEntity;
system.run(()=>itemDrop(location, dimension))

shy leaf
umbral dune
vast rune
#

Is there any way to detect what block is under the entity?

prisma shard
# vast rune Is there any way to detect what block is under the entity?

Yes.

/**
 * Gets the block just below the entity.
 * @param {Entity} entity - The entity.
 * @return {Block | null} The block below the entity or null if unavailable.
 */
function getBlockBelow(entity) {
  const loc = entity.location;
  loc.y -= 1;
  return entity.dimension.getBlock(loc);
}```
#

or if using custom compoenent, there is onStepOn

simple zodiac
#

any|null is crazy work

prisma shard
prisma shard
vast rune
#

k

umbral dune
# vast rune is this ts or js?

it is worth assuming that ts and js have the same syntax,
if there is no type definition then it is javascript. (most cases)

vast rune
#

yeah, im new to this( i only know c++ mainly)

prisma shard
#

uh fine i change it apple_skull

tidal wasp
#

Block suddenly not working

#

Here the code in question

prisma shard
#

that file is block_trigger.js where appears to be the error right?

#

Or, in the function there is a lot of playSound, you can put await null; just inside the function, on top of those playSounds

#
function blockPlaceNoise() {
  await null;
  if () {
    dimension.playSound
  }
  else if () {
    dimension.playSound
  }
  else if () {
    dimension.playSound
  }  
}```
#

i dont want to extact texts from your immage, so here is just example

prisma shard
half drum
tidal wasp
#

It worked before 😭

half drum
tidal wasp
#

Not years ago

prisma shard
tidal wasp
#

Weeks ago

#

I know

tidal wasp
#

Trying it

#

Nope

tidal wasp
prisma shard
tidal wasp
prisma shard
#
async function blockPlaceNoise(){
  await null;
  if () {
    dimension.playSound
  }
  else if () {
    dimension.playSound
  }
  else if () {
    dimension.playSound
  }  
}
#

or just use system.run() dude

tidal wasp
#

👍

#

Imma have to use system.run

prisma shard
#

because the playSound inside the function is only returning error

tidal wasp
#

Thanks

#

Ok so putting it around where I called the function didn't work

tidal wasp
#

Neither did putting it around the playsound area either

prisma shard
#

this is not how it works.......

tidal wasp
#

Nvm

#

I may be a fucking idiot

#

Please have mercy

#

It is 3 am and I got a headache

prisma shard
tidal wasp
#

Dw i figured that out

#

Works now @prisma shard

half drum
# tidal wasp So this didn't work

been a while but if you're wondering why this didn't work is because, again, you're using playSound in a read-only environment (beforeOnPlayerPlace)

rapid nimbus
prisma shard
#

what

prisma shard
rapid nimbus
# prisma shard this channel isn't for promotion

I know that but I send the link to my addon package for people to download and try my addon package because I'm afraid it has some bug in my Script API so people can report errors in the script to me so I can fix them in the Script API only

remote oyster
rapid nimbus
#

Okay

boreal siren
#

How to create an event for the "/scriptevent" command?

cold grove
#

"Create an event"

boreal siren
acoustic basin
#

how can i stop player from using an item when the use duration reaches certain point?

#

i set the cooldown for item, but player keeps using it, i need to stop that

distant tulip
# boreal siren How to create an event for the "/scriptevent" command?
import { world, system } from "@minecraft/server";

system.afterEvents.scriptEventReceive.subscribe((event) => {
    event.id //@remarks — Identifier of this ScriptEvent command message.
    event.message //@remarks — Optional additional data passed in with the script event command.
    event.sourceEntity //@remarks — Source entity if this command was triggered by an entity (e.g., a NPC).
    event.sourceBlock //@remarks — Source block if this command was triggered via a block (e.g., a commandblock.)
    event.sourceType //@remarks — Returns the type of source that fired this command.

    //example use
    if(event.id === "admin:anounce"){
        if(!event.message) return
        world.sendMessage(`📢-Announcement: ${event.message}`)
    }
});

distant tulip
cold grove
acoustic basin
distant tulip
#

what event are you using

#

use itemStartUse

cold grove
acoustic basin
cold grove
#

Do not run the action if your cooldown ticks remaining are not zero or whatever you set

#

Ahh! Use duration. Sorry

#

My bad...

acoustic basin
#

one second, will try

#

so like, useDuration = 0?

distant tulip
#

Returns the time, in ticks, for the remaining duration left before the charge completes its cycle.

acoustic basin
#

ah, so how do i stop the action from running further, even if i have a cooldown that has started, but i'm still using the item...

distant tulip
#

if useDuration == max use duration

acoustic basin
#

hold on, i'll show what i have...

#
world.afterEvents.itemStartUse.subscribe((event) => {
    const { source, itemStack, useDuration } = event;
    if (itemStack?.typeId !== "item") return;

    const selectedItem = source.getComponent("minecraft:equippable");

    let ticks = 0;
    const hammer = system.runInterval(() => {
        ticks++;
        const property = source.getDynamicProperty("item");

        if (ticks == 14) {
            source.dimension.spawnEntity("entity", source.location).triggerEvent("event");
        }
        if (ticks >= 20) {
            system.clearRun(property);
            source.startItemCooldown("item", 200)
            return;
        }
    }, 1);

    source.setDynamicProperty("item", hammer);
});```
#

so when ticks is >= 20, then i need to stop item from being used, even if i'm still holding the use action

distant tulip
acoustic basin
distant tulip
#

what are you referring to by "the item being used"

distant tulip
#

already doing that

acoustic basin
#

item being in use

#

i honestly don't know how else i could explain it...

distant tulip
#

the itemStartUse triggering as i said?

#

also
if (itemStack?.typeId !== "item") return;
this is wrong, no?

acoustic basin
acoustic basin
distant tulip
#

ah alr, lol

#

hmm

acoustic basin
#

so i've tried one thing

#

i've cloned the item with itemStack.clone()

#

and then did this

selectedItem.setEquipment("Mainhand", new ItemStack("air", 1));
            system.run(() => {
                selectedItem.setEquipment("Mainhand", item);
            })```
distant tulip
#

i am bit confused tbh

maybe try ItemUseAfterEvent

acoustic basin
#

just, the issue is, if player immediately switches to another slot when the item is getting replaced, the slot player just selected gets replaced with the cloned item

acoustic basin
distant tulip
#

yeah

acoustic basin
#

but how would it help

#

it changed nothing

distant tulip
#

a custom bow?

acoustic basin
#

it was a typo XD

woven loom
#

I wanted to know how to use the types installed globally

distant tulip
#

how to install them or how to use them?

woven loom
#

Use

distant tulip
# acoustic basin no

so, from what i am understanding
itemStartUse get triggered even if you didn't release the item and start using it again?

distant tulip
acoustic basin
#

oh, wait

#

i thought of something now lol

distant tulip
#

i don't remember it being that way

acoustic basin
#

yes, genius

#

or wait

distant tulip
#

hmm?

acoustic basin
#

nah, not genius...

distant tulip
#

this is a custom item, right?

acoustic basin
#

yes

distant tulip
#

do we need to use minecraft:chargeable?

acoustic basin
distant tulip
#

ah, that is deprecated anyway

acoustic basin
#

lol

distant tulip
#

could you log the value of useDuration and see what it is when the problem happen

acoustic basin
#

i've just found a solution

#

not perfect, but it'll do it

#

sorry for taking up your time😭

distant tulip
#

cool, and it is alright lol

acoustic basin
#

still, thank you =)

snow knoll
#

Is there a way to detect how long an entity has been alive

#

Like e.g.

if ( entity.age <0.07 ) {...}```
distant tulip
#
world.afterEvents.entitySpawn.subscribe((event)=>{
    event.entity.setDynamicProperty('spawnTime', Date.now())
})
snow knoll
#

Would I have to make this into a constant

#

So that I could then detect if it is a lower value than whatever number I need

sharp elbow
#

I would not use Date.now. This does not account for the game being paused

#

Use system.currentTick instead

sharp elbow
honest spear
#

you should messure all time in ticks to match the game experience

distant tulip
#

i forgot about game pause

sharp elbow
#
function getEntityAge(entity) {
  const spawnTick = entity.getDynamicProperty('spawnTime');
  return system.currentTick - spawnTick;
  // const spawnTime = entity.getDynamicProperty('spawnTime');
  // return Date.now() - spawnTick;
}
distant tulip
#

after thinking about it, Date.now() is really bad in this case
the time where the server is shutdown will count too

sharp elbow
#

Oh haha, true

unique acorn
#

doesn't system.currentTick reset to 0 once the world is started?

distant tulip
#

nope

distant tulip
#

getAbsoluteTime and currentTick whats the different

sharp elbow
#

Not sure. Have you noticed any difference?

distant tulip
#

getAbsoluteTime can be changed? beside that? no just asking

sharp elbow
#

Oh fascinating

distant tulip
#

yeah, the time getAbsoluteTime get can be altered by game-play (sleeping, commands, scripts and so on)
was thinking they are the same

sharp elbow
#

Oh, is that also adjusted by /time set?

distant tulip
#

not a fitting description tho

Returns the absolute time since the start of the world.

sharp elbow
#

Well, it's not wrong either. Just that, that can mean several things

#

I think that could be improved by clarifying further:

/**
 * Returns the absolute time since the start of the world. This value can be changed through {@link World.setAbsoluteTime}.
 */
distant tulip
#

i mean, do we count sleeping as time pass or skipped

sharp elbow
#

That only differs by semantics, right? Technically it is being skipped

distant tulip
#

yeah, relative to currentTick it is skipped
i guess each one and it use case

stark kestrel
#

how would you make custom damage system?

honest spear
#

sleeping is the same as currentWorldTime = nextDayMorning

#

its just recalculated time

stark kestrel
honest spear
#

you can simulate that with /time set

distant tulip
#

yeah

honest spear
stark kestrel
honest spear
#

not that easy

stark kestrel
#

hmm

#

where should i start

distant tulip
#

can be as simple or as complex as you want

honest spear
#

you can't cancel the vanilla damage

#

can't with Script API

stark kestrel
#

i know

#

ik

honest spear
#

also you can't set the strength only with entity effects

#

so what is your goal?

stark kestrel
#

i can heal the dealt damage back right?

stark kestrel
#

and running a entityhitentity?

#

for applying damage?

honest spear
stark kestrel
#

hm

honest spear
#

its afterEvent so the code is too late to save it

stark kestrel
#

yeah, i wish there was a beforeEvent for it

distant tulip
#

you could try to give all entities weakness and apply your own damage

shy leaf
#

player.json

honest spear
#

real

stark kestrel
# shy leaf player.json

i dont even care about using player.jspon, i have my server made fully by myself, i dont use anything else lol

shy leaf
#

ohohoho now we are talking

stark kestrel
shy leaf
#

give me a second

honest spear
#

but player.json is for players only

#

thats the catch i see

stark kestrel
#

hm

shy leaf
honest spear
#

does it actually heals on hit?

shy leaf
honest spear
#

ohh

shy leaf
#

the docs said that but it was a lie

distant tulip
#

that cancel player damaging not damage, no?

shy leaf
honest spear
shy leaf
#

but entityHitEntity still fires

honest spear
#

you can cancel the damage with hit damage sensors

distant tulip
#

i thought that what he is after

stark kestrel
#

O.o

stark kestrel
#

can u send me the player.json please.

#

or where do i find it

shy leaf
#

you can check the vanilla player.json

stark kestrel
#

thanks

#

alot

shy leaf
#

but

#

there are two unexpected things that can happen

#

when you do this

stark kestrel
#

👀

#

what are they

shy leaf
#

first is that mace damage also gets reduced

stark kestrel
#

i dont use mace anyways lol

shy leaf
#

and second is, for whatever god damn reason, using weapons with damage bonus enchantments while having weakness effect,

#

literally

#

ignores the component

stark kestrel
#

hmm

#

i dont use em too :D

shy leaf
shut citrus
#

how to fix slowdown watchdog?

shy leaf
honest spear
#

Me watching the BAO users fighting watchdog and not trying to agree with it

sharp elbow
#

It's a bit unfortunate, but it is true. If watchdog is biting your ass, then either you're playing on some bad hardware (like Nintendo Switch) or you're doing something inefficiently

honest spear
#

I mean sometimes the loops they make is crazy, but yea low performance divices are also pain

distant tulip
sharp elbow
#

That's a proper foot-gun right there

shy leaf
#

literally this

distant tulip
#

fr

solar dagger
#

Uh that image is broken sir

shy leaf
#

hoe about this

solar dagger
#

No I meant like the gun

honest spear
sharp elbow
#

Whoever started spreading top level await to get out of early execution has spread a blight

honest spear
#

yea top level one is really fun killer

distant tulip
honest spear
#

i use await null; alot and i didn't have any problems so far

sharp elbow
#

It's a hack. The way it works really should not work

distant tulip
#

what does it do, i seen it used way before

honest spear
#

you can mock sync callbacks like this

//native code
arg.value = 4;

// simulated callback for subscribed event
yourAsyncCallback(arg);

// simulated next step //native memory freeing
delete arg.value;
whole saddle
#

how to register custom components in the new script api version 2.0.0 ?
system.beforeEvents.startup somehow doesn't work for me

shut citrus
warm drum
#

hi, how can i turn on experimental features on bds?

distant tulip
distant tulip
#

that is the only ways that i know of
maybe ask in OSS server

remote oyster
#

Patching levels.dat is how I do it.

tidal wasp
#

var block_locationx = e.block.location.x
var block_locationy = e.block.location.y
var block_locationz = e.block.location.z
if(
e.dimension.getBlock(block_locationx + 1, block_locationy, block_locationz)
){}

#

would this work

patent tapir
#

Hey I need a fix urgently, my data.cancel won't work

#
world.beforeEvents.chatSend.subscribe((data) => {
    data.cancel = true;
    const sender = data.sender
    const message = data.message
    system.run(() => {
        world.sendMessage({ rawtext: [{ text: `${Prefix}${useNameTag === true ? sender.nameTag : sender.name}${NameSuffix}${message}${MsgSuffix}`.trim() }] })
    })
})```
#

I tried destructuring already

#

It sends your (and friends') message twice

ripe dune
#

it works fine for me lol

tidal wasp
#

Whenever i went to console log the whole expression, it gave me NaN until I put an active redstone wire next to it or powered it

#

then it stopped giving me anything

#

also doesnt stops screaming at me when i place a redstone block next to it

#

but doesnt turn on

tidal wasp
#

I've found a much less barbaric method

drowsy scaffold
#

is there a native method to check if a player is on fire?

drowsy scaffold
#

thanks Sea

shy leaf
#

np

cold grove
#

Iwiwiwiwi

solar dagger
#

what is the alternative method of

!entity.isValid()
solar dagger
wary edge
solar dagger
#

without the ()?

wary edge
#

Yeah.

shy leaf
#

uhhhh where did the tip message param go

wary edge
shy leaf
#

wtf

wary edge
#

Another Stirante W.

shy leaf
#

wait

#

wh

#

the defaultValue moved to that interface

#

but

#

my code is working as if it didnt change

#

it still accepts defaultValue

edgy elm
#

hello here. does anyboy know how can i remove the black background overlay here? in the player nametag

marsh pebble
#

anyone know a good payed js obfuscator

shy leaf
marsh pebble
#

For a friend

#

Is it possible to just put code in a github?

#

@shy leaf

shy leaf
#

thats like

ripe dune
#

Just use this

prisma shard
ripe dune
shy leaf
#

the opposite of obfuscating

#

also please for the love of god, avoid obfuscating your code

prisma shard
marsh pebble
prisma shard
shy leaf
#

yeah, anyone can deobfuscate regardless of paid or not

marsh pebble
#

@plain silo

prisma shard
shy leaf
#

obfuscating makes your code unreadable for humans

#

but not for machines

prisma shard
#

It's like you want to literally obfuscate code with money, then someone talented just de-obfuscates your code for free....

ripe dune
#

I want to see someone de-obfuscate this without using any program

shy leaf
#

so just please convince your friend to not do it

ripe dune
#

(function(_0x1490b0,_0xd218f5){var _0x2f1a3e=_0x2e83,_0x97face=_0x1490b0();while(!![]){try{var _0x41bda8=-parseInt(_0x2f1a3e(0x1dc))/0x1+parseInt(_0x2f1a3e(0x1d4))/0x2+parseInt(_0x2f1a3e(0x1d5))/0x3*(parseInt(_0x2f1a3e(0x1d9))/0x4)+-parseInt(_0x2f1a3e(0x1db))/0x5+-parseInt(_0x2f1a3e(0x1d6))/0x6*(parseInt(_0x2f1a3e(0x1d8))/0x7)+-parseInt(_0x2f1a3e(0x1d7))/0x8*(-parseInt(_0x2f1a3e(0x1da))/0x9)+parseInt(_0x2f1a3e(0x1de))/0xa;if(_0x41bda8===_0xd218f5)break;else _0x97face'push';}catch(_0x31c534){_0x97face'push';}}}(_0x491f,0xd91dc));function _0x2e83(_0x25c189,_0x34924b){var _0x491fc0=_0x491f();return _0x2e83=function(_0x2e836b,_0x3303e3){_0x2e836b=_0x2e836b-0x1d4;var _0x4d9d6c=_0x491fc0[_0x2e836b];return _0x4d9d6c;},_0x2e83(_0x25c189,_0x34924b);}function hi(){var _0x3eda9b=_0x2e83;console_0x3eda9b(0x1dd);}hi();function _0x491f(){var _0xb1a3b2=['936409xPfzEL','log','14949710klKtbH','2258888doAggG','15BsjKnT','381768fLraIt','6008ZfxdiW','154AKLrBc','1295212DRaWYJ','7281QZKzqu','8127280PCiYaI'];_0x491f=function(){return _0xb1a3b2;};return _0x491f();}

#

(just a hello world)

shy leaf
#

:skull

shy leaf
#

uh

marsh pebble
shy leaf
#

you want me to run the code?

ripe dune
#

🌚

marsh pebble
#

shit

#

im on phone