#Script API General

1 messages · Page 118 of 1

meager zenith
#

no it turns out my entire world was being buggy, had to load it up in a new world and it worked

knotty plaza
#

If its only xyz then you can save it directly to a dynamic property

#

If it has more properties, then you can stringify it and then save it to a dynamic property

glacial widget
#

IS there a way to check if a player has OP?

devout sandal
#

there a good way to get an equipped items id aux?

warm mason
devout sandal
#

frickkkkkkk.. so i would have to make a tuple that has EVERYTHING??

warm mason
devout sandal
#

bruh. wasnt there some calculation you could do based on the items id? is that broken now?

fallow minnow
north rapids
#

is there any way to get entity equipment slot?

digital robin
lilac glacier
#
import { system, world } from "@minecraft/server";

{
system.afterEvents.scriptEventReceive.subscribe((event) => {
    const { id, sourceEntity } = event;

    if (id === "jockey:riding" && sourceEntity) {
        
        const direction = sourceEntity.getViewDirection();
        

        const horizontalStrength = -2.0;
        const verticalStrength = 1.2;

       
        sourceEntity.applyKnockback(
            {x:direction.x * horizontalStrength,
            z:direction.z * horizontalStrength},
            verticalStrength
        );
    }
});
}```

can anyone tell me why this is giving me some errors
shy leaf
lilac glacier
#

its the only one

shy leaf
#

the error type logs can be made by doing console.error()

lilac glacier
#

and the error type logs don't happen via console.error either.

#

@warped kelp

shy leaf
#

odd

lilac glacier
#

yea

warped kelp
#

Nyah

warped kelp
#

I'm at version 1.21.113 so I'm not really sure my input can help much xd

lilac glacier
#

it gives an error

#

lol

warped kelp
#

Have you

#

Tried seeking consultation from the deep?

verbal yew
#

Can some one help me

#

Why would this not be working

#

i think i have updated it

vast rune
knotty plaza
vast rune
#

oh thats so cool

#

ty

drowsy scaffold
#

why does the leather gear just not have the dyable component? it's supported by script API, but never returned as a valid component of the item

wicked girder
#

what the max string size for dynamic property value

wicked girder
#

ty

granite cape
#

long time

wicked girder
#

How do I change the amount of an item in the players inventory? Im trying and if I set it to air it doesnt update but does work. and if I change the .amount it doesnt work.

#

Even just doing .setItem(i) which removes it but doesnt update it nvm forgot to save lol

#

setting the items to new itemstack with the amount work but is a little annoying

autumn marsh
wicked girder
#

disable vibrant visuals?

#

or what exactly?

fallow minnow
#

i believe its automatically forcing them to download the packs

#

which is only possible via featured servers

vast rune
#

is there an event for world saving?

dull shell
#
world.beforeEvents.playerInteractWithBlock.subscribe((event) => {

  if (
    event.block.typeId === "jay:juggernog_bottom", "jay:juggernog_middle", "jay:juggernog_top"
  ) {

    event.cancel = true;
    const player = event.player;

    player.runCommandAsync("say hi");   
  }
});

```any reason for this 😓
vast rune
#

idk

dull shell
#

so ngl its with every block

vast rune
#

you could create an array

dull shell
#

mm ik theres a simple way of doing it i fr j forgot how

vast rune
#

wait what problem do u have

dull shell
#

im trying to make it run a command when I interact with my blocks

#

but anytime I place any block or interact it runs the command

vast rune
#

i think theres an event specifically for block interaction

#

oh

dull shell
#

and with already placed blocks it spams it

vast rune
#

yeah idk why that happens, i dont know how to fix that

dull shell
#

damn 😭

vast rune
#

im sorry im not a trained professional

#

unlike a lot of these ppl in the discord server

midnight ridge
#

why does this return as a not a function ?

const activeWandUsers = new Map();

system.runInterval(() => {
  const players = world.getAllPlayers();
  for (const player of players) {
    const inventory = player.getComponent("inventory");
    const container = inventory?.container;
    const item = container?.getItem(player.selectedSlotIndex);

    if (item?.typeId === "sh:furnace_wand") {
      handleWandActive(player);
    } else {
      if (activeWandUsers.has(player.id)) {
        handleWandInactive(player);
      }
    }
  }
});

function handleWandActive(player) {
  player.runCommandAsync("inputpermission set @s movement disabled");
  const furnacePerm = BlockPermutation.resolve("minecraft:furnace");
  targetBlock.setPermutation(furnacePerm);

  activeWandUsers.set(player.id, {
    placedBlockLocation: blockInFrontLoc,
    dimensionId: dimension.id,
  });
}```
distant tulip
prisma shard
# dull shell ```js world.beforeEvents.playerInteractWithBlock.subscribe((event) => { if ( ...
const array = [
    "jay:juggernog_bottom", "jay:juggernog_middle", "jay:juggernog_top"
]
world.beforeEvents.playerInteractWithBlock.subscribe((event) => {
    if (!event.isFirstEvent && !array.includes(event.block.typeId)) return;
    event.cancel = true;
    const player = event.player;
    player.runCommandAsync("say hi");
});```
can u try this im not sure i've been not scripting for awhile
halcyon phoenix
dawn zealot
#

yeah

warm mason
#
if (!(event.isFirstEvent && array.includes(event.block.typeId))) return;
halcyon phoenix
halcyon phoenix
warm mason
warm mason
warm mason
#

Commas are generally not allowed in if as far as I remember.

#

let me test..

#

They work the same way as ||

#

so, yes

#

it will always be true

halcyon phoenix
#

yeah it always prints the last one

warm mason
#

Why would I write this then?

halcyon phoenix
#

bro...lol

midnight ridge
#

gimini detected

#

i figured out that there is not .set by seeing the docs

dawn zealot
#

yeah plus gemini is alot worse than chatgpt at scripting

midnight ridge
dawn zealot
kind zenith
#

how i do make item fire immune with script api

midnight ridge
#

not directly

#

like you can stop lava flow from destroying item

kind zenith
glacial widget
dull shell
#

i literally did this before but forgot how to

round bone
buoyant canopy
#

is dimension.playSound bugged or something?
the sound completely disappears when i am 16 blocks away from the location of the sound

sharp elbow
#

Completely disappears when you first play the sound, then leave the radius while it's active?

#

Or it simply stops playing more sounds when you leave that radius?

#

Latter indicates the volume is set too low. You'll want a higher volume for players in a larger radius to hear the sound. Each 1 value in volume is 16 blocks in radius

#

(This is the volume passed to the playSound method)

#

If the volume is larger than 1 and you still cannot hear it from more than 16 blocks, might be the sound itself is attenuating too soon. Now you need to increase the max_dist property of the sound's definition.
(Ensure your sound definition's format version is 1.20.20, see MCPE-154378)

vast rune
knotty plaza
#

I don't think it affects performance unless you are setting and/or getting a lot of dynamic properties every tick

cyan basin
#

always love when these display incorrectly 💀 (chest ui - been fixing it)

dawn zealot
#

is getbiome in beta

#

or still in preview

shy leaf
deep arrow
#

Can i make an entity not be pushed by water?

dawn zealot
#

is anyone else having a problem with getBiome crashing the game?

dawn zealot
#

nvm

summer cloud
#

what do i use to set a entity's nameTag?

#

nvm i was using nameTag() instaed of nameTag

vast rune
#

i have 4 points, each a vector3 with an x y and z component. is there a better way to add a certain amount for every axis and point? something better than this:
this.p1.x = this.p1.x + pos.x;
this.p1.y = this.p1.y + pos.y;
this.p1.z = this.p1.z + pos.z;
repeated 4 times for each point (p1, p2, p3, p4)

summer cloud
#

if i give a entity a dynamic property if that entity gets removed does the dynamic property persist? or does it get removed?

dawn zealot
#

ur storing it on the entity

#

so if no entity

#

no storage for dynamic property

subtle cove
vast rune
#

im opposed to ai...i guess ill try it now lol

subtle cove
vast rune
subtle cove
#

when they're saved in structure, however, their dynamic property persists exclusively in the entity.
so u gota load the structure where the entity is saved to get the relative dynamic property

subtle cove
summer cloud
#

nah i was just making nametags for items and i just wanted to double check the property gets removed when the item entity gets "removed" so the worlds dont get spammed and overflown with properties

runic crypt
#

What does Enum mean in CustomCommandParamType ?

warm mason
scenic bolt
#

What’s the difference between the onPlayerDestroy and onPlayerBreak custom components

open urchin
buoyant canopy
#

it works when i call this.onPower() within onPower() but not within onPlayerInteract

#

(waiting for my screenshot to send)

#

why is this happening?

sharp elbow
#

Ah, are you exporting the component from another file and using it somewhere?

honest spear
#

Its important to call it on the object it self

sharp elbow
#

It is presumably being used in a custom component. And for whatever reason the call site of custom components is null

honest spear
#

ahh yea

sharp elbow
#

I assume the API takes the objects and kinda pulls the methods out, so we lose the context of the object it came from

honest spear
#

yea the object it self is more like bunch of options

#

and one of the options is onPlayerInteract

#

but not method

sharp elbow
#

I would follow this pattern instead:

const component = {
    onPlayerInteract(event) {
        component.onPower(event);
    },
    onPower({ block }) {
        // ...
    }
}

export default component;
#

Might work better?

#

If not, then this pattern:

function onPower({ block }) {
    // ...
}
const component = {
    onPlayerInteract: (event) => onPower(event)
}

export default component;
wary edge
#

I like classes.

honest spear
#

yea using classes would be much cleaner

#

i would suggest something like this

class MyCustomClass
{
  onPower()...{}
  asComponent()...{
    return {
      onPlayerInteract: (event) => this.onPower(event)
    }
  }
}
grave halo
#

guys

wary edge
#

This is basically mines

abstract class FeatureFlag implements BlockCustomComponent {
  onTick(
    _componentData: BlockComponentTickEvent,
    _paramData?: CustomComponentParameters,
  ): void {}
  abstract onPlace(
    componentData: BlockComponentOnPlaceEvent,
    paramData?: CustomComponentParameters,
  ): void;
  abstract onBreak(
    componentData: BlockComponentBlockBreakEvent,
    paramData?: CustomComponentParameters,
  ): void;
}
grave halo
#

i removed my main.js file from my addon, but it keeps being registrated at minecraft

honest spear
grave halo
honest spear
#

just use devlopment folder and you sure it would use the latest version of it

grave halo
#

ok

grave halo
#

yeah now it works

#

thanks

buoyant canopy
#

this is what i ended up doing

#

can't be bothered with classes

mystic harness
#

does player.id change everytime i join the world?

#

or it is set according to my account

warm mason
mystic harness
#

and is it always different on other worlds?

warm mason
#

I can say for sure that the world host always has the same ID.

snow jungle
#

Does anyone have a wrapper for simulating players?

pliant breach
#

Guys I have a question: is there anyway to turn off the vanilla swing animation without using player.json (the entity file of player in resource pack) using script or anything

dawn zealot
pliant breach
#

I still have to modify the player animation file tho

dawn zealot
#

maybe make a new animation then play it when the player swings

pliant breach
#

I try use my Own animation file to overdrive it but it not work

pliant breach
#

So there will be a frame where the player begin to jitter before the animation got override

warm mason
#

why modify the entire file?

#

just make an animation with the same name

pliant breach
#

then it will alway playing that animation i only want to play it in certain scenario

#

i9 found the way btw

#

by using haste effect

dull shell
#

How would I go about running a command when I interact with a entity? I cant rlly find any example docs on it

honest spear
halcyon phoenix
#

I see

warped blaze
#

FINALLY


Added class EntityHurtBeforeEventSignal to beta 

Added interface EntityHurtAfterEventOptions to beta 

Added interface EntityHurtBeforeEventOptions to beta 

Added WorldBeforeEvents.entityHurt to beta 

Changed EntityHurtAfterEventSignal to use EntityHurtAfterEventOptions in beta 

Added enum EntityHealCause to beta 

Added class EntityHealSource to beta 

Added class EntityHealAfterEvent to beta 

Added class EntityHealBeforeEvent to beta 

Added class EntityHealBeforeEventSignal to beta
 
Added class EntityHealAfterEventSignal to beta 

Added property WorldAfterEvents.entityHeal to beta
 
Added property WorldBeforeEvents.entityHeal to beta 

Added interface EntityHealEventOptions to beta ```
#

WE GOT EntityHurtBeforeEvent FINALLY

dawn zealot
warped blaze
dawn zealot
#

holy shmoly

#

no more damage sensors

#

finally

round bone
#

And you have to wait for next 2 months to get this in stable version

#

😅

dawn zealot
#

yup

#

its in beta now so next update we can use it right

knotty salmon
knotty salmon
dawn zealot
#

bet ty

gaunt salmonBOT
untold magnet
#

yao, its been a while since i last checked, is it possible to detect when the player jumps yet? like not detecting when the button is pressed or something, detecting when the player entity jumps, similar to the one inside the player exhaustion component, where u can set the jump exhaustion value every time the player jumps,

#

at LEAST we can detect when entityHurtBeforeEvents, which means custom totems are now possible, or extra hardcore lives are now possible!

#

speaking of extra hardcore lives, i think its a nice addon that i will be making! like u can craft an item that gives u one extra life, it will appear right next to ur hearts to show u that u have an extra life available, it will only work when u are not holding any kind of totems in ur hands and only work when u take a fatal damage, it will consume some of ur hearts tho, but u can regain those missing hearts later by doing something else

#

this addon will save u from many Bedrock Moments or at least give u enough time to get ur other totems before dying

#

just one simple feature have given us lots of possibilities! thank u mojangbao_ext_toldyouso

glacial widget
#

i can finally rest in peace

snow knoll
untold magnet
snow knoll
untold magnet
#

thats just a cheap workaround ig, and has some bugs that are literally terrible

snow knoll
untold magnet
#

that will infact cause issues, why do i know? bec i have already tried it before.

snow knoll
untold magnet
#

in another clear word, it wont work like how the player exhaustion works.

snow knoll
#

Mind if I see what you did if it still exists

#

Cause I feel like we're talking about 2 extremely similar different things, but idk

untold magnet
#

nah its gone by now

snow knoll
#

😭

untold magnet
#

im just asking to see if its possible now or not, and it still not possible

#

like only if they update the isJumping component and make it runs only when the player jumps that will be awesome

snow knoll
#

But that would break my script 🥺 😭

untold magnet
#

pressing / holding

snow knoll
#

But that equals extra effort 🥺

untold magnet
# snow knoll But that equals extra effort 🥺

then:

world.afterEvents.playerJump.subscribe(({player}) => {player?.remove});;```
or

```js
world.beforeEvents.playerJump.subscribe((event) => {if (!event.player?.hasTag('ableToJump')) event.cancel});;```
#

mojang bts: taking notes

#

-# hopefully

snow knoll
untold magnet
#

please mojang bts, its a very simple feature but highly needed

thorn flicker
#

what would be the difference between that and system.runInterval, it both would spam code quickly

untold magnet
#

it will run better

#

without the interval lag

#

overall, better performances

thorn flicker
#

lag depends on what you run in the interval.

untold magnet
#

and how r u getting the player in first place

thorn flicker
#

a simple for loop of all players would be performant heavy?

untold magnet
#

so my core interval has alot, alot of codes and i am sending them all every tick, that will run alot better than giving each code its own interval, right?

thorn flicker
#

if they all should trigger at the same time, it would not make sense to have them in separate intervals

untold magnet
#

anyways,

thorn flicker
#

would be nice yeah

untold magnet
#

that is exactly what im talking about

#

good thing u got it

thorn flicker
untold magnet
thorn flicker
#

anyways yay entity beforeHurt

thorn flicker
wicked girder
#

Im trying to make a binary string that compresses data so I can fit more in a string dynamic property but for some reason it seems to just remove most of it. can anyone help?

#

these are the methods to make it a string and back

toBinaryString(): string {
    let out = "";
    for (let i = 0; i < this.offset; i++)
        out += String.fromCharCode(this.buffer[i]);
    
    return out;
};

static fromBinaryString(str: string): ByteArray {
    const arr = new ByteArray(new Uint8Array(str.length));
    for (let i = 0; i < str.length; i++)
        arr.buffer[i] = str.charCodeAt(i);

    arr.offset = 0;
    return arr;
};
#

buffer is a Uint8Array

cunning canyon
#

Is there a variable I can use in scripting that can also be used in a query client side?

thorn flicker
cunning canyon
snow knoll
warm mason
#

I'm actually a little upset about the new EntityHurtBeforeEvent..

snow knoll
# thorn flicker huh lol

Now he will always be too in depth about his problem and no one will ever have to ask him for follow up information ever again
maniacal laughter

warm mason
#

It's like what I spent months working on is now easily accessible to almost everyone

thorn flicker
#

thats how it goes

warm mason
#

I've already seen a custom totem in #1046947779118895114

#

:(

warm mason
#

Well, it's actually a nearly completely redesigned protection system, taking into account addon systems, events, and much more, which isn't actually the same "EntityHurtBeforeEvent." It's about 1,200 lines

snow knoll
#

Great Scott. Im so sorry for the loss of your time and effort

warm mason
#

And EntityHurtBeforeEvent solves only two of my problems, but gives me one huge

#

Same thing with my Jigsaw system

snow knoll
round bone
warm mason
round bone
shy leaf
#

the entityhurtbeforeevent is really a christmas gift to me

#

though theres one issue...

#

for my use case at least

thorn flicker
shy leaf
#

so i have to cancel damages as whole and reapply using applyDamage so that i can customize everything

#

but that can cause loops

thorn flicker
#

some people are reporting that player knockback doesnt get cancelled

shy leaf
#

What

thorn flicker
# shy leaf What

when you cancel the event, players can still knockback entities

shy leaf
#

oh wait

#

by sprint knockbacking???

thorn flicker
#

yeah.

#

apparently

#

#1445820376763338854 message

shy leaf
#

god damnit

thorn flicker
#

and the knockback enchantment

shy leaf
#

i kinda expected this

thorn flicker
#

then again, its not entityHit its entityHurt beforeEvent

#

i feel like canceling the hit would make more sense to cancel knockback right?

shy leaf
#

yeah but

#

sprint knockback still applying is just sad

#

😭

thorn flicker
#

well its in preview so

#

maybe theres time

#

lol

#

i saw someone using clearvelocity which helps a little

devout sandal
#

Is there a good way to get a script to fire ONE time on the worlds very first load ever, then never again..?

#

(I’m a noob sorry)

shy leaf
#

hmm

#

what about a tag?

devout sandal
#

Like on world gen, world initialization, world creation, idk what to call it, and wdym?

shy leaf
devout sandal
#

Ah

shy leaf
#

theres not really a good way to check if the world was loaded for very first time

#

at least with scripting api stuff

#

you can use anything that persists in the world regardless of anything (restarting or etc)

devout sandal
#

Ok, thanks

shy leaf
#

so yeah thats why i suggested tag

#

it can be manually removed by player command but it still does persist

shy leaf
#

oh right...

#

dynamic properties exist

#

i just woke up

shut citrus
mystic harness
#

is there an event that emits when player receives a tag or remove a tag

shy leaf
warped blaze
shy leaf
#

yeah i forgot about the existence of dynamic properties

#

😭

shy leaf
warm mason
shy leaf
#

i see, thanks

cinder shadow
#

Did we get any sort of input detection for when a player is lunging or is my best bet to check velocity?

prisma shard
#

Lunging?

cinder shadow
#

with the spear

earnest meadow
#

Hi, does anyone know if system.runTimeout respects game pausing?

#

like if a player pauses their game, does the timeout stop running momentarily too?

#

okay, tested, it does

prisma shard
snow knoll
weary umbra
#

Is there away to set an item in an itemframe? with script?

warm mason
weary umbra
distant tulip
#

You can get the item, but not set it

weary umbra
warm mason
distant tulip
#

@warm mason

warm mason
#

not the block item

distant tulip
#

i just said how?

warm mason
#

wait..

distant tulip
#

it return the item in it if it is not empty

warm mason
#

😵‍💫

#

I need to test it

distant tulip
#

alr

warm mason
#

I'm scared to imagine what this code looks like...

distant tulip
#

what code

warm mason
thorn flicker
#

im kinda scared to see minecraft's code in general

distant tulip
thorn flicker
warm mason
distant tulip
#

that is the exact behavior ctrl+middle mouse click do tho

thorn flicker
distant tulip
#

yeah

thorn flicker
#

we'll never know though

#

unless a mojang developer comes in and confirms it rn, 2% chance of that happening

#

lol

distant tulip
#

i mean, we can ask the devs
but idk if that a valid reason to ping them lol

warm mason
#

😠

thorn flicker
#

why are you angry

warm mason
#

I wanted to say about asking Mojang, but you already did it

thorn flicker
#

you focus on the wrong things man

warm mason
thorn flicker
#

yeah I didnt think you were serious

warm mason
#

Okay, so now I can't say I'm waiting for EntityHurtBeforeEvent...

thorn flicker
#

what else is there

#

i cant think of any else to wait for now

#

-# for me anyway

warm mason
#

hmmmmmm

thorn flicker
#

hmm...

warm mason
#

stable and NOT read-only entity.target?

thorn flicker
#

oh yeah, that would be nice

#

we also got biome tag methods in the preview so thats taken care of

#

hm...

warm mason
#

or native method to make mobs navigate to a location

thorn flicker
#

so ai override methods

#

yeah.

warm mason
#

server-gametest has it

#

but u need to place a whole structure just to use it

thorn flicker
#

a method to see what ui the player has open maybe

#

block dynamic properties

warm mason
#

a method to see if a player is in UI

warm mason
thorn flicker
#

just check if its undefined

warm mason
# warm mason yeah..

but if they will fix BlockCustomComponent.onBreak it will be easy to recreate this

#

Ahh, I need a bigger vocabulary :/

warm mason
# thorn flicker ?

well, we could make a custom block dynamic properties system, using world properties

#

still a "hack"

thorn flicker
#

yeah I know

#

but eh

distant tulip
warm mason
#

rewritable MolangVariableMap values..

thorn flicker
#

so like

warm mason
thorn flicker
distant tulip
#

pfft

warm mason
distant tulip
#

that is my alt

warm mason
#

lol

thorn flicker
#

oh thats not the real one

distant tulip
#

lol

thorn flicker
#

you got me

#

lol

warm mason
#

soo...

thorn flicker
#

what else

#

think serty think

warm mason
#

I'd like a "Dimension.register()" method

#

:>

thorn flicker
#

okay well thats a whole system needed

#

what about stuff like that already exists

warm mason
#

thinking

thorn flicker
#

thinking aswell

warm mason
#

BlockUpdateBeforeEvent

thorn flicker
#

yeah

warm mason
#

or after at least

distant tulip
#

Dimension is not even in early execution, so how would that work

#

eh wait, nvm what i said

warm mason
#

HMMMMMMM

thorn flicker
#

mhhh

warm mason
#

subcommands?

thorn flicker
#

why didnt i mention that, I was just complaining to myself earlier that we didnt have it

#

yes, subcommands would be great

distant tulip
warm mason
#

a radius property in ExplosionAfterEvent

distant tulip
#

before event tho

thorn flicker
#

yeah in beforeEvent so you can edit it, would be nice

distant tulip
#

it could carry the read only too, lol

warm mason
#

and to knew the explosion "power", because blocks... well not an accurate method

thorn flicker
#

?

warm mason
thorn flicker
#

why did you show me that it extends it

#

im confused lol

warm mason
#

and "minecraft:destructable_by_explosion" component

#

and "destructable_by_mining"

thorn flicker
#

damage component for weapons

warm mason
distant tulip
warm mason
#

custom enchantments

thorn flicker
#

equippable component for non-players

warm mason
#

now Im waiting for equippable component

#

Well, I never stopped waiting for it..

thorn flicker
#

dimension change beforeEvent I guess

warm mason
warm mason
distant tulip
#

tame component getting fixed...

thorn flicker
warm mason
distant tulip
thorn flicker
#

the tame component gets removed in some vanilla entities after being tamed

thorn flicker
#

I didnt check

warm mason
#

it's actually a json code issue

thorn flicker
#

yes

warm mason
distant tulip
thorn flicker
#

lol

warm mason
#

🙄

distant tulip
#

hmm, what other bugs are there

thorn flicker
#

loot table match all query is still broken but thats not script related

warm mason
#

recipe manager

warm mason
#

and all this

thorn flicker
#

how can we forget recipes

#

yes

#

and an unlock method

warm mason
#

and "craft" method

#

and support for all recipe types

#

or just give us an array of json code

distant tulip
#

just learned the other day that you can use the crafter in script api to validate a recipe

warm mason
#

PlayerCraft Events

thorn flicker
#

fishing events

warm mason
thorn flicker
#

not maybe, that would be neat

#

cmon

distant tulip
#

it is too specific lol

thorn flicker
#

no

warm mason
thorn flicker
#

button push event too

warm mason
#

Plates..

distant tulip
#

ok, maybe not

thorn flicker
#

like, those are useful

warm mason
#

tripWireTrip

thorn flicker
#

what else

distant tulip
#

Dimension.getMap(volume:BlockVolume): RGB[]

warm mason
#

WhiteGalzedTerracottaBreakWIthEnchantedDiamondPickaxeAfterEvent

warm mason
thorn flicker
#

we have get block color already

warm mason
#

and ItemStackMapComponent

warm mason
distant tulip
#

get block + get map color is slow

warm mason
#

we need world.seed

#

and dimension.noise()

thorn flicker
#

yeah

warm mason
#

Client Side js

#

OreUI

thorn flicker
#

lol

warm mason
#

The clients should spawn particles by themselves

distant tulip
#

ChunkLoad
ChunkUnload

warm mason
#

but...

#

Im not sure it would be optimized to even use them

thorn flicker
#

dynamic property option in EntityQueryOptions

#

filter function works fine but wouldnt hurt

warm mason
thorn flicker
warm mason
thorn flicker
#

target selectors

warm mason
#

whaa

thorn flicker
#

filter dynamic properties

#

in target selectors

warm mason
#

😵‍💫

distant tulip
#

not sue how doable is this
structureLoaded

thorn flicker
#

bro doesnt know what a target selector is

warm mason
distant tulip
thorn flicker
#

kill @s[has_dynamic_property={}]

warm mason
distant tulip
#

a structure...

village
nether fortress
...

thorn flicker
#

please mojang

warm mason
thorn flicker
#

i dont know how they would do it

warm mason
distant tulip
#

entityEquipmentChanged

warm mason
thorn flicker
#

that would be good

warm mason
distant tulip
#

entityTargetChanged

thorn flicker
#

is has to be Change though, not Changed

#

to follow the name of the other events

distant tulip
#

yeah

thorn flicker
#

PlayerItemInventoryChange

#

yk

warm mason
#

custom effects

distant tulip
#

also to make sense in before event

thorn flicker
thorn flicker
warm mason
thorn flicker
warm mason
thorn flicker
#

leave me bee

thorn flicker
#

mr. im no longer unique

#

lol

warm mason
thorn flicker
#

mr. i must state something first before someone else does

#

im kidding man

#

dont roll your eyes too far

distant tulip
#

entityPathFinding
and it return the path somehow and we can change it or cancel it

warm mason
thorn flicker
#

i dont know how that would work

warm mason
#

make a fourth axis

distant tulip
#

also, we don't have playerCameraChanged do we?

thorn flicker
#

no

#

I guess that would be neat

distant tulip
#

yeah

#

a crafting event too would be cool

thorn flicker
#

we mentioned that already

#

well, you did

distant tulip
#

did i

thorn flicker
#

yeah

warm mason
#

it was me

thorn flicker
#

that was serty

distant tulip
#

lol, alr

thorn flicker
#

yeah I just double checked

warm mason
thorn flicker
#

mb minato, you and serty are so alike yk

distant tulip
#

i mean, while we are at it, make some for furnaces and so on

distant tulip
thorn flicker
#

joke

warm mason
thorn flicker
#

furnace event, brewing event

#

anvil event

#

event for any event that triggers

thorn flicker
#

what you guys think

#

lmao

distant tulip
#

do we have a ride event?

thorn flicker
#

nope

warm mason
#

(I didn't mean you)

#

I mean, like, the playewr

thorn flicker
#

Ah yes, and maybe DimensionChangeAndGetSwarmedByHoglinEvent

#

oh how about property change event?

warm mason
#

we need an event for all actions

distant tulip
#

yeah, tho not useful that much

warm mason
thorn flicker
thorn flicker
warm mason
#

oh, lol

thorn flicker
#

keybind event

#

because yes

warm mason
#

mobile players yk

thorn flicker
#

are we?

#

well heres the thing, I dont care about mobile players /j

warm mason
#

hmmmmm

#

what else

#

we need more things, that will never be released

thorn flicker
#

setRedstonePower()

distant tulip
#

itemPickup
itemDroppe
playerHungerChange
entityTame
entityBreed
screenOpene (inv, furnace, and so on)
screenClose

warm mason
thorn flicker
#

but yeah

distant tulip
#

true

thorn flicker
#

maybe screenChange could also detect titles too

#

could be cool

#

idk how useful but yeah

warm mason
distant tulip
#

most of them are server side

thorn flicker
warm mason
distant tulip
#

beside the events, there is a lot of other functions too

warm mason
thorn flicker
distant tulip
#

dimension.fillBiome()

thorn flicker
warm mason
thorn flicker
#

well

#

that

#

or setBiome()

warm mason
#

hmmmmmm

#

hmhmhmhmmh

thorn flicker
#

how about a biomeEnter event

warm mason
#

but unlikely

thorn flicker
#

yeah idk man

warm mason
#

Custom enchantments, effects

distant tulip
distant tulip
thorn flicker
#

that sounds like after a biome gets changed

distant tulip
#

nah, so it have fromBiome toBiome

thorn flicker
#

no I understand what you mean

warm mason
#

What happens when you change biome? - Nothing. So such an event is unlikely

distant tulip
#

yeah just like the dimension one

warm mason
#

I mean

#

it's not like dimensions

thorn flicker
#

yeah nothing happens but if we had an event we can make something happen

#

lol

#

idk

warm mason
#

system.runInterval + getBiome

distant tulip
thorn flicker
#

duh

thorn flicker
#

more events the better

warm mason
thorn flicker
#

yeah but it would perform better no

warm mason
#

km.ajsgdklajshdbajksd

thorn flicker
#

dwerwearfwer

warm mason
#

idk what to say

distant tulip
#

there is probably something in game that trigger on biome change, so they just add an api there

thorn flicker
#

server side tho? i dont think so

warm mason
#

give me Dimension.loadedChunks

#

or Dimension.getLoadedChunks()

thorn flicker
#

thats already a thing

distant tulip
#

no

#

isLoaded

warm mason
distant tulip
#

?

warm mason
#

well

#

not slow

#

but

thorn flicker
#

what makes you think this new method wouldnt be as slow then

#

just wish the current method would be faster

#

lol

distant tulip
warm mason
#

because why calculating it N times in tick

#

when u can do it one time

distant tulip
#

i gtg to sleep, i will see you guys around

thorn flicker
warm mason
#

well...

thorn flicker
#

well

warm mason
#

it's almost 2 AM for me

#

and...

#

Im going to.. ||write scripts, AAAAAAAAAAAAH||

thorn flicker
#

its 6pm for me, so I have a little longer before I sleep

thorn flicker
#

lol

warm mason
#

or maybe not

#

Im tired

thorn flicker
#

sleeping is healthy man

#

you should sleep

warm mason
#

well, Im homeschooled now, and I don't need to wake up early...

thorn flicker
#

i just fixed my sleep schedule recently

warm mason
#

I just ruined mine recently

#

lol

thorn flicker
#

yeah the process sucks to fix it

warm mason
#

early waking up is cool, cuz u have much more time, but I hate going to sleep early, so...

#

😵‍💫

thorn flicker
#

once your sleep schedule is fixed

#

youll have time

warm mason
#

so my free time won't really change

#

well, about coding..

thorn flicker
#

🤷

warm mason
#

I have a little bit of code left for what I need... and it's pretty routine, so tomorrow

#

(I'll fall asleep only in +-2 years)\

thorn flicker
#

lol

mystic harness
#

quick question, how do yall turn off PlayerName joined/left the game?

pale terrace
#

anyone knows when 1.21.130 stable will be released?

deep arrow
shy leaf
# warm mason It does

wait, i need to make sure if im understanding this correctly
if i attack with 4 damage while the victim has resistance 4, the final damage would be 0.8
would the damage value in entityhurt beforeevent be 0.8?

#

i wish i could test it by myself but i cant for reasons

sharp elbow
#

Yea, the damage value reflects the final damage taken.

shy leaf
#

would be nice if we had access to first initial damage too tbh

#

but this alone opens a lot of possibilities

mystic harness
#

how to set player fire immune? without fire resistance effect

snow knoll
shy leaf
#

with the new entityhurt beforeevent, you could technically make players to not take damages from fire, fire tick or lava

#

its in preview tho

snow knoll
supple perch
supple perch
supple perch
supple perch
supple perch
thorn flicker
#

I wasnt suggesting it to exist.

supple perch
#

oh

thorn flicker
#

I was referencing it

supple perch
#

my bad

#

lol

thorn flicker
#

np

supple perch
supple perch
#

it definitely is editable

supple perch
#

they can pick another target

distant tulip
supple perch
#

my bad lmao

#

can't believe entityHurt beforeEvent is real

distant tulip
#

I don't mind, was just joking

supple perch
#

this is so AWESOMEEEEEE

thorn flicker
#

entityHeal beforeEvent is also really nice

supple perch
#

or are you suggesting

thorn flicker
#

not would be

supple perch
#

ah

#

sorry, I'm not too good with english

#

not my native language

warm mason
thorn flicker
supple perch
thorn flicker
#

yes, it exists

supple perch
#

cuz I'm sure i used it

warm mason
supple perch
#

it just doesn't last long

thorn flicker
supple perch
#

really?

#

wow am i hallucinating

thorn flicker
supple perch
#

dang

#

they must've made it read-only

#

cuz i remember i used it a couple versions ago maybe

thorn flicker
#

lol

supple perch
#

oh

#

lol

thorn flicker
#

no they did not make it read only, we are just seeing things

#

the messages are a lie

supple perch
#

nooooo

#

I'm double hallucinating

#

noooo

#

lol

#

oh well, my bad for the inconvenience

thorn flicker
#

i forgot how long ago they made it read only

supple perch
thorn flicker
#

must've been before then.

supple perch
thorn flicker
#

you know whats kinda lame too, they removed fallDistance property

supple perch
#

fallDistance?

#

entity.fallDistance

thorn flicker
#

yes

supple perch
#

now that's interesting

#

i didn't know it existed

#

i do see why tho

#

it could be a bit inaccurate and unperformant

#

but maybe there are other reasons they removed it for

#

tho it would be really cool

supple perch
#

anyway I'm gonna go

#

have a fantastic afternoon

thorn flicker
#

peace

#

thanks, you too

distant tulip
thorn flicker
#

a block destroy method

#

we dont have that

distant tulip
#

the event or a func?

thorn flicker
#

so ye

#

an event for a block being destroyed in general, not just be a player would be cool too

distant tulip
#

yeah

thorn flicker
#

and yes im aware theres a custom block component event for that

#

but thats only for custom blocks ofc

distant tulip
#

hmm? what are you referring to

thorn flicker
distant tulip
#

what event

distant tulip
thorn flicker
grand acorn
#

Has anybody here ever had issues with server forms sometimes not rendering on IOS?

shy leaf
#

perhaps its a bit more common on iOS?

grand acorn
#

Thanks! Do you get soft locked in a blank screen, or does it just fail to open?

shy leaf
#

when the bug happens, it hides the hud but doesnt show the form itself

#

but i can safely get out of it by pressing ESC

grand acorn
#

Okay, thank you!

meager pulsar
#

can you get the food item component of vanilla food?

#

const foodComponent = itemStack.getComponent(`minecraft:food`)
console.warn(foodComponent , itemStack.typeId)

distant tulip
honest spear
#

weird it would be great if that did work

#

but we might ask for it, i remember durability didn't worked on vanilla as well before

distant tulip
distant tulip
#

welp, i am wrong then

shut citrus
#

How to prevent player death when health drops below 0.5

inland merlin
snow jungle
#

level_tick

frozen vine
#

What does this mean? I'm getting these errors from my custom components for some items.

winged gull
#

No, never do that, that is the first red flag people look for in viruses, anything that is a passworded zip is 99.9% of the time a virus, terrible idea.

#

I just realized that message was from 2024 💀...

frozen vine
#

Script v2 use this

supple perch
#

i can add a tag to the entities i want the undead mobs to target

#

but I don't want external undead mobs to target

#

i know I'll have to edit the entities' .json

#

but I'm not exactly familiar with how to make certain entities target certain entities

#

if anyone has any idea what i should do, please go ahead and suggest away.

snow knoll
supple perch
#

i know

#

i just need skeleton

#

zombie

#

and wither skeleton

snow knoll
#

Soo

supple perch
#

i can automate adding the entries to them

#

but idk what to add 💔

snow knoll
#

You could literally make your own ones that target whatever you want and not edit the entity.json files

supple perch
#

ooh

#

You're right

#

but still

#

uh

snow knoll
#

Then have them transform into the actual vanilla entity if you wanted to, even

supple perch
#

how do i have them only target a set of players?

supple perch
snow knoll
#

What distinguishing features does the set of players have?

supple perch
#

tags

#

properties

#

anything

#

that i can add in the script

#

and that the json can use

snow knoll
#

So you're ok with using player.json

supple perch
#

yeah

#

I'm completely fine with it

#

it's an addon for my server so i don't worry too much about add-on compatibility

#

and i can merge player.json(s) if i ever need to

#

but not using it would be pretty good too

#

so like

#

any solutions?

snow knoll
#

You can use tags

#

Properties

supple perch
#

I'm a bit confused

#

what should i do?

snow knoll
#

Player.json is the it in question for your information

supple perch
#

what should i do in it then?

#

by the way, when i said properties and tags, i meant target.addTag and target.setPropertyOverride...

#

i can use player.json but I'd like to avoid it

#

I'm trying to make the undead mobs target the nearest players
players that are targets > normal players in priority

#

but to pick normal players if no targets available

#

and I don't want the undead mobs to target teammates

supple perch
#

if you wouldn't mind, could you send an example? or a snippet of what to do

#

i don't need to be spoon fed scripts but I don't exactly know what to do

#

if you got any documentation for how to do something close to this, please send it

frozen vine
coral ermine
#

Why /playsound command plays sounds louder than .playMusic method? how to make .playMusic volume same as /playsound command

frozen vine
coral ermine
frozen vine
snow knoll
#

If you want an example I can make one

#

Also I don't know how summoning the entity works so adding the tags is something I might need more for

earnest meadow
#

Does Dimension.getBlockFromRay() not work on all occasions? Basically some of my custom blocks don't get caught on for some reason?

earnest meadow
#

⤴️ this function sucks, I made one my own

nova flame
#

is it possible to give players items with impossible enchants using script api?

#

no structures

sage portal
#

can we manipulate a player's movement speed using scripts? With the new beforeHurt event coming soon, this will be the last thing I need in order to drop player.json

thorn flicker
#

and use the setCurrentValue method, however the speed gets reset when the player sprints.

thorn flicker
sage portal
#

that's some pretty annoying variables to keep track of. Do you know of them all, or is that part vague?

thorn flicker
#

uh

thorn flicker
#

I only know sprinting for sure does

sage portal
#

that sounds like a lot of trial and error to test before it hits stable. Thanks either way.

thorn flicker
#

like what are you going to try to do? check if the player is sprinting in system runInterval to keep setting the movement value?

#

it wouldnt be consistent I imagine

sage portal
#

that or an async function was my plan, yeah

thorn flicker
#

better off just using the speed effect for now, no?

sage portal
#

unfortunately, speed is limited to specific intervals, and it also warps FOV to hyperdrive for those who leave dynamic FOV on.

I've been looking for alternatives that give me small increments without FOV adjustments, hence player.json

thorn flicker