#Script API General
1 messages · Page 47 of 1
You can use particles and molangVariableMaps for the pieces, just an idea 
it didn't work but i found another way and it works.
block.setPermutation(block.permutation.withState({ '<name>': <value> });```
this is how you use it
already did
I might actually.
Anyways here it is. Kinda confusing since there's no pieces yet but I added the logging in the top right... @chilly fractal
hi there, so I have some nametag system that used to work just fine, but recently I noticed that after a player dies the nametag shows up like so:
any ideia what could cause that? that might be related to the new death screen?
Looks fun to play
why don't make it 8 by 8 with big pieces
what is the problem?
the position?
yes
I think this is the position when it is set to a dead body
but it remains after respawn for some reason
did you edit the entity file?
the nametag is position is relative to the entity collision box
aslo it will be cool that you can use the new inputs to move an cursor to select the spot
wanna see the progress, so interested 👀
without entities?
system yes, but the visuals I need entities since blocks have limits so I can't just use states
great work!
Oum hi everyone if you don't mind, is it possible to make an Custom fishing rod using Script API?and have the function of a normal fishing rod?
I'm a bit curious since I'm trying to make a custom fishing rod for an addon I'm working
Just @mention me if anyone have an idea if it's possible
almost nothing is impossible for me ( while making custom stuff working exactly like vanilla )
i believe it is possible
@valid ice yours is closed source?
Thanks, Now this gives me hope to finally make an custom fishing rod that functions like a vanilla one
use a small system that will take 1 durability from the item if needed and change the texture of it ( by making it a custom modelled item ) and summon a new custom entity with a custom rope that is connected to the player somehow
i know, the custom rope that is connected to the player is a thing on bedrock, u can make it but idk how exactly
// Handle item durability damage
function damageRod(player, item) {
const durability = item.getComponent("minecraft:durability");
if (durability) {
durability.damage(1); // Reduce durability by 1
// If rod is broken, remove it from inventory
if (durability.damage >= durability.maxDurability) {
player.getComponent("minecraft:inventory").container.removeItem(item);
player.sendMessage("Your fishing rod broke!");
}
}
}
Yes
@dim tusk can you help again with my post?
@untold magnet any chance you can help with my script api post
Yes? About what?
and idk how to fix it
@dim tusk here: 1323484880763490374 its that thread id I have one open
What thread, what you gave me is numbers
@deep arrow yes thats it
@dim tusk idk does this work when I paste it:https://discord.com/channels/523663022053392405/1323484880763490374
more people needa code in typescript imo
If they can't even do js why use ts?
fair ig i just prefer ts lol
how can I set an item slot to a quantity of one on an entity that isn't the player?
ive tried this but nothing seems to happen
const entity = block.dimension.spawnEntity("sci:mBContainer", block.location)
const entitySlot = entity.getComponent("inventory").container;
const book = entitySlot.addItem(playerMainHandSlot)
entitySlot.amount = 1```
W
Nah the logic you have is concerning.
You can set it to any number (from 0 to 35) i think. [Btw entities dont have main hand slots]
Guys do you know about Mojang update that items have colors now that indicates how it's rare so is there any in script that can detect how rare I'm holding
Nope
Make a map of all the items yourself
And this won't know rarity of custom items too.
Ohhh ok
are there any optimisation techniques i could use for those users who face high ping in servers?
using script api i could pre activate a function
For example melee attacks
Higher ping gives more damage
what do you mean?
it looks like a new (I think?) bug. Had the same thing happen today
entity.getComponent('inventory').container.setItem(0, new ItemStack('netherite_ingot'));
Wth is this
he is joking
LoL I think it's real
is this even possible https://discord.com/channels/523663022053392405/1323607944314748990?
entity property,
use q.property in animation to set the legs animaton/position(if it possible)
use scriptApi to set the property
idk if there any scoreboard query
scoreboard query only work if it is displayed
too complicated
bedrock system goal need to be simple and powerful
then the mods youre recreating is too complicated too
it's easier than that thing
how to use dimension.getBlocks ?
what is BlockVolumeBase
entity properties is actually a very decent way of doing this
How do I create a wall of blocks in all directions (starting from the center) without replacing any block?
"how do i place a bock without placing a block" is what i understood from your question
Damn
I'm trying to find ways to just place a border made of blocks without collision box. I would use this to show players what's the actual safe zone
use particles
blocks are not a good idea
yeah
I did it last time I did this, but the border wasn't very clear to players, making them confused
I used a bunch of border block particles iirc
or this if you want to use blocks, just make sure to use filter and remove the up and down planes
how was it confusing though
You couldn't see it all the time, only if you actually approached the border
same with blocks?
I never tried blocks for a border, and it's the first time that I want to do it with blocks
maybe you didn't do something correctly, because that's weird.
Let me see if I have my previous code (I probably do since it's in a private Git repository)
I doubt I would be able to help
[tasks/player.ts]
if (border.condition) {
showBorderParticles(p, 20);
p.applyDamage(2);
p.onScreenDisplay.setActionBar(
"§cYou're in the border. §eYou will die if you don't go back!",
);
return;
}
if (border.closeTo) {
showBorderParticles(p, 8);
p.onScreenDisplay.setActionBar(
"§6You're close to the border! Going further will end your game.",
);
return;
}
[index.ts]
export function showBorderParticles(player: server.Player, frequency: number = 2) {
for (let i = 0; i < frequency; i++) {
let position = {
x: Math.floor(Math.random() * 5) - 2,
y: Math.floor(Math.random() * 5) - 2,
z: Math.floor(Math.random() * 5) - 2,
};
server.world
.getDimension(MinecraftDimensionTypes.Overworld)
.runCommand(
"execute as " +
player.name +
" at @s run particle minecraft:rising_border_dust_particle " +
`~${position.x} ~${position.y} ~${position.z}`,
);
}
}
well, you shouldn't use commands
Yeah, I know
I used to, though
(which is bad)
i may look into this later, no promise tho
Alright!!
Also, why the hell did I use an execute as command if I could've just ran the command as the player
I find it funny because you used setActionBar method
but you used a command for the other part
I don't even know if the spawnParticles method was a thing back then
lol
We're talking about 2023
well... was it actually? how long ago was this
when was spawnParticle added?
commands do spawn particles outside loaded area, right?
you wouldnt get an error for that
I have no clue, honestly. I remember using a command because I couldn't find another way to spawn particles
it was there from 1.1.0-beta
nahhh
I would ask a bunch of questions here in this thread
Now I either do the stuff myself
Or, if I ask any question, I may solve it myself somehow
you just needed to look at documents more and you should've been fine
assuming it was well documented
anyone know how to convert block into color?
🥸
uh
we all were terrible at it in some point
That's true
true
coddy did sent you a script, no?
That's amazing
yeah
oh that's amazing
that wont always be accurate when it comes to custom blocks though.
not all devs define map color component...
yeah
yep
Unrelated, but are minimaps even possible on Bedrock?
ive seen like 2
both were EH
somedude use render controller and anim
to manually render it
Dang
maybe someone will make it
Impressive stuff overall
yeah using structure 3d renderer it's possible
Im assuming they kept updating the structure every tick with scripts
yeahh
idk how performant that is though
probably not good...
using just resource pack is impresive tho
oh yeah and structure renderer doesnt have to reloaded everytime isnt it
huh
typo
oh, reloaded
How do I use block volumes?
I'm trying to get this working
import BlockVolume class.
Yeah, okay. I just want to know how they work
its already imported...
idk when i use
new BlockVolume(from:player.location,to:player.location)
here
i think it's just parameter?
Documentation for @minecraft/server
Ohhhhh
Thank you!!
That makes sense
suprise in me it doesnt work
i just use ```js
getSurfaceBlock({from:Vector3,to:Vector3})
and it's work
This doesn't really work with big distances
world.afterEvents.playerInteractWithEntity.subscribe(eventData => {
const player = eventData.player;
const entity = eventData.target;
if (entity.typeId !== "test:test" || player.typeId !== "minecraft:player") return; {
entity.runCommand("particle minecraft:huge_explosion_emitter ~ ~ ~");
system.runTimeout(() => {
entity.remove()
}, 40);
}
});
How I can make in this script so player can Interact only one time with the entity? Because now I can Interact with it till it's removed, so if I spam button I can do it like 6 times, which is wrong.
And now I know why: unloaded chunks
Whenever I use the getSurfaceBlocks method with large distances (50 for example), it will just spit out this error
I don't really know how to solve it
tickingarea
world.afterEvents.playerInteractWithEntity.subscribe(({ player, target: entity }) => {
if (entity.typeId !== "test:test" || entity.getDynamicProperty("hasInteracted")) return;
entity.setDynamicProperty("hasInteracted", true);
entity.runCommand("particle minecraft:huge_explosion_emitter ~ ~ ~");
system.runTimeout(() => {
entity.remove();
}, 40);
});```
Use dynamic property
you just have to find the best way of getting the colors and displaying it
This is aliasing right?
no
it is just a loop that get colors and pass them to particle
no additional stuff
Oof, I thought that's a block from far away it's just 1 full block particle
it is 400 particle
20x20 map
Thank you very much!
Yeah, but how?
If you are looking to generate a border, which is what it appears to be in your image, then you could have it create the border as players come near it. This way the chunks are loaded prior to accessing the general location.
I don't know about that approach
Player have to clearly see the border. It can't just pop in like nothing
I believe the effect won't be much different as your rendering distance when you move about, but it will likely depend on how close you want them to be before you generate it.
@hot gust, I believe you already do something like this so maybe you can clarify.
yes
i have a custom particle
then im trying to find the code
its a fair amount of code but creates a border lines within the world
// Visual Border system configuration
let worldSpawn = { x: 0, y: 64, z: 0 }; // Center of the world border
const particleEffectName = "paradox:worldborderviz";
const maxDistance = 44; // Max distance from player to spawn particles to ensure chunks are loaded
const maxParticles = 500; // Maximum number of particles to spawn
const particleLifetime = 3.5; // Lifetime of particles in seconds
const ticksPerSecond = 20; // Minecraft runs at 20 ticks per second
const spawnInterval = particleLifetime * ticksPerSecond; // Interval to spawn particles in ticks
let tickCounter = 2; // Initialize the counter
// Function to calculate positions for a line along the x or z axis at the world border
function calculateBorderLinePositions(borderNumber, axis, start, length, y) {
let positions = [];
if (axis === 'x') {
for (let i = -length; i <= length; i++) {
positions.push({ x: borderNumber, y: y, z: start + i });
}
} else if (axis === 'z') {
for (let i = -length; i <= length; i++) {
positions.push({ x: start + i, y: y, z: borderNumber });
}
}
return positions;
}```
function filterPositions(playerPos, positions, maxDistance) {
return positions.filter(position => {
let distance = Math.sqrt(Math.pow(position.x - playerPos.x, 2) + Math.pow(position.z - playerPos.z, 2));
return distance <= maxDistance;
});
}```
let spawned = 0;
for (let position of positions) {
if (spawned >= maxParticles) break;
// Convert coordinates to integers
let intX = Math.floor(position.x);
let intY = Math.floor(position.y);
let intZ = Math.floor(position.z);
// Spawn the particle at integer coordinates
world.getDimension(dimension).spawnParticle(effectName, { x: intX, y: intY, z: intZ });
spawned++;
}
}
tickCounter++; // Increment the tick counter
let worldBorderNumber = border
if (tickCounter == 3) {
const playerPosition = player.location;
const worldBorderNumbers = [border, -border]; // Array to store both positive and negative border numbers
// Check if player is near the x or z border number
let particlePositions = [];
for (let worldBorderNumber of worldBorderNumbers) {
if (Math.abs(playerPosition.x - worldBorderNumber) < maxDistance) {
particlePositions = particlePositions.concat(calculateBorderLinePositions(worldBorderNumber, 'x', playerPosition.z, 50, playerPosition.y));
}
if (Math.abs(playerPosition.z - worldBorderNumber) < maxDistance) {
particlePositions = particlePositions.concat(calculateBorderLinePositions(worldBorderNumber, 'z', playerPosition.x, 50, playerPosition.y));
}
}
// Filter the positions to those within a reasonable range of the player
let filteredPositions = filterPositions(playerPosition, particlePositions, maxDistance);
let currentDim = dimension;
// Spawn a limited number of particles at the filtered positions
spawnParticlesAtPositions(particleEffectName, filteredPositions, maxParticles,currentDim);
tickCounter = 0; // Reset the counter after spawning particles
}
}
then on a tick script i used the older paradox world border to do all this
if(player.dimension.id === "minecraft:overworld"){
let dim = "minecraft:overworld"
updateParticlePositions(player,worldBorderOverworldNumber,dim);
}
if(player.dimension.id === "minecraft:nether"){
updateParticlePositions(player,worldBorderNetherNumber,player.dimension.id);
}
if(player.dimension.id === "minecraft:the_end"){
updateParticlePositions(player,worldBorderEndNumber),player.dimension.id;
}```
sorry for the spam lol
I find it really, really, really stupid that the typeof null equals object. object!
why JS 🤦♂️
everything in an object
Happy new year!
It's not that bad. You can add && param != null
the funny thing is a fix was proposed and got rejected
https://web.archive.org/web/20160331031419/http://wiki.ecmascript.org:80/doku.php?id=harmony:typeof_null
Happy new year
One explanation I saw on StackOverflow suggested that null is equivalent to a null pointer. Following the expectation that pointers in a program's memory are almost always used to point to objects, then it makes sense that typeof null == 'object'
(In that a variable can either be assigned to a pointer of a given object type, or to null, the latter of which is intended to mean uninitialized or unspecified memory)
I suppose it would be more sensical if JavaScript had a more stringent type system. Then typeof in its current form would be completely irrelevant, and thus this problem would not exist, since there would be no need for an object-like type comparison—only a "is this an X (class)" comparison
I mean you always just use Object instanceof Class
is there a way to spawn entity with custom variant
Use entity events to trigger the compinent groups.
Unfortunately, not all entity has event to trigger the variant switch
you have to edit their files then.
wouldnt be worth it imo
Huh.
For some reason I thought script API could edit variants by now
I wouldn't know because I've just been using entity properties.
hey guys! i need quite some help with optimizing my add-on
i won't be saying a lot at first, i'll go step by step, i first tried to do something myself, but i need some help now
firstly, and i think mostly, i had quite some system.runIntervals all around the add-on, and all the intervals that matched the same time (in ticks), i merged them in one bug script, hoping that it would stop the "hang" crash, but, ik, its not just runIntervals, it's much more, and im working on it
im changing a lot of scripts, removing a lot of unnecesary stuff (to be more specific, changing the stuff that i made when i didnt know scripting so well, changing all this stuff to the better, imporoved systems)
so, firstly, im looking for some help to stabilize these system.runInterval even more
maybe there's some kind of, a lil bit more optimized, alternative to it?
im still learning scripts, thought, im much better at them now, but i still need help, especially with optimization, anybody willing to help me out?
lol
Sure
Firstly
Any looping through arrays turn it into:
let array = /*value, comment out this line if you already have the array, but for example if you are looping through players then put `world.getPlayers()` here*/;
for (let i = 0; i < array.length; i++) {
let element = array[i];
}```
thank u! u can dm me if more conveniente
alr wait, im confused, how does this work? like, how is it a looping array and how would it work, for example specifically on every 3 ticks, or evey 500 ticks
It works like normal, just faster
Anyway, secondly, turn any functionality you have in loops into a function outside that loop and call it from there, for example:
system.runInterval(() => {
// some functionality
});
Should be:
function loop() {
// functionality
}
system.runInterval(loop);
Also avoid objects as much as humanely possible unless you have the indexes, for example if you have an object with each player's health for example (for example, don't actually do this lmao) and you have their id as the key, then sure you can use objects in this case, this is to avoid the Object.keys() & Object.values() & Object.entries() calls
-# "won't be saying a lot at first"
i meant like help with intervals, and then send another script i need help with, and another one, and another one
like, firstly with intervals
Also for long running stuff that doesn't exactly need to be computed exactly every <ticks>, you can use system.runJob(function* (){ // code }());
im starting to understand
its late for me, my brain isnt quite braining, but its starting to brain
im trying to understand and i do
If you want to edit the variant I think the entity should have a variant component first... I'm not sure since I don't use that component and also docs said it's not read only 🤷
Also if you use a variable or a function or whatever more than once, and remember this, make sure to cache it the first time and use the cached value from there. But this is completely useless if you are accessing something like system.currentTick and you want the current tick (someone asked about this a long time ago, they asked what is more performant, storing the current tick in a variable and then updating it everything or just using it instantly, and ofc the answer is to just get the property using system.currentTick, but the only use case for caching the current tick is to know when a certain event finished for timed operations).
My eyes kinda twitched lmao
Lol
Exist a way to save data on an item without cancel my use animation? (Sorry for my bad english, Im not english native speaker)
Is it stackable?
ngl, that sounds incredibly stupid
So then what is the problem?
Im using dynamic properties
and you're correct when just checking the time cache but the actual time of the world? Why the fuck put it on the variable
Setting the item stops use maybe that's why?
Someone asked something this dumb a long time ago
When reset, the using animation glitchs
Set it later?
Lock the item and make it not lost on death and hide that by turning off the showTags gamerule
okey, thank u so much pal! i'll get into undertsanding and practicing with this tuff tomorrow
It depends, Does it need to be setted constantly?
Hey neight!
i'll also show the script i have
You can't set it instantly right? So just use the other approach. Unless you got a better choice.
I should go now. I still am working on the website :(
Uhuh
I am tryna finish the big update before new years eve
me who is literally not done with my chess
Lol
I literally attach an external keyboard and mouse on my phone
Since it's hard to constantly duplicate an object
The thing is i promised something i couldn't do to my server members :(
let oldObj = Object.entries(oldObj), newObj = Object.fromEntries(oldObj);
Don't try to help a beginner being a beginner too... You will just confuse him.
Alright buddy
If you were to give good programming advices at least make sure they are. Those are just your ways to do such stuff, not the correct way.
Whatever you say.
modelling not script lmao
Ohhh
in that case, give the guy the correct advice?
I don't have time for that.
I usually help with code snippets here
but explaining someone how to code
Then zip it until you have time to provide help.
Then you are just attacking, not providing real help.
you're a blind trying to lead a blind
okay then don't complain that they did something wrong...
NO FUCKIN FIGHTING.... GOSH
i'm not complaining
Am i? Or are you? Who is the one attacking here?
I'm TELLING that you shouldn't try to help a beginner being a beginner too
leave that for the biggers.
your message is literally a complaint 😭
No
No "biggers" is helping in this case.
So until they actually start helping
They are undefined and are not in this equation
Yeah you can do whatever u want buddy it's a public chat so it's stupid saying i'm complaining bc i'm not a staff here to do something about you giving shit advices.
I was justt giving my opinion
from an objetive pov
that's it
^
it is what it is
It indeed is what it is.
hm
Good advices would be for example... Use guard clauses instead of nested if statements
Something like that
but
Making a separated function to put it inside the runInterval
Some people just pop outta nowhere and start claiming stuff is horrible and bad without providing "the real advise".
??
^
see? You're complaining, you're not just telling the right thing
You wanted a real advice there it is
Sure but it has complaining too
And it usually does nothing in performance, if you want performance you'd use a ternary operator.
Its just for better readability.
You can't use ternary operators in all cases 💀
if you're not satisfied with someone's advice why not give better advice to the other guy instead of saying "I don't have time" but also have time to tell the guy who doesn't need advice and advice 🤷
If you weren't a beginner you wouldn't have said that.
I can, infact.
Ternary operators aren't for all cases
I can make them for all cases.
imagine doing 6 conditions in a single line just because "you wanna use ternary operator in all cases"
that's crazy
and loses all the sense of that "better readability" you talking about
Beginner being a beginner...
anyways
im outta this convo
no point on talking to a beginner
I am telling you you are providing better readability not performance and he was asking about performance
Also you can put the tenary operator on multiple lines btw
Using ternary operrators isn't more performant than guard clauses 💀
you're just trying to prove a point that doesn't exist
💀
Umm, yeah bro really have time arguing with you instead of giving the guy who actually needed help and advice 😑....
You can, yeah, it's still unreadable when there's a lot of conditions to check for.
I just gave 1 👍🏼
Put it on a new indentation level, ez problem saved.
"I don't have time for that"
i just gave 1 👍🏼
"I don't have time for that"
wtv u say
i just gave 1 👍🏼
Not to one who needs advices from an arrogant person.
advices*
Which one is right?
player.getGamemode("creative")
or
player.getGamemode == "creative"
Yes, whatever i say is better then whatever you say.
1st
wait
no
It's getGameMode and use 2nd
none of them
Both wrong
.getGamemode() === "creative"
Oh, thnks
Why are you always in fights 😭😭
bro thinks he's part of the justice league
Nah i aint always in fights, i always leave fights but some people just love arrogance
Okay
yeah, they have a love and hate relationship.
L
But only 20% love
Yeah, i am the flash.
To you.
Brothers be arguing on who give a the best code advice
womp womp
Sure
i wasn't arguing who gives the best one because idc about that
i was arguing about why u SHOULDN'T give bad advices to beginners
Nuh uh, its personal
And i was arguing about your high ego and low iq
Normal thing.
Low iq 😭🙏
bro doesn't even know what to say anymore
we have Albert Einstein around
Bro i think ??? isn’t a beginner he used to help me like 1 year ago
Yes, thanks for accepting that 🙏
You don't stop being a beginner in 1 year
Im not him, dw. Hes one of us but not me and for sure not u
Am i a beginner?
Low iq see.
No idea
wtv u say lil bro
Yes whatever i say, its better then whatever the crap comes out of your mouth or your stupid little discord account.
Bro got so mad that he's even insulting 🙏
Hey, why is it me who doesn't have an enemy... Can I have one?
Bro's iq is so low that he didn't even realize i was talking 'bout him 💀
No.
that's mad crazy
Crazy, bro insults himself and thinks others are talking about themselves!
We got Anonymus 2015 ahh hacker vs script veteran 🍿
I'm insulting no 1
im just talking about ur low iq
stay mad
You are insulting no.1? Yourself you mean? Cuz indexes start with 1 in lua.
No, thanks 🙏 👍
Bro cringe levels are going crazy please stop this 🛑
Ok now im actually outta this convo ion wanna get banned, think wtv u wanna think bro, at the end of the day, it's whatever, im a software engineer and you're a kid growing up trying to learn a programming language just to create addons for minecraft 🙏 (i also create Addons but that's not the only thing i do)
Damn 😔
Little bud, i am a fullstack web developer and i am a software engineer.
yeah just wanna add we didn't ask if you're a full time programmer man...
-# but that's cool I guess?
Bro wrote a whole essay
Bro got hurt so bad he spammed an emoji?
Frfr
Either way ginkn with your lives
public convo i say wtv i want 👍🏼
cya
there's better things to do than this stupid little shit
it wasnt for u srry
See ya. Have a great day 😀
was for that guy who thinks he full stack
u too
Ay ay.. stop it
It was for you*
The day is ending 😭🙏
(It long ended in my timezone for this context so yeah)
I'm literally calling a mod.
-# nah I'm not I'm a scaredy cat lol
Mods should add a channel to argue
Kind of useless y'know off-topic channel? Yeah, this argument should be off-topic but they didn't do it
Off-topic? Nah
Useless channel
A quick search of your name shows you aren't much better. Calm down bro. You got a reputation for stirring up trouble here. Might be time someone puts you in timeout.
ehh... Kinda forget bro made two enemies
Very few things will bother me. People like him are one of them. I'm not in favor of sitting idle when it comes around either.
I'll call it like I see it.
Honestly, you need to stop putting so much energy into arguing with people online.
its not worth it.
I won't argue. I'll just correct. Turning a blind eye isn't healthy either. Unless a mod handles the behavior then someone needs to point it out to them.
You know what you are doing, and they do too.
Bro actin like the main character 😭🙏
say that to the other guy I guess?
Of course, I already stated my intentions. I'm not hiding from it 😎
Eon is the one causing the heat.
don't let people get you mad like that.
especially online.
Agreed.
Rage baiting at it's finest
if you agree why are you feeding
Ye and also is for stupid reasons
I already said my intentions?
Or is there a misunderstanding on the difference between arguments and corrections?
corrections can be a form of argumentation.
this right here is turning into argument lol
arguing about what an argument is
funny
🤷♂️
Arguments is another form of fighting. One which I have no intention of doing. However, I will stand firm on my actions. Emotions do not factor in with my decision to hold someone accountable. I could care less about ones emotions on the matter. If you are wrong then you are wrong.
player.explode()
People complain they're getting cyber bullied, just turn off your WiFi
or just, dont respond
nah, json player.dimension.createExplosion()
True, if you can't handle the heat don't feed it even more... You're just gonna burn in the end
even though they never can admit they are mad or emotionally affected.
gotta go
Bro thinks he is a philosopher
ill try to talk to you tomorrow vlad
have a great day! =P
you too 
bro thinks... Bro thi- Nvm... 😔
Eh, 2 hours left. I'll go home in a year lol 😆 (new years joke lol)
Thank you for recommending this pattern 🙏
You're welcome.
The number of times people have gotten confused because their error says at <anonymous> when they could have been naming their routines ...
Math nerds are so cool dude
Idk i feel like they have hacks lol, i also feel that when i get my calculations right
Yes, Albert Einstein
He was a great hacker
This guy is a certified, nerd and a chill guy
And a certified hacker too, cmon give the guy credits.
He hacked the education system and was taught in home, unlike others.
He used to fail so many times
Yet he became the most smartest man
Lmfao, W
Failure raise you my dawg
he learns from his mistakes
Yessir
Just like Tony stark.
Yessir
I’m brain rotten
Probably not
Thanks
If its being used, its on main hand.. so Player#selectedSlotIndex
Is faster to do equippable component main hand
She asked for slot
They are asking for the index
Not me
Not the item.
Oh
I used this with a let for save last slot, and work
My item not duplicated again
is there a way to get texture from block ?
using script api of course
@valid ice how can u do it in the chest form?
Sure
Just paste the path
Wdym by textures? You mean icon?
Son of god can someone help me with the molangVariableMap()?
-# me first time using this
how do I add a variable to the particle?
nvm oof
I just need to read the docs lmfao
[Scripting][error]-Plugin [pack.name - 1.0.0] - [main.js] ran with error: [SyntaxError: Could not find export 'ModelFormData' in module '@minecraft/server-ui']
anyone know how to fix im following a tutorial by using a compass it opens a gui, this happend when i /reload
You forgot to add it to your manifest
add what, this is my first day scripting so if im kinda stupid thats why
{
"format_version": 2,
"header": {
"name": "",
"description": "",
"uuid": "",
"version": [0, 0, 1],
"min_engine_version": [1, 21, 60]
},
"modules": [
{
"description": "behavior",
"version": [0, 0, 1],
"uuid": "",
"type": "script",
"language": "javascript",
"entry": "scripts/main.js"
}
],
"dependencies": [
{
"description": "server",
"module_name": "@minecraft/server",
"version": "1.18.0-beta"
},
{
"description": "server-ui",
"module_name": "@minecraft/server-ui",
"version": "1.4.0-beta"
},
{
"description": "debug-utilities",
"module_name": "@minecraft/debug-utilities",
"version": "1.0.0-beta"
},
{
"description": "resource",
"uuid": "",
"version": [0, 0, 1]
}
]
}```
Here. A sample
this is mine rn
{
"format_version": 2,
"metadata": {
"authors": [
"hello"
],
"generated_with": {
"bridge": [
"2.7.42"
],
"dash": [
"0.11.7"
]
}
},
"header": {
"name": "pack.name",
"description": "pack.description",
"min_engine_version": [
1,
21,
0
],
"uuid": "a432d459-24d6-40ea-9241-c7236fb6e2b3",
"version": [
1,
0,
1
]
},
"modules": [
{
"type": "data",
"uuid": "37352f7b-47a5-4570-87e6-f9b09b040efd",
"version": [
1,
0,
0
]
},
{
"type": "script",
"language": "javascript",
"uuid": "8d827430-cba9-4991-b00c-026f9cc394ae",
"entry": "scripts/main.js",
"version": [
1,
0,
0
]
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.17.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.4.0-beta"
}
]
}
nvm, you put it wrong
put what wrong
ModalFormData not Model
tysm for your help i greatly appreciate it
world.beforeEvents.itemUse.subscribe(data => {
let player = data.source
let title = "title of your gui"
if (data.itemStack.typeId == "minecraft:compass") system.run(() => main(player))
just wondering what this does
Dont enough code, but just ASSUMING shows a form when used the item
when using the compass it will call a function in the next tick
Custom item or vanilla?
diamond sword
If custom use custom components if vanilla use before events of itemUse
https://pastebin.com/B10PbQ3t
clearlag use system.currentTick
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
in world.sendMessage("") how do i make it send "given "PLAYERSNAME" strength 5 for 5 seconds?
world.sendMessage(`given ${player.name} strength 5 for 5 seconds`);
Or
world.sendMessage('given' + player.name + 'strength 5 for 5 seconds');
both works
Just add a space if you use +
They will look like this. If you don't add spaces after each string
giveCoddystrength 5 for 5 second```
Oh I forget
world.sendMessage('given ' + player.name + 'strength 5 for 5 seconds');
i had already tried world.sendMessage(given ${player.name} strength 5 for 5 seconds); and it didnt work which is when i asked the question but i realised i used " instead of `
so i fixed it and alll better
that's why the ${block.location.x} earlier didn't work.
Yea because ${} need ``
Huh, we meet again
Happy new year BTW
EST
How's life living in the past man?
great
Happy 2013 guys
That sounds different when out of context
lol
so system.currentTick % (40) === 0 will run every 40 ticks in runInterval, but how could I delay until 40 ticks after an event, and run every 40 ticks perpetually after?
rate my code, how can i improve this?
import {world as W, system as S} from "@minecraft/server"
let [m,d,s,c,f] = [[],
_=>1 << W.getPlayers()[0].selectedSlotIndex,
(s,b)=> W.getDimension("overworld").runCommand(`setblock ${s >> 6} -59 ${s & 31 >> 1} ${b}`) && s,
(p,h)=> p && c(m[p]) || p == (h ?? p) && p,
(p,h,a)=> S.runTimeout( _=>{
m[s(h, "green_concrete")] = p
s(a, "red_concrete") != h && (m[s(c(p), "air")] = 0) || (a = Math.floor(Math.random() * 999) & 990 + 1)
!c(p,h) && f(h, (h + (d() & 66) - (d() & 132 >> 1)) & 991, a)
}, 4)
]
f(1,3,3)
2/10 I can't even tell what it is supposed to do
oops i wrote this without an lsp, seems like i missed a ,
Looks like what the compiler would make
I would deobfuscate this at first
also fyi, this is a snake clone
Is there anything to detect if a player has a certain scoreboard number?
world.scoreboard.getObjective('objective')?.getScore(player);
I cannot read that
and why is it using runCommand
also it's running it off of the first player in the world?
i challenged myself to make a snake clone with the fewest characters possible
and runcommand is shorter than setblockpermutation
actually
maybe not, I'll test it later
Is it possible to stop containers from dropping their items when broken? (/gamerule dotilrdrops does not do this in case anyone suggests it)
If you are using beta api you could cancel the block breaking event and remove the block from the script
okey, so, im here and starting to work. i'll start working with the information u shared with me and will try to put it to work. also, as i wanted to show my intervals script, and here it is (i know its a COMPLETE mess😭😭😭😭)
(and sorry for ping)
firstly, i'll turn functionality to functions and do this
What's the impact in performance?
guys i have a script, where im trying to make so my entity transformed into another one, for example, here
const entityList = [
'minecraft:pig',
'minecraft:hoglin',
'minecraft:cow',
'minecraft:frog',
'minecraft:villager_v2',
'minecraft:piglin',
'minecraft:slime',
'minecraft:allay'
]
const mutatedEntityList = [
'minecraft:hoglin',
'minecraft:zoglin',
'minecraft:ravager',
'v360:warped_frog',
'minecraft:vindicator',
'minecraft:zombie_pigman',
'minecraft:magma_cube',
'minecraft:vex'
]
function mutateEntity() {
for (let i = 0; i < entityList.length; i++) {
}
}
for (const player of world.getPlayers()) {
world.getDimension(player.dimension.id).getEntities().forEach((entity) => {
if (entityList.includes(entity.typeId) && entity.hasTag('v360:warping_stage1')) {
}
})
}```
i have 2 lists of entities, and list of transformed entities. i want to make it so for example, first entity from `entityList` spawns the first entity from `mutatedEntityList`, or, for example, piglin, it's the sixth entity in the `entityList`, so it has to spawn sixth entity from `mutatedEntityList`, which is zombie pigman. currently im stuck with this, and i need help figuring out the rest
There's a faster way tho.
const transform = {
'minecraft:creeper': 'minecraft:sheep',
}```
but what's after that?
wait, imma make a simple script.
const transform = {
'minecraft:creeper': 'minecraft:sheep',
'minecraft:skeleton': 'minecraft:tnt'
};
for (const entity of world.getDimension().getEntities()) {
if (transform.includes(entity.typeId) && entity.hasTag('transform')) {
const targetType = transform[entity.typeId];
console.warn(`${entity.typeId} into ${targetType}`);
}
}```
Sorry it took awhile, I'm eating my dinner rn
no problem
sorry, replace includes with hasOwnProperty, I forgot includes only works on arrays
👀
import { world, system } from "@minecraft/server";
const mutateTo = {
'minecraft:pig':"minecraft:hoglin",
'minecraft:hoglin':"minecraft:zoglin",
'minecraft:cow':"minecraft:ravager",
'minecraft:frog':"v360:warped_frog",
'minecraft:villager_v2':"minecraft:vindicator",
'minecraft:piglin':"minecraft:zombie_pigman",
'minecraft:slime':"minecraft:magma_cube",
'minecraft:allay':"minecraft:vex"
}
const entities = Object.keys(mutateTo)
const allDimensions = [ 'overworld', 'nether', 'the_end' ];
const dimensions = allDimensions.map(dimension => world.getDimension(dimension));
function mutateEntity(entity) {
const type = mutateTo[entity.typeId]
if(!type) throw new Error("Entity type not found for mutation");
const {location,dimension,nameTag} = entity.location
const rot = entity.getRotation()
const vel = entity.getVelocity()
entity.remove()
const mutatedEntity = dimension.spawnEntity(type,location)
mutatedEntity.setRotation(rot)
mutatedEntity.applyImpulse(vel)
mutatedEntity.nameTag = nameTag
}
system.runInterval(()=>{
for(let dimension of dimensions){
for(let entity of dimension.getEntities()){
if(!entities.includes(entity.typeId)) continue
if(entity.hasTag('v360:warping_stage1')) mutateEntity(entity)
}
}
},5)
imagine he doesn't want to spawn the entity and you made a whole ask script for that.
Havent had any issues on bds 10-11 players
i mean...
What about client performance?
it works!!
my entity transforms
thank u sooooo much!!
See he has a different function 😭 that's why I didn't bother making a whole script.
Player base is mostly made of ps4 and mobiles with a few pc players and no one has complained
I suppose those mobile devices weren't all high-end, right?
No
this was bothering me
so i remade the whole thing
@hot gust what about the particles?
I just realized that you can just player.dimension.getEntities()
i still appreciate it! i'll take this as an example for something else, for the future
i can learn from this
duh
lol
What do you mean they spawn then die and repeat providing the player is within the set range of the world border
Sorry. I meant that I don't have the particle file, and I'm not really experienced with particles myself (haven't created any particle)
Oh i see yeah youd need a resource pack you could replace the custom one with one of the vanilla particles
What particles do you recommend me to use?
Im away at the moment but can dm you the pack later
Any one of them would do just to test it
anyone know why the .getComponent("minecraft:is_charged") doesnt work on creeper?
Idk because, maybe its for crossbow only ☠️ @warm drum
Its an entity component...
getComponents and print them out to see if it is even there
try hasComponent
@granite badger how to keep the script blocks to persist through reloads of the world
pinging someone limits the amount of people who can help you from everyone online here to just one person
Expect he'll respond 7 hours later
and thats fine
Do you mean the data within the block? They are stored in dynamic properties
i mean how can i make the blocks code persist through reloads
You can't at the moment. I can think about adding a script initialize feature which runs the code at startup through the behavior pack if that's what you want
ok thanks for the help jayly
does teleporting an entity 9999999 999999 99999999 to get rid of it forever cause a memory leak or add memory to the world?
should i be teleporting them to a location and adding a tag to despawn them based on a despawn component group in the json of the entity?
it hasn't seemed to cause issues before just trying to clean up some code and make it more efficent
im updating my leefy spawners addon
Could you elaborate on what you're trying to do?
So far, teleporting an entity below bedrock seems more optimal
.remove() best
Yar
no shot....
Like .kill() but without death effect or loot
dang i've been outta the loop
Entity just simply ceases to exist
W a i t w h a t
well that works very well... alot less processing thank the lord.. performance for sure
I'll allow myself to guess: A cat on a keyboard
ojnn pm,;p//// '''''
😭
o/ Hi Leefy's cat.
It was a very meaningful conversation
sounds good haha
i had to clean up some melted carmel on a couch since someone sat on a milkyway and melted the entire kind size bar
then my kid 18 month old, decided to go full leefy and put headphones on as well and type like an artist
How did that person not feel them sitting on it😭
Ok this is getting off topic, i shall not elaborate further
sounds good. anyways, i've been updating my code for an addon i have.. its getting sorta laggy overtime, and i've figured out a bunch of places that have helped alot.
reducing any memory leaks as well
do you know if they fixed the summon entity facing direction issue?
they currenlty spawn in only at one direction after killing my entities
ill have to test i suppose
this is what im am reffering to... when killing they always spawn in facing one direction, and there was a issue in the past...
This is something you'd see on a DanTDM vid back in 2016
(ignore the Netherite)
oh haha
I think the best you’ll get is setRotation
awh okay
i am planning on adding more entities
but wanna make sure functionality in servers is not gonna cause lagg
which it doesn't
for the most part...
I'm trying to repeat the logic on spawners where if you right click a spawn egg onto it, it changes it to that type of spawner. I already have it so it reads which mob it is from the itemUseOn event... but how can I store the data on the block?
wait a sec...
for rotation
initial might be able to get inherited
seems newer or im just way outdated myself
you could just use /summon right
i just use database, and store based on location etc.... and use entities inside the block for extra spawning stuff..
maybe you can use itemDynamicProperties?
can't do that, i'm putting it inside a structure block to be saved
possibly, but i need it to be api otherwise it laggs using commands
due to cap
awh ok
thats not a bad idea
I was trying just event.block.setPermutation(server.BlockPermutation.resolve("block:block_name", {mob: mobType})) (with the correct name ofc) but I guess I don't understand how I'm suppsoed to allow this permutation to work?
maybe this is more of a blocks question then scripting
well, your talking about hard coded permutations right
Permutations are definitely worth looking into
I use them for my spawners, no entities involved (besides the ones spawned, ofc)
Def nice to use permutations, I need to look into that more.
Less blocks to create smaller addon
I would assume
Easier to expand on
I still have 1 block per spawner
Each is a separate block
But they all run off the same custom component & permutation names so it’s easy to expand upon
i realized I needed to add the states lmao
code was fine
max of 16 states (for one state) :/ unfortunate
16 values for 1 state and 32 states for a block
your block can't have more than 65k permutation and the world shouldn't have that many permutation too
Is it possible to make an entity atack in area applying knockback and damage that could be possible to block with the shields??
I need it for a boss but idk if thats even possible with scripts
help plz
for this kind of attacks
i was thinking in using tags
what is .subscribe used for?
Callback Arg
for exp
world.afterEvents.itemUse.subscribe(({ source: player, itemStack }) => {})
if you subscribe to an event it does it?
Uhm
event is don't exist, U can put any custom name after subscribe
world.afterEvents.itemUse.subscribe((abc) => {})
where do you put which item for itemUse
If U use an original arg like this U must add {}
Like this
const { itemStack, player } = abc;
Or
const itemStack = abc.itemStack
Also U can directly use
if (abc.itemStack.typeId)
whats the abc
Not specific U can custom it
but like what do you put there
Wdym
U can use any word
an event?
All event callbacks can use any word
Tells the code to start listening for when that event activates
The code listens for nothing when you first start, and you can tell it to listen or unlisten to events based on what you want it to do
The professionals explanation
Fake it till ya make it 
ok
so would this work
import { world, system } from "@minecraft/server"
console.warn(`index.js has loaded\nYour code has worked!!`)
world.beforeEvents.itemUse.subscribe(data => {
let player = data.source
if (data.itemStack.typeId == "minecraft:diamond_sword") system.run(() => main(player))
function main() {
player.runCommandAsync("/effect @s strength 10 255")
world.sendMessage(`Gave ${player.nameTag} Strength 255 for 10 seconds`)
player.sendMessage(`§l§7Im so cool`)
}
})
Yea
i copied most of this btw
idk, try it and see
U can just do like this
Debug result for [code](#1067535608660107284 message)
Compiler found 1 errors:
[36m<REPL0>.js[0m:[33m5[0m:[33m83[0m - [31merror[0m[30m TS2554: [0mExpected 0 arguments, but got 1.
[7m5[0m if (data.itemStack.typeId == "minecraft:diamond_sword") system.run(() => main(player))
[7m [0m [31m ~~~~~~[0m
ESLint results:
<REPL0>.js
8:9 warning The /effect command can be fully replaced with the Entity.addEffect api in the @minecraft/server module. See https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/entity#addeffect for more information. minecraft-linting/avoid-unnecessary-command
const { source: player, itemStack } = data;
I forget it
what does that do
Simply
Keeping variables separate makes it more readable, especially if you're learning
I luv how smokey 👎 it
do you know how to test out how much damage your doing
entity hurt event?
use entityHurt
get the item used then boom
how
world.afterEvents.entityHurt.subscribe(data => {
console.warn('Damage dealt: ' + data.damage)
})
[Scripting][warning]-index.js has loaded
Your code has worked!!
[Scripting][warning]-main.js loaded
[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)
[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)
[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)
[Scripting][error]-ReferenceError: player is not initialized at main (scripts2/index.js:8)
at <anonymous> (scripts2/index.js)
[Scripting][warning]-index.js has loaded
Your code has worked!!
[Scripting][warning]-main.js loaded
[Scripting][warning]-index.js has loaded
Your code has worked!!
[Scripting][warning]-main.js loaded
[Scripting][warning]-Damage dealt: 1.6743704204155438e+30
not even that much damage
What?
Damage dealt: 1.6743704204155438e+30
Uhh... Nvm
?
player not being initalized is because you don't have it as a parameter in the function you declared (main)
what does its not initalized mean?
The variable is not defined
just wondering if you know how to summon a mob but it stays still?
try
import { world, system } from "@minecraft/server"
console.warn(`index.js has loaded\nYour code has worked!!`)
world.beforeEvents.itemUse.subscribe(data => {
let player = data.source
if (data.itemStack.typeId == "minecraft:diamond_sword") system.run(() => {
player.runCommandAsync("/effect @s strength 10 255")
world.sendMessage(`Gave ${player.nameTag} Strength 255 for 10 seconds`)
player.sendMessage(`§l§7Im so cool`)
})
})
slowness 255
oh good idea
Or disable it's AI by editing the BP file
would it work on the ender dragon
slowness won't work on the ender dragon, edit it's vanilla file...
or you can tp it constantly 🤷
good idea
I type error at the beginning , I forget and I directly use const { player.. instead of source
or you could just Entity.clearVelocity()
Just type it at the top of my script?
It's not as simple as that
Read some documentation to know more
Do not jump directly to this
is there a way i can add the entities name to this
world.afterEvents.entityHurt.subscribe(data => {
console.warn('You dealt: ' + data.damage + `to a`)
})
entity who attacked or the entity who got damage?
got damaged
data.hurtEntity.nameTag
ty
it didnt work
the hell you mean didn't work? You probably did it wrong
prob
Lemme see it
world.afterEvents.entityHurt.subscribe(data => {
console.warn('You dealt: ' + data.damage + ` to a` + data.hurtEntity.nameTag)
})
that's correct.. wym by didn't work?
it says you dealt 3878387 to a
the entity don't have a name then
[Scripting][warning]-You dealt: 1.6743704204155438e+30 to a
[Scripting][warning]-You dealt: 1.6743704204155438e+30 to a
wym by name the actual naem of entity or the id?
chicken and warden
i mean by id is minecraft:warden
eithers fine
world.afterEvents.entityHurt.subscribe(data => {
console.warn('You dealt: ' + data.damage + ` to a` + data.hurtEntity.typeId)
})```
it worked thanks for your help
Anyone knows how much does System run affects to performance?
And if theres a way to optimize it
run or runInterval doesn't affect the performance, what you are doing or how you using it does
Alr
Thanks!
Can we still not detect whether an itemStack has custom components?
Correct.
😔 guess I'll just give them all item tags
damn I'm really just reliving all of the problems I already had whenever I try to mess with something after taking a break
world.sendMessage(`hasTag:${eventData.itemStack.hasTag("grimy")}`)
world.sendMessage(`getTags:${JSON.stringify(eventData.itemStack.getTags())}`)```
funny times
and as I remember, you have to specify an identifier in the itemStack's tag for it to be recognizable with HasTag
such a weird quirk
blame good games
so you're saying MINECRAFT IS BAD?
I hardly play Minecraft
tho Minecraft is a sandbox game can't blame you
my year in review had nearly 10x the amount of time spent in preview than stable
What games do you mostly play?
I play marvel rivals and rdr2
-# yes, I still play rdr2
Is it possible to deop a player using script api
Yes:
player.deOp()
I think
wait no
it's
player.setOp(false)
I think
Would dynamic properties be the best database system for mass quantities of data?
Yes- just note string properties have a limit of 32767 characters
ran my pack and got an error, ive got no idea what it means tho?
[Scripting][error]-Plugin [§l§3Scripting_Pack_V! - 1.0.3] - [index.js] ran with error: [ReferenceError: Module [minecraft/server.js] not found. Native module error or file not found.]
also because world.afterEvents.playerBreakBlock.subscribe(function(data) {
is a thing is world.beforeEvents.playerBreakBlock.subscribe(function(data) {
import { world } from "minecraft/server"
oh no @
Yea
sorry
Nvm
Can someone remind me how you set nameTag for an item with lang file %?
I dont think its possible, it only takes strings
guess I need to get fancy
damn, I can't even read the items name
Oh thats fine i plan on chunking the data but thats means i can raise my chunk sizes
How do you apply knockback just enough so that you get a 'pull upward' effect ?
is this error related to script api or json ui
Json UI
Anyone Master in javaScript, css and json.UI here I have a question if you gonna translate the
{
"binding_type": "view",
"source_property_name": "((#title_text - 'Custom Form') = #title_text)",
"target_property_name": "#visible"
}
In the JavaScript code Do you think it's like if else statement
that's a c++ type thing I think?
it would sort of be like this (if it was a class or something)
this.visible = !this.title_text.includes('Custom Form')
actually
Rate my code guys I make it more readble and understandable
My addon name is better level mechanic
I think I'm the only one here using only mobile Android phone for coding and making add-on
Nu uh... Me too
How's my code
I did too, few months ago
I mean does it work?
Yes.
Then it's okay... If it works then it works
And format it pls... My demon side is waking up
Your code can be simplified
I see this in hive server where a chest Open without clicking it instead just holding a item how is that happen anyone have the file code
Prehistoric beasts fight in Far Cry Primal.
If you enjoyed this video, be sure to subscribe and watch my other NPC / AI battle videos!
Follow me on Social Media:
https://facebook.com/wisebattles
https://twitter.com/wisebattles
https://www.instagram.com/wisebattles
Music Thanks to:
Far Cry Primal Original Soundtrack
minecraft mobs in future
One thing to keep in mind, though not necessarily a requirement, is the potential impact of destructuring event objects. If you intend to modify the properties or structure of the original object directly, destructuring can be problematic. This is because the newly created variables are separate from the original object and cannot be used to make changes to it.
No accurate way I guess? You can detect after events of interaction but the chess you need to check more since the chest can be interacted without actually being opened... For example there's a block blocking the top of the chest.
inventory?
I don't think so....
hi
ive made this script that flag u when u have speed but when i go -x, -z the script ignore me how can i fix?
Minecraft.system.runInterval(() => {
[...world.getPlayers()].forEach(player => {
const playerVelocity = player.getVelocity();
console.warn(playerVelocity.x)
if(playerVelocity.x < -0.390 || playerVelocity.z < -0.390 && !player.isJumping) {
world.sendMessage('§4velocity flag' + playerVelocity.x)
}
})
}, );
if(Math.abs(playerVelocity.x) != 0 || Math.abs(playerVelocity.z) != 0 && !player.isJumping) {
world.sendMessage('§4velocity flag' + playerVelocity.x)
}
thx
wait how this work and mine not?
You are comparing the velocity vector, not the velocity. The vector can be negative, so you need to use Math.abs() to find out the speed
oh okay
please help my manifest not work
{
"format_version": 2,
"header": {
"name": "ElysiumMinage",
"description": "ElysiumMinage Script Pack",
"uuid": "7983f147-4ba9-4b0e-81b6-08202c43b8b1",
"version": [1, 0, 0],
"min_engine_version": [1, 20, 0]
},
"metadata": {
"authors": ["shadowbubble"],
"generated_with": {
"blockbench_item_wizard": ["1.1.0"],
"blockbench_block_wizard": ["1.2.2"]
}
},
"modules": [
{
"type": "script",
"entry": "scripts/main.js",
"uuid": "072153b0-0716-43a7-9ebe-1118953fe17e",
"version": [0, 1, 0]
}
],
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.17.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.4.0-beta"
}
]
}
in the modules on the script add "language": "javascript"
How can i detect if a player has a effect and the level of the effect
const effect = Entity.getEffect('<name>');
effect.amplifier;
effect.duration;```
Uhhh thx to everyone
just add it in there?
okay its good
Why does itemStack.getLore() not return a string??
@dim tusk
But it returns a function for me 😭
show your code
My scripty senses are tingling!
What are u doin? If you are doing const lore = item.getLore() then i am here to break to you, it return an ARRAY of STRINGS not a STRING.
The correct way to do this (if you want the first element in that lore [first line]) then do: const lore = item?.getLore()[0];, btw the added ? Is to make sure item is not undefined when accessing so it doesn't throw an error :)
JSON.stringify()?
it's an array not a normal string
^
Also hey coddy
I finally finished the indexedDB and the image encoding and decoding and the navbar and everything!
that's nice.
By encoding i meant turning it into a base64 version after the user cozyly decides what part of their image they want an avatar then i fetch the image, centerize it, keep only what they see and nothing less and nothing more, compress it into jpeg with lost .1 of it's original quality becuz base64 versions of images are roughly 30% larger then the original image (not 30, more like 33.73083, ofc depends) and then sends the encoded version to backend!
Basically the backend part is the most easiest part of the website, front end is so fking complex and just making everything user friendly and secure and great and legal is so hard!
How about the quality of the image?
i aint been coding for like the past like year, where can i find newest manifest and everything i need to hop back on, tryna start from scratch
It's handled by the browser. You can't expect me to actually fking edit the quality manually frfr
Use jayly's bot
Or read through ms documentation
(It will have latest types)
{
"format_version": 2,
"header": {
"name": "",
"description": "",
"uuid": "",
"version": [0, 0, 1],
"min_engine_version": [1, 21, 60]
},
"modules": [
{
"description": "behavior",
"version": [0, 0, 1],
"uuid": "",
"type": "script",
"language": "javascript",
"entry": "scripts/main.js"
}
],
"dependencies": [
{
"description": "server",
"module_name": "@minecraft/server",
"version": "1.18.0-beta"
},
{
"description": "server-ui",
"module_name": "@minecraft/server-ui",
"version": "1.4.0-beta"
},
{
"description": "debug-utilities",
"module_name": "@minecraft/debug-utilities",
"version": "1.0.0-beta"
},
{
"description": "resource",
"uuid": "",
"version": [0, 0, 1]
}
]
}```
here's a manifest
u saint
Nothing really changed much
any huge advancements added?
like is hitEnitity a beforeEvent now
ik people been waiting on that for a while
none
Nah
we can detect WASD now even if the movement is disabled same goes to jump and sneak
damn
ooo
thats huge
quick thing whats the command to download all the packages or wtv
it's still beta btw.
thas chill
npm i @minecraft/server
ty
For reference I am literally playing with my self to check how chess works and if mine matches to the actual one 😭