#Script API General

1 messages Β· Page 30 of 1

dim tusk
#

Custom block?

leaden walrus
dim tusk
#

Btw is custom components still beta?

oblique eagle
#

does anyone know why this doesnt work?

    const Block = data.block
    const player = data.player
    
    console.warn(`erherhedhewse`)
})```
leaden walrus
dim tusk
oblique eagle
dim tusk
#

Grass block is not interactable

#

Try using crafting table

#

What i mean by interactable your arms swings whn you right click a block

oblique eagle
#

I've seen someone do it with non interactable blocks like a diamond block

dim tusk
#

They used beforeEvents

oblique eagle
#

what the flip

#

alr ill try that

dim tusk
#

Btw it spams the console warn

oblique eagle
#

yeah it works but it spams

leaden walrus
dim tusk
dim tusk
leaden walrus
dim tusk
# oblique eagle yeah it works but it spams
world.beforeEvents.playerInteractWithBlock.subscribe(({ block, player }) => {

    if ((player['cooldown'] ?? 0) > Date.now()) return;
    player['cooldown'] = Date.now() + 50;
    console.warn("block");
});
dim tusk
dim tusk
true isle
#

Ik it's like the 5th time I've asked this but is their anyway to randomize setblock using an array?

dim tusk
#

Just define the xyz

sage sparrow
#

hi there, I used to have this code where it simulates a security camera but it get updated with a new location every X seconds always facing the player and it keeps tracking the player until next update.
after some past update it stopped to work and now I m trying to tshoot it, and looks like the easeOptions is causing a issue where the camera will not get update and always remains on the first position it was set at begining of the loop ```javascript
tv.camera.setCamera("minecraft:free", { easeOptions: { easeTime: 0.80, easeType: "OutCubic" }, facingEntity: target, location: { x: target.location.x, y: target.location.y+5, z: target.location.z+3 } })

do someone know what can be causing it?
if I remove the easeOptions it work and the camera get updated to the new location, but with ease it dont.
dim tusk
#

player.getSpawnPoint()

#

It's a vector3

vestal thorn
#

No one help me on how to do item lore for a item yet

#

can I please get some help, it would be very appreciated

#

And also please stop with the ItemStack thing because I want it set for a specific item to have lore, Example: a stick, where you can hover over it in the creative, or normal inventory and the lore appears for only the stick

wary edge
vestal thorn
#

Ik it's possible, i seen people done it

#

I just don't know how

wary edge
vestal thorn
#

But how do I set it to what item, i want to have lore on it?

wary edge
#
const item = new ItemStack('minecraft:stick');
item.setLore(['Lore']);
// Code to set Item in inventory
vestal thorn
#

A lot of people have been tell me to do this:

ItemStack.addLore(["line1","line2","line3"])
vestal thorn
vestal thorn
wary edge
#

You should try learning Scripting.

vestal thorn
#

Its pretty confusing

wary edge
vestal thorn
#

I'm looking at it, and I don't get it? I see getItem but how do I grab the entity?

wary edge
#

What are you trying to do is my question.

#

How will the player obtain this item?

vestal thorn
#

Just from the creative inventory/a mob loot/recipe/ basically anyway you can get a item the lore will be there

wary edge
#

Yeah that's not really feasible. You can only do it when it's in the world and not just UI.

#

For loot you can use loot table's functions. As for the rest, you probably want to do a system.run then loop through the inventory and if there isn't lore add the lore. Or alternatively if it's a custom item just use \n in the display_name.

wary edge
#

They likely used the methods I mentioned.

vestal thorn
#

But the lore appears in the creative inventory when you hover or it

wary edge
#

Then they used the second method I described.

vestal thorn
#

You said that you can't do that?

#

Oh

wary edge
#

Or alternatively if it's a custom item just use \n in the display_name.

vestal thorn
wary edge
#

That's just how it is.

vestal thorn
#

What does it do? Does it make it work or something else?

#

Sorry if I'm bothering you a lot

#

I'm just a bit confused

wary edge
#

Yeah it sets the Item into the inventory. That's just how it is.

vestal thorn
winged gull
sharp elbow
#

Depends on how the ItemStack instance is prepared. It is possible to do both:

  • Adding an item involves creating an ItemStack instance out of thin air, via the new keyword (like Smokey described earlier). Then the lore is set, and later is added into the inventory.
  • Changing an item requires first grabbing an ItemStack instance from within the inventory first. Then the lore is set, and later can be set back to the slot in which it came.
pseudo timber
#

anyone help

wary edge
#

The only instances where an ItemStack does not have to be set back is for beforeEvents if I recall. Specfiically for the Custom Components one.

sharp elbow
# vestal thorn Its pretty confusing

It can be. There are some hoops you need to jump through to grab the data you wantβ€”in this case, grabbing an item off the player involves:

  1. Grabbing the player
  2. Grabbing the "inventory" component
  3. Grabbing the container
  4. Grabbing the slot
  5. Grabbing the item
winged gull
#
MDN Web Docs

The JavaScript reference serves as a repository of facts about the JavaScript language. The entire language is described here in detail. As you write JavaScript code, you'll refer to these pages often (thus the title "JavaScript reference").

Landing page containing a high-level introduction of Script APIs for Minecraft: Bedrock Edition.

drifting ravenBOT
#
Learn JavaScript

As the Script API is a framework built on JavaScript code, having an understanding of JavaScript is key.

If you are being shown this, then you most likely are a beginner with JS and could use a little guidance.

Videos on Learning JavaScript
Javascript in 1 hour
Javascript Classes in 1 hour

Web Guide:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide

Reference Sites:
https://www.w3schools.com/jsref/default.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
https://javascript.info

winged gull
#

oh lol I didn't realize there was a command for it, I was just listing the websites I used to teach myself javascript and the minecraft scripting api

sharp elbow
#

Where it being JavaScript becomes relevant is understanding how data in the API is exposed. All data in the API, except of the most atomic kind like primitives (numbers, strings of text) and interfaces (a la objects), are classes of some kind. A function in one class may return another kind of class; the Player class' getComponent("inventory") method returns an EntityInventoryComponent class, which happens to be an extension of a more general EntityComponent class, and so on up the chain.

distant gulch
#

Anyone know how I could constantly update a scoreboard in scripts..

#

I thought about just constantly deleting and re adding the scoreboard but idk

true isle
#

is their any way to simulate a warped or crimson tree using the tree feature?

slow walrus
# pseudo timber anyone help

no one can help you beacuse they have no clue what you're asking for. All you've showed is two screenshots with zero code, and said you can't do something.

leaden walrus
#

system.runTimeout doesnt work, does someone have another solution ?

import { BlockPermutation, ItemStack } from "@minecraft/server";
import {  addItemOrSpawn } from '../util/utils';

export class FryingPan {
  onPlayerInteract(e) {
    const { player, block, dimension } = e;
    const itemInHand = player.getComponent("inventory").container.getItem(player.selectedSlotIndex);
    const detailBlock = block.typeId.split("_fryingpan_")[0]; 
    const typeBlock = detailBlock.split(":")[1];
    const stateBlockId = block.typeId.split("_fryingpan_")[1];
    const stateBlock = Number(stateBlockId);
    player.sendMessage(`Entered`);
    player.sendMessage(`${typeBlock}`);
    player.sendMessage(`${stateBlock}`);

    switch (typeBlock) {
      case "empty":
        const newItem = itemInHand.typeId.split(":")[1];
        player.sendMessage(`Entered empty`);
        player.sendMessage(`${newItem}`);
        block.setPermutation(BlockPermutation.resolve(`custom:${newItem}_fryingpan_1`));
        player.sendMessage(`Entered empty check`);
        player.runCommandAsync('playsound random.pop @s ~ ~ ~ 0.2');
        if (!isCreative(player)) decrementItemInHand(player);
        timeout1 = system.runTimeout(() => {
          block.setPermutation(BlockPermutation.resolve(`custom:${newItem}_fryingpan_2`));
       }, 20 * 3); 
        timeout2 = system.runTimeout(() => {
          block.setPermutation(BlockPermutation.resolve(`custom:burn_fryingpan_3`));
       }, 20 * 3); 
        break;
  
      case "sliced_beef":
        if(stateBlock === 2) {
            addItemOrSpawn(player, new ItemStack("custom:cooked_sliced_beef", 1));
            block.setPermutation(BlockPermutation.resolve(`custom:empty_fryingpan_0`));
        }
      case "burn":
        if(stateBlock === 3) {
          addItemOrSpawn(player, new ItemStack("custom:burned", 1));
          block.setPermutation(BlockPermutation.resolve(`custom:empty_fryingpan_0`));
      }
    }

  }
}
leaden walrus
leaden walrus
#

Does it come from minecraft/server ?

tiny tartan
leaden walrus
#

ok thanks

leaden walrus
#

Also, is it possible to cancel a runTimeout with a second click of the player ? Like I click one time, it triggers the runTimeout, and then, I click a second time and it triggers a clearRun

remote oyster
leaden walrus
remote oyster
leaden walrus
#
import { BlockPermutation, ItemStack, system } from "@minecraft/server";
import {  addItemOrSpawn, isCreative } from '../util/utils';

export class FryingPan {
  onPlayerInteract(e) {
    const { player, block, dimension } = e;
    const itemInHand = player.getComponent("inventory").container.getItem(player.selectedSlotIndex);
    const detailBlock = block.typeId.split("_fryingpan_")[0]; 
    const typeBlock = detailBlock.split(":")[1];
    const stateBlockId = block.typeId.split("_fryingpan_")[1];
    const stateBlock = Number(stateBlockId);

    switch (typeBlock) {
      case "empty":
        const newItem = itemInHand.typeId.split(":")[1];
        block.setPermutation(BlockPermutation.resolve(`custom:${newItem}_fryingpan_1`));
        player.runCommandAsync('playsound random.pop @s ~ ~ ~ 0.2');
        if (!isCreative(player)) decrementItemInHand(player);
        system.runTimeout(() => {
          block.setPermutation(BlockPermutation.resolve(`custom:${newItem}_fryingpan_2`));
       }, 20 * 10); 
        const burning = system.runTimeout(() => {
          block.setPermutation(BlockPermutation.resolve(`custom:burn_fryingpan_3`));
       }, 20 * 20);
        break;
  
      case "sliced_beef":
        if(stateBlock === 2) {
            system.clearRun(burning);
            addItemOrSpawn(player, new ItemStack("custom:sliced_beef", 1));
            block.setPermutation(BlockPermutation.resolve(`custom:empty_fryingpan_0`));
        }
      case "burn":
        if(stateBlock === 3) {
          addItemOrSpawn(player, new ItemStack("custom:burned", 1));
          block.setPermutation(BlockPermutation.resolve(`custom:empty_fryingpan_0`));
      }
    }

  }
}
leaden walrus
# remote oyster Show an example

when my block is "empty", it starts the runTimeout. Then, when the block becomes "sliced_beef", I want to clearRun the second runTimeout by clicking on the block

remote oyster
# leaden walrus when my block is "empty", it starts the runTimeout. Then, when the block becomes...

The issue you're encountering is that the burning variable is defined within a specific scope, meaning it is lost once that scope ends. As a result, when you click again for "sliced_beef", burning is undefined, and nothing happens. To resolve this, you have a couple of options: you can either make burning a global variable, allowing it to persist across different invocations in your script, or you can modify your class to add burning as a property. The second approach is generally recommended, as it keeps your code organized and avoids potential conflicts with global variables, allowing each instance of the class to maintain its own state.

leaden walrus
remote oyster
# leaden walrus thanks ! How do I define burning as a property ?
import { BlockPermutation, ItemStack, system } from "@minecraft/server";
import { addItemOrSpawn, isCreative } from '../util/utils';

export class FryingPan {
  constructor() {
    this.burning = null; // Initialize burning as a property
  }

  onPlayerInteract(e) {
    const { player, block } = e;
    const itemInHand = player.getComponent("inventory").container.getItem(player.selectedSlotIndex);
    const detailBlock = block.typeId.split("_fryingpan_")[0]; 
    const typeBlock = detailBlock.split(":")[1];
    const stateBlockId = block.typeId.split("_fryingpan_")[1];
    const stateBlock = Number(stateBlockId);

    switch (typeBlock) {
      case "empty":
        const newItem = itemInHand.typeId.split(":")[1];
        block.setPermutation(BlockPermutation.resolve(`custom:${newItem}_fryingpan_1`));
        player.runCommandAsync('playsound random.pop @s ~ ~ ~ 0.2');
        if (!isCreative(player)) decrementItemInHand(player);
        system.runTimeout(() => {
          block.setPermutation(BlockPermutation.resolve(`custom:${newItem}_fryingpan_2`));
        }, 20 * 10);
        this.burning = system.runTimeout(() => {
          block.setPermutation(BlockPermutation.resolve(`custom:burn_fryingpan_3`));
        }, 20 * 20);
        break;

      case "sliced_beef":
        if (stateBlock === 2) {
          if (this.burning) {
            system.clearRun(this.burning); // Clear the previous timeout
            this.burning = null; // Reset burning after clearing
          }
          addItemOrSpawn(player, new ItemStack("custom:sliced_beef", 1));
          block.setPermutation(BlockPermutation.resolve(`custom:empty_fryingpan_0`));
        }
        break;

      case "burn":
        if (stateBlock === 3) {
          addItemOrSpawn(player, new ItemStack("custom:burned", 1));
          block.setPermutation(BlockPermutation.resolve(`custom:empty_fryingpan_0`));
        }
        break;
    }
  }
}
#

To create a property for burning in the FryingPan class, you start by adding this.burning = null; in the constructor. This way, you're setting up burning as a property that belongs to the class. Then, when you get to the "sliced_beef" case, you check if this.burning is still active before trying to clear it. This makes sure you don't run into any issues. After clearing the timeout, you reset this.burning to null to show that there's no active burning state anymore. This approach helps keep everything organized and makes sure each instance of FryingPan can manage its own burning status without stepping on each other's toes.

leaden walrus
#

Okay okay, thanks ! I'll try this

remote oyster
leaden walrus
drowsy scaffold
#

what's the best way to store scores that I'm gonna be accessing every ~3-4 ticks?

#

all of my "scores" are dynamic properties, if that helps

sharp elbow
#

I imagine dynamic properties are optimized to be accessed, yet it's still an API call. Personally I would only be updating their values when I know I need them stored, like when a player logs out or when the world closes.

sharp elbow
#

The world state will probably not be saved anyway. You notice how you might lose some progress when the game crashes?

wheat condor
sharp elbow
#

That may be how often you feel comfortable saving your dynamic properties, then πŸ™‚

halcyon phoenix
#

where can I find that sample for itemUse?

#

found it

#

it's in wolrdafterevents

#

why can't I use "if" in itemuse afterEvent

#

I forgot I have to do the prefix "minecraft"....

bronze pulsar
#

Is it possible to create an entity that is completely invisible (cannot be hit and doesn't get in the way of placing blocks)

sage sparrow
#

can this listen to messages event on the server without need to create bedrock client?

fallen cape
#

any way to teleport an entity to player so fast that it's not being late? (so it accurately depicts player position)

wispy iron
#

The break block event has a block property

#

The block has .x, .y, and .z

#

As well as a .location

carmine yarrow
#

Hey, is there an event that detects when a block is placed but not by a player ?
Something like

  • enderman placing block
  • cobblestone generating from lava and water
    etc ?
warm mason
tawny jungle
#

Is there a good reliable way to detect when a dispenser dispenses an item?

wispy iron
#

just execute at the location and then run your positional commands

hardy tusk
#

execute positioned x y z run ...

wispy iron
distant tulip
#

what is your goal?
some stuff don't need commands

mellow jolt
#

InputPermissionCategory ? Movement: 2 ?

distant tulip
#

is that a question or what?

mellow jolt
#

Stop all animation ?

tawny jungle
mellow jolt
#

😭

wispy iron
#

I think the focus is on the input apis now

thorn flicker
thin steeple
# wispy iron

they should add these to platform information:

device's current fps
ip address (only available if you were using the server-net module)
max storage (not ram. the actual storage like ssd, hdd, sd card)
ping

#

but the current stuff is already awesome

wispy iron
#

FPS would be nice to for on the fly adjustment

thin steeple
wispy iron
#

Very excited there

thorn flicker
#

lmao

thin steeple
thorn flicker
#

I dont want people grabbing my ip.

#

no thanks

thin steeple
#

i do

distant tulip
thorn flicker
thin steeple
#

left click detection would complete addons

thorn flicker
#

even right click detection would be nice

thin steeple
#

its not that needed since we have item, block, and entity click events

#

but its nice to click on nothing

thorn flicker
#

im aware

thin steeple
thorn flicker
thin steeple
thorn flicker
thin steeple
thorn flicker
#

like a dash ability, idk

#

that would probably be better if we can detect other keys

distant tulip
#

doing that while supporting multiple platforms is a challenge

thin steeple
#

the challenge is the bugs

#

adding it shouldnt be too hard tho

thorn flicker
#

there's a concern for keyloggers too

distant tulip
#

yeah
unnecessary concern (i think?)

thorn flicker
#

which I kinda understand why there is but it still makes me sad.

#

I hope they add it regardless.

remote oyster
thorn flicker
#

I just, still dont want addons grabbing my ip? lol

wispy iron
thorn flicker
wispy iron
# thorn flicker Mojang

ah, tbf microsoft doesn't need to use minecraft if they can just take a screenshot of your computer every 5 seconds for AI (thank god that was canceled lmao)

thorn flicker
#

lmao

#

I heard about that

wispy iron
#

execs smoking some shit fr

thorn flicker
#

lolll

mystic mortar
# wispy iron execs smoking some shit fr
const invalidItemNames = [
    "bricks", "slab", "chest", "table", "log", "block", "snow", "head", "skull", "carpet", "door", "stair", "chair", "anvil", "brew", "wall", "sign", "cracked", "slate", "gate", "egg", "bell", "wool", "glazed", "banner", "ore", "cobblestone", "stone", "box", "cake", "vine", "skulk", "clay", "cobbled", "copper", "heart", "crafter", "dispenser", "dropper", "rail", "lamp", "lectern", "path", "obsidian", "frame", "eye", "splash", "charge", "steel", "beacon", "furnace", "smoker", "moss", "pot", "candle", "boat", "spawn", "vault", "banner", "carpet", "button", "torch", "hook", "tnt", "redstone", "planks", "fence", "plate", "stripped", "camp", "lava", "water", "ice", "magma", "coral", "bucket", "wrench", "debug", "light", "sand", "glass", "stem", "end", "button", "piston", "carpet", "wax", "amethyst"
  ];```

Using playerInteractWithBlock, I'm trying to filter out any click event where the player is holding a block or something that naturally interacts with stairs or slabs ingame. This use typeID includes.

Any suggestions on what I should add to it?
abstract cave
#

is there a way to cancel the damage done on player durability during a break or hit event

abstract cave
# wary edge Custom item?

i meant durability in general, like if i break a block with a vanilla shovel, can i cancel the damage done on the durability

shy leaf
#

how can i make tamed wolves to target an entity the player attacks? wolves somehow wont track targets if the player's attack wasnt direct

#

applyDamage also doesnt work for targeting

shy leaf
#

no, for some reason

wary edge
# shy leaf

Ok...I have many questions, what does toggle addon do different then vanilla?

shy leaf
#

to put it short, it disables direct damage from player and replace it with applyDamage

shy leaf
#

by putting a huge negative number in player entity's attack component

#

(it works somehow lmao)

wary edge
#

Ok now I'm curious, does doing /damage work? Vanilla.

shy leaf
#

let me check

wary edge
#

Intriguing.

abstract cave
# shy leaf

if this is a tablet, how do you have many tabs open at once

shy leaf
abstract cave
shy leaf
#

enter and tab keys

elder heath
#

perfect

shy leaf
#

the downside is

#

i cant find mixed tabs and spaces easily

abstract cave
shy leaf
#

nah ill stick to quickedit

#

i paid for it so

abstract cave
exotic raptor
#

🎡 I NEED A HERO 🎡

mellow jolt
#

playAnimation(animationName: string, options?: PlayAnimationOptions): void

#

Stop animation ??

#

stopExpression is used to stop the animation that I am launching and not an animation already launched or am I making mistakes?

fallow rivet
#
function addench(player) {
const i = player.selectedSlotIndex;
const inv = player.getComponent("inventory").container;
const item = inv.getItem(i);   
const enc = item.getComponent("enchantable").getEnchantments();
    for (let i = 0; i < enc.length; i++) {
console.warn(enc.type.id)
}
}

Not work , why?

sharp elbow
wheat condor
#

enc is an array and at console.warn() you re getting a type from the array
you should do

console.warn(enc[i].type.id)
north depot
#

Helloo,
what is better or efficient, making the more scripting files with tiny codes, or putting all the codes in one big single file?

north depot
#

thanks!

static nebula
#

Can someone help me? How do I get the device the player is playing on and add a tag with the device name?

static nebula
mellow jolt
thin steeple
#

it also helps me sort things out based on what i wanna work on

junior hill
#

[Scripting][error]-Unhandled promise rejection: TypeError: cannot read property 'beforeItemUseOn' of undefined

[Scripting][error]-Plugin [test_blaster BP - 1.0.0] - [index.js] ran with error: [TypeError: cannot read property 'beforeItemUseOn' of undefined    at <anonymous> (test.js:17)
]```Why am i getting this error?
#

did i not import or is my manifest for minecraft/servers needs to be a specfic version?

valid ice
#

manifest verion issue?

junior hill
# valid ice manifest verion issue?
{
    "format_version": 2,
    "header": {
        "description": "test_pack",
        "name": "test_blaster BP",
        "uuid": "ecb74745-bfc1-483f-8904-2423a755ea56",
        "version": [
            1,
            1,
            1
        ],
        "min_engine_version": [
            1,
            21,
            1
        ]
    },
    "modules": [
        {
            "description": "pack.description",
            "type": "data",
            "uuid": "96d8494a-2431-4e8b-a08e-3978ee2ec57b",
            "version": [
                1,
                1,
                1
            ]
        },
        {
            "entry": "scripts/index.js",
            "type": "script",
            "uuid": "b4744624-8a95-4699-a65e-f95fce5be59b",
            "version": [
                1,
                0,
                0
            ]
        }
    ],
    "capabilities": [ "script_eval" ],
    "dependencies": [
        {
            "module_name": "@minecraft/server",
            "version": "1.15.0"
        },
        {
            "module_name": "@minecraft/server-ui",
            "version": "1.3.0"
        }
    ],
    "metadata": {
        "generated_with": {
            "bridge": [
                "1.8.5"
            ]
        }
    }
}

this it

#

it is up to date to my knowledge

valid ice
#

What's your code?

junior hill
# valid ice What's your code?

const BLOCK_IDENTIFIER = "JCTbuild:coppercornerangle";
const MAX_SPIN = 15;

function rotateBlock(block) {
    let spinValue = block.getBlockData().getProperty("JCTbuild:spin");
    let newSpin = (spinValue + 1) % (MAX_SPIN + 1);
    let permutation = BlockPermutation.create(block.type, { "JCTbuild:spin": newSpin });
    block.setPermutation(permutation);
}

world.events.beforeItemUseOn.subscribe((event) => {
    const { source: player, block } = event;
    if (block.typeId === BLOCK_IDENTIFIER && player.isSneaking) {
        rotateBlock(block);
    }
});
valid ice
#

ah, world.events is not a thing anymore

junior hill
valid ice
#

world.afterEvents or world.beforeEvents

#

world.events hasn't been a thing since like, 1.19

thin steeple
slow walrus
#

it is AI

thin steeple
#

people can code a certain way similar to ai and it not be ai

#

you never know if he knew world.events didn't exist anymore

slow walrus
#

nope that's definitely AI

#

there's other parts that the AI has hallucinated

thin steeple
slow walrus
#

I'm not assuming every time

thin steeple
#

you did this time

slow walrus
#

is this time every time?

thin steeple
#

it's part of every time

slow walrus
#

but it's not every time is it

spring dove
#

there's no removeItem function?

thin steeple
thin steeple
slow walrus
spring dove
#

the problem its that i wanted to decrease the quantity of items

slow walrus
thin steeple
#

i like it that way tho

slow walrus
slow walrus
thin steeple
slow walrus
#

show me then

thin steeple
#

no

#

im not going that far

#

you've implicitly assumed code was ai generated.

remote oyster
slow walrus
wary edge
thin steeple
slow walrus
thin steeple
slow walrus
#

yes

#

that's how it works

thin steeple
#

no

thin steeple
slow walrus
#

if you can't show evidence, you can't say it's the truth

remote oyster
thin steeple
slow walrus
#

it's right there in the code

valid ice
#

Both of you cut it out, it legitimately does not matter

remote oyster
slow walrus
#

even if it's not enough evidence, I didn't explicitly state they used AI anyway, I simply said "don't use AI".

#

I could say "dont use AI" to anyone

thin steeple
slow walrus
#

ok how much is enough then

#

enlighten me so I don't make this mistake again

thin steeple
slow walrus
#

ok, give me a second

remote oyster
# thin steeple 2 - 3 sentences on why they could be using AI, and why they shouldn't

If the code references outdated methods like world.events that are no longer valid in the current API, it could indicate a lack of understanding of the latest standards. This is a common issue with AI-generated code, as it might not always be up-to-date with recent changes in libraries or frameworks. Such inaccuracies can further support the argument that the code may have been generated rather than written by someone familiar with the current environment.

#

Please note "may have".

slow walrus
# thin steeple 2 - 3 sentences on why they could be using AI, and why they shouldn't
  • let spinValue = block.getBlockData().getProperty("JCTbuild:spin");
    Block.getBlockData doesn't exist, never has existed. Obviously an AI hallucination. Likewise getProperty on whatever that should return also doesn't exist.

  • let permutation = BlockPermutation.create(block.type, { "JCTbuild:spin": newSpin });
    BlockPermutation.create() also doesn't exist. AI hallucination

  • world.events.beforeItemUseOn.subscribe
    hasn't existed for a long time, so they've used an AI with old training data

#

haha actually yk what

#

block.getBlockData is a spigot function

thin steeple
# remote oyster If the code references outdated methods like world.events that are no longer val...

sure the world.events is outdated, but you cant underestimate people. he might've not scripted for a while, and still thought that events were still used like that after coming back. AI makes mistakes like the ones you pointed out, but anyone could accidentally make that mistake. ive seen people used methods that don't exist, and their code wasn't AI at all.

you shouldn't almost automatically assume that their code is AI generated, they may be a Java player who works with spigot or some other server tool. some of this code probably was AI generated, but probably not all.

#

sorry if im a little slower at typing, im on a mobile device after all.

thin steeple
slow walrus
#

I highly doubt that

random flint
#

Ngl, I do think the code was AI generated

slow walrus
#

Occam's Razor

remote oyster
#

Classic

valid ice
#

MOVE ON FOLKS

thin steeple
junior hill
#

i use ai to get familar with topics, they are wrong but now ik what to look for

#
[Scripting][error]-ReferenceError: Native function [Block::setPermutation] does not have required privileges.    at rotateBlock (test.js:16)
    at <anonymous> (test.js:25)```
```import { world, BlockPermutation, EquipmentSlot } from '@minecraft/server';

const maxSpin = 15;

function rotateBlock(block) {

    const currentState = block.permutation.getState("JCTbuild:spin");
    let spinValue = currentState || 1;


    let newSpin = (spinValue % maxSpin) + 1;


    const newPermutation = block.permutation.withState("JCTbuild:spin", newSpin);

    block.setPermutation(newPermutation);
}

world.beforeEvents.itemUseOn.subscribe((event) => {
    const { source: player, block } = event;

    const mainhand = player.getComponent("equippable").getEquipment(EquipmentSlot.Mainhand);

    if (player.isSneaking && mainhand?.typeId === "minecraft:wooden_sword") {
        rotateBlock(block);
    } else {
        console.log("Rip.");
    }
});
```Anyone knows what this error means?
shy leaf
shy leaf
#

wrapping the function with system.run() will make the code to run

shy leaf
#
system.run(() => rotateBlock(block))```
or
```js
system.run(() => {
    rotateBlock(block)
})```
wanton ocean
#

how could i loop whats in here 20 times?
js if(player.hasTag('rabbit_escape_tamed')){ const entity = player.dimension.spawnEntity('jjk:shikigami_projectile_dummy' , player.getHeadLocation()); const projectile = entity.getComponent('projectile'); projectile.owner = player; projectile.shoot(player.getViewDirection()) entity.runCommandAsync("event entity @s rabbit_escape") cooldown.startCooldown(player) }
I forgot and don't wanna type it 20 times with different constant names 😭

#

like looping for x amount of times basically

#

πŸ₯Ί

random flint
random flint
#

it'll shoot all of it in the same tick tho

wanton ocean
slow walrus
#

wait nvm saw it's already been answered

abstract cave
#

Is there a way to get an entity that died

#

before or after events

mystic mortar
slow walrus
#

event

#

after event iirc

dim tusk
#

I know seems impossible I want to be able cancel damage using SCRIPTS only

shy leaf
#

not sure if you know it but

#

putting a huge negative value in attack component can cancel the damage

#

it does use player.json but just saying

distant tulip
wheat condor
sharp elbow
#

If one chooses to use an IDE that provides those suggestions, then sure.

#

Not everyone does though, so oftentimes it looks like people engage in guesswork. That does not often work

distant tulip
halcyon phoenix
sharp elbow
#

An entity will always occupy blocks. The only way to make it completely intangible is to make it an AOE cloud.

strong oar
#

Guys can I ask, what code to fill with this.

Const tool = (the item that was in the mainland of the player)

#

*mainhand

strong oar
#

When I put it switch ,should it be like 'minecraft:stick' or just 'stick'

thorn flicker
strong oar
#

Ohh thanks

thorn flicker
#

I would just put minecraft: anyway

granite badger
warm mason
#

Mojang moment

graceful mountain
graceful mountain
# warm mason ?

on the error log see after enchantment instance - Tyring to set enchantment level to 2,

warm mason
#

Actually funny.. An official error is issued after checking whether it is possible to add an enchantment and says that she is tired of adding enchantments.

abstract cave
#

Is there a way to make an entity load the chunk its in

valid ice
#

Ticking component in entity behavior

idle dagger
#

Do if (!initialSpawn) detect player first spawn or spawn after he died?

thorn flicker
thin steeple
#

if omniac up for it, ill be glad to argue again

alpine nebula
#

Is there a way to get query.time_of_day data in scripting?

#

I want to make clock block.

strong oar
#

guys why my custom component for updating block_states doesnt work, i just want to make it that if the player is holding a stick on the mainhand and click the block. The block state will be updated

valid ice
#

minecraft:stick

#

namespace is needed

strong oar
#

I tried 'minecraft:stick' and still no changes

proud cliff
#

Try tool.typeId in your switch argument

slow walrus
thin steeple
slow walrus
thin steeple
#

i know the method names seem specific like how ai would use them, but really anyone can make the mistake of using a fake method

remote oyster
# thin steeple i know the method names seem specific like how ai would use them, but really any...

I'm not convinced that someone who uses auto completion, whether their packages are outdated or not, would use a non existing method since there would be no auto completion for it. Would be an illogical thing to do even for someone who is limited on what the API may offer, since this conversation established they are dependent on auto completion to assist them as they write the code. Besides, assuming they do not use auto completion, they wouldn't have been able to write a portion of their code without some knowledge and references to the API, therefore demonstrating their ability to read and understand it to some degree, and thereby determining if such methods did in fact exist since their code showed evidence that they would have used a reference for the API. Omniac is correct that the errors would have been sufficient in the initial tests to show they were incompatible.

Whether they understood what the errors meant or not is an entirely different discussion.

scarlet lynx
#

1.20.50 we can finally stop horion crashes

#

And detect who sent em

thin steeple
# remote oyster I'm not convinced that someone who uses auto completion, whether their packages ...

im not convinced either, but that wasn't the point of the conversation. it was that people can make mistakes, and not everything is ai. in this case the code probably was generated with some ai software. but i started the argument because people dont always use ai. i personally dont think the old npm package auto completion used the methods that were non existent as proven. but im saying anyone can make a simple mistake of using a non existent method. i would type a lot more, but i dont have the time right now. omniac was indeed correct at some parts, but not all. i too have seen ai code and know what it looks like.

remote oyster
scarlet lynx
remote oyster
scarlet lynx
#

Well it’s with server-net

slow walrus
# thin steeple no it's not, they could be using an outdated npm as well as non existent methods...

If they had the old npm packages, and they were using autocomplete, then,

  • They would have used the old event syntax
  • But they wouldn't have used the non-existent methods (because they'd be errored out)

OR, if they didn't have the packages, and they were using the correct packages,

  • They wouldn't have used the old syntax
  • They also wouldn't have used the non-existent methods, (again they'd have errors)

OR, if they weren't using any packages at all,

  • They would have had to look at the docs to see what they needed, in which case they would've used the correct syntax, since the official docs are always on the latest version
  • They wouldn't have used the non-existent methods, since they aren't in the docs

SO in conclusion the only way that they would have done this, is either,

  • If they were high on the zaza and imagining things
  • Or if it's simply just an AI, which has had it's training data mashed together from scraped data from the web, so it mixed up the old syntax, with methods from spigot, probably because the user prompted something like "write a script to get the block data for minecraft", without specifiying versions, or APIs. And that's assuming that the AI still wouldn't hallucinate with the correct specifications, which it usually does.
prisma shard
#

@granite badger

#

i need it real quickk 😭

#

what happen to bot

#

bruh

quick shoal
#

Anyone who have the chest Gui addons?

shy leaf
quick shoal
shy leaf
quick shoal
#

I don't want this

#

What I need is a real container gui

#

Not a Gui that mimic the chest

random flint
#

not yet

valid ice
#

Not multiplayer friendly, and very annoying to edit

quick shoal
#

HEY EVERYONE JAYLY BOT BACK

sage portal
#

looks like I should have double tapped

prisma shard
#

i dont see the addTag method

valid ice
#

They’re a static thing

prisma shard
#

so i would i

#

do

valid ice
#

Not editable outside of the json

prisma shard
#

bruhhhhhhhhh

valid ice
#

Use dynamic properties, it’s what they’re for

prisma shard
#

how can i get the list of tags the item has?

valid ice
#

getTags or something, idk

prisma shard
#

as an array

prisma shard
velvet swallow
#

How to detect when a player is in a moving minecart?

prisma shard
#

woooo

#

minecraft:wooden_tier

#

is_digger

valid ice
#

Ok

prisma shard
#

is_axe

prisma shard
#

to detect if player moving you can do:

if (player.getVelocity() != 0) {
  //returns true/false
}
#

there might be molang for if player is in minecart

distant gulch
prisma shard
#

@valid ice

#

why my script not working

prisma shard
# distant gulch <@1107163750781440021> ```js // <player> implements a player const ridingOnEnt...
import { EquipmentSlot, system, world } from "@minecraft/server";

// List of the animals that will recieve double damage
const Animals_List = [
    "minecraft:pig"
];

// A function to make the animale recieve double damage
function doubleDamage(damage) {
    return damage * 2
}

world.afterEvents.entityHurt.subscribe(({ damageSource, hurtEntity, damage }) => {
    // Get the item 
    const itemStack = damageSource.damagingEntity.getComponent("minecraft:equippable").getEquipment(EquipmentSlot.Mainhand);
    // Check if the weapon has the tag "axe"
    if (itemStack && itemStack.hasTag("minecraft:is_axe")) {
        // Check if the hitted animale is in the list
        if (Animals_List.includes(hurtEntity.typeId)) {
           // Get the applied damage and double it using the function
           const newDamage = doubleDamage(damage);
           // and then apply it
           hurtEntity.applyDamage(newDamage);
        }
    }
})```
#

help

#

my script is not working

#

whyy

distant gulch
#

what isnt woring

prisma shard
#

the entity will recieve double deamage

#

but it doesnt recieve double damage

distant gulch
#

okay ill take a look over it

prisma shard
prisma shard
distant gulch
#

lets dm

prisma shard
#

kjo

#

ok

warm mason
#

Are you sure that all conditions are met?

#

By the way, your damage is 3X, not 2X

prisma shard
#

yes that i want

prisma shard
warm mason
#

ok

prisma shard
#

you seee the script

warm mason
#

Most likely it doesn’t work because when you deal damage, a certain cooldown begins and while it lasts you cannot deal damage. That is, you need to wait a while for it to deal damage again

thin steeple
dim tusk
#

You still love pinging people πŸ˜†

slow walrus
#

anyway you can't just slap random stuff together from nowhere, they would've had to have some sort of knowledge about the methods etc to even start writing, if it were the case that they didn't have autocompletions

thin steeple
slow walrus
thorn flicker
#

I've dealt with people making "guessing" code before

#

are they weren't using AI

slow walrus
thin steeple
thin steeple
slow walrus
#

eh it was more just a general term, "you" as in anyone

thorn flicker
queen prism
#

Hello everyone. I'm struggling with implementing 3 riding anims for my jane mob. Any help is appreciated.

#

I'll just send the scripting parts

#

Wait

thorn flicker
slow walrus
#

animations?

queen prism
#

No like

thorn flicker
#

you could trigger animations with scripts. sure

#

but

thin steeple
thorn flicker
#

I sent that as soon as he sent his message.

thin steeple
#

i read faster than you typed that

queen prism
#

Here

#

So far, I can only execute the anims using the event command

thorn flicker
queen prism
#

Exactly

thorn flicker
#

I was going to suggest properties if not

#

nice.

thorn flicker
queen prism
#

I want them to work.

#

But I got no idea how to

thorn flicker
#

you shouldnt use scripting

queen prism
#

So maybe some people who know scripting better than I do would.

#

Oh

#

?

thorn flicker
#

you just need animation controllers lmao

queen prism
#

Oh my god

#

Lol

#

#add-ons

Mind if you show me how to in this channel?

untold magnet
#

guys, how can i use InputButton thing?

#

also is it possible to open the entity inventory using it??

untold magnet
#

I'm just curious, is there any way to open the entity inventory without interacting with it?

amber granite
#

Is there only two ? Buttons

#

@cold grove

cold grove
amber granite
#

Ok

misty pivot
#

it says cannot read property registerCustomComponent of undefined

world.beforeEvents.worldInitialize.subscribe(event => {
    event.blockTypeRegistry.registerCustomComponent("vm:potato_pie", new PotatoPie())
})```
amber granite
#

Youw wassup

shy leaf
misty pivot
#

alright, i got this from the microsoft docs

shy leaf
#

ow

amber granite
#

{ onTick : (e)=> {} } ;

#

@misty pivot

#

What inside PotatoPie

misty pivot
#

oh that part is already working, since it's a class with the thingie in the constructor cant really explain

misty pivot
amber granite
#

._.

misty pivot
#

yeah sorry πŸ˜…

amber granite
#

Ok np

misty pivot
#

but is this how you check if a block has a specific permutation?

if (block.permutation.getState("example:test")) {
    ...
}```
amber granite
#

Idk , i didn't script for a while

#
  • never use it before so lol
misty pivot
#

i just added != undefined

#

it worked

prisma shard
untold magnet
grim raft
#

yo whats the command to see whats wrong with a script

cold grove
untold magnet
valid ice
#

No it's not possible

deft nest
#

@valid ice I have a question, is it possible to write items and lore in the creative inventory?

valid ice
#

Nop

distant gulch
#

Hey guys

#
return new ModalFormData()
    // likes: number
    .slider('Β§f\nΒ§8[Β§2LikesΒ§8] Β§eΒ§l ', likes, likes, likes, likes);

How can i like make that the slider can't be moved? i want it like that he stays at the start and just don't move, is that possible?


// implement this as a slider
[Likes] : 23
// Cant be moved, its constant on the edge
[x]=====================================
#

(Nervermind, i figured it out)

gaunt salmonBOT
amber granite
distant tulip
#

in case the state is 0 or false

junior hill
#

Any scripters here do commissions?

amber granite
#

Commissions ?

distant tulip
distant tulip
dim tusk
alpine nebula
#

Any ideas why my script outputs only AM and never goes to PM?

dim tusk
#

Didn't thought this was possible

#

Supposed to look like this, world.getTimeOfDay() >= 0 && world.getTimeOfDay() < 12000 right?

distant tulip
dim tusk
#

?

#

Also that's the reason I said didn't thought it was possible cause I'm not sure either lmao

alpine nebula
distant tulip
#

line 65
replace it with
if ((0 <= timeOfDay && timeOfDay < 6000) || (18000 <= timeOfDay && timeOfDay < 24000)) {

distant tulip
#

1 < 2 <3
will just turn into
true < 3

alpine nebula
#

That worked, thank you guys.

distant tulip
#

np

dim tusk
distant tulip
distant tulip
dim tusk
#

Not script related but I found a way to increase the NPCs button

#

Yeah, I did it last year I just don't share it cause I know people don't use npc_interact screen anymore lmfao

thin steeple
dim tusk
thin steeple
dim tusk
# thin steeple yeah

But I used an editor that lets you add almost infinite amounts of button by editing it's data.

dim tusk
#

So fun to use lmao... I love that it doesn't flickers when you change forms...

thin steeple
#

wouldnt that affect performance

dim tusk
#

But I don't lag and I only added 10-15 buttons yet

near siren
#

When transferring items to the player's inventory, is there a way to prevent the items from showing up as invisible?

thin steeple
#

?

#

they shouldnt be invisible

#

thats likely a problem with the item itself (like the resource pack)

near siren
#

I'm not using any resource packs, its weird

untold magnet
#

i already tested it out

dim tusk
untold magnet
#

he doesn't even have to use it

untold magnet
#

just <= 12000 will work from tick 0 ( sunset ) to 12000 ( sunrise )

#

wait

dim tusk
#

Backread first lmao

untold magnet
#

ah,

#

tick 12000 is the sunrise

untold magnet
dim tusk
#

He already said it's "AM" and "PM"... Backread gosh

distant tulip
#

he kinda right
there is not negative timeOfDay
0 <= timeOfDay this is not needed

dim tusk
#

I hate light mode

dim tusk
#
    return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)

def get_days_in_month(month, year):
    if month == 1:  # January
        return 31
    elif month == 2:  # February
        return 29 if is_leap_year(year) else 28
    elif month == 3:  # March
        return 31
    elif month == 4:  # April
        return 30
    elif month == 5:  # May
        return 31
    elif month == 6:  # June
        return 30
    elif month == 7:  # July
        return 31
    elif month == 8:  # August
        return 31
    elif month == 9:  # September
        return 30
    elif month == 10:  # October
        return 31
    elif month == 11:  # November
        return 30
    elif month == 12:  # December
        return 31
    else:
        return "Invalid month number."

def main():
    user_input = input("Type 'yes' to continue: ").strip().lower()
    if user_input == "yes":
        try:
            year = int(input("Enter the year: "))
            month = int(input("Enter the month number (1-12): "))
            days = get_days_in_month(month, year)
            if isinstance(days, int):
                print(f"The number of days in month {month} of year {year} is: {days}")
            else:
                print(days)
        except ValueError:
            print("Please enter a valid year and month number.")
    else:
        print("Exiting the program.")

if __name__ == "__main__":
    main()
#

My friend is so stupid in python he needs help with this

#

-# Not related to script

dim tusk
near siren
dim tusk
#

Anyways, I'm creating clipboard hahahaha.. I''ll be back next week

untold magnet
#

anyways

near siren
#

I feel like its a bedrock thing

thin steeple
strong oar
dim tusk
amber granite
#

Bro said

amber granite
dim tusk
amber granite
#

☠️ just don't try to learn it , u r had gonna shut down

dim tusk
#

I won't learn new language from now. Unless I got time...

amber granite
#

Yeah

#

Java is good

#

Python is fine

#

Html, js are easy

dim tusk
#

I need help for json UI lmao... I'll finish the modal form then problem the UI next and bg

#

Wait in the text field you can't put limit that like it's 10 characters only? Nope I'm not talking about hiding it like you can't realize type it

gaunt salmonBOT
hardy moat
#

I'm trying to create a custom form for Minecraft via main.js. However, when I try to use the listed items to activate it, it doesn't work. Does anyone know where the error is?

thin steeple
#

replace the customUI Β° with =
and change the tipeId in your event to typeId

hardy moat
thin steeple
#

any errors?

neat hazel
# hardy moat Ok here I have changed it but it still doesn't work
import { world } from "@minecraft/server"
import { ActionFormData } from "@minecraft/server-ui"

world.afterEvents.itemUse.subscribe((data) => {
  const player = data.source;
  if (player && data.itemStack.typeId === "minecraft:compass") {
    ui(player);
  }
  if (player && data.itemStack.typeId === "minecraft:clock") {
    customUi(player);
  }
});
function ui(player) {
  const form = new ActionFormData()
    .title("title Ui")
    .body("Body Ui")
    .button("button.1")
    .button("button.2")
    .button("button.3")
  form.show(player).then(r => {
    if (r.selection == 0) {
      player.sendMessage("Button Ui 1")
    }
    if (r.selection == 1) {
      player.sendMessage("Button Ui 2")
    }
    if (r.selection == 2) {
      player.sendMessage("Button Ui 3")
    }
  })
}
function customUi(player) {
  const form = new ActionFormData()
    .title("title customUi")
    .body("Body customUi")
    .button("button.1")
    .button("button.2")
    .button("button.3")
  form.show(player).then(r => {
    if (r.selection == 0) {
      player.sendMessage("Button customUi 1")
    }
    if (r.selection == 1) {
      player.sendMessage("Button customUi 2")
    }
    if (r.selection == 2) {
      player.sendMessage("Button customUi 3")
    }
  })
}
#

@hardy moat

hardy moat
#

Unfortunately this still doesn't work. Maybe someone knows what the error is in the script placement?

shy leaf
#

itll tell you errors

#

(alternatively, try deleting the pack from the world and activate it back)

hardy moat
#

I'm a newbie here

shy leaf
#

open settings, and check the tab with command block icon

#

and then turn on content logs GUI

shy leaf
shy leaf
hardy moat
#

Ok I will try it

#

I have tried all those ways but still not working and this came out

slow walrus
#

show your manifest

hardy moat
#

Is there any error?

slow walrus
#

add the server-ui module to your dependencies

hardy moat
#

Ok

#

Ok this work. Thank you

slow walrus
#

πŸ‘

idle dagger
#

How to close only player current form not all?

random flint
#

Open another form after you close it

idle dagger
#

I want to open another form first and close current form

random flint
#

can't dynamically update server form without the animation

dim tusk
#

Guys, I'm still correct that you can't access the form values if you close the form right? Using the ModalFormData

#

Looks I really need to edit the json UI of it so when player closed the form it will click the submit button

prisma shard
#

im always leik that xd

amber granite
#

Hail9

amber granite
#

Question

#

Can i overwrite dynamic proprety

dim tusk
halcyon phoenix
#

is it fine if I ask about MBE here?

slow walrus
halcyon phoenix
#

Yeah

#

im tryna mix it with scripting but I have no idea how he did the tnt part

halcyon phoenix
#

how do I check if an entity is alive. example:
I spawn an entity and use runTimeout and check if the entity if still alive.

thorn flicker
#

check if its greater than 0

halcyon phoenix
#

alright thanks

thorn flicker
#

try that instead

halcyon phoenix
#

alright

subtle cove
idle dagger
subtle cove
#

well, there's only that method rn, so no other method

#

u can prevent a form being shown multi times using time/tick

halcyon phoenix
#

I just found out that inside an event after getting an entity's health component and do a runTimeout the health component is still updated, so basically when an entity dies and that runTimeout triggers it gets the updated value not the past

subtle cove
#

cus the property is a getter bound to the health component of specific entity

#

thats the nature of getter property

#

u can cache such components actually

halcyon phoenix
#

how do I get the past? do I assign it outside the event block?

subtle cove
#

use entitytHealthChange event

halcyon phoenix
#

what are other options?

subtle cove
#
const hp0 = health.currentValue
system.runTimeout(() => {
  const hp1 = health.currentValue
}, 10)```
halcyon phoenix
#

I check for hp0 and still the same

subtle cove
#

adjust the tick time

halcyon phoenix
#

oh wait

#

that's not the full code

#

ima just explain it

subtle cove
#

define the number before the runTimeout

halcyon phoenix
#

the number?

#
mc.world.afterEvents.itemUse.subscribe((e) =>{
const entityHealth = entity.getComponent("health");


mc.system.runTimeout(() =>{    
                let durability = itemUsed.getComponent("durability");
                inventory.addItem(itemUsed);

                if (entity.isValid()) {
                    mc.world.sendMessage("1")
                    durability.damage = durability.damage - ( entityHealth.currentValue - entityHealth.defaultValue );
                    entity.remove();
                    
                }
                else {
                    mc.world.sendMessage("2")
                    durability.damage = durability.damage - entityHealth.defaultValue;
                };
            },200);
)};
#

basically this is what I was doing

#

the 2 doesn't get to check the defaultValue

distant gulch
#

Have anyone of you ever used Proxy or Reflect in a minecraft script?

distant gulch
#

search what up?

#

dont need to

subtle cove
#

here...

distant gulch
#

i just was wondering if anyone used it in here

#

ohhh my bad

subtle cove
#

the Reflect one isn't visible, but ive seen it been used here

distant gulch
#

Okay cool, btw:

#

Sometimes some functions arent available in mnicraft like bigInt or eval, you know how i can use them?

#

do i need to add a module or what?

subtle cove
distant gulch
#

hmm interesting

#

where can i find the list of all available Capabilities

distant gulch
#

Thanks you both

distant gulch
#

thanks

#

Sorry to bother you again but, i only can see these 4

subtle cove
#

;-; vscode ext

dim tusk
distant gulch
#

wanted to ask the same

subtle cove
#

@honest spear help ;-;

distant gulch
#

No, you got this M9

distant tulip
#

rare M9 moment

subtle cove
#

nah, haent touched that pbr thing tho

honest spear
#

Hello whats up?

#

some context please πŸ™

subtle cove
#

manifest capabilities like pbr

distant gulch
honest spear
distant gulch
honest spear
distant gulch
#

huh, i tought because sometime (in the past) i got an error while using it, probably my skill issue

distant tulip
#

they added support to it sometime ago

distant gulch
#

Nice

honest spear
distant gulch
#

Yes i know

honest spear
#

well then there is nothing more to say i guess

#

whats your usecase for BigInt?

distant gulch
#

Yep

#

Hmm, i dont really remember the reason for the usecase, i dont even know if anyone ever have used it in a minecraft script

distant tulip
amber granite
#

Or if u wanna count the total number of blocks in your world ☠️

honest spear
amber granite
#

I mean the exact number of blocks

#

So yeah

honest spear
#

thats still not great usecase

amber granite
#

Ok i know what

#

U can use it to build very big structures using algorithms

honest spear
#

well Number is big enought

#

also MC would crash if you try to spawn too big structures

#

Number is good enought trust me

distant tulip
junior hill
#

No way

#

The jaylay bot just went down mid use

distant gulch
#

Is the Buffer (class) useable? (i cant test it at)

random flint
muted wing
#

yo chat

distant gulch
#

yo Woods

amber granite
#

Guys question

#

Is there something in server module , that divides blocks into categories

#

Like
Redstone blocks
Ticking blocks
Farm blocks
Decoration blocks

#

Or something like that

distant gulch
#

@amber granite idk but maybe you can do some thing with that:

block.getComponent
block.getTags
block.hasTag

block.permutation.type.canBeWaterlogged

block.permutation.getState
block.permutation.getAllStates

block.permutation.hasTag
block.permutation.getTags
amber granite
#

._.

#

No

#

I want something that can be updated by it self

granite badger
#

are vanilla blocks categorised?

wary edge
wary edge
#

They're in the creative menu?

amber granite
#

Yeah can i get it in script api

thorn flicker
#

however there's item tags for swords, pickaxes, axes and hoes.

#

if that's useful

amber granite
#

What about

amber granite
#

Guys

#

Why my world.dynamicPropreties didn't get daved after i left the world

distant gulch
#
        this.#player.camera.setCamera("GameCamera", {
            rotation: rotation, // Vector2
            location: location, // Vector3

            easeOptions: {
                easeTime: easeTime, // number
                easeType: easingType // keyof typeof EasingType
            }
        });

help?

#

@valid ice

sharp elbow
#

What is "GameCamera"? Is that some camera preset you have created? I'm pretty sure cameras need to be namespaced IDs

distant gulch
sharp elbow
#

Mm, the camera preset there is something like "minecraft:free". It is a camera definition within your behavior pack

distant gulch
#

tried camera:gameDefault, it still throwed an error

#

ohh you meant this

#

I completely forgot about that

#

thanks!

distant gulch
#

yes its working

terse tide
#

Hi

#

How i can make custom book and chest? With separeted slots?

quick shoal
#

Hey everyone who can help me fix the code

#

#1301464443162460221 message

#

See the latest massage

amber granite
#

Guys i want explanation

distant gulch
#

Sure

amber granite
distant gulch
#

QR CODE builder?

distant gulch
amber granite
#

No

#

So i used getEntities({maxDistancr : 40 } )

#

And i got this

#

The pink frames are the chunks that getEntities method didn't detect them

#

@distant gulch

#

How can i make it detects those 4 chunks

dim tusk
amber granite
#

They are loaded

subtle cove
#

location, where

amber granite
#

The red dot in the middle

subtle cove
#

should it be radius or box?

amber granite
#

What

subtle cove
#

if u moved on the corner, does it detect the entities in pink?

amber granite
#

It s const entity

#

That doesn't move

subtle cove
#
const location = entity.location;
location.x -= 40
location.z -= 40
entity.dimension.getEntities({location, volume:{ x:40*2 ,y:20 ,z:40*2 }})
amber granite
#

Nice

amber granite
subtle cove
#

dunno

amber granite
#

I need the most effecient way

subtle cove
# amber granite

perhaps that's just the range of chunks the entity, alone, can simulate...

amber granite
#

Hmmm

#

Why why isn't square

#

Why mojang has to ruin my things

subtle cove
#

"radius"

#

and the chunks that's in the radius

amber granite
#

Ok

subtle cove
#

more like touched by the radius

untold magnet
#

ah,

#

const block = entity.dimension.getBlock(entity.location);
const { x, y, z } = block?.center();

dim tusk
untold magnet
#

fixed

quick shoal
#

guys

#

How to detect and kill specific item

#
const itemNametag = 'diamond';

system.runInterval(() => {
   for (const entity of world.getDimension('overworld').getEntities())
   if (entity.typeId === "minecraft:item" && entity.nameTag === itemNametag) {
            entity.kill();
        });
#

I do this but not working

#

Code is correct but I drop the item the. Not happened anything

amber granite
#

Guys

untold magnet
#

lemme make u one

#

just wait

quick shoal
#

Thanks bc I annoyed for this issue as long time

granite badger
#

item entity doesn't have name tags

untold magnet
#

im making him/her a script rn

quick shoal
#

But the compiler doesn't said code has bug

wheat condor
#

why does doDayLightCycle gamerule return always undefined

granite badger
untold magnet
#

@quick shoal

#
import { system } from '@minecraft/server';

const eItems = ['minecraft:diamond'] // add the items ID's here
system.runInterval(() => {
  const dimension = ['overworld', 'nether', 'the_end'].map(dim => {
    for (const entity of world.getDimension(dim).getEntities()) {
      const rItems = entity.getComponent('minecraft:item');
      if (eItems?.includes(rItems.itemStack.typeId)) entity.remove()
    }
  })
})```
quick shoal
#

Whatt

#

Ok..

#

Thanks!!

untold magnet
#

np,

gaunt salmonBOT
# untold magnet ```js import { system } from '@minecraft/server'; const eItems = ['minecraft:di...

Debug result for [code](#1067535608660107284 message)

Compiler Result

Compiler found 1 errors:

<REPL0>.js:6:26 - error TS2304: Cannot find name 'world'.

6     for (const entity of world.getDimension(dim).getEntities()) {
                           ~~~~~

Lint Result

ESLint results:

<REPL0>.js

5:9 error 'dimension' is assigned a value but never used @typescript-eslint/no-unused-vars

quick shoal
#

Forget import world

#

Never mind

#

Alr thanks

amber granite
#

How that thing worksss....

quick shoal
amber granite
#

Code :

e.dimension.getEntities({location : e.entity.location , volume : { x : 80 , y : 80 , z :80 } } )
quick shoal
#

Send the full

#

What u want to made

amber granite
#

I want this

#

U see the middle red block

#

Is the entity

#

I want the entities around 2 chunks of it in radius

#

Including pink frames

amber granite
subtle cove
#

subtract the location's x and z coords by radius

amber granite
#

How

untold magnet
#

hm,mm,mmm does the tickingarea have limitations of how many areas are loaded?

amber granite
#

Why ?

amber granite
amber granite
subtle cove
#

ye

amber granite
#

Tank u

untold magnet
# amber granite 10

alright!, I'll make my addon use a custom advanced block that will load chunks around it using the tickingarea command

#

is there any better way to do it?

amber granite
#

Tick_world

#

If u wanna unlimited

#

Ticking area

untold magnet
#

like entities that will load chunks around it, i think its possible

amber granite
#

But...

#

Tick_world
Works chunk radius not block radius

#

And maximum radius is 6 and minimum is 2

#

So if u wanna load 1 block... As example

#

U will load other 24 chunks

untold magnet
#

i will load blocks in a huge radius, not one or two blocks

amber granite
#

Yep use what i told u

untold magnet
#

more loaded chunks = more energy costs

#

thats why u need a nuclear reactor

amber granite
#

More heat

subtle cove
#

for what purpose...

amber granite
#

U can do another work around

#

By making one ticking area shrink and expand

untold magnet
#

my addon isn't allowed for phones that aren't 15+

amber granite
#

And that needs : time , math , bugs

untold magnet
amber granite
#

☠️

#

Make it for windows

untold magnet
#

its for everything, phones pcs xbox ps7

amber granite
#

Wait ,

#

Rach ticking area contains 10 chunk max

untold magnet
#

@subtle cove ^

amber granite
#

There is

#

10 ticking area each ticking area contains 10 chunks

subtle cove
#

perhaps /tickingarea cmd

amber granite
#

So 100 chunks limit

untold magnet
#

100 chunks isn't enough for my addon

#

i prefer using another method

amber granite
#

Now chose between two

subtle cove
#

uhm, tickingarea is limited per dimension, its in /tickingarea list

amber granite
#

Tick_world component

#

Or limited ticking area

subtle cove
#

entity tick_world component, u can use more

untold magnet
#

which one has more lag?

#

by minimum chunks

amber granite
#

Tick_world cons :
1 entity that has tick_world component, can cause lag as hell
Because minimum is 25 chunks per entity
TickArea command cons :
More devices friendly , limited

quick shoal
#

@untold magnet can U help me again the code U given is bugging

#
[Scripting][error]-TypeError: cannot read property 'itemStack' of undefined    at <anonymous> (main.js:53)
    at map (native)
    at <anonymous> (main.js:55)
amber granite
#

Send code

subtle cove
#

use runInterval as timer

quick shoal
#
system.runInterval(() => {
            const eItems = ['minecraft:diamond']
            const dimension = ['overworld', 'nether', 'the_end'].map(dim => {
            for (const entity of world.getDimension(dim).getEntities()) {
            const rItems = entity.getComponent('minecraft:item');
            if (eItems?.includes(rItems.itemStack.typeId)) entity.remove()
    }
  })
});
quick shoal
#
system.runInterval(() => {
            const eItems = ['minecraft:diamond']
            const dimension = ['overworld', 'nether', 'the_end'].map(dim => {
            for (const entity of world.getDimension(dim).getEntities()) {
            const rItems = entity.getComponent('minecraft:item');
            if (eItems?.includes(rItems.itemStack.typeId)) entity.remove()
    }
  })
});
[Scripting][error]-TypeError: cannot read property 'itemStack' of undefined    at <anonymous> (main.js:53)
    at map (native)
    at <anonymous> (main.js:55)
#

Plz fix it

buoyant canopy
cold grove
amber granite
subtle cove
amber granite
#

That not how it works

buoyant canopy
quick shoal
#

Wait what is correct.

#

Wait

quick shoal
#

I must say

#

It actually kill the item

#

But keep jump the error

cold grove
#

Just Check if not an item entity

quick shoal
#

And breaked my chest ui

#

Nah this is main code

cold grove
#

Use the entity filter of getEntities()

quick shoal
#

How

cold grove
#

Bruh

buoyant canopy
#

entities.filter(e => e.typeId == "minecart:item" )

cold grove
#

No

subtle cove
#

getEntities({type:'item'})

untold magnet
#

?

quick shoal
#

Its will normally remove the item but also broke my chest Gui code

untold magnet
#

my internet went off

subtle cove
#

sigh

buoyant canopy
quick shoal
#

Which is correct?

#

getEntities({type:'item'})
This?

untold magnet
#

edit the whole thing

#

for him/her