#Script API General

1 messages ยท Page 88 of 1

uncut lynx
#

knockback also aoe

sly valve
#

already exists

sly valve
woven loom
#

yes

uncut lynx
sly valve
uncut lynx
#

bruh

sly valve
warm mason
#

It's pretty easy to do knockback on it.

sly valve
gilded shadow
#

22:38:54[Scripting][warning]-[Watchdog] Spike from 'Oraria' (130ms)
is this bad, on start up?

#

can anyone share their tsconfig.json? i think mine is not working because after compiling it messes up any await or async calls
22:21:47[Scripting][error]-ReferenceError: '__awaiter' is not defined at <anonymous> (core/PlayerManager.js:36)

prisma shard
# gilded shadow can anyone share their tsconfig.json? i think mine is not working because after ...
{
    "compilerOptions": {
        "lib": ["esnext"],
        "target": "esnext",
        "module": "esnext",
        "outDir": "./scripts",
        "rootDir": "./source",
        "allowJs": false,
        "checkJs": false,
        "useDefineForClassFields": true,
        "noImplicitReturns": true,
        "noUnusedLocals": true,
        "noImplicitAny": true,
        "alwaysStrict": true,
        "noFallthroughCasesInSwitch": true,
        "noImplicitThis": true,
        "noUnusedParameters": true,
        "moduleResolution": "node",
        "baseUrl": "./source",
        "paths": {
          "*": ["*"]
        }
    },
    "include": ["source"],
    "exclude": ["node_modules"]
}
cyan basin
#

Bro had that shit on speed dial ๐Ÿ˜ญ

gilded shadow
prisma shard
gilded shadow
prisma shard
#

XD ok

gilded shadow
#

Found 46 errors in 21 files.

ima cry๐Ÿ˜ญ

prisma shard
#

tsconfig should match with coding style thats why

#

i think the one i sent is has too strict checks

#

wait what

#

what would happen if i use runTimeout inside runInterval

#

it just works, but... why

ancient sierra
#

Hello! How would I get the item im currently holding? The inventory component is really confusing for me xd

prisma shard
ancient sierra
#

Oh I see, so that's why I couldn't get anything from the inventory component one

Thank you so much! I didn't knew that

prisma shard
ancient sierra
#

selectedSlotIndex doesn't seem to appear in my types although I'll try the first one!

gilded shadow
mighty igloo
#

How do you get item types from item names?

#

In previous updates you could import the class Items from the server @ thing but now it doesnt seem to have an export

#

Ok figured it out

#

it was replaced with ItemTypes

woven loom
#

is there any perf diff b/w set property vs set properties

warm mason
remote oyster
# prisma shard what would happen if i use runTimeout inside runInterval

runInterval executes a block of code repeatedly at a fixed interval, measured in ticks. If you nest a runTimeout inside runInterval, you're adding an additional delay before the inner code runs. For example, if runInterval is set to trigger every 20 ticks, and you include a runTimeout with a 20 tick delay inside it, the inner code (inside runTimeout) will effectively execute every 20 ticks after the interval fires, so every 40 ticks in total.

However, it's important to note that the first execution of runInterval happens around (tick 0 tick 1), and the runTimeout inside it would delay execution by 20 ticks, meaning the first inner execution happens at tick 20. After that, runInterval will fire every 20 ticks (20, 40, 60...), and each time the inner code will be delayed by another 20 ticks (40, 60, 80...), leading to an effective execution of the inner code every 40 ticks.

distant tulip
remote oyster
#

I know run delays at the end of the tick. I'm unsure if runInterval does the same but it's very likely now that you mentioned it.

distant tulip
remote oyster
#

Yea it would make sense. In either case, the nested function for runTimeout basically increases the already delayed runInterval.

distant tulip
#

yeah, just making sure i don't have it wrong

remote oyster
#

I edited my comment above to reflect it.

#

Whether at the end of the tick or the following tick, the math is still the same lol. ๐Ÿ˜

cinder shadow
#

do we have a way to disable this kind of output or is this yet another random content log I will have to live with forever?

granite badger
cinder shadow
#

It's already distinguished by needing the rc: identifier, adding the capability to do the commands without an identifier was a mistake imo and I will die on this hill

open urchin
remote oyster
#

I'm still using old school CLI until the new custom commands feature gets worked out a little more.

remote oyster
#

Yea, that's true but for context and clarity so as to not create confusion, that's why I referenced it as "old school" ๐Ÿ˜€

cinder shadow
#

I do also hope we are given the ability to put commands into "groups" so they are only alphabetized within that group

#

makes sense why minecraft has a /? command

#

otherwise the actual /help command which you would want at the top of the list would end up in the middle

remote oyster
#

If anyone knows, ping me. ๐Ÿ‘

#879773489601585244 message

mighty igloo
#

can you do dynamic properties or something similar on a sign?

#

oh they dont

#

does anyone know any alternative?

#

or a way to see who owns/placed a block

thorn flicker
mighty igloo
#

well ofc

#

but a way to get the player who placed a block within a block

thorn flicker
#

you can use that for what you are trying to do.

mighty igloo
#

Im making a sign shop but I cant seem to assign the sign shops to players without having them place their name in the sign. The issue ofc with that is that they can put any person as the owner

#

My only idea is to save the block and its location within world properties but it seems a little too complicated for this. I mean if its the only method then I will but...

thorn flicker
uncut lynx
#

In a span of a day i remade the system myself from scratch. i reduced code size by 50% vs what ai gave me.

#

I'll send a vid of it

#

and code

#

made with 0% ai

#

i enjoyed the process more actually

#

again, compressed from 400mib srry for the quality

#

Oh, i forgor the part where the parts break etc.

#

i'mma send that rq

mighty igloo
#

why is this void?

uncut lynx
mighty igloo
#

well I tried putting : Player

#

but it still d

uncut lynx
#

use .filter

mighty igloo
#

filter for what?

uncut lynx
#

Ohh then idk use a function

#

or do

let a;
b.forEach((c) => { a = c; });

kinda thing

uncut lynx
mighty igloo
#

ok it worked

thorn flicker
uncut lynx
#

Since u basically said that my ai code was worthless

#

i have remade it.

#

from scratch.

#

myself.

thorn flicker
#

I did not say that

mighty igloo
thorn flicker
#

I said I was less interested in it because it was made by ai.

#

and again, my criticism is not about the ai's accuracy.

uncut lynx
uncut lynx
mighty igloo
#

?

uncut lynx
#

.

uncut lynx
thorn flicker
#

okay

thorn flicker
uncut lynx
#

also what is the byte limit of world.setDynamicProperty

dusky flicker
#

@remote oyster did you work with dbs already? im confused about memory alignment of pages. is it based on the table size or the page size? im thinking about, if pagesize = 4kb, and the data being stored is 40bytes, sometime it will overflow and go to another byte, and so data will get corrupted

thorn flicker
#

I believe

dusky flicker
remote oyster
uncut lynx
dusky flicker
dusky flicker
remote oyster
uncut lynx
#

okay

remote oyster
uncut lynx
#

thanks!

distant tulip
remote oyster
#

Indeed, it's common to limit each value to 30,000 and splitting them into chunks. Should you decide to not take the approach of keeping your database flattened.

dusky flicker
#

i pretend making an in memory art

dusky flicker
#

not 100% sure about that, but its what i saw on web

#

i think sqlite uses pages of 4kb

distant tulip
#

keep in mind the number is to high and you will never reach it, so you might find some people saying it is unlimited (might as well be)

#

if the game didn't break that is

distant tulip
remote oyster
#

If you do globs of data then I would suggest pointers to do faster lookups. Or something of the sorts.

distant tulip
#

can't see a use case where i would search and sort through them

remote oyster
#

Me either. Not flattened anyways. That would be pretty wild I think.

distant tulip
#

just wasn't sure if the amount of api calls would be better than one call, and if the value size affect the call that much

remote oyster
#

Oh no, definitely limit API calls. For example, if you break your glob of data into chunks, instead of trying to write each chunk to its own dynamic property, making numerous API calls, you could utilize world.setDynamicProperties() and make it a batch process. Run it asynchronously and you got something going for yourself.

distant tulip
#

uh... setDynamicProperties is a thing?

remote oyster
#

Yup, and it's fantastic lol. I just wish they had one for get.

distant tulip
#

you learn new thing every day i guess, lol
that sound useful

#

damn, why not...

dusky flicker
wary edge
dusky flicker
#

for sure the api call has its overheads, but as its implemented in C++, i think its lesser(i dont know if this word exists) than copying 30kb of data

#

that supposing each 1 char = 1byte

remote oyster
distant tulip
distant tulip
remote oyster
# dusky flicker i'd not use 30k, quickjs is not as hell optimized as v8, strings are copied, and...

You can definitely break them down into much smaller chunks of concerned about memory and performance. Although in this instance I think memory will be the biggest concern and a lot less on performance due to the constraints within the API and it's limited memory usage. Just keep in mind that there may still be overhead for gathering up all of your chunks, piecing them together, and then doing whatever it is that you plan to do. Unless you plan to get extremely complex to where you access part of the glob, modify that section, and write it back like a delta update.

remote oyster
dusky flicker
dusky flicker
#

the unique way i think is creating different dynamic properties

remote oyster
#

There are many ways to go about this too.

#

It's all personal preference and how you design your database.

dusky flicker
#

im going to do a lot of benchmarks to decide what to use for performance

remote oyster
remote oyster
dusky flicker
#

imma use it as hell

#

to batch updates

uncut lynx
#

How can i use setDynamicProperties here?

const saveDataString = JSON.stringify(saveData);
const numberSaveDataParts = saveDataString.length / 32767;
for (let i = 0; i < numberSaveDataParts; ++i) {
    world.setDynamicProperty(`createbedrock:rotation_system_components_${i}`, saveDataString.slice(i * 32767, (i + 1) * 32767));
}```
sly valve
#

but:

#
const DATA_LENGTH = 32767

const saveDataString = JSON.stringify(saveData);
const numberSaveDataParts = Math.ceil(saveDataString.length / DATA_LENGTH);

const saveRecord = {}
for (let i = 0; i < numberSaveDataParts; ++i) {
    saveRecord[`createbedrock:rotation_system_components_${i}`] = saveDataString.slice(i * DATA_LENGTH, (i + 1) * DATA_LENGTH);
}

world.setDynamicProperties(saveRecord);

@uncut lynx

#

like that

uncut lynx
#

Hmm... is that gonna be faster?

sly valve
#

instead of 1-3 API calls, you only do one

#

but as far as i remember, the max. value length of an dynamic property was 4096 ?!

#

instead of 32767

uncut lynx
#

for me 32767 works

sly valve
#

lol

#

cool

uncut lynx
#

Could you help me debug my code

#

?

#

I have an issue, where randomly components destroy themselves (i.e. rpm conflict occurs), when i place sth too fast or ranomly.

#

i'm working on a possible solution but well... idk

#

my possible solution (since while (this.needsUpdate) {} crashes my world) is to have separate copy of the components made upon call of update()

#

then we dont care bout anything new until next update()

#

but then how do i copy the components back w/o breaking possible changes...

#

obv i could copy it one by one

#

but that'd be kinda slow

#

but i do so much iterating anyway

#

it doesnt matter

lyric kestrel
#

Did not know that was a thing you could do with ts

uncut lynx
#

okay i figured it out

#

turns out it was destroying when the value was 0 vs positive value, which failed the check (a>0 !== b>0)

#

how can i run sth in async

cold grove
#
world.afterEvents.someEventIDk.subscribe(async () => { /* */ })
system.run(async () => { /* */ })
(async () => { /* */ })();
sly valve
#

Async/Promises are peak stuff

#

everyone needs to know how it works

lyric kestrel
#

Just the little small things

sweet seal
#

Better alternative to system intervals that won't lag as much?

sly valve
sweet seal
finite totem
#
if (id == "genb10:teleporter") {
        const randomPlayer = world.getAllPlayers()
        player.teleport(randomPlayer, { facingLocation: targetLocation, });
        return;
    }

how do i check for if the player it is trying to teleport to is not the player itself?

#

i dont want the player to tp to themself, unless ig, there is no one else to tp to

#

probably going to also add an "allow teleport" feature that only lets people tp to them if they have it on

wary edge
#

That code also would not work.

dusky flicker
#
poll_question_text

For nosql database-lik inside mc, should memory usage or performance be prioritized?

victor_answer_votes

7

total_votes

7

victor_answer_id

1

victor_answer_text

Performance

dawn zealot
#

is there anyway i can make the playerInteractWithBlock not fire multiple times when i niteract with a block

finite totem
shy leaf
#

you dont have to check for id that way

#
const players = world.getAllPlayers().filter(p => p !== source);
alpine wigeon
#

how do you spawn projectiles with motion?

shy leaf
#

or do .applyImpulse() method after spawning

#

or do both

alpine wigeon
#

how do i use .shoot()

simple zodiac
finite totem
shy leaf
shy leaf
alpine wigeon
#

um

#

how?

shy leaf
#

_ _

#

are you new to scripting

alpine wigeon
#

kinda

shy leaf
#
import { world } from "@minecraft/server";

function shootArrow(targetLocation) {
  const velocity = { x: 0, y: 1, z: 5 };

  const arrow = targetLocation.dimension.spawnEntity("minecraft:arrow", {
    x: targetLocation.x,
    y: targetLocation.y + 2,
    z: targetLocation.z,
  });

  const projectileComp = arrow.getComponent("minecraft:projectile");

  projectileComp?.shoot(velocity);
}
#

this is an example code

alpine wigeon
#

is there a way to throw a projectile without consuming an item?

shy leaf
#

uh, depends on your use case, i guess?

alpine wigeon
#

i want it to work like you're on creative, but for every gamemode

shy leaf
#

you mean for like, all the projectiles?

alpine wigeon
#

for a specific item i just made

#

only that one

#

no others

#

do you know how to do that?

shy leaf
#

uhhhh i dont know much

finite totem
shy leaf
#

especially since i dont know how your code is

shy leaf
#

give me a second

alpine wigeon
# shy leaf especially since i dont know how your code is
{
    "format_version": "1.21.50",
    "minecraft:item": {
        "description": {
            "identifier": "content:infinity_disc",
            "menu_category": {
                "category": "equipment"
            }
        },
        "components": {
            "minecraft:max_stack_size": 1,
            "minecraft:display_name": {"value": "Infinity Disc"},
            "minecraft:icon": "infinity_disc",
            "minecraft:hand_equipped": true,
            "minecraft:throwable": {
                "do_swing_animation": true
            },
            "minecraft:projectile": {
                "projectile_entity": "content:infinity_disc"
            }
        }
    }
}
shy leaf
alpine wigeon
#

idk maybe

#

i could use custom component instead

shy leaf
alpine wigeon
# alpine wigeon i could use custom component instead
{
    "format_version": "1.21.50",
    "minecraft:item": {
        "description": {
            "identifier": "content:infinity_disc",
            "menu_category": {
                "category": "equipment"
            }
        },
        "components": {
            "minecraft:max_stack_size": 1,
            "minecraft:display_name": {"value": "Infinity Disc"},
            "minecraft:icon": "infinity_disc",
            "minecraft:hand_equipped": true,
            "minecraft:custom_components": ["content:infinity_disc"]
        }
    }
}
shy leaf
#

ig custom components could work? but

#

items arent my expertise sadly

#

so i cant help much here

alpine wigeon
#

D:

#

ok ๐Ÿ˜ฆ

shy leaf
#

so you could do like

player.teleport(randomPlayer.location, { keepVelocity: true });
nova wraith
#

Scripts can make the player unable to enter portals?

shy leaf
#

i think theres no beforeEvent for dimension change

#

last time i checked

nova wraith
shy leaf
#

you

alpine wigeon
#

what's wrong with this?

source.spawnEntity("content:infinity_disc", source.location)
nova wraith
#

I don't know if it is caused by your scripts or something else

alpine wigeon
#

ohhhhhhh

#

ty

shy leaf
nova wraith
#

Since I'm changing almost everything on the main script, I will try to remove some lines to see what happens

shy leaf
#

mhm

#

i see

#

also are you still using the hacky method?

nova wraith
#

Hacky method?

shy leaf
#

the uh

nova wraith
#

Wdym?

shy leaf
#

i mean the player direction thing

#

you know

nova wraith
#

I'm using your movement scripts

shy leaf
#

i see

nova wraith
#

Since it's the only thing that makes the player move like dungeons

shy leaf
#

just letting you know that you can revamp the whole code using new camera features in future updates

#

they added something similar to that

#

using only camera presets

nova wraith
#

So only with camera presets we will be able to change player movements?

shy leaf
#

yep

nova wraith
#

That's interesting

#

But wouldn't that break the combat system?

shy leaf
#

i lost the test video by someone but its somewhere in this server

nova wraith
#

When it was posted?

shy leaf
#

and aim assist is a thing too

shy leaf
#

:(

nova wraith
shy leaf
#

it seems plausible

nova wraith
#

But that will require a lot of scripts lessons lmao

shy leaf
#

better than fake hitbox

#

its worth it

nova wraith
shy leaf
#

keep in mind that the addon is my first work ever

nova wraith
shy leaf
#

(i still have nightmares about the horrid code)

nova wraith
#

I thought that was just a side project of yours

shy leaf
#

yeah it really is my first project

#

made using my phone and tablet

#

bridge

nova wraith
#

I'm learning new things because of that

shy leaf
#

i hope you didnt learn from my scripts code

#

considering how horrible

#

it is

nova wraith
#

Sometimes the player teleport 1 block back but it's fine

shy leaf
#

yeah

nova wraith
#

I've managed to finish the dash code

#

Just need to add cooldown

shy leaf
#

good luck with that

nova wraith
shy leaf
#

fire

#

๐Ÿ”ฅ

nova wraith
#

Can i send a short showcase of it to you?

shy leaf
#

i would love it

nova wraith
#

._.

alpine wigeon
#

now what

source.dimension.shootProjectile("content:infinity_disc", source.location)
#

it's broken again ๐Ÿ˜ญ

mighty igloo
#

anyone know?

drifting ravenBOT
#
Please, no screenshots or photos!

Screenshots are hard to read, and photos even more so. This is especially true if you are using bridge or another tree editor, as this format obscures the JSON format.

We can help you best if you copy and paste your code here, or send it directly as a file.

alpine wigeon
shy leaf
mighty igloo
#

can you click on the image

wary edge
#

Screenshots are hard to read.

wary edge
mighty igloo
#

i can read it fine

#

whats the problem

wary edge
#

Screenshots are hard to read.

mighty igloo
#

no it isnt

#

I clicked on it and its the same I see on my screen

#

if I can read it then you can

shy leaf
wary edge
#

Screenshots are hard to read.

shy leaf
#

this is a horrible readability

mighty igloo
#

its the same size as text

shy leaf
#

i cant see all the codes in a screen

wary edge
#

You do realise people are on different devices and aspect ratios?

mighty igloo
#

I can litterally read it in your screenshot of a screenshot

fallow carbon
#

screenshots prevent us from performing some analysis code as well such as typechecking it locally and making tweaks or the issue being excluded from the snippet

mighty igloo
#

Sounds sus

wary edge
mighty igloo
#

bruh okay ill test it on my phone too

wary edge
#

Good for you that you can read, screenshots are still hard to read.

mighty igloo
#

dyslexia?

#

bruh

wary edge
mighty igloo
#

ive done screenshots since I joined

#

nobody complained until now

shy leaf
#

i literally cant see the whole code because of screen size

wary edge
mighty igloo
#

bruh I can read the text in the screenshot of a screenshot on my phone

#

the same device

shy leaf
mighty igloo
#

yall cant be serious

alpine wigeon
shy leaf
#

the code gets cut off

mighty igloo
#

so what thats all you need to see

wary edge
#

Additionally.

drifting ravenBOT
#
How To Ask Good Questions

Be specific and include relevant details about the question upfront.

  • What are you trying to accomplish?
  • If you have code, which part is not working? Any content logs?
  • What have you already tried?
  • Have you searched the Bedrock Wiki?

https://xyproblem.info/

mighty igloo
#

Im not sending all my code

wary edge
shy leaf
alpine wigeon
#

ok and how do i get the view direction

mighty igloo
# drifting raven

im not wasting my time on unnecessary responses. you all have trouble with answering a question thats not my problem. Ill just wait for someone who actually cares to help

shy leaf
#

stirante and jayly docs are useful here

wary edge
mighty igloo
#

says the moderator

alpine wigeon
wary edge
shy leaf
#

but heres a catch

mighty igloo
wary edge
mighty igloo
shy leaf
#

you cant do multiply math using objects, so you cant do smth like

velocity * player.getViewDirection()
#

itll not work as intended

alpine wigeon
#

you have to split velocity into 3 values right?

wary edge
alpine wigeon
#

oh wait yeah

shy leaf
#

do smth like;

const dir = player.getViewDirection();
p.shoot({ x: dir.x, y: dir.y, z: dir.z * 4 });
#

uh

#

probably should multiply z value instead

#

i forgot how vector3 works in this case

alpine wigeon
#

lol yeah

#

hmm it wants a number for the vector and can't parse the getViewDirection function for some reason

shy leaf
#

aw damnit

#

oopsie

mighty igloo
# wary edge "Ive committed crimes before and no one complained"

Not following guidelines is not a crime. I get your analogy but it incorrect in the scenario when Im able to recreate the situation the other user is experiencing and know for sure that they are able to read the screenshot. Whether or not it was the full code is not your concerns. If I would giving the code away I wouldve sent the full thing, but no. So I sent a screenshot. Screenshots help simplify the process of copying. If I pasted it, it would also display differently. Here is what you need to do. You need to respect that I prefer screenshots over copy and paste. If you cant respect it then this conversation is over.

fallow carbon
shy leaf
#

common vector3 mistake

alpine wigeon
#

ohhh ok

mighty igloo
alpine wigeon
#

it works

#

but it shoots off to the side most of the time

mighty igloo
shy leaf
alpine wigeon
#

z i think

shy leaf
mighty igloo
#

There was no attitude

#

you all caused this

alpine wigeon
shy leaf
#

yeah i pointed it out

mighty igloo
#

ok and thats all you needed to do

#

you didnt need to escalate anything

shy leaf
#

i couldve GLADLY helped you if i could actually comprehend what the bloody hell is happening in the code

mighty igloo
#

thats all you and smokeystack

shy leaf
#

also no??? i didnt escalate anything

#

i literally just... pointed it out???

mighty igloo
#

You initiated it

#

smokeystack took over

alpine wigeon
mighty igloo
#

I am but he doesnt know how to end the conversation

alpine wigeon
shy leaf
#

that shouldnt be the case

#

since youre multiplying

alpine wigeon
#

but i'm not scaling the x and y only the z

shy leaf
#

the view direction scales that for you

#

oh wait.

alpine wigeon
#
x: dir.x, y: dir.y, z: 5*dir.z
shy leaf
#

try uh

#

multiplying all the values

#

i forgot that

wary edge
#

You should only scale the y.

alpine wigeon
#

yeahhhhh it works a LOT better now that i'm uniformly scaling it

shy leaf
#

if that resolves it im gonna crashout

alpine wigeon
#

it did resolve it...
๐Ÿ’€

shy leaf
#

im gonna crashout

#

welp GG

alpine wigeon
#

now the problem is that it spawns the entity inside the player hitbox
so it deletes the entity before it goes anywhere

wary edge
#

Im still mad they wont include a native Vector3 class in the server module.

shy leaf
#

owner property, maybe?

wary edge
#

Spawn in front of the player and then shoot it.

shy leaf
#

projectile component has owner property

vast grove
shy leaf
#

its probably disappearing because it hits the owner as soon as it spawns

wary edge
shy leaf
#

yeah uh

#

how does your projectile code looks like

wary edge
#

Vector3 was originally a class before they switched it to interface.

alpine wigeon
vast grove
#

Still available on their math utils npm package I think.

shy leaf
wary edge
alpine wigeon
#

oh

vast grove
#

I guess the point was overrideable customizability

alpine wigeon
#
const dir = source.getViewDirection()
            const velocity = { x: 5*dir.x, y: 5*dir.y, z: 5*dir.z };

            const projectile = source.dimension.spawnEntity("content:infinity_disc", {
                x: source.location.x,
                y: source.location.y + 2.5,
                z: source.location.z,
            });

            const projectileComp = projectile.getComponent("minecraft:projectile");

            projectileComp?.shoot(velocity);
shy leaf
#

try adding

projectileComp.owner = source;

below projectileComp

alpine wigeon
#

okie

#

dangit the game crashed

#

i have to load it again and it takes so long ๐Ÿ˜ญ

shy leaf
#

do you not use /reload

alpine wigeon
#

i did but i changed some code in the entity so i had to exit

shy leaf
#

oh rip

alpine wigeon
#

OMG TYSM GUYS it works!!!!!!!

shy leaf
#

there we go

#

gg

alpine wigeon
#

i wanna send a video of it

#

is there a specific channel i should send it in?

shy leaf
#

this place should be fine

#

since its related with what we had above

alpine wigeon
shy leaf
#

mkv ๐Ÿ˜ญ do you not have mp4 convert enabled

marsh pebble
#

does anyone know if you can hide code like on a github for an addon to use

alpine wigeon
#

it just be like that

marsh pebble
#

here is the mp4

alpine wigeon
#

WAIT YOU HAVE TO DOWNLOAD???

shy leaf
#

yeah

alpine wigeon
#

OMG I DIDN'T REALIZE

marsh pebble
shy leaf
#

im on phone

alpine wigeon
#

IM SO SORRY

marsh pebble
shy leaf
#

cant play mkv spong

shy leaf
alpine wigeon
#

๐Ÿ˜ญ

wary edge
#

Society if Discord supported more formats.

marsh pebble
#

or atleast

#

under 20$

marsh pebble
#

For a friend

marsh pebble
#

websites dont count

shy leaf
#

we had a lot of questions like this but

marsh pebble
#

im talking about software

wary edge
#

Obfuscation is very easy to reverse, but to entertain this thought I would use a bundler to minify your code and obfuscate it.

shy leaf
#

obfuscating makes it unreadable for humans

#

only humans

marsh pebble
#

i dont understand the whole obfuscation thingy

wary edge
marsh pebble
wary edge
marsh pebble
#

I already understand it's suppose to be un-readable for humans only,

shy leaf
#

obfuscating is like

#

a padlock

#

keeps the honest ones away

#

only honest ones

marsh pebble
#

How i think of it, No matter how secure your code is there is a person or software that can always crack it,

#

well

#

yeah

fallow minnow
#

is this good system

#

its just test code for now

#

gonna make classes for the database thing

marsh pebble
#

Deff not bad

vast grove
#

Code obfuscation with the really stupid way of how JavaScript handles coercion...

marsh pebble
#

even tho i know it can be cracked i still need an obfuscation software for my friend

fallow minnow
#

im actualy goinmg to

#

uh

marsh pebble
#

?

fallow minnow
#

switch the "cache" to dynamic properties

#

just in case

marsh pebble
#

i dont understand javascript

#

too confusing for my brain

shy leaf
#

no one fully understands javascript

marsh pebble
shy leaf
#

rip

marsh pebble
#

bc i need a teacher

#

and my friend is being taught by jeanmajid

#

so sad

vast grove
marsh pebble
#

no luck

#

maybe ido need motivation

shy leaf
#

it has been a year since i started javascript

#

and i can say im fairly alright with javascript now

#

its all trial and error, full of practices

marsh pebble
#

did u make sweep and N' slash

shy leaf
#

yep

marsh pebble
#

so sad

shy leaf
#

why

marsh pebble
shy leaf
#

oh

#

well

#

there are marketplace partners here too

#

and mojang devs

marsh pebble
#

๐Ÿค”

vast grove
#

My experience with programming is 12+ years and I still don't know a lot of things because I don't need to. You can't learn something if you don't have a goal to create something.

shy leaf
#

yes that

marsh pebble
shy leaf
#

โ˜ ๏ธ โ˜ ๏ธ โ˜ ๏ธ

#

caught me off guard

vast grove
#

I had to learn JavaScript because of webdev and now mc. I had to learn C# because I wanted to create a cross platform application in an OOP specific environment, also because it was easier for me.

marsh pebble
#

ik css and html

#

shouldnt js be easy?

#

I dont understand it

vast grove
#

I don't know CSS and HTML

shy leaf
#

well js is easy

vast grove
shy leaf
#

until it isnt

marsh pebble
#

I use to be a head admin at leaf essentials if yk what that is (Now im just a bum) ๐Ÿ’”

vast grove
#

I know vue, xaml, cshtml. But raw html and css I am hopeless

marsh pebble
vast grove
#

So it's not about (knowing) things. It's about achieving things

vast grove
marsh pebble
#

anyways i cant even run minecraft, vscode, and my browser at the same time without my cpu capping over 90%

vast grove
#

Eeeehhh well Minecraft itself is very power sucking without capping your fps

#

Dawg. Tech moves so fast. Ryzen 9 9950x exists and I'm still on ryzen 9 3900x...

marsh pebble
#

literally for a 300$ laptop im so suprised

vast grove
#

Me who spent way too much on a desktop that I hardly use sadJoe

marsh pebble
#

im too poor for tjat

#

im only 14 ๐Ÿ™

#

im getting a new mouse tmrw tho

#

mine has been broken for a week lmao

marsh pebble
vast grove
#

I think I spent $1.5k for a laptop, 4k for the desktop and 1k for a phone bigthonk though I don't spend much on anything else so it's slightly justifiable

#

Idk. I should probably wipe my desktop and install a linux distro on it for rendering stuff

#

Or like some compile server with gitlab integration. Would be kinda cool

#

Ok i should stop speculating and work on mclink with VC

sly valve
#

Guys, Im doing a Tower Defense, Anyone got ideas which enemy types I can add? (the images are my current enemies I already have or will have soon)

#

Please ping on Response

sly valve
round bone
#

๐Ÿ˜ญ

sly valve
#

lol just seen, forgot to remove them

round bone
#

Zombie_horse -> ZombieHorse
Wither_Skeleton -> WitherSkeleton

sly valve
#

just did it

#

its because I copy pasted them form the entity type

round bone
#

oh, okay

woven loom
prisma shard
prisma shard
#

mmm

#

player.dimension.getEntities().length
i am getting entities count using this

#

but

#

it kindof flickers

#

idk why but it shouldnt

#

lets say i kill one entity.. it was 7 before

#

its like suddenly 2 adds up, then turns to 6

#

its inside runInterval with a runTimeout(()={}, 2) inside

round bone
#

you have 7 entities

#

you killed one

#

and you should have 6 entities

#

everything is okay

prisma shard
#

but

#

it suddenly goes to 9

#

then goes to 6

round bone
#

are you sure that there aren't any other entities spawning for a ms?

prisma shard
#

idk but

#

why should 2 entities spawn

#

then disspaear immediately

#

so its maybe script problem

round bone
#

isn't this entity dropping some items maybe?

prisma shard
#

the counter is like -> 7 -> (-1) kill -> 9 -> 6

#

but it should just go 7 -> (-1) kill -> 6

prisma shard
#

mmmmmmmm\

#

i gotta test then

#

you might be right

#

yeah i am stupid sorry ๐Ÿ™

round bone
#

which entity are you killing?

prisma shard
#

lets say a pig bruh]

#

ok thats not a problem i was just being stupuid

round bone
#

this bug is for every entity

#

oh

#

xD

prisma shard
#

its just giving me nightmares why am i using runTimeout inside runInterval

#

i mean that loooks nested but it works if it works

round bone
#

can you show me the code?

#

I think you're doing something wrong then xD

wheat condor
prisma shard
#

omg no

#

why

#

what

#

i am making debug screen

#

that loses functionbality of vannilla

uncut lynx
#

Bruh i love async

#

it made my addon not lag the hell out of it when block is placed

#

well the lag is lesser

#

but it still is

gilded shadow
#

should i keep my AStar synchronous or asynchronous ?

worn sphinx
#

let me ask, what is getComponent of hunger?

uncut lynx
#

they'd lag the hell outta it

#

secondly, see the lag when i place?

#

it happens for my mod only, rest of the game is unaffected

#

alright the cause is propagateRotation function

#

but that func is already async...

#

there ain't much better way of doing it other than BFS

#

time for micro optimizations i guess

round bone
#

show it

worn sphinx
#

Code

system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        const playerhunger = player.getComponent("minecraft:player.hunger");
        console.warn(playerhunger.currentValue)
    }
}, 20);
uncut lynx
#

i switched to Queue taken from the internet

#

the lag is lesser

#

but still is

warm mason
halcyon phoenix
#

whats that???

worn sphinx
#

Oh

worn sphinx
halcyon phoenix
#

is it goodhabit to add semicolon?

round bone
#

but I don't like them

#

in production they does not matter

uncut lynx
#

why can't i use console.time ???

#

wait, i know why the lag

#

whatever it is just the visuals

uncut lynx
#

gosh i cannot convert large cogwheel texture properly from java to bedrock

remote oyster
# halcyon phoenix is it goodhabit to add semicolon?

Semicolons make it clear where a statement ends, similar to how you end a sentence with a period, exclamation point, or question mark. They're a form of proper punctuation in code. You aren't obligated to use them just like you aren't obligated to end a sentence with a period, but others may look at it differently.

halcyon phoenix
#

I see thanks

alpine wigeon
thorn flicker
alpine wigeon
#

how does one do that

thorn flicker
#

nvm

#

there's no power property, im going insane

thorn flicker
round bone
alpine wigeon
#

specificly do you know what the code would be?

round bone
alpine wigeon
#

no

#

wat

thorn flicker
#

should learn what dot notation is.

alpine wigeon
#

like source.runCommand?
or source.spawnEntity

round bone
thorn flicker
#

you access a property with a period

#

yes

alpine wigeon
#

then i do know

thorn flicker
#

good.

#

these are the properties you can get from the projectile component.

thorn flicker
#

i sent

round bone
#

you're looking for Inertia props ig

round bone
#

I am on my phone rn

thorn flicker
#

we sent it at the same time

#

its fine lol

round bone
#

It's hard to browse scripting docs on phone xD

uncut lynx
alpine wigeon
round bone
thorn flicker
#

like I said

#

there's no power property

uncut lynx
round bone
alpine wigeon
#

:(((((((

uncut lynx
#

but the models look like a potato

alpine wigeon
#

but inertia is different i think

uncut lynx
#

(i mean raw models w/o txts are fine)

round bone
#

check docs and you'll get to know what you need

alpine wigeon
#

inertia is how quickly it will slow down
power is how fast it goes at the start

round bone
thorn flicker
#

power is the damage modifier from the power enchantment on a bow

alpine wigeon
#

oh really?

thorn flicker
#

are you being sarcastic

alpine wigeon
#

no

#

genuine

#

sry

#

ambiguous

thorn flicker
#

what do you mean by power then

#

the power of the launch?

round bone
#

velocity or power?

alpine wigeon
#

the thing in the entity
idk really

thorn flicker
#

huh

alpine wigeon
#

whenever i tested power changes it made it go faster with higher power value

round bone
#

describe your idea

round bone
alpine wigeon
#

no

#

there's a script

sleek nexus
#

Yes power is initial speed, inertia is how much speed the projectile keeps over time

alpine wigeon
#

i just want to use the "power" that i set in the entity when i set the velocity with the script

thorn flicker
round bone
#

yup

alpine wigeon
#

dang

round bone
#

you have to involve some math then

#

๐Ÿ˜…

alpine wigeon
#

so velocity has to be hard coded?

#

what math

thorn flicker
#

you can get the velocity

#

entity.getVelocity()

alpine wigeon
#

but im setting the velocity on like the next line

#
const projectile = source.dimension.spawnEntity("content:infinity_disc", {
                x: source.location.x,
                y: source.location.y + 1.6, //1.6 is eye height
                z: source.location.z,
            });

            const projectileComp = projectile.getComponent("minecraft:projectile");
            projectileComp.owner = source
            
            const dir = source.getViewDirection()
            const power = 10
            const velocity = { x: power*dir.x, y: power*dir.y, z: power*dir.z };

            projectileComp?.shoot(velocity);
alpine wigeon
#

but then it's hard coded

dim tusk
#

Make a variable.

thorn flicker
#

there is a variable.

alpine wigeon
#

i want it to use this value

{
    "format_version": "1.16.0",
    "minecraft:entity": {
        "description": {
            "identifier": "content:infinity_disc",
            "is_spawnable": false,
            "is_summonable": true,
            "is_experimental": false,
            "runtime_identifier": "minecraft:snowball"
        },
        "components": {
            "minecraft:collision_box": {
                "width": 0.3,
                "height": 0.1
            },
            "minecraft:projectile": {
                "on_hit": {
                    "impact_damage": {
                        "damage": 1000000000
                    },
                    "remove_on_hit": {}
                },
                "power": 2, //<<<POWER HERE
                "gravity": 0.001,
                "angle_offset": 0.0,
                "liquid_inertia": 1.0
            },
            "minecraft:physics": {},
            "minecraft:pushable": {
                "is_pushable": true,
                "is_pushable_by_piston": true
            }
        }
    }
}
dim tusk
#

I'm out of context here lmao I just got here.

thorn flicker
#

just because you cant get it in scripts doesnt mean its hardcoded though.

dim tusk
#

Anyways, bye.

#

Nice pfp void.

thorn flicker
alpine wigeon
#

yeah don't look at the dmg value

#

๐Ÿ’€

thorn flicker
alpine wigeon
#

nah it's insanely expensive to craft
so it has to have high dmg

uncut lynx
#

What do y'all thing of this line btw

world.getDimension(currentConnectedComponent.component.block.dimension.id).runCommand(`setblock ${currentConnectedComponent.component.block.location.x} ${currentConnectedComponent.component.block.location.y} ${currentConnectedComponent.component.block.location.z} air destroy`);```
thorn flicker
#

if you are just using it in scripts, remove power, and then just use the variable in the scripts for the power.

somber cedar
uncut lynx
#

lmfao

dim tusk
#

ooof nvm

thorn flicker
dim tusk
#

Didn't see the destroy

#

Oh yeah.

thorn flicker
#

and I was gonna say why are you using the block's dimension to change the block's type

#

lol

#

you fixed it though

round bone
#

is there any native method that's giving me a drop of block like /loot does it?

thorn flicker
#

im going insane

round bone
#

or am I forced to implement it by myself

#

ahh

uncut lynx
thorn flicker
#

its in the roadmap.

round bone
thorn flicker
#

i hope that gives us a destroy method

#

I dont remember if that specifically was mentioned or not

round bone
dim tusk
uncut lynx
#

what's the point if u use them one singular time?

dim tusk
#

you call it multiple times and it annoys me.

thorn flicker
#

they were intentionally trying to annoy I believe

round bone
uncut lynx
#

good point

dim tusk
round bone
dim tusk
thorn flicker
dim tusk
#

-# mbmb

uncut lynx
#

why would the f. i annoy somebody? also this is my full usage.

 if (currentConnectedComponentRPM > CONFIG.RPM_LIMITS.max || currentConnectedComponentRPM < CONFIG.RPM_LIMITS.min) {
                    //console.log(`ยง4[RotationSystem] RPM LIMIT EXCEEDED! Destroying block at ${currentConnectedComponentKey}`);
                    //console.log(`ยง4[RotationSystem] RPM ${currentConnectedComponentRPM} is outside limits [${CONFIG.RPM_LIMITS.min}, ${CONFIG.RPM_LIMITS.max}]`);

                    currentConnectedComponent.component.block.dimension.runCommand(`setblock ${currentConnectedComponent.component.block.location.x} ${currentConnectedComponent.component.block.location.y} ${currentConnectedComponent.component.block.location.z} air destroy`);
                    this.removeComponent(currentComponent.block, true);
                    continue;
                }```
alpine wigeon
thorn flicker
thorn flicker
alpine wigeon
#

nvm nvm

dim tusk
alpine wigeon
#

CHILL BRO

alpine wigeon
round bone
#

NAHHH

thorn flicker
round bone
#

crazy

#

Call of Duty of course

dim tusk
round bone
#

๐Ÿ‘Œ๐Ÿ‘Œ

dim tusk
thorn flicker
#

i just thought it was funny?

uncut lynx
#

i am not tryna annoy anybody tf?

round bone
#

๐Ÿ˜ญ

uncut lynx
#

i thought my line of code was funny?

dim tusk
thorn flicker
#

it was a joke

#

somewhat

dim tusk
uncut lynx
dim tusk
#

I must have typos or missing but like a reference yes.

dim tusk
dim tusk
uncut lynx
dim tusk
#

HUHHH?

alpine wigeon
#

what's the sound called that's played when you throw a snowball?

dim tusk
#

ok, I'm not in mood to explain... So people who's around do it.

uncut lynx
alpine wigeon
thorn flicker
dim tusk
thorn flicker
thorn flicker
thorn flicker
prisma shard
alpine wigeon
alpine wigeon
#

something's undefined tho

thorn flicker
#

you didnt define dimension did you.

#

get the dimension.

alpine wigeon
#

oop

#

that would make sense

halcyon phoenix
alpine wigeon
thorn flicker
alpine wigeon
#
onUse({ itemStack, source, dimension }) {
            const projectile = source.dimension.spawnEntity("content:infinity_disc", {
                x: source.location.x,
                y: source.location.y + 1.6,
                z: source.location.z,
            });

            const projectileComp = projectile.getComponent("minecraft:projectile");
            projectileComp.owner = source
            
            const dir = source.getViewDirection()
            const power = 10
            const velocity = { x: power*dir.x, y: power*dir.y, z: power*dir.z };

            projectileComp?.shoot(velocity);
            dimension.playSound("mob.witch.throw", source.location)
        }
#

oh i have an idea

warm mason
#

onUse does not have a dimension property

thorn flicker
#

yeah.

#

it doesnt.

#

do source.dimension

alpine wigeon
#

oh

thorn flicker
#

please just check the docs

#

dont assume or guess

#

less headaches

#

lol

alpine wigeon
warm mason
#

or just import @minecraft/server via npm

alpine wigeon
#

i just needed to add a sound because the discs move so fast you can't even tell if it threw

thorn flicker
halcyon phoenix
#

import * as mc from '@minecraft/server'; :>

prisma shard
#

i hate this shit..
i always have to do
/** @param {Dimension} dim */
otherwise the function doesn't show typings

thorn flicker
#

that's the point of it

halcyon phoenix
#

yeah

#

I just realized typescript is just JS but more readable

prisma shard
#

noooooo i also hate those as string shittt

thorn flicker
#

I hate alot of things in life

prisma shard
halcyon phoenix
#

TS are mostly for people who wants to be as precise as they can be

thorn flicker
halcyon phoenix
halcyon phoenix
#

what do you do?

thorn flicker
round bone
thorn flicker
#

Serty uses js too I guess

halcyon phoenix
#

I use copilot to check for typings

thorn flicker
#

im so unbothered by the typing stuff

#

I dont care enough yet

#

i will some day

#

especially if its a big project or something

halcyon phoenix
#

yeah and it's good for collaborative projects

distant gulch
#

Someone know a server where people need scripts? (Paid)

thorn flicker
distant gulch
halcyon phoenix
#

nice name

drifting ravenBOT
#
Finding a Dev or a Team?

This discord isn't suited for finding or offering paid work. We can't moderate these transactions, so we ask that you move to a more suitable place.

For a casual discord community, consider joining Skill Share: https://discord.gg/sZ7fkcN.

Find incredible people. Make beautiful things. A home for crafting your career in the Minecraft industry.

https://www.bucketofcrabs.net/

thorn flicker
#

or Skillshare

halcyon phoenix
#

I refreshed and it works now

halcyon phoenix
#

what's one way to filter blocks that only a player can break?
whitelist some blocks

#

breakblock beforeEvent?

tardy pivot
#

is there a script for checking hotbar?

cyan basin
#

If you get the players inventory you can then get their selectedSlotIndex which is their hotbar

halcyon phoenix
tight bloom
#

How do we run commands as blocks nowadays?

wary edge
wheat condor
#

can someone rq help me testing a feature of my revive addon?
i need a quick test, just 1 minute, dm me

lyric kestrel
#

I can't remember what it's called, but on VSCode there's a Java Datapack add-on that turns the icons in your file and folders into the relevant images, and it works for bedrock

#

Does anyone know the name of it?

wary edge
#

Should be in #1072983602821861426

uncut lynx
distant tulip
#

cool
-# but cross posting is against the server rules

neat hound
#

Any GitHub experts here?

warm mason
neat hound
#

Fresh windows install... and projects folder is moved. How to link folder back to Repo?

distant tulip
#

If you cloned the repo and just moved or renamed the folder it is still linked
you can confirm with "git remote -v"

#

or just type
"git remote add origin git-link"
if not

neat hound
#

Not cloned, all my stuff.

remote oyster
#

Cloning the repo versus downloading the project will have it set up for git.

neat hound
#

Hmm, seems that after adding git , vscode recognises everything....

remote oyster
#

Make sure your git history is intact.

#

Check with git log

neat hound
#

I pushed everything before the new ssd

#

thanks.. will try

remote oyster
#

Yea I figured you did. That's why I suggested using the git clone command. No need to try and "link" your folder to GitHub this way. Cloning it from upstream will pull in everything from the repo on GitHub, including commit history.

neat hound
#

Great.. cause I moved the folder from under my user to the c:\ and was not sure it would play nice

remote oyster
#

Once you clone it, you can move it wherever you like. Or just go to the directory where you want it to be, then execute the command there.

#

Cloning is probably the easiest and most efficient way here.

neat hound
#

4 repos.. was not looking forward to that.. I really need to do my github turorial

neat hound
#

So it has been a while (4 months) What is new?

granite badger
#

too many stuff changed with v2, I didnโ€™t catch up with all of them

neat hound
#

Version 2 to be released soonish?

uncut lynx
neat hound
#

Jayly, why do you want to see text and images cop[ied to the clipboard? LOL

granite badger
#

Wait what?

wheat condor
warm mason
distant gulch
distant gulch
uncut lynx
#

i didn't use ANY entities

#

the "lag" u see

#

is that block geo is constantly changing

#

hence u cannot place anything directly on it

wheat condor
#

if you re changing it evey tick trugh scripts it is

#

remember that lag stacks up

uncut lynx
#

nop

#

read my code

north frigate
wheat condor