#Script API General
1 messages · Page 7 of 1
does anyone have an issue with custom components making the block interactable even without onPlayerInteract?
there's no way to stop that currently
How to store all metadata of an itemStack? Even if its a book and quil?
metadata?
its already out in planetminecraft
link
I thought it was fixed in 1.21? Or was it fixed in .10?
if a block has the custom components component it becomes interactable
they made it so that the interaction resulted in the held block being placed if the custom component doesn't include the onPlayerInteract listener but it doesn't work perfectly
but there's no way to actually stop it from being interactable
no rule against that but sure
thanks
if a block has the custom components component it becomes interactable
Yeah that's fixed right?
but it doesn't work perfectly
You still have issues with this?
He means data values
no, it's not fixed
So it must be in preview then
no
What do you mean no?
Then use playerInteractWithBlock event
i hate typing on phone I can explain tomorrow
The text written in a book, for the other stuff I‘ve made something 5 months ago
Getting it as a string
https://bugs.mojang.com/browse/MCPE-179928 Yeah it should be resolved
SmokeyStack
Done (Resolved)
Fixed
U don't meaN nbt tags ?
which versio. do they say they resolved it in
Read my comment in the bug report
we can't do that
that change does not resolve your bug report
they just added a janky block placement system when the block is interacted with
When you have time please show me a video of what exactly youre having problems with bc i havent experienced this ever since the fix
Is there an event that detects durability damage?
anyone know about bedrock protocols? like: minecraft://?, i want to open the servers tab using web :c
#off-topic
no
Damn but ty
sub for all the events that can cause damage
item use
block break
...
compare the damage in the before and after event
If its for custom items then yes, but only for entity hit
When attacking with a tool, even without an event to consume durability, it loses 2 durability points. I want to stop this, I already tried using entityHitEntity to detect the attack and add durability again, but when the attack does not cause damage, it still consumes durability...
I need to find a solution for this
Is this for a custom item?
Yep
Then do the method above that i said
remove the durability component?
That's not what they want
I need it
Use the onBeforeDurabilityDamage custom component @north rapids
ah
Wich method?
Oh, thanks
Is it possible to cancel the event with event.cancel?
Ok tks ya
is there an event when an entity touch a block? I cant find one
Like steps on? Only for custom components
no, literally touch a block It can be by stepping on it or touching the side
By the way, how do you manage to be in several places almost at the same time? you literally just wrote in minecraft feedbacks
There is block break , item use events
How do you detect if the held itemStack has enchantments?
getComponent("enchantable").getEnchantments
Yeah
nice ty
also what is better to use overall
player.dimension.spawnEntity or world.getDimension(player.dimension.id).spawnEntity
can you share the link pls
first one
sent in dms
cuz its shorter?
no, cause the second one is first trying to get the dimension
then spawning the entity
ah so first one is faster overall
and the first one already has the dimension
nice ty
thanks
No differences
Wait
well ig first one is more clean
First one since youre already calling dimension.
2nd one houre calling dimension to get its id, then using world to get the dimension class based on the id
got it
now this is weird
spawnEntity that has triggerEvent doesnt seem like its working
to be more specific, the entity spawns when the player uses the item, which goes boom and give effect to nearby enemies
and the event should make the player to be unaffected
turns out the entity json is more complicated than i thought
god
oh christ i found it nevermind
guys
can i send a file here i need some help
can anyone tell/make it so that
the select a player is a drop-down menu
and the select amount is a slider ?
with increment of $1000 per level ?
have you checked modal forms doc
i did but couldn't find anything
there is one that explains dropdown menu
Are you in a universe where being gone 10 days is a month... you had ubber activity on 07/18/24
literally interstellar
I stil gotta see that....
i hope you are safe bro
He is fine. We wiped his memory. He will not remember being caged with 2 creepers in a deep dark cave. We gathered good data and will proceed to abduct the next "volunteer"
I had a weird dream where I was in a dark room with two green roommates.
Average college experience
@cinder shadow sorry for ping but I vaguely recall you saying something about getBlockFromViewDirection/getBlockFromRay stopping when it reaches any block even if it's an excludedType? Can't find anything on this, tho
I don't know if it will stop when it hits an excluded type
Just that if you include water, it will still require a solid block at the end to hit or it won't work @valid ice
BlockRaycastOptions.includeLiquidBlocks (?)
Hello
Is it possible to control fall damage intensity, fall speed and jump height with a score using scripts?
Does someone knows how can i make customized structure using script api ?
guys, how do i use LocationOutOfWorldBoundariesError to cancel the error which appears all the time
that's an error, you aren't supposed to "use" it
but like with watchdog how i can cancel it, maybe i can cancel this one too?
Can't cancel that. You can only aim to mitigate/prevent the error.
so how can i try and mitigate/prevent it?
By first determining the cause and effect.
how can i get the "distance" between two locations?
help
let dx = b.x - a.x
let dy = b.y - a.y
let dz = b.z - a.z
let dis = Math.hypot(dx,dy,dz)
thx
i could just use the substract function from vector.js
I am using custom class vector
sorry I missed the main thing
Just to see if I understand this right.
A script is there to basically give a set of instructions (like an event in this case for a block). And it is supposed to make things easier for addons to use. (namely have multiple blocks use the same script)
What I got so far is, while using an example of stripping logs of a certain wood type.
The log would refer to the script for an event where Wood X log becomes Wood X stripped log.
But now, what if I want to do the same thing with a different wood type?
Would I be able to use the same script, or should I now make a separate script for Wood Y?
If I use the former, I end up with Wood Y log becoming Wood X stripped log.
And if I use the latter, I end up with a script for for each and every wood type....
Where did Mojang supposedly claim that this would make writing addons easier when they removed Holiday Creator features that had these events part of each json file!!?
you can make one script that deal with all logs
send what you got currently
I'll look it up, thanks.
I have been trying to follow guides, but they dont really explain what does what.
The Microsoft learn and bedrock wiki were not that clear on that.
Even a template that used Eventdata does not seem to work.
This leaves me with no real code to show for it, sadly.
This is the template I was trying to use: https://github.com/Kaioga5/Kaioga-s-Block-Templates/blob/main/templates/1.20.80/slab/behavior_pack/scripts/onInteract.js#L9
No dosen't use that method
Use the tchebychev distance
max(|x1 - x2| , |y1 - y2|)
you need to list the logs and there striped variant
const list = {
"x":"x_striped",
"y":"y_striped",
"z":"z_striped",
//...
}
and then when the interaction happen, get the block id and then get the stripped variant
const stripped_variant = list[block.typeId]
ur wlc
world.afterEvents.playerBreakBlock.subscribe((e) => {
const { player, block, itemStackBeforeBreak } = e;
const blocklocation = world.getDimension("overworld").getBlock({ x: 24, y: 87, z: 74 });
let ckey = world.scoreboard.getObjective("commonkey");
if (block.typeId == "minecraft:iron_ore" && blocklocation) {
world.sendMessage(`§d§lHCV KitPvP >> §a${player.name} has found a Common key while mining iron`);
ckey.addScore(player, ckey);
}
});
how do i define addScore

whats the issue in this
its the addScore
for some reason its not defined
ckey is the one not defined
"can't get function addScore of undefined" or something like this?
wait how
yeah
does the world have commonkey objective
do
const ckey = world.scoreboard.getObjective("commonkey")?? world.scoreboard.addObjective("id:commonkey","commonkey")
i fixed it, thank you somuch
dw the getObj was wrong lol

you still need addObjective
yh did that
Is playerPlaceBlock before events exist or not ?
yup it does
Documentation for @minecraft/server
This is for a slab anyways. You want the logs template. They all work
maybe check your npm list
no?
beforeEvents
its probably his npm files
No
did you check bro?
maybe item use
with playerPlaceBlock?
Yes
Yeah i think
I ll use afterEvents
Then turn the player's block to air
From reading this, I gather you are not a programmer, correct? There is no way a programmer would make the statement you made. It is understandable that you see it this way. But I assure you, the power we have right now to create via code is infinitely better than HCF.
My suggestion is that you take a basic JavaScript tutorial and learn about object oriented programming. You will quickly learn if you have an aptitude for this or not. It is not for everyone.. and that is okay.
Side note. I have been a programmer for many many* years on other platforms and I had to fully learn JavaScript before I let myself touch scripting API. And good thing I did...
The teacher I recommend is Mosh Hamedani (CodeWithMosh...youtube or udemy or his website). Take the JavaScript Basics class and the Node JS class.. There are many other teachers/classes on youtube.
Good Luck.
yes please.
And thank you.
what is node js for?
He has that in his repo. It'll be under logs or wood ect.
I think to automate things?
Gives you a better insite into the object oriented side and event processing
not at all XD
Just a dabbler.
I was able to make a working addon before the experimental feature got nuked.
Learning how to write scripts is a new level of frustration when one tutorial teaches one thing. But that principle does not work when applied to another scenario. And looking up how a script is supposed to work in that scenario (namely using a template that supposedly works, but does not for some reason) has been frustrating.
Thanks for the advice and well wishes.
I'll need that. lol
guys how do i make a script for floating leaderboards ?
Script api is better tho
Make the game more modifiable
And easier to do that
- learning js is good because is one of the most famous programming languages
When I first looked at code snippets, I was lost too. There are too many ways to do the same thing and I was not used to that. After learning the language, it will make sense somewhat. Especially if people write code more for readability instead of all the built in shortcuts. Those make it so you have to really know the language to understand what the code is doing, whereas readability makes it so anyone can follow the logic. Other languages are better for this. If you kinda like programming after you have a taste, I suggest Python.
i kinda learned script api before js lol
but i have experience in other languages
They said it s not good to start with python
It's better to start with js
All seniors suggest that
python is stupid for this
mobile devs would have hard time coding with tons of spaces
They say a lot of things... and since everyone is not the same, the information may or may not be true. Either is fine, but for quickness in getting into a programming frame of mind from none, then it is more readable, this can be better for a beginner to dabble in the possibilities
the python suggestion was not for scripts but for learning any coding
There are no restrictions
oh nvm then
Everything is fine and as itended 🙂 👍🏻
not the severe refacting show off stuff...
send nukes to anyone suggest py for mc scripting
no one did... you misunderstood
xD
in general
Nah , all programming languages are fine except of one specific language
although some do automated things with py
Py used for front-end
So they are both important
py used for front end ?
Yes
when did that happen
Many languages
Alot
Yes.. I wrote a few of my regolith filters in python and I did not know the language... that is how easy it is to use and understand. I was able to take another's code, understand it, look up a few things and w rite in python.
Back-end
js is the only front end lang i see on web
Not front-end
yea
My bad
i was like how the heck py ended up in browser all of sudden
The same thing happened to me but with js xD
In ur opinion, do u think py is easier to learn than js ?
Until now I have done countless things with js and I have never seen any tutorial, I learned by myself
I am not a good one to ask, I am programmer, probably longer than you have been alive, I have an aptitude for and can learn anything logical...
the sad part about js is it all ends up with node, or browser no vanilla stuff
Yes, but that does not mean you are writing good code. I see some of the things people write... and they are not optimzed or using best practices... but does not matter much, so I keep my mouth shut
Yeah but, which one do u prefer rn
I have not fully learned python yet, I have no use for it right now, But I like it. I will have to see how it's OOP is first.
That is learned by experimenting, asking, etc.
for me its way to simple which makes it hard
even AI helps with that
I guess preference is for the one I know.. there are a lot of things I like about it. I use SQL daily and now I wish I could have some JS features in... and then sometimes when I look up how to do something is JS, I am like YGTBFK me...
blind leading the blind sometimes..
experience is not blind and much less an AI
That is not what that means.. LOL
Ai is not good for beginners
Some people here will suggest a better way to do something, but a lot of that just comes with experience in coding period
No, it is only useful for mathematical things SOMETIMES and to ask functions
I do not use AI, have never chat gpt'd... don't even know where it is... I am old school, I'd rather do for myself
Is great for some script api, it has updated one
true
Chat gpt 4o only
obviously its possibilities of use are great
Not always
Ever heard of Garbage-In, Garbage-Out?
No
Ah, you young people....
It is a very useful and advanced tool. If you ever have any questions, you can use it, maybe it will help you.
My native language is not English.
so no
Yeah
Are you 70 years old or what? haha
Well I do use it by using Alexa and Google home mini... but that is a far as I go...
☠️ alexa and Google dosen't contain chat gpt i guess
No, but I have a 19yr old college student son... so older than you
☠️
but it is still AI...
Yeah , somehow
I wonder how you ended up here?
Well... cliffnotes.... started playing MC during "the germ era" to bond with son... => realms => command blocks => add-ons
That s little odd
How so?
Nvm
Enough with the # off topic.... back to programming... any questions out there?
Anyone know if getBlockFromRay stops if it hits a block in the excludeTypes param?
let me try
no, it doesnt stop
completely ignore the block
excellect, ty
alr thats fine
how much ram does a world have? 100 mbs?
world.afterEvents.playerInteractWithBlock.subscribe((e) =>{
const {player, itemStack, block} = e
const blocklocation1 = world.getDimension("overworld").getBlock({x: 100, y: 23, z: 142})
if(block.typeId == "minecraft:chest" && blocklocation1){
world.structureManager.place(`mystructure:starterkit`, player.dimension, { ...player.location, y: player.location.y + 1})
player.playSound(`note.pling`, { pitch: 2 })
return player.sendMessage(`§aSuccessfully loaded kit!`)
}
why does this work on chests that are not even in the block location?
@last latch can you see https://discord.com/channels/523663022053392405/1267178791910772808 pls ?
because you check if the blockLocation1 is even a thing

you need to compare its location with the saved one
sure just give me a moment
thank you so much 😭
it worked with my other script, so am confused?
you know that && = and
because this if (blocklocation1) equals this if (blocklocation1 !== undefined)
your if statement is like this : if (block.typeId == "minecraft:chest" && blocklocation1 !== undefined)
ohhh
so i would need to put the coords into a const
save*
yes and compare it with other coords
this blocklocation1 outputs either a class Block or undefined
Look at your IF... you asked if the block location at those coords are valid and if the block interacted in the event is a chest.... both can be true and not related... you need to connect it.
for the coords i can use the same thing right ?
world.getDimension("overworld").getBlock({x: 100, y: 23, z: 136})
Oh alright ill try now
check if the chest is at that location
Maybe a function that can compare vector3s, so you can reuse it elsewhere
you can start y our own vector query class (I know others made one they shared, but for learning, do your own and only reference theirs, if you cannot figure it out - that is how you get better)
Thank you for the help and taking your time to explain
No problem.... your icon looks like my son.. and he has no interest in programming... LOL
that's funny lol, however i got the script to work at the block location so thanks
how do I detect fishing?
No direct way to do that
U can use itemUse event
well the fishing rod is a entity
(not the item)
thats a simple behaviour, why isnt that a event 😭
I guess I may need to detect if the hook had despawned and did it catch a fish
Oh u mean fishing
After getting the fish ?
yea
I'm trying to make a event like world.afterEvents.playerCaughtFish but that sadly isn't a thing
mc.world.afterEvents.itemUse.subscribe((event) => {
const { itemStack, source } = event;
if (itemStack.typeId === "minecraft:fishing_rod") {
const entites = mc.world.getDimension("overworld").getEntities({
location: source.location,
maxDistance: 30,
});
for (const entity of entites) {
if (entity.typeId === "minecraft:fishing_hook") {
const fishing = system.runInterval(() => {
});
};
};
};
});
mc.world.afterEvents.entityRemove.subscribe((event) => {
const { removedEntityId, typeId } = event;
if (typeId === "minecraft:fishing_hook") {
};
});
mc.world.afterEvents.entitySpawn.subscribe((event) => {
const { entity, cause } = event;
if(entity.typeId === "minecraft:item"){
};
if(entity.typeId === "minecraft:fishing_hook"){
};
});
Try one of those
a nice structure, I'll try to merge it to my existing project.
Thanks :)
I would start with some logging action of spawns and removal of entities around me while I am holding the rod... so I can see what is activated and in what order and for how long.
Then I can manipulate it for my usage.
No need , getEntities has options
Like entity type etc...
Well it is more for the event and when triggered and if triggered... I've learned some anomalies that way. Things do not always work like you think they do or should.
but check what the entities are so that I can see when the hook comes and goes as well as the other items.
sometimes getting the whole picture gives more info instead of zeroing in on what you think you are looking for. More info for analysis... and I am good at analysis
.Hmmm.. I wonder if can make the hook always return an item when manual fishing... cause sometimes that small window of when to pull back is tight... you'd think for accessibility reasons they would have something
U mean ?
which?
Is there an automated fishing?
world.afterEvents.playerBreakBlock.subscribe((e) => {
const { player, block, itemStackBeforeBreak } = e;
const ckey = world.scoreboard.getObjective("ckey");
const chance = 100;
const randomChance = Math.floor(Math.random() * chance);
const blocks = ["minecraft:iron_ore", "minecraft:gold_ore", "minecraft:coal_ore"]
if (block.typeId === blocks[0]) {
if (randomChance < 10) {
const crateKeys = 1;
ckey.addScore(player, crateKeys);
world.sendMessage(`§d§lHCV KitPvP >> §a${player.name} has found a Common key while mining iron`);
}
}
this doesnt work for iron blocks, why?
There is if you build it... I do it all the time
U should fix ur type.id
thats not the problem
it works fine when the iron block is on a clone command
Test it without the chance to confirm
alr
and iron block is not iron ore... so you actually mean the ore, right
and remember the deepslate versions
i meant ore my bad
yep tested
for some reason it only works if the iron ore is being cloned and i break it from there
That does not sound right.. throw a debug line in near top that gives you the typeId of the block broken
oh wait... that is after events.... the block is not the block its the broken one
Or just make it console.log the right type id of that block
do a log on block, itemStackBeforeBreak to see for yourself
or change this to before events...
most of the people have
i did before events now it runs a error on iron ores i break now, which means it works
this is the error
Remember.... when you see that... put the comand in a system run
do system.run
okay... yes only before events can get that block. simpler.. else ha ve to use broken block permutation... https://jaylydev.github.io/scriptapi-docs/preview/classes/_minecraft_server_1_14_0_beta.PlayerBreakBlockAfterEvent.html#brokenBlockPermutation
Does not have required privileges, actually happens because of the beforeEvent
or just use after event if you don't need to cancel the event
thank you mane, now works
Both are options, just have to know what holds the information you want, because different for each
is beforeEvent the only thing activate read only mod?
ohh alright
I am not understanding your question. ? read only mod ?
How can i get the adjacent blocks?
like, i want to get the connected/nearby blocks of a block
help
the block as methods for that
.offset()
block.south()

....
........
Look at the Block Class... (this is previe beta) https://jaylydev.github.io/scriptapi-docs/preview/classes/_minecraft_server_1_14_0_beta.Block.html
i dont want to use the block methods so much time
I want to get each block at a time
Well what else would you use
If you have one block then you can get another offset from it
in a volume?
you know how fast this stuff goes right? or you mean your time in coding?
Wite a functin, then use it... then fast...
your- your- understanding wrong.....
ok
there is the getBlocks function
get the block location and use that to get all the blocks around the area
like, i dont want to do block.above().above().above().above().above().above()
block.above(6) 🤷♂️
const adjacentBlock = { x + 1, x - 1, y + 1, y - 1, z - 1, z + 1}```
I know there is getBlovk
but wouldn't that just get the - up, down, south, east, west, north, of ONE block,? I want to get the south,east,west,etc of each block
You'd need a loop or something to run code for each block, in that case
how
Learn basic JS first?
... uh
LOL
i know loop
I think you should look into the getBlocks... has iterator of vector3s and you can use that to pull the blocks into an array.
It would help to know.. what is the input and what do you want to end up with?
you said adjacent blocks.. but then said it sounded like you wanted the adjacent blocks of the adjacent blocks...
so... how far out... easy to build loops for that.
or try getBlocks.. may have what you need to get them all within....
this should work
const directions = ["east", "west", "north", "south", "above", "below"];
directions.forEach((direction) => {
const block2 = block[direction]()
//...
});
All of the adjacent blocks of a block, would mean adjacent blocks of the adjacent blocks
@prisma shard at this point just open a post and describe exactly what you want
Youre just cinfusing everyone now
world.beforeEvents.itemUse.subscribe(data => {
let player = data.source
let title = "§l§7-= ShadowCraft menu =-"
if (data.itemStack.typeId == "grassblock:shadowcraft_gui") system.run(() => main(player))
function main() {
const form = new MessageFormData()
.title(title)
.body(`il menu è attualmente in manutenziona.\nclicca annulla per chiudere il menu`)
.button('annulla')
.show(player).then(({ canceled, selection }) => {
if (canceled) return
if (selection == 0) {
player.playSound("random.break")
return
}
})
}
})
why the message form data is not defined
it's the first time that i use message from data
did you import it?
no?
Does ur code
includes :
import {MessageFormData} from "@minecraft/server-ui"
import { MessageFormData } from "@minecraft/server-ui"?
thx
Server-ui
.
ohhhhh
if i want only one button? @distant gulch
Add just 1 button then
there is a limit number of buttons?
Probabbly.... idk
-.-
Read the docs please
use modelfromdata and change the submit button text
since when could I not use a json file tf?
I've always stored static data inside of a config.json file and now it just reads as a js?!
Could be a bug..? Or an intentional decision?
silly bugrock* as always 😭

Since forever?
I recall it being asked in a qna
i used to use json files in all my old projects tho?!
whatever, i'll just use exports i guess
The game is gaslighting you, fr
and while you are making that post, add a picture of graph paper making block and all the blocks you ultimately want to get back...
that sound like you trying to get all the blocks in the world lol
not sure if you saw his request and the ensuing confusion... no idea where it was expected to stop
yeah
he said adjacent blocks of adjacent blocks
basically the whole world
I am thinking he means all 8 blocks... but it is the communication of it that is off...
maybe he is looking for something like A* search algorithm
well 8 cubed
So 64 blocks?
Wait that aint even 64 i cant math
i don't think cubic area is what he is looking for
adjacent blocks will make a diamond shape
I think he wanted the blocks in between and not just touching
good job on finding or doing the graphics
And this is why we should explain clearly what we want instead of being vague
Yeah we know that.. garbage in - garbage out...
but eveyrone is not used to requirements
and having to satisfy them... need to be explicit else you get what you asked for
I do that on projects I don't want to do.. you get what you asked for and nothing more
lol
Did you AI that?
no XD
I wish we had code challenges....
i'm new at json
json ui is the final boss of json
there used to be one here, right?
no.. they have events but that is not the same.... I am thinking like code-wars, but with scripting....
One message removed from a suspended account.
One message removed from a suspended account.
kinda like games dev jam?
you don't have a function that add the score objective to the world?
But same subject... that way everyone can compare and learn
One message removed from a suspended account.
you don't 🤷♂️
yeah that will be cool
One message removed from a suspended account.
It is going to run that code when the world starts... did you intend that, players may not be loaded yet and that is run time
One message removed from a suspended account.
Oh I see... it's interval
Did you not test it? Why are are asking if anything is wrong with it, would not loading it tell you?
One message removed from a suspended account.
One message removed from a suspended account.
ask them to enable the console log
You could have lead with that, and this would have been best as a new post.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Lead... means 1st statement.. it was a the bottom.. the ignored area... just sayin....
What device works?
and is server? realm?
or you are just loading add-on into different worlds on different devices?
If so... did you check all same configuration with world setup, is content log on for each device... details...
One message removed from a suspended account.
One message removed from a suspended account.
How is playstatin playing on a mobile world.. LAN Connection, attached to friends?
If you have a realm you can test with, would be best.... to load it there and connect via other devices... That should work fine, so it may be something non related.
Like diamond shape ?
They should change json ui with html
😱
Ore UI?
what does the skull mean... like poison?
But instead of making mediator just let us interact with the actual html
No 💀 is like 😂
What does that mean? I don't know the emotolingo
I do not know if I should be perturbed or not.
It means like "bruh" or some disbelief over the given answer
laughing until he died
"Why does script API not have enderchest component 💀"
"I just tried to get a player using getEntities and got cows as well 💀"
luhd
lol
huh
is the second one a thing
yes
💀
That looks like a Star Wars Alien... don't know what that means either..
What ☠️ , i never heard of that meaning
💀 and ☠️ are used interchangeably
it kinda dose
You just used it according to that meaning, see
"What (expressing disbelief), I never heard of that meaning"
unless he didn't
No , it means i laught to death
💀
Imma take it to mean... You are introducing alien utter nonsense into my world
and possibly poisonous
Locking in for a second here
Code war ?
Start a post, challenge, get all the blocks Froggo wanted...
make a replace for the piston before event
GO GO GO...
yeah
Does it make more sense for a guard to view the player by the player's head, or from their feet?
e.g. a player is hidden if their head is behind a block (out of guard's view) but their feet are visible, or
a player is hidden if their feet are behind a block (out of guard's view) but their head is visible
Really
Before event piston activate, my beloved ❤️
feet is your location... so maybe it is tied to that
nikki is working on it right now
No I am not... involves detectiing redstone
it is alright
you can do it
raycast from guard would always be from the head- just if the end of the raycast should be the player's feet, or the player's head.
2 meters tall ain't bad
video game don't make sense
if you are trying to make it logical you need to make the guard aware of all the player
even his shadow
That's like, 6'6", 6'7"
Two blocks height = 2 meters
My guy, I am doing quick & easy here, not a full-blown stealth system 😛
What about , the life's game
Full system is:
- Each player scans around them for guards
- Raycast is sent to each guard within range to determine blocks between two locations
- Angle between raycast line & guard view is found
- A "percent guarded" is returned based on the above factors
you should send 2 raycast or 4 one from the head and the other from the feet
That would be a decent amount of extra computing
Rather keep it as simple as possible really
yeah
But you only want a number if either face or feet is exposed to guards view
I think checking from the head would be best from a players perspective. They can only see you if you are also able to see them. In general, the players head and legs will be aligned anyways though, right?
Whether or not you could potentially just do the raycast, store the players' volume somewhere, and check if that raycast intersects with the players volume
Hmm what if the player is crawling
Well that's a special case and might not even be applicable here
Other states that the player could be in are not applicable here
Ok
The map is static and will not have those conditions
Crouching, it will, only because that is a conscious choice the player makes
Same with jumping
Would be cool
idk whether there would be any performance impacts though
you could probably just use a 2D plane tbh
And you can't piggyback of off the entities target system and check who he is targeting?
The entity is not targeting the player, it's just a view thing
Did you already discuss see thru blocks... I suppose those are in your exclude list
They are, yes
Hence this question I had earlier
Head... because if there is an action because of it, player won't understand.. "but he can see your feet.. and you cannot see him"
unless baby guards, lol
Don't mine me, I'm just crazy
We are all a little crazy
Now that is an idea... Baby warden that ventures into the overworld, pop up 10% chance if ancient city below....
I know, I was thinking of the real one... I need to make a small one to see what it looks like. See if I can do it.
The term I use to encompass them all is "protector"
.

Time, many projects...
For me, definitely the second. I get tons of motivation to script at 3:00 AM on a weekday. Good stuff.
just thought of another, I like this one... baby witch (mean girl) not to kill, but throw potions like nausea, slowness, blindness
and talk shit
lol
I play with a motely crew who would love that
oh no that kinda stuff is fun... me and a friend kept spawning iron golems and wardens in an ancient city to see who would win...
So I am confused, my code works but I keep getting this error? I think it's because something is not defined, got any ideas of what it could be
world.afterEvents.playerInteractWithEntity.subscribe(({ itemStack, player}) => {
if (lunaAxeId.includes(itemStack.typeId)) {
const playerEquippableComp = player.getComponent("equippable");
if (!playerEquippableComp) return;
const durability = itemUsed.getComponent("durability");
if (!durability) return;
let durabilityModifier = 0;
if (lunaAxeId.includes(itemStack.typeId)) {
durabilityModifier = 1;
} else {
durabilityModifier = 2;
}
durability.damage += durabilityModifier;
const maxDurability = durability.maxDurability
const damage = durability.damage
if (damage >= maxDurability) {
player.playSound('random.break', { pitch: 1, location: player.location, volume: 1 })
playerEquippableComp.setEquipment("Mainhand", new ItemStack('minecraft:air', 1));
}
else if (damage < maxDurability) {
playerEquippableComp.setEquipment("Mainhand", itemUsed);
}
}
});
[Scripting][error]-Plugin [Infusion - 0.1.0] - [Main.js] ran with error: [TypeError: cannot read property 'subscribe' of undefined at <anonymous> (Main.js:91)
]
A world isn't allotted RAM. The server/application is allotted RAM. How much RAM can vary depending on your environment. However, RAM isn't the real concern here if that is why you are asking. Its performance is heavily influenced by the CPU, particularly its single-threaded performance, which affects the game's responsiveness and overall smoothness. RAM is important to consider if you have a large base of players and plenty of activity currently ongoing, but the CPU will play the more crucial role here.
It is beta, check the version in your manifest, and if it is preview-beta, make sure you use Preview. so either it is 1.12.0-beta, 1.13.0 or 1.14.0-beta
Oh gotcha, yeah I had my manifest set to 0.1.0 that makes, thank you Nikki ❤️
1.13.0 is stable right or should it be 1.11.0
1.13.0 is considered the release candidate RC, so it is the stable of Preview
Okay, good deal 😊
1.11.0 is stabel for reg MC
Even tho the RC can change... chatSend is in 1.120-beta, but taken out of 1.13.0 and moved back to 1.14.0-beta
cause SOMEONE had to discover an exploit bug... LOL...
exploit bug?
yeah, something about if you changed the message while something it crashed game...
so it's readonly now, as I think it should be anyway, we should not be able to alter any user's message ever, cancel yes, alter no.
👀
well you can just cancel and then make the player send the message with the sendMessage method and insert the sent message text with template literals
so it becoming read only isnt a big deal
you can make it look like something
Oh I remember, someone was Assasin I think encrypting message to undo on receiver...
so it did not crash, it got an account suspension that should not have happen
yeah that is it... so that is bad,
#879773489601585244 message
So how do you use player.sendMessage to make it look like the player sent a message?
oh, him... hi Vis
just explained how
I am not sure about that...
im sure about it.
I need to see it I guess
I see..
world.beforeEvents.chatSend.subscribe(data => {
const msg = data.message
const player = data.sender
data.cancel = true;
player.sendMessage(`message: ${msg}`)
})
but that sends a message to the player not from him
world.sendMessage(`<${name}> ${message}`)
Bro i asked how much addon-data can a world handle. BDS has its limits for example.
that a private message
yeah I think this is what I did, not player.sendMessage. I used it to change the color of people's messages before.
RAM is dependent on the environment. REALMS is technically unknown I believe. Not sure Mojang has that information public. BDS can be configured accordingly. You could use basic software to monitor RAM with regards to a local world, but that will be dependent on the device. So unfortunately, there is no definitive answer for you.
Huh, I guess that number is small. We will never know.
Isn't the look or font slight different so that you can tell if it was the player or code?
doesnt that really matter
lol
"theres 2 more pixels on this character, this is unpolished!"
yeah it does, if a malicious add on makes it have one person say something "bad" to another
something reportable
Large window but probably somewhere between 2 to 10 gigs of ram. So not much.
it'll ########## censor it
you can take a pic of it... but if there is that difference, then they would know
not bad that way... unkind remarks
hate speech
bunch of stuff
A guy hosts a world, and this worlds tends to be known for crashing because of ram usage. I don't think he could use data to fulfill 2-10gbs of ram.
Like it crashes every 1-2 hours...
I see.
Is it crashing by saying something on the lines of memory limitations on the screen?
I'm asking because script-api is allotted memory. Exceeding it will crash it.
I can't remember how much memory.... I forgot haha.
To test the look, have it duplicate your message and see it against a real message.
I noticed the diff a while back because I had monsters saying shit.... so ... maybe it is diff now, don't know
I think yea, definitely something with memory/ram. Probably he doesn't clear multiple maps with players or something.
Yea, I want to say we are allotted 256 MB. I might be able to track down where it's actually mentioned, but I know it's not much so you have to handle your memory correctly. If it's steadily growing then one of two things is happening. Mismanagement of memory, or a memory leak (which is still partially mismanagement lol).
It depends on ur devices ram
I dont think so.
Looks like watchdog has a default setting of 250 MB. With a memory warning starting at 100 MB. This is on BDS. I would think it's best to assume these settings are the same on Realms as well. On BDS you can configure these by either increasing these values or disabling them entirely.
Disabling? You can disable them entirely?
For BDS. Its configurable in server.properties.
But I wouldn't recommend that. If you have a memory leak, or a mismanagement of memory handling then it would be highly advised to fix that problem versus ignoring it. Steadily growing memory will eventually cause issues. You do not need watchdog enabled to experience those.
If the memory is stable, but just so happens to use a decent amount, then instead of ignoring it entirely, I would just increase what is allotted in server.properties.
What's the beforeEvent listener that checks if a player is hurt by another player?
There isn't a beforeEvent. Just an afterEvent at the moment.
https://stirante.com/script/server/1.12.0-beta.1.21.3-stable/classes/EntityHurtAfterEvent.html
Documentation for @minecraft/server
Does event.cancel still work?
That doesn't exist in the event.
Alright, how can I negate damage done to a player?
- damage_sensor through player.json
- Potion effects
Specifically testing if a player hit a player
Oh right
Yeah that works
First option best fr
- add the damage that was dealt to the player back as health (it won't stop one hits though)
Hey, I've had a few months break of creating addons. Has much changed (stable)? I'm trying to use dimension.spawnItem but the vector part doesn't seem to work
Vector is now an interface instead of a class if that's what you're using
Ahh, i see. Does it need importing now then
Hmmm, I'm still having trouble getting it working... player.dimension.spawnItem(mSpawner, {x: bx, y: by, z: bz });
The console error I'm getting:
[Scripting][warning]-console.warn
[Scripting][error]-TypeError: Native setter cannot be assigned null or undefined. Interface property ['z'] expected type: number (failed parsing interface to Function argument [1]) at <anonymous> (mob_spawner.js:19)
send it as message its not even 1 kb
No need to
Try removing the () that's wrapping the vector interface
Still hasn't fixed it...
You could just use tblock.location as well
Since that returns a Vector3, no need to construct a new one
I was hoping to use const {bx, by, bz} = tBlock.location; so I can offset the coordinates
That's just:
const {x: bx, y: by, z: bz} = tBlock.location;
Oh, so the variable is const {x: bx, y:by, z:bz} = tBlock.location; and not const {bx, by, bz} = tBlock.location;
ye
bx, by, bz would be undefined if you do that
And when I use spawnItem i still have to include the x:, y:, z:?
yea?
u could also do this:
const loc1 = tBlock.center();
overworld.spawnItem(itemStack,loc1);
@grave thistle
Going to see if altering the variable like you said since i need to offset the item spawn point
@random flint got it working, ty. Wish I didn't take a break from coding for so long
Why isn't {x: bx + 0.5, y: by + 0.5, z: bz + 0.5} offsetting the spawn location?
It should, but since it's a half block difference it might not look like it. Try offsetting 5 blocks
Tried 5 and it still won't offset
Are you putting this in the spawnItem method?
Yeah, here it is: tBlock.dimension.spawnItem(mSpawner, { x: bx + 5, y: by + 5, z: bz + 5 });
Thats weird
Weird, I removed and re-added the behaviour pack and it now works
Well that makes sense now
Are you using the dev folder by any chance?
The correct way to create addons is by using the development_behavior_packs and development_resource_packs folders. Storing your addons here will allow you to reload the world to see addon changes, and will prevent pack caching issues.
You can work directly in the world, or in behavior_packs/resource_packs, but you need an understanding of manifest-versions and caching to avoid issues.
We highly recommend using the development_*_packs folders.
No, I'm on mobile. Using the normal behaviour folder
Yeah makes sense. You're facing caching issues
Lol so janky. Don't know why overwritting the file didn't update it. At least completely removing and re-adding it has fixed it
If you could, try use the dev folders. If not, prepare to keep reapplying your pack
I'm using bridge. and I'm not sure it can upload directly to the dev folder
You're offsetting it by 5?
oh nvm
yey development folder
guys my scripts keeps getting put into message.txt and jayly script debugger dont work
how to fix
Use the .js / .ts file extension on ur file before using the debugger.
bot down maybe?
ok
Is there a way to perform raycast that goes through passable blocks but not through water? When using includeLiquidBlocks: true, includePassableBlocks: false it doesn't hit water, as it seems includePassableBlocks already includes water and it takes priority, which is a weird design choice imo
make a custom raycast then. do we even have a way to test flowing water
Is there a way to test which block types are considered as "passable"?
my guess is that any block which let entity pass considered as passable
Passable are things like scaffolding iirc. Ladders vines
Is there a way to detect which block is passable based on its type? Wanting to re-implement includePassableBlocks functionality in a way that can include water in the raycast
Setup a gamtest script ig?
Then grab the results and those that are passable put into an array?
ig that works but it's unfortunate that we even have to resort to such extreme workarounds
for a very simple behaviour
I do wonder....do flowers and vines count as .isAir or are they .isSolid
isSolid is for full blocks
or not?
Idk thats why I asked
pretty sure isAir is only for air
not sure what isSolid is though
it's not even stable yet afaik
it's not, no
pretty sure i used isSolid before to detect full blocks
but does isSolid mean able to transmit redstone or occupies the full block collision?
not really clear based on that name
Hence why I asked
a glass block would probably be the easiest way to test that
Ive, rarely used .isSolid to test such thinga i always use it to check full blocks bc i assume it would only be restricted to that
idk
but glass is not solid
it's not solid in regards to redstone and fences, but it is solid in regards to collision
Im heading to work so i cant test that now 😔
full block != solid block
let me just test that
I think it overwrites everything
could u use that to check for water then?
😔 this is the only optiom then...unless the wiki and the java decompiled code has a list
So you'll have to list every single block except for passable types
ah, that sucks
excludeTypes is a viable option tho, but you'd still have to list all passable blocks there
And that might be quite slow to execute depending on how many types you use
you could probably just ignore the likely options, won't be great for compat though
just give us a collision block component
though that would still suck
fixing that weird passable behavior would be best
raycasting second time just for water is also an option, but idk how slow that would be
wouldn't it just immediately hit the next water block after the final destination?
instead of whatever the "first" one would've been
No I mean do 2 raycasts in the same pos and dir, one with passable blocks excluded and another one only against water and use the closest hit
ah, I don't think it would be that bad, depending on how often that's ran
That'd double the number of raycasts tho and when raycasting just against water, rays would have to check a lot of blocks
would it be worse to have a huge filter or double raycast though?
that's the question
Filter would have a fixed performance hit while doing 2 raycasts will depend on the scene, if there isn't a lot of water nearby, then water rays will have to do more work
Yes ,
function getRandomSpawn() {
const s = {x: random(ArenaArea[0], ArenaArea[2]), y: 265, z: random(ArenaArea[1], ArenaArea[3])};
const t = {x: s.x, y: 254, z: s.z};
const u = overworld.getBlockFromRay(s, t).block.location;
console.log(JSON.stringify(s));
console.log(JSON.stringify(t));
console.log(JSON.stringify(u));
return {x: u.x, y: u.y + 1, z: u.z};
}
how is raycast like this, what even is a raycast if my assumption is wrong?
[2024-07-30 21:34:29:720 INFO] [Scripting] {"x":12014,"y":265,"z":12019}
[2024-07-30 21:34:29:720 INFO] [Scripting] {"x":12014,"y":254,"z":12019}
[2024-07-30 21:34:29:720 INFO] [Scripting] {"z":12031,"y":265,"x":12025
im trying to find the spawnable location in a random xz location
The second argument passed to getBlockFromRay is the direction it should go. You should not be passing world coordinates into this
I'm assuming you want the topmost block, by casting downward. T should be:
const t = {x: 0, y: -1, z: 0};
@grand heart (pinging for visibility)
if (enchants != `` && enchants != undefined && enchants) {
enchants.forEach(enchant => {
addEnchantments(itemFormatted, [{
type: `${enchant.type}`, level: enchant.level
}]);
});
}
Why does this not work
anymore
it used to
what did they replace it with
export function addEnchantments(item, enchants) {
const itemEnchantComponent = item.getComponent("enchantable");
if (itemEnchantComponent) {
itemEnchantComponent.addEnchantments(enchants);
}
}
Give us the full code
Not
Hello guys! Another problem:
I'm trying to use this chest ui
A very strange part is, changing the constant number_of_1_16_100 to +11(The amount of custom item we have) makes:
every block shift incorrectly, and item shift correctly
Did anyone encounter this before and is there a thing I can do?
Everything you need to know
I have some foggy variables
Because everything else works
So the "item" parameter is ItemStack, and "enchants" is an Enchantment array?
Just not the enchantment adding
any, like, context on the enchants variable? like its type?
Component must have
minecraft:
Any clues would be greatly appreciated :)
is it possible to add components to an entity without modifying its behavior file?
Block IDs do not get shifted with the addition of custom contentt
weirdly, when setting number_of_... to 0 every item doesn't show its correct texture so I tried to modify it
Only custom items with 1.16.100 format version & higher shift stuff- as they are inserted into the IDs at 256, shifting all IDs that exist above 256.
does pushing player in an array and checking if the player is inside the array will cause some problems?
it works for me but im afraid there would be problems in testing for the player
So u pushing player
Nah will not cause
Uw
even though i changed the player properties, right?
It will changes player's propreties too
You could push a property of the player- like their name, id or something instead of the entire player class
Better idea ^
yeah, that's how i really do it, im just curious if its just the same
I don't see why it would cause any problems
That's actually slower, although not by much. Adding an object to an array doesn't create a new copy of it, it's just a reference to the player instance.
the amount of people sending dms to offer me help 🤦♂️
Agree
import { world, system, Player, EntityInitializationCause} from '@minecraft/server';
import { ActionFormData, MessageFormData, ModalFormData, ModalFormResponse } from "@minecraft/server-ui";
world.afterEvents.playerInteractWithBlock.subscribe((ev) =>{
const {block, blockFace} = ev
const tokens = ["minecraft:nether_wart", "minecraft:nether_star"]
const ores = []
const money = world.scoreboard.getObjective("Money")
let player = world.getAllPlayers()
if(block.typeId == "minecraft:lime_stained_glass" && block.x == -17 && block.y == 176 && block.z == 32){
switch(tokens || ores){
case tokens[0]:{
console.warn("works")
player.runCommand("/clear @s nether_wart")
money.addScore(player, 100)
player.sendMessage("you have sold your items")
}
}
}
})
why does this not work, i dont get any errors at all or a console warn
its a interact with block i cant add source
huh
It should work , because its array refrence
To all the players
Oh yeah i see
U are using it wrongly
Use
player.forEach(player=>{
//Your code})
Idk what he is trying to do :T
interact with the block
at a spot
could i use entityHit for this aswell?
alr so like this?
world.afterEvents.entityHitBlock.subscribe((ev) =>{
const {hitBlock, hitBlockPermutation,} = ev
const tokens = ["minecraft:nether_wart", "minecraft:nether_star"]
const ores = []
const money = world.scoreboard.getObjective("Money")
let player = world.getAllPlayers()
if(hitBlock.typeId == "minecraft:lime_stained_glass" && hitBlock.x == -17 && hitBlock.y == 176 && hitBlock.z == 32){
switch(tokens || ores){
case tokens[0]:{
console.warn("works")
player.runCommand("/clear @s nether_wart")
money.addScore(player, 100)
player.sendMessage("you have sold your items")
}
}
}
})
import { world, system, Player, EntityInitializationCause} from '@minecraft/server';
import { ActionFormData, MessageFormData, ModalFormData, ModalFormResponse } from "@minecraft/server-ui";
world.afterEvents.entityHitBlock.subscribe((ev) =>{
const {hitBlock, hitBlockPermutation} = ev
const player = ev.damagingEntity
const tokens = ["minecraft:nether_wart", "minecraft:nether_star"]
const ores = ["minecraft:coal", "", ""]
const money = world.scoreboard.getObjective("Money")
if(hitBlock.typeId == "minecraft:lime_stained_glass" && hitBlock.x == -17 && hitBlock.y == 176 && hitBlock.z == 32){
console.warn("works")
switch(tokens || ores){
case tokens[0]:{
player.runCommand("/clear @s nether_wart")
money.addScore(player, 100)
player.sendMessage("you have sold your items")
}
}
}
})
does not work?
it worked! thank you good sir!
Looks good idea
@glacial widget u want trade system between players ?
switch(tokens || ores) is creating a boolean statement, to be compared to the tokens—true === "minecraft:nether_wart" will not succeed
that would be cool
ohh but || = or
so i thought i would count to both arrays
I can make a one
Yes, for testing conditions. It works in if() by creating a boolean statement
Using dataForm
yeah thats what am using rn
thank you though
What should it be doing? Are you wanting to iterate over some array (or two) to see if any entries match? Or if one array includes entries from another?
to see if any entires match
array.some(element => element === value)
.some() returns a true if ANY callback returns true
.every() returns true if ALL callbacks return true
.find() is useful if you need the value of that element.
I am constantly finding new ones every time I look
Those dang javascript developers just keep adding more
"The strength of JavaScript is that you can do anything. The weakness is that you will." ~ Reginald Braithwaite
I will what ?
Are u messing with me ?
It's a quote.
import { world, system, Player, EntityInitializationCause} from '@minecraft/server';
import { ActionFormData, MessageFormData, ModalFormData, ModalFormResponse } from "@minecraft/server-ui";
world.afterEvents.playerInteractWithBlock.subscribe((ev) =>{
const {block, player, itemStack} = ev
const tokens = ["minecraft:nether_wart", "minecraft:nether_star"]
const ores = ["minecraft:coal", "", ""]
const money = world.scoreboard.getObjective("Money")
if(block.typeId == "minecraft:lime_stained_glass" && block.x == -17 && block.y == 176 && block.z == 32){
console.warn("works")
if(itemStack.typeId = tokens.every()){
console.warn("works")
player.runCommand("clear @s nether_wart")
money.addScore(player, 100)
}
}
})
something like this?
What is that ?
Not sure I understand you or if you misunderstood the quote.
It speaks about the power of JavaScript and how versatile it can be but highlighting the pitfalls that comes with it. In JavaScript, you can achieve a lot with little code, but it's flexibility can lead to complex, difficult-to-maintain code if not managed properly.
There is typescript
when a player clicks on a block it checks if they have any tokens then runs the code i got below
So it s trading system
a sell block
i did
it works but for some reason the if statement does not
But i thought about trading system between players, u know some players sell the goods , and wait until one of the other players buy them and get the money after that
even when i hold out the item
like a auction house?
Etc....
hello everyone, who can tell you how to make any text on top in the center of the screen? (Maybe someone knows a publication that will help you find a solution?)
player.onScreenDisplay.
then from there you can learn
Thanks
np sir
Bot exactly, just u put ur items that u wanna sell , and wait until someone buy them , and get ur money after that
And so on
thats acutally cool!

Without creating non-existent resources
no it should be tokens.every(item => itemStack.typeId == item) and it should not be every
it should be some
Add code to have it print off the block type to verify it's comparing the same string. Then print off the location of that block to verify it matches with the hard coded coordinates you expect it to be. If any of those conditions are not a match then your if statement will not execute the code inside the clause. Also, may I suggest using === versus ==?
=== is strict type checking. If you are trying to compare a string then it will strictly check for a string. The other isn't strict. It will try against a string, number, etc to get a match.
Hopefully this explanation is simple to understand. I didn't want to get too heavy in it lol.
so replace the every.() with some.()
some()
tokens.some(item => itemStack.typeId == item)
but it will always clear nether wart even if it checks in nether star, your code has yet so much flaws
Yep
oh could you point them out? my bad
is the money you will give always 100 regardless of the type of item? if so
player.runCommand(`clear @s "${itemStack.typeId}"`);
that that makes sense
however am still getting a error for this
itemStack.typeId === tokens.some(item => itemStack.typeId == item)
no, remove the one before the first e qual signs and also the first equal signs
if (tokens.some(item => itemStack.typeId == item))
☠️ bro is cooked
btw what code is inside item?
the code you have inside if block
import { world, system, Player, EntityInitializationCause} from '@minecraft/server';
import { ActionFormData, MessageFormData, ModalFormData, ModalFormResponse } from "@minecraft/server-ui";
world.afterEvents.playerInteractWithBlock.subscribe((ev) =>{
const {block, player, itemStack} = ev
const tokens = ["minecraft:nether_wart", "minecraft:nether_star"]
const ores = ["minecraft:coal", "", ""]
const money = world.scoreboard.getObjective("Money")
if(block.typeId == "minecraft:lime_stained_glass" && block.x == -17 && block.y == 176 && block.z == 32){
console.warn("works")
if(tokens.some(item => item == itemStack.typeId)){
console.warn("works")
player.runCommand(`clear @s "${itemStack.typeId}"`)
money.addScore(player, 100)
}
}
})
alr just checking cuz am getting a error
oh what you get?
i assume it will throw if you don't have item in your hand?
if so you can just put if (!itemStack) return;
or put itemStack or !!itemStack inside your first if statement
if (!!itemStack && block.typeId == ...
if(tokens.some(item => item == itemStack.typeId))
hmm yes that's where the error goes but not necessarily, itemStack's value can be none(undefined) so you must first check if it has value or nah
const tokens = {
"minecraft:nether_wart": 100,
"minecraft:nether_star": 200
}
``````js
if (itemStack?.typeId in tokens) {
const hand = player.getComponent("equippable").getEquipmentSlot("Mainhand")
if (itemStack.amount === 1) hand.setItem()
else hand.amount--
player.addScore(player, tokens[itemStack.typeId])
} ```
pro move
Or, just skip it:
const { block, player, itemStack } = ev;
if (!itemStack) {
return; // Skip if itemStack is undefined
}
also * itemStack.amount
Wth
What is
If ( something in something)
also will the itemStack.amount--work? i tried it on nameTag and it doesn't
Is it rare to see code with ContainerSlot?
I nevermind see that before
Checking to see if a property is in an object
But ,

