#Script API General

1 messages ยท Page 89 of 1

uncut lynx
#

go ahead, read it

#

it doesnt stack

#

i remade it from scratch

wary edge
#

What does this even mean?

wheat condor
uncut lynx
#

no more

north frigate
uncut lynx
#

now i did it somewhat more properly

#

defacto i use dynamic properties only for save/load (:

wheat condor
# uncut lynx that was old shitty lazy code
 animationUpdate(): void {
        for (const component of this.components.values()) {
            if (!component.animated) {
                continue;
            }
 
            const currentTickStage = system.currentTick % 1200 / 1200;
            let rotation = Math.round(Math.abs(component.RPM) * currentTickStage * 90 / 15) * 15 % 90;
 
            if (component.RPM < 0) {
                rotation = (90 - rotation) % 90;
            }
 
            if (["south", "east", "down"].includes(component.block.permutation.getState("minecraft:facing_direction"))) {
                rotation = (90 - rotation) % 90;
            }
 
            component.block.setPermutation(component.block.permutation.withState("createbedrock:rotation", rotation));
        }
    }

so you re saying that this isnt lag generator?

uncut lynx
#

it doesnt do much lag at all

wheat condor
#

if you put 40 wheels, setPermutation runs 800 times per second

wary edge
#

That can be negated by increasing the tick interval.

wheat condor
uncut lynx
wheat condor
wheat condor
uncut lynx
wheat condor
#

i dont mean fps lag, i mean tick per second lag

thorn flicker
#

wdym what is his point, the point is it'll lag

wheat condor
#

server lag

wary edge
#

I seriously think you should just use entities for the animation.

thorn flicker
#

could still get laggy

#

if you summon alot

wheat condor
# uncut lynx but what is your point

the point is that you re testing on your pc that might be a 5000$ rtx 3090 128gb ram
and on a mid pc or a realm with 10 players having 50 animated blocks each one and 40 farms in the world

warm mason
wheat condor
#

BRO STOP SPAMMING REACTIONS roterslime2286

uncut lynx
#

vscode debugger doesnt connect

wheat condor
#

do /connect command

#

wait a second

uncut lynx
#

?

warm mason
#

it's time to remove people from the thread

#

If I understood correctly.....

wheat condor
warm mason
# wheat condor why

Because it's overflowing, again. But it's not noticeable that Smokey is doing anything.

valid ice
#

Let him cook

wheat condor
#

overflowing?

#

huh

valid ice
#

@native patio what's your problem man

warm mason
wheat condor
#

he wants to speak

valid ice
#

oh lmao

wheat condor
#

just create a new account

wary edge
#

Please hold.

rigid torrent
#

Guys we are making some changes, sorry for the inconvenience! We will be back soon ๐Ÿ™‚

radiant drumBOT
#

Purging 523/755

217 member(s) have sent at least one message in the last month in #1067535608660107284.

radiant drumBOT
#

Purging done! Removed 154 member(s).

obsidian coyote
radiant drumBOT
obsidian coyote
#

Last actual message!

wary edge
#

Sowwie.

warm mason
#

๐Ÿ˜ฎโ€๐Ÿ’จ

remote oyster
distant tulip
#

navi got purged, lol

remote oyster
#

3 months lol

warm mason
distant tulip
#

did it git a request timeout when it stopped ๐Ÿ‘€

#

anyway, gtg to sleep, was up sense 6AM

obsidian coyote
warm mason
distant tulip
obsidian coyote
uncut lynx
#

Yoo

wary edge
uncut lynx
#

ik how to spawn

#

idk how to animate with dynamic script-controlled vars

lyric kestrel
#

damn, another purge

fallow minnow
#

what the fleep happened

remote oyster
uncut lynx
#

guys i cant get proper entity model to look like the block

wary edge
vast grove
fallow minnow
#

not discord server

vast grove
#

Ooohhh

shy leaf
#

WTF HAPPENED HERE

nova wraith
shy leaf
#

:sob;

runic crypt
#

Is this legit ?
I found it on yt via a friend

#

Tried running and it has a Scratch (the coding cat thingy) stuff
like code blocks and stuff ??

#

Does anyone kniw what it is/not to use it ?

shy leaf
#

๐Ÿ˜ญ

runic crypt
#

How else am i supposed to post it ??
it has the most generic name ๐Ÿ˜ญ

shy leaf
#

idk??? maybe a screenshot couldve been better

runic crypt
#

Of the name ???

shy leaf
#

i (and other ppl) dont want to run that

runic crypt
#

I did ๐Ÿ’€

#

It has a weird ui

shy leaf
#

screenshot

runic crypt
shy leaf
#

also please remove that link, the existense of that thing in this chat scares me

#

other ppl might not like it too

runic crypt
#

Is this like an official tool ?

#

@shy leaf

runic crypt
#

Done

shy leaf
#

naw wth

#

block code based on javascript

runic crypt
#

I mean it looks kinda legit

shy leaf
#

imagine how horrible the results would be ๐Ÿ˜ญ

runic crypt
#

Imma try it ๐Ÿ’€

shy leaf
#

but what i can tell for sure is that it isnt an offical tool

runic crypt
#

So I should not run it ?

#

And wait for someone else to run it ?

shy leaf
#

idk??

#

wait

#

WAIT. let me search it

runic crypt
#

Cuz if it can actually make addons that would be like too good

runic crypt
shy leaf
#

ITS REAL????

runic crypt
#

Wait how did u get the KCD thing beside ur name ?

runic crypt
shy leaf
#

ITS REAL

runic crypt
#

Wait so ig app is for offline
makes sense

runic crypt
shy leaf
#

yeah

#

microsoft real

runic crypt
shy leaf
#

that one seems super outdated though

#

i mean the offline one

runic crypt
#

So someone just downloaded the whole thing to make it offline

#

Damn

#

Wait so it will actually work ?

shy leaf
#

maybe

shy leaf
#

easy to port

runic crypt
#

Should I make a post in script resources ?

shy leaf
#

lets see what the moderators would say abt this

runic crypt
#

U have any jdea if we can use python in Minecraft ?

shy leaf
#

the other edition

runic crypt
shy leaf
#

uh

runic crypt
#

damn

shy leaf
#

educational edition

runic crypt
#

close enough

shy leaf
#

well

#

that seems like its purely based on educational edition

runic crypt
#

potato tomato man

#

imma make a post abt this

shy leaf
#

i dont see anything related with javascript in there

#

im checking it rn

#

i might be missing out thoufh

#

but it doesnt seem like it uses minecraft server api

runic crypt
#

It has on player join so im assuming it has more
u checking the offline or the online ?

runic crypt
shy leaf
#

this isnt server api

#

๐Ÿ˜”

shy leaf
runic crypt
runic crypt
shy leaf
#

i see

runic crypt
shy leaf
runic crypt
#

ukw forget it man ๐Ÿ˜ญ

prisma shard
vast grove
shy leaf
#

oh

prisma shard
vast grove
#

Discord can be weird in it's rollout

sleek nexus
#

Anyone have a good idea for how to make some kind of code that runs once for every chunk that is loaded?

I'm trying to do script-based generation for a basic world type.

My current method is using /schedule to run a function that spawns an entity which runs the script event, which in turn adds the scheduled command to the neighboring chunks if they haven't already been generated. This method allows me to get the chunk location in the script-side of things. But there's a con where reloading the world doesn't save these scheduled commands. so I need to re-initialize the system.

vast grove
#

You could store the position of the loaded chunk in some world property

sleek nexus
#

I was considering that, but didn't want to run into memory issues

#

I'd rather somehow make use of Minecraft's normal chunk loading systems

vast grove
#

Split the data. Use something like grid cells

#

Octree or quadree could work

sleek nexus
#

into separate world properties?

#

But I don't like the idea of storing data that can expand theoretically infinitely

vast grove
#

Well. Not really

sleek nexus
#

If I store whether each chunk is generated, whether that's in a spatial split hashmap like a tree structure or not, if the player explores throughout the world the size of that stored data will increase as chunks generate

vast grove
#

Not really much you can do other than that afaik

#

Could ask navi if we could get a dedicated api for accessing chunks

sleek nexus
#

Yeah that'd be nice

shy leaf
#

are temporary properties (ex. player.__cooldown) unique to UUID?

distant tulip
shy leaf
#

so it is unique but not to UUID

#

got it

distant tulip
#

Yep

wheat condor
vast grove
#

That's literally what I suggested in a sense. Not specifically that way but in a technical sense...

dusty temple
#

Is there an easy way to remove a player's armor?

vast grove
#

Wdym?

dusty temple
vast grove
#

I believe there is an armor equipment component you can get. Hang on

#

You can set equipment to null and it'll clear it

#

Or you can just a run command

dusty temple
# vast grove Or you can just a run command

There we go

const equipmentSlots: Partial<keyof typeof EquipmentSlot>[] = [
  'Head',
  'Chest',
  'Legs',
  'Feet',
  'Offhand',
] as const;

export function clearArmor(plr: Player) {
  const equippable = plr.getComponent('minecraft:equippable');
  if (!equippable) return;
  for (const slot of equipmentSlots) equippable.setEquipment(EquipmentSlot[slot], undefined);
};
#

Thank you

round bone
#
const equipmentSlots: EquipmentSlot[] = [
  EquipmentSlot.Head,
  EquipmentSlot.Chest,
  EquipmentSlot.Legs,
  EquipmentSlot.Feet,
  EquipmentSlot.Offhand,
] as const;
halcyon phoenix
#

in mobile how would itemUse beforeEvent work?do they just have to hold it?

#

im wondering if there is a block and it would just prioritize breaking the block instead of using the item

halcyon phoenix
shy leaf
#

this is just my speculation, but it prolly will prioritize item use

#

but only if the item counts as usable

halcyon phoenix
#

alright I guess afterEvents then

dusky flicker
#

enums are iterable as well

#

just use

for(const slot of Object.values(EquipmentSlot));

misty dagger
#

Has anybody noticed this bug where two entities that share a property ID will become entangled if both are within render distance? By entangled, I mean both of them will display as having the same value of the property at all times, even though, according to the server, they are different. I was testing some of my maps and add-ons, and multiple of them suddenly broke like this in the exact same way when loaded in Bedrock 1.21.82.

#

I can tell that it's a client-side issue because, when the dominating entity goes out of render distance, the other entity suddenly adopts its proper appearance. So the server had the correct values of the property all along.

#

What's weirder is that not all properties become entangled like this. And properties can become entangled across different entity IDs as long as the property ID is the same between them.

round bone
round bone
dusky flicker
thorn flicker
dusky flicker
#

seriously i never thought js programmers caring about it

#

no one seems to talk about it

thorn flicker
#

you never thought a type of programmer would care about performance?

remote oyster
#

Performance is important to me personally. Especially when taking into consideration the environmental constraints and hardware limitations when talking about Mobile devices.

#

Every decision I make I try to take into account on how it would impact such cases. If this means writing unconventional code to reach the end goal then so be it. The objective to me isn't about being conventional. Its about producing code that works.

dusky flicker
#

its hard to see that happening

thorn flicker
dusky flicker
remote oyster
thorn flicker