#Script API General

1 messages · Page 39 of 1

umbral scarab
#

Oh really? How come?

ruby haven
#

How about forcing a player to be in first person?

distant tulip
ruby haven
distant tulip
#

player.camera

ruby haven
remote oyster
#

Ah, yes I wouldn't have known that lol. I haven't used it in a very long time.

honest spear
remote oyster
umbral scarab
honest spear
remote oyster
#

Oh, definitely.

honest spear
umbral scarab
#

Dang

remote oyster
honest spear
#

Well but you still could have option to enable it

remote oyster
#

👀

#

People here are gonna panic lol.

honest spear
#

its already gone like 2 years or something

#

it take me while to notice as well

honest spear
#

its a bit off topic but what do you think about it?

slim forum
#

How do I get a gamerule? For example, get the 'keepinventory' gamerule and make it return if it is true or false

remote oyster
remote oyster
#

At work, so I'm not entirely focused lol.

distant tulip
#

i can confirm that global installs work fine

honest spear
#

💀 💀 💀 💀

#

What???

#

damn

distant tulip
#

yeah
all my mc packages are global installs

honest spear
#

I have to test this

distant tulip
#

you are on windows?

honest spear
#

yes

ruby haven
#

Is there a way to detect character player through scripting if it is slim or not?

distant tulip
#

character player?

ruby haven
distant tulip
honest spear
#

i am confused asf

distant tulip
distant tulip
honest spear
distant tulip
#

oh
yeah forgot about the character creator stuff
i don't thing even the server net can get those

ruby haven
honest spear
#

ya it would be great

remote oyster
chilly fractal
#

Yo y'all I'm wondering if I re-add the damage a player got in an entityHurt event would it cancel their damage (and/or) death? I can make my own player inv loader so I can set keepInv gamerule to true and it doesn't drop their items so if it wasn't meant for them to die their inv won't be lost and and if it was meant then just load the inventory, would this all work for a make-shift damage canceling?

warm mason
#

And I still don’t understand why you need to cancel the damage

chilly fractal
#

Uh no not applying

#

I re-add the lost health to the player

#

If they shouldn't be hurt in this context

warm mason
#

Well, he will die if the damage is lethal

chilly fractal
#

If that cancels the EntityDie Event then I wouldn't need to check if their health-

#

Welp

#

I do have a damage sensor (multiple) but they aren't that flexible

#

I can't test if the hurt & attacker both have tag that starts with something which is pissing me off

warm mason
#

Not. This event cannot be canceled. You can only immediately restore HP after losing them, but if the damage is lethal, then there is nothing you can do

chilly fractal
#

Nvm, welp thanks!

solar dagger
#

Best way to detect if an entity is in a cave? Of course without using the entity behavior file

warm mason
distant tulip
#

man, if only we have air cave from java

wary edge
#

They're not even used anymore.

distant tulip
distant tulip
wary edge
warm mason
#

Basically you can just get the highest block and check if you are under it

wary edge
#

Reread what I said, an is_underground component or filter via ScriptAPI would be far sustantially better than using cave air.

warm mason
distant tulip
#

is_underground is not a component and there is not filter for it in the api

wary edge
#

Because what is even cave air? If I just destroy the cave....then what?

distant tulip
#

i mean yeah i said "if" it is more of a work around if we did have it

solar dagger
#

Ok but what would be the best way to check a large area?

#

Because these caves are huge af

distant tulip
#

rays or A* algo

distant tulip
# warm mason .

that not enough
a block above don't mean you are underground

distant tulip
warm mason
distant tulip
#

maybe you are under a tree, or passing under a extended block from a building, or under a ship from the end
lot of cases

solar dagger
#

Maybe exclude leaves or something?

solar dagger
jolly citrus
#

what has changed with 1.20.50

distant tulip
jolly citrus
#

wow amazing website

#

thx

solar dagger
#

I'm not trying to cause lag when trying to check the surroundings

granite badger
#

I just found out my docs update caused old links to be broken completely, whoops

neat hound
#

I don't think it did this before, but why is it showing something as beta when it is not? I always go to beta to see what is beta, versus going to stable and seeing it not there. But if everything under beta says beta, then.... is this a bug? @granite badger

#

I am 90% positive that stuff that was stable did not have a beta tag when you viewed the server-beta pages

granite badger
ruby haven
#

I want to detect when a player is riding a specific entity using molang but that is not possible so I'm thinking of creating a property called sm:ride with a default value of false and then set that property to true in scripts then use the molang:
query.has_property Takes one argument: the name of the property on the entity. Returns 1.0 if a property with the given name exists, 0 otherwise.

Is this possible?

dim tusk
#

Just grab the entity you want to set the property with

#
entity.setProperty('<name>', <value>); // accepted values or values you indicated in entity file```
ruby haven
#

Wait I just realized that the only argument that the query.has_property takes is only the name it doesn't take any value

dim tusk
#

has_property is straightforward it returns true when the property exist on tha player otherwise place

ruby haven
dim tusk
#
system.runInterval(() => {
   for (const player of world.getPlayers()) {
      const riding = player.getComponent('riding');
      if (riding.entityRidingOn?.typeId === 'mz:smile') {
         player.setProperty('<name>', <value>);
      } else {
         player.setProperty('<name>', <value>);
      }
   }
});```
dim tusk
ruby haven
dim tusk
ruby haven
drifting cobalt
#

is getComponent('food') fixed?

dim tusk
dim tusk
drifting cobalt
#

tq

dim tusk
#

Sorry I read it wrong I thought you'd said exist 😭

dim tusk
ruby haven
ruby haven
dim tusk
dim tusk
dim tusk
dim tusk
celest abyss
#

Hey

terse pulsar
#

How I can make the button form has conditions to appear?

terse pulsar
uncut summit
#

need some help

wary edge
#

Man...open a post.

uncut summit
#

ok

celest abyss
#
world.afterEvents.playerInteractWithBlock.subscribe(ev => {
  if (ev.block.typeId.includes('minecraft:door')) return; player.runCommandAsync('execute as @s at @s run damage @s 2000');
}

I have a problem, now practically the interact button does the /damage, literally putting blocks does the damage, putting mob generators also does the /damage

wary edge
celest abyss
wary edge
celest abyss
wary edge
#

What?

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

world.beforeEvents.worldInitialize.subscribe((e) => {
    e.itemComponentRegistry.registerCustomComponent("jm:shoot_cooldown", {
        onUse({ source: player, itemStack: item }) {
            player.startItemCooldown("shoot", 20)
        }
    })
})

function summonBullet(player) {
    const head = player.getHeadLocation();
    const view = player.getViewDirection();

    const bullet = player.dimension.spawnEntity("jm:thrown_bullet", { x: head.x + view.x * 1, y: head.y + view.y, z: head.z + view.z * 1 });
    const proj = bullet.getComponent("projectile");
    proj.owner = player;
    proj.shoot(player.getViewDirection())
}

function shoot(player, item) {
    console.warn(`${item.getDynamicProperty("ammo")}`)
}
world.beforeEvents.itemUse.subscribe((e) => {
    const { source: player, itemStack: item } = e;
    if (item.typeId == "jm:m1911_colt") {
        system.run(() => {
            shoot(player, item);
        })
    }
})

system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        if (!player.isValid()) break;

        const heldItem = player.getComponent("inventory")?.container?.getItem(player.selectedSlotIndex);

        if (heldItem && heldItem.typeId == "jm:m1911_colt" && !heldItem.getDynamicProperty("ammo")) {
            heldItem.setDynamicProperty("ammo", 20);
        }

        if (heldItem && heldItem.typeId == "jm:m1911_colt") {
            player.onScreenDisplay.setActionBar(`${heldItem.getDynamicProperty("ammo")}`);
        }
    }
})

does anyone know why the console.warn returns undefined despite the fact it says 20 on the actionbar?

wary edge
celest abyss
valid ice
#

The semicolon after the return cuts off the code, so it thinks the runCommand is the next line, effectively

valid ice
celest abyss
wary edge
terse pulsar
#

Aw I see

wary edge
#

Make it an inverse.

#

And also it shoulf just be includes door not namespace.

valid ice
#

Aren't the other doors like minecraft:spruce_door and whatnot

#

Can check for _door

celest abyss
wary edge
terse pulsar
#

Anyone know how to make the form response more exactly?

valid ice
terse pulsar
#

But

#

The normal selection just work with on the buttons that was on the form when is open

#

If I make a button 3 appear alone with a condition, he will execute the case 0

valid ice
#

Ah, I see

#

You'd have to conditionally check button visibility in the selections as well

terse pulsar
valid ice
#

well, you could do
const actualSelection = response.selection - !(button_1_condition) - !(button_2_condition) or something janky ahh

#

But honestly, two buttons with variable visibility is pretty wacky, as it will get messy fast

terse pulsar
#

Ok

#

I dint understand but is it

distant gulch
#

In a vector3, what is the equivalent of ^^^1 in commands? How can I get the coordinate one block in front of their face

distant gulch
#

headlocation+viewdirection

#

I thought its just the first solid block in ur ray

distant gulch
valid ice
#

Spherical coordinates meta_steve

distant gulch
#

side*

valid ice
distant gulch
valid ice
#

getHeadLocation() returns a vec3 where the head is
getViewDirection returns a unit vec3 based on where they're looking

distant gulch
#

Does getBlockFromViewDirection return air?

valid ice
#

If no block is found, I think it returns undefined

#

aka it finds air

distant gulch
#

Can I get the location of the undefined?

valid ice
#

Nop

#

The viewBlock itself is undefined

distant gulch
#

Well how else (besides view + location) can I get the block in front of me?

#

Because headLoc and viewDir combined runs off to the side depending on vieeDir value

valid ice
#

Apparently head location is inaccurate to camera; have you seen this here?

distant gulch
#

This is my code

#
{ x: bullet.location.x + bullet.getViewDirection().x, y: bullet.location.y + bullet.getViewDirection().y, z: bullet.location.z + bullet.getViewDirection().z }
ruby haven
#

In this why is my property throwing errors?

ruby haven
distant gulch
#

What's my issue?

#

I'm trying to create a projectile

#

but no matter what I change the power to

#

it also goes the same speed as a snowball

ruby haven
distant gulch
#

I want to create a new projectile

#

ohh, u mean copy an arrow?

ruby haven
distant gulch
#

and change it up a lol

#

ahh

#

I'll get back to u on that lol

ruby haven
dim tusk
dim tusk
ruby haven
distant gulch
# dim tusk How do you throw the projectile?
world.beforeEvents.itemUse.subscribe((e) => {
    if (e.itemStack.typeId == "minecraft:stick") {
        system.run(() => {
            summonBullet(e.source);
        })
    }
})

function summonBullet(player) {
    const head = player.getHeadLocation();
    const view = player.getViewDirection();
    const bullet = player.dimension.spawnEntity("jm:thrown_bullet", { x: head.x, y: head.y - 0.5, z: head.z })
    const proj = bullet.getComponent("projectile");
    proj.owner = player;
    proj.shoot(view);
}
distant gulch
distant gulch
ruby haven
distant gulch
ruby haven
dim tusk
#
world.beforeEvents.itemUse.subscribe(({ itemStack, source }) => {
   if (itemStack.typeId === 'minecraft:stick') {
      system.run(() => {
         const head = source.getHeadLocation();
         const view = source.getViewDirection();
         const bullet = source.dimension.spawnEntity('jm:thrown_projectile', { x: head.x, y: head.y - 0.5, z: head.z });
          const proj = bullet.getComponent('projectile');
          proj.owner = player;
          proj.shoot({ x: head.x + view.x * 2, y: head.y + view.y + 0.1 * 2, z: head.z + view z * 2 });
      });
   }
});```
dim tusk
dim tusk
distant gulch
#

unfortunately

#

my original shot shot straight in a line

#

this shoots no further and just shoots to the side

dim tusk
#

Does your projectile have the runtime identifier of snowball?

distant gulch
#

the shoot method goes based on a direction/angle

#

not a location or a power

slim spear
#

getTopMostBlock

dim tusk
# distant gulch not a location or a power

Weird because it works for me!

world.beforeEvents.itemUse.subscribe(({ itemStack, source }) => {
   if (itemStack.typeId === 'minecraft:blaze_rod') {
      system.run(() => {
         const head = source.getHeadLocation();
         const view = source.getViewDirection();
         const bullet = source.dimension.spawnEntity('minecraft:snowball', head);
          const proj = bullet.getComponent('projectile');
          proj.owner = source;
          proj.shoot({ x: view.x * 5, y: view.y * 5, z: view.z * 5 });
      });
   }
});```
distant gulch
#

Unfortunately, mine just went off to the right

dim tusk
distant gulch
dim tusk
#

And my point still stands that you can change the power of the projectile in the shoot() property not just direction/angle...

verbal yew
#

do yal know if the name tags was changed and how you edit them

dim tusk
verbal yew
#

player.nameTag

dim tusk
distant gulch
dim tusk
verbal yew
dim tusk
verbal yew
#

oh ok will it work on a player

dim tusk
#

Wym by player?

verbal yew
#

it is for chat ranks and to change the over head nametag of the player

dim tusk
dim tusk
verbal yew
#

oh my bad

verbal yew
#

player.nameTag = ${displayName} §f| ${nameColor}${player.name};

dim tusk
verbal yew
#

it worked bfor the update

solar dagger
slim spear
#

oh no i just mean detect if there's a block above them in general

distant gulch
#

Do dynamicProperties not save for items?

#

In one the areas of my script, I set a dynamic property on a custom item, and it displays it fine in an actionbar,

but in another area, when I call for that same proprty, it's undefined

dim tusk
distant gulch
#

can I show u my script rq

#

one sec

#
system.runInterval(() => {
    for (const player of world.getAllPlayers()) {
        if (!player.isValid()) break;
        const heldItem = player.getComponent("inventory")?.container?.getItem(player.selectedSlotIndex);
        if (heldItem && heldItem.typeId == "jm:m1911" && !heldItem.getDynamicProperty("ammo")) {
            heldItem.setDynamicProperty("ammo", 20);
        }
        if (heldItem && heldItem.typeId == "jm:m1911") {
            player.onScreenDisplay.setActionBar(`${heldItem.getDynamicProperty("ammo")}`)
        }
    }
})

world.beforeEvents.itemUse.subscribe((e) => {
    const heldItem = e.source.getComponent("inventory")?.container?.getItem(e.source.selectedSlotIndex);
    if (e.itemStack.typeId == "jm:m1911") {
        system.run(() => {
            summonBullet(e.source);
            e.source.sendMessage(`${heldItem.getDynamicProperty("ammo")}`);
        })
    }
})
#

In the first part, the dynamicProperty works fine in the actionbar

#

but in my world.beforeEvents, it's showing as undefined

#

same for console.log

dim tusk
distant gulch
#

Can you explain??

#

oops

#

doubel questionmark

dim tusk
#

Every time you modify an item you need to put it back in the slot.

distant gulch
#

double*

#

I can't type today

#

can you give me a small example code?

#

I'm tired lol, I can't think properly

dim tusk
# distant gulch can you give me a small example code?
system.runInterval(() => {
   for (const player of world.getPlayers()) {
      const equip = player.getComponent('equippable');
      const mainhand = equip.getEquipment('Mainhand');
      if (mainhand?.typeId === 'jm:m1911') {
         mainhand.setDynamicProperty('ammo', 20);
         mainhand.setEquipment('Mainhand', mainhand);
      }
   }
});```
distant gulch
#

ah

#

I see

#

I'm dumb lol, that's what you want

dim tusk
#
system.runInterval(() => {
   for (const player of world.getPlayers()) {
      const inventory = player.getComponent('inventory');
      const mainhand = inventory.getItem(player.selectedSlotIndex);
      if (mainhand?.typeId === 'jm:m1911') {
         mainhand.setDynamicProperty('ammo', 20);
         mainhand.setItem(player.selectedSlotIndex, mainhand);
      }
   }
});```
distant gulch
#

I'm gonna test it out rq

dim tusk
ruby haven
#
import { world, system } from '@minecraft/server';


system.runInterval(() => {
  for (const player of world.getPlayers()) {
    const riding = player.getComponent('minecraft:riding');
    if (riding.entityRidingOn?.typeId === 'mz:smile') {
      player.setProperty('smile:ride', true);
    } else {
      player.setProperty('smile:ride', false);
    }
  }
});

In this code is there an entityRidingOn method?
Cause it says it is undefined

solar dagger
dim tusk
ruby haven
solar dagger
#

And trigger the condition that way

dim tusk
#

Just do riding?.entityRidingOn?.typeId === '' if it keeps persisting

ruby haven
dim tusk
dim tusk
solar dagger
slim spear
#

Yeah

#

you could also check if the entity is standing on stone/deepslate

#

There won't be a perfect way for this

solar dagger
slim spear
#

yeah

distant gulch
slim spear
#

under y 60 & if there is a block above them

#

is what i would do

solar dagger
slim spear
#

np

dim tusk
#

Lmao I forgot things easily lmao...

#

Welcome I guess?

ruby haven
#

{
"controller.render.wide.possesed": "q.property('smile:ride') == true && variable.short_arm_offset_right == 0.0"
}

ruby haven
#

Why does it say q.property('smile:ride') doesn't have an actor?

dim tusk
distant gulch
dim tusk
ruby haven
ruby haven
dim tusk
ruby haven
ruby haven
dim tusk
#

Or you understand it

ruby haven
dim tusk
ruby haven
alpine void
#

How can I make it so that when an entity hits you, the durability of your tools and armor will be lowered to a specific level that I want?

ruby haven
alpine void
#

with what?

#

I can't find anything

ruby haven
alpine void
#

yes

ruby haven
# alpine void yes

Wait it is possible you have to make the format version of the item 1.21.10+

#

Where can I find the camera preset for first person can I modify it so that I can look tall?

warm mason
# alpine void How can I make it so that when an entity hits you, the durability of your tools ...

you can use the entityHitEntity event and the equippable component (it only works for the player). Here's an example:

world.afterEvents.entityHitEntity.subscribe(data => {
  let player = data.hitEntity
  if (player.typeId != "minecraft:player") return // Excluding events in which hitEntity is not a player

  let equip = player.getComponent("minecraft:player")
  for (let slot of ["Head","Chest","Legs","Feet"]) {
    let item = equip.getEquipment(slot)
    if (item == undefined) continue

    let dur = item.getComponent("durability")
    if (dur) {
      let damage = dur.damage + dur.maxDurability*0.01 // Remove 1% durability
      if (damage >= dur.maxDurability) {
        item = undefined
      } else {
        dur.damage = damage
      }
    }

    equip.setEquipment(slot, item)
  }
})
glacial widget
#

is it possible to check players offhand?

humble lintel
#

could i ask if its possible to check for player interactions with blocks that aren't normally interactable

#

like grass or stone

dim tusk
dim tusk
ruby haven
#

who is knowledgeable here in creating camera presets?

dim tusk
shut citrus
#

poor creaking

ruby haven
humble lintel
#

thank you

ruby haven
#

In the player.location.x where does it base it's direction, is it the x and y axis of the world or the player itself?

dry meadow
#

how do i change movement speed of player via scripting? cant find a method in EntityMovementComponent

ruby haven
#
import { world, system } from '@minecraft/server';


async function forceRide(ride, rider, maxAttempt = 200) {
  let attempts = maxAttempt;
  while (attempts--) {
    const rideable = ride.getComponent("minecraft:rideable");
    if (rideable && rideable.addRider(rider)) {
      return true;
    }
    await system.waitTicks(1);
  }
  return false;
}


world.afterEvents.entityDie.subscribe(({ damageSource: { damagingEntity }, deadEntity }) => {
  if (!damagingEntity || damagingEntity.typeId !== 'minecraft:player') return;

  if (deadEntity.typeId === 'minecraft:villager_v2') {
    world.scoreboard.getObjective('Kills').addScore(damagingEntity, 1);

  } else if (deadEntity.typeId === 'mz:smile' && damagingEntity.hasTag('survivor')) {
    deadEntity.triggerEvent('bridge:dead');

  } else {
    deadEntity.triggerEvent('bridge:fake_death');
    damagingEntity.triggerEvent('bridge:no_movement');
    damagingEntity.runCommand(`camera @s set minecraft:first_person facing ${deadEntity.location.x} ${deadEntity.location.y} ${deadEntity.location.z}`)

    system.runTimeout(async () => {

      await forceRide(deadEntity, damagingEntity);
    }, 20);

    damagingEntity.runCommand(`camera @s set minecraft:free ease 4 linear pos ${damagingEntity.location.x + 10} ${damagingEntity.location.y + 3} ${damagingEntity.location.z} rot 40 90`);
  }
});
ruby haven
humble lintel
#

does anyone know why it says spawn item does not have required privbiliges

wary edge
buoyant canopy
#

how to get difficulty?

buoyant canopy
#

is it even possible?

warm mason
buoyant canopy
#

Lol WHAT

warm mason
buoyant canopy
#

that's crazy

warm mason
#

The funny thing is that there is even enumeration for difficulty, but there is no difficulty

buoyant canopy
#

why does the Difficulty enum exist then?

slow walrus
#

completely unused

ruby haven
granite badger
coral ermine
#

Is there a obfuscator that doesn’t have its deobfuscate?

wary edge
#

Obfuscation bad.

coral ermine
#

ts good

winged gull
ruby haven
ruby haven
#

Check the last command

glacial widget
wise raft
#

Is there a way to check if Block 1 is connected with Block 2?

warm mason
#

I wonder how this will work

valid ice
#

Didn't those already exist

warm mason
valid ice
#

Ohhhhhh I see

#

Didn't catch the plural, thought it was just bad script changelog formatting 😛

valid ice
warm mason
valid ice
#

It's a nice QOL, but I don't see myself using it that much lol

honest spear
#

Yes

honest spear
#

cool

#

he is fast

valid ice
#

Yar

fathom pecan
#

@granite badger I'm walking around and there's a little problem here

#

tnt or diamond sword how its lol silk one or the other

#

:)

cinder shadow
#

those are the same thing

simple arch
#

In my post someone said "We could change that to SU" what is SU?

remote oyster
remote oyster
simple arch
remote oyster
simple arch
#

Look in my post

#

If you saw someone respond with we can chat to SU which means idk either

dreamy elbow
#

.isInWater.valueOf() doesn't detect things like rain, splash potions, ect. Is there another easy way to do it or should I just hardcode it

warm mason
dreamy elbow
#

Yeah I know how to do it I was just wondering if there was an easy one.

autumn seal
#

does anyone have vanilla shield code? I want to see how they handle deflecting projectile that hit the front of the player

#

does minecraft just compare the yaw/pitch of arrow and player?

spare fox
#

was this figured out?

wary edge
spare fox
wary edge
spare fox
#

how did they not change this

wary edge
#

Intentional change by the devs.

spare fox
#

I guess I will just write over it in the types. Very weird change

#

or is there some way to add your typing to it?

wary edge
#

This is what I did.

spare fox
oak lynx
#

@valid ice sorry for the ping
But is the amount of 1.16.100+ items in chest gui based on the actual amount of items or item_texture.json

valid ice
#

Actual BP file count

spare fox
wary edge
#

As far as I know.

slow walrus
#

they should be

#

navi said that workaround is for now

#

just got no clue when it'll be changed

wary edge
#

For now can be until 2030.

slow walrus
#

yep

bright dove
#

does anyone here knows all the things that can update a block ?

olive rapids
#

Can someone help me make an exact replica of an addon?

autumn seal
slow walrus
#

oh

#

wait

#

nvm other way around

olive rapids
#

Can someone help me recreate a script for an addon I have? I need a similar one

bright dove
slow walrus
bright dove
slow walrus
#

it changes a lot depending on what block it is

fiery solar
autumn seal
#

Before observers people used bud switches that checked alot of things that could update blocks including random things like silverfish entering the block or enderman shenanigans, there are lists of all these updates but they are probably old and not all of them update blocks on bedrock edition

bright dove
#

If we have a onBlockUpdate custom event listener function we could do ALOOTT of things

#

but it does involve detecting everysingle changes to block separately

#

so very labourous

#

but NOT impossible

bright dove
fiery solar
# spare fox yuk I hate doing that

Redeclaring the getState interface with an intersection of the BlockStateSuperset and your own state interface is a pretty good middle ground between type safety and ease of use:

interface MyStates {
  "namespace:my_state": number;
}

type StateKeys = keyof (BlockStateSuperset & MyStates);

declare module "@minecraft/server" {
  interface BlockPermutation {
    getState<T extends StateKeys>(key: T): string | number | boolean | undefined;
  }
}

Just needs to be updated manually if the return values of getState change, but to be fair they probably won't

coral ermine
#

Does chatSend work only for 1.16.0-beta or it works for 1.8.0-beta too?

dim tusk
#

chatsend works on the last latest beta right now it's 1.17.0-beta

shut citrus
#

what's new in script 2.0.0 ?

dim tusk
shut citrus
#

why

dim tusk
#

Wait lemme try searching Smokey's Message regarding to this

coral ermine
dim tusk
#

What mc version are you?

coral ermine
#

@minecraft/server version in manifest

coral ermine
dim tusk
coral ermine
dim tusk
#

I don't where did you get the 1.8.0-beta.

coral ermine
#

1.8.0-beta is for 1.20.50

dim tusk
#

Sorry

#

My bad it's my fault you're 1.20 not 1.21

dim tusk
bright dove
#

i am still relatively new to Scripting, well, haven't made any scripts of my own yet

dim tusk
slow walrus
#

you are very ambitious I will say

#

definitely gonna run into performance issues

slow walrus
#

It's better to wait till we get a native event for that, but even that might not be super performant

bright dove
slow walrus
#

there's a heap of block updates every tick

bright dove
#

is there a way to optimize the performance ?

slow walrus
#

and trying to iterate or test through each would be very slow

dim tusk
slow walrus
bright dove
slow walrus
#

it just depends how you impl it

#

but either way you'll have big overhead

#

so your min performance loss is probably still quite big, not worth it imo

dim tusk
bright dove
#

oh...

#

hmmm

#

i see

#

i am trying to get a way to check for block updates

slow walrus
#

why do you want it anyway?

bright dove
#

there are two versions of the fluids, one ticking, one static

dim tusk
#

In the wiki there's a template for custom water but not very accurate, we can't replicate the flowing effect to players, and can't break crops we can't do anything to 1:1 or make it really close to the vanilla water

bright dove
#

First the component check if there's no block update to switch to the ticking version, Then have a component which will detect no changes in the envy to switch it back

bright dove
#

it had been there for over a year now

dim tusk
slow walrus
proud saddle
#

#1314157932757127198 message
so is it possible to do?

round bone
#

there's no option to set infinite duration of effect via Effect.addEffect?

#

checked docs and the only way I see right now is to call a command

shy leaf
scarlet sable
#

/reload doesn't reload ui and textures?

shy leaf
#

functions and scripts

#

you need to do /reload all if you want to reload resource pack and the whole behavior pack

scarlet sable
#

oh sad

slow walrus
#

same for clearing all effects

#

there's no script method for that, just gotta use a command

round bone
slow walrus
round bone
#

just bit more code to write

#
for (const effect of player.getEffects()) {
    player.removeEffect(effect);
};
jolly citrus
#

is it possible to get the amount a player has of a certain item in their inventory in total without using a loop

clear pendant
#

what got added from 1.13 to 1.16 in the server module?

pale terrace
#

is there a way to pass scripting info to client? I want to do something with attachable but I dont know what to do because there is no molang or scripting to do this

chilly fractal
#

Idk set a property and detect it in molang, idk much about molang so if it works it works

nocturne berry
#

How to detect the lack of an entity from a specific family?

chilly fractal
#

If the entity is not in a family?

#

Be more specific and I'll help

nocturne berry
random flint
#

run for non-undead
if (!comp.getTypeFamilies().includes("undead")) {};
shorter alternative:
if (!comp.hasTypeFamily("undead") {};

jolly citrus
clear pendant
#

non

jolly citrus
#

both non beta?

clear pendant
#

ye

clear pendant
#

thx

jolly citrus
#

creds to smokeystack for linking me that website

#

idk how public it is

drowsy scaffold
#

how would I reduce an array to stack the quantity of typeIds of items? Say, as an example, that I have four pieces of dirt in one slot, two pieces of stone in another slot, and another three pieces of dirt in a different slot. How would I convert that down to seven pieces of dirt and two pieces of stone? I currently have:

    const inv = player.getComponent("minecraft:inventory").container
    const playerInv = Array.from({length:inv.size},((_, slot)=> inv.getItem(slot)))
        .filter((slot)=> slot != null)
chilly fractal
pale terrace
#

Therefore, I cannot add properties to it

chilly fractal
#

Well you do need to edit the player.json

#

If you do want to use query.property('<yourProperty'>) you're gonna need to define that Property & it's type in the entity file, which is the player file.

pale terrace
drowsy scaffold
chilly fractal
sharp elbow
#

This may be a stretch, but playAnimation could send a variable to the client that, in theory, the attachable can read. But that depends on variables being saved properly and being rendered public.

clear pendant
#

could i compress a 884 uint8 array into 6 or 12 base36 string?

#

or well a string with just letters and numbers

thorn ocean
#

Alright, does anyone know how to get both parents when they both breed? Cuz usually you can get the child or the parent in the events of the entity file, but never both the parents.

warm mason
distant tulip
#

save the last entities the player interacted with

#

i did write a script for it a long time ago here

warm mason
distant tulip
#

yeah
it is the best you can do

dim tusk
#

You gave me that on statistics thing I made 7-8 months ago

distant tulip
#

yeah

warm mason
dim tusk
#
const entities_items = {
  "minecraft:cow": [ "wheat" ],
  "minecraft:goat": [ "wheat" ],
  "minecraft:mooshroom": [ "wheat" ],
  "minecraft:sheep": [ "wheat" ],
  "minecraft:pig": [ "carrot", "potato", "beetroot" ],
  "minecraft:chicken": [ "wheat_seeds" ],
  "minecraft:rabbit": [ "dandelion", "carrot", "golden_carrot" ],
  "minecraft:wolf": [ "porkchop", "beef", "chicken", "mutton", "rabbit", "rotten_flesh" ],
  "minecraft:ocelot": [ "cod", "salmon" ],
  "minecraft:cat": [ "cod", "salmon" ],
  "minecraft:horse": [ "golden_apple", "golden_carrot" ],
  "minecraft:donkey": [ "golden_apple", "golden_carrot" ],
  "minecraft:llama": [ "hay_block" ],
  "minecraft:turtle": [ "seagrass" ],
  "minecraft:panda": [ "bamboo" ],
  "minecraft:fox": [ "sweet_berries", "glow_berries" ],
  "minecraft:bee": [ ],
  "minecraft:strider": [ " warped_fungus", "crimson_fungus" ],
  "minecraft:hoglin": [ "crimson_fungus" ]
};

world.afterEvents.playerInteractWithEntity.subscribe(({ target, player, itemStack }) => {
  if ((target.typeId in entities_items)) {
    if (entities_items[target.typeId].includes(itemStack?.typeId)) {
      if (!player[target.typeId] || player[target.typeId] < Date.now()) {
        player[target.typeId] = Date.now() + 9999;
      } else {
        player.setDynamicProperty(target.typeId, true);
      }
    }
  }
});

world.afterEvents.dataDrivenEntityTrigger.subscribe(({ entity, eventId }) => {
  if (eventId === "minecraft:entity_born" || eventId === "minecraft:become_pregnant") {
    for (const player of entity.dimension.getPlayers()) {
      if (!player.getDynamicProperty(entity.typeId)) {
        player.setDynamicProperty(entity.typeId, null);
        player.setDynamicProperty("animal_breed", (player.getDynamicProperty("animal_breed") ?? 0) + 1);
      }
    }
  }
});```
dim tusk
#

I'm not sure if this is it because I modified it before lmao

distant tulip
#

it is
you removed the comments lol

dim tusk
dim tusk
distant tulip
dim tusk
#

If only we can get item we can breed to mobs

thorn ocean
warm mason
#

I know how to increase accuracy to 100%!!

distant tulip
#

how?

dim tusk
#

?

warm mason
#

Just remove the component from the entity json code and create your own using scripts.

#

:)

dim tusk
#

😭😭 too many entities man

distant tulip
#

lol
for every entity?

dim tusk
#

And won't work to custom ones 😭

#

Let's see my current stats script

warm mason
warm mason
jade grail
#

How does setting lore work? i tried and didnt let me

dim tusk
dim tusk
distant tulip
jade grail
#

get item set lore? then that it

warm mason
# jade grail How does setting lore work? i tried and didnt let me
function giveItemWithLore(player, itemTypeId, lore, amount = 1) {
  let item = new ItemStack(itemTypeId, amount)
  item.setLore(lore)
  player.getComponent("inventory").container.addItem(item)
}

giveItemWithLore('there must be a player here', "wooden_sword", ["Lore line 1", "lore line 2"])
dim tusk
#

It's not just renaming it then done

dim tusk
#

As what serty shown

#

And btw it's an array

warm mason
warm mason
dim tusk
#

I am so happy that Mojang put player break and interact to stable

#

Few script versions ago

dim tusk
#
world.afterEvents.playerInteractWithBlock.subscribe(({
    beforeItemStack, itemStack, player
}) => {
    if (beforeItemStack) {
        const durabBefore = beforeItemStack?.getComponent('durability');
        const durabAfter = itemStack?.getComponent('durability');

        if (durabBefore) {
            if (!itemStack || itemStack.typeId !== beforeItemStack.typeId || !itemStack.hasComponent('durability')) {
                console.error(`The item broke!`);
            } else if (durabAfter?.damage > durabBefore?.damage) {
                console.error('The item used!');
            }
        }
    }
});```
#

And added the before and after itemStack

warm mason
dim tusk
warm mason
warm mason
dim tusk
#

Like villager?

#

I kinda forgot that component ezisted

sage portal
warm mason
sage portal
#

quick question: is there a stable way to detect a world's difficulty via scripts?

warm mason
dim tusk
#

Wait, stupid it's gamemode not difficult 🤦

warm mason
sage portal
#

welp.
gotta find another way to convince players not to choose hard difficulty

dim tusk
#

I asked this question many times lol... Is the damage shield get is based on the damage the attacker dealed?

sage portal
#

I believe so

sage portal
#

I can oneshot the shield with a high enough strength effect

sage portal
dim tusk
#

Yes!! I could detect the damage player blocked, only problem is we can't detect the actual damage when it's broken especially if the damage exceeded the shield's durability

sage portal
#

just put ">9000" and call it a day 🧹

jade grail
warm mason
jade grail
#

i cant get the lock in slot to work or i dont knw how to

dim tusk
jade grail
#

this doesnt explain it well

jade grail
#

wanna see what i tried

#

it told me it was a function in the editor

dim tusk
wintry bane
#

What would you rather use?

if(player.getGameMode() != "creative" || player.getGameMode() != "spectator")

vs

if(!["creative", "spectator"].includes(player.getGameMode()))

valid ice
#

Second one because first is logically flawed

wary edge
#

works_as_intended &&

valid ice
#

real

#

The first option will always return true, because if the player is in creative, first part will return false, but second part will return true because creative is not spectator. And if the player is in spectator, same but vice versa.

wintry bane
#

My friend needs to change his ||s to &&s now haha, he still wouldn't consider the 2nd option tho

round bone
wintry bane
#

Yeah

round bone
#

you're using array (or a Set for a bit more safety) to search for gamemode

#

the same complexity as if statements, but a bit cleaner

wintry bane
#

My friend sent code but sent dinner instead. He could end world hunger with alat spaghetti.

#

How limited is the marketplace when it comes to scripting? Stable only?

round bone
#

yeah

#

Writing a code for marketplace maps is a pain.

dim tusk
#

Tbh, I'm interested in what's the limit of the marketplace

distant tulip
wintry bane
#

"Guns" you hold transform into zweihanders

dim tusk
wintry bane
#

Blasters = bao_ext_aintbutter

rapid sail
#

so what does the getblocks do?

fiery solar
rapid sail
rapid sail
dim tusk
#

Btw you need to use BlockVolume

terse tide
#

How do I use set lore

shy leaf
dim tusk
#

#1067535608660107284 message

terse tide
#

Im the set item I need to make like this?

Bla... Bla... Bla..
setItem(0, a defined item?)
dim tusk
shy leaf
wary edge
#

Remind me, does playerinput get trigerred for jump if jump perms are disabled?

terse tide
shy leaf
#

oh

dim tusk
#
const equip = player.getComponent('equippable');
const mainhand = equip.getEquipment('Mainhand');

mainhand.setLore(['test', 'test']);

// set the item back to slot
equip.setEquipment('Mainhand', mainhand);```
terse tide
#

Ty

shy leaf
#

you dont need to put item back in if youre using ContainerSlot iirc

#

just saying

dim tusk
#
const inventory = player.getComponent('inventory').container;
const slot = inventory.getItem(0);

slot.setLore(['test', 'test']);

// set the item back to slot
inventory.setItem(0, slot);```
buoyant canopy
#

Why the hell can't I interact with a custom block while holding a bucket???

dim tusk
buoyant canopy
dim tusk
buoyant canopy
#

yes, onPlayerInteract ignores interactions done with a bucket for some reason

shy leaf
#

not sure if its fixed by now though

dim tusk
#

Hmm, weird... It's been awhile since I touched custom components... So I can't really say anything tho

shy leaf
#

cant use items while aiming at some of the copper blocks

buoyant canopy
buoyant canopy
# dim tusk Yes Soo weird

what's even weirder is that i have another block with custom components that interacts with bucket fine

dim tusk
#

After reloading

buoyant canopy
#

what do you mean?

dim tusk
# buoyant canopy what do you mean?

I mean... After reloading you break and place block again since blocks that are placed and you edit the custom components it doesn't affect the placed block

buoyant canopy
#

yes, i have tried to break and replace the blocks

rapid sail
dim tusk
rapid sail
#

ah i see how would i use if meaning if the block is there? and not use for?

slim forum
#

Minecraft updated and...

#

What is going?

#

Wtf, my server switch to 2.0.0-alpha

subtle cove
#

does anyone know where to find 2.0.0-alpha typings?

slim forum
#

Thanks

dim tusk
rapid sail
#

im trying to make a ticking block that detects if the blocks in the area are the same as the others then the block will change status

#

can that be done with getblocks?

dim tusk
#

You want all blocks inside of the two locations to be the same?

#

Returns true or false

rapid sail
#

so i add return at the end of the thing?

dim tusk
rapid sail
#

well its not just two but yes

#

hang on me let explain in dms is that fine?

dim tusk
#

Hmm

untold thunder
#

How do I get an entity's scoreboard?

slow walrus
rapid sail
distant gulch
#

Wrong place to ask this, but since I'm here all the time: it's whatever

#

How do I customize my superflat?

#

I tried changing level.dat, but it changed right back

#

nvm, I got it lol

ruby haven
#

const rot = damagingEntity.getRotation();
const rotation = rot+90

damagingEntity.runCommand(`camera @s set minecraft:free ease 4 linear pos ${damagingEntity.location.x + 10} ${damagingEntity.location.y + 3} ${damagingEntity.location.z} rot 40 ${rotation}`);

Why does my command not work

idle dagger
#

How to place structure with degrees? I got this

await world.structureManager.place("diagonal", player.dimension, { x: targetX, y: targetY, z: targetZ });

sharp elbow
#

@ruby haven getRotation returns an object with two properties: x and y. It does not make sense to add 90 to an object:

const rotation = {x: 0, y: 0} + 90;
#

I'm assuming you want the y-value; so change that line to const rotation = rot.y + 90;

ruby haven
slim spear
dim tusk
#

How do i detect if a player blocked a projectile?

neat hazel
#
"execute as @s at @s positioned ~~~ rotated ~ -20 run camera @s set minecraft:free ease 1 out_cubic pos ^^1^4 facing @s"

How to turn this into a script, with the camera without runCommandAsync?

The logic behind this is that the camera goes in front of the player looking at him.

ruby haven
neat hazel
ruby haven
#

I think it's just better to use ^^^ than to get the location of the entity

dim tusk
#

Sorry been outdated to command for so long

ruby haven
dim tusk
#

I'm pointing out this specific part.. what does positioned do and rotated do

ruby haven
slow walrus
#

changes the relative position to do the camera command from

#

so the ^^1^4 facing direction isn't actually the player's exact view direction, but rotated -20 in whichever axis that is

ruby haven
ruby haven
dim tusk
dim tusk
#

Did you backread 😭

ruby haven
dim tusk
#

And he use /camera to change view

#

I probably can do it.. but I'm kinda lazy to do it loo

ruby haven
#

dang I didn't read the command clearly but I think using positioned and rotated may solve my problem

jade grail
#

How do i make a /scriptevent

#

idk if this part of commands or script api

warm mason
jade grail
#

i was looking in the world part of it

warm mason
jade grail
#

cannot read property of undefind?

#

subscribe part

warm mason
jade grail
warm mason
#

Recive -> Receive

jade grail
#

-_- i copied and pasted urs

#

i think i by acc deleted it

#

when i write the command it says identifier must have a namespace that is not 'minecraft'

jade grail
#

i think i got fix

proud saddle
#

bao_ext_toldyouso
impossible change radius of minecraft:follow_orbit camera with script api
it requires creating of custom template of orbital camera

ember swallow
#

Heyyy! can somebody help me, I have a question about knockback, I am making an addon and want if you get the tag knockback, that you get pushed into the air for 10 block, then the tag removes, can somebody help me? Thanks! 😄

warm mason
ember swallow
#

wow that was fast!

#

I will test it!

#

is that good?
import * as mc from "@minecraft/server";

system.runInterval(() => {
for (let player of world.getPlayers({ tags: ["knockback"] })) {
player.applyKnockback(0, 0, 4, 5)
player.removeTag("knockback")
}
})

#

because it didn't work :C

warm mason
#
import * as mc from "@minecraft/server";

mc.system.runInterval(() => {
    for (let player of mc.world.getPlayers({ tags: ["knockback"] })) {
        player.applyKnockback(0, 0, 4, 5)
        player.removeTag("knockback")
    }
})
ember swallow
#

I love you!

#

does it work with animals?

warm mason
#

sorry..

ember swallow
#

no?

warm mason
#

you didn't see anything

ember swallow
#

it was weird langue

#

so nope

ember swallow
warm mason
ember swallow
#

but now it works on me

warm mason
#

only players

ember swallow
#

how to fic?

#

fix*

warm mason
#
import * as mc from "@minecraft/server";

const dimensionIds = ["overworld","nether","the_end"]

mc.system.runInterval(() => {
  for (let dimId of dimensionIds) {
    for (let entity of mc.world.getDimension(dimId).getEntities({ tags: ["knockback"] })) {
      entity.applyKnockback(0, 0, 0, 2)
      entity.removeTag("knockback")
    }
  }
})
ember swallow
#

I am so happy that there are people like you out there, Thanks a lot!

#

doesn't work :C

warm mason
#

any errors?

ember swallow
#

think not

warm mason
#

Does the debugger say anything?

ember swallow
#

nothing is red or sometghing

#

idk how to open debugger :C

#

I work on bridge so idk

warm mason
#

Or something else... in general, look in the settings

ember swallow
#

I am so sorry but can't find it, my vridge is outdated but yh :C

warm mason
#

This is in the minecraft settings

ember swallow
#

wait,

warm mason
ember swallow
#

sometimes it does work

warm mason
ember swallow
#

some thing there are disabeled, like gray

#

very easy scripts, for detecting when right clicked

warm mason
#

That is, they are connected to the addon

ember swallow
#

OWWW it worked

warm mason
#

._.

ember swallow
#

I did @e and then itr flipped

#

but when I do 1 only it works

#

Thanks!!!!!! Love you

#

sorry for your time!

#

it's very cool in my addon! I would love to show it in action but you are probably not interested

#

and respect that 😄

ruby haven
#

In the setRotation property if I disabled bothe the camera and movement of a player using input permission will it still work?

distant tulip
ruby haven
distant tulip
#

tp is the only option

ruby haven
dim tusk
ruby haven
#

I think there is a ravager_blocked thing component in json

random flint
dim tusk
random flint
#

is it shield?

dim tusk
dim tusk
random flint
#

Either you check with projectileHitEntity, or entityRemove (beforeEvent)

dim tusk
#

My first idea was to use runtInterval to detect it but not reliable because the player can just change the durability of the shield using commands or scripts.... Lmao

random flint
#

Spawn an invisible entity at the projectile location upon entitySpawn, solely to sponge up the damage. Has no defense, which gives an accurate measurement of the damage.

Spawn the projectile again, if it despawns from hitting the invisible entity, and it is spawnable. Copy-paste the projectile component of the old one to the new one.

dim tusk
random flint
#

I think that approach would be more effective for projectiles

dim tusk
#

K, I'll be saving this but I'll be ditching this part of my idea and move on to the next one

ruby haven
#
const dx = deadEntity.location.x - damagingEntity.location.x;
const dz = deadEntity.location.z - damagingEntity.location.z;
const yaw = Math.atan2(dz, dx) * (180 / Math.PI);

Should I change the 180 to 360?

ruby haven
random flint
ruby haven
random flint
# ruby haven I wish this works if not then it has to be the issue where I disabled both the p...

Well, I got this shitty snippet of mine.
-# (Return Vector2, Rotation for the camera origin to face the target location)

function cameraRotation(cameraPosition, targetPosition) {
  const directionVector = {
    x: targetPosition.x - cameraPosition.x,
    y: targetPosition.y - cameraPosition.y,
    z: targetPosition.z - cameraPosition.z
  };

  const yawAngle = -Math.atan2(directionVector.x, directionVector.z) * (180 / Math.PI);

  const xzDistance = Math.hypot(directionVector.x, directionVector.z);
  const pitchAngle = -Math.atan2(directionVector.y, xzDistance) * (180 / Math.PI);

  return { pitch: pitchAngle, yaw: yawAngle };
}
distant tulip
dim tusk
#

Just a hunch, cause it doesn't apply to all like if the entity has knockback resistance like ravagers

celest abyss
#

It is possible to detect when a player dies

#

?

distant tulip
ruby haven
#

Is there a way to make an entity stop moving or looking

warm mason
ruby haven
warm mason
ruby haven
dim tusk
#

idk if this is an intentional thing but the isFalling function on players, when I tp them from above it doesn't trigger unless I move an inch

#

Can anyone confirm if this is intentional because I don't like it lmao

#

If anyone is gonna ask, I'm on 1.21.60.21

narrow patio
#

how do you get getComponet typings

dim tusk
narrow patio
#

entity

ruby haven
#
    const rot = damagingEntity.getRotation();
    const rotation = rot.y + 90;


    system.runTimeout(() => {
      damagingEntity.teleport({ x: newX, y: newY, z: newZ }, {
        facingLocation: deadEntity.location
      });
    }, 20);
    system.runTimeout(() => {
      damagingEntity.runCommand(`execute as @s at @s positioned ~~~ rotated ${rotation}~-20 run camera @s set minecraft:free ease 1 out_cubic pos ^4^6^6 facing @s`);
    }, 10)

What do I do here so that I will always get the same rotation of the camera everytime, I wanted create a constant side view scene, I tried taking the rotation of the entity then adding 90 to it but it doesn't work sometimes sideview sometimes front view sometimes back view

jade grail
#

I still dont know how /scriptevent works can smone make a script event and show me it ive checked the documentation

jade grail
#

wait ive found it

#

ik im way off

wary edge
jade grail
wary edge
#

Wdym how?

jade grail
#

what iirc mean -_-

wary edge
#

Whats the command you used?

jade grail
#

complex term?

wary edge
jade grail
#

0_0

#

i want my name space as naz

#

instead of naz do i put naz:

wary edge
valid ice
jade grail
#

/scriptevent naz:test

valid ice
#

Ye

wary edge
jade grail
#

Ty it working

#

😭 i thought when it asked for id it was refering to the namespace

#

and message was the id

celest relic
#

Can you set a block to be waterlogged with scripts?

wary edge
celest relic
#

What's the function?

unique dragon
simple arch
#

what does this mean?

ruby haven
#

#debug-playground

simple arch
#

its not finding what to fix

warm mason
simple arch
#

what code?

warm mason
# simple arch

Somewhere in the code you are trying to get a component from undefined, which means some variable in which there should be an entity can be equal to undefined

simple arch
#

idk where though

#

everything looks right

gusty bramble
#

Is it possible to spawn items on the ground?

neat hound
#

quick question.... if a class has a static beta function in it, but you are not using it in your stable add-on... is it gonna freak out to be there?

dim tusk
neat hound
#

Not using it. It is just in my blockClass

dim tusk
#
import { ItemStack } from '@minecraft/server';

dimension.spawnItem(new ItemStack('minecraft:stick', 1, location);```
distant tulip
chilly fractal
#

Yo can anyone suggest a good & useful and vanilla-ish command I should make? For example I have the !home command, !tps and many more, but I just ran into a dead end... and yeah I want to make alot of commands but there aren't any command ideas that don't turn the server into a factions server. Any good suggestions? (If you can come up with a staff command I'll make it too :])

chilly fractal
#

Already done

distant tulip
#

!set-rules

chilly fractal
#

Bet

#

Done

distant tulip
#

!log (chat)

#

!mute (chat)

chilly fractal
#

Already done with 3 variations (chatlog & commandlog & actionlog)

#

And mute already done

distant tulip
#

!muteall

chilly fractal
#

Good idea ima rename to lock chat tho

distant tulip
#

!announce (save a message and show it to every player once)
!join-message (save a message and show it to players when they join)

chilly fractal
#

Already done :)

#

Can you suggest some player wise commands tho?

distant tulip
#

!deathlog ? show past death infos

chilly fractal
#

Within actionlogs (becuz there is a max of 10 lifes system)

#

BTW can you get suggest some player commands? Cuz there is barely any commands there

distant tulip
#

can't think of any

#

!schedule <world/selector> <message>
set a timer to send a message
!reminder <time> <message> <message/actionbar/title>

#

!randomblock <true/false> <[slots]>
on payer place a block randomly swap blocks from selected slots to main hand (for building)

warm mason
scarlet sable
#

Is there an "is typing" function?

warm mason
jolly citrus
#

what do i do guys

#

how to track down the problem

#

i even turned all my intervals and i still get this

chilly fractal
jolly citrus
#

like the numbers are racking up every single second

#

but it's weird,

#

even NA players on my world dont complain about lag??

#

people are asking me how it runs so smoothly

#

with so many scripts

chilly fractal
#

So you have long running operations I believe.

jolly citrus
chilly fractal
#

It's the cause of the problem, and you create an interval on each snowball spawn, which is in fact not performant at all. Now from the "cd" and "rid" I believe you are trying to despawn the snowball if it lives for 160 ticks, now a better way to do this is doing a system.runTimeout(() => { // code }, 160);

jolly citrus
#

it's not ticks

#

its for a cooldown

#

16 seconds

chilly fractal
#

Alright then what is it?

jolly citrus
#

1 = 1 tenth of a second here

#

its for the player

#

cooldown when using a special item

chilly fractal
#

Alright there is a better way to do this just set a cooldown key and after 16*20 (converts 16s to ticks) just deletes that map

#

Example would be