#Script API General

1 messages ยท Page 142 of 1

fallen cape
#

BFS is not usually done with recursion, use a queue

ocean escarp
#

My brain hates trying work with queues especially when they have to store a lot of data like time stamps

#

It just becomes variable hell really quickly

#

Tbh I have a lot more respect for people who make veinminers

#

It's really hard

woven loom
#

nah its simple

#

use claude

ocean escarp
#

Not when you're tryna bake in a wave pattern + config

woven loom
#

try using claude

ocean escarp
#

I'm not using AI

#

That's vibecoding

#

I have to figure this out myself

#

Once I figure out loops

#

Cause block A needs to check 6 different locations for block B

#

And then all instances of B to C

#

And so on

#

I have no clue what I'm going ๐Ÿ’€

dapper copper
ocean escarp
#

I'm trying to figure out maps

#

Since I could run individual instances that way

#

I think???

#

Why do I have to be doing this on 2 hours of sleep

dapper copper
ocean escarp
#

Yeah I give up

#

I don't know why I thought I could do this

#

I'm honestly garbage at scripting anyways

fallen cape
ocean escarp
#

How hard can I really be to handle several dozen iterative maps under specific tick constraints while maintaining the integrity of the vein being mined and avoiding duplicate loot drops while taking into account enchantments on each block affected

#

It's honestly preschool level stuff

#

I think a hello world program is more difficult

worldly pier
#

I mean, what are you trying to do in the first place?

worldly pier
rich jacinth
#

Is there a way to do something along the lines of save a Tickingarea into something like an array for later use

rich jacinth
#

I'll try that out, thank you :D

ocean escarp
worldly pier
#

Just for curiosity, what features does it need to have?

warped kelp
#

Yeah, it uses a tag detection system:

Entity has thag tag at the time of damage, and activates the parry. Restores the health taken, gives it to the attacker. Of course, it also has a damage cap, and it works without the tag.

Let's say the damage cap is 30, the entity gets shot with a super OP damage that deals 200 HP out of the entity's 300, the HP would be taken, calculated to reduce the excess damage from the entity, and subtract, while also healing the entity of the excess damage (except for the 30 damage that did not exceed the cap) so 200 goes in, 30 goes out, and the entity looks like it had a seizure

fresh comet
#

Im too lazy to think about how to make a veinminer, but ig that's about detecting neighbor blocks in given amount of times

ocean escarp
wary edge
#

Enchantment support is quite easy. I wonder why Marketplace doesnt add them.

ocean escarp
#

/vutil:veinminer_add_block <blockID>
/vutil:veinminer_remove_block <blockID>

Probably not via a command because apparently I can't set up custom commands for the life of me but pretty much this

worldly pier
ocean escarp
#

Though it's 2am so i stopped working on it for the night about 2 hours ago

worldly pier
#

Jmm why would you need to use a queue?

ocean escarp
#

Apparently the best method is to just queue all the blocks and resolve the chain backwards

#

Breadth-first search method

worldly pier
#

What do you mean by all the blocks? wouldn't it be more efficient to just store the target's type blocks and then work with that?

ocean escarp
#

Well yeah that is what you would do

#

But you still need to queue every instance of that block as a coordinate

#

So the script knows what to break

#

I don't think this method support the flow animation I want to add tho

worldly pier
#

Yes but that's the same as just iterating over the array of selected blocks. I guess you can use a queue to do that, but in my opinion thats not necessary.

ocean escarp
#

I'll just spend another 6 hours tomorrow trying to figure it out

#

I don't got nothing better to do

worldly pier
ocean escarp
#

I'd have to like save an iteration value

#

And play each iteration 1 tick after each other

#

I was never a fan of the instant ones

worldly pier
ocean escarp
#

This feature was going to be a part of a larger pack

ocean escarp
#

It may be quite late for me

worldly pier
#

Ok, for me it's still early... So I'll post what I came up with and then I'll tag you so you can check it when you want

ocean escarp
#

Alr I appreciate that

#

Gn

hazy nebula
#

Is there a way to generate lightning without causing damage or fire?

worldly pier
# ocean escarp Alr I appreciate that

This is my progess for the time being. It works... Kinda, some blocks seem to repeat, in the result list, for some reason and I cannot figure out why... I'll do it later.

import { Block, world, system } from "@minecraft/server";
function veinMiner(startBlock:Block){
  let location= (block:Block) => `${block.x};${block.y};${block.z}` // vector3 -> unique string
  let result: Block[] = [] // all blocks scanned
  let selectedBlocks:Block[] = [startBlock] //soo this end up stransforming into a queue
  let resultLocations:string[]= [location(startBlock)] // all blocks scanned's location in string form
  let blockType = startBlock.typeId // thr block type we're looking for
  for (let i=0; i<10; i++){
    let selected= selectedBlocks.shift()
    if (!selected) break
    let adjacentBlocks:(Block | undefined)[] = [selected.above(), selected.below(), selected.south(), selected.north(), selected.east(), selected.west()]
    for (const block of adjacentBlocks){
      if (!block) continue
      if (location(block) == location(selected)) console.warn("how?")
      if (location(block) in resultLocations) continue // already scanned
      if (block.typeId!=blockType) continue
      selectedBlocks.push(block)
      resultLocations.push(location(block))
      result.push(block)
    }
  }
  return result
}
world.beforeEvents.playerBreakBlock.subscribe(v=>{
  let heldItem = v.player.getComponent("inventory")?.container!.getItem(v.player.selectedSlotIndex)
  if (!heldItem) return
  if (heldItem.typeId !="minecraft:stick") return
  v.cancel = true
  system.run(()=>{
    let blocks = veinMiner(v.block)
    console.warn(blocks.length)
    for (const block of blocks){
      block.setType("iron_block")
    }
  })
})
console.warn("loaded 123")
rigid torrent
#

Does someone knows if I can spawn a custom entity with a nametag, and it to show when looking at the entity just like any nametag without requiring a game reload

#

I don't know why it requires me to reload the game in order for the name tag to show normally

#

Okay, handling it purely with scripting and not relying on JSON fixes it

warped kelp
#

Scripts are scary, man

worldly pier
#

New update. This time I take a different approach. I used node trees. It works as expected. It doesn't seem to have bugs. It's only problem seems to be efficiency.

warped kelp
#

Is there any way to apply the freezing screen from powdered snow via scripts?

ocean escarp
#

Do dynamic properties have to be entity linked?

distant tulip
#

Or players

ocean escarp
warm mason
ocean escarp
#

Well that solves 1 issue

#

Now I just need to figure out the other 30

#

I might need a local nested function

#

I'm still trying to understand queue systems

ocean escarp
#

This isn't right

#

I feel useless

#

Now I need to find out how to build a new set from this data...

#

My head hurts...

#

Idek if the data is right

#

I think this is right

#

But how would I make it recursive

#

Or I guess progressive

#

Do I need ANOTHER loop + index to track it????

#

Don't tell me this is the entire system or I will find a way to block this message.. getting given the correct answer is not good for learning

#

It's like trying to pass an exam by letting someone whisper the answers to you

#

It doesn't help me get better

#

Even if it takes me a week and a few hammers to the head I will figure this out without being given the answer

#

I want to learn not to plaguerise

woven loom
#

okay

ocean escarp
#

I'm asking for advice on the methods not a full implementation with 0 effort on my part

#

Whether I'm going the right steps

#

I know the format I need to build but it's just so difficult

const oreMap = [
[[Loc 1]],
[[Loc 2a], [loc 2b] ...],
[[loc 3a], [loc3b] ...]
]

Then I evaluate each member of oreMap with 1 tick of spacing between them

ocean escarp
#

@woven loom

#

Building this structure so I can break the correct ores

woven loom
#

what are you tring to do btw

ocean escarp
#

Just a simple veinminer with a few extra features I can't seem to find anywhere else

#

But it's the first time I've ever tried to make an "expanding" system

woven loom
#
FUNCTION VeinMineSearch(startBlock, maxBlocks)

    targetType = startBlock.type

    create empty queue
    create empty visited set
    create empty result list

    add startBlock to queue
    add startBlock position to visited

    WHILE queue is not empty

        currentBlock = queue.popFront()

        IF currentBlock.type != targetType
            CONTINUE

        add currentBlock to result

        IF result size >= maxBlocks
            BREAK

        FOR EACH neighboring direction

            nextPosition = currentBlock.position + direction

            IF nextPosition already visited
                CONTINUE

            mark nextPosition as visited

            nextBlock = getBlock(nextPosition)

            IF nextBlock does not exist
                CONTINUE

            IF nextBlock.type != targetType
                CONTINUE

            add nextBlock to queue

    END WHILE

    RETURN result
ocean escarp
#

yeah maybe I'm not cut out for this
I was just going to use a set to avoid duplicates and not have to worry about tracking processed blocks but apparently in Js
A โ‰  A

#

[1, 35, 3] โ‰  [1, 35, 3]

snow pewter
#

hi

#

i have question

#

i am new developer of minecraft scripting

#

is typescript optional

ocean escarp
#

Both JavaScript and typescript work but Ts is considered the better of the 2

distant tulip
ocean escarp
#

I'm probably going to end up using encoded strings if that's the case

#

"x100y-40z3012"

distant tulip
#

What are you trying to compare arrays for

ocean escarp
#

But 2 arrays aren't the same so I may have to add strings instead

distant tulip
#

Use set?

ocean escarp
#

location.add([1, 2, 3])
location.add([1, 2, 3])

#

This would still get added twice

#

Because the arrays are from different references

distant tulip
#
const dupNumbers = [1, 2, 2, 3, 4, 4, 5];
const numbers = [...new Set(dupNumbers)];

console.log(numbers); 
// [1, 2, 3, 4, 5]
#

Just keep in mind this may not work in all types, so you may need to stringify

ocean escarp
#

It makes sense to decode when it's needed

worldly pier
#

Hai

woven loom
#

hi

random flint
#

hello

worldly pier
#

Like a node that may have a parent and some children

ocean escarp
#

No because I already tried racking my brain with classes and constructors and vars in functions. It didn't go well

#

I'm too simple

worldly pier
#

Oka. But if done right it can simplify code a lot

ocean escarp
#

If I'm struggling to make a basic offset system asking me to use nodes is like telling a preschooler to learn calculus

worldly pier
ocean escarp
#

I think I'll just keep brute forcing my current method

#

A simple option for a simple guy

worldly pier
#

Oka. Jmm... That could get messy very easily. Well, good luck

ocean escarp
#

I'm not trying to learn advanced programming for a simple task like a veinminer I could probably just download elsewhere for less features but actual functionality

worldly pier
ocean escarp
#

Well at least my encoding works

worldly pier
worldly pier
ocean escarp
#

And classes are complex

#

At least to me

worldly pier
#

Classes are objects with ribbons

ocean escarp
#

Indeed

#

And that's too much for me

#

I can barely write a hello world program

#

It's a miracle I've gotten this far

worldly pier
#

Ha. You'll learn.

ocean escarp
#

The most messy code you'll ever read

worldly pier
#

Did you know very block has a built in method to get its adjacent blocks

#

Don't need to use other system

ocean escarp
#

Yes but I'm not running block.east for every direction

#

Or whatever it is

worldly pier
#

Why not?

ocean escarp
#

It gets more confusing than direction offsets somehow

worldly pier
#

Well you can make an array with all the blocks surrounding the selected one and iterate over them

random flint
#

block.offset() is less wordy personally, you can also change its xyz to your needs

ocean escarp
worldly pier
#

I said it because that could help you make things simpler

ocean escarp
#

If I can't figure it out there is 0 downsides to dropping besides the cost fallacy effect or whatever they call it

#

Maybe im just not built to script

worldly pier
#

No one is born knowing...

#

I have to go. Bye

ocean escarp
#

Yeah but 99% of developers are what they are because they're good at problem solving

#

I'm not

#

Anyways cya

worldly pier
#

Experience.

ocean escarp
#

Besides I think if I wanted to copy someone else's work I would just do that from the Internet

ocean escarp
#

Looking at a sample pack for ideas and yeahhhhhh no I'm not making that

#

I look up "simple veinminer" and apparently this is all required

woven loom
ocean escarp
#

I have some issues I need to work through right now

woven loom
#

๐Ÿ‘

remote oyster
golden holly
#
let players = world.getAllPlayers();
    let spawnLoc = {}
    players.forEach(ply => {
        freezePlayer(ply);
        world.sendMessage("player " + ply.name + " is now frozen");
        spawnLoc.x = ply.location.x;
        spawnLoc.y = ply.location.y + 10
        spawnLoc.z = ply.location.z
        storedPos.push(spawnLoc)
    });
    if (storedPos.length <= 1) {
        world.sendMessage("need two player for titan fight")
    }
    spawnTitan(storedPos);```
#

Can somone help, ths is spawning all titans at same player

remote oyster
crude ferry
#

Just shift let spawnLoc = {}; inside the loop.

#

Or change storedPos.push(spawnLoc); to storedPos.push({...spawnLoc});

#

Also unless you're using specifically the last player's location for something. spawnLoc is kinda useless.

remote oyster
#
const players = world.getAllPlayers();
const count = players.length;

if (count < 2) {
    world.sendMessage("Need two players for titan fight");
    return;
}

const storedPos = new Array(count);

for (let i = 0; i < count; i++) {
    const loc = players[i].location;

    freezePlayer(players[i]);

    storedPos[i] = [loc.x, loc.y + 10, loc.z];
}

spawnTitan(storedPos);

@golden holly

snow pewter
#

is typescript difficult??

golden holly
#

thanks

#

@remote oyster @crude ferry

#

but Why didnt my work

#

it was doing the same thing

crude ferry
#

Objects share memory reference.

snow pewter
#

i have learned javascript but i dont have any idea for typescript

remote oyster
# snow pewter ohh

TypeScript helps catch errors while you are writing code instead of only finding them when you run the game or world. This gives you real-time feedback, such as warnings for missing properties, incorrect types, or invalid function usage. As a result, development is usually faster, debugging is easier, and you can avoid many common mistakes compared to writing only JavaScript. If you try to learn TypeScript (which I recommend), make sure you compile it to JavaScript because only JavaScript is supported in-game. Using TypeScript is purely for gain in development practices.

azure sentinel
crude ferry
#

When you change the original spawnLoc, it reflects everywhere else.

golden holly
#

Hmm

#

Thanks

crude ferry
#

๐Ÿ‘

snow pewter
remote oyster
remote oyster
azure sentinel
#

JS has two categories of types: primitives and objects.

#

Primitives cannot be modified in-place without creating a new one.

snow pewter
#

but is there any difference like some thing is only created by typescript

crude ferry
#

Katie types slower than my prof.

snow pewter
#

lol

crude ferry
#

lol.

remote oyster
azure sentinel
remote oyster
crude ferry
#

Understandable.

azure sentinel
#

How is it funny?

remote oyster
azure sentinel
#

@ the "lol"s

snow pewter
remote oyster
thorn flicker
#

did your hand get chopped off or something

azure sentinel
#

I was naking sure you all knew that "lol" implies something was funny

remote oyster
#

Oh, of course. "Laughing out loud".

azure sentinel
snow pewter
#

@azure sentinel

#

@remote oyster

azure sentinel
remote oyster
azure sentinel
#

also Discord for Android is broken on latest update

snow pewter
azure sentinel
#

I can't hold phone sideways like I used to

thorn flicker
#

so landscape mode isnt working?

remote oyster
#

Which keyboard is that?

thorn flicker
#

you sure you dont have it locked

snow pewter
#

what phone is that

azure sentinel
thorn flicker
#

weird

snow pewter
#

okay i am also coming in few minutes

azure sentinel
#

I can bring up the keyboard fine in another app.

remote oyster
#

This is what it looks like for me right now.

azure sentinel
#

Is the app fully updated? Are you on Android? Did you tap the text box while holding it sideways?

remote oyster
#

On Android and the app is on the latest version

#

Might be related to the keyboard you are using.

azure sentinel
#

Shouldn't be. Worked fine before updating Discord.

remote oyster
#

Try using the default keyboard to rule it out

sharp elbow
#

And you didn't disable auto-rotate in your device settings, right?

azure sentinel
remote oyster
#

Yea it doesn't behave like that on my end. Try using the original keyboard that comes stock on your device.

sharp elbow
#

Odd. Modern software do be buggy these days

remote oyster
#

If that keyboard works fine then it's the custom keyboard you are using which is bugging out.

azure sentinel
#

This is an old keyboard app, but this isn't the latest Android version either.

remote oyster
#

Still need to rule it out by testing with the keyboard that is stock for the device.

azure sentinel
#

Keyboard or something. I hate how Google broke Android

remote oyster
#

Gonna get worse when they begin their transition to mimic Apple. Except it won't be functionally the same because Google is known to be incomplete when developing projects and then abandoning them to create another project which is essentially the same as the last one just reskinned lol.

azure sentinel
#

As a power user, I already know that.

remote oyster
#

Google Allo is a good example lol.

#

For those that remember it ๐Ÿ˜‚

azure sentinel
#

"Allo"?

remote oyster
#

Oh you don't know about Allo?

#

Go Google that disaster

#

Haha

azure sentinel
#

typo?

remote oyster
#

No it was actually called Google Allo

azure sentinel
#

Look are we going to talk about my phone which I'm not a dumb i**ot about or will we talk about the Script API here?

remote oyster
#

Did you check the stock keyboard to see if the problem persist?

azure sentinel
remote oyster
azure sentinel
remote oyster
remote oyster
#

That didn't clearly answer the question. Looks like a random statement or opinion.

azure sentinel
#

[It is the] keyboard or something. snip

remote oyster
#

.....

Custom Keyboard
broken on Discord

Stock Keyboard
broken or not broken (yes or no)

azure sentinel
#

How dumb at tech do you think I am?
Also, how old you think I am?

remote oyster
#

I'm literally asking a yes or no question regarding your stock keyboard and you keep dancing around it.... I already know your custom keyboard don't work on discord because you showed a recorded video of it but you have yet to give a clear and precise yes or no answer regarding your stock keyboard.

sullen ocean
#

I would have moved to this account sooner if not you all making me stay typing on that phone.

#

I answered. You didn't listen even after I pointed it out. Blocked.

remote oyster
sullen ocean
#

Not even going to look at the messages. I'm not fond of people pestering me non-stop.

snow pewter
#

i am back

remote oyster
sullen ocean
#

Hello Crazy... Note that I am the same person as @azure sentinel (verify by looking at the bio of this account I'm typing from and that account I am pinging here).

#

... also note I'm going to be missing out on some messages due to being pestered nonstop as if they are intentionally trying to rile me up.

remote oyster
sullen ocean
#

^ that one... whoever it is.

#

I only blocked because of them being extremely persistent as if I'm dumber than a Beta fish.

snow pewter
#

can you tell me do's and dont's while learning or while making an script behavior pack. i mean give me some advises. it will help me a lot

sullen ocean
#

I am only used to JavaScript, not TypeScript.

remote oyster
snow pewter
sullen ocean
#

Some of it could apply to TS, but do note that to set up TypeScript for use with Bedrock requires extra stuff... and most recommended is a Windows 10 / 11 (or Linux if you have it set up right) computer

#

TypeScript is a transpiled language, meaning it must be converted to another language to be used. It also heavily focuses on stuff being already "defined".

#

As in if something just came out and there is no defnintion for it, the TypeScript transpiler would complain.

snow pewter
sullen ocean
#

JavaScript however is quite... prone to making errors with.
Though I should mention this immediately: Avoid LLMs for any sort of coding project whenever possible

#

To make a "cool server", you'd need a modified server software.

remote oyster
snow pewter
sullen ocean
#

Though I'd first recommend starting out making something basic.
It is pretty much a bad idea to dive into the deep end of a swimming pool without knowing how to swim, as they say.

sullen ocean
#

@remote oyster ... Please try to be understanding next time. I'm not so good with what seems like people pestering me. I'll unblock you for now.

snow pewter
#

then i listened about levilamina and endstone

#

they are best for vanila minecraft

#

but the problem with endstone is there is not huge library

sullen ocean
#

Starting small and learning about how Add-ons themselves work should be relatively helpful.
For an example, you'd still need Add-ons for some functionality like certain types of custom GUIs to work.

snow pewter
#

and levilamina does update to latest bds after very much time

remote oyster
# sullen ocean <@825930528586727445> ... Please try to be understanding next time. I'm not so g...

Yeah, no, Iโ€™m not playing into that victim game. I was polite and calm the entire time. I was simply trying to assist and help by stating it would be wise to test the stock keyboard to rule it out, to determine whether Discord was actually the problem or if it was isolated to the custom keyboard. You then turned it upside down by insinuating that I was questioning your age and intelligence. Neither of which I did.

sullen ocean
remote oyster
#

Read my bio real quick.

sullen ocean
#

I can probably guess what that is without Googling it. Apologizes for getting agitated so easily.

remote oyster
#

I'm not interested in games. I'm just here to help when I can. The drama is meaningless to me. Simply don't have time for it.

azure sentinel
#

Breakfast so stepping away from the laptop (anf its account) to go eat.

remote oyster
#

Same myself. Getting the shakes.

shy leaf
#

you good?

remote oyster
snow pewter
azure sentinel
#

PTSD here

snow pewter
#

bro enjoy life as much as you can

azure sentinel
#

On top of high-functioning autismโ€ฆ not the most fun of combinations

snow pewter
#

do you know about levilamina and endstone

crude ferry
#

:(
D:

shy leaf
#

ive heard about endstone

#

but dont know about it much

#

nor levilamina

remote oyster
# snow pewter feeling bad for you

It's alright. No need to. We all have a clock looking down on us until this life expires. Some are just sooner than others. Tomorrow isn't promised. So live life each day as if it were your last because it could very well be your last ๐Ÿ‘Œ

crude ferry
#

:)

snow pewter
#

๐Ÿ™‚

shy leaf
#

but uhhhh yeah idk if we (or at least i) can help with stuff like BDS that much, maybe in #1478215043601399818

crude ferry
#

My man is more enthusiastic than people who are healthy. Gotta learn from it actually.

remote oyster
crude ferry
#

I'm sorry.

remote oyster
#

Life works that way. Just have to learn to be content with the cards that are dealt.

snow pewter
shy leaf
#

10 players doesnt sound bad

#

i often ran dedicated servers in other games and ive only got a full 32 players in the server for only once

#

it never happened again

azure sentinel
#

When one knows their life is about to end, one of a few outcomes can happen normally:

  • Feel down (causes body to weaken)
  • Stay positive (allows the body to keep working better)
#

When feeling down, your immune system cannot properly function at full capacity.

crude ferry
#

Shit dude feeling like a bad person for complaining so much now.

#

Aww man :(

azure sentinel
remote oyster
azure sentinel
#

It's probably another reason why young ones get those candy after a blood draw or immunity shot at the doctor.

#

Keeps them not only distracted but also happy.

snow pewter
#

i am just a beginner @shy leaf

shy leaf
#

my advice? note down everything that comes in your mind

#

like a sort of brainstorming

#

you first start with ideas

azure sentinel
snow pewter
snow pewter
remote oyster
snow pewter
#

i today only tried latest new dimension using latest beta api it was void world only but creating that was fun (and yes i took help of llm)

remote oyster
azure sentinel
#

Honestly, there was something called Minetest (now it is called Luanti) that not only had a lot more buildable space before JE expanded (still out-does both Minecraft versions vertically), it also had built-in mod support (like Bedrock's auto-download) and supported more platforms natively before Bedrock did

snow pewter
sullen ocean
#

The only downside for Luanti is if you try to compare it to Minecraft... you'll end up disappointed.

shy leaf
#

so yeah youll get there

sullen ocean
sullen ocean
snow pewter
#

btw where do you live i mean in which country

shy leaf
#

hello from south korea

sullen ocean
#

This applies to various forms of creativity, from writing novels, to drawing, to ideas for games, etc. etc.

  • Keep notebooks around as well as a pencil or something to write with.
  • Write down any idea ASAP -- Don't trust your memory to remember it.
  • Even if an idea is dumb, still write it down. This is an important one!
  • With physical notebooks, even if lined, you can sketch out ideas as well (doing simple sketches works).
  • Never, I repeat, NEVER destroy any ideas nor throw away any pages, just because you think they are not "good enough".
  • Whenever you want inspiration, go look though your collections. Even the dumbest of ideas of your past can spark one amazingly creative idea in the future.
snow pewter
sullen ocean
#

USA for me.
Airport code PDX or Portland International Airport always has the same time that I do (meaning I could live extremely close by, or anywhere else within the state that shares the time zone of it)

snow pewter
shy leaf
#

was about to sleep

sullen ocean
#

By the way, this still exists in Windows 11 somehow

snow pewter
#

ohh

sullen ocean
#

whoops... forgot to blur or what-not the name

snow pewter
#

you are in 29 may 2026 i am still in 28

sullen ocean
shy leaf
#

how did our mutual friend even happen

#

or did i mention this already

sullen ocean
#

I have no idea... my memory is sub-par

shy leaf
sullen ocean
#

I wish I was joking... PTSD is a real [BOINK!] of a problem

sullen ocean
# sullen ocean

As shown form this screenshot I took a moment ago (IRL time)? Yes.

snow pewter
#

hmm

#

i always found this funny becuse all of us are on same planet but facing different times

sullen ocean
#

Looks like Luanti got an update recently.

snow pewter
#

this is my time !!!

sullen ocean
#

Stupid question... is this cursed in anyone's eyes

snow pewter
#

wth

sullen ocean
#

(Note: the tab isn't built into stock Windows)

snow pewter
#

ohh

#

so you are running windows in a tab??

crude ferry
#

Katie ain't using the right channels!

sullen ocean
#

Going to move over to #off-topic

crude ferry
last latch
crude ferry
#

lol.

snow pewter
#

Should I install npm of latest server and server ui module or should I just use extension in vscode

warm mason
snow pewter
#

Okay tysm

gaunt salmonBOT
lethal lichen
#

has anyone benchmarked the cost of calling BlockVolume.translate()? is it simple property updating internally or is it doing more expensive calculations?

crude ferry
#

If you are proefficient with JS. You don't have to "learn" TS.

#

Just do 3-4 projects and search when you are stuck.

#

Fun fact: Once you learn JS or any language. You don't have to "learn" any other language (maybe a little with low level languages tho.)

#

The thinking process transferrs.

random flint
crude ferry
#

Just because JS is dynamically typed doesn't mean it don't require knowledge of data types lol.

#

It just removes explicit declarations, not the concept itself.

slow walrus
crude ferry
#

Well that's how it was for me learning Python, C and Java ๐Ÿคทโ€โ™‚๏ธ

#

Though I can see that happening, yeah.

snow pewter
tardy pivot
#

is there a way to detect whenever a player crafts an item?

crude ferry
#

But obviously this method has many quirks that you cannot really do anything about.

buoyant canopy
#

you might wanna learn java if you want to dig through libraries that you're using or browse the source code from java mods or other programs, but you should never write code in java if you are just entering

#

I think the only reason to write anything in java is if you already know it, otherwise don't

tardy pivot
sage portal
#

Still a javascript amateur: If something in an runInterval has a lot of math to go through and there's no need for it to happen in order, is that the time to use an asynchronous function for optimization?
Or is this moreso case by case?

crude ferry
#

An asynchronous function executes synchronously until it hits the first await.

woven loom
#

should use job instead

crude ferry
#

Yes.

#

Make it a generator function and do system.runJob() instead.

sage portal
#

I'll look into what generator functions are, thanks

golden holly
#

I'm also doing soemthing same

sage portal
# golden holly Curious what your heavy Calc is

doing shockwave calculations.
It's simple on its own, but when there are numerous entities to check for, it starts slowing the whole thing down.

Realistically I'm only doing this for a minecraft map, so it's nothing I'm pressed about since I'm not really going to worry about high entity count for conventional gameplay, but I'd like to find any opportunity to optimize whenever I can.

stray spoke
#

there's an api like applyKnockback that acys like a shockwave by positioning where it starts "exploding" knockback

#

while applyImpulse is responsive to entity's position, or I'm wrong

worldly pier
#

Would anyone be interested in a Python util for mobile?
The script just zips and add-on and does some stuff to it.
Basically it takes an add-on path, it increases the version in the manifest. if specified, it runs the command "tsc" for typescript functionality. And then it zips the add-on, and opens a menu to open the mcpack with minectaft. Obviously it doesn't has typescript in it, nor the zip library, you would need to install those by hand

crude ferry
#

I'm not entirely sure what you need this for ๐Ÿ˜‚

#

Why so specific.

worldly pier
#

When you're on mobile and want to make an addon, there's no way of debugging it without importing it to minectaft. Everytime you want to do that, you need to change the version of the addon, compress it, and change the extension to "mcpack". Also If youre using TypeScript, you need to do the extra step to compile it to js.
So, for efficiency purposes, I did a Python script that does all of that automatically. Thats it.

#

It may not seem like much: "its just changing the versions number, compressing and changing the extension" but when you need to do this a lot of times, it gets boring.

crude glacier
#

How to add lore to items

#

But in inventory

#

Creative inventory as example

cinder shadow
#

Did anything change recently with dimension.findClosestBiome? I'm suddenly getting errors with this line but as far as I'm seeing it's unchanged ```js
const biome = dimension.findClosestBiome(location, currentBiome.id, {boundingSize: {x: 64, y: 64, z: 64}});

crude glacier
#

What the error

cinder shadow
crude glacier
#

๐Ÿซช

#

Lemme check

cinder shadow
#

mmm, this part of my add-on have actually been broken for a very long time

#

I recall I had to use findClosestBiome and BiomeTypes.getall() in the past, but now I can just use dimension.getBiome();

crude glacier
#

Can you provide something useful

#

Like a getBiome function itself

#

And what did you pass as arguments for it

cinder shadow
#

yeah, I don't think dimension.getBiome existed then

#

but it also had some other issues that I need to check

#

Lush Caves and the biome on the surface were completely flipped

crude glacier
#

Oh

#

Why don't you use claude AI to update your codes

cinder shadow
#

I didn't even know it was something that was broken and I have no reason to use claudeAI to just delete a section of code and change 1 line lol

#

I use codex

crude glacier
#

Oh ok then good

#

Wait , since when you are developing runecraft !

cinder shadow
#

? I am the only developer of RuneCraft

crude glacier
#

๐Ÿซช

#

No i mean since when

#

I remember that UI is very familiar

#

I remembered that i've seen an image of it since 2023

cinder shadow
#

2021

crude glacier
#

Damn ๐Ÿซช๐Ÿ™

#

You are developing runecraft since 2021

proud saddle
#

is there a better way to rotate canera around block without using camera:free with animations?
i tried to use it but now matter how many keyframes i add it does'nt move rights in the first and the last keyframe

proud saddle
late ore
wary edge
#

You're using an old scripting version.

late ore
#

ok

#

i'm not expert in the scripting topic. i think that a Dev Team could be good because i'm doing Slendytubbies Blockwar all by myself

woven loom
#

We are at 2.7.0 now

shy leaf
shy leaf
crude ferry
#

I thought you're asking how to make one.

#

You might wanna put it in #1072983602821861426 then.

worldly pier
crude ferry
#

Pretty sure there are a lot of Mobile devs here so yeah you can.

chrome flint
#

do custom commands run on .runCommand()?

crude ferry
#

Yes.

shy leaf
#

you need to be more specific with "creative inventory"

crude glacier
#

I mean just lores

#

Without putting the lore in item's name using \n

shy leaf
crude glacier
#

Yeah but. I want it to be there in creative's is inventory

shy leaf
#

creative inventory is not really different though?

crude glacier
#

No i mean in the Equipment slot , construction slot

#

Etc...

#

I mean let s say the player searches for that item in the creative search section

#

And he hovers over it

shy leaf
#

nope, not possible

crude glacier
#

Sad : (

#

So only when the item is in the player's hotbar it is possible?

shy leaf
#

only when the item exists in world

crude glacier
warped kelp
#

Is there a way to detect both backward movement and crouching? I wanna try adding a parry system where a player must "pull back" (move backward) and sneak at the same time

shy leaf
# warped kelp Is there a way to detect both backward movement and crouching? I wanna try addin...
deep arrow
#

Im assuming their still isnt a good way to make a custom fishing rod

olive sphinx
#

Not to my knowledge

crude glacier
#

I just figured out something

sleek nexus
#

What's that?

lyric kestrel
#

What's that?

warm mason
stray spoke
#

And legends say he still never told what's something

crude ferry
#

๐Ÿ˜‚

olive sphinx
crude ferry
#

What is that sticker omg.

olive sphinx
#

Someone named Hana taking notes

thorn flicker
#

jumpscare

full island
#

been looking for a minute and cant find an answer to this, is it possible to use scripts to give above vanilla enchants? Like sharpness x efficiency 20 etc
Only way I know how to do it rn is nbt editing players or villager trades which I'd rather not do for a BDS world

full island
#

damn that sucks, thanks

worldly heath
#

is it possible to get data of a holding item ?

#

for detecting a specific potion

shut citrus
#

anyone got bug with includePassableBlocks: false, includeLiquidBlocks: true?

#

I can't detect liquidBlocks when includePassableBlocks is false

halcyon phoenix
#

is there any ways to detect player movement such as wasd without the player moving?

distant tulip
#

And disable player control

#

The movement vector get updated regardless

halcyon phoenix
#

oh that's inputButton

distant tulip
#

Not the event

halcyon phoenix
#

Alright ima try it, thanks for the info Minato

distant tulip
#

Player.inputInfo.something

#

Np

crude ferry
#

Liquid are passable blocks.

shut citrus
#

that liquid not block๐Ÿฅฒ

wary edge
crude ferry
#

Lol I misspelled intentional.

shut citrus
crude ferry
#

You'd have to ask a Moyang staff to get an answer.

#

(๐Ÿ˜‚)

wary edge
shy cape
#

What should i use to cancel a player breaking/mining a block whether it is survival or creative

shy cape
#

Thanks !

amber nest
#

how do i modify my script in game

#

whats the path to the behavior packs of my world

#

if any1 knows

honest spear
amber nest
#

pc*

worldly pier
shut citrus
subtle cove
valid ice
#

No

crude ferry
# shut citrus how can i filter that
const raycastOptions = {
    includePassableBlocks: true,
    includeLiquidBlocks: true,
    excludeTypes: ["minecraft:tallgrass", "minecraft:yellow_flower", "minecraft:red_flower", "minecraft:vine"],
};```
#

These 4 are just examples. I am not sure about the entire list of passable blocks.

subtle cove
shy leaf
#

why does EntityQueryOptions has minDistance, but not EntityRaycastOptions

#

๐Ÿ˜ญ

worldly pier
#

Why would you need something like that?

shy leaf
#

well at least thats my use case

sharp elbow
#

Hm. If you wanted to go the extra mile, you could do the ray/box intersection yourself. The slab method is pretty easy to implement and you can use it to get precise distances

#

What's cool is you could run this in parallel on a selection of mobs and have precise intersection results for each of them. You can that to know, in which order, a given line of mobs would be hit in

shy leaf
#

ooo

snow pewter
#

@shy leaf

#

hi

crude ferry
snow pewter
#

hmmmm

#

all syntax are same in both??

crude ferry
#

No.

snow pewter
#

ohh

hardy tusk
#

If you cancel the damage then apply it again it would cause an infinite loop

shy leaf
#

yeah it did

hardy tusk
#

You need to set some sort of variable to stop it on the 2nd turn

prisma shard
crude ferry
#

I already know TS so I cannot "unsee" it, maybe that's why lol.

#

I try to imagine what it'd be like to read TS for someone who only knows JS and it seems perfectly readable lol.

shy leaf
#

TYPESCRIPT CAN KISS MY ASS

#

HOW CAN NUMBER EVEN BE THERE???

#

ok finally fixed it, i forgot to account for nulls on dividers and labels
and the compiler was panicking cuz a type was a union ๐Ÿ˜ญ

lyric kestrel
#

Ever since I've done only TypeScript for my main project, I have not gotten really any scripting related errors in-game

crude ferry
#

๐Ÿ™

worldly pier
#

typescript my beloved, saved me of having to always debug ingame for systax errors ๐Ÿ™

lyric kestrel
amber nest
#

is there a before event for entity die

crude ferry
#

That's the closest. This isn't exactly "beforeDie."

snow knoll
snow jungle
#

When getting a block location, if a block is a chest, is possible to see if its a connected double chest vs a individual single chest?

amber nest
nova tartan
wary edge
nova tartan
#

Sim right..

wary edge
#

What you can do is use entityHurtBefore event to check if the damage is fatal

snow jungle
crude ferry
#

If it has 27 it's a single chest.

snow jungle
crude ferry
#

Or at least not to my knowledge.

#

You can bruteforce it of course by getting each block around it and checking it's permutation.

snow jungle
#

Thank you

versed echo
#

Does anyone want a project developed by an experienced FiveM and Minecraft developer?

shy leaf
#

why does my typescript yeet off enums that i wrote ๐Ÿ’€

amber rapids
#

??

shy leaf
#

i have no idea either

#

๐Ÿ˜ญ

#

everytime i compile, it just removes whatever new stuff i wrote

amber rapids
#

I don't understand what you're trying to describe.

shy leaf
#

no logs about it either

amber rapids
#

How did you compile it? VSCode can't compile it. Did you use tsc?

shy leaf
#

im using regolith

#

oh hey look, type_gen filter is the one removing my enums

#
[INFO]  Running filter type_gen
[INFO]  [type_gen] Enum written to packs\data\gametests\src\Files.ts
#

...but HOW IS THAT EVEN RELEVANT

crude ferry
#

Someones been struggling with TS for the past day perhaps.

shy leaf
#

im on the brink of breaking a table

crude ferry
#

You need fresh eyes.

amber rapids
#

Iโ€™ll take a look at Bedrock-OSS/regolith; I havenโ€™t used it before.

amber rapids
#

It looks like Bedrock-OSS/regolith is an add-on packaging tool.

shy leaf
#

yeah it is

amber rapids
#

I took a quick look at the Bedrock-OSS/regolith documentation, and it has a lot of features. But the config.json file seems pretty complicated.

#

I've recently been working on https://github.com/mcbe-mods/create, which offers similar functionality. If you're interested, feel free to check it out (it hasn't been published on npm yet).

shy leaf
#

bet

last latch
#

Maybe regolith removes stuff you do not use

round bone
shy leaf
#

i was told that the file was autogenerated skull_issue_c

#

which was why it kept overwriting

shy leaf
crude ferry
#

Funny thing but I wonder why is location a property and getHeadLocation a method on Entity class lol?

shy leaf
#

since head location varies on entities

crude ferry
#

Ahh yeah.

#

Could have made it a getter.

worldly heath
#

whats the best way to count specific blocks in a certain volume?

#

any better way than looping through 3 axis?

wary edge
worldly heath
nova tartan
#
DARKOAK_STANDING_SIGN = 'minecraft:darkoak_standing_sign',
DARKOAK_WALL_SIGN = 'minecraft:darkoak_wall_sign',```
It's always nice when you're going through block ids in Minecraft to find out this is how they do the standing and wall signs for dark oak.
#

Everything else is labeled minecraft:dark_oak_ which is correct but for some reason they made these two darkoak instead.

#

W Mojang.. ๐Ÿ˜ญ

nova tartan
#

Also take END_STONE_BRICK_DOUBLE_SLAB = 'minecraft:end_stone_brick_double_slab' for example.. everything so far has always been BLOCK_TYPE + _DOUBLE_SLAB but for exposed cut copper double slab it's: exposed_double_cut_copper_slab like why bruh ๐Ÿ’€

olive sphinx
#

๐Ÿ’€

thorn ocean
#

Does anyone have a stable version of Block.isSolid, since it is still in beta?

nova tartan
#

I guess this is what happens when you go looking into minecraft properly

olive sphinx
nova tartan
#

No

#

That's not normal ๐Ÿ˜ญ

#

Can we rename redstone_torch to stick_and_redstone_torch then?

#

And every other item..

last latch
#

not really

#

golden rail is a rail but made with gold

nova tartan
#

a redstone torch is a torch made with a stick though ๐Ÿคทโ€โ™‚๏ธ

#

so... lol

open urchin
#

it's still a lot better than reeds

nova tartan
#

yh lmao

last latch
nova tartan
#

who knows

last latch
#

its the same logic tho

nova tartan
#

Still can't change my mind about these though.. cause this is just silly: ts DARKOAK_STANDING_SIGN = 'minecraft:darkoak_standing_sign', DARKOAK_WALL_SIGN = 'minecraft:darkoak_wall_sign',

open urchin
#

I think that identifier was added before dark oak had an identifier anywhere else and they chose to go without the space
If they chose to match the texture names it would be big_oak which is even worse

thorn ocean
olive sphinx
restive gate
#

hello,
Any optimized recommendations for limiting custom entities by zone or player? It would involve using world.afterEvents.entitySpawn.subscribe

sharp elbow
worldly pier
crude glacier
#

Is it possible to make an entity search for the nearest horse and raid it ?

harsh dawn
hazy nebula
worldly pier
#

๐Ÿง 

shy leaf
#

how does sulfur cube interact with applyDamage and applyKnockback?
edit: as expected

crude ferry
#

Ain't no method to get an array of all occurence of an itemStack in a container?

#

Would have to loop through each slot perhaps.

shy leaf
crude ferry
#

Nah I got it, it's fine.

shell sigil
#

Does anyone know how to get banner patterns and color

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

const spawnCheck = new Map();

world.afterEvents.playerSpawn.subscribe((event) => {
    const player = event.player;

    if (!event.initialSpawn) return;

    const id = player.id;

    spawnCheck.set(id, {
        lastPos: player.location,
        sent: false
    });

    const interval = system.runInterval(() => {
        const data = spawnCheck.get(id);

        // player left or already handled
        if (!data || data.sent) {
            system.clearRun(interval);
            spawnCheck.delete(id);
            return;
        }

        const current = player.location;

        const dx = current.x - data.lastPos.x;
        const dy = current.y - data.lastPos.y;
        const dz = current.z - data.lastPos.z;

        const moved = Math.sqrt(dx * dx + dy * dy + dz * dz);

        data.lastPos = current;

        if (moved > 0.05) {
            player.sendMessage(`Hello ${player.name} in this Hello World tunudrunm lol`);
            data.sent = true;

            spawnCheck.delete(id);
            system.clearRun(interval);
        }
    }, 5);
});

// Cleanup on leave
world.afterEvents.playerLeave.subscribe((event) => {
    spawnCheck.delete(event.playerId);
});
amber nest
#

is it possible to cancel the damage a hit did?

wary edge
amber nest
#

same response lol

amber nest
remote oyster
# amber nest thx

Instead of canceling you can set the damage to 0.

world.beforeEvents.entityHurt.subscribe((event) {
    event.damage = 0
});
#

Just another option based on preference.

snow knoll
remote oyster
amber nest
snow knoll
#

A shame
My version of the game is too low ๐Ÿฅฒ

amber nest
#

ill test it rq

snow knoll
amber nest
#

u just dont take damage from the hit but u still take the knockback etc

snow knoll
#

Thank you ๐Ÿ‘
I think I'll probably use that more often than event cancelling, for when i start using the beforeEvent, better suits my needs

amber nest
#

the knock back without damage its strange

snow knoll
#

Strange?

#

What's it like exactly?

amber nest
#

accept friend

#

ill show u with ss

#

or just join vc

worldly pier
#

another solution, if you want to keep the knock-back, is to give that player resistance level 250

#

that was the old method of canceling damage in maps

snow knoll
amber nest
#

i wont talk too

snow knoll
#

Sure

remote oyster
# snow knoll Does this make knockback happen still? Just a bit curious

There is still knockback after testing moments ago, but you can minimize that knockback pretty good with the following example:

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

world.beforeEvents.entityHurt.subscribe((event) => {
    event.damage = 0;
    system.run(() => {
        event.hurtEntity.clearVelocity();
    });
});

snow knoll
glad wren
#

Does getmovementvector work with movement input permission set to disabled?

cinder shadow
#

Weird.. latest preview did some very strange stuff. I have an item with a custom onUseOn component that is somehow causing a content log "read-only" error for a temp property in a completely different file. If I don't use the items on the ground, the error never fires and the code/temp property work as intended.

#

Actually. This file isn't even in a "read-only" section, it's a function ran in a system.runInterval

#
if (!player.__staminaTimeout) player.__staminaTimeout = 0;
#

That's all line 30 is, and it's not in a read-only function

#

Okay something is broken with all temporary properties

#

Commented out that entire file and tested another one using them

#

@valid ice You use properties like this too still, right? Can you see if the same thing happens to you

amber nest
warm mason
amber nest
amber nest
#

but exaggerated

warm mason
#

so, u want vanilla knockback and that's why u're not cancelling the event, but set damage to 0, but vanilla knockback is "strange" and u use clearVelocity to get no knockback at all

#

what's the point?..

amber nest
#

lol

warm mason
amber nest
#

i want the hit effect

warm mason
#

wdym hit effect?

amber nest
#

and critic

#

and i dont want to use any effect

#

so thats why

stray spoke
#

You should try and see first

remote oyster
# warm mason so, u want vanilla knockback and that's why u're not cancelling the event, but s...

Canceling the event interrupts part of the damage pipeline, which can delay hit feedback. It can also cause strange feedback if you have other scripts using the same event (I had to find this out the hard way). So what I shared above doesn't necessarily get rid of the knockback. It only minimizes the threshold so it's not overly dramatic when you hit the entity. You can see how dramatic it is if you test for yourself.

worldly pier
floral copper
#

guys what am i doing wrong here, im trynna make it so that when it rains, the player gets regeneration

const Odim = world.getDimension("overworld")
            if (Odim.getWeather() == "rain") {
                player.addEffect("regeneration", TicksPerSecond * 3, { amplifier: 0, showParticles: false })
            }
#

the error says not a function at line 23 ( the "if" line )

#

is getWeather not a function or smth ๐Ÿ˜ญ

amber nest
stray spoke
#

Oh

#
import {world,WeatherType,TicksPerSecond} from "@minecraft/server"

world.afterEvents.weatherChange.subscribe(data => {
  const {newWeather, previousWeather, dimension} = data;
  const Players = world.getPlayers()
  
  if(newWeather !== WeatherType.Rain) return;
  
  for(const player of Players){
    player.addEffect("regeneration", TicksPerSecond * 3, {showParticles: false})
  }
})
#

test

#

100,000th message

#

Yess!

round bone
stray spoke
#

-# ignore my battery

round bone
stray spoke
#

Oh alright

crude ferry
#

It was once saying "999,999" when I was on the android app.

worldly pier
stray spoke
#

Damn

#

so how many Nth is my "100,000th msg"

#

I see its almost like 90+

shy leaf
#

(idk why but holy crap its painful)

remote oyster
sharp elbow
#

You did not know something, and now you do. That does not make you dumb, that makes you learned.

stray spoke
#

yeah you're actually right

#

thanks

unkempt siren
#

Hey Guys i'm trying the new CustomForm script api but i can't get it to work, here's my code and manifest

{
      "module_name": "@minecraft/server-ui",
      "version": "2.1.0-beta"
    },
world.beforeEvents.playerBreakBlock.subscribe((e : any) => {
    system.run(() => {
        log("hi")
        const player = world.getPlayers()[0];
        
        /*const toggleValue = new ObservableBoolean(false, {clientWritable : true})
        toggleValue.subscribe((v : boolean) => {
            log(`value changed to ${v}`)
        })*/
        try {
            const form = new CustomForm(player, "test");
            form.button("test button", () => {
                log("button pressed")
                //toggleValue.setData(true)
            })
            //.toggle("test toggle", toggleValue)
            .show()
        } catch (error: any){
            log(error)
        }
    })
})

i get the error: Invalid constructor called (on the line where CustomForm is made)

i also can't create an ObservableBoolean, when i try to says something about not a function at anonymos or something

#

also i'm playing on the 1.26.21-stable

wary edge
#

Make sure you read the right docs next time.

nova tartan
#

What's causing these dataDrivenEntityTrigger events to happen in a normal world? I just made an event logger to check what events are running.

#

I don't quite get the entities healing are health change either. Do these trigger just from them spawning?

warm mason
nova tartan
#

Ah, gotcha. That'll be quite a lot then.

#

I guess it would be good to filter that event out then. I already filtered out the playerButtonInput event since that would spam from jumping and sneaking.

stray spoke
#

And custom form like this:

CustomForm.create(player, "Form Title")
wary edge
#

Which is changed in 26.30 fyi which releases in 2 weeks.

stray spoke
#

Oh

unkempt siren
#

Too bad that these forms are in OreUI, would have made some very nice uis if it were json ui

worldly heath
#

anyways to move an itemstack player mainHand to another entity's ? getcomponent(equippable) isnt working at all on anything other than player

wary edge
worldly heath
#

damn rip

stray spoke
wary edge
stray spoke
#

Ahh alright

crude ferry
#

What ๐Ÿ˜ญ

#

Why would I import react js. I don't even have any imports like that.

#

Okay this got to be some VS Code auto complete.

#

Yeah it is.

clear wadi
# worldly heath anyways to move an itemstack player mainHand to another entity's ? getcomponent(...

Use a command to id the item. ```// POLL MAIN HAND: Utility
function pollMainhand(entity) {
// FRAME ITEMS TO DETECT in TARGET ENTITY
for (const typeId in EVOLVE_MAP) {
entity.runCommand(tag @s[hasitem={item=${typeId},location=slot.weapon.mainhand}] add phantom:has_required_item);
if (entity.hasTag("phantom:has_required_item")) {
entity.removeTag("phantom:has_required_item");
const item = new ItemStack(typeId, 1);
return item ? item : { typeId: "minecraft:air", getTags: () => [] };
}
}

// check player via API 
// if the item is not caught in MAP Above, return `air` for frame entity (no `equippable` component)
const equipment = entity.getComponent("minecraft:equippable");    
if (!equipment) return { typeId: "minecraft:air", getTags: () => [] };

// continue for player only USING API
let item = equipment.getEquipment(EquipmentSlot.Mainhand);
return item ? item : { typeId: "minecraft:air", getTags: () => [] };

}and the EVOLVE_MAP looks like this in my code... const EVOLVE_MAP = {
"minecraft:mob_spawner": 1,
"minecraft:armor_stand": 2,
"minecraft:empty_map": 3
} ``` You can then use pollMainhand for BOTH entities and Players.

#

so now the item is returned and you can give it to whomever

#

its not exactly what you need but the concept is workable.

worldly heath
#

ig this is useful getting non tools and stuff

#

i added a behavior pickup it works as long as i drop the weapon near the custom entityy

clear wadi
#

Understood. Have you looked at EntityComponentTypes ? There is a different way to access equippable for entities than for players. ``` import { EntityComponentTypes, EquipmentSlot } from "@minecraft/server";

// This works flawlessly on both players AND standard mobs (like custom item frames or armor stands)
const equippable = entity.getComponent(EntityComponentTypes.Equippable);

if (equippable) {
// Directly targets what the entity is visually holding in their main hand!
const heldItem = equippable.getEquipment(EquipmentSlot.Mainhand);
}

crude ferry
#

Java Edition has a seperate air block called minecraft:cave_air as its turning out.

#

Istg I got so happy and then I realised it's Java Exclusive.

#

I am trying to detect caves.

#

It seems impossible to do precisely.

#

Okay locating a lush cave can do something.

worldly heath
crude ferry
#

Trial chamber, Ancient City, and Deep Dark too perhaps.

worldly heath
floral copper
floral copper
clear wadi
#

Yeah sort of. But entities do not have "minecraft:equippable" they have "EntityComponentType.equippable" worth a shot unless you have exhausted that already.

worldly heath
crude ferry
#

Not that bad but I will try to create some algorithm to detect caves before using that solution.

amber nest
crude ferry
#

Yes.

amber nest
#

than u can use that to detect caves

crude ferry
#

Sure but it can choke on small notches that generate quite frequently.

#

I think I will check for air underground and then take a block volume around it and check how much Air% it is.

amber nest
#

yh thats smart

clear wadi
#

@crude ferry I'm sorry to jump in... cave detection is an interesting issue. If you are writing custom script behaviors, are you looking to track a player's environmental depth (like checking ambient lighting and sky-exposure), or are you trying to hook into custom underground biomes like Dripstone or Lush Caves? I guess what I'm saying is it sounds like you are detecting specific procedural cave gen. No? Can you not just scan for those unique and specific blocks underground? Like dripstone copper bulbs or glow berries? Or is this some kind of teleport situation?

#

I agree with you though, cave air would be easier if we had it.

crude ferry
clear wadi
#

@crude ferry I see the issue... That's much trickier than it would appear isn't it? Water, lava, collision, cavities that may register as caves if the systemic checks you have are too small. Are you planning on clearing out blocks in the area that is chosen? Maybe an air structure could work in such a case. Basically get close enough, then drop a mostly air structure in the spot you selected. Structures can be set broken too so it isn't some strange cube shape. But that takes some of the challenge out of the clean discovery, doesn't it.

crude ferry
#

"Are you planning on clearing out blocks in the area that is chosen?" Why would I do that lol? I don't see the point in that one.

clear wadi
#

You said you are moving a player to the nearest cave. It can be any shape. Well... I can grab a cave in a structure. Multiple caves even. Then fake carve my own in real time before moving the player. That's all.

crude ferry
#

Oh.

clear wadi
#

This way the player is never moved say right above water or lava

crude ferry
#

That's genius ๐Ÿ˜ญ

clear wadi
#

Thanks!

crude ferry
#

Like it didn't achieve the real task of detecting caves but faking one of my own actually fits what I am trying to do lol.

clear wadi
#

And takes away the chance of accidently getting a player in an unwinnable situation. You are in total control. Later

crude ferry
#

Yeah.

#

Is there no way to locate structure without commands ๐Ÿ˜ญ

clear wadi
#

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

/**

  • Places a pre-saved structure at a given location.

  • @param {string} structureName - The name of your .mcstructure file (e.g., "mystructure" or "mystruct:house")

  • @param {number} x - X coordinate

  • @param {number} y - Y coordinate

  • @param {number} z - Z coordinate
    */
    function placeStructure(structureName, x, y, z) {
    // Wrap inside system.run to safely modify the world context
    system.run(() => {
    const overworld = world.getDimension("overworld");

     // Formulate the Bedrock /structure command string
     const command = `structure load "${structureName}" ${x} ${y} ${z}`;
     
     // Execute the command asynchronously
     overworld.runCommandAsync(command)
         .then((result) => {
             console.warn(`Successfully placed ${structureName} at ${x}, ${y}, ${z}`);
         })
         .catch((error) => {
             console.error(`Failed to place structure: ${error}`);
         });
    

    });
    }

// Example usage: Spawns a saved structure at coordinates 0, 64, 0
placeStructure("mystructure", 0, 64, 0);

#

Those should point you in a good direction. ๐Ÿ‘

crude ferry
#

That wouldn't quite work for vanilla structures.

wary edge
clear wadi
#

Oh sorry smokey.

shut citrus
#

any limit in world.setdynamicproperty?

woven loom
#

32k bytes

amber nest
#

is it possible to cancel the message when someone leaves/join

last latch
#

Where do we get that information from?

stray spoke
crude ferry
#

You sent this like the 4th time today lmao.

stray spoke
#

Yeah, just wanna annoy yall

stray spoke
#

hope they add typescript support in scripting

halcyon phoenix
#

do we have improved method to make block display entities?

#

or is it still the good ol fox method?

dapper copper
stray spoke
dapper copper
#

you just need a compiler

stray spoke
#

then we still can't really run typescript in Minecraft, you still need to transpile it

#

But I'm curious about what you mean

stray spoke
dapper copper
#

its really convient if you want proper types and not just guessing when you have objects or interfaces

wintry sigil
#

Can someone explain why my messages arenโ€™t appearing in game?

#

Wait wrong channel

dapper copper
stray spoke
dapper copper
#

just reload

#

it works the same way

stray spoke
#

It's not strict as ts tho, but yeah that works

sharp elbow
#

It is possible to both work within TypeScript and to have hot /reload work.

#

If a behavior pack is located in either the development_behavior_packs folder or in a world file directly, then you can use /reload to quickly access changes.

#

Packs located in the regular behavior_packs folder (such as when importing a .mcpack or .mcaddon file) will get copied to a world when applied, and that would explain the need to reinstall them

last latch
#

sapi uses quickjs

#

quickjs runs on js unlike bun

stray spoke
#

yeah

half ivy
#

How could I make a particle circle

worldly pier
worldly pier
# half ivy How could I make a particle circle

this draws an expanding circle, here you have:

function* drawCircle(radius:number,center:Vector3,dim:Dimension){
  for (let delta = 0; delta < 2*Math.PI; delta +=1/(2*radius)){
    let cx = center.x+radius*Math.sin(delta)
    let cz = center.z+radius*Math.cos(delta)
    
    let pos = {
      x:cx,
      y:center.y,
      z:cz
    }
    let particleConfig= new MolangVariableMap()
    dim.spawnParticle("minecraft:soul_particle", pos, particleConfig)
    yield
  }
}
half ivy
#

Thank you

stray spoke
#

didn't know MolangVariableMap exist, or is it custom one .

wary edge
#

๐Ÿ˜‰ read the docs

stray spoke
#

I thought it was from JavaScript itself

woven loom
#

why u keep sending this image

stray spoke
#

mb, I'm relieving stress and had too much dopamine that I randomly do this, or idk .

#

I keep laughing at this alone

distant tulip
#

just blocked the guy

stray spoke
#

oh

#

Mb

wary edge
wary edge
#

Truth nuke.

nova tartan
#

Is it going to be preview or stable next? ๐Ÿค” ๐Ÿ‘€

#

I NEED MORE SCRIPT API EVENTS AND FEATURES!!!

last latch
#

Because I cant find anything related to the 26.30 release

wary edge