#Script API General

1 messages · Page 10 of 1

shy leaf
#

man i should look at javascript tutorial again

halcyon phoenix
#

why player["cooldown"]? what's that?

subtle cove
#

Meh, i actually just test whatever i see possible

#

It's like if undefined, assign 0

#

There's a calling for it, cant remember

shy leaf
#

it removes when you leave the world

subtle cove
#
entity[entity.isValid() && "kill"]?.()
halcyon phoenix
shy leaf
subtle cove
#

Player/Entity object is a permanent object script-running wise

shy leaf
#

or whatever value you want to use
and then you use it anywhere

#

wait i was replying on wrong message

subtle cove
#

In runInterval, events as long as it's in same script pack
The "new" property that's attached to the object remains

#

Topic's prob object assignments

halcyon phoenix
#

oh cool huh

burnt remnant
#

real quick whats the code for damaging a tool/weapon

shy leaf
#

.damage

burnt remnant
shy leaf
#

.damage += 1

#

its like setting a value

honest spear
#

Yes, but don't forget to update that item in that slot as well

burnt remnant
#

thank you i have solved it

amber granite
#

Why ??=

#

The = for what

subtle cove
amber granite
#

Yeah , but why did u use ?

#

Isn't only should be ??

cold grove
#

So the next time you "ask" for "cooldown" property it will be 0 instead of undefined

distant tulip
#

const test = {}
test.name??=5

if test doesn't have a "name " property create it and assign 5 to it

amber granite
#

Oh , hmmm

subtle cove
#

&&=
||=
??=

amber granite
#

I know but , will u assign getDP ?

cold grove
amber granite
#

I mean u could just use ??

#

Instead of ??=

#

That s usless in this situation

remote oyster
amber granite
#

My common sense tells me ??= Shouldn't be used on getDynamicProprety

remote oyster
distant tulip
amber granite
#

Oh my bad

#

I thought he used getDynamicProprety XD ☠️ im blind

remote oyster
#

Haha

modest oasis
#

how can I get player scoreboard?

cold grove
#

Or a single score value

amber granite
#

Scoreboards are objectives shared between players

modest oasis
#

I did use titleraw to display it but I dont know other way so im asking

#

like displaying it to a form

inland merlin
#

does anyone have custom loot table that calculates the looting enchantment, and drops in an entity is killed?

i want more control but want to see if anyone has one first

#

in js

#

im hoping for a premade class

#

if not ill have to make it lol

wary edge
inland merlin
grave thistle
#

I'm trying to use the itemUseOn event using a custom item but nothing is happening when I try to use the item. Is there something I need to do to the item so it can be used on blocks?

wary edge
grave thistle
#

Don't think so. Is that all that's missing? Also, what would be the best values for an instant use item?

grave thistle
#

For both of the parameters (movement_modifier and use_duration)?

cold grove
grave thistle
# wary edge 0.1

I've added use_modifiers and use_animation components to my item but it's still not working

subtle cove
upbeat tendon
#

is there a way to check if a player/entity has an item in its inventory via scripting?

upbeat tendon
#

does that always exist even if not defined in the json?

steady canopy
#

only the ones that have any kind of inventory

upbeat tendon
#

oh so it should always be there for players

#

awesome, thank you!

grave thistle
#

How do I stop this error from appearing:

[Scripting][error]-LocationOutOfWorldBoundariesError: Trying to access location (-2.0, -65.0, 1.0) which is outside of the world boundaries. at checkBlocks (treasure_detector.js:63)
at <anonymous> (treasure_detector.js:86)

shy leaf
amber granite
#

Add tickarea then delete it

#

Or use tp command

#

Or summon command

#

They both will work in this situation

#

It depends on what u are trying to do

subtle cove
#

Show code if u may

grave thistle
amber granite
#

@grave thistle

#

Wait

grave thistle
#

I'll try that now, thanks

amber granite
#

Wait

#

Not yet

#

I need to add thing

#
if (block.below(i -1).location.y === 64 ) break theloop ;
                    nextBlock = block.below(i);
grave thistle
#

Couldn't i break the for loop if it detects the final bedrock layer

amber granite
#
theloop : for (let i = 1; i <= searchDistance; i++) {
#

@grave thistle

#

Now u see ur loop of check block

#

Add
theloop :

#

For it

amber granite
#

U can also break the loop if i === 65

#

I don't think it will work

#

Because y will change

#

@grave thistle

#
function checkBlocks(searchDistance, detectArray) {

        if (entity.getBlockFromViewDirection({ maxDistance: 7, includeLiquidBlocks: false, includePassableBlocks: false }) === undefined) return;
        if (detectArray.includes(block.type.id)) {

            console.warn(`§a${block.type.id} detected!`);
            return;
        }

        theloop : for (let i = 1; i <= searchDistance; i++) {

            let nextBlock;
            let bSide;
            switch (bFace) {

                case "North":

                    nextBlock = block.south(i)
                    bSide = "south";
                    break;

                case "East":

                    nextBlock = block.west(i);
                    bSide = "west";
                    break;

                case "South":

                    nextBlock = block.north(i);
                    bSide = "north";
                    break;

                case "West":

                    nextBlock = block.east(i);
                    bSide = "east";
                    break;

                case "Up":
                if (block.below(i -1).location.y === -64 ) break theloop;
                    nextBlock = block.below(i);
                    bSide = "down";
                    break;

                case "Down":

                    nextBlock = block.above(i);
                    bSide = "up";
                    break;

                default: break;
            }

            if (detectArray.includes(nextBlock.type.id)) {

                console.warn(`§a${nextBlock.type.id} detected ${i} blocks ${bSide}!`);
                break;
            }
        }
    }

    if (hItem.type.id === "bbb:basic_treasure_detector") {

        checkBlocks(20, bDetection);
    } else if (hItem.type.id === "bbb:advanced_treasure_detector") {

        checkBlocks(40, aDetection);
    }
})
#

Change ur check block function with this one

sharp elbow
amber granite
#

Wait damn

sharp elbow
#

Ensure y never goes below -64

subtle cove
#
for (.....) {
    try {
        switch (... ) {
        } 
    } catch { continue } 
} ```me when lazy
amber granite
amber granite
#

This will fix ur error

grave thistle
#

It's good, i managed to fix it. Thanks for the help, it opens my eyes

amber granite
#

U welcome

cinder shadow
#

can anyone see why hasTag and .includes are spitting out false? js const itemTags = item.getTags(); const itemId = item.typeId; world.sendMessage(`tag1: ${JSON.stringify(itemTags)} tag2:${potion[0].tag}`) world.sendMessage(`${item.hasTag(potion[0].tag)} `)

#

oh wait

#

yeah nvm idk

fast lark
#

how can i make a command -ban with script

cinder shadow
#

that's the only way I got it to work

wary edge
#

Intriguing, is anyone else having issues with the durability component?

system.afterEvents.scriptEventReceive.subscribe((eventData) => {
    let s = eventData.sourceEntity
        .getComponent('equippable')
        .getEquipment(EquipmentSlot.Mainhand)
        .getComponent('durability').damage;
    console.warn(s);
});

If I substitute damage withi typeId it outputs minecraft:durability, but with damage it says fail to get property

glacial widget
#

when i click on the submit button with no info in the textfield i still get given a tag?

function add(player){
    const add = new ModalFormData()
    .title("create a name")
    .textField("", "type here")
    .submitButton("agree to name")
    .show(player).then(r =>{
     const input = r.formValues

     if(input){

        player.addTag(`rank:${input}`)
        player.sendMessage("you have created a name")

     } if(input == "") {

        player.sendMessage("you did not type a name")

     } else {
        player.sendMessage("you did not type a name")
     }
    })
}
glacial widget
distant gulch
#

hello

glacial widget
hardy tusk
#

So its an array

#

Thats your issue here

glacial widget
#

oh

#

i didnt see it as that

#

my bad

amber granite
#

@glacial widget did u really learnt js ☠️

glacial widget
#

only the basic stuff like data types, objects, arrays and etc

amber granite
#

☠️

#

But why u keep doing the things incorrectly

glacial widget
#

am still learning manjoesob

chrome flint
amber granite
#

I mean like something in the native language

#

Like using arrays methods on string

#

Etc

chrome flint
#

nah he must be just using other's examples, form samples are everywhere in here

remote oyster
#

😜

frozen vine
#

How do I see if a mob has any components?

amber granite
#

1.15.0-beta ?

pale terrace
#

What is more optimized, a Boss entity made mostly in scripting or in json? In scripting it is better since it is more free, but for example to activate attacks I would have to define conditions in a runInterval, so I don't know if it is better optimized like this or in json.

In json on the other hand, it might not be better and more expensive to make and it doesn't always work the way I want, but maybe it's worth it as it's more optimized (?

frozen vine
#

or just vanilla?

frozen vine
#

Oh , only vanilla

#

This is bad , but ok

rigid torrent
#

Can we trigger something when a player tries to equip an item/block, that is not normally equippable, in the head slot?

rigid torrent
knotty plaza
rigid torrent
#

Unfortunate, thank you

amber granite
#

?

frozen vine
#

Is there a component that if I hit a mob with a certain item, it won't cause damage to the mob?

wary edge
frozen vine
fickle dagger
#

well we can't cancel damage with scripts yet, so our other possible choice is damage sensors

#

too bad it only applies to that specific entity with the sensor though, so you can't cancel all damage without modifying every mob to have those sensors

wary edge
frozen vine
fickle dagger
#

yep

#

that's sadly the other option

#

if only it was possible with scripts, we wouldn't have to modify any mob files

pale terrace
#

The runInterval is a lot of load for the game and I want to optimize my addon, but I need to activate script codes for my entity, I was wondering if it is more optimized to activate the script code with scriptevent in a loop from my entity with some timer or something similar or simply keep the runInterval?

wide shuttle
#

how do i get player coords and facing

pale terrace
wide shuttle
#

ty

rigid torrent
#

Can we detect when a block is used rather than placed?

wary edge
rigid torrent
wide shuttle
#

you mean minecraft:on_use_on ?

rigid torrent
#

No

#

I mean like detecting right click on air

#

With a block in hand

wide shuttle
#

an interactable item?

fickle dagger
#

ooh

wide shuttle
#

like a goat horn?

fickle dagger
#

basically right click but blocks

rigid torrent
#

yes

wide shuttle
#

minecraft:on_use

rigid torrent
#

Block

#

Not item

fickle dagger
#

well no its more similiar as to itemOnUse for blocks

#

does it not work for blocks?

rigid torrent
#

It does, but I need it to work on nothing

#

Not on something specific

#

Compare it to a snowball item, you can right click to use it

#

For blocks, right click means place

#

I need it to have both

wide shuttle
#

does anyone have a good tutorial to start coding mc addons, ive looked around at quite a few but i feel more lost than before.

rigid torrent
#

Did I not explained myself good enough? lol

wary edge
#

Does itemuseon not get triggered when placing block? That wouldnt work either way

rigid torrent
#

It does, I believe

wary edge
#

What are you trying to do that warrants a block right click in air?

rigid torrent
#

Nothing yet, just need to visualize it on my mind before anything

#

This is for the heads we talked earlier

chrome flint
#

itemUse

chrome flint
#

but you'll have problems at spam entries on ItemUseOn if its being used on a place where an entity stands

wide shuttle
#

how do i invoke a function in a js file from a json file?

sharp elbow
#

Use script events. Invoke /scriptevent from your behavior file, then subscribe to the scriptEventReceive event (under system afterEvents).

shy leaf
#

now this is weird

#

content log says theres no module found

#

even though there is one

#

oh crap no wonder, i moved the files instead of pasting it

#

god i dont like android 'security'

neat hound
#

My intense scripting fun for the last 2 days... 85% finished results... https://youtu.be/d1jcFGT1cOw

I need to incorporate placement for buttons and for some reason setblocking a door doesn't stick..

I started this after seeing a tag convo in here and I wanted to actually grab the tags from the blocks themselves. I get the block one after set and the itemStack one... just tryna make sense of it all..

Anyways, learned a lot... and King/Kiro, this is why I needed that vanilla data installed...

Playing around with Bedrocks's Scripting API

I built this for myself as an exercise and so I can gather undocumented (or damn near impossible to find) information on blocks, like those dang tags.

I still need to add code for the placement of the buttons and for some reason the doors are not happy. There are other anomalies, but I will deal wi...

▶ Play video
shy leaf
#

how to i make EntityFilter to check if there is any match in familes array instead of checking for exact match

#
  • which is better, for (const e of entities) or entities.forEach(e => {})
distant tulip
#

getEntities({families:["monster"]})

edgy nimbus
shy leaf
shy leaf
remote oyster
# shy leaf + which is better, `for (const e of entities)` or `entities.forEach(e => {})`

Here is something you can use to get an idea on performance.

const runBenchmark = () => {
  // Create a large array of numbers
  const arraySize = 1000000;
  const entitiesArray = Array(arraySize).fill(0).map((_, i) => i);

  // Create a large object
  const entitiesObject = {};
  for (let i = 0; i < arraySize; i++) {
    entitiesObject[i] = i;
  }

  // Benchmark for...of with array
  console.time('Array for...of');
  for (const e of entitiesArray) {
    const square = e * e;
  }
  console.timeEnd('Array for...of');

  // Benchmark forEach with array
  console.time('Array forEach');
  entitiesArray.forEach(e => {
    const square = e * e;
  });
  console.timeEnd('Array forEach');

  // Benchmark for loop with array
  console.time('Array for');
  for (let i = 0; i < entitiesArray.length; i++) {
    const square = entitiesArray[i] * entitiesArray[i];
  }
  console.timeEnd('Array for');

  // Benchmark for...in with object
  console.time('Object for...in');
  for (const key in entitiesObject) {
    if (entitiesObject.hasOwnProperty(key)) {
      const square = entitiesObject[key] * entitiesObject[key];
    }
  }
  console.timeEnd('Object for...in');

  // Benchmark Object.keys().forEach with object
  console.time('Object Object.keys().forEach');
  Object.keys(entitiesObject).forEach(key => {
    const square = entitiesObject[key] * entitiesObject[key];
  });
  console.timeEnd('Object Object.keys().forEach');

  // Benchmark for loop with object (via Object.keys())
  console.time('Object for (Object.keys)');
  const keys = Object.keys(entitiesObject);
  for (let i = 0; i < keys.length; i++) {
    const key = keys[i];
    const square = entitiesObject[key] * entitiesObject[key];
  }
  console.timeEnd('Object for (Object.keys)');
};

// Run the benchmark
runBenchmark();
shy leaf
#

never knew you can do script benchmark in minecraft

remote oyster
shy leaf
#

ok nvm not in minecraft

remote oyster
shy leaf
#

but holy hell that is REALLY fast

granite badger
honest spear
honest spear
remote oyster
shy leaf
#

theres a similar thing called Date.now()

remote oyster
#

Yes

neat hound
#

We are limited to console.warn and error.... I tested almost all of them and a no-go

shy leaf
#

no wait that sounds stupid to me

remote oyster
shy leaf
#

hmmmmm ill try

remote oyster
#
const queryEntityLookup = world.getDimension("overworld").getEntities( { families: ["player", "mob"] } );

for (let i = 0; i < queryEntityLookup.length; i++) {
    console.warn(`${queryEntityLookup[i].typeId}`);
}

Something like that I believe.

shy leaf
#

gotta try it

#

hmm it still checks for the exact match

#

ill try a different approach

remote oyster
#

All other entities are ignored.

chrome flint
chrome flint
distant tulip
burnt remnant
#

so the debugger says theres nothing wrong with this, yet minecraft says there is??

const chestInventory = blockAbove.getComponent("minecraft:inventory").container;
const itemInFirstSlot = chestInventory.getItem(0);
const itemInSecondSlot = chestInventory.getItem(1);

if (itemInFirstSlot.typeId === "minecraft:coal" && itemInSecondSlot.typeId === "minecraft:iron_ingot")

shy leaf
shy leaf
burnt remnant
#

thank you both

chrome flint
distant tulip
#

idk
the benchmark didn't help either

remote oyster
remote oyster
#

The difference between caching length and not caching length on a for loop is so small, you won't really notice the difference.

#

However, caching object keys, that's an entirely different discussion. Major improvement.

fiery solar
# remote oyster

This is a flawed benchmark though, when benchmarking performance you really need to perform each test at least 30 times and take the average. You'll start to see that the results are extremely variable.

You also can't assume that any results from V8 (node or Chrome) are going to be similar for Minecraft's QuickJS implementation, because they won't be:

For an array with 10,000 items, the difference between for (const val of arr) and for (let index = 0; index < arr.length; index++) is maybe 2% faster, where 2% is 1-3 hundredths of a millisecond.

Here I did a test where each method of iterating the array of 10,000 was performed 1,000 times and timed, then I repeated that process 30 times and took the mean and standard deviation of both sets of trials. Then I calculated the Z-score of the difference between the two methods and calculated the p-value. The results are actually so close that they are not statistically significant.

onTestStructureLoaded: tick:for test
[2024-08-04 07:06:12:225 INFO] [Scripting] Average time for ForOf: 1.04432 ms (Std Dev: 0.10629309498182997)
[2024-08-04 07:06:12:225 INFO] [Scripting] Average time for For: 1.0153400000000001 ms (Std Dev: 0.12040943925301076)

[2024-08-04 07:06:12:225 INFO] [Scripting] The difference in performance between ForOf and For is not significant (p-value: 0.89970)   

onTestPassed: tick:for test

For an array of 1,000,000 elements, it does start to become statistically significant, but for is only about 14% faster than for of:

[2024-08-04 07:34:14:889 INFO] [Scripting] Average time for ForOf: 80.96600000000001 ms (Std Dev: 2.8134233631659797)

[2024-08-04 07:34:14:890 INFO] [Scripting] Average time for For: 92.01 ms (Std Dev: 3.093789038096312)

[2024-08-04 07:34:14:890 INFO] [Scripting] ForOf is about 1.14 times faster than For.

[2024-08-04 07:34:14:890 INFO] [Scripting] The difference in performance between ForOf and For is significant (p-value: 0.00100)  
#

All of that to say... Almost nobody should be worried about the difference for anything other than a very large (>10,000-100,000 element) array, or until you actually see lag due to this. Use what makes your code easier to read.

remote oyster
#

So it isn't "flawed".

fiery solar
# remote oyster So it isn't "flawed".

Sorry, the approach isn't flawed for getting a baseline, the only flaw with that benchmark is running it in the browser instead of Minecraft.

Didn't mean to sound rude.

remote oyster
#

Nah, I understand, and I get that. Hence why I shared the code. I'm aware that different engines can produce different times. I believe ConMaster even chimed in to let the readers know this by stating the loops are slower in Minecraft but the ratio is still about the same. So even though it's slower, we know the baseline and from that baseline a developer can take the best course of action.

#

The availability of that script also makes it possible for other's to do bigger stress tests as well 😀

glacial widget
#

does this work?

(item.hasComponentComponent("enchantable"))
remote oyster
#

.hasComponent("enchantable")

polar dagger
#

e

chrome flint
amber granite
hazy nebula
#

Why can't I open the form?

fiery solar
amber granite
#

Hey guys

#

I have question

cold grove
#

Yes

drifting ravenBOT
sudden nest
#

I literally don't know what I am doing, but wanted to share this. This executes this two events in the same tick, and idk what is going on, but it works. And tell me, is this great practice? 😪

#
world.beforeEvents.itemUse.subscribe((e) => {
  const player = event.source;
  if(!player.myCoolItem.isEquipped) return;
  system.run(() => {
    const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
      system.run(() => world.afterEvents.entitySpawn.unsubscribe(x1));
      if(spawnEvent.entity) {
        console.warn("ENTITY IS CREATED: ", system.currentTick);
        somethingToExecuteWhenCreated();
      };
    });
  });
  system.runTimeout(() => {
    system.run(() => world.afterEvents.entityRemove.unsubscribe(x2));
    const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
      console.warn("ENTITY IS REMOVED: ", system.currentTick);
      const removedEntity = removedEvent.typeId;
      if(removedEntity !== myCoolEntityToFilter) return;
      somethingToExecuteUponRemoving();
    });
  }, 0);
});
#

i was learning game loops in scripting api, and was trying to mess with stuffs

cold grove
#

Events doesnt "execute"

#

Events are those you receive via event listeners

sudden nest
#

@honest spear sorry for pinging, not a question though. I was just amazed and confused at the same time (idk literally know what to say). I was trying to create an event when fishing rod is used like casting and reeling, and don't know how to do it perfectly. But this worked, you were the one who also told me to create like this events inside another event before, since its possible but the problem with creating an event inside another event it doesn't execute in the same tick. But this one, does (in my experience).

sudden nest
honest spear
#

in programing events do executes/triggers your registered callbacks

sudden nest
#

but is this a great practice though?

honest spear
#

wait le me add formating

#
world.beforeEvents.itemUse.subscribe((e) => {
  const player: Player = event.source as Player;
  if(!player.myCoolItem.isEquipped) return;
  system.run(() => {
    const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
      system.run(() => world.afterEvents.entitySpawn.unsubscribe(x1));
      if(spawnEvent.entity) {
        console.warn("ENTITY IS CREATED: ", system.currentTick);
        somethingToExecuteWhenCreated();
      };
    });
  });
  system.runTimeout(() => {
    system.run(() => world.afterEvents.entityRemove.unsubscribe(x2));
    const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
      console.warn("ENTITY IS REMOVED: ", system.currentTick);
      const removedEntity = removedEvent.typeId;
      if(removedEntity !== myCoolEntityToFilter) return;
      somethingToExecuteUponRemoving();
    });
  }, 0);
});
#

i am on mobile and ts is not displayed

sudden nest
#

okay wait lemme fix it

honest spear
# sudden nest but is this a great practice though?

Well there are some points that could be simpliefied and even work in more reasonable way

When you unsubscribe from event you dont need a system.run, its still same tick but unsubscribing in callback it self is more safe and works as well

sudden nest
#

so unsubscribing the event doesn't need to be called in the system.run?

honest spear
#
world.beforeEvents.itemUse.subscribe((e) => {
  const player: Player = event.source as Player;
  if(!player.myCoolItem.isEquipped) return;
  const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
    world.afterEvents.entitySpawn.unsubscribe(x1);
    if(spawnEvent.entity) {
      console.warn("ENTITY IS CREATED: ", system.currentTick);
      somethingToExecuteWhenCreated();
    };
  });    
  const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
    world.afterEvents.entityRemove.unsubscribe(x2);
    console.warn("ENTITY IS REMOVED: ", system.currentTick);
    const removedEntity = removedEvent.typeId;
    if(removedEntity !== myCoolEntityToFilter) return;
    somethingToExecuteUponRemoving();
  });
});
#

Well you should check the entity id you are targing in remove event bc same tick more entities could be removed

sudden nest
#

i thought it was similar to this functionality:

subscribing an event inside another event means calling the event to start listening, and unsubscribing means stops the listening of a particular event.

as I still don't know what events truly are (dumdumbao_doggo_dead ).

honest spear
#
world.beforeEvents.itemUse.subscribe((e) => {
  const player: Player = event.source as Player;
  if(!player.myCoolItem.isEquipped) return;
  let theRightEntityImWaitingFor = null;
  const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
    if(theRightEntityImWaitingFor = thspawnEvent.entity) { //Ya here is assign intended
      world.afterEvents.entitySpawn.unsubscribe(x1);
      console.warn("ENTITY IS CREATED: ", system.currentTick);
      somethingToExecuteWhenCreated();
    };
  });    
  const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
    if(theRightEntityImWaitingFor?.id !== removeEvent.removedEntityId) return;
    world.afterEvents.entityRemove.unsubscribe(x2);
    console.warn("ENTITY IS REMOVED: ", system.currentTick);
    const removedEntity = removedEvent.typeId;
    somethingToExecuteUponRemoving();
  });
});
#

well you should also check what type of entity are you looking for in entitySpawn event

honest spear
#

well assign is expression, and that expression is returning value that was assigned so i am just checking the assign results

sudden nest
#

noted, thanks for the time bao_foxxo_sunglasses sorry to bother

honest spear
#

no problem thank you for pinging me

ripe swan
#

An event is essentially a way of one developer (Mojang in this case) telling other developers "We're going to run a bunch of code every time this specific thing happens." For example, every time an item is used by a player, the game is going to run a bunch of the same code. When you use the Subscribe method, you're telling the game "I want you to run this function along with the stuff you're running "

honest spear
#

Yes

ripe swan
#

Sorry, that's for Yang

#

The subscribe method returns a token of sorts so that if you want to unsubscribe your code from the event, you call unsubscribe with that token and the game code will know to throw out and not call your code during the event anymore

honest spear
ripe swan
#

Sorry, I'm not terribly well versed in JavaScript, but you're right, since you can assign functions as variables, it's not a token, it's the actual function.

#

Thanks for the reminder ConMaster. 🙂

sudden nest
#

where can I report a bug? or is this called a bug? or a file a request

it's just MineraftEntityTypes.FishingHook doesn't match with the typeId of an entity.typeId

MineraftEntityTypes.FishingHook = "fishing_hook, meanwhile entity.typeId is minecraft:fishing_hook or is this intended?

I am using vanilla-data = 1.21.3

cold grove
#

EntityTypes is available on minrcraft-server

sudden nest
sudden nest
cold grove
remote oyster
# fiery solar All of these things are almost exactly the same in terms of performance unless y...

It's a matter of whether using an object, map, or an array is appropriate. So depending on the circumstances and what may be considered best in the code will determine which method based on those circumstances is best suited for the task. Not all things can be treated as an object, not all things can be treated as a map, and not all things can be treated as an array. It's too complex for something to be that simple.

sudden nest
#

it's okay bao_panda_dead

spring dove
#

Whats a good way to run commands in a script without an entity

fallen cape
honest spear
sudden nest
#

do you like create your own Minecraft*Types? instead using from vanilla-data?

spring dove
#

@fallen cape it worked ty

honest spear
sudden nest
#

oh okay, I was using jayly's vanilla types class / enums, and was lazy to add some new stuffs in it, and used the vanilla types instead. Although typing errors starts to popup, so that's that. Imma just not be lazy next time. Thanks for letting me know.

honest spear
#

But of course this is just personal preferences

distant tulip
north rapids
#

main.js

world.beforeEvents.worldInitialize.subscribe(setup => {
  setup.itemComponentRegistry.registerCustomComponent("psm:durability_fix", {
    onBeforeDurabilityDamage(event) {
      psm.fixDurability(event);
    }
  });
})

functions.js

export function fixDurability(data) {
  const player = data.attackingEntity
  const item = data.itemStack;
  const drb = item.getComponent("durability");
  if (player.getGameMode() == "creative") return;
  drb.damage -= 2;
  player.getComponent("equippable").setEquipment("Mainhand", item);
};

[Scripting][error]-ReferenceError: Native property setter [ItemDurabilityComponent::damage] does not have required privileges. at fixDurability (functions.js:6)
at onBeforeDurabilityDamage (main.js:8)

Can anyone tell me how to fix this?

wary edge
#

You'll need to use system.run

north rapids
#

Wdym?

wary edge
#

On mobile so bare with me:

system.run(()=>{
//Your code
})
#

Also you dont need to do that

north rapids
#

I got it, but what I want to know is what to put in it

wary edge
north rapids
#

Ok ty

#

Seeing this made me realize how little I know about JavaScript lol

frozen vine
#

How do I set 2 lore to an item?

north rapids
#

The custom component does not have permissions to modify these properties, but with system.run you can access them

winter plaza
#

How do I identify if I have 5 diamond swords in my inventory?

distant tulip
distant tulip
frozen vine
# distant tulip setLore(["line1","line2"])
<REPL0>.js:12:22 - error TS2322: Type 'string[]' is not assignable to type 'string'.

12     newItem.setLore([lore,mobName])
                        ~~~~
#

Need " ?

nimble radish
#

can someone help me why is my script doing this:

distant tulip
#

that not a script thing

nimble radish
#

but it is bc my other forms work

distant tulip
#

look like json ui problem

nimble radish
#

i dont think it is lol

#

bc everything else works but this

#

all im doing is switching what form is being opening via 2 tags lol

north rapids
#

No more durability damage when attacking ;D

winter plaza
distant tulip
#

yeah that will work

frozen vine
#

I put this

#

let lore = hand.getLore()
lore.push(§fID: ${entityHurt.id})

distant tulip
#

@winter plaza

world.getAllPlayers().forEach(player => {
  const diamondSwordAmount = getItemAmount(player, "diamond_sword");
  if(player.hasTag("test") && diamondSwordAmount >= 5) {
    //...code
  }
})

function getItemAmount(player, itemType) {
  let amount = 0
  const inv = player.getComponent("inventory").container
  for(let i = 0; i < inv.size; i++) {
    const item = inv.getItem(i)
    if(item?.typeId === itemType) amount += item.amount
  }
  return amount
}
distant tulip
cold grove
#

Not scripting or form things

nimble radish
#
world.afterEvents.itemUse.subscribe(({ source, itemStack }) => {
    if (itemStack.typeId == 'kingdom:gui') {
        if (source.hasTag("Spawn")) {
            MainMenu(source);
        } else if (source.hasTag("Pvp")) {
            test(source);
        }
    }
});


function test(player) {
    new ActionFormData()
    .title(`-=- Main Menu -=-`)
    .body(`Welcome ${player.name},\nPlease select what you would like to do!`)
    .button(`Go to Lobby\n[ Click to Warp ]`, 'textures/items/map_locked')
    .button(`Money Transfer\n[ Click to Transfer ]`, 'textures/ui/trade_icon')
    .button(`Claim Starter Kit\n[ Click to Claim ]`, 'textures/items/wood_sword')
    .show(player).then((result) => {
        if (result.selection === 0) {
            player.teleport({ x: 0, y: 0, z: 0 });
            player.sendMessage(`§2[§aSystem§2] Teleported to §aLobby§2!`);
        }
        if (result.selection === 1) {
            MoneyTransfer(player);
        }
        if (result.selection === 2) {
            Kit(player);
        }
    });
}


function MainMenu(player) {
    let form = new ActionFormData()
    form.title(`Main Menu`)
    form.body(`§2Welcome §a${player.name}§2, Select an option below on what type of §aManagement§2!`)
    form.button(`§2Warps`,'textures/ui/icon_steve')
    form.button(`§aMoney Transfer`,'textures/ui/icon_blackfriday')
    form.button(`§2Code Redemption`,'textures/ui/permissions_op_crown')
    form.button(`§aPersonal`,'textures/ui/absorption_effect')
    form.button(`§2Information`,'textures/ui/icon_setting')
    form.button(`§cGo Back`,'textures/ui/icon_import')
    form.show(player).then((result) => {
        if (result.selection === 0) SelectWarp(player)
        if (result.selection === 1) MoneyTransfer(player)
        if (result.selection === 2) CodeRedemption(player)
        if (result.selection === 3) PersonalMenu(player)
        if (result.selection === 4) Information(player)
    })
}
cold grove
nimble radish
#

okay but howd you fix it?!

distant tulip
nimble radish
#

yh im using herobrines chestform?

distant tulip
#

avoid the title '§c§h§e§s§t'

nimble radish
#

fixed it

#

its the -=-

#

that is the issue

#

idk why

cold grove
#

Because json ui

amber granite
#

For some reason i am trying to learn c++ , and everything looks great

#

Is that good ?

#

Or i m on the wrong way ☠️

rich kernel
#

how can I make an ItemStack with a custom item?

const bruhItem = new ItemStack("fe:dingus", 3);
rich kernel
wary edge
amber granite
#

So idk if that bad or good ☠️

#

It s like going to hell by ur choice

remote oyster
#

Don't need to learn Python to learn C++.

amber granite
#

It s like start learning from easy and after that go to hardest possible

rich kernel
amber granite
#

Did u make its json correct?

nimble radish
#

@amber granite dm's

spring dove
#

i want to put a border of bedrock around the world, what could i do, to make it work

#

my biggest problem its that the world isnt loaded for when i execute a script that loads that border

frozen vine
#

How is the cooldown counted by the game? in seconds? in ticks? in minutes? Could someone explain it to me?

frozen vine
#

or send something that could explain

frozen vine
wary edge
frozen vine
#

I saw it in a complement, and I was curious about one thing, it uses if (cooldown == 47) { and I didn't quite understand the logic of this, because the number in seconds is a fixed value, if it is changed it won't work, in this case the value is "duration": 2.4 and I just checked the docs and it says to be counted in seconds, so when there is a cooldown = q 47 seconds it will be able to execute? but the duration of inactivity needs to be at 2.4 why? What is the logic between them?

cold grove
#

We dont have any context of what are you saying

frozen vine
fickle pulsar
#

guys i have a problem. im trying to define a let variable to a existing object property value but it throws a error expecting ":" but i know that changes the property value

fickle pulsar
#

ok

#
let serverinfo = JSON.parse(world.getDynamicProperty("serverinfo"));
const player = world.getAllPlayers()[z]
const senderprofanity = serverinfo?.players?[ev.sender.id].profanity
const playerprofanity = serverinfo?.players?[player.id].profanity
frozen vine
wary edge
#

Sure?

fickle pulsar
#

can someone help pls

frozen vine
# wary edge Sure?

Thanks, that's what I needed to know, so now it makes sense for the value in the json to be different from the value in the script

cold grove
fickle pulsar
#

ok

#

ill try that

#

thank you so much it worked

mellow socket
#

Whats the latest @minecraft/server version for education editon?

#

i used the "1.4.0-beta" but it broke now?

granite badger
mellow socket
granite badger
mellow socket
#

Did they remove DynamicPropertiesDefintion

fallow rivet
#

Do the codes given by Chat CGT work?

distant tulip
shy leaf
#

can getEffect return duration and amplifier?

mellow socket
#

to match that?

mellow socket
#

ChatSendAfterEvent is gone?

honest spear
#

it was renamed in newer versions

mellow socket
#

im now on 1.12.0-beta

honest spear
#

Well whats your code?

granite badger
mellow socket
#

was MinecraftBlockTypes renamed?

remote oyster
mellow socket
#

like, how do i include it?
do i add it to the manifest in the BP

distant tulip
#

just use BlockTypes and filter by name space "minecraft:"

remote oyster
# mellow socket like, how do i include it? do i add it to the manifest in the BP

It's not an actual module like @minecraft/server. Don't need to include it in your manifest. You can get it by using the following command in the terminal of vs code, or any other terminal which recognizes NPM installed on your machine.

npm i @minecraft/vanilla-data

If you do that at the root directory of your folder where you work on your behavior pack it should create a new folder called node_modules. There you will see vanilla-data. Just move the node_modules folder into the scripts folder and from there you can import it directly from that path. It's that simple.

#

The node_modules folder including vanilla-data will have to be shipped with your behavior pack in order to import and use it. Otherwise, use strings.

mellow socket
remote oyster
#

That isn't what we are doing. Like I said, vanilla-data isn't an actual module. In order to utilize the enums and other bits it offers you have to bundle it. I just explained how to do it manually versus using a tool.

#

And if you still question it then know that Mojang designed it this way. So yes, it's intentional by nature.

#

If your node_modules folder already exists and is populated with other stuff, then just create a new folder at the root of your scripts folder. Call it whatever you like. Just grab the vanilla-data folder from the actual node_modules folder and copy it over.

#

Congratulations, you have successfully bundled vanilla-data.

mellow socket
turbid oriole
turbid oriole
# mellow socket

This is the second time they have had that error. I'm tempted to try it.

#

I'll try it in a while. I'm researching some computer technologies.

granite badger
turbid oriole
wary edge
#

Competition?

turbid oriole
#

I'm the guy who's studying to design an Android IDE that surpasses bridge at least in Android versatility.

mellow socket
turbid oriole
wary edge
#

It's not a competition, releax

wary edge
turbid oriole
turbid oriole
turbid oriole
#

It's just comfort for the lucky ones. I just use the documentation and that's it xD

#

By the way, I'll be calmer now. I calmed down now, I don't know why.

sudden nest
wary edge
#

I'm pretty sure they're enums

turbid oriole
sudden nest
#

Oh sadge, i thought it similar to jayly's vanilla types

#

I had one but pretty outdated, I used it to modify things easily such as creating new methoda or whatsoever

#

That's why I was looking forward with just making it a class with static getters

turbid oriole
turbid oriole
sudden nest
turbid oriole
sudden nest
#

Hope they also gave us some enums xp

#

Like EnchantmentSlot for example, cause I don't like creating an extendedEnchantmentSlot enums

turbid oriole
#

I'm going to continue studying. End.

#

Time is valuable. And I have plenty of it.

sudden nest
#

Okay, mine always have constraints

turbid oriole
remote oyster
shy leaf
#

can player's unique id change if the player re enters the world?

wary edge
shy leaf
#

so it can happen rarely?

wary edge
#

The chances are low but never 0. Goes for everything in life

shy leaf
#

hmmm

#

i made a thing where players can summon a pet using an item

#

and the player tracks their own pet by checking if the entity has a tag of player's id

#

well ig i can keep this since it rarely happens

#

or... i could just use name instead of id

wary edge
shy leaf
#

got any suggestions?

wary edge
shy leaf
#

dang

#

but those can change

#

ok screw it ill just stick with ID

wary edge
#

and that was a freak accident

shy leaf
#

yeah im being too paranoid

distant tulip
#

-# EntityIsTamedComponent

shy leaf
distant tulip
#

alr

mellow socket
#

i have another project with the exact same dependensies and it does work?

remote oyster
# mellow socket eeuh?

If you have the stable (non beta) server module installed via NPM then it's likely your script in vs code is targeting that which would explain why it is reporting that this method doesn't exist. Remove the import at the top of the file, then manually type in the import again. When it shows a list of autocompletes look and verify if it shows two of the same type for @minecraft/server. If it does, then one is your beta and the other is stable, or some other version that doesn't actively have that method available.

#

This reason is why I actually do not like installing these modules globally. I prefer to install them locally to the project itself. It prevents this from happening.

mellow socket
#

i installed them to the node modules folder in the project folder

#

(i already deleted and remade the node modules folder aswell)

remote oyster
# mellow socket wdym?

When you type out:

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

See if the list of auto complete shows two options for "world".

mellow socket
remote oyster
#

Delete the line with the original import. Then retype it again.

#

I'm not at my computer or else I would share a screenshot to show you what I mean.

mellow socket
#

it is going for the node_modules one (if that helps)

remote oyster
# mellow socket ok, did that same issue

Yea, I know the issue will still be there. The point of doing that is to verify if it's showing two versions of @minecraft/server in the list of autocompletes.

mellow socket
#

Only shows 1 @minecraft/server

remote oyster
#

Show screenshot.

mellow socket
remote oyster
#

You have to delete the entire line where you import minecraft/server. I literally see it above in the screenshot....

mellow socket
remote oyster
#

Execute this in your terminal:

npm list -g @minecraft/server

mellow socket
#

(i don't have it globally installed)

remote oyster
#

Confirmed. How are you installing it locally?

fiery solar
mellow socket
#

and i bumped the manifest and package.json up
did a npm install (after deleting the node_modules)
and now intellisesne / compiler fucks up

#

i have another project where it does all work

remote oyster
#

Hmm, try closing vs code and opening it back up after installing the NPM package through package.json. Could be a cache issue. That's happened to me a few times on Windows. Never experienced it on Linux though.

#

Otherwise, I'm slightly baffled by the circumstances.

mellow socket
remote oyster
#

I trust your package.json is correct, but would you be willing to show it?

mellow socket
#
{
  "name": "scripting-starter",
  "version": "0.1.0",
  "productName": "Minecraft TypeScript Starter Project",
  "description": "Minecraft TypeScript Starter Project",
  "private": true,
  "devDependencies": {
    "del": "^6.0.0",
    "gulp": "^4.0.2",
    "gulp-cli": "^2.3.0",
    "gulp-rename": "^2.0.0",
    "gulp-sourcemaps": "^3.0.0",
    "gulp-typescript": "^6.0.0-alpha.1",
    "gulp-zip": "^5.1.0",
    "source-map": "^0.7.4",
    "typescript": "^4.4.3"
  },
  "scripts": {
    "enablemcloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-1958404141-86561845-1752920682-3514627264-368642714-62675701-733520436",
    "enablemcpreviewloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-424268864-5579737-879501358-346833251-474568803-887069379-4040235476"
  },
  "dependencies": {
    "@minecraft/server": "^1.12.0-beta.1.21.0-stable",
    "decode-uri-component": "^0.2.2",
    "prismarine-nbt": "^2.2.1",
    "readline-sync": "^1.4.10"
  }
}
remote oyster
#

Oh, I know what is happening haha.

#

Add this line below "dependencies":{}

    "overrides": {
        "@minecraft/server": "1.12.0-beta.1.21.0-stable"
    }
mellow socket
remote oyster
#
{
  "name": "scripting-starter",
  "version": "0.1.0",
  "productName": "Minecraft TypeScript Starter Project",
  "description": "Minecraft TypeScript Starter Project",
  "private": true,
  "devDependencies": {
    "del": "^6.0.0",
    "gulp": "^4.0.2",
    "gulp-cli": "^2.3.0",
    "gulp-rename": "^2.0.0",
    "gulp-sourcemaps": "^3.0.0",
    "gulp-typescript": "^6.0.0-alpha.1",
    "gulp-zip": "^5.1.0",
    "source-map": "^0.7.4",
    "typescript": "^4.4.3"
  },
  "scripts": {
    "enablemcloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-1958404141-86561845-1752920682-3514627264-368642714-62675701-733520436",
    "enablemcpreviewloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-424268864-5579737-879501358-346833251-474568803-887069379-4040235476"
  },
  "dependencies": {
    "@minecraft/server": "1.12.0-beta.1.21.0-stable",
    "decode-uri-component": "^0.2.2",
    "prismarine-nbt": "^2.2.1",
    "readline-sync": "^1.4.10"
  },
  "overrides": {
      "@minecraft/server": "1.12.0-beta.1.21.0-stable"
  }
}
mellow socket
#

Still a conflict

remote oyster
#

You may have to restart vscode afterwards

mellow socket
#

even after a restart

remote oyster
#

Conflict as the error in your screenshot or conflict as in the method is still not available?

#

Remove ^ from 1.12.0 in dependencies.

#

Delete node_modules folder.

#

Install again.

#

I edited the JSON above to remove ^

mellow socket
#

finally

sage sparrow
#

hi there, when the EntityLifetimeState get removed what alternative can I use to test if the entity is loaded? or there isn`t?
can the isValid() on entity be a replacement?

subtle cove
#

Yuh

#

.isValid() is one of the primary checks that should be used often. It's in Component, Entity, Block, etc

pale terrace
#

its possible to get the output of a runCommand? I want to get the output of the /locate command

#

idk if there is a function similar to locate structure in scripting

naive tinsel
#

what does this mean

#

Unhandled critical exception of type 'StackOverflow' in behavior pack '§u§lIsland Generation' also

sharp elbow
#

Usually that means you performed too many operations at one time. Something like a for or while loop with no proper exit condition

oak hatch
#

a stack overflow is usually caused by a recursive function without a proper base case

solar dagger
#

          target.playAnimation('animation.mammoth.charge_start', {
            controller: 'controller.animation.mammoth_charge',
          });

Im a little confused on this. Cant i just use the controller instead of adding the animation.


    "controller.animation.mammoth_charge": {
      "states": {
        "default": {
          "animations": ["charge_start"],
          "transitions": [{ "phase_2": "query.any_animation_finished" }],
          "blend_transition": 0.2
        },
        "phase_2": {
          "animations": ["charge"],
          "transitions": [{ "reset": "query.any_animation_finished" }],
          "blend_transition": 0.2
        },
        "reset": {
          "animations": ["general"]
        }
      }
    }```
sharp elbow
#

From what I know, controller doesn't specify an existing controller to use. It specifies the name for a brand new runtime controller, in case you want to run multiple /playanimation or playAnimation() methods.

#

Where each state is the name of the animation

solar dagger
sharp elbow
#

If at all possible, yes.

nimble schooner
#

Is there a better way than scripts to modify the block drop pool?

cinder shadow
#

If it's not possible with loot tables, creating your own through scripting is the best way

steep hamlet
#

is it possible to damage items?

distant gulch
fallen cape
#

You should use item.getComponent("durability")

distant gulch
#
 const durability = item.getComponent('minecraft:durability');
                        if (durability) {
                            durability.damage = selectedItem.durability;
                        }```
#
  •    * // Gives a player a half-damaged diamond sword
       * import { ItemStack, Player, ItemComponentTypes, EntityComponentTypes } from '@minecraft/server';
       * import { MinecraftItemTypes } from '@minecraft/vanilla-data';
       *
       * function giveHurtDiamondSword(player: Player) {
       *     const hurtDiamondSword = new ItemStack(MinecraftItemTypes.DiamondSword);
       *     const durabilityComponent = hurtDiamondSword.getComponent(ItemComponentTypes.Durability);
       *     if (durabilityComponent !== undefined) {
       *         durabilityComponent.damage = durabilityComponent.maxDurability / 2;
       *     }
       *
       *     const inventory = player.getComponent(EntityComponentTypes.Inventory);
       *     if (inventory === undefined || inventory.container === undefined) {
       *         return;
       *     }
       *
       *     inventory.container.addItem(hurtDiamondSword);
       * }
       * ```
celest fable
#

hellow

#

does anyone know how to set the item data for itemStack?

distant gulch
celest fable
distant gulch
celest fable
#

mmmm

#

sorry my bad, ItemStack

spring axle
distant gulch
# spring axle We don't expose item stack's data field directly. You can access the specific t...
/**
 * Represents a container that can hold sets of items. Used
 * with entities such as Players, Chest Minecarts, Llamas, and
 * more.
 * @example containers.js
 * ```typescript
 * let leftLocation = test.worldLocation({ x: 2, y: 2, z: 2 }); // left chest location
 * let rightLocation = test.worldLocation({ x: 4, y: 2, z: 2 }); // right chest location
 *
 * const chestCart = test.spawn("chest_minecart", { x: 6, y: 2, z: 2 });
 *
 * let leftChestBlock = defaultDimension.getBlock(leftLocation);
 * let rightChestBlock = defaultDimension.getBlock(rightLocation);
 *
 * leftChestBlock.setType(MinecraftBlockTypes.chest);
 * rightChestBlock.setType(MinecraftBlockTypes.chest);
 *
 * const rightChestInventoryComp = rightChestBlock.getComponent("inventory");
 * const leftChestInventoryComp = leftChestBlock.getComponent("inventory");
 * const chestCartInventoryComp = chestCart.getComponent("inventory");
 *
 * const rightChestContainer = rightChestInventoryComp.container;
 * const leftChestContainer = leftChestInventoryComp.container;
 * const chestCartContainer = chestCartInventoryComp.container;
 *
 * rightChestContainer.setItem(0, new ItemStack(Items.apple, 10, 0));
 * test.assert(rightChestContainer.getItem(0).id === "apple", "Expected apple in right container slot index 0");
 *
 * rightChestContainer.setItem(1, new ItemStack(Items.emerald, 10, 0));
 * test.assert(rightChestContainer.getItem(1).id === "emerald", "Expected emerald in right container slot index 1");
 *
 * test.assert(rightChestContainer.size === 27, "Unexpected size: " + rightChestContainer.size);
 * test.assert(
 *   rightChestContainer.emptySlotsCount === 25,
 *   "Unexpected emptySlotsCount: " + rightChestContainer.emptySlotsCount
 * );
 *
 * const itemStack = rightChestContainer.getItem(0);
 * test.assert(itemStack.id === "apple", "Expected apple");
 * test.assert(itemStack.amount === 10, "Expected 10 apples");
 * test.assert(itemStack.data === 0, "Expected 0 data");
 *
 * leftChestContainer.setItem(0, new ItemStack(Items.cake, 10, 0));
 *
 * rightChestContainer.transferItem(0, 4, chestCartContainer); // transfer the apple from the right chest to a chest cart
 * rightChestContainer.swapItems(1, 0, leftChestContainer); // swap the cake and emerald
 *
 * test.assert(chestCartContainer.getItem(4).id === "apple", "Expected apple in left container slot index 4");
 * test.assert(leftChestContainer.getItem(0).id === "emerald", "Expected emerald in left container slot index 0");
 * test.assert(rightChestContainer.getItem(1).id === "cake", "Expected cake in right container slot index 1");
 *
 * ```
 */```

```js
 * test.assert(itemStack.data === 0, "Expected 0 data");
#

@minecraft/server line 3964, is this not item data?

celest fable
spring axle
distant gulch
#
  "dependencies": {
    "@minecraft/server": "^1.2.0"
  },```
spring axle
#

Hmm looking at the 1.2.0 types and I don't see that but I could be missing it

distant gulch
# spring axle Hmm looking at the 1.2.0 types and I don't see that but I could be missing it
#

I think a workaround could be done via getting the inventory find a empty slot then use /give command with the data value and set it to the empty slot and just get the itemStack like that to do any additional gametest on the item

true isle
#

is there like a general tag that all vanilla blocks would have?

true isle
#

hmm ok might have to do without the 2d cardinal

wary edge
true isle
#

well im trying to recreate my spine block. it has modified stair rotation with an extra direction sorta. it has up down and side similar to pistons but also has cardinal im just having an issue getting the side to place. i can toggle it on and off just not place it normally not sure why

neat hound
#

Fun Fact I learned yesterday while tryna make my Every Block add-on be able to place doors.... You have to place the bottem and the top door with the correct state codesJS else if (blockInfo.name.endsWith('_door')) { const topDoorBlock = BlockPermutation.resolve(blockInfo.typeId, { direction: 0, door_hinge_bit: true, open_bit: false, upper_block_bit: true }); const bottomDoorBlock = BlockPermutation.resolve(blockInfo.typeId, { direction: 0, door_hinge_bit: true, open_bit: false, upper_block_bit: false }); dimension.setBlockPermutation({x:blockInfo.xyz.x,y:blockInfo.xyz.y+1,z:blockInfo.xyz.z}, topDoorBlock); dimension.setBlockPermutation(blockInfo.xyz, bottomDoorBlock); } Which means just dimension.setBlockType(blockInfo.xyz, 'minecraft:<type>_door')no worky

neat hound
#

Kinda thought their code would handle it... like when I made my door... the bottom places it's own top.

#

but now that I think about it... they cannot do that... 🫠 Well I mean they can, but a setBlock can't activate a hardcoded event

#

Also.... buttons, setblock default is face_direction = 0.... so you have to set it yourself, if not the bottom of another block. But, when I set it to zero... it stayed on the bottom of air block. I am not sure how long it would have stayed in an impossible state, because I quickly changed the code to 1.

thorn flicker
#

is it intended for custom block components to not work if they are only in permutations.

#

because Im trying to make only some states of my block have certain custom components.
I dont want all them to have it. This is only a concern because I dont want a state to use the randomTick or onTick.

true isle
fickle pulsar
#

guys is source maps possible when your debugging with bundled code?

thorn flicker
#

because maybe this is a bug and its only fixed in preview.

weary umbra
#

does anyone has an idea how to fix this issue?
I used this:

                let { x, y, z } = player.getViewDirection();
                player.teleport({ x: player.location.x - x, y: player.location.y, z: player.location.z - z });
neat hound
thorn flicker
#

im aware I can put custom components within permutations, the problem is I have to define it outside of permutations first for it to work.

thorn flicker
thorn flicker
neat hound
#

Perhaps start a post, post the code and tell what it is doing that you DO NOT want it to do.

neat hound
#

link

fiery solar
#

Yes, you have to set it up though. Are you using esbuild and emitting source maps?

rich kernel
#

is this what i'm supposed to do to add a delay
system.runTimeout.prototype(1)

remote oyster
near siren
#

Does getDamageChance just not work anymore? How else would I get the chance

wary edge
near siren
#

All I get is this: [Scripting][error]-Error: Failed to call function 'getDamageChance' at <anonymous> (treecap.js:16)

subtle cove
#

Meaning the entity isn't loaded

wary edge
#

Thats not true but sure

near siren
#

Im getting the player's mainhand item's durability and trying to grab the damage chance

subtle cove
#

Const item

near siren
#

Its an iron axe

#

With unbreaking 1

subtle cove
#

:}

#

did u define item 1st?

wary edge
near siren
#

Im just grabbing the item the player is holding

subtle cove
#

Mhm, did u define the i t e m...

wary edge
#

Wow major spelling mistake

near siren
#

Basically have player.getComponent('equippable').getEquipmentSlot('Mainhand').getItem()

near siren
#

Same error

#

It also gives the same error when Im wearing an iron chestplate

wary edge
#

Last i tried only wolf armour and the carrot/fungus on a stick works

#

That was 2 months ago though

valid ice
#

Should it not work for... everything..?

wary edge
valid ice
#

Been away the last few days

wary edge
#

Oh hang on...nvm then, thats for damage chance range

#

That works onky for those 3

valid ice
#

You may say, "well can't you check your phone when away?"
Not when out of cell service, I can't echsplode

wary edge
valid ice
#

I ask myself the same question

near siren
#

Untested old code, but this is what I did a long time ago and it worked durability.getDamageChance(item.getComponent('enchantable').getEnchantment('unbreaking').level)

fickle pulsar
#

guys is source maps possible when your debugging with bundled code?

inland merlin
#

Don't worry this is relevant to the convo

prisma shard
fickle pulsar
#

well it gets generated

#

but it doesnt get applied i think

sudden nest
#

hello, anyone having an "TypeError" with runJob?

This one never works:

system.runJob((function* () {
 world.sendMessage("TEST");
 yield;
})());

Here's my manifest:

{
   "module_name": "@minecraft/server",
   "version": "1.11.0"
}

Installed this:
npm i @minecraft/[email protected]

and tried this:
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]

I am currently playing Minecraft v1.21.2.

It produces a "TypeError, not a function" error, tried a function that exist, and tried this, still leaving with this error.

random flint
#

Calling it would otherwise, return undefined which is why "Not a function" came from.

sudden nest
#

wait imma try it

#

Argument of type '() => Generator<any, void, unknown>' is not assignable to parameter of type 'Generator<void, void, void>'.

system.runJob((function*() {
    world.sendMessage("TEST");
    yield;
}));

Still error

#

Even the example from the documentation doesn't work bao_foxxo_doubt

random flint
#

You need to add 3 arguments.

system.runJob((function*(a,b,c) {
    world.sendMessage("TEST");
    yield;
}));
sudden nest
#

i think, its the minecraft version im using or manifest or the api i just installed

#

what minecraft u using?

random flint
#

Latest stable version

random flint
#

That's just how it work

#

IDK why it's so goofy, and need 3 arguments for it to work.

sudden nest
#

wait

random flint
#

(a=null, b=null, c=null)
ig... I never use typings xd

sudden nest
#

i think it's my npm version or somewhat minecraft/manifest stuffs

#

methods from beta is not recognized when running inside the minecraft, but is autocompletion from tsserver works

random flint
sudden nest
#

like findClosesBiomes it doesn't recognize it

random flint
#

void is just undefined.

#

@sudden nest try this:

You need to add 3 arguments. call it and add 3 arguments

system.runJob((function*(a,b,c) {
    world.sendMessage("TEST");
    yield;
})(0,0,0));
sudden nest
#

okay

random flint
#

or this...

function* genFunc(a,b,c) {
    world.sendMessage("TEST");
    yield;
};
system.runJob(genFunc(0,0,0));
sudden nest
#

i mean i used runJob before, it can easily recognize generator functions

#

still not a functiona... thanks for helping though. I think i'll might think about this first

#

here's my package.json

#

i used to have 1.1.0 for common, but still the function still not recognized

random flint
sudden nest
#

i used to code on phone, now my phone cannot access with data/folder

sudden nest
#

yep

#

it works now, i just changed my manifest to 1.12.0-beta

random flint
#

If it doesn't work. You can just go with a custom runJob by making an asynchronous function and await system.waitTicks(1) after accumulating enough attempts

sudden nest
#

but the docs said it was 1.11.0bao_doggo_derp

sudden nest
random flint
#

Ah, then... you can use the system.runTimeout() sleep function that exists somewhere in this server xd

sudden nest
#

that was a weird scene i have encountered. The game doesn't even tell me to update my manifest it just doesn't work even with typescript

random flint
sudden nest
#

yeah my manifest is dumdum, not throwing any error

sudden nest
#

the docs has only this available versions:

#

weird

random flint
#

Maybe it's stable in the docs, but it is actually still in the preview.

nimble schooner
#

Is there a way to properly modify the loottable of blocks?

random flint
#

Vanilla Blocks? Nuh-uh

#

It's always this workaround: kill the dropped item & spawn the new one

shy leaf
#

kill the

#

dropped item

#

that sounds janky

random flint
#

If it works, it ain't stupid janky.

prisma shard
#

hi guys

prisma shard
random flint
#

I have 4% on my phone batteries don't expect a reply

prisma shard
simple zodiac
#

Just bad types made from mojangs side imo

turbid oriole
#

One question, what computer technologies do you use? I'm collecting technology for my personality.

#

I will be a full stack programmer, I am starting this whole complex world.

turbid oriole
forest loom
#

Is there a vanilla behavior pack somewhere that includes things like all of the basic structures and their generation conditions so they can be properly edited? The normal one doesn't seem to include it.

Is that sort of stuff even changeable in the first place?

granite badger
#
  1. They’re stored as nbt files only in game files.
  2. Pretty sure jigsaw blocks don’t work for us
forest loom
#

Damn

fiery solar
forest loom
#

do have to say though, it's weird af how they store everything in this

forest loom
#

Can't even find where the actual generation conditions would be, I'm guessing somewhere in the mess of NBT files, but I'm also guessing it's way too much work for me to actually figure out where for each one lol

#

guess I'll just scrap this

weary umbra
#

can I change particle size with script

#
{
    "format_version": "1.10.0",
    "particle_effect": {
        "description": {
            "identifier": "ct:box",
            "basic_render_parameters": {
                "material": "particles_alpha",
                "texture": "textures/particle/particles"
            }
        },
        "components": {
            "minecraft:emitter_initialization": {
                "creation_expression": "variable.size_x = 10;variable.size_y = 10;variable.size_z = 10;"
            },
            "minecraft:emitter_rate_steady": {
                "spawn_rate": 400,
                "max_particles": 400
            },
            "minecraft:emitter_lifetime_looping": {
                "active_time": 1
            },
            "minecraft:emitter_shape_box": {
                "offset": [-12, "variable.size_y-5", 12],
                "half_dimensions": ["variable.size_x", "variable.size_y", "variable.size_z"],
                "surface_only": true,
                "direction": [0, 1, 0]
            },
            "minecraft:particle_lifetime_expression": {
                "max_lifetime": 1
            },
            "minecraft:particle_initial_speed": "math.random(1, 4)",
            "minecraft:particle_appearance_billboard": {
                "size": [0.2, 0.2],
                "facing_camera_mode": "rotate_xyz",
                "uv": {
                    "texture_width": 128,
                    "texture_height": 128,
                    "uv": [16, 48],
                    "uv_size": [7, 7]
                }
            },
            "minecraft:particle_motion_collision": {},
            "minecraft:particle_appearance_tinting": {
                "color": ["variable.color.r", "variable.color.g", "variable.color.b", "variable.color.a"]
            }
        }
    }
}

this is the particle I already have the variable but idk if I can use it in the molang

#

nvm I'm dumb I got it

woven oyster
#

what is the solution of this problem ?

The dependency with the id is missing. 'ad 1ec4d2-96ef-44e6-905e-61024a7a1c09' version
'1.0.0'.```
fast lark
#

can someone help me

#

i want to edit my mod directly from minecraft files but when I look the folders they are empty

remote oyster
fast lark
#

idk why is empty

remote oyster
#

Then you must be looking in the wrong folder.

fast lark
#

no bs yesterday worked

valid ice
#

Is it a development pack or a normal pack?

fast lark
valid ice
#

In the development_resource_pack or development_behavior_pack folders

fickle dagger
fast lark
valid ice
#

Dev packs are not stored on the world; they do not show up in the world files

fast lark
#

oh

remote oyster
#

They show up in another folder.

fast lark
valid ice
#

ye

fast lark
valid ice
#

If you're using the dev folders, you do not need to work directly from the world files (and it is highly recommended against anyways)

valid ice
#

As for that empty folder... no clue

fast lark
#

thanks anyway

true isle
#

How do I update the server api again? I tried doing it through vscode like last time and I got a crap load of fatal errors from node and no clue why

cold grove
#

What do you mean by "updating server api"

#

@minecraft/server 1.11.0 -> 1.12.0?

#

Do you mean your, types module? (npm)

gaunt salmonBOT
#

Latest NPM Types

npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]

Beta APIs NPM Types

npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]

Preview Latest NPM Types

npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]

Preview Beta APIs NPM Types

npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
shy leaf
#

is it just me or

#

isSprinting is broken

cold grove
shy leaf
#

does it return true if the player is 'currently' sprinting

#

or started sprinting

cold grove
#

Yes?

shy leaf
#

i mean

#

which one

cold grove
#

isSprinting

read-only isSprinting: boolean;
Whether the entity is sprinting. For example, a player using the sprint action, an ocelot running away or a pig boosting with Carrot on a Stick.

shy leaf
#

'sprinting'

#

but

#

for some reason it returns true only if i just started sprinting

cold grove
#

You tried printing it constantly?

shy leaf
#

well no not really, but i tied it to an event that fires when the player attacks

cinder shadow
#

well that's probably why it would only play once...

remote oyster
valid ice
#

What does that do

silk egret
#

Hi

remote oyster
# valid ice What does *that* do

I honestly do not know. At face value it seems like a custom logic for creating your own events which can be triggered under certain circumstances according to how you implement it.

But I would need to see an example because it just seems like something no differently than doing a condition check and calling a function if the condition meets.

Just happened to stumble upon it lol.

subtle cove
#

Bye

valid ice
#

Trigger really does not seem to have any use that I can tell- unless its something for triggering entity-file events or something odd like that.

remote oyster
#

Not sure. Not at my PC to mess with it. Probably mess with it later though.

true isle
#

So mc server 1.21.0 is stable? Sweet I'm still on 1.12 beta apparently

valid ice
#

In preview 1.12.0 is stable, and in regular mc, 1.11.0 is stable

prisma shard
true isle
#

There's too name of those

#

Many*

true isle
#

Lol

true isle
prisma shard
# valid ice no

I am trying to make one, but i don't know how to get the adjacent blocks of a block.
like when you break one block, all of the adjacent blocks will also break at once.

#

Can you help me making it

valid ice
#

I'm good, thanks

chrome flint
#

hey can someone tell me what's the typeId of eye of ender?

#

is it "minecraft:ender_eye" or "minecraft:eye_of_ender" ?

valid ice
chrome flint
sudden nest
grave thistle
#

How do I set a dynamic property for a player when they first join the world? I only want it set once and not every time they join.

I have a UI toggle and want it to be set to the dynamic property - menu.toggle("test", entity.getDynamicProperty("initial_spawn")); - but the toggle is always false when first opening the UI

valid ice
simple zodiac
#

using typeof or an explicit undefined bc false is also false

chrome flint
#

what does runJob do?

grave thistle
valid ice
#

should

grave thistle
#

I'll try that now

simple zodiac
grave thistle
umbral dune
#

@wary edge "undefined" is the value of this item property, I set the value of the property to "true", but nothing happens.

cinder shadow
# umbral dune

Can you provide information that would actually be usable to help you? A video is only going to show that it doesn't work, but we want to know why it doesn't work.

umbral dune
#

ok, but please don't make fun of my code :(

const ready = e.itemStack.getDynamicProperty("ready");
    system.run(() => e.player.onScreenDisplay.setActionBar(`${ready}`));
    if(ready) {
      e.itemStack.setDynamicProperty("ready", false);
      
      const target = e.block.location;
      const source = e.itemStack.getDynamicProperty("source");
      
      e.itemStack.setDynamicProperty("source");
      
      const minX = Math.min(target.x, source.x), minY = Math.min(target.y, source.y), minZ = Math.min(target.z, source.z);
      const maxX = Math.max(target.x, source.x), maxY = Math.max(target.y, source.y), maxZ = Math.max(target.z, source.z);
      
      const storage = new Map();
      for(let i = minX; i <= maxX; i++) {
        for(let j = minY; j <= maxY; j++) {
          for(let k = minZ; k <= maxZ; k++) {
            const block = e.block.dimension.getBlock({ x: i, y: j, z: k });
            if(block && !block.isAir) {
              storage.set(block.typeId, (storage.get(block.typeId) ?? 0) + 1);
            }
          }
        }
      }
      
      const list = [];
      for(const [block, quantity] of storage) {
        list.push(`${block} (${quantity}x)`);
      }
      
      system.run(() => e.player.onScreenDisplay.setActionBar(list.join(" §7-§r ")));
    } else {
      e.itemStack.setDynamicProperty("ready", true);
      
      const target = e.block.location;
      e.itemStack.setDynamicProperty("source", target);
      
      // system.run(() => e.player.onScreenDisplay.setActionBar(`§7source position set to §s${target.x} ${target.y} ${target.z}§r`));
    }
neat hound
winter plaza
#

help

#
import * as mc from "@minecraft/server";
import * as q from "./mission_list.js";
import { getScore, random } from "./all.js";

mc.world.afterEvents.playerSpawn.subscribe((data) => {
  if (data.source.hasTag("in_mission")) {
    inMission(data.source, q.Mission.list[getScore("missions", data.player)]);
  }
});

function inMission(player, mission) {
  //my code
}
umbral dune
neat hound
umbral dune
digital swallow
#

Anyone know how I can get the item type an item in the world is? When I try to get it's typeId it gives me "minecraft:item", because thats what the entity ID is. (I want the string "minecraft:diamond" for example, from the item, if it were a diamond)

wary edge
distant tulip
#

const item = entity.getComponent("item").itemStack
const id = item.typeId

digital swallow
neat hound
# umbral dune 1. It is a custom item 2. I didn't understand what you said 3. yes, I did an if-...

You now have, and have had for a little while, the ability to add a custom component onto your item so that it catches the events for that item. So instead of using the generic, which still works, but you have to test the item for the correct one. Which you may have to do if you share your component with other custom items that do similar things... Either way, just something to consider which you may do when you learn more about it and want to refactor..

neat hound
fickle pulsar
#

guys

#

how do i use sourcemaps with minecraft

distant tulip
#

what dose these numbers mean?
the max spike i get in game is 17 ms

chrome flint
fiery solar
# distant tulip what dose these numbers mean? the max spike i get in game is 17 ms

Total Time is the amount of time that was spent in that function while you had the profiler on (including functions that get called from your function).

The self time is the amount of time spent in that function not counting any sub functions that it calls. Do from the time you started the profiler to the time you stopped it, 22.4 seconds was spent getting the .size attribute of containers.

spring dove
#

How can i stop a system run interval from running once is fired

neat hound
spring dove
#

I discovered it ty

#

little example

neat hound
#

Yes. and can do a for loop with just the runTimeout where you multiply the interval by 20

#

and seeing how JS works, can make your own class to do this so you jus send parms.... LOL

spring dove
#

how, tried that at first

valid ice
spring dove
neat hound
#

welll 20 would need to be in a variable```
const x = 20;

for(let i=1.....)

system.runTimeOut...... ,i*x)

neat hound
#

I do not know which is more efficient... but both work. Just preference. I like yours.

valid ice
spring dove
valid ice
#

I probably should upgrade my loops tbh

neat hound
#

I forgot you can double up on the vars in for loop... I'mma have to go upgrade some stuff... LOL or not... later

valid ice
#

It gets messy fast; I would not reccommend it 😛

neat hound
#

I like messy and complicated.. make me feel sMart

valid ice
#

What you see above is double-nested in timeouts on top of what is already there

#

It's... bad

neat hound
#

Me and system.run.... are good friends now.. since I made a thing to place every block in the game, in a pattern 8 directions from where I am and it has to move me and get block information once placed....

#

I learned... all the (acacia) wood blocks, except one, have the block tag Wood

valid ice
neat hound
#

cause no info... so I figured, why not just see what it has myself... I made, with chat command, queriable info,. It was just a fun exercise.

valid ice
#

Nice 👍

neat hound
#

BT is block tags and IT is the itemStack tags

valid ice
#

so only the sapling does not have wood tag?

neat hound
#

as it should not... it is a plant

valid ice
#

Makes sense

#

How'd you query the ID? Manually or automatic?

#

Or is that just the position of that item/block in the array you use?

sudden nest
#

Anyone have big projects I can look at? How they structure their project and If which is better:

CamelCase or camelCase, and also I feel anxious with longer function names or variable names since i haven't looked any big projects lately

#

Or even if it's not big projects just some tips

neat hound
valid ice
#

I always use camelCase for variable names, no real reason behind it other than I do

gray tinsel
#

Just do what makes sense for you

#

From what I know it comes down to the person really

#

As it is both object oriented and whatever function thing I called.

neat hound
sudden nest
#

I looked Nox's Villager project, and find out reminds me of Java (i miss and hate java lol)

gray tinsel
#

But for functions I would use camel case

#

Just do whatever suits you best

sudden nest
#

I use camelCase, but with file names I use snack_case

gray tinsel
#

Unless you want people using your code for something I wouldn't worry

#

Even then it just has to be clear and consistent

wary edge
#

That's th eproper term

sudden nest
#

I kinda want to blend my typing cases with scripting since I don't like inconsistent stuffs

wary edge
#

I just recommend following the standard JS naming scheme

buoyant canopy
#

can we tell if a player is an operator with scripts?

gray tinsel
#

Yes

#

.isOp() I believe

neat hound
# valid ice Or is that just the position of that item/block in the array you use?

Remember when I was conflicted about using a class... well this is what I decided and it occurred to me I can use the file.js like a class... so methods and data are hidden.```JS
class BlockInfo {
/**
* @param { import("@minecraft/server").Vector3 } location
* @param { number} index
* @param { string} key
/
constructor(index, key, location) {
this.index = index,
this.inValid = 0,
this.displayGroup = 0,
this.key = key,
this.typeId = MinecraftBlockTypes[ key ],
this.name = this.typeId.split(':')[ 1 ],
this.isAir = false,
this.isLiquid = false,
this.isSolid = true,
this.hasTags = false,
this.tags = [],
this.y_offset = ['cactus','waterlily'].includes(this.name) ? 1 : 0,
this.defaultStates = {},
/

button: facing_direction Fix LATER
*/
this.xyz = location,

        this.isStackable = false,
        this.maxAmount = 1,
        this.hasItemTags = false,
        this.itemTags = [],
        this.placed = false;
}
x = () => this.xyz.x;
y = () => this.xyz.y;
z = () => this.xyz.z;

}
const vbKeys = Object.keys(MinecraftBlockTypes)
//.filter(k => { true })
.filter((k) => { return !k.startsWith("Chemistry"); })
.filter((k) => { return !k.startsWith("Chemical"); })
.filter((k) => { return !k.startsWith("Element"); })
.filter((k) => { return !k.startsWith("InfoUpdate"); })
.filter((k) => { return !k.startsWith("Reserved"); })
.filter((k) => { return !k.startsWith("Unknown"); })
.filter((k) => { return !(k.startsWith("Hard") && k.includes("Glass")); });
//==============================================================================
const vanillaBlocks = {
initialized: false,
blocksInGround: false,

baseDimension: world.getDimension("overworld"),
baseLocation: { x: 0, y: 0, z: 0 },

blocks: vbKeys.map((k, i) => {
    const info = new BlockInfo(i, k, { x: 0, y: 0, z: 0 });
    return info;
}),

count: () => vanillaBlocks.blocks.length

};```

gray tinsel
#

How long is the fix later gonna stay there?

sudden nest
gray tinsel
#

1 year

#

Perhaps 10?

buoyant canopy
#

it's neither a method nor a property for the player class

distant gulch
gray tinsel
#

It's experimental

#

:/

#

For what reason I have no idea

#

Seems pretty simple to tell

buoyant canopy
wary edge
#

I mean...checking if a block isAir seems pretty simple and yet its still experimental...we love spaghetti codebase

distant gulch
#

Has anyone tried working on a actual block id/item id to texture path converter?

gray tinsel
#

You are meaning the beta API version?

spring dove
#

Whats the difference between runCommand and runCommandAsync

wary edge
gray tinsel
buoyant canopy
distant gulch
#

And custom items that a realm owner might have woudnt be supported.

#

Is there a work around for that?

buoyant canopy
remote oyster
# gray tinsel .isOp() I believe

I believe it's still broken when used in a Realm. It's inconsistency due to the complex permission system Mojang currently has implemented makes it unreliable right now.

buoyant canopy
distant gulch
#

Im using the resource path texturelist to have them automatically generated

inland merlin
buoyant canopy
distant gulch
inland merlin
valid ice
distant gulch
inland merlin
buoyant canopy
valid ice
#

The best I can think of would be using python or similar to set the shift variable based on a file count in the items folder

distant gulch
# valid ice The best I can think of would be using python or similar to set the shift variab...
GitHub

Samples and assets for building Minecraft: Bedrock Edition add-ons - Mojang/bedrock-samples

GitHub

Samples and assets for building Minecraft: Bedrock Edition add-ons - Mojang/bedrock-samples

spring dove
#

I have a question, even if you only add the tickingarea to just a block, the whole chunk its added to the tickingarea?

remote oyster
# spring dove Whats the difference between runCommand and runCommandAsync

One operates synchronously and the other asynchronously.

It's like counting from 1 to 10 and with each count you had a job to do and until that job was finished you couldn't move forward with the count. That's synchronous. Now assume you get to 3 and number 3 is asynchronous. You will continue counting to 10, meanwhile the job for 3 is still getting done.

With asynchronous you can use 'await' or not. 'await' basically tells the js engine to wait until the asynchronous job is completed before counting beyond 3 based on the illustration I gave. If you don't use 'await' then you keep counting while the job for 3 happens on the sidelines. In either cases, the asynchronous job will return a promise saying whether or not it is resolved.

spring dove
#

wtf

buoyant canopy
mystic mortar
spring dove
valid ice
#

I may be thinking of a different Id than you guys are tbh

distant gulch
buoyant canopy
distant gulch
#

yes

mystic mortar
valid ice
#

I see ID and I go to numerical ID

buoyant canopy
mystic mortar
valid ice
mystic mortar
#

The way I'm doing that is by making a list of items that break texture under the current number system.

distant tulip
#

if only numerical id don't shift when there is a custom item

valid ice
valid ice
#

Average mojang system

buoyant canopy
distant tulip
#

both ideas fail when it comes to custom items

buoyant canopy
#

i was looking for a way to crop a ui element if it is overlapping empty pixels of its parent element, just to avoid using the aux value for enchanted items

mystic mortar
mystic mortar
# valid ice Real

Either way tho, we need a manual texture mapper and number offset.

buoyant canopy
# valid ice Woah

for example, if a golden apple png was the parent element and the enchantment glint animation was the child element, i would want the child element to adjust its size to match the shape of the golden apple

mystic mortar
fickle pulsar
#

how do i use source maps with miencraft

median oyster
#

how do I do a or? I know that && is and but whats or?

fickle pulsar
#

its ||

median oyster
#

ty