#Script API General

1 messages · Page 58 of 1

untold magnet
#

||trying make u understand how it works and why its not useful on multiplayer||

#

another explanation:
getPlayers: if one of us touches grass we will die, the script will detect if the player touches grass, all other players will die at the same time, having all players in the same array
but getAllPlayers will make each player have its own array.
( i hope u understand it )bao_ext_toldyouso

ivory bough
untold magnet
thorn flicker
#

I said ill mess with it on my own time.

#

thank you.

undone cradle
#

sorry for repeating question
but i couldn't find information about it
from which version minecart start supporting the script modules and scripting in general?

random flint
#

No, both getPlayers and getAllPlayers return the same thing. ( Array of Players )

The only difference is that, getPlayers() can use EntityQueryOptions

#

If you use .forEach(), it'll do the same thing for both.

What you probably have, causing "not multiplayer friendly" is a logic issue on your part.

thorn flicker
#

that's what im saying

untold magnet
thorn flicker
untold magnet
untold magnet
#

hmm

thorn flicker
#

...

untold magnet
#

why i cant detect the pale wolf variant?

thorn flicker
#

idk

untold magnet
#

if (variant?.value === 0) is the pale wolf variant

#

i tried console.warn it, it says undefined

#

detecting other variants is fine, but idk why its not the case for the normal pale one

untold magnet
#

cuz i did if (!variant) and it works for the pale wolf variant

thorn flicker
#

yeah

untold magnet
#

maybe cuz im on beta

thorn flicker
#

no

#

sometimes it spawns without the variant component.
just check if its undefined or 0

#

I spawned a wolf in the swamps and it was default skin, but it says it doesnt have the component.

untold magnet
#

i tried it inside of the desert, its undefined

thorn flicker
#

exactly

untold magnet
#

so yah i should do if (!variant || variant?.value === 0)

thorn flicker
#

yes.

untold magnet
#

that make sense, but mojang doesn't make any sense lol

spring axle
wary edge
granite badger
#

air being a block

obsidian coyote
#

They were trying to block air

tidal wasp
#

why doesnt the if statement ever return?

#

even if I go ahead and do console.error(e.block.getTags()) it returns nothing

cinder shadow
#

which statement?

tidal wasp
#

if(e.block.hasTag('beam'))

cinder shadow
rose light
#

I want to create a system using the JSON UI to display the player's money permanently on the screen.

I have already modified the player's title, but I need a way to attach the money display to the player's screen. My goal is that when I send a message with the title "money," the player will see both the label "money" and their current balance, positioned at a specific offset on the screen.

How can I achieve this?

tidal wasp
#

can you use permutation to place to set multiple permutations to be placed

drowsy scaffold
#

how do I get types for Custom Components? It's a pain to have to search every single component manually

drowsy scaffold
#

I have the most recent ones

#

wait I'm probably not using these right

vestal thorn
#

How do you make a mob spawn at a mineshaft, with spawn weight?

marsh pebble
#

I need a drop down menu template with players

cold grove
cold grove
#
const player =....;
cons modal = new ModalFormData();
//etc
const players = player.dimension.getPlayers();
const playerNames = players.map((p) => p.name);

modal.dropdown(...., playerNames);
cold grove
#

I will not edit it flashitoLMAO

vestal thorn
tender pier
#

Is there a way to rotate or change the position of particles without having to write a function for each direction?

vestal thorn
cold grove
#

Just modifying the mineshaft feature

vestal thorn
#

Besides the mineshaft one

cold grove
vestal thorn
# cold grove No

Can't you detect a block in the world and do a random chance, to spawn a entity on that location?

cold grove
vestal thorn
#

Or around the player, like how spawn rules work

cold grove
#

Not worth it

#

Sorry mate

dim tusk
vestal thorn
#

Alright, thats sucks

vestal thorn
#

I didn't see a feature file for mineshaft

celest abyss
#

closeAllForms is beta?

drowsy scaffold
#

sounds right, it's still recent so

dim tusk
#

I think it's not.

#

I maybe wrong

#

Since iirc I tried closeAllForms in 1.3.0

#

-# but I have shit memory sooo.

dawn zealot
#

can someone helpies!

#

how do i drop a players inventory when they leave the game

drowsy scaffold
#

beforeEvents.playerLeave -> Get player inventory and equippable -> iterate through each and get all -> filter and map them after

drowsy scaffold
#

filter and map afterwards so that you don't risk losing the player instance because if you take too long in the event the player becomes invalid

#

at least from what I was told

drowsy scaffold
dawn zealot
drowsy scaffold
#

oh my god

dawn zealot
#

ive never had a need lmao

drowsy scaffold
#

that is seriously impressive considering you own like a very sizable server

drowsy scaffold
#
const inventory = player.getComponent(`inventory`).container
const equippable = player.getComponent(`eqippable`)
const eqippableItems = ["Head","Chest","Legs","Feet","Offhand"]

const items = Array.from({length:inventory.size},((_, i) => inventory.getItem(i)))
equippableItems.forEach((item)=> items.push(equippable.getEquipment(item)))
#

maybe

#

idk since mapping and foreach off the top of my head without autocomplete is rough but

dawn zealot
#

i understand it all but can u explain array.from?

drowsy scaffold
#

it creates an array based on a property, like what I do with the length

#

it defines an array of a fixed initial size

dawn zealot
#

so the size of the inventory then

drowsy scaffold
#

and then the second argument is a .map operator, where i take each slot's index and get the corresponding item to it from the player's inventory

dawn zealot
#

gotcha thanks:) understand it now

#

but 1 more quesiton

#

how exactly do i drop the item?

drowsy scaffold
#
for (const item of items) {
  player.dimension.spawnItem(item, player.location)
}
dawn zealot
#

U CAN DO THAT?

#

oh my lifes a lie

drowsy scaffold
#

you may want to save player location and dimension so you can access it after the player becomes invalid

dawn zealot
#

finally a person who gives me an explanation on what things do and doesnt link me a microsfot link that doesnt have what i ask for 🙏

#

aka smokey cough cough

drowsy scaffold
#

different people learn in different ways, smokey might learn best from source documentation so he refers others to it

#

nothing wrong with that

thorn flicker
drowsy scaffold
#

Reading docs are tough until they click with you, once you get the moment where it clicks you're basically set

dawn zealot
#

ill be reading abut pancakes next minute im talking about nuclear codes

wary edge
#

On my way to delete the Bedrock wiki.

thorn flicker
#

no

#

please

dawn zealot
tidal wasp
#

Can someone explain why the if statement in the switch case statement is being ignored

drowsy scaffold
tidal wasp
#

It will activate place weather im shifting or not

dawn zealot
wary edge
#

I mean...obviously people don't like reading so...

dawn zealot
drowsy scaffold
thorn flicker
drowsy scaffold
#

A guide on how to read and interpret documentation would unironically be a good developer resource

thorn flicker
#

funny

dawn zealot
tidal wasp
drowsy scaffold
thorn flicker
dawn zealot
thorn flicker
#

you spelled equippable wrong

tidal wasp
dawn zealot
#

blaming remanxnce for that

#

🙏

thorn flicker
#

read the code before using it

dawn zealot
#

i did

thorn flicker
#

lol

drowsy scaffold
#

😭 discord code without typescript completions is hard okay

dawn zealot
#

lmao no worries

drowsy scaffold
#

I gotta go sleep now though, it's like 11 for me

dawn zealot
#

also pretty sure i gotta do world.dimension.spawnItem right

thorn flicker
#

getDimension() and no

dawn zealot
#

getdimmension i mean

#

euyah

#

yeah

thorn flicker
#

use player's dimension property.

dawn zealot
#

i said it wrong

drowsy scaffold
#

world.getDimension but generally saving player.dimension is better

dawn zealot
valid ice
#

Also don’t forget to delay the spawn item, as it’s still in a before event (and definitely counts as modifying the world- aka privilege error)

drowsy scaffold
#

system.run

thorn flicker
#

run

valid ice
#

Or system.run

drowsy scaffold
#

that's what I forgot

dawn zealot
#

o

valid ice
#

System timeout or system run

drowsy scaffold
#

i thought it was too easy

valid ice
#

Not interval, unless you want to spawn in the items every few ticks

thorn flicker
drowsy scaffold
#

basically just wrap the who for-of loop in a system.run()

thorn flicker
#

show your full code.

dawn zealot
drowsy scaffold
dawn zealot
#
world.beforeEvents.playerLeave.subscribe(data => {
    const player = data.player;
    const location = player.location;

    if (getScore(player, `${config.combatScoreboardObjective}`) >= 1) {

        //Gets the items from the players inventory
        const inventory = player.getComponent(`inventory`).container
        const equippable = player.getComponent(`equippable`)
        const equippableItems = ["Head", "Chest", "Legs", "Feet", "Offhand"]

        //Adds the items to an array
        const items = Array.from({ length: inventory.size }, ((_, i) => inventory.getItem(i)))
        equippableItems.forEach((item) => items.push(equippable.getEquipment(item)))

        //Spawns the items on the location where the player left
        system.run(() => {
            for (const item of items) {
                player.dimension.spawnItem(item, location)
            }
        })
        //Tells the world that this player has left while in combat
        world.sendMessage(`§f${player.name} §dhas left while §cin combat! §7[§b${(getScore(player, `${config.combatScoreboardObjective}`) / 20).toFixed(2)}§3s§7]`)
        player.runCommand(`say test`)
    }
})
valid ice
#

Anything that modifies the world has to be set out of the before events read-only mode

thorn flicker
drowsy scaffold
# dawn zealot ```js world.beforeEvents.playerLeave.subscribe(data => { const player = data...
world.beforeEvents.playerLeave.subscribe(data => {
    const player = data.player;
    const {location, dimension} = player;

    if (getScore(player, `${config.combatScoreboardObjective}`) >= 1) {

        //Gets the items from the players inventory
        const inventory = player.getComponent(`inventory`).container
        const equippable = player.getComponent(`equippable`)
        const equippableItems = ["Head", "Chest", "Legs", "Feet", "Offhand"]

        //Adds the items to an array
        const items = Array.from({ length: inventory.size }, ((_, i) => inventory.getItem(i)))
        equippableItems.forEach((item) => items.push(equippable.getEquipment(item)))

        //Spawns the items on the location where the player left
        system.run(() => {
            for (const item of items) {
                dimension.spawnItem(item, location)
            }
        })
        //Tells the world that this player has left while in combat
        world.sendMessage(`§f${player.name} §dhas left while §cin combat! §7[§b${(getScore(player, `${config.combatScoreboardObjective}`) / 20).toFixed(2)}§3s§7]`)
    }
})
dawn zealot
dim tusk
#
world.beforeEvents.playerLeave.subscribe(({ player }) => {
    const inventory = player.getComponent('inventory').container;
    const equippable = player.getComponent('equippable');
    const equippableItems = ["Head", "Chest", "Legs", "Feet", "Offhand"];

    const items = [
        ...Array.from({ length: inventory.size }, (_, i) => inventory.getItem(i)),
        ...equippableItems.map(item => equippable.getEquipment(item))
    ];

    system.run(() => {
        items.forEach(item => {
            if (item) player.dimension.spawnItem(item, player.location);
        });
    });
});```
#

Somewhat like this?

dim tusk
#

-# oof I'm late to conversation lmfao

drowsy scaffold
thorn flicker
random flint
#

That only dropped the item, not clear their inventory ;D

dawn zealot
#

it works but got this error

dim tusk
thorn flicker
dawn zealot
#

even more to do

#

kms

dim tusk
random flint
#

Ye ik

dawn zealot
random flint
#

store player.id somewhere ig

dawn zealot
drowsy scaffold
dawn zealot
#

I WAS RIGHT

drowsy scaffold
#

this is what I was talking about when I mentioned filtering it after

dawn zealot
#

LOOK AT ME GO

valid ice
#

.filter

dawn zealot
drowsy scaffold
#
world.beforeEvents.playerLeave.subscribe(data => {
    const player = data.player;
    const {location, dimension} = player;

    if (getScore(player, `${config.combatScoreboardObjective}`) >= 1) {

        //Gets the items from the players inventory
        const inventory = player.getComponent(`inventory`).container
        const equippable = player.getComponent(`equippable`)
        const equippableItems = ["Head", "Chest", "Legs", "Feet", "Offhand"]

        //Adds the items to an array
        const items = Array.from({ length: inventory.size }, ((_, i) => inventory.getItem(i)))
        equippableItems.forEach((item) => items.push(equippable.getEquipment(item)))

        //Spawns the items on the location where the player left
        system.run(() => {
            for (const item of items.filter((itemStack)=>{itemStack !== undefined})) {
                dimension.spawnItem(item, location)
            }
        })
        //Tells the world that this player has left while in combat
        world.sendMessage(`§f${player.name} §dhas left while §cin combat! §7[§b${(getScore(player, `${config.combatScoreboardObjective}`) / 20).toFixed(2)}§3s§7]`)
    }
})
random flint
drowsy scaffold
dawn zealot
#

i see

#

idk why but i seem to only understand stuff fromr eading code

#

i hate it

valid ice
#
const words = ['spray', 'elite', 'exuberant', 'destruction', 'present'];

const result = words.filter((word) => word.length > 6);

console.log(result);
// Expected output: Array ["exuberant", "destruction", "present"]
valid ice
#

A bit of googling goes a long way 🙂

drowsy scaffold
#

smells like GPT to me (it's okay GPT is good at explaining native method functionality)

valid ice
#

Heck, even AI could help with that, it’s a given js method

drowsy scaffold
#

damn, checkmate me I guess😭

#

alright I'm out though

#

goodnight people!

dim tusk
#

Ahh, laggy asf.

dawn zealot
dim tusk
#

My goofy ahh will suggest to use dynamic property

thorn flicker
#

great, hes going to use ai now

dawn zealot
#

the filter kinda broke it

#

it no drop items :(

random flint
#

being able to write dynamicProperty inside beforeEvent is so convenient

long cargo
#
onStepOn: (({ block, entity, dimension }) => {
    const { x, y, z } = block.location;

    block.above().setPermutation(BlockPermutation.resolve(block.typeId, { "chiko:trap_top": true }));
    block.above().setType("chiko:trap");
})

How do I set the state to true?

valid ice
random flint
dawn zealot
#
        system.run(() => {
            for (const item of items.filter((itemStack) => { itemStack !== undefined })) {
                dimension.spawnItem(item, location)
            }
        })
``` this isnt spawning the items when adding the filter and i dont have a scooby doo why
#

no logs either

#

wada faq

dim tusk
#

why....this works 😭

thorn flicker
dawn zealot
dim tusk
dawn zealot
#

did ai make it

dim tusk
#

-# I mean the script I just recently sent

dawn zealot
#

lmfao

dim tusk
dawn zealot
random flint
#

Since when world dynamicProperty can use Array?

thorn flicker
#

Coddy used ai?

#

woww

dim tusk
dawn zealot
dim tusk
#

But not chatgpt, I used deepseek

thorn flicker
#

do you use ai often

dawn zealot
dim tusk
thorn flicker
dim tusk
dim tusk
thorn flicker
#

good

dim tusk
#

I feel disappointed

thorn flicker
#

in yourself or the ai

dim tusk
#

my self :(

thorn flicker
#

not good but good, this is a learning moment

random flint
#

I feel happi, kept using AI pls

dim tusk
#

wait, I'm lagging I need to restart discord.

dawn zealot
#

i get no logs inside the for

dim tusk
thorn flicker
dawn zealot
#
world.beforeEvents.playerLeave.subscribe(data => {
    const player = data.player;
    const { location, dimension } = player;

    if (getScore(player, `${config.combatScoreboardObjective}`) >= 1) {

        //Gets the items from the players inventory
        const inventory = player.getComponent(`inventory`).container
        const equippable = player.getComponent(`equippable`)
        const equippableItems = ["Head", "Chest", "Legs", "Feet", "Offhand"]

        //Adds the items to an array
        const items = Array.from({ length: inventory.size }, ((_, i) => inventory.getItem(i)))
        equippableItems.forEach((item) => items.push(equippable.getEquipment(item)))

        //Spawns the items on the location where the player left
        system.run(() => {
            for (const item of items.filter((itemStack) => { itemStack !== undefined })) {
                dimension.spawnItem(item, location)
            }
        })
        //Tells the world that this player has left while in combat
        world.sendMessage(`§f${player.name} §dhas left while §cin combat! §7[§b${(getScore(player, `${config.combatScoreboardObjective}`) / 20).toFixed(2)}§3s§7]`)
    }
})

//Removes items when player joins
world.afterEvents.playerSpawn.subscribe((data) => {
    const player = data.player;
    if (player.hasTag(`${config.combatTag}`)) {
        player.runCommand(`clear @s`)
        player.runCommand(`scoreboard players set @s ${config.combatScoreboardObjective} 0`)
        world.sendMessage(`§f${player.name} §chas logged back in after combat logging, items cleared.`)
    }
})
``` this what i got
random flint
#

You got a post? Let's not flood the general thread xd

thorn flicker
#

exactly

dawn zealot
thorn flicker
#

I was gonna say

dim tusk
#

shit, I broke my breeding system

dawn zealot
thorn flicker
#

breeding system?

dim tusk
#

I'm detecting breeding lol

thorn flicker
#

oh

#

I thought you recreated breeding

dim tusk
#

I'm refurbishing my stats addon.

thorn flicker
#

like

#

why

#

would someone do that

dim tusk
#

I'll actually try to release my stats addon and chess addon in public

#

only in GitHub tho..

random flint
#

Yeah, why should someone do that? That's morally wrong.
-# I love that idea, noted

thorn flicker
#

I read that as cheese

#

I need to sleep

dawn zealot
#

yeah it no give error im not sleeping tn

thorn flicker
#

lmao

dawn zealot
#

ioma go ask ai

thorn flicker
dim tusk
#

🤢

dim tusk
thorn flicker
dim tusk
random flint
dawn zealot
#

LMAO

#

ai fixed it

thorn flicker
dawn zealot
#

yippie!

thorn flicker
#

woo hoo!!!

valid ice
random flint
#

I'm detecting two brain cells having a conversation

thorn flicker
#

theres no braincells

dawn zealot
dim tusk
#

huh? Braincells?

#

what's that?

#

man, c'mon.... I broke my script then I broke my plugin?.

#

Imma kill myself now.

random flint
#

Shit just derailed so much, general script api had become offtopic#2

thorn flicker
warm mason
#

👀

thorn flicker
dim tusk
# thorn flicker dont

I can't take it anymore man, every beginner uses ai now... When you tell them not to , they'll keep using cause it's handy....

thorn flicker
#

be proud of that

random flint
#

Yes, stand proud, you're smart

dim tusk
#

I suffer 5 years from this thing and ai will just replace my brain?

#

damn, that sucks

#

Imma just cook

thorn flicker
#

its replacing everything

#

but dont let that bring you down

#

die as a warrior

warm mason
#

Script API - 15%
Channel with motivational speeches - 85%

thorn flicker
#

lmfao

chrome flint
#

what events are on Beta API 1.21.51?

thorn flicker
dim tusk
dim tusk
#

but in all seriousness, I'm kinda sad that people prefer to learn in ai than read.

thorn flicker
#

look away

dawn zealot
#

get with the times old timer!

thorn flicker
dim tusk
#

back in my day 👴

thorn flicker
#

people dont like learning, they just want to quickest way to do stuff, its not about the experience.

warm mason
random flint
dawn zealot
random flint
#

I just learn about labeled break from AI lol. So it do have some merits

thorn flicker
dawn zealot
#

ive never even used ai until 10 minutes ago

#

but will be using it more now

dim tusk
#

ngl, one of my friends thought I'm using ai since when I give a snippet it looks like ai lmfao

#

I dunno if I should be happy or not.

thorn flicker
dawn zealot
thorn flicker
dawn zealot
#

on my yt, we taking this deal or nah ik its very off topic but i need an answer

thorn flicker
#

buddy

#

lol

dawn zealot
#

thats it

#

im crashing out

thorn flicker
dawn zealot
thorn flicker
random flint
#

no

distant gulch
#

Even if i hate do put EVERYTHING in one file, i needed to and its kind of still small

#

Hello Guys

chrome flint
#

how do i lock an item in slot using scripts

bright dove
#

function applyJumpingEffects(entity, vector, gravity) {
    const initialJumpPower = Math.max(0.0001, gravity.value / 200); 
    const steps = Math.max(30, Math.ceil(70 - gravity.value * 3)); //smooth ascent

    // knockback steps
    (function applyKnockbackStep(step) {
        if (step < steps) {
            const progress = step / (steps - 1); // Normalize the step
            const power = initialJumpPower * Math.pow(1 - progress, 5); // Quintic power for verrryyyyyyy gradual reduction

            entity.applyKnockback(vector.x, vector.z, vector.hzPower, power);

            // Schedule the next step
            system.runTimeout(() => applyKnockbackStep(step + 1), 2); // Call next step after 1 tick
        }
    })(0); // Start with step 0
}//KILL ME ;-; 
#

Help

dim tusk
celest abyss
#

Line 247

player.teleport(player.location.x, player.location.y - 0.2, player.location.z)  
warm mason
celest abyss
#

Ty

ivory bough
#

How to make my entity ignore enemy's armor resistance when attacking?

untold magnet
ivory bough
misty dagger
#

I attempted to use async functions for the heaviest parts of my code, but it didn't seem to have any effect. Did they render them basically useless?

#

I was detecting it by getting the system time before and after and getting the difference. Only an async function call is in between, so it should have been 0 or 1, but it was some larger number instead.

untold magnet
#

so u will apply the damage instantly via scripts

ivory bough
untold magnet
#

idk.

dim tusk
untold magnet
#

i can make the entity follow the player but doesn't deal any damage, just like how the creeper works

dim tusk
untold magnet
#

and make it damage the player via scripts ( getting the targeted player around the entity )

dim tusk
#

that's the point right now, pure scripts no editing the entity.json

untold magnet
#

he wants to make his entity damage the player, but without the armor resistance

#

the damage will ignore the player armor

untold magnet
dim tusk
#

no need to explain it to me.

#

-# actually I am but not that stupid.

untold magnet
bright dove
#

so satisfying

chilly fractal
#

Yo, does anyone know how'd one apply knockback/impluse on the entity he hits?

#

Specifically like, a knockback neo

#

I know, entityHitEntity and etc, i am asking about the math involved

knotty plaza
prisma shard
#

hi redtnt

serene lava
#

i asked to Chatgtp how to add fuel to a steam locomotive, it showed me this script but is not working, ¿someone knows if this has a mistake?

valid ice
#

itemUseOnEntity ain't an event

serene lava
knotty plaza
#

Actually it is pretty good for an AI

#

The code is almost correct in everything

serene lava
#

what is the mistake?

knotty plaza
#

Use the playerInteractWithEntity event if you are using beta-api

#

If not, just add the minecraft:interact component to your entity and make it run the scriptevent command

grave thistle
#

How do I get the percentage symbol to show on my modal ui? Ingame the symbol doesn't appear

valid ice
#

Double percentage symbol

cinder shadow
#

wait till you have to do a triple percentage symbol

#

Then you realize that making the % show up on the items display name by doing that will also make it not show up in script forms

#

So then you use 4 % symbols

rose light
#

Why doesn't the particle appear when I use the item? I'm having extreme difficulty making it appear

wary edge
chilly fractal
#

Have you ever heard of a knockback neo?

#

Ye i meant like that

knotty plaza
chilly fractal
#

Like an item that has knockback 10

#

On java bedwars servers

knotty plaza
#

Oh I see

chilly fractal
#

I kinda wanna do exactly what it does but just as like, like the knockback, i dont want the item checking or anything, just the math to apply correct impluse and knockback depending on both the attacker and target

knotty plaza
#

For players its applyKnockback, and you have to pass the x and z direction, then the horizontal force and the vertical force

chilly fractal
#

But what about .applyImpluse

#

I need to do the same for entities

knotty plaza
chilly fractal
#

I know

chilly fractal
knotty plaza
chilly fractal
knotty plaza
#

I don't see why

chilly fractal
#

Yeah good point

grave thistle
untold magnet
#

why when i try to detect the new pig/cow/chicken variants ( console.warn(variant) ) it returns undefined?

untold magnet
knotty plaza
#

Is that already out?

untold magnet
knotty plaza
#

I just downloaded the 1.21.60 behavior pack and there is nothing about that

gaunt salmonBOT
austere flax
#

what are the types for beta stable

knotty plaza
austere flax
#

its 1.21.60 now

#

i dont think types are released just yet

knotty plaza
#

Yeah, they aren't

austere flax
#

okay i'll keep an eye on it

#

cheers

knotty plaza
#

I just checked the official behavior

#

Idk about preview

distant tulip
#

the repo won't include it, sense it is behind experimental

#

all experimental have there own pack

untold magnet
knotty plaza
distant tulip
# distant tulip

@untold magnet the experimental stuff is not there
here is the files

untold magnet
#

my eyes bad

knotty plaza
#

Yeah I recommend downloading the one Minato sent

untold magnet
distant tulip
#

sorry, no time to check the files

untold magnet
# distant tulip sorry, no time to check the files
    "description": {
      "identifier": "minecraft:pig",
      "spawn_category": "creature",
      "is_spawnable": true,
      "is_summonable": true,
      "properties": {
        "minecraft:climate_variant": {
          "type": "enum",
          "values": [ "temperate", "warm", "cold" ],
          "default": "temperate",
          "client_sync": true
        }
      }
    },```
#

should i just do getComponent('minecraft:climate_variant') something?

distant tulip
#

entity.getProperty("minecraft:climate_variant")

untold magnet
#

interesting

untold magnet
# distant tulip entity.getProperty("minecraft:climate_variant")
const newVariants = eEntity?.getProperty('minecraft:climate_variant');
if (newVariants?.value === 'temperate') { ,,, }
or
if (newVariants = 'temperate') { ,,, }```![bao_icon_entities](https://cdn.discordapp.com/emojis/937567566442922084.webp?size=128 "bao_icon_entities")?
distant tulip
#

== or ===
= is for assigning values

untold magnet
#

alright.

distant tulip
#

and no .value

untold magnet
distant tulip
#

🤷‍♂️

untold magnet
#

( i mean the new pigs / cows / chickens / upcoming sheeps / upcoming goats )

distant tulip
#

mojang is known for there consistency

untold magnet
#
  • tell me if it is possible to detect if the goat have horns or not,
#

if it is hardcoded or too complicated, screw it

gaunt salmonBOT
grim raft
distant tulip
celest abyss
granite badger
#

not released yet

untold magnet
grim raft
distant tulip
untold magnet
#

well

#

how about the new texture path of the new variants?

distant tulip
#

can playanimation play bp animations?

untold magnet
#

is it like so:
entity/pig > temperate pig
entity/pig_cold > cold pig
entity/pig_warm > warm pig

untold magnet
gaunt salmonBOT
untold magnet
rough jackal
dawn zealot
#

anyone have the change log so i can fix these

rigid meadow
#

i heard that there is gamemode 6. is it possible to do that using scripting?

untold magnet
#

already solved

valid ice
#

1.17.0 ain't the same as 1.17.0-beta

#

This has been the case for like, every version that's released for scripts so far

distant tulip
#

v1 final moments

jade grail
#

UH quick question

#

is this not how u get the entities current dimension ?

jade grail
#

im assuming its cuz player isnt identified

sharp elbow
#

If you are getting an error, probably

jade grail
#

ok thats it then thanks

#

yall know how i can the get location of a dead entity which has js died?

#

this is in an after death

#

event

#

it works with the player but if any other entity dies it is fully removed so idk from all dimensions

dim tusk
jade grail
#

is that new cuz i dont remember it

dim tusk
sweet seal
#

How to update pack on a realm without removing/resetting dynamic properties?

jade grail
#

it doesnt seem to work

jade grail
sweet seal
#

but somebody said if i reset the packs uuid to update it itll reset

distant tulip
sweet seal
#

so i can change the uuid?

sweet seal
#

im confused

distant tulip
jade grail
#

im confused to now

thorn flicker
#

why are you changing the uuid

sweet seal
#

i want to update the pack

jade grail
#

so can multiple addons use the same dynamic properties? and it wont overlay

thorn flicker
#

just change pack version like minato said, not the uuid.

distant tulip
dim tusk
sweet seal
#

do i need to make it development

distant tulip
#

no, but recommended for development

jade grail
distant tulip
#

removedEntity

jade grail
dim tusk
#

shii

thorn flicker
#

removedEntity

#

not entity

dim tusk
#

I always forget that lol

thorn flicker
dim tusk
jade grail
#

ty yall tht part is working now

#

but i got a another problem

#

heres the line in that

sweet seal
# distant tulip

i edited the version by 1 and changed the name but when i turn it pack into a normal pack i only see the older version of it

jade grail
distant tulip
distant tulip
jade grail
sweet seal
dim tusk
jade grail
#

item is defined upper up

dim tusk
jade grail
distant tulip
dim tusk
#

Thank god I didn't release my addon yet since I remembered they changed the 'fluidContainer' component to 'fluid_container'

glacial widget
#

Is BDS 1.21.60 out yet?

thorn flicker
rose light
#

Is it possible to make a particle that can see from far away and see through walls?

thorn flicker
rose light
#

and through block? is it possible?

thorn flicker
#

not with scripts.

#

thats more of a client side thing

#

im not sure if you can

rose light
#

it can be anything as long as it works

thorn flicker
#

ask in #1067869590400544869

cold grove
lucid scroll
#

Anybody know if it's possible to zero out an entitys y velocity while retaining it's x and z?

Basically stop if from going up or down, but keep it moving forward?

dim tusk
umbral dune
#

How do I send the name of the pack an item belongs to?

#

*send a message to the player who held the item

dense wraith
#

One message removed from a suspended account.

quick shoal
dense wraith
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

quick shoal
#

Uhmm

tender pier
#

Is there anyway to control the life time of a particle?

dim tusk
dense wraith
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dim tusk
dense wraith
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dim tusk
#

ok so I don't think that's a script issue side, that's more like in json ui side since it shouldn't happen if you already hid it.

dense wraith
#

One message removed from a suspended account.

dim tusk
dense wraith
#

One message removed from a suspended account.

dim tusk
dense wraith
#

One message removed from a suspended account.

dim tusk
#

like I made 3 buttons in the ui, and I added 2 buttons in script side, thee last button isn't functional at all

#

tho it still exists

#

Also let's move to #1067869374410657962

wary edge
dim tusk
umbral dune
#

but in this case, the pack.name I need can be any, I have no way of predicting

wary edge
#

I don't believe it's possible then. Best you can do is just get their namespace. What are you trying to create?

wary edge
#

Best you can do is just display the namespace.

umbral dune
#

Can I at least get the display name of the block?

#

vanilla blocks

wary edge
#

Oh, is it like WAILA?

#

Poggy made one if so. You can reference that.

drowsy scaffold
#

you can format the typeId of the block to make it look like the vanilla display name

wary edge
#

What
Am
I
Looking
At

#

WAILA

umbral dune
drowsy scaffold
#

huh, interesting

umbral dune
#

you click and it shows entity/block information

drowsy scaffold
#

...so basically WAILA

#

in item format

umbral dune
#

best description

drowsy scaffold
#

since it's intended for vanilla items, you can do the following to get a DisplayName-ish text

#
const displayName = block.typeId.split(":")?.pop()?.split('_').map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(' ');
dense wraith
#

One message removed from a suspended account.

umbral dune
#

and using an item's id as display name is not even reliable,

drowsy scaffold
#

oh I didn't even think of translations for it with lang files

#

that's so much smarter

umbral dune
#

fixing some things.

const displayName = block.typeId.split(":")[1].split("_").replace(/(\b[a-z](?!\s))/g, x => x.toUpperCase());
#

why the ??

drowsy scaffold
#

it's a part of prototypes that I was making and I considered the possibility that someone might be stupid and try to pass an invalid namespace or manually do it

umbral dune
#

anyway, thanks for the help

drowsy scaffold
#

yeah, hopefully you at least got some idea of where to go with it from it

#

also unrelated but how does one just memorize regex patterns to use 😭

valid ice
#

Regex 101 😛

dim tusk
#

I despise regex

#

-# because I didn't learned them

dense wraith
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

dim tusk
#

as I said that's not a script side problem

#

that's json ui

dense wraith
#

One message removed from a suspended account.

serene lava
#

i want to make a homing projectile that follows the target in a straight direction,because i want to make that the projectile doesn't move like a Shulker Bullet

celest abyss
#

It is possible to add a decimal number to a variable

#

Let's say for example


let timer = 0.5

timer += 0.5

timer == 1
valid ice
#

no

#

A number ain't a variable

dense wraith
#

One message removed from a suspended account.

sharp elbow
# valid ice no

What? No, this logically should be fine. @celest abyss The concern should more be about floating point precision loss.

valid ice
#

They edited it 😭

sharp elbow
#

Ah OK lol

valid ice
#

Now I look like the weird one

sharp elbow
#

I bet it was some 0.5 += 0.5 before

valid ice
#

Jarvis, pull up those logs

celest abyss
#

I had no ideas for the variable name

sharp elbow
#

For floating point arithmetic math, try this floating point approximate-equals function:

//https://stackoverflow.com/a/32334103
function f_approxEquals(a, b) {
    if(a == b) return true;
    let diff = Math.abs(a - b);
    let norm = Math.min(Math.abs(a) + Math.abs(b), Number.MAX_VALUE);
    return diff < Math.max(norm * Number.EPSILON);
}

const threeTenths = 0.1 + 0.1 + 0.1;
console.log(threeTenths == 0.3);               // false
console.log(f_approxEquals(threeTenths, 0.3)); // true
dense wraith
#

One message removed from a suspended account.

sharp elbow
#

@dense wraith I'm assuming this shows you only the cosmetics you have acquired, instead of all cosmetics. I would personally construct an array of selectable cosmetics that have indices consistent with the form, then index into that with the form response's selection property.

const Selectable = headcosmetics.filter((option) => player.hasTag(option.name));

for(const option of Selectable) {
  costab1.button(option.name, option.texture);
}

costab1.show().then(function onCosmeticSelection(response) {
  if (response.selection == undefined) throw "nothing selected case";
  const selection = Selectable[response.selection];
  selection.whateverElse();
});
#

Granted, if you have a lot of cosmetics then copying a filtered headcosmetics into an array could be memory-intensive and expensive

#

Might be able to optimize that with a lookup on all tags at once, by inserting player.getTags() into a Set and running has() on that Set

prisma shard
#

CAN SOMEONE TELL ME

#

WHY MOJANG IS NOT ADDING EntityHurtBeforeEvent in SCRIPT API

#

mojang even going to release script api 2.0.0..... but still not adding EntityHurtBeforeEvent 😭

sharp elbow
#

Another idea is to map button indices to headcosmetics indices:

const PlayerTags = new Set(player.getTags());
const ButtonCosmeticMap = new Map();

let buttonIndex = 0;
for (let cosmeticIndex = 0; cosmeticIndex < headcosmetics.length; ++cosmeticIndex) {
  if (PlayerTags.has(option.name)) {
    costab1.button(option.name, option.texture);
    ButtonCosmeticMap.set(buttonIndex++, cosmeticIndex);
  }
}

costab1.show().then(function onCosmeticSelection(response) {
  if (response.selection == undefined) throw "nothing selected case";
  const selection = headcosmetics[ButtonCosmeticMap.get(response.selection)];
  selection.whateverElse();
});
#

In either case, it's worth trying to do the lookup on some form of headcosmetics rather than try to carry the object over, because this allows your code to be more modular.

#

Huh, I actually like the button mapping idea, I'd personally roll with that

dim tusk
#

-# me who just reads this because I'm fascinated with the idea lol

sharp elbow
#

It's an interesting problem, had me thinking more than I expected at first

prisma shard
#

sprunkles are you an ai

sharp elbow
#

does not compute, does not compute, system shut down

prisma shard
#

ok bye im going for school

hardy tusk
#

Asking is all you can do really. If you're actively demanding something, chances might even be lower that it gets added. You're not just asking for a feature, you are actively telling someone how they have to do their job, by requiring them to shift around their workplan and roadmap and work on this feature just for you.

#

And no one wants to be told how they should do their job

warm mason
#

He just can't find another way to create what he needs.

random flint
#

EntityHurtBeforeEvent? we have that at home.
||entity.json 🥲||

random flint
#

Put weakness to put their damage to zero.

#

Hide the effect hud
-# Gaslight them

valid ice
#

Hmm yes today I will make custom enchants Clueless

random flint
#

How many times did you try to make one

valid ice
#

Thrice

#

Was successful on my third attempt

#

No before hurt is pain, fr

shut citrus
#

can I install addons in preview version

chilly fractal
#

I am losing my sanity trying to emulate linux ubuntu-20.04

#

On my arm64 mobile device

#

I should probably just go get a proper host to test my server-net scripts...

#

I still wanna host the test server locally :(

#

Plz moyang release an arm64 version of the bds software

dusk agate
#

Imagine not have the 100k msg🤫🧏‍♂️

quick shoal
#

Guys who can help me tsc convert

#
ChestUI.setUIPage('home', new Page({
    11: new Button('<', 'arrow', {
        onClick: ({ player }) => {
            let idx = ChestUI.getData(player).idx as number
            if (idx > 0) idx--
            ChestUI.setData(player, { idx })
        }
    }),
    15: new Button('>', 'arrow', {
        onClick: ({ player }) => {
            let idx = ChestUI.getData(player).idx as number
            if (idx < 2) idx++
            ChestUI.setData(player, { idx })
        }
    })
}, {
    start: (({ player }) => {
        ChestUI.setData(player, { idx: 0 })
    }),
    update: ({ player, container_e }) => {
        const idx = ChestUI.getData(player).idx as number
        let item: ItemStack
        switch (idx) {
            case 0:
                item = ChestUI.newUIItem(`Hello world`, 'command_block')
                break
            case 1:
                const time = new Date();
                time.setHours(time.getHours() + 8);
                const formattedTime = time.toISOString().slice(11, 19);
                item = ChestUI.newUIItem(formattedTime, 'clock')
                break
            case 2:
                const count = world.getAllPlayers().length
                item = ChestUI.newUIItem(`${count}/30`, 'oak_sign')
                break
        }
        container_e.setItem(13, item) // setPageItem would be better
    },
    tickInterval: 1
}))
trail marten
#

what's the difference between player.setDynamicProperty() and player.setProperty()

#

it seems like they do share the same purposes

#

but different function name

#

idk which is the optimal one though

noble bolt
#

native type conversion failed

dim tusk
#

imagine it as a storage and it won't disappear unless you delete them.

trail marten
trail marten
trail marten
#

alright thanks

random flint
# trail marten what's the difference between `player.setDynamicProperty()` and `player.setPrope...

.setProperty(): Set Entity property. Entity property is usually used in JSON logic with certain Molang query functions. Value change is delayed by a tick. Cannot be used in beforeEvent. The property is readable by all scripts from another pack.

.setDynamicProperty() Unique storage bound to the entity and the addon's script. (Other scripts from another pack can't read them... iirc). Immediately changes. Can be used in beforeEvent. Only readable through script.

prisma shard
#

lol

chilly fractal
dense wraith
#

One message removed from a suspended account.

dense wraith
#

One message removed from a suspended account.

sharp elbow
#

(I realized I forgot to define the option variable the first time, whoops)

untold magnet
dense wraith
serene lava
cold grove
cold grove
#

👀

dusk agate
chilly fractal
#

Well not the actual 100k message, cuz that was probably wayy too long ago, but discord keeps trippin' and it shows that we still haven't passed 100k every now and then

serene lava
dusk agate
sweet seal
#

How to remove footstep sound and particle if you have a certain score?

rough jackal
#

Is there a datapack that has all of the vanilla entity behavior and loot tables?

drifting ravenBOT
marsh pebble
#

Hey! Anyone know how i whould use my plot system to make an invite for my plot system

  const form = new ActionFormData().title("Title");
  form.body("Select a Player");
  for (const player of world.getAllPlayers()) {
    form.button(player.name);
  };
  form.show(target).then(responses => {
    const selectedPlayer = world.getAllPlayers()[responses.selection];
    selectedPlayer.addTag("tag");
  });
};```
My plot system uses scores "locationID=1" Than your plot is 1 And 
"locationID1=1" than that's your friend slot.
?
tiny tartan
#

can i make specific item fire/lava protected?

rough jackal
ivory bough
#
function hasBlock(players, anomaly) {
  const head = players.getHeadLocation();
  const distance = Math.sqrt((head.x - anomaly.location.x)**2 + (head.y - (anomaly.location.y + anomaly.getHeadLocation().y)/2)**2 + (head.z - anomaly.location.z)**2);
  let block = players.dimension.getBlockFromRay(head, players.getViewDirection(), {
    maxDistance: distance+(anomaly.getHeadLocation().y - anomaly.location.y)/2
  });

  if (block == undefined) return false;
  return true;
}

system.runInterval(() => {
  for (let player of world.getAllPlayers()) {
    for (let entityHit of player.getEntitiesFromViewDirection({ 
      ignoreBlockCollision: true,
      type: "space:anomaly"
     })) {
      if (hasBlock(player, entityHit)) {
        world.getDimension("overworld").runCommandAsync("event entity @e[type=space:anomaly] despawn");
      }
    }
  }
}, 5);

[Scripting][error]-TypeError: cannot read property 'x' of undefined at hasBlock (anomaly.js:100)
at <anonymous> (anomaly.js:115)
How to fix this?

slim spear
#

ok

dim tusk
#

Are you sure you're looking at an entity?

lone thistle
#

Scripting if entityHurt gets a beforeEvent

ivory bough
ivory bough
#
function hasBlock(players, anomaly) {
  const head = players.getHeadLocation();
  const distance = Math.sqrt((head.x - anomaly.location.x)**2 + (head.y - (anomaly.location.y + anomaly.getHeadLocation().y)/2)**2 + (head.z - anomaly.location.z)**2);
  let block = players.dimension.getBlockFromRay(head, players.getViewDirection(), {
    maxDistance: distance+(anomaly.getHeadLocation().y - anomaly.location.y)/2
  });

  if (block == undefined) return false;
  return true;
}

system.runInterval(() => {
  for (let player of world.getAllPlayers()) {
    for (let entityHit of player.getEntitiesFromViewDirection({ 
      ignoreBlockCollision: true,
      type: "space:anomaly"
     })) {
      if (hasBlock(player, entityHit)) {
        world.getDimension("overworld").runCommandAsync("event entity @e[type=space:anomaly] despawn");
      }
    }
  }
}, 5);

[Scripting][error]-TypeError: cannot read property 'x' of undefined at hasBlock (anomaly.js:100)
at <anonymous> (anomaly.js:115)
Does any one know how to fix this?

covert goblet
#

Is it possible to offload a scripting process to the client, for example instead of the server checking for every block that's broken by every player every tick, can the players client not detect it and send the information to the server, doesn't have to be realtime. I'm just trying to think of efficient ways to get the data I want

chilly fractal
#

Nope

hardy tusk
glacial widget
sharp elbow
#

If the entity was found, it returns an object with an entity property

#

In the function hasBlock, your distance variable is redundant, since the anomaly parameter also already has a distance property you can use (albeit, from the entity's bounds, not its location). If you wanted to calculate the distance by hand, you need anomaly.entity.location

sage sparrow
#

hi there, is it possible to get via API the target a mob is targeting?

upper adder
#

How to place a block at certain coordinates

charred gorge
oak lynx
#

what are the packets used for crashing?

#

i wanna make an anti-crasher

#

i know that some crashers use /me spam

sage sparrow
fallow minnow
#

a lot of the crashers have advanced a lot

#

they have external methods where it sends nothing through packets

#

they don't join or anything

echo canopy
#

Hello how do I send a message to a player saying "You have successfully spawned!" when the player joins the world

untold magnet
# fallow minnow code
.body(`Welcome, §a${player?.nameTag}§r!\n\nThank you for downloading §lMore Heads & Plushies§r!\nWe hope you have a great time collecting and decorating with all the new mob heads and plushies.\n\nThis addon introduces heads for almost all vanilla mobs, giving you tons of options to customize your world.\nHowever, some mobs like -§aSlimes§r and §cMagma Cubes§r- don’t have anything\nbecause they are either bugged or not possible to add due to §lMinecraft Bedrock limitations§r.\n`)```
#

is it bec of the ( don't " ' " ) thing?

valid ice
#

Yes

untold magnet
#

god

#

should i just say dont without the ' bao_icon_entities

fallow minnow
#

'

valid ice
#

Use ' directly

fallow minnow
# untold magnet ```js .body(`Welcome, §a${player?.nameTag}§r!\n\nThank you for downloading §lMor...
.body(`Welcome, §a${player?.nameTag}§r!\n\nThank you for downloading §lMore Heads & Plushies§r!\nWe hope you have a great time collecting and decorating with all the new mob heads and plushies.\n\nThis addon introduces heads for almost all vanilla mobs, giving you tons of options to customize your world.\nHowever, some mobs like -§aSlimes§r and §cMagma Cubes§r- don't have anything\nbecause they are either bugged or not possible to add due to §lMinecraft Bedrock limitations§r.\n`)```
#

u used some special one

untold magnet
distant tulip
#

" ' "
or
' \' '

fallow minnow
#

’ compared to '

untold magnet
#

anyways,

#

i dont think it is possible to add a body below the buttons, right?

valid ice
#

Try it and see I guess

remote oyster
oak lynx
#

okay but what packets usually cause issues

remote oyster
# oak lynx okay but what packets usually cause issues

That can vary depending on how desperate they are. The two common ones are most certainly CommandRequest and LegacyTelemetryEvent packets. There are others too. If you know of a server or personally experience it on your own server, you can just monitor and log the traffic to see what packets are causing problems or raising flags prior to a crash.

untold magnet
#

like
.body('1')
.button('hi')
.body('2')
it will just show '2' above the button

valid ice
#

Welp

dim tusk
#

if you want to have two body effects, use one body effect and in json ui divide them and place where the second body will be.

iron apex
#

Guys, my scripts stopped working on the new version. What do I need to do to make them work?

untold magnet
valid ice
#

Game tells you versions when you join a world

charred gorge
untold magnet
iron apex
valid ice
#

The script dependency version

iron apex
#

Well, I have 1.17.0 beta

thorn flicker
#

make it not beta

#

its out of beta now

iron apex
#

Okay

thorn flicker
#

or if you want to continue using beta, just use 1.18.0-beta

valid ice
#

Or use 1.18.0 beta, ye

iron apex
#

Thanks for the help

celest abyss
#

How to delete a dynamic property ?

valid ice
#

Set it to undefined

cinder shadow
#

did the getScore method change in the recent update?

#

Updated my add-on for the first time in 8 months only for it to not be playable because my getScore function no longer works 💀

#

oh it didn't, I'm just bad 😔

hushed ravine
#

Can I make death messages use the nameTag instead of the actual name? I'm making a nicking (.nick) system

chilly fractal
hushed ravine
#

I can... turn them off?

chilly fractal
#

(You will have to make every single death message, and if an addon edited it, you won't have the "edited" death messages from lang)

chilly fractal
hushed ravine
tender pier
#

How can I detect when the time is set to a specific value?

#

Like 27000

#

Or something like that

chrome flint
#

does equippable component works with entities now?

#

whats the other work around to replace entity's equipment with itemStack?

dim tusk
tender pier
#

I have no idea how to do it

edgy elm
#

hello here. I just want to ask how you handle button texture in a form if u are mapping inventory items. For example you want to map players inventory and u want to show it as a button. You want it to show a texture the same as the item. How can i do this?

dim tusk
#

tho you should remember that aux id shift if there's custom items.

valid ice
prisma plaza
#

Fun little stress test of some scripting basics. What's a good server time to aim for?

edgy elm
dim tusk
edgy elm
#

joke lang boss hahahahahha

dawn zealot
#

how do i remove the equipment lore

hardy tusk
#

cant

dawn zealot
#

breh

hardy tusk
#

it goes away when you're not in search inventory tab I think

dawn zealot
#

i see

dim tusk
#

But you make it not gettable in creative inventory

dawn zealot
#

got it

celest abyss
#

I'm looking for a random button system in a form

#
   const menu = new ActionFormData();
  menu.title(`Test`);
  menu.body(` Test`);
  menu.button(target.name, target.id)
#

Let's say target should be a random player

#

I mean that among all the players who have a Tag, a randomness system is created and a button is created

dim tusk
#

wait, is it only one random player??

celest abyss
dim tusk
# celest abyss Yes
const players = world.getAllPlayers();

if (players.length > 0) {
    const random = players[Math.floor(Math.random() * players.length)];

    const form = new ActionFormData()
        .title('Test')
        .body('Test')
        .button(random.name);
}```
celest abyss
#

Ty

dawn zealot
#

just talked to an ai for 2 hours to help me fix my code and it finally worked 😭

serene lava
#

White scripts is so annoying. Even when the script doesn't work

remote oyster
autumn marsh
#

Is this code okay?

dawn zealot
#

after 4 hours of asking AI i now have my lore buying enchants and xp updating 😭 🙏

slow walrus
#

looks pretty good

valid ice
#

4 hours on AI is wild comms

#

Is the data at least saved in dynamic properties?

untold magnet
#

sup guys, why is this thing:

        let rCode = new ModalFormData();
    rCode.title(`title`);
    rCode.textField(`Hi - under processing`, `testing`);
    rCode.show(player).then(({formValues}) => {
      if (formValues[0] === 'codetest') { *** }```have a log showing up when i close the form-ui without writing anything?
simple zodiac
#

Yeh cuz formValues is undefined when you just close the form meaning you can't read [0] from it

dim tusk
untold magnet
dim tusk
errant wadi
#

I recommend do it with canceled

dawn zealot
#

it cycles through each line of the lroe until it matches with lets say level, then uses regex to return the level, xp and xpmax

#

used AI cuz i had no clue how to do it, now i can do it without ai :)

valid ice
#

Dynamic properties are a lot easier to store data in and have a much higher limit than lore does

dawn zealot
#

i dont feel like going through the 10 step process

errant wadi
#

dynamic properties cannot be set on stackable items

#

😭

valid ice
dawn zealot
#

plus reading off the lore is better anyway

#

the lore limit doesnt affect me too

errant wadi
valid ice
#

20 lines, 50 characters

dawn zealot
valid ice
#

It will happen to you

dawn zealot
valid ice
#

Dynamic properties are also very fast compared to lore

dawn zealot
#

i have 10 enchants

valid ice
#

parsing a single string (saved as json) vs parsing with regex

#

trust me, I have done both systems. Lore works, sure, but it's so much easier with DPs

dawn zealot
#

doesnt matter still does it quick enough

dawn zealot
errant wadi
#

making a parser for each line will be more terrible..

dawn zealot
#

this how mine works

errant wadi
#

just use dynamic properties 😭

dawn zealot
sharp elbow
wary edge
#

If people wanna suffer let them suffer.

valid ice
#

const level = item.getDynamicProperty('level') ?? 0

#

Very easy to use, the design is very human

errant wadi
#

very human

#

lol

dawn zealot
errant wadi
#

It's saved on the item

dawn zealot
#

it will still be on the item

valid ice
#

Have you tried just updating the pack's version?
Idk if you necessarily need to go through all those steps, if just the version is updated.

dawn zealot
errant wadi
dawn zealot
#

or will it reset

#

like player and world

errant wadi
#

try it yourself 💯

dawn zealot
sharp elbow
#

I suppose you could download the world off the Realm, apply your pack changes (including the version in world_*_packs), then reupload it, but that becomes infeasible after the world reaches a certain size

dawn zealot
#

bro u shouldve seen the amount of debuggin i had that ai do 😭

oblique heath
#

why are you making ais do stuff

#

tsk tsk

dawn zealot
#

chat length

sharp elbow
#

That level of proompting is crazy

errant wadi
#

I like this whole try-catch lol

dawn zealot
dawn zealot
#

the ai was struggling with getting the mainhand item

#

it kept getting hotbar slot

oblique heath
#

well duh

dawn zealot
#

or would make it mainhand instead of Mainhand

oblique heath
#

why would it know anything about that

dawn zealot
#

it knew about it on my enchants one

oblique heath
#

righttt

dawn zealot
#

but for the pickaxeXP it didnt

sharp elbow
#

What's the point of documentation if nobody is willing to read it

dawn zealot
wary edge
sharp elbow
#

It could be this way. I have actually not read whatever it is you're referencing haha

#

Whenever I write documentation I "yap," but that's to explain what it is doing

dawn zealot
dawn zealot
#

like sometimes it will be on the right track then start talking about something thats completely different

#

anyway i dont wanna get offtopic

sharp elbow
#

Is it some "recipe website where I tell my funny anecdote" level of yap

dawn zealot
#

but if i use item.getDynamicProperties how would i display it on the lore, wouldnt i need to use lore anyway for that?

sharp elbow
#

Yeah sorry, lol

dawn zealot
sharp elbow
#

Yep. But at least the source of truth is in the property, not the lore. The former is easier to parse and is more reliable(?) to store

valid ice
distant tulip
#

it won't be a wiki if all it provided it straight up templates

dawn zealot
#

so basically just run a function that updates the lore whenever i call it then

valid ice
#

Lore has always been meant for displaying stuff; it was never meant to store data

oblique heath
#

yeah what crazy person uses lore for that

#

purpose

distant tulip
#

imagine if there was a lore database

wary edge
#

If only lore was translateable.

valid ice
#

Just the fact that you can store an object of data on an item dynamic property should be enough to not use lore for data storage

oblique heath
#

what smokey actually wants is custom item descriptions

#

translatable lore is just crazy people talk

sharp elbow
#

Let me put four lines of flavor text on my items for lore reasons, dammit

oblique heath
#

lore but better

#

lore but its not saved on an nbt tag 😂

distant tulip
#

move it to ore ui and let me play Doom there