#Script API General
1 messages · Page 39 of 1
How about forcing a player to be in first person?
camera api
Oh there is what class can I find it
player.camera
I know there is a command for it but what is better script or command running in json?
Ah, yes I wouldn't have known that lol. I haven't used it in a very long time.
I am really sad about it bc its really annoying to install types every single time, or thigns like @types/node
I personally prefer local installs. Helps to ensure the types being used for that project aren't overlapping with other versions I may be using in other stuff. Keeps things maintained, and orderly.
Was there a reason behind it's removal? Sounds like a really nice thing to have ngl
Well i mean more like test scripts not actually valueable projects if you know what i mean
Oh, definitely.
I never really understood what it was removed, its kinda shit its not even toggable
Dang
Seems like an odd thing to remove but if I were a betting man, they probably removed it on the same premise as to why I prefer local installs.
Well but you still could have option to enable it
Makes me wonder if they plan to remove it in VSC in the near future.
👀
People here are gonna panic lol.
What do you think about that generated code thats is assigning prototypes for all returned Vector3 objects?
its a bit off topic but what do you think about it?
How do I get a gamerule? For example, get the 'keepinventory' gamerule and make it return if it is true or false
VSC? I don't think so. It recognizes global installs.
Got a link or reference so I can freshen up on this?
At work, so I'm not entirely focused lol.
i can confirm that global installs work fine
yeah
all my mc packages are global installs
VSCode Version: 1.17.1 OS Version: Ubuntu 16.04 Reproduces without extensions: Yes This issue is also posted on: https://stackoverflow.com/questions/46762461/how-to-use-global-node-packages-with-vs...
I have to test this
you are on windows?
yes
Is there a way to detect character player through scripting if it is slim or not?
character player?
not possible
Yes like slim the model
this is with a global install
i am confused asf
scripts are server side only
we can't detect any of the resource pack stuff
not the case in your end?
Ah okay
Its related to skin, and skin is resolved on server side as well btu not sure if there is direct access or not, but its not possible for now anyway
oh
yeah forgot about the character creator stuff
i don't thing even the server net can get those
Yeah it would be great if that is possible
ya it would be great
That would need to be investigated further. Seems it was removed back in 2017 but it's plausible it was reinstated years later.
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?
I don’t think that damage can be canceled (unless it’s damage_sensor). And if you also deal damage through applyDamage, it will either be applied or not, because after receiving damage there is a certain cooldown that does not allow you to deal damage in the next couple of ticks after receiving it
And I still don’t understand why you need to cancel the damage
Uh no not applying
I re-add the lost health to the player
If they shouldn't be hurt in this context
Well, he will die if the damage is lethal
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
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
Nvm, welp thanks!
Best way to detect if an entity is in a cave? Of course without using the entity behavior file
Well, you can check the surrounding blocks and height
man, if only we have air cave from java
Ew.
They're not even used anymore.
i mean... it is good way to detect caves
fr? sense when?
Or...is_undergroud.
Basically you can just get the highest block and check if you are under it
I never said to use JSON file.
Reread what I said, an is_underground component or filter via ScriptAPI would be far sustantially better than using cave air.
I don’t understand what component we are talking about and what “cave air” is
is_underground is not a component and there is not filter for it in the api
it is from java
Which is exactly why I said it be better if we had support for that then use cave air.
Because what is even cave air? If I just destroy the cave....then what?
i mean yeah i said "if" it is more of a work around if we did have it
good point
Ok but what would be the best way to check a large area?
Because these caves are huge af
rays or A* algo
.
that not enough
a block above don't mean you are underground
Technically...

But if you are under some kind of block, then you are not on the surface, but therefore underground. You can make a couple of exceptions or checks.
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
Just do some extra checks
Maybe exclude leaves or something?
A ray? Do you mean the entity's ray reach? Isn't that limited?
what has changed with 1.20.50
getBlockFromRay
use multiple in all directions
Okay thanks, would a system.runInterval be best?
I'm not trying to cause lag when trying to check the surroundings
I just found out my docs update caused old links to be broken completely, whoops
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
Typedoc new update kinda changed how things are parsed. Seems like if the module is marked with beta tag, everything is marked as beta.
I’ll bring this up with the typedoc devs
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?
You can set property in scripts without using events
Just grab the entity you want to set the property with
entity.setProperty('<name>', <value>); // accepted values or values you indicated in entity file```
Wait I just realized that the only argument that the query.has_property takes is only the name it doesn't take any value
You used ```query.property('<name>') == <value>
// sample
query.property('tnt:exploded') == true
has_property is straightforward it returns true when the property exist on tha player otherwise place
Oh okay thanks, I just wanted to play an animation when the player rides the smile entity so yeah this is possible
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>);
}
}
});```
Wait... You will set the property player is riding or the player itself?
The property of the player cause it is the one playing the animation
^ hmm, so this one will work then... @ruby haven
Yeah is it safe to use multiple system.run interval in an addon?
is getComponent('food') fixed?
Why do you need to separate it if you could just one?
Yes...
tq
Wait sorry wdym by fixed?
Sorry I read it wrong I thought you'd said exist 😭
As I said why make separate intervals when you can just use one unless each one has specific delays
No just asking cause I'm trying to make the addon not laggy even in low end devices cause most bedrock players play on phone
Each one has specific delays so yeah
It kinda depends what you do in each of them
Sorry I don't know... 😞 Just try it out.
If your settings property constantly or dynamic property... Probably yes
I tested it and yes it doesn't work... Idk if it really doesn't work on vanilla and only custom...
Hey
How I can make the button form has conditions to appear?
Like
if (condition) {
form.button()
}
need some help
Man...open a post.
ok
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
I have...many questions like why youre using execute and runcommandasync. Secondly, whats the issue? When do you want it to damage?
I want damage to be applied to the player when interacting with doors and buttons
Then why did you make it return early?
I didn't put the complete code but it actually returns you to a function
What?
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?
Im confused. You want it to be
!block.typeId = door then return.
world.afterEvents.playerInteractWithBlock.subscribe(ev => {
if (ev.block.typeId.includes('minecraft:door')) return;
test(ev.player);
});
function test(player) {
player.runCommandAsync('execute as @s at @s run damage @s 2000');
}
Yeah...like I said.
The semicolon after the return cuts off the code, so it thinks the runCommand is the next line, effectively
Hm?
the include is necessary?
In the first code, not the one most recently sent
I need it for all doors
Yes...do what I said.
Aw I see
But for it to work on all doors, would I have to copy and paste the code?
Which would account for trapdoors right!
Anyone know how to make the form response more exactly?
....?
yur
I was doing a form with conditions on the buttons
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
Ah, I see
You'd have to conditionally check button visibility in the selections as well
I don't have any ideia how to do that
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
In a vector3, what is the equivalent of ^^^1 in commands? How can I get the coordinate one block in front of their face
GettBlockFromViewDirection?
Does that Block include air?
headlocation+viewdirection
I thought its just the first solid block in ur ray
No, that's very innacurate in how I'm doing this. It returned with the going to the aide
Spherical coordinates 
side*
this
And it was unfortunately too innacurate for what I'm doing
getHeadLocation() returns a vec3 where the head is
getViewDirection returns a unit vec3 based on where they're looking
Does getBlockFromViewDirection return air?
Iknow what they do
Can I get the location of the undefined?
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
What do you mean?
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 }
In this why is my property throwing errors?
Can someone tell me what's wrong here
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
Just change the behavior of arrow bro
wdym
I want to create a new projectile
ohh, u mean copy an arrow?
Yeah just modify the arrow
In this one why is my property throwing errors?
How do you throw the projectile?
It throws an error in game?
No oh so it's normal for it to look like that
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);
}
not sure
I think so. My json file yells at me all the time for stuff that works
Hahah I'm so confused why bridge is saying it's wrong I read the documentTion and I'm doing it right
Yeah bridge is weird, but I still love using it lol
Yeah super useful
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 });
});
}
});```
I feel like its work just the auto completion isn't updated
If iirc the speed of the bullet will be based on the * 2 or whatever you put there.
That just shoots my arrow to the side
unfortunately
my original shot shot straight in a line
this shoots no further and just shoots to the side
That shouldn't happen.
Does your projectile have the runtime identifier of snowball?
and yes
I would detect if there's a block above the entity, and then also detect if they are below a certain y level threshold
getTopMostBlock
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 });
});
}
});```
A "minecraft:snowball" is not the same as my bullet, and you changed the values of original code
Unfortunately, mine just went off to the right
The problem is your entity file then
I based it off snowball, then off arrow
I changed the spawn locations with your original location and it still works
And my point still stands that you can change the power of the projectile in the shoot() property not just direction/angle...
do yal know if the name tags was changed and how you edit them
Entity.nameTag = ''
As well as the values
player.nameTag
Nahh my point still stands you change power using shoot()
thank you for posting the new values
Sarcastic? Idk I'm kinda stupid with this.
that change player to entity
We're just talking about entity file of the bullet and scripts no player
oh ok will it work on a player
Wym by player?
it is for chat ranks and to change the over head nametag of the player
Ohh... this is a different topic
just do player.nameTag but the name doesn't change in the chat you need to have different approach
oh my bad
i have both but my name=Tag stoepd working
player.nameTag = ${displayName} §f| ${nameColor}${player.name};
Show the code then ...
What would be the appropriate distance? Also wouldn't I have to detect the light level too? But the player could be nearby lava or a torch 😅
oh no i just mean detect if there's a block above them in general
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
They save... When putting a dp on an item you need to put the item back to slot it doesn't work on stackables tho
Ik, it's not stackable
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
You're not setting the item back to the slot.
wdym
Can you explain??
oops
doubel questionmark
Every time you modify an item you need to put it back in the slot.
double*
I can't type today
can you give me a small example code?
I'm tired lol, I can't think properly
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);
}
}
});```
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);
}
}
});```
I'm gonna test it out rq
This applies to everything setting name, lore, durability or whatever as long as you modify the item, you need to put back item to slot
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
Dumb question but are you riding the entity?
alr, thanks
Don't worry it doesn't spam setting the item to slot, it knows when you modify an item it only sets the item to slot
Ah since it runs every interval so it is making the error
Yeah...just use the player to interact with entity world event
And trigger the condition that way
Just do riding?.entityRidingOn?.typeId === '' if it keeps persisting
This is a lot more better for documentation than the other link I use
I think it spams because you're not riding anything and it tries to grab the entity player is riding even tho he's not
That's why I added the ?
Yeah
But could that also be a house?
Yeah
you could also check if the entity is standing on stone/deepslate
There won't be a perfect way for this
Yeah I kinda figured. I was maybe thinking of just restricting it under the standard water level and go from there
yeah
Ah, thanks so much! It worked!
Alr thanks for the input 🙏
np
Are you talking about the dynamic property?
Lmao I forgot things easily lmao...
Welcome I guess?
{
"controller.render.wide.possesed": "q.property('smile:ride') == true && variable.short_arm_offset_right == 0.0"
}
This one loads a different geo if the model is wide and I also made one for slim
Why does it say q.property('smile:ride') doesn't have an actor?
The variable short arm offset works but the player needs to be in first person to load that
yes lol
Just ignore it... 🙃
Oh I hope my community doesn't complain about it
So after it loads the model will stay that way even if the player switches to third person right?
So if you put that variable when the player is in third person it won't trigger that when go to first person it trigger that then it would become permanent otherwise no
No cause I the moment they ride the smile entity I run a function that forces them to be in first person and after the render controllers load they can switch again to third person and the model will still stay that way right?
Yeah it would become "permanent"
Okay finally I was able to finish the death scene
Wait I think you misunderstood... So that variable detects if the player has Alex slim or Steve body...
Or you understand it
Yes
The only thing I don't like is the error showing it ruins the beauty of the death scene
Use json ui to hide that 🤷 idk or ask in #1067869318383157430 it's not my specialty sorry
Nah I'm not asking for help it's fine
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?
I think it already exist in json
Its already built in do you want to control how much durability the item loses?
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?
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)
}
})
is it possible to check players offhand?
could i ask if its possible to check for player interactions with blocks that aren't normally interactable
like grass or stone
Use before events
world.beforeEvents.playerInteractWithBlock.subscribe(({ block, player }) => {
if (block.typeId === 'minecraft:grass_block') {
}
});```
who is knowledgeable here in creating camera presets?
const equipment = player.getComponent('equippable');
const offhand = equipment.getEquipment('Offhand');
console.error(offhand?.typeId);```
Hahaha nice medosa
oh okay maybe it didnt work because i used after events
thank you
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?
how do i change movement speed of player via scripting? cant find a method in EntityMovementComponent
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`);
}
});
In the last command I wanted to activate a camera command where it creates a side view scene of the damaging.entity but I can't find the right values
Example in rectangle I want an angle where I am facing the right longer part of that rectangle
does anyone know why it says spawn item does not have required privbiliges
Are you using it in a beforeEvent?
how to get difficulty?
is it even possible?
As I remember it is impossible
Lol WHAT
I was surprised too when I couldn't find it.
that's crazy
The funny thing is that there is even enumeration for difficulty, but there is no difficulty
why does the Difficulty enum exist then?
idk
completely unused
Does someone know how to achieve this?
try search it up maybe
Is there a obfuscator that doesn’t have its deobfuscate?
No.
Obfuscation bad.
ts good
just use the playAnimation function, you should try to avoid using player.json whenever possible, only use it when ABSOLUTELY NECESSARY
Oh so I can playAnimation in the behavior side and will play in the resource side?
Yes
Can you tell if there is a better way than doing this
Check the last command
tried but when i have something in my offhand, still says i have nothing?
Is there a way to check if Block 1 is connected with Block 2?
Thx
I wonder how this will work
Didn't those already exist
There was a setDynamicProperty method, and here is setDynamicProperties
Ohhhhhh I see
Didn't catch the plural, thought it was just bad script changelog formatting 😛
I thought so too at first
It's a nice QOL, but I don't see myself using it that much lol
Yes
Yar
@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
:)
those are the same thing
In my post someone said "We could change that to SU" what is SU?
On Linux it's known as a switch user. On Android it's known as superuser. Although superuser is sufficient for Linux as well. It's the equivalence of having or gaining administrative access to the system. Acquiring elevated privileges to do things you normally could not do without proper permissions.
"xyz"
.split("")
.reduce((ac, cu) => {
ac[cu] = playerPos[cu] - blockPos[cu]
return ac
}, {})
``` how would it work on this?
I'm not sure I see the context related to that and the reference to SU.
Look in my post
If you saw someone respond with we can chat to SU which means idk either
.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
Essentially, these are just particles, and they cannot be detected
Rain can be detected via getWeather() but you need to take into account the biome and where the block is located
Yeah I know how to do it I was just wondering if there was an easy one.
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?
was this figured out?
What about it?
do we have to use as to get around this issue?
If using typescript yes.
how did they not change this
Intentional change by the devs.
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?
@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
Actual BP file count
so there not changing this?
As far as I know.
they should be
navi said that workaround is for now
just got no clue when it'll be changed
For now can be until 2030.
yep
does anyone here knows all the things that can update a block ?
Can someone help me make an exact replica of an addon?
Logs update leaf blocks
looks like they actually changed it back in 1.17.0-beta wrong way around lmao
oh
wait
nvm other way around
Can someone help me recreate a script for an addon I have? I need a similar one
i am trying to create a onBlockUpdate event listener by janking and detecting all the changes that could happen to a block
these are the changes from 1.16-beta to 1.17-beta if anyone is curious https://stirante.com/script/diff.html#%40minecraft%2Fserver/1.16.0-beta.1.21.44-stable/1.17.0-beta.1.21.50-stable
Please if anyone is active, you'll see how interesting this api is
it changes a lot depending on what block it is
You should make a post about this. It does seem like an interesting challenge.
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
Yes, this is EXACTLY why i am doing it
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
yeah but i need it as a function
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
Does chatSend work only for 1.16.0-beta or it works for 1.8.0-beta too?
What?
chatsend works on the last latest beta right now it's 1.17.0-beta
what's new in script 2.0.0 ?
You can't use it rn as what smokey said
why
I don't know
Wait lemme try searching Smokey's Message regarding to this
Does it work on 1.8.0-beta?
@minecraft/server version in manifest
1.20.50
Where did you get the 1.8.0-beta?
that’s the 1.20.50 ?
In 1.21.50 it only has 1.17.0-beta and 1.16.0 below for server and 1.4.0-beta and 1.3.0 for server ui
I don't where did you get the 1.8.0-beta.
Wdym
1.8.0-beta is for 1.20.50
Yes chatsend work on that version
@dim tusk do you take interest in this ?
i am still relatively new to Scripting, well, haven't made any scripts of my own yet
No I'm not sorry... It's not interesting for me since it's kinda basic that everyone can do... And it's kinda resource intensive
It's better to wait till we get a native event for that, but even that might not be super performant
basic yeah, but nobody have done it yet.
there's a heap of block updates every tick
is there a way to optimize the performance ?
and trying to iterate or test through each would be very slow
Someone did it already, but didn't just share it
None...
well you don't have a script yet so no
then it is as good as not existing at all.
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
But you can't use it still... We already told you, resource intensive
why do you want it anyway?
it's for a custom fluids api my friend is making
there are two versions of the fluids, one ticking, one static
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
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
that template is old
it had been there for over a year now
So?
honestly that's completely pointless. You're gonna be ticking more anyway to check the enviroment than if the fluid was just always ticking
#1314157932757127198 message
so is it possible to do?
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
its prob not there yet
/reload doesn't reload ui and textures?
it only reloads behavior side stuff
functions and scripts
you need to do /reload all if you want to reload resource pack and the whole behavior pack
oh sad
nice
just use the command, I'm doing that rn
same for clearing all effects
there's no script method for that, just gotta use a command

you can technically for loop for every effect
yeah not fun though
just bit more code to write
for (const effect of player.getEffects()) {
player.removeEffect(effect);
};
is it possible to get the amount a player has of a certain item in their inventory in total without using a loop
i dont think so
no
what got added from 1.13 to 1.16 in the server module?
perfect thanks!
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
Idk set a property and detect it in molang, idk much about molang so if it works it works
How to detect the lack of an entity from a specific family?
?
If the entity is not in a family?
Be more specific and I'll help

Something like the command execute unless entity @e[family=zombie,r=1]
run for non-undead
if (!comp.getTypeFamilies().includes("undead")) {};
shorter alternative:
if (!comp.hasTypeFamily("undead") {};
beta or non beta
non
both non beta?
ye
thx
Thanks
but if its the player?
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)
Yes it works for player I believe, lemme check rq
Yes, but the problem is that I don't want to edit the player because of the problems it generates.
Therefore, I cannot add properties to it
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.
I'm looking for another way to not edit the player
Look for Array#reduce
I thought that but wasn't sure, thank you
Sadly there may not be any other way as minecraft's client system isn't that dynamic. So tags and other things can't actually be used.
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.
could i compress a 884 uint8 array into 6 or 12 base36 string?
or well a string with just letters and numbers
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.
There is no component responsible for this in the scripts yet
save the last entities the player interacted with
i did write a script for it a long time ago here
This isn't accurate
yeah
it is the best you can do
I have the copy here lmao
You gave me that on statistics thing I made 7-8 months ago
You can also take into account the entitySpawn event to increase accuracy. To take the closest possible parents from a born entity
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);
}
}
}
});```
that what i did i think
I'm not sure if this is it because I modified it before lmao
Yes, my file is getting bigger when I include them ☠️
huh? I don't see any comments at all
I don't see any code*
If only we can get item we can breed to mobs
Thanks!
I know how to increase accuracy to 100%!!
how?
?
Just remove the component from the entity json code and create your own using scripts.
:)
😭😭 too many entities man
lol
for every entity?
Not at all. You can even add this behavior in other parts of your code
With such ambitions, I will soon replace all components of mobs/items and blocks with scripts
How does setting lore work? i tried and didnt let me
Ohh noo. Get this man away from Mojang team!!
Are you setting the item back to slot?
maybe xp take the same rotation as one of the parents...?
like how items take the rotation of who drooped them
wdym?
get item set lore? then that it
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"])
When you modify an item you always put the item back to the slot
It's not just renaming it then done
I just really lack control over the behavior of entities.
And one line can only take up 50 characters, and a total of a maximum of 20 lines
I am so happy that Mojang put player break and interact to stable
Few script versions ago
And that sucks....Mojang fix this
-# which they won't
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
I'm waiting for them to remove read-only from entity.target
I could check the breaking of the item easily.... Not very accurate tho
Or when they allow us to build a path through entityNavigationComponent
Otherwise I will create my entityNavigationComponent
I'm waiting for it to be stable :c
It exists, but all its usefulness is the information that it exists
quick question: is there a stable way to detect a world's difficulty via scripts?
There’s not even an experimental one
getGamemode() is still beta?
Wait, stupid it's gamemode not difficult 🤦
no
huh. you'd figure something as simple as that would be a thing
welp.
gotta find another way to convince players not to choose hard difficulty
I asked this question many times lol... Is the damage shield get is based on the damage the attacker dealed?
I believe so
You can't convince me....
✅
I can oneshot the shield with a high enough strength effect
you poor thing
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
just put ">9000" and call it a day 🧹
setitem how do i add nbt tags like keep ondeath lock in slot
That's all you can do with items
i cant get the lock in slot to work or i dont knw how to
ItemStack.lockMode = 'slot';
ItemStack.keepOnDeath = true```
this doesnt explain it well
Oh...
wanna see what i tried
it told me it was a function in the editor
Ohh didn't notice the mistake lmao
What would you rather use?
if(player.getGameMode() != "creative" || player.getGameMode() != "spectator")
vs
if(!["creative", "spectator"].includes(player.getGameMode()))
Second one because first is logically flawed
2nd
&&
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.
My friend needs to change his ||s to &&s now haha, he still wouldn't consider the 2nd option tho
2nd option might be easier to fast-edit
Yeah
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
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?
Tbh, I'm interested in what's the limit of the marketplace
most stuff are stable
Actually NOT Guns Add-on
"Guns" you hold transform into zweihanders
What?
so what does the getblocks do?
It lets you get all the blocks matching some filters. Much faster than looping through the whole area.
so wait if all blocks are the same in the area it will pass?
could you make an example using the if block.dimension.getBlocks()) i been struggling using it to find all the blocks that are the same state using the Minecraft: tick
Btw you need to use BlockVolume
How do I use set lore
it accepts an array
#1067535608660107284 message
@rapid sail ^
Im the set item I need to make like this?
Bla... Bla... Bla..
setItem(0, a defined item?)
It's an array as what seawhite said when you modify an item on inventory YOU ALWAYS PUT THE ITEM BACK TO SLOT
item.setLore(["yeet", "foobar"]);```
gotta check if its for ItemStack brb
Remind me, does playerinput get trigerred for jump if jump perms are disabled?
Yes
Same as the sneak
I know, I got confused with setItem
oh
const equip = player.getComponent('equippable');
const mainhand = equip.getEquipment('Mainhand');
mainhand.setLore(['test', 'test']);
// set the item back to slot
equip.setEquipment('Mainhand', mainhand);```
Ty
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);```
Why the hell can't I interact with a custom block while holding a bucket???
It doesn't swing your arms like it supposed to do
it doesn't interact at all
Is your custom block using custom components?
yes, onPlayerInteract ignores interactions done with a bucket for some reason
i think this is also an issue with some of the copper blocks in vanilla
not sure if its fixed by now though
Hmm, weird... It's been awhile since I touched custom components... So I can't really say anything tho
What's the issue?
cant use items while aiming at some of the copper blocks
i switched to world.beforeEvents.playerInteractWithBlock and it detects it fine now... so weird
Yes Soo weird
what's even weirder is that i have another block with custom components that interacts with bucket fine
Did you place and break the block?
After reloading
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
yes, i have tried to break and replace the blocks
yes?
Click the link I put
ah i see how would i use if meaning if the block is there? and not use for?
worldLoad
does anyone know where to find 2.0.0-alpha typings?
Thanks
coddy?
I'm confused with your question
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?
so i add return at the end of the thing?
I'm asking you
Hmm
How do I get an entity's scoreboard?
world.scoreboard.getObjective('objective').getScore(entity)
i explained more in dms
ty
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
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
How to place structure with degrees? I got this
await world.structureManager.place("diagonal", player.dimension, { x: targetX, y: targetY, z: targetZ });
@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;
Oh okay I actually want the x value cause I want the camera to be always side view no matter what is the rotation of the player in the world
Thanks by the way
/reload all gigachad
Ty
How do i detect if a player blocked a projectile?
"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.
Where does the pos ^^^ base it's position is it the rotation of the feet of the head?
^^^ is where the player is looking, so I think it would be the position of the eyes/head
I think it's just better to use ^^^ than to get the location of the entity
What does execute as @s at @s positioned ~~~ rotated ~ -20 do?
Sorry been outdated to command for so long
Try looking examples @ https://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server.Camera.html
The ~~~ means it doesn't align to where the player is looking while ^^^ is aligned
Huhh? I'm confused with your explanation
I'm pointing out this specific part.. what does positioned do and rotated do
Oh that's just a parameter of camera command
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
My code works like this
Wait so it's better to use execute than just straight out camera command
Cause in my code I used the player as runner of the command so I thought that it is also the executor
I didn't understand
Ohh so it's just following the y rotation but not where the player is looking?
That's why he said setCamera version
Did you backread 😭
yeah
What I mean is if it is better to use /execute as @s at @s rather than /camera @s
Is he not doing it already?
And he use /camera to change view
I probably can do it.. but I'm kinda lazy to do it loo
dang I didn't read the command clearly but I think using positioned and rotated may solve my problem
system.afterEvents.scriptEventReceive.subscribe(data => {
// Code
})
```https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/scripteventcommandmessageafterevent?view=minecraft-bedrock-experimental
Thanks
i was looking in the world part of it
there is an error it says
code
.
Recive -> Receive
-_- 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'
Then use a different namespace
i think i got fix

impossible change radius of minecraft:follow_orbit camera with script api
it requires creating of custom template of orbital camera
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! 😄
system.runInterval(() => {
for (let player of world.getPlayers({ tags: ["knockback"] })) {
player.applyKnockback(0, 0, 0, 2)
player.removeTag("knockback")
}
})
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
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")
}
})
sorry..
no?
you didn't see anything
:C
import * as name means you are importing everything from that module and you need to write it with the prefix you specified. For example mc.system
but now it works on me
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")
}
}
})
I am so happy that there are people like you out there, Thanks a lot!
doesn't work :C
any errors?
think not
Does the debugger say anything?
nothing is red or sometghing
idk how to open debugger :C
I work on bridge so idk
settings > creator > debug log
Or something else... in general, look in the settings
I am so sorry but can't find it, my vridge is outdated but yh :C
This is in the minecraft settings
wait,
sometimes it does work
Have you already worked with scripts in your addon?
some thing there are disabeled, like gray
very easy scripts, for detecting when right clicked
That is, they are connected to the addon
OWWW it worked
._.
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 😄
In the setRotation property if I disabled bothe the camera and movement of a player using input permission will it still work?
setRotation don't work for players
Noooooooo
tp is the only option
Yeah
^ if possible
-# bump
I think there is a ravager_blocked thing component in json
projectileHitEntity?
I'm not sure but i think it won't trigger since the projectile is not even hitting the player at all right?
is it shield?
Uhh... What? I'm talking about script only
Yahh
Either you check with projectileHitEntity, or entityRemove (beforeEvent)
hmm, looks like I'll be ditching this for now... My idea was to detect the amount of damage shield blocked since the durability damage shield takes is based on the damage the attacker dealt
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
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.
For projectiles or for Melee attacks too?
I think that approach would be more effective for projectiles
K, I'll be saving this but I'll be ditching this part of my idea and move on to the next one
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?
This is supposed to teleport the player facing a certain entity but they are not parallel I'm not getting the desired rotation
I don't know if Minecraft uses -180 to 180 or 0 to 360
player.teleport(location,{
facingLocation: entity.location
})
🤓👆
I wish this works if not then it has to be the issue where I disabled both the players movement and camera
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 };
}
maybe get the arrow and detect when it velocity change by a big amount
this apply to some other cases too, so maybe add more filters
Maybe i could detect the block of the melee attack if the entity who attacked got pushed 🤷
Just a hunch, cause it doesn't apply to all like if the entity has knockback resistance like ravagers
world.afterEvents.entityDie.subscribe((event)=>{
const {damageSource, deadEntity} = event
if(deadEntity.typeId === "minecraft:player"){}
})
Is there a way to make an entity stop moving or looking
entity.clearVelocity()
This will be faster than activating functions in json right?
It will be the same
I'm surprised it is a lot faster
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
how do you get getComponet typings
Entity, item or blocks?
entity
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
I still dont know how /scriptevent works can smone make a script event and show me it ive checked the documentation
What have you done?
ive deleted it now cuz it didnt work
wait ive found it
ik im way off
Id needs to be a namespace:id iirc.
how?
Wdym how?
what iirc mean -_-
Whats the command you used?
complex term?
If
I
Recall
Correctly
.
The colon just separates the namespace & the id
/scriptevent naz:test
Ye
Then id=='naz:test'
ill try that thanks
Ty it working
😭 i thought when it asked for id it was refering to the namespace
and message was the id
Plss help me 😭😭
Can you set a block to be waterlogged with scripts?
Only if it can be waterlogged.
What's the function?
setWaterlogged(isWaterlogged: boolean): void
what does this mean?
Go to debug playground and try to debug your code
#debug-playground
its not finding what to fix
This means you need to send a code
what code?
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
Is it possible to spawn items on the ground?
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?
Yes, using beta on stable version of script will freak out while using stable in beta won't
Not using it. It is just in my blockClass
Yes very much possible
import { ItemStack } from '@minecraft/server';
dimension.spawnItem(new ItemStack('minecraft:stick', 1, location);```
not sure about typeScript but in javaScript it won't be a problem
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 :])
!spawn
!rules
Already done
!set-rules
Already done with 3 variations (chatlog & commandlog & actionlog)
And mute already done
!muteall
Good idea ima rename to lock chat tho
!announce (save a message and show it to every player once)
!join-message (save a message and show it to players when they join)
!deathlog ? show past death infos
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
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)
!invsee - to view another player’s inventory (available only for admins)
Is there an "is typing" function?
no
what do i do guys
how to track down the problem
i even turned all my intervals and i still get this
Already done :)
If it is on using /reload or when loading world/server/Realm for first time then it's okay, but if it's after that then there is something a bit optimized in your code
no it happens every tick
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
So you have long running operations I believe.
yes
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);
no
it's not ticks
its for a cooldown
16 seconds
Alright then what is it?
