#Script API General
1 messages · Page 35 of 1
animation and scale the root boon to 0
It seems to me that there will still be fire
not sure about that one
You could extinguish the entity depending on what you're doing it for
world.afterEvents.projectileHitEntity.subscribe(({ getEntityHit }) => console.log(getEntityHit()))
Native function [ProjectileHitEntityAfterEvent::getEntityHit] object bound to prototype does not exist. at <anonymous> (Main.js)
is this again BDS fault?
event => event.getEntityHit()
You have to do this otherwise the reference will disappear
Destructuring is sensitive in this environment.
(atleast i think i have)
Idk... like why do gangsters love taking dr#gs? They harm themselves, why do they do it???
well its ok tbh idc if theres fire that much
ill try soon
is there a way to check for enchantments on items that are incompatible with it
i have infinity enchantment on an ender pearl and would like to detect
enchantments component doesn't work
uh, what should i use to make this:
onTick: t => {
const entities = t.block.dimension.getEntities({ location: t.block.center(), maxDistance: 3 });
for (const entity of entities) {
if (entity) world.sendMessage('entityFound')
else world.sendMessage('noEntity')
}
}```undetect entities, like when the block doesn't have entities around it, it will run a function or something, bec this one ↑ isn't working, for some reason.
I choked when I read that LOL
if (entities.length == 0) {
// code
}```
function enchantItemFunc(player, ench) {
let mainHand = player.getComponent('equippable').getEquipment(EquipmentSlot.Mainhand), enchComp = mainHand.getComponent('enchantable');
if (enchComp) {
let lvl = enchComp.hasEnchantment(e.type), id = ench.type.id;
if (lvl == ench.type.maxLevel || lvl >= ench.level) return function(){player.sendMessage(`§g[§6§lServer§r§g] §cEnchantment §7${normalizeTypeId(id)}§c Already At Maximum Level!`); playSound(player, 'random.bassattack');}();
try {
if (enchComp.canAddEnchantment(ench)) {
enchComp.addEnchantment(ench);
player.getComponent('equippable').setEquipment(EquipmentSlot.Mainhand, mainHand);
playSound(player, 'beacon.power');
player.sendMessage(`§g[§6§lServer§r§g] §aSuccessfully Added The Enchantment §5${normalizeTypeId(id)} §3${ench.level}`);
}
} catch (e) {
playSound(player, 'random.bassattack');
player.sendMessage(`§g[§6§lServer§r§g] §cEnchantment §7${normalizeTypeId(id)} §cAlready At Maximum Level!`);
}
}
}
And just remove normalizeTypeId or do this:
function normalizeTypeId(id) {
let configuredID = id.includes(':') ? null : 'e:'+id;
return configuredID.split(':')[1].map((word) => word.charAt(0).toUpperCase() + word.substring(1));
}
Edited code snippet, use the new one, thanks!
😱 Are You A... GANGSTER?!!!!
i found a interesting bug
when i add nausea using Script API there is no visual effect
but when i add using commands the effect is present
oh no nevermind
🤦
i need to make it way longer than 60 ticks
why is team not lined up w the other entries
/**
*
* @param {Player} player
* @returns
*/
function displayStats_lite(player) {
let timers = [];
if (player.getDynamicProperty("spawntag") > 0) {
timers.push(` §c§lSpawn Tag§r§7: §c${secondsToMinutesAndSeconds(player.getDynamicProperty("spawntag"))}\n`);
}
let team = FindPlayerTeam(player.name)
if (team != null) {
let teams = JSON.parse(world.getDynamicProperty("teams")) || {};
let req = Object.entries(teams).find(([teamName]) => teamName?.toLowerCase() === team?.toLowerCase())?.[1];
let online = 0;
let leader = world.getPlayers({ name: req.leader })[0];
if (leader) online++;
req.members.map(captain => {if (player) online++});
req.captains.map(captain => {if (player) online++});
timers.push(`\n`)
timers.push(` §6§lTeam§r§7: §e${team}\n`)
if (req.hq.slice(0, 3).every(value => value === 0)) {
timers.push(` §6§lHQ§r§7: §eNot Set\n`)
}
else {
timers.push(` §6§lHQ§r§7: §e${req.hq[0]}\n`)
}
timers.push(` §6§lDTR§r§7: §e${req.dtr}\n`)
timers.push(` §6§lOnline§r§7: §e${online}\n`)
}
let stats = [];
if (timers.length !== 0) {
stats = [timers.join('')];
} else {
return 0;
}
if (stats[0].endsWith('\n')) {
stats[0] = stats[0].slice(0, -1);
}
return stats.join('\n');
}
o i fixed it
i had to add §r to the last line cos it ended in bold
is there a way to prevent ppl from using pressure plates in certain locations
i need them to be disablee for enemies in faction claims
I think there is an event but lemme try to get it if it does exist
It's for afterEvent so you can't cancel but here
Documentation for Script API - v1.21.43
Documentation for Script API - v1.21.43
oh this is helpful af tho
maybe i can temporarily clear the pressure plate
No it's after it's used.
temporarily clear = replace it with another block like air
is what i meant
i know it wont like
disable the initial ignition
Yes I know, but the event fires after you do step.
but it doesn’t matter in my case tbh
yes
Alright then
but its ok cos you’ll only be able to use pressure plates to toggle doors and stuff
Good evening.
tnt is disabled
good evening
anyone have an inv to build a realm or mc realm hub dm me it please 🙏🏼
How do dynamic properties work?
They save data to an entity, the world, or an unstackable item
will this data be saved for the next time player rejoins if i set player a property?
Yes, it will. It's like scoreboards.
? is it these properties which it changes?
Those are entity properties, not dynamic properties
i think i understand
Dynamic properties are exclusing to script API
getDynamicProperty() is the method to get it
thanks alot
h,m
how can i
const entities = block?.dimension.getEntities;
to use different { maxDistance } on it
like when the script spots entities at distance 16 it will do something
but when the script spots entities at distance 8 it will do another something
just like
if (entities({ maxDistance: 16 }).length !== 0) { ,,, }
if (entities({ maxDistance: 8 }).length !== 0) { ,,, }
??
na thats stupid ^
kinda
Its possible to make custom ropes?
most methods are unbound,
U can do
const entities = arg => block?.dimension.getEntities({ ...block, ...arg})
``````js
entities({maxDistance: 16})
entities({maxDistance: 8}).length
entities({maxDistance: 4}).length
block's location gets distributed in the query as an anchor for the following properties like maxDistance
I think it's bad form to use the spread operator on an object from the API (block) like that unless you need all the properties. It's slow, not to mention it's a little confusing to anyone reading the code.
Edit: Actually nevermind, I was wrong about the performance, I thought it would enumerate the accessor properties but apparently it doesn't. Interestingly the block's location property (or any other property for that matter since they're all accessors) doesn't actually get taken from the spread ... operator, {...block} is just a Vector3 because of the block's only 3 properties that are primitives are the x y and z properties.
Few updates ago, query parameter started accepting anything.
And from the input, it only reads properties like location, maxDistance, type, and any EntityQueryOptions properties
object & function are only types I've tried so far
Right, adding extra properties won't make it crash, but I'm saying this method doesn't work. I just tried it, {...block} doesn't have a location property so the getEntities call will be centered at {x:0,y:0,z:0}. Try printing the value of JSON.stringify({...block}), it only has {x,y,z} values because those are the only data properties on Block
hey, im new to this but is there any way to detect an item aux inside an entity inventory?
Mmm noo
Dimensions
That is not a question.
You cant create dimensions, it says its a private constructor
I know but I don't understand why this site has the "new Dimension()" script above
Its not the official one soo
Creator mistakes 🤷♀️
Not all classes has public constructors
On YouTube there is a Peruvian Youtuber who created a dimension that no one else can do, that is JhondPrincss.
You can make custom dimensions teleporting far away the players to your pre made area or biome
that youtuber is also posting fake content
►Minecraft PE (Pagina) : https://MinecraftPERevolution.blogspot.com (Mods,Addons & Mas!)
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
►Como Instalar Mods: https://youtu.be/95HnQCCOgyc
►Como Instalar RTX (Android): https://youtu.be/fpO2v1nRHbo
►Morph Mod : https://youtu.be/sEf1Vd75nU4
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
--- Conectate con mígo! ---
● Twitter - h...
it's just java with stitched pocket edition UI on top
His Android phone is Rooted so he can create whatever he likes with Minecraft Pocket Edition
that's simply not how that works
Thats not how it works...
you can get java edition on Android through an unofficial app, but it does not have the same style controls
If there is a way, it will be a lot of information about it
How can we check the days played of the world?
You've been clickbaited so hard...
that's literally java

1.24.0?🤨
He's just from the future
Fr
They also speak out some point in the video "you must die to access this minecraft version!"
(Jk don't do it)
uh, is it possible to make it detect entities in circles distance, not box?
also i prefer using X Y Z bec max Y is 8 not 16
max X = 16
max Y = 8
max Z = 16
if i use maxDistance: 16 it will detect entities in 16 × 16 × 16 box
for a better result:
making the script detect how far is that entity, if it was ( 16 - 9 ) blocks far it will run a function
if it was ( 8 - 5 ) blocks far it will run another function, etc
I really wanna know what you are tryna do
Cuz you've been asking how to use just one api method to check at different values.
I'm just curious
i want to make my entity detect all types of entities around it by 16 × 8 × 16 area
each distance will have its own functions, entities in distance between 16 and 8 will be detected and run a function, entities in distance between 4 and 8 will have its own function
just like having 3 or 4 maxDistances, first one is 16, second one is 8, third one is 4, last one is 2
that's just simple math
trying to explain^
you grab all the entites in the max size bounding box, then iterate and test their distances
just like
const large = 16;
const mid = 8;
const small = 4;
const tiny = 2;```entities in large distances will have their own function, entities in mid distance will have their own function, etc
max Y is 8 not 16, i dont wanna make it detects entities in 16 × 16 × 16 area.
uh, how exactly?
||I'll be back in 30m||
In mathematics, the Euclidean distance between two points in Euclidean space is the length of the line segment between them. It can be calculated from the Cartesian coordinates of the points using the Pythagorean theorem, and therefore is occasionally called the Pythagorean distance.
These names come from the ancient Greek mathematicians Euclid ...
x, y, z, typeId are static so they're the only JSON.stringifyable
Have u tried the whole function tho...
how could that be useful?
Using math, to get the distance from entity and block.center()
i have no idea how math is mathing
for (let x = playerX - radius; x <= playerX + radius; x++) {
for (let y = playerY - radius; y <= playerY + radius; y++) {
for (let z = playerZ - radius; z <= playerZ + radius; z++) {
const block = player.dimension.getBlock({ x: x, y: y, z: z })```should i do something similar to this?
Uhm, no
knew it
bro what
const center = block.center()
for (const e of entities({maxDistance: 16})) {
const loc = e.location
const dist = Math.hypot(loc.x - center.x, loc.y - center.y, loc.z - center.z)
} ```
Something like that,
i dont have getBlock thing in my interval,
hmm,
if (dist <= 16) { ,,, }; if (dist <= 8} { ,,, };?
if (dist <= 2) {}
else if (dist <= 4) {}
else if (dist <=8) {}
no else is needed in my system,
As long as there's 'return' in there, sure
I made a player.runcommand in the script but I want the entity to be summoned directly Infront of me facing cause if I use summon mz:custom_entity ^^^2 facing @s it will depend when the players camera is stable
Are there ways to achieve this?
import { world } from '@minecraft/server';
world.beforeEvents.chatSend.subscribe((event) => {
const player = event.sender;
const rotation = player.getRotation(); // Get player's pitch (x) and yaw (y)
const location = player.location; // Get player's current position
// Convert yaw to radians (for direction calculation)
const yawRadians = (rotation.y * Math.PI) / 180;
// Calculate the position 2 blocks in front of the player
const x = location.x + Math.sin(yawRadians) * 2;
const z = location.z + Math.cos(yawRadians) * 2;
const y = location.y; // Same height as the player
// Run the summon command at the calculated position facing the player
system.run(() => {
player.runCommand(`summon mz:custom_entity ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);
});
});
I just used the chatSend event for the example. Use whatever you like on getting the player object. Haven't tested it - on mobile at the moment.
import { world, system } from "@minecraft/server";
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
player.runCommand("function movenot");
player.runCommand("scoreboard objectives add Trauma dummy");
player.runCommand("scoreboard players add @s Trauma 10");
player.runCommand("scoreboard objectives add Days dummy");
player.runCommand("scoreboard players add @s Days 30");
player.runCommand("scoreboard objectives setdisplay sidebar Days")
};
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
player.runCommand("summon mz:smile_base ~~~")
world.scoreboard.getObjective("Days").removeParticipant(player);
}
}
})
});
I want it to add to this
Please use:
```js
// Put your code here
```
Your edit was close. Need to fix it up top where you put js
Wait
A system.runInterval inside of an event and it doesn't get cleared???? Nahhhh this guy is speedrunning getting a rift in the sky just like in the game "shades" when shadow first appears.
Done
Makes it easier to look at. Especially when you are looking at it from a mobile device lol.
Now instead of it being intentional (the order of assassins opened it) nah he'd just do it causally without knowing
Yeah same haha
Dude, are you kidding me? we write you code that contains API methods instead of commands
I achieved my goals with the script API you helped me with
And why did you put the system.runInterval outside the event so it doesn't create a memory leak bruhhhh
But why are you still using commands
Its easy and it works
Lol, we put it in the right place. For some reason he did it like that
Yeah I thought you were mocking at first so I added to it but then you edited to show frustration
You made a very serious mistake by putting runInterval in the event
Yes, it’s just that for now I know English too poorly to write it myself, but I can notice the translator’s mistakes
Here you go. Once again, not tested, and on mobile. But try it out. I also removed runInterval as it is not needed since you are using an after event.
import { world } from "@minecraft/server";
// Handle player spawn events
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
// Initial setup for the player
player.runCommand("function movenot");
player.runCommand("scoreboard objectives add Trauma dummy");
player.runCommand("scoreboard players add @s Trauma 10");
player.runCommand("scoreboard objectives add Days dummy");
player.runCommand("scoreboard players add @s Days 30");
player.runCommand("scoreboard objectives setdisplay sidebar Days");
}
// Check if the player's "Days" score is 0
const daysObjective = world.scoreboard.getObjective("Days");
const daysScore = daysObjective.getScore(player);
if (daysScore <= 0) {
// Spawn the entity in front of the player
const rotation = player.getRotation();
const location = player.location;
const yawRadians = (rotation.y * Math.PI) / 180;
const x = location.x + Math.sin(yawRadians) * 2;
const z = location.z + Math.cos(yawRadians) * 2;
const y = location.y;
// Execute the commands when "Days" score reaches 0
player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
player.runCommand(`summon mz:smile_base ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);
// Remove the player from the "Days" scoreboard
daysObjective.removeParticipant(player);
}
});
Because you need to know what you are writing. Each time the player logs in, a new interval is started.
🌟 M E M O R Y L E A K 🌟
His example wouldn't cause a memory leak.
Really?
Yup
Yeah that's the problem I encountered but I was thinking to fix it after I finished the full gameplay mechanics of the addon I'm making it's actually a horror addon called smile
It could cause a leak if they added a delay and that delay overlapped.
wrong code. The event that triggers when reaching 0 points should be called immediately, and not when the player appears again
I mean for one player sure, but the more players join the more intervals will be made and eventually performance issues before ultimately crashing
You might not have encountered this problem if you had not touched the correct code
It's executing in a single tick. There are 20 ticks in a second. Would need a serious hang for a leak, and if that happened, you probably already crashed from a bigger issue.
Use the code we gave you before
.
Hang occurs around ~10,000ms or ~1,000ms idk I don't remember. Last time I crashed was like a year or two ago.
So yes it's hard to crash
But still why?
Just make sure you're totally in the clear
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
player.runCommand("function movenot");
world.scoreboard.addObjective('Trauma', null);
world.scoreboard.addObjective('Days', null);
world.scoreboard.getObjective('Trauma').addScore(player, 10);
world.scoreboard.getObjective('Days').addScore(player, 30);
}
});
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
player.sendMessage("Time over")
world.scoreboard.getObjective("Days").removeParticipant(player)
}
}
})
So in the player.sendmessage part I can run a command there
You can do whatever you want there
player.sendMessage() -> player.runCommand()
Boom
Or just add player.runCommand()
After the player.sendMessage()
Or before it
Incredible. How did you come up with this?
Yap town (I'm high) wooooooohooooo
Sorry I just slept 4am and woke up 8am
All my coffee supplies ran out and yeah I'm on 0% energy
import { world } from "@minecraft/server";
// Handle player spawn events
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
// Initial setup for the player
player.runCommand("function movenot");
player.runCommand("scoreboard objectives add Trauma dummy");
player.runCommand("scoreboard players add @s Trauma 10");
player.runCommand("scoreboard objectives add Days dummy");
player.runCommand("scoreboard players add @s Days 30");
player.runCommand("scoreboard objectives setdisplay sidebar Days");
}
// Check if the player's "Days" score is 0
const daysObjective = world.scoreboard.getObjective("Days");
const daysScore = daysObjective.getScore(player);
if (daysScore <= 0) {
// Spawn the entity in front of the player
const rotation = player.getRotation();
const location = player.location;
const yawRadians = (rotation.y * Math.PI) / 180;
const x = location.x + Math.sin(yawRadians) * 2;
const z = location.z + Math.cos(yawRadians) * 2;
const y = location.y;
// Execute the commands when "Days" score reaches 0
player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
player.runCommand(`summon mz:smile_base ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);
// Remove the player from the "Days" scoreboard
daysObjective.removeParticipant(player);
}
});
So will just write all the variables in this code to the original so that the summoning command will work
Drink tea
import { world, system } from "@minecraft/server";
// Interval handle to track the interval
let intervalHandle = null;
// Monitor "Days" score for all players
function monitorPlayerScores() {
for (let player of world.getAllPlayers()) {
const daysObjective = world.scoreboard.getObjective("Days");
const daysScore = daysObjective.getScore(player);
if (daysScore <= 0) {
// Spawn the entity in front of the player
const rotation = player.getRotation();
const location = player.location;
const yawRadians = (rotation.y * Math.PI) / 180;
const x = location.x + Math.sin(yawRadians) * 2;
const z = location.z + Math.cos(yawRadians) * 2;
const y = location.y;
// Execute the commands when "Days" score reaches 0
player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
player.runCommand(`summon mz:smile_base ${x} ${y} ${z} facing ${location.x} ${location.y} ${location.z}`);
// Remove the player from the "Days" scoreboard
daysObjective.removeParticipant(player);
}
}
}
// Player spawn logic
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
// Initial setup for the player
player.runCommand("function movenot");
player.runCommand("scoreboard objectives add Trauma dummy");
player.runCommand("scoreboard players add @s Trauma 10");
player.runCommand("scoreboard objectives add Days dummy");
player.runCommand("scoreboard players add @s Days 30");
player.runCommand("scoreboard objectives setdisplay sidebar Days");
}
// Ensure the interval is only started once
if (!intervalHandle) {
intervalHandle = system.runInterval(() => monitorPlayerScores());
}
});
I already drank like 3 cups and I can barely even focus
So... Come on, no hasty codes for 1000 lines.
What do you need to do when you reach 0 points?
So after looking closer @ruby haven I noticed that your runInterval was needed. @warm mason it's updated but a condition is added to make sure the runInterval is only started once, and with each initial spawn it will check to start it again "assuming" the last one disappears.
I want to summon the boss in front of me facing me cause there is a spawning animation for it
No use. you can just take it out of the event
Somebody help me https://discord.com/channels/523663022053392405/1308025469894918171
You could, but as the other person mentioned it starts a new runInterval each time someone spawns. Which means you build up a queue.
I only want the script to works once not like every time the player reenters the game it will always run
I misunderstood earlier.
Nope that's to the system.runInterval in the event
Not when u get outta the event
The interval is needed in order to monitor the days.
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
player.runCommand("function movenot");
world.scoreboard.addObjective('Trauma', null);
world.scoreboard.addObjective('Days', null);
world.scoreboard.getObjective('Trauma').addScore(player, 10);
world.scoreboard.getObjective('Days').addScore(player, 30);
}
});
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
let view = player.getViewDirection()
let entity = player.dimension.spawnEntity("boss:id", {
x: player.location.x + view.x*6,
y: player.location.y + view.y,
z: player.location.z + view.z*6
})
entity.teleport(entity.location, { facingLocation: player.location })
world.scoreboard.getObjective("Days").removeParticipant(player)
}
}
})```
How are you calling and executing the runInterval method?
It is literally called by itself
@ruby haven
It's a fricking interval
Not a function
Chill bro, it depends on how you call the script. Otherwise runInterval() isn't called and executed. It's a legitimate question.
💀
I'm about to flex on some new developers. Trying to remain humble.
runInterval is simply separate from the player spawn event
Nah you're testing my IQ while I'm on 0%
Where can I put the identifier of my entity
I'm actually like dead inside rn. I seriously can't think straight.
You should learn js and API better.
I'm just gonna go sleep
Good day ig?
Like good night for day time
Yeah I just know the basic stuff like doing something after events something like that or before events
I can run any command here without worrying lags right?
Thanks again bro
it's not a memory leak, it's just bad coding
a memory leak happens when memory isn't properly deallocated
anyway, in this case memory wouldn't be the issue, the performance time would be
it can count as memory leak sense he is keeping hold of variables that are not cleaned up
the variables count go up over time, and that is a memory leak
let et
let startTime = 0
let initTime = 0
let projectileType = "minecraft:snowball"
world.afterEvents.entitySpawn.subscribe(({ entity }) => {
if (entity.typeId == projectileType) {
//NEED TO ADD TIMER
}
});
const velocity = 0.5;
export const faceVelocity = {
west: {
x: -1,
y: 1,
z: 1
},
east: {
x: -1,
y: 1,
z: 1
},
up: {
x: 1,
y: -1,
z: 1
},
down: {
x: 1,
y: -1,
z: 1
},
north: {
x: 1,
y: 1,
z: -1
},
south: {
x: 1,
y: 1,
z: -1
}
}
const offset = 0.5;
export const faceOffset = {
west: {
x: -offset,
y: 0,
z: 0
},
east: {
x: offset,
y: 0,
z: 0
},
up: {
x: 0,
y: offset,
z: 0
},
down: {
x: 0,
y: -offset,
z: 0
},
north: {
x: 0,
y: 0,
z: -offset
},
south: {
x: 0,
y: 0,
z: offset
}
}
world.afterEvents.projectileHitBlock.subscribe((data) => {
let { projectile, hitVector, location } = data;
const blockHit = data.getBlockHit();
let bounceVocity = ((Date.now() - initTime) * 0.000775 + startTime)
const multiply = faceVelocity[blockHit.face];
startTime = 0
const add = faceOffset[blockHit.face];
const newProj = projectile.dimension.spawnEntity(projectile.typeId, new Vector(location.x + add.x, location.y + add.y, location.z + add.z))
newProj.applyImpulse({
x: hitVector.x * multiply.x * velocity, y: hitVector.y * multiply.y * velocity, z: hitVector.z * multiply.z * velocity
});
console.warn(Date.now() - initTime)
console.warn(bounceVocity)
projectile.kill();
});
Is there anything outdated? Ig the event name is..
.
Thx
I tried this code and it keeps running when I reenter the game so I tried creating a global variable called
let firstSpawn = true;
And then after the player spawns I changed its value to false but the functions still runs I don't know the problem
Try the code I give
I tried but it still keeps running
This one this is the code you gave to me we had to change something cause I want to spawn a boss that is facing me
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
player.runCommand("function movenot");
world.scoreboard.addObjective('Trauma', null);
world.scoreboard.addObjective('Days', null);
if (world.scoreboard.getObjective("Days").getScore(player) != undefined) return
world.scoreboard.getObjective('Trauma').addScore(player, 10);
world.scoreboard.getObjective('Days').addScore(player, 30);
}
});
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
let view = player.getViewDirection()
let entity = player.dimension.spawnEntity("boss:id", {
x: player.location.x + view.x*6,
y: player.location.y + view.y,
z: player.location.z + view.z*6
})
entity.teleport(entity.location, { facingLocation: player.location })
world.scoreboard.getObjective("Days").removeParticipant(player)
}
}
})```
I just tried it but it still keeps running when I reenter the game I don't why it keeps running the functions even though it is checking if it is the firstime spawning into the world also it has this error in the main.js 17
Can I ask the link for documentation for creating custom block component
is there a vanilla anim for that
like a way to change the scale
ive never worked with anims
Just a little question, if event.face is for the side of the block that was interacted for example the "up" side of the block?
Correct.
Ohh thanks
what the npm commands do again? , i forgor
lets you install node packages using node package manager
import { world, system, Scoreboard, ScoreboardObjective } from "@minecraft/server";
const getObjective = (o, d) => world.scoreboard.getObjective(o) ?? world.scoreboard.addObjective(o, d)
const Days = getObjective("Days", null)
const Trauma = getObjective("Trauma", null)
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (initialSpawn) {
player.runCommand("function movenot")
if (Days.hasParticipant(player)) return
Days.addScore(player, 30)
Trauma.addScore(player, 10)
}
});
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (Days.getScore(player) <= 0) {
let view = player.getViewDirection()
let entity = player.dimension.spawnEntity("boss:id", {
x: player.location.x + view.x * 6,
y: player.location.y + view.y,
z: player.location.z + view.z * 6
})
entity.teleport(entity.location, { facingLocation: player.getHeadLocation() })
Days.removeParticipant(player)
}
}
});
like python pip equivalent on node.js
and how does it helps me in making addons? or it doesn't and i just misunderstood smth
Installation for @minecraft/server
Latest API module install:
npm i @minecraft/[email protected]
Beta API module install:
npm i @minecraft/[email protected]
Preview API module install:
npm i @minecraft/[email protected]
Preview Beta API module install:
npm i @minecraft/[email protected]
if you mean these i just sent u can use these packages to get autofills for stuff n all the classes
so you dont need to constantly check the docs for everything like return types
oooo thanks you so much\
do i have to do download all of the previous version or i can just download the latest version
@remarks tells you what it does, @param identifier explains the use of a specific parameter (in this case, identifier), @param identifier explains the use of a specific parameter (in this case, value) @throws tells you if the function can or can not throw errors
no definitely not
ur only supposed to download the package suitable for ur current use case
oh i see
if you're on the latest stable version (1.21.44) you'll wanna install npm i @minecraft/[email protected] or npm i @minecraft/[email protected]
oh ok
just check which ones you're using in your manifest file to choose
thanks again for the help
ur welcome
yep i have been learning about the script api for the past like 4 months now, but now i won't have to look at the docs as much as i am used to
Does this run like one time only cause the in the original code it keeps running whenever I'm reentering the game
it will run for each player whenever they join the world
What if they leave and join again?
based on the .playerSpawn part idk if theres any more to it i didnt check original post
will also run
yeah... after several trials you'll understand every line of the code
if you want to prevent that u should, for example, add a tag to identify whether or not a player has been in the world before
like playerSpawn -> check if has tag "oldplayer" if not run the code, then add tag "oldplayer"
yo, uh.
system.runInterval(() => {
for (const player of world.getAllPlayers()) {
let slots = 0;
const inv = player.getComponent('minecraft:equippable');
const parts = ['Head', 'Chest', 'Legs', 'Feet'];
for (const part of parts) {
const eSlot = inv?.getEquipment(part);
if (!eSlot) continue;
if (myArmor[parts.indexOf(part)].includes(eSlot?.typeId)) slots++;
}
if (slots === 2) console.warn('2');
if (slots === 3) console.warn('3');
if (slots === 4) console.warn('4');
}
})```i used this method to detect if the player is wearing the full seg of armor or not, and it's kinda glitched so, is there any better way to do it?
I'm thinking of using the player.join and create a global variable called firstSpawn that has a value of true then change it afterwards that way I can avoid the repeating of the functions
You can achieve that without scripts
whats the Days objective for? why does it have to be removed after a boss:id entity spawn?
global variables will be reset if you reload ur scripts
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (!player.hasTag("oldplayer")) {
if (initialSpawn) {
player.runCommand("function movenot")
if (Days.hasParticipant(player)) return
Days.addScore(player, 30)
Trauma.addScore(player, 10)
player.addTag("oldplayer")
}
}
});
this is one simple way to achieve the checks ur looking for
i need to see if the entity is wearing those armor or not. using scripts
Yes you can achieve it
more ocntext pls
what is myArmor
array
they probably want to check for it through scripts, not everybody likes commands
example ?
const myArmor = ['minecraft:iron_helmet', 'minecraft:iron_chestplate', 'minecraft:iron_leggings', 'minecraft:iron_boots'];
Not commands but json
In the entity behavior there is an environment sensor component there you can create filters like to check if an entity is wearing a specific armor or a complete set of armor
u guys will not understand if i explain, so i have to detect the armor using scripts, nothing else
let effects = {
"bard": [
["regeneration", {
amplifier: 0
}],
["resistance", {
amplifier: 1
}],
["speed", {
amplifier: 1
}]
],
"archer": [
["jump_boost", {
amplifier: 0
}],
["resistance", {
amplifier: 1
}],
["speed", {
amplifier: 2
}]
],
"rogue": [
["jump_boost", {
amplifier: 1
}],
["speed", {
amplifier: 3
}],
["resistance", {
amplifier: 0
}],
],
"miner": [
["haste", {
amplifier: 1
}],
["speed", {
amplifier: 0
}],
["fire_resistance", {
amplifier: 0
}],
["night_vision", {
amplifier: 0
}]
]
}
system.runInterval(() => {
for (const player of world.getPlayers()) {
let helmet = player.getComponent("equippable").getEquipment("Head");
let chestplate = player.getComponent("equippable").getEquipment("Chest");
let leggings = player.getComponent("equippable").getEquipment("Legs");
let boots = player.getComponent("equippable").getEquipment("Feet");
let foundSet = false;
for (const [className, armorSet] of Object.entries(armors)) {
if (
helmet?.typeId === armorSet.helmet &&
chestplate?.typeId === armorSet.chestplate &&
leggings?.typeId === armorSet.leggings &&
boots?.typeId === armorSet.boots
) {
foundSet = true;
player.setDynamicProperty("class", className);
const classEffects = effects[className];
for (const [effectType, options] of classEffects) {
const duration = effectType == "night_vision" ? 241 : effectType == "regeneration" ? 121 : 21;
if (effectType == "regeneration" && player.getEffect("regeneration") == undefined) {
player.addEffect(effectType, duration, options);
} else if (effectType != "regeneration") {
player.addEffect(effectType, duration, options);
}
}
}
}
}
}, 20);
modify it a bit but this is how i did it
The gameplay I'm trying to achieve is after the entity spawns I will add an objective called days after the days turns to 0 I will run a command
quickly copy pasted u dont need half of this
also i cant put the armor inside a loop, gosh i cant explain it.
the armor set array is static not inside a loop
idk wym
Give me a general idea what you're trying to achieve
I'll do it myself later.,.
wait no it was the wrong
array
let armors = {
"bard": {
helmet: "minecraft:golden_helmet",
chestplate: "minecraft:golden_chestplate",
leggings: "minecraft:golden_leggings",
boots: "minecraft:golden_boots"
},
"archer": {
helmet: "minecraft:leather_helmet",
chestplate: "minecraft:leather_chestplate",
leggings: "minecraft:leather_leggings",
boots: "minecraft:leather_boots"
},
"rogue": {
helmet: "minecraft:chainmail_helmet",
chestplate: "minecraft:chainmail_chestplate",
leggings: "minecraft:chainmail_leggings",
boots: "minecraft:chainmail_boots"
},
"miner": {
helmet: "minecraft:iron_helmet",
chestplate: "minecraft:iron_chestplate",
leggings: "minecraft:iron_leggings",
boots: "minecraft:iron_boots"
}
}
i hope that explains the logic better i just noticed
for (const [className, armorSet] of Object.entries(armors)) {
if (
helmet?.typeId === armorSet.helmet &&
chestplate?.typeId === armorSet.chestplate &&
leggings?.typeId === armorSet.leggings &&
boots?.typeId === armorSet.boots
) {
In my case what about using tags
I'm gonna check if the player has a tag called spawned will that work
Hello Humans
no
make one
Hello 𝑱𝒖
give me some suggestions of radiation effects, cuz those aren't enough
lol
do custom ones
without wearing the protective armor u will get those effects, wearing the protective armor will save u from 3 of those effects ( except for poison )
like Disintegration
well, youll need something like a custom effect handler
slowness and player model distortion
and manager idk
Large = 16
Mid = 8
Small = 4
Tiny = 2
-
with-out the protective armor
Large Distances = Nausea I
Mid Distances = Fetal Poison II
Small Distance = Darkness III + Slowness I
Tiny Distances = Fetal Poison V
-
with the protective armor:
Tiny Distances = Fetal Poison II + Nausea I
lol
i imagined the player skin changing to a different one
im too lazy to do them :/
maybe in the future...
maybe
why not changing the entire player into a infected thing
nah
the green tint is a good idea
indeed
import { world, system } from "@minecraft/server";
world.afterEvents.playerSpawn.subscribe(({ player }) => {
if (!player.hasTag("spawned")) {
player.runCommand("function movenot");
world.scoreboard.addObjective('Trauma', null);
world.scoreboard.addObjective('Days', null);
world.scoreboard.getObjective('Trauma').addScore(player, 10);
world.scoreboard.getObjective('Days').addScore(player, 30);
player.runCommand("scoreboard objectives setdisplay sidebar Days")
player.addTag("spawned");
}
});
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (world.scoreboard.getObjective("Days").getScore(player) <= 0) {
player.runCommand("structure load smile ~-16.5~~-16.5 0_degrees none true");
let view = player.getViewDirection();
let entity = player.dimension.spawnEntity("mz:smile_base", {
x: player.location.x + view.x * 6,
y: player.location.y + view.y,
z: player.location.z + view.z * 6
})
entity.teleport(entity.location, { facingLocation: player.location })
world.scoreboard.getObjective("Days").removeParticipant(player)
}
}
})
Already fixed the issue for the function that keeps repeating after a player rejoins a the world but it has this error
[Scripting][error]-TypeError: cannot read property 'getScore' of undefined at <anonymous> (main.js:18)
If getObjective returns undefined, then getScore won't work. You need to check that the Days objective exists before trying to get a score—or use optional chaining and null coalescing—or create the objective in that same step.
The solution to go with depends on what behavior you want to have.
I just want the behavior to run one way ones it is activated one time there is no way to reverse it back
Then I would probably omit the scoreboard objective creation step in playerSpawn and coalesce the creation and getting together. In code, that would be:
const DaysObj = world.scoreboard.getObjective('Days') ?? world.scoreboard.addObjective('Days');
if(DaysObj.getScore(player) <= 0) {
// ...
}
Then when it tries to access that scoreboard objective, it will run the addObjective method if getObjective returns undefined.
Thanks I'll try this
Has anyone been able to place a water block through scripts that automatically flows? Cuz I used fill commands and setBlockType and the water doesn't update until a block is placed next to it.
Youll have to update it yourself.
block.setType('flowing_water')
That's a shame...
Yeah, the water block is still frozen.
Weird. Even placing flowing_water down with commands has it flow automatically
Are you using setblock or fill?
Never got this to work with setblock.
Nor world gen.
setblock
Aren't there certain features that automatically have flowing water in them?
/setblock ~~~ flowing_water works for me
They must've updated it.
Yeah it doesn't work.
Using /setblock?
Yep. The block still doesn't flow.
How does it work for me and not for you? 
Well then just set a block next to it and set that block to air then?
Randomtickspeed maybe.
Yes thats the solution everyone uses.
I'm pretty sure water uses queued ticks, so random tick speed will have no effect
I would love to see a video.
Alright then so it's not a problem right?.... ik it's a "workaround" but that works right???
New world?
I'm talking about scripts.
It's not. Want me to make a new world?
Yes.
...runCommand("setblock ~~~ flowing_water")
New world, vanilla.
Same result
Looks like they finally fixed it. Now do the same for world gen.
I'm not well-versed in world gen. Perhaps someone else
it's water that doesn't float, flowing_water does
Is it possible to do something like that,
If im right click a item the Chest UI menu will open
If i left click it to a player, so hit him with that, the menu will get open again, i take the kit i want, and than i challenged him, kf he accept we will match together
Sure
It's possible but gonna be needing an inventory management system (for saving items with enchants and lore and setting on player and clearing it), and a ui system (very basic, I'm sure you know). And of course the duel system (like randomly selecting & setting map, countdown, class removal, managing the dynamicProperties or whatever you use to set the property of players wether the duel has started or not and cancel all moves if it hasn't started).
And of course your maps and the map management system.
All seems very possible but will take a good bit of time and effort.
Most of what I mentioned is very easy to do, like inventory management system, canceling player moves if the duel hasn't started, countdown, ui system
What would be a bit harder to do is the map system, as you have two choices, either save the whole map as each block with its data and stuff (very bad approach) or use structures to save areas, and you're gonna need more than one structure if your map is bigger than a 646464 cube I believe
Now I do have to make this clear: no one will do free work for you & this server isn't a hiring place, so you're not allowed to ask others for paid worked (paying them for it). People here will help you achieve your goals. So just make the code, test it, if it fails ask for help here and learn from your mistakes.
Ehm ik that?
Alright then, you know how to make your desires. NOW GET THE F- jk jk
So what's the problem?
Be nice… even if it is a joke…
I dont have a problem, u started to tell me thst
Alright, sorry.
I asked no one for paid stuff or anything like that, i just ask for something if its possible
Dont be mad
I'm not mad
If you have a problem, than dont answer me
✨ anything is possible ✨
I also answered your question
I don't have a problem.....?
Waitttttt
You are they guy with herobrine chest UI right?
Yeah he is
In this server the best of best is just chillin'
Ambro? Yessir
Sprunkles? Yessir
Herobrine? Yessir
Others (I'm thinking of other things rn so I can't remember, but also): Yessir
Poggy
Ye, just chillin'
Think of anyone and i bet $1 they'll be chillin'
I actually I change that bet to $0....
Queen Elizabeth
She is, in fact, not chillin’
Is it intentional that when using custom block components and using onUseOn, no blocks are automatically placed anymore?
Can you try crouching? Im confused what you mean.
Quick placing blocks in a row
I assume it's because block placing is being managed completely on the server side at that point
Its also an issue if custom blocks have any custom components. Quick placing and whatever else is broken.
Crouching works, but I'm talking about placing blocks (or quick placing)
Does the block have custom components?
Yes. This only happens to blocks with custom components.
QuazChick
To Do (Open)
Unresolved
So it is a bug. That's a shame.
im tryna do player.getComponent("minecraft:health").max but its coming out as undefined anyone know the error?
when i remove the max part it comes out as object: object
.effectiveMax
istead of .max?
Is it possible to set an entities rotation before it spawns
yes
yes
do u know how i can get the current hp aswell?
currentValue
yes
How
entei?
no?
yes.
entei mc 😭
?
how?
ohhh
summon entity ~ ~ ~ ~${player.getRotation().x) ~
is this basically just facing command?
yes
well
that is not native script api method
lol
and if you want the entity reference? use getEntities?...
that just a work around
function Missions(player) {
let body = 0;
const score = getScore("missions", player);
switch (score.currentValue) {
case `0`:
body = "1"
break
}
}
depends how u want to spawn it in
switch doesn't work with score?
it does
u put it in
``
that why
its not a str
function Missions(player) {
let body = "0";
const score = getScore("missions", player);
switch (score.currentValue) {
case `0`:
body = "1"
break
}
}
and so? is this correct?
no
case 0:
0_0 i awnsered it already
oh ok
confused lol
why do you need switch for that
What's the difference between runcommandasync and runcommand?
function Missions(player) {
return getScore("missions", player)==0?1:0;
}
runcommand
it waits for the command to be done
-_- i think
idk im not good with js
im assumming runCommand slows the entire code down
Hey i dont know where to put this question but.
Does someone have a solution for leaves decaying when you don't want them to decay but you can't set randomtickspeed to 0.
Because, i have a spawn map where most decorations are made of leaves and they will decay as soon as i set randomtickspeed to something higher than 0.
I can't set randomtickspeed to 0 because that won't let farms work.
runcommandasync is asynchronous function meaning it execute in the background while your code continue runing
runcommand is the opposite it run first then allow the rest of the code to continue
Very much so
Player placed leaves don't decay, I thought?
change there state
for some reason even if i setblock them with persistent_bit to true they will decay
and also if i place them manually
-_- idk what catergory this is part of but im doing screen display when i display a subtitle then title the subtitle is deleted
these leaves are obviously placed manually
but they still decaying
so it makes no sense
Weird
and way around that?
system.runInterval(() => {
for (let player of world.getAllPlayers()) {
if (player.hasTag("logic_done")) continue;
const DaysObj = world.scoreboard.getObjective('Days') ?? world.scoreboard.addObjective('Days', null);
const daysScore = DaysObj.getScore(player);
if (daysScore <= 0) {
player.runCommand("structure load smile ~-16.5~-1~-16.5 0_degrees none true");
let view = player.getViewDirection();
let entity = player.dimension.spawnEntity("mz:smile_base", {
x: player.location.x + view.x * 6,
y: player.location.y + view.y,
z: player.location.z + view.z * 6,
});
entity.teleport(entity.location, { facingLocation: player.location });
DaysObj.removeParticipant(player);
player.addTag("logic_done");
}
}
}, 20);
Is there a better way to spawn my entity where its rotation is already set the position is already set cause the entity that I'm spawning doesn't move
setTitle(title, TitleDisplayOptions?)
TitleDisplayOptions have subtitle property
try use setRotation
In this code the entity is being teleported repeatedly right cause after the entity transforms into another entity it suddenly teleported to a random location
how i disable that part i dont want 😭
uhm... i don't know what that mean
how do i disable it reseting subtitle
save it somewhere and re-use it?
0_0 that wont do
im linking it with json ui
every time it gets reset the ui gonna start flashing
I'm going to use a lot of words, it can't be like this
export function stats_missions(player) {
let body = "0";
const form = new ui.ActionFormData();
form.title(`Mission`);
form.body(`${Missions(player, body)}`);
form.button("§0");
form.button("§0");
form.show(player).then((r) => {
if (r.selection === 0) {
stats_menu(player);
}
if (r.selection === 1) {
stats_missions(player);
}
}
);}
function Missions(player, body) {
const score = getScore("missions", player);
switch (score) {
case 0:
body = "test1"
break
case 1:
body = "test2"
break
}
}
the body is undefined
const scoreStr = {
0:"test1",
1:"test2"
}
function Missions(player) {
return scoreStr[getScore("missions", player)]
}
@winter plaza
avoid switch if it isn't needed
it is slow
ah ok
dimension.getEntities
in preview, theres a way
which events will be fired if a player in adventure mode punches a block
Documentation for @minecraft/server
why does this not work for me in survival or in adventur
Nothins triggered ig...
can it be listened for from multiple files
i have it in 4 places now
but only one does not work
nvm it does trigger
not in adventure tho like i wanted
why is this returning false
Frozen.Info([x, y, z] + "==" + [19, 67, 10])
if ([x, y, z] == [19, 67, 10])
Frozen.Info([x, y, z] + "==" + [19, 67, 10] + ": " + ([x, y, z] == [19, 67, 10]))
oh nvm chatgpt explained it to me
i forgot
prob because they are objects
it would be so cool if we can select what entity to include/exclude in a structure with the structureManager
It would be so cool to cancel entityHurt
ugh...
const inv = eEntity?.getComponent('minecraft:equippable');
let h = inv?.getEquipment('Head')?.typeId === 'minecraft:iron_helmet';
if (h) console.warn('H-on')
if (!h) console.warn('H-off')```why?
this should warn H-on only when I equip the iron helmet, it shouldn't warn H-off
why is it happening?
oh, nvm nvm
i fixed it
my bad
Bro the custom button is cool
Is that activated when wearing helmet?
Idk
I asked about this in the feedback post when the structure manager came out and my question was ignored.
combat system help
How can I do a time out that can remove player's combat tag if thier not longer has pvping
i am sure its already 200, 000th
wait a second, ill send you an example
This is my code @distant gulch
3 Heart System
All players have 3 Hearts, but you can only lose a heart if you get killed by an other player, that means, dying to mobs, fall damage or anything other, will not lose you one heart.
If you lost all 3 Hearts, you will kicked from the server and can't join it again.
Fight System
If you fight against a player and got hit by him, you are in combat. That means if you are in combat, you must escape or fight trough the end. If you get hit, a message for the player who got hit will showed, this message is a combat countdown, if you get hit the message will show up, it should look like this:
You got attacked by [player], you are now 30 seconds in combat.
In this 30 seconds you can easily lose a heart, that means if u are in the combat and fall down and die, you will lose a heart and the kill will get the player who get you in the combat. Also if you are trying to log out through the combat, if you will join back u will lose a heart.
If you are not anymore in the combat. A message will show up like that:
You are not anymore in combat, you are safe now.
But if you get hit again by a player, the combat is there again.
If a player get killed by a other player, a message for the whole server will show up like that:
[player] got killed while fighting against [player] (- 1 Heart)
Deathscreen
If you got killed by a other player, a animated Deathscreen will show up, the Deathscreen is showing a animation how ur heart get destroyed
Animated Heart
Your 3 Heart should show up between ur Hunger Bar and ur normal Hearts.
I can give example photos.
Is that possible?
yes
Can i show u a example
You can, but why?
yes
And do u think its hard
Well, for me there is nothing complicated here. I'll do something like this in 2 days
Does my manifest.json needs the module "script" when using a typescript compiler?
Thats crazy
@warm mason since you are that eager to help
It seems that you need to change the language in the script module from javascript to typescript
well
Why do you need TS?
It's much slower than JS
Atthe end it gets transpiled to machine-code so it will only effect that "speed"
right?
?
The "translation" is only less fast right?
Transpilation or Compilation
JS and TS are interpreted languages, and are run line by line each time, so the speed of JS affects this
And TS is also translated into JS, then into C++, then into assembler, and only after all this into machine code
Yes so only that initialization-time is more?
No. TS and JS are interpreted, not compiled. So the interpreter runs through their lines each time and translates them into machine code
Yes i know, sometimes i mix up Transpilation with Interpretation
Anyways, only the Transpilation takes longer on TS right?
So it wont affect the code
No, that's not true. TS is always slower than JS! Not only when loading scripts. And your budder code is about 3 times slower than JS
Well i searched it up and it says, that only the transpiling time is affected, not in use
Well then decide for yourself. I think JS is faster
Sure everyone have's their op.
Anyways~
Uh did U forget it
Can someone help me with what in a picture
i sent you private b....
Ohh sry
Amnesia? dementai? Dokutah?
Sry I thought it was here so I can't find it here then i Think U deleted it
Ik its not the channel but idk where else, can someone change the red to good nice purple tone
My bad
sure
Thankss
Cool
nvm
Yoooo mann thxx
Nah dont worry - i wasnt even beginning to do it
Maybe you or @warm mason can do one thing too for me
Can u remove the mouse cursor you can see there and change the heart to the purple like on the picture, or is it too hard
And that goofy button on the right button too
So just the blue to purple if its possible
It must be JavaScript in the manifest. Some of us use TS to write our code because we can utilize its capabilities for real time results versus runtime. However, for production we transpile it to JS.
@gentle mist
You mean for that what i want to do?
You got the wrong ping
Okay, is "entry" needed on it?
You mean "entry"? That is to let the application know where your main script is. Which will be the script that jump starts everything as needed.
Yes i know, its my first time setting it up with TS
My project is set up for a TypeScript environment. Here is what my manifest looks like. Feel free to review my repo to see how I have it done. Take a look at package.json, and tsconfig.json specifically.
https://github.com/Visual1mpact/Paradox_AntiCheat/blob/rewrite/manifest.json
Thanks :))
[Hate](#1067535608660107284 message) to [burst](#1067535608660107284 message) your [bubble](
#1067535608660107284 message), but [we've](#1067535608660107284 message) had [100k](#1067535608660107284 message) messages [for](#1067535608660107284 message) a [while](#1067535608660107284 message) now.
are there any good NBT editors on pc
NBT Studio is an NBT editing application, the spiritual successor to NBTExplorer. It has been rewritten completely from scratch to support a vast array of new features, while keeping the familiar layout of controls. New features include Bedrock support, SNBT support, undo/redo functionality, drag and drop, multiselect, and more! It's called Studio to make it sound more important than it really is.
@sterile epoch
thanks
Does Bedrock have Plugins
Ehh Does Plugins exist for Bedrock*
anyone have good github stuff thst is good for servers
Which servers?
I found a workaround with playerInteractWithBlockBeforeEvent, where the placing block event is cancelled if the right item and interactable block is used.
So now the custom slabs are fully functional without that weird placing bug.
custom servers like pocket mine
world.afterEvents.playerJoin.subscribe((event) => {
let sender = event.playerId
world.sendMessage(`§8[§2+§8]§r ${event.playerName} `)
sender.sendMessage("§8§l>> §rHome and Warp system created by LunaireI")
})
how to make a message of custom join player message, I did ca but ca does not work why?
I do not understand the error
playerId is a string (player id) not the player itself
u should probably use playerspawn instead of playerjoin
ok I undestand but, how define sender
What is the best server for bedrock
in playerspawn u can get the player in the event system
no idea sorry
its okay thanks
yes but I want send message just when player join server not when player spawn
so this solution not perfect
playerspawn is just better it gets when the player joins aswell
world.afterEvents.playerSpawn.subscribe((event)=>{
const {initialSpawn, player} = event
if(initialSpawn){
world.sendMessage(`§8[§2+§8]§r ${player.name} `)
player.sendMessage("§8§l>> §rHome and Warp system created by LunaireI")
}
})
oh Ok, thanks you
export function value_changer_menu(player) {
let all_players = mc.world.getPlayers();
const form = new ui.ModalFormData()
.title("§l§1Value Changer")
.dropdown("§l§dPlayer", ["Default"], 0)
.textField("§l§bValue to change", "", "")
.textField("§l§2New Value", "", "");
form.show(player).then(r => { //ERROR LINE (line 300)
if (r.canceled) return;
let [dropdown, droptextField1, textField2] = r.formValues;
});
};
error with this?
Any content log?
[Scripting][error]-ReferenceError: Native function [ModalFormData::show] does not have required privileges. at value_changer_menu (test/menu.js:300)
i think the problem is what im using to open the ui
not the code in it
You need to wrap it around system.run since you're running it in a beforeEvent.
You need to wrap it around system.run.
ok
That wasn't the problem, their function is not gonna run after the timeout because they forgot to put ()=> before it, and the runTimeout also fixes the required privileges issue
the problem is they are passing the output of their menu showing function to runTimeout
which will not make it wait
they need to prefix it with ()=> to make it so the function itself is passed as the argument
it should be
mc.system.runTimeout(()=>menu.value_changer_menu(player), 20)
thanks 😭 but i kinda realised
lol
i had another project which i did same thing i went back to that
and checked what i did
if you were using typescript it would have told you that was the problem
typescript makes everything wayyyy easier
it is a pain doing it in pure javascript
because you don't get those errors inside the editor
where it shows you exactly where the problem is
when using typescript, you need to build it to js and then use that in the manifest.
for example, this is my tsconfig.json:
{
"compilerOptions": {
"module": "ES2020",
"target": "ES2020",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"declaration": true,
"noImplicitAny": true,
"strict": true,
"outDir": "./packs/BP/scripts/dist",
"pretty": true
},
"exclude": ["node_modules"],
"include": ["./packs/BP/scripts/src"]
}
so I have a src folder in scripts that contains all the .ts files, and then it outputs the .js and .d.ts to the dist folder in scripts, and my manifest uses the dist folder
And here's what it would look like in the manifest:
"modules": [
{
"type": "script",
"language": "javascript",
"entry": "scripts/dist/entry.js",
"uuid": "UUID",
"version": [
1,
0,
0
]
}
],
uh how do i translate the entity name?
blueprint.setLore([
`${entity.typeId}`
]);
world.afterEvents.playerBreakBlock.subscribe((event) => {
const block = event.block;
const player = event.player;
const location = block.location;
if (block.type.id === "swmc:door1") {
const x = location.x;
const y = location.y;
const z = location.z;
dimension.runCommand(`fill ${x} ${y - 1} ${z} ${x} ${y + 1} ${z} air replace swmc:door1`);
}
});
Why wont this work?
entity.name on players and on entities & players entity.nameTag
Errors:
- Using AfterEvent, This Fires After The Block Is Broken. Which I Believe May Return Undefined But I May Be Wrong.
- Using Dimension When It Hasn't Been Defined Before.
Coding Mistakes:
- Deconstructing Using A Line For Each Property Of The Location Object
- Using Commands When Native Methods Exist.
Correct Code:
import { world, system, BlockVolume } from "@minecraft/server";
world.beforeEvents.playerBreakBlock.subscribe((event) => {
const block = event.block, player = event.player, location = block.location;
if (block.type.id === "swmc:door1") {
const {x, y, z} = block.location;
system.run(() => {
player.dimension.fillBlocks(new BlockVolume({ x: x, y: y+1, z: z }, { x: x, y: y+1, z: z }), 'minecraft:air', {blockFilter: { includeTypes: ["swmc:door1"] }});
});
}
});```
Thanks but i already know how it's wokring, i completely missunderstood it xd
playerInteractWithEntity for now triggers only if interacting was successful
what event to use to register unsuccessful interactions
beforeEvents
system.run 
okay
How can I use transferPlayer in BDS
You need level 4 permissions to execute it, last I recalled. Memory is really vague on it.
@hot gust I think you may remember this?
What are the permission levels in scripts?
Oof, having me knock some dust off the old shelf.... I can't recall.
I do know some leverage is gained by adding the following to server.properties:
op-permission-level = 4
Though, I'd admit that my memory is rusty on how far that extends.
Server permissions? Lol why
OP permissions for BDS are different than Realms, and local worlds. It's a hot mess honestly, and the devs know it already. I don't think they want to touch it because of the amount of refactoring it would take to handle it.
It's one of the reasons why the isOp method works, but doesn't. It depends on the environment and adequate level of OP permissions. Need to be at least 2 minimum so for BDS, that happens when you apply the property, making it viable to use. Realms lack it so it just simply does not work.
No, I just don’t understand why the server needs permissions.
Ah, I understand what you are saying. I concur. It's the server after all.
can we get a world tick(i mean total tick, not daily tick)
How does this work. Am I simply not allowed to call the transferPlayer() method if the server does not have that level of rights?
system.currentTick
okay
Essentially, yes.
Without permission level 4 for Operator permission, technically can't use it.
but I can simply set the level of rights higher.
What does the operator have to do with this as a player?
BDS doesn't execute with level 4 permissions.
It's plausible that the API for server-admin may be given adequate permission under the hood. I don't know what the devs intentions are on the matter.
Busy at work, but to quickly touch base with the player, you are able to execute the /transfer command in chat which will move a player where needed, respectively.
The property you set in server.properties to gain level 4 permissions for OP should technically allow you to get that player object with that permission, and use runCommand() or runCommandAsync() to call that /transfer command with adequate permission for it to execute.
In theory Not a Theory - Confirmed
This obviously will not work in a Realm. Only BDS if it worked at all.
yes you need level 4 for that command to work
this is how I was doing it
const playerObj = getPlayerByName("PlayerWhoIsAnOP");
if (playerObj) {
const command = /transfer ${player.name} XX.XX.XX.XX.XX 19132;
playerObj.sendMessage(command);
}```
wha?
Show the slots array
yah, fixed
how do i check if two itemstacks are equal
im trying to compare two inventories to each other
like all the properties n that theyre actually the same stack not just two identical-seeming ones
/**
*
* @param {ItemStack} i1
* @param {ItemStack} i2
* @returns
*/
function compareItems(i1, i2) {
Frozen.Info(`Item 1: ${JSON.stringify(i1.getLore())} | ${i1.typeId} | ${i1.nameTag ?? "undefined"} | ${i1.getComponent("durability").damage}`)
Frozen.Info(`Item 2: ${JSON.stringify(i2.getLore())} | ${i2.typeId} | ${i2.nameTag ?? "undefined"} | ${i2.getComponent("durability").damage}`)
if (i1.getLore() != i2.getLore()) return false;
if (i1.typeId != i1.typeId) return false;
if (i1.nameTag != i2.nameTag) return false;
if (i1.getComponent("durability").damage != i1.getComponent("durability").damage) return false;
return true;
}
why does it return false
The equality operator cannot compare arrays or other objects
omg i always forget
thanks
You can use my function to turn an object into a string and compare the strings
@jolly citrus
thx ill check it out
system.runInterval(()=>{
for (const player of world.getPlayers()) {
if (vectorsAreEqual(player.getVelocity(),Vec3(0,0,0))) {
let OldInventory = playerInventories.get(player.id)
let Inventory = player.getComponent("inventory").container
if (OldInventory) {
let Result = compareInventories(Inventory,OldInventory)
if (Result == false) {
world.sendMessage(`inventories were not identical`)
}
playerInventories.set(player.id,Inventory)
} else {
playerInventories.set(player.id,Inventory)
}
}
}
},40)
why is OldInventory always identical to Inventory
if i drop an item from the first slot they both get updated to this new value on the next check not just Inventory
Both are likely references to the same object. You should store a copy of the properties you want to save. Maybe by playerInventories.set(player.id, {...Inventory});?
I'm unsure if spreading the properties will work like that though
If I'm not mistaken—think of grabbing the container not as taking a snapshot of the inventory at a point in time, but grabbing an object that will dynamically be updated as the contents of the inventory change.
Naturally, then, the container you store in the map is the same as the container you have just acquired.
ye i fixed it
saved each item stack in an array instead
is it possible to clear the item a player has 'equipped' on their inventory cursor like shown in the image
No. Its read only last I checked.
#1307833431358570567 message
Well, you can still get around this
how reliable is it
?
does it always work or not
I forgot there was a clear function.
The itemstack itself is readonly.
wait how does item swapping work on mobile devices
can they swap two items between slots
in their inventory
This doesn't work at all on mobile devices
ye but on pc
It should work fine, it's already in a stable version
alright
I don't know, but I don't think your phone players will like such innovations
yeah i was going to make a click to enchant type of thing
for custom enchantment books
thx it worked very well
Depends on device, code, and other factors
True, what's the average
Depending, you can get the ram gbs from player's device information, depending on how your script is crafted it will affect the performance time, if you have system.runJob(function*(){ /* Code */ }());
And have yield; in your code, your code should work fine on all devices, but it may delay iteration so it can work fine on any device. (This is if you need long running asynchronous operations or anything performance using), depending on how big your player render chunks from the settings it may make your code lag if you're running the code on a world, caching arrays while using for...let loops makes your code run faster. Uhhh idk what else to say.
Okay nic ethanks, is system.currentTick fast to get?
Yeah
import { system } from "@minecraft/server";
import Interval from "../assets/Interval";
export default class Game {
public static init(): void {
new Interval(Game.onTick);
}
public static currentTick: number = 0;
public static onTick(): void {
this.currentTick = system.currentTick;
}
}
I declared Game.currentTick as system.currentTick every tick once so i dont need to re-get currentTick from system ( due i need currentTick in other files too )
is this smart?
or am i just dumb
.. i could just count it up by one every tick... im dumb lol
Not sure what to say but I think just accessing might be faster.. but idk just use a tps checker and use both your method & just accessing directly and see whatever is faster
well then i need to check it when my code is complete
Ill do a tower defense game and i need in 4-5 different file the current tick, and i dont want to call system.currentTick uselss 4-5 times when i can decalre in thr Game class or just do my own counter?
Honestly just do system.currentTick
you sure? okay i will
I wrote this API 2 months ago, in shortcut: much easier way to send Discord messages via webhook
do you have some suggestions what can I add to this API? (except documentation, I'm already working on website version on it)
API that allows you to send webhooks via requests in add-ons. - m0lc14kk/WebhookAPI
like some methods, classes etc. I could add to this API to provide even better experience
how can I ensure that the player can only place within a certain distance?
calculate distance between player and block, then compare it with max block reach
thanks
is there a way i can get mindistance in a similar way to getBlockFromViewDirection()?
min distance?
yeah i need minimum distance to something to work
but realized that probably not achievable without an entity
then forgot about this message
on a somewhat related note, why is this returning these numbers? im clicking right next to myself
const y1 = playerLocation.y
const z1 = playerLocation.z
const x2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.faceLocation.x
const y2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.faceLocation.y
const z2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.faceLocation.z
const difference = { x: x1 - x2, y: y1 - y2, z: z1 - z2 };
const distance = Math.sqrt(difference.x ** 2 + difference.y ** 2 + difference.z ** 2);
console.warn(distance)```
output from console log:
How do I make it so that when a block powered by redstone is close to my block it activates?
nvm i was using facelocation. supposed to use block
👍
why does this function return different values depending on where its called in the file?
const playerLocation = player.location
const x1 = playerLocation.x
const y1 = playerLocation.y
const z1 = playerLocation.z
const x2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.block.x
const y2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.block.y
const z2 = player.getBlockFromViewDirection({ includeLiquidBlocks: false, includePassableBlocks: false })?.block.z
const distance = Math.sqrt((x1-x2) ** 2 + (y1-y2) ** 2 + (z1-z2) ** 2);
return distance
}```
the first and second are each a call of the function in different places in the file, both under world.beforeEvents
still doesnt work
i tried afterEvent
what this is suppose to do is when u break a block it fills the block if the block is swmc:door1 it turns it into air
is it possible to import scripts from different addons?
does the vector3 interface seriously have no operators
tf
not even addition and subtraction
Use the math module.
do you know if there are any plans to make this possible? or maybe if theres workarounds
What are you trying to do?
I just wanted to create an addon with all the scripts I normally use so I wouldn't need to reuse & update all the files of all my projects everytime I update one of the scripts
you wanna call those scripts from other addons?
yep
you can use this https://discord.com/channels/523663022053392405/1277940040688996512
set up channel handlers on your main pack, and then you can invoke them from your other packs
hmmmmm very very cool, I have no idea what this is but I'll take a look
Ah so a library of sorts.
yup, lmk if you need any help using it
If only. the best I've achieved is custom components and that's because it doesn't really require scripts, it just needs the custom components registered.
can I ping you in case I need any help? :p
sure
thank you very much!!
there's some basic usage stuff in the readme that should help
hmm so custom component work between packs, I didn't knew that.. maybe some of my scripts could be turned into custom components
https://github.com/SmokeyStack/adk-lib shameless plug
that's only item and block events though right?
I have never really made much use of custom components but is there any way to make custom components recieve input data?
for example, on a block.json or item.json, a custom component that requires specific block or item id to be specified
and whateaver gets added as input could be used on the custom component code
What do you mean by "all the scripts I normally use"? Are you talking about helper functions and other utilities like databases?
I suggest checking out my project 🙂 .
"custom components do not have parameter support yet" thats a same :/
Yeah...but if you read further...you would know that I just use tags.
I meant everything, classes, functions, databases, maps etc
You're better creating your own "package" then bundling them.
but that would require me to add the package files to all the projects, right?
I would definitely consider another option then. The usual solution to organizing shared logic would be either a monorepo or an NPM package.
Doing this through IPC would be a nightmare, require that a second addon be installed, be harder to update and might actually be the opposite of what you want.
yeah but tags wouldn't be useful if for example I wanted to specify what block I want an item to place (dumb example)
🤷 Works for me.
I utilize tags to do lots of parameters. But then again, this might not be suited for you.
You have a differetn use case.
by requiring another addon to be installed you mean the library addon with all the scripts? because if yes thats what Im looking for
can you give me an example of the kind of parameters you use tags for, please?
You can find it in my project 🙂 .
nevermind I just saw at your project
yeah xD
hmmm
interesting
that might actually work for me
why would it be a nightmare?
For something like a database?
Because you have to serialize every function call to your shared API, send it through IPC (adding significant overhead), deserialize it on the other side (introducing an additional place for potential bugs to occur). You can't make any backwards-incompatible changes to the API, or else you break all the other add-ons that rely on it. You also have the limitation that you can't run anything synchronously.
Or instead of all that you could just bundle the scripts automatically into each of your add-ons code and just call the function normally.
There's certainly many uses for that library, but in my opinion a database is not one of them unless you need to create an add-on that facilitates communication between 2 or more other addons for something like concurrency control.
IPC already handles all serialization and deserialization, sending stuff through it doesn't add much overhead at all (unless you're sending well over 10,000 chars in which case you have other problems). newest IPC release is gonna be stable for a long time since there's not really anything that can be improved atp, and ofc it being asynchronous is expected, if they wanted an entirely synchronous database they'd use a local one, so it's up to them to decide
not really something I'd call a nightmare
dynamic property databases are also UUID linked so it might be a better idea to use one pack with IPC rather than bundling, so you can share the database between multiple packs
I need help please, the truth is I don't know why it is not repaired so to speak, my goal is that it has leather armor and it is repaired at every moment so to speak
const equipmentSlots = ["Head", "Chest", "Legs", "Feet"];
system.runInterval(() => {
const players = world.getAllPlayers();
players.forEach(player => {
const equippable = player.getComponent("equippable");
if (equippable) {
for(const slot of equipmentSlots){
const item = equippable.getEquipment(slot)
if(item && item.typeId){
if(item.typeId.startsWith("minecraft:leather_")){
const durabilidad = item.getComponent("durability")
if(item.typeId == "minecraft:leather_chestplate"){
console.warn(item.typeId)
durabilidad.damage = 10;
}
}else{console.warn("no c encuentra")}
}else {console.warn("sin item")}
}
}
});
}, 100);
use getEquipmentSlot
ok
About the returns undefined, it returns air instead.
Send your code.
world.afterEvents.playerInteractWithBlock.subscribe(({ player, itemStack, block }) => {
const item = itemStack.typeId;
const target = block.typeId;
if (item === "luna:filter_rod" && target === "minecraft:grass") {
player.runCommand('say this works');
}
});```
Am I supposed to include the block location to get this to work?
The block identifier is actually minecraft:grass_block
Oh gotcha, I changed it. Thanks for that 😉 I still can't get it to do anything though
Are you getting any log?
afterEvents when interacting with a block only fires if used successfully (for example, bone meal is used on grass). To receive all triggers use beforeEvents and system.run
Damm you already bet me to it lol
world.beforeEvents.playerInteractWithBlock.subscribe((ev) => {
const {player, itemStack:item, block} = ev
if (item.typeId === "Your item" && block.typeId === "minecraft:grass_block") {
system.run(() =>{
player.sendMessage("EYE CAN TOUCH GRASS")
})
}
});
this a better method, always use beforeEvents for interact with block
just simple and less errors the using afterEvents
less errors? better?
in what way?
@fiery solar the IPC system works amazingly, I think it will allow me and my friend @lament tree to do everything we have planned. incredibile job!
It was created by @slow walrus but it's very cool and I'm glad you found something that works for you!
@dapper viper
?
uh
is it possible to detect if a specific block is pushed by a piston?
i know i can use piston activate thing, but what if my block has been pushed by another block that has been pushed by a piston?
iirc there used to be an event for that
uh, trying to explain ^
not sure if it exists now, for pushed block i mean
[Scripting][error]-ArgumentOutOfBoundsError: Provided integer value was out of range. Value: 1732114309912, argument bounds: [0, 4294967295] at onPlayerHit (antiInterrup.js:65)
at <anonymous> (antiInterrup.js:94)
Who can help me fix this error
the number is too large
use entityHitEntity, better than onPlayerHit thing
ug
nvm,
i simply dont want to make uranium ore pushable, and if it was pushed it will explode,
That is a new class
@dim tusk
Seriously just use the code, no need for afterEvents
Use beforeEvents
Dude, I answered you a long time ago
How i can detect If has powered redstone on faces of my block?
@junior hill If you are facing an error send it here instead of pinging me and like 2 other guys with no text or error or issue or anything that stops you from using the script i gave you.
While yes I'm open for pings, I don't like random pings that aren't asking for help from me.
You can help me?
One sec
Okay
You're welcome.
Is it possible to add armor points for mobs without actually having them equipping an armor piece?
no
import * as mc from "@minecraft/server";
mc.world.beforeEvents.chatSend.subscribe((event) => {
const { sender, message } = event;
console.log(`Sending message to server: ${sender}: ${message}`);
});
Why does this not work?
What's error
From contents log
Wait a moment
What version?
latest
Need beta
is it possible to set a block to look different for a specific player
like client-sided
Nay
i wonder if we'll ever get more client manipulation features
they would be so useful
Yarr
yarr
The existence of @minecraft/server eludes to a mysterious @minecraft/client 👀
Check back in 2030.
Maybe if they just add simple functionality for packet modification
you could achieve anything with that as long as you try hard enough no
Packet stuff just got added for server-net. I expect more functionality in the future, would be great
amazing maybe i won't host this as a realm then
Should be available in 1.20.50
how soon are we getting that
ill be tired of minecraft in 1 month again
No clue
approx.
sad
how do i find out where my script slowdowns originate from
I face no errors in the content log too.
Lots & lots of console warns
what do i log in them
the slowdowns r like 5ms-80ms how am i going o notice
Use the debugger or script profiler
You can log the time since script start to the current time
E.g. at the top of your code block, const startTime = Date.now()
And then in the warns use Date.now() - startTime
Or use the profiler, would probably be easier 😛
should i be worried if i get slowdowns when playing alone
in this range
Any slowdown is cause for concern
You can fake this using particles in the beta API, but it would only really work well for a block that you expected to have less than about 50 of total at any time.
Well than what's the error/issue you're facing?
It seems to not to work at all. Not a syntax error just a functional error
Alright put some console.warn('Working (number)'); statements in the script then
Kk i will try
@knotty plaza No logs but it's okay, I didn't think of before events like the others said.
@serty.name Oh I didn't know that 🤯 Thank you for that!
@glacial widget Oh I appreciate that a lot, never worked with system.run so I am glad for the example ❤️ Thank you
I know you cant set nor clear it, but can you get a player's velocity?
Does anyone here know if you can use a SQLite database with the script api on a bds server? And if so, how?
player.getVelocity()
But does it work?
The maximum you can do is http requests
In theory yes
I figured the same for clear and set velocity, but the game runs the error that you can't do that for player class entities
thank you 🫡
This shouldn't happen with getVelocity()
what do you exactly mean by that
and how would it work
Then just teleport the player to the same location and set the property keepVelocity to false
I'm looking for getVelocity, not clearVelocity
Ah.
These methods should work tho
@jolly citrus One of the types of particles you can create is aligned to an axis instead of always facing the player. You could spawn a square particle facing 6 different directions for a certain player based on some condition using player.spawnParticle (which is currently experimental), and do the same thing for other players (but with a different particle).
But it's a lot of processing, so you can't really do this for a common block. Here's a video of me testing a block that's invisible unless you have a golden helmet.
hey guys, anyone know how to solve this issue?
[Scripting] Unhandled promise rejection: TypeError: Native property setter [HttpRequest::method] cannot be assigned null or undefined.
code below:
const body = {
CustomId: this.userId,
CreateAccount: true,
TitleId: "<myTitleId>",
};
const req = new HttpRequest(url);
req.body = JSON.stringify(body);
req.method = HttpRequestMethod.POST;
req.headers = [new HttpHeader("Content-Type", "application/json")];
return http.request(req);
Did you import HttpRequestMethod from @minecraft/server-net?
I can use the texts of .lang in sendMesage string?
solved, I was using the version that is in development, which was not working for some reason.
switched back to the default version, 1.0.0-beta, and it started to work
world.sendMessage({ translate: "your.translation.message" });```
also check this
https://jaylydev.github.io/scriptapi-docs/latest/interfaces/_minecraft_server_1_15_0.RawMessage.html
thats amazing to hear, thanks!
is there a way for me to save data to a world? like how i can save data to an entity using dynamic properties?
Yeah, use dynamic properties.
can u show me an example
of a way to save it to the world
no problem!
Documentation for @minecraft/server
world.setDynamicProperty('ds:randomThingIdk', 9);
thanks
and thanks
You're welcome

