#Script API General
1 messages Β· Page 92 of 1
Doesn't matter if it's a number , boolean, word whatever
I use the same one but I think for your case it's better yo separate them
Ehhh I don't get it lol
fov tween
What's that?
Look at the video again, the field of view changes over time.
Nah like what is it used for
ccinematic shots?
Is this possible tho?
strings
Unfortunately does not allow selectors.
It doesn't allow numbers for some reason
Yeah. MC commands are annoying when using just a number for a string value. You can type
"1" and it'll accept it.
No clue. Unless you can do an overload
hello! there is on bedrock an "inventoryclick event" like java plugin? i need to set a set of item in the inventory of the player who him can't remove or move from their inventory
theres no event for it but you can make your custom handler for it
Just lock the item...
it'll take a toll on performance for sure tho
you can compare container properties between ticks and then fire a custom event when a change is detected
but yea for your task do what sinevector said
you can make items undroppable, unmovable etc. in bedrock
with components? (im new in scripting on bedrock)
yea im pretty sure
Learn how to lock items in Minecraft slot or inventory, locking an item means you can't drop it, move it, craft with it etc. So you could also call this video how to get items the player can't drop, or how to get items the player can't craft with.
This works on all Minecraft bedrock editions: PS4, PS5, Xbox, Switch, Windows PC & MCPE / Pocket E...
Not with components. Its a property you can set for an item.
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/itemstack?view=minecraft-bedrock-experimental#lockmode
why does the block still drop?
import { world, system, GameMode } from "@minecraft/server";
world.beforeEvents.playerBreakBlock.subscribe(eventData => {
system.run(() => {
const player = eventData.player;
const block = eventData.block;
const isCreative = player.getGameMode() === GameMode.creative;
if (block.typeId.includes("paint_overlay") && !isCreative) {
eventData.cancel = true;
block.setType("minecraft:air");
};
});
});
You're putting the cancel in the next tick that's why. Put it outside the system.run
stirng is probably the closest one
use integer type
Not what they wanted. They wanted to accept any and all type of arguments, so we suggested the closest they can get is strings.
oh, yeah
I have other commands I need strings for
subcommand or type any/onOf would have helped here
is there a way to use infinite duration in .addEffect()? i mean true infinite, not a large number
use runCommand
or use intervals
Imagine the script API having toggles in settings. Actual add-on configs section. Couldn't imagine.
i don't really need it, i was just curious abt it
toggles in modal forms already exists
yeah
screw modals. "Settings" item feels so gross
Block custom component event
beforeOnPlayerPlaceis now called when an item usingreplace_block_itemis set to true for V2.0.0 and higher custom components
is this fix going to be stable in 1.21.90, of it's for v2.1.0-beta?
system.runInterval(() => {
for (let player of world.getPlayers()) {
if (player.dimension.id == "minecraft:the_end" && player.hasTag('ender_colleague') && player.isSprinting && !player.isGliding && !player.isInWater) {
const loc = player.getHeadLocation()
const lowestBlock = player.dimension.getBlockFromRay({ x: loc.x, y: loc.y - 2, z: loc.z }, { x: loc.x, y: loc.y - 10, z: loc.z }, { maxDistance: 12 })
if (lowestBlock.block.isAir && player.getGameMode() != "creative" && player.getGameMode() != "spectator") {
player.applyKnockback(player.getVelocity().x, player.getVelocity().z, 0.1, 0.05)
}
}
}
}, 0)```
[Scripting][error]-TypeError: cannot read property 'block' of undefined at <anonymous> (entity_or_block_gametest.js:23)
I've defined lowestBlock with seemingly proper parameters... am I using getBlockFromRay properly? The intention is to detect if there are no blocks below the player(within maxdistance)
if there is no block then ray cast will just give u no value
does air not count towards being a block?
even if not, there is ground below me when this error occurs
nope
const lowestBlock = player.dimension.getBlockFromRay({ x: loc.x, y: loc.y - 2, z: loc.z }, { x: loc.x, y: loc.y - 10, z: loc.z }, { maxDistance: 12 })
if (lowestBlock?.block == null) return
if (lowestBlock.block.isAir && player.getGameMode() != "creative" && player.getGameMode() != "spectator") {
with this change, it doesn't trigger anything
there seems to be something wrong with the raycast in general?
how so?
direction supposed to me unit vector
const lowestBlock = player.dimension.getBlockFromRay({ x: loc.x, y: loc.y - 2, z: loc.z }, { x: 0, y: -1, z: 0 }, { maxDistance: 12 })
@tight bloom
π
what would be the least resource demanding way to prevent entities from entering specific areas
or like if they do enter an area theyre not allowed to be in then just remove them i dont care about whether or not theyre in the world anymore at that point
do i just get entities -> if entity in this area then remove it ?
seems like it'd be pretty bad on performance when theres lots of players in different chunks tho
this is how im implementing it atm
if (tickIndex % 20 === 0) {
const overworld = world.getDimension("overworld");
const nether = world.getDimension("nether");
const end = world.getDimension("the_end");
const entitiesOverworld = overworld.getEntities();
const entitiesNether = nether.getEntities();
const entitiesEnd = end.getEntities();
entitiesOverworld.forEach((entity) => {
if (blacklistedEntities.has(entity.typeId)) {
if (!ClaimManager.entityHasPermissionAtPosition("minecraft:overworld", entity, entity.location)) {
entity.remove();
}
}
});
entitiesNether.forEach((entity) => {
if (blacklistedEntities.has(entity.typeId)) {
if (!ClaimManager.entityHasPermissionAtPosition("minecraft:nether", entity, entity.location)) {
entity.remove();
}
}
});
entitiesEnd.forEach((entity) => {
if (blacklistedEntities.has(entity.typeId)) {
if (!ClaimManager.entityHasPermissionAtPosition("minecraft:the_end", entity, entity.location)) {
entity.remove();
}
}
});
}
reverse the logic loop areas for entity and remove the with commands
any isn't a type
Least resource eating way is using commands, sounds stupid, but it be like that
i meant if it is
ye I wish it did
It would only work for pc/console players
Because with a controller/mouse you can drag items with the CursorInventory but in touch screens you can't
if (tickIndex % 100 === 0) {
const dimensions = [
{ id: "minecraft:overworld", dim: world.getDimension("overworld") },
{ id: "minecraft:nether", dim: world.getDimension("nether") },
{ id: "minecraft:the_end", dim: world.getDimension("the_end") },
];
for (const { id: dimensionId, dim } of dimensions) {
const claims = ClaimManager.getAllClaims(dimensionId as DimensionIdentifier).filter(
(claim) => claim.allowMobs === false
);
for (const claim of claims) {
const corners = ClaimUtils.getClaimCornersFromClaim(claim);
const minX = Math.min(corners.topLeft.x, corners.bottomLeft.x);
const maxX = Math.max(corners.topRight.x, corners.bottomRight.x);
const minZ = Math.min(corners.topLeft.z, corners.topRight.z);
const maxZ = Math.max(corners.bottomLeft.z, corners.bottomRight.z);
const dx = maxX - minX;
const dz = maxZ - minZ;
const y = -120; /* covers all y */
const dy = 320; /* covers all y */
for (const typeId of blacklistedEntities) {
dim.runCommand(`kill @e[type=${typeId},x=${minX},y=${y},z=${minZ},dx=${dx},dy=${dy},dz=${dz}]`);
}
}
}
}
yes?
except that i should probably tp them instead of /kill is this the way u were thinking of
or at least somewhat close
Though this causes 100ms spikes every 5 seconds now
gosh after 4 days i got load/save properly done
maybe use system.rubJob?
yes
...
function *killBlacklistedEntitiesInClaim(claim, blacklistedEntities) {
const corners = ClaimUtils.getClaimCornersFromClaim(claim);
const minX = Math.min(corners.topLeft.x, corners.bottomLeft.x);
const maxX = Math.max(corners.topRight.x, corners.bottomRight.x);
const minZ = Math.min(corners.topLeft.z, corners.topRight.z);
const maxZ = Math.max(corners.bottomLeft.z, corners.bottomRight.z);
const dx = maxX - minX;
const dz = maxZ - minZ;
const y = -120; /* covers all y */
const dy = 320; /* covers all y */
for (const typeId of blacklistedEntities) {
dim.runCommand(`kill @e[type=${typeId},x=${minX},y=${y},z=${minZ},dx=${dx},dy=${dy},dz=${dz}]`);
yield;
}
}
...
if (tickIndex % 1 === 0 /* remove the if idk just so u notice that the if NO LONGER NEEDED */) {
const dimensions = [
{ id: "minecraft:overworld", dim: world.getDimension("overworld") },
{ id: "minecraft:nether", dim: world.getDimension("nether") },
{ id: "minecraft:the_end", dim: world.getDimension("the_end") },
];
for (const { id: dimensionId, dim } of dimensions) {
const claims = ClaimManager.getAllClaims(dimensionId as DimensionIdentifier).filter(
(claim) => claim.allowMobs === false
);
for (const claim of claims) {
const corners = ClaimUtils.getClaimCornersFromClaim(claim);
const minX = Math.min(corners.topLeft.x, corners.bottomLeft.x);
const maxX = Math.max(corners.topRight.x, corners.bottomRight.x);
const minZ = Math.min(corners.topLeft.z, corners.topRight.z);
const maxZ = Math.max(corners.bottomLeft.z, corners.bottomRight.z);
const dx = maxX - minX;
const dz = maxZ - minZ;
const y = -120; /* covers all y */
const dy = 320; /* covers all y */
system.runJob(killBlacklistedEntitiesInClaim(claim, blacklistedEntities))
}
}
}```
here u go
u might want to yield less often
or based on time (as i do)
There's a syntax error at const job = in killBlacklistedEntitiesInClaim
There should be a better way to go about this than runCommand. What we're essentially looking for is collision detection, right?
I wonder if building some kind of quadtree/octree would be overkill for something like this
(i am not saying it is anything of a good advice.) for my complex calculations, i use time-based yielding:
...
const lastYieldTime = Date.now();
...
// (in some loop)
if (Date.now() - lastYieldTime >= 10 /* ms, note up to 50ms per tick, so be considerate, depends on the workload */) {
yield;
lastYieldTime = Date.now();
...```
hmm
i don't know much context about the problem
can you tell me in short?
Does the job system have some sort of priority for its jobs? Like if the job system prioritizes executing older jobs before moving on to newer ones
nup, executes each one with same priority
but u can be selfish and take e.g. 40ms for urself
by time based yielding
(as i do but we dont talk bout that)
I worry that, if new jobs are added to the stack, it could prevent old jobs from ever completing. Certain claims could, in theory, never kill entities because of the order they are iterated in / of running "out of time" before that job gets its turn to continue
well i think we can implement state per each one like at the begin
... begin
finishedJobs[id] = false;
... end
finishedJobs[id] = true;
that'd prevent from multiple runnin at the same time
do not worry, i once had my job take 400ms
and still complete
with others
runnin too
also do i go full selfish and do 50ms for myself?
in the meantime
please inform me about the context
Maybe try using RunCommand
Don't use the async version of runCommandAsync use runCommand
If your using beta api
Stable can use runCommandAsync still i believe
ye but it's deprecated
Ok, thanks everyone
is there a way to add lore to an item without having to scan the inventory and add it manually in a runInterval
as long as u have the itemstack object u can
Hello
I updated my behaviour pack a few days ago on a realm, and all the old dynamic properties are gone? Do they get cleared somehow?
don't change your uuid
they are linked to it
It was world dynamic properties, the key is exactly the same but it's empty now
i am talking about your bp uuid
That's odd, it's the same as before, only change was some extra commands and a version increment
it was like this from the start
it is a good thing
you don't want other add-ons editing each other data
-# unless you do
As in, my UUID hasn't changed, I haven't edited anything in the manifest other than version
Uhhh unfortunately not, it's a realm which is now too big to download
I really wish I could check the data
Maybe when removing the old version it deletes the dynamic property?
maybe get all the dp in the world and log them to see whats there
could be a corruption thing too, so maybe use a backup
I don't really have free access to do loads of testing which is a pain but I mean, if it's gone, I'll just have to be careful for next time.
Is it likely that removing a BP removes its dynamic properties?
not sure about that one
@honest spear do you have any idea?
if a world had some dp and you removed the bp then loaded the world, do they get deleted or stay in case you re-applied it
I think the world file is multiple gigabytes at this point so corruption is very likely
I always forget, i think it stays for itemstacks and entities, but needs to be well tested
alright, i will keep that in mind to test it next time i can
thanks
hello people I need help on importing my own libraries
I have 1.js that exports values and functions and 2.js that imports those values and function, how'd I do that? just Importing it doesn't work
it says native module error not found
I believe before I can just import it, did something change?
did you export it?
yes and I forgot to mention
π Api Folder
-> 1.js
-> 2.js
main.js
oh wait it works now
my lib was so big I thought it just use basic stuff I forgot it has afterEvents too and I didn't import minecraft/server
it's all goods now
Guys how to combine scripts without crashing them with each other
Because there is this weapons which are special specifically spartan weaponry some of the weapons can absorb damage apply damage when certain events are met and more but it's in different scripts and there's so many of them how will I combine them?
You'll need to elaborate further by it's in different scripts and there's so many of them
I have no clue where else to ask this, but I feel like this is the smartest bedrock community I know of. Where do I report duplication bugs? Just stick it on Mojira? idk if they want sensitive bugs reported privately
Any sensitive bugs will be marked as Private by a moderator.
Although I think there is the option to report a Private bug at the time of creation?
The best way to know is to ask them directly: https://discord.gg/rpCyfKV
Thank you!
Yes.
how
like how do I add lore without a loop
does anyone know why my npm wont install my packages?
ive added a package json file to my directory with the latest beta packages but when running npm i in the console or vsc it just seems to keep loading and never installs
i just tried restarting my pc and just nothing is working with it anymore but was working earlier
system.runInterval(() => {
const dimensions = ["overworld", "nether", "the_end"];
dimensions.forEach((dimension) => {
const player = world.getDimension(dimension).getPlayers()
player.forEach(players => {
const entity = world.getDimension(dimension).getEntities({ families: ["cnb_ppl_entity"], })
if (players.dimension.getBlock(players.location) == undefined) return;
entitys.forEach(entity => {
if (players.dimension.getBlock(entitys.location) == undefined) return;
console.error(success)
})
})
})
})
So I have entities that need a command loaded from them once every tick, but the issue is that if two players get close to eachother they will end up increasing the load on the system 2x. Any ideas how to prevent it from having double the load?
you can actually
or used to be a thing at least
how did you do that btw?
No
Right now you can't drag items in mobile
Not sure if that was a feature before.
Alright, question. Is there anyway to translate an entity's typeId, insert it into a string and use it generally?
Yes, what are you trying to do with it? Can it be within the same function?
I was trying to set the lore of an item as an entity's name, but it doesn't accept Raw Messages, so I was wondering if i could translate the name in another variable, save the translated name in a string and then insert it as the lore. And yes it can be within the same function.
have you tried JSON.Stringify()?
If you post it I should be able to help better.
You should be able to put it in a string and add it to the lore, I've done this recently.
Well this is what I had currently: let name = ''; name = "%entity." + entity.typeId + ".name"; spawnItem.setDynamicProperty("plantalia:snapclam_trapped", saveId); spawnItem.setLore([ "Captured " + name ]);
Let me setup something real quick to help. I'm still a bit inexperienced myself.
Hmm I'm having trouble getting spawnItem to work, sorry.
I was using giveItem
system.runInterval(() => {
const dimensions = ["overworld", "nether", "the_end"];
dimensions.forEach((dimension) => {
const players = world.getDimension(dimension).getPlayers()
players.forEach((player) => {
if (player.hasTag('dropitem')) {
const entitys = world.getDimension(dimension).getEntities({ families: ["sheep"], })
entitys.forEach((entity) => {
const entityid = entity.typeId
const loc = entity.location
giveItem1(player, "minecraft:stick", loc, dimension, `${entityid}`);
player.runCommandAsync(`tag @s remove dropitem`);
})
}
})
})
})
function giveItem1(player, itemId, loc, dimension, lore) {
const { container } = player.getComponent('inventory');
if (container.emptySlotsCount === 0) return;
const newitem = new ItemStack(itemId, 1);
newitem.setLore([
"Captured " + lore
]);
system.run(() => container.addItem(newitem) );
}
Idk if this helps, but this is how it works with addItem
@thorn ocean
Is spawnItem experimental?
Ok so mc turned off my pack for some reason lol
system.runInterval(() => {
const dimensions = ["overworld", "nether", "the_end"];
dimensions.forEach((dimension) => {
const players = world.getDimension(dimension).getPlayers()
players.forEach((player) => {
if (player.hasTag('dropitem')) {
const entitys = world.getDimension(dimension).getEntities({ families: ["sheep"], })
entitys.forEach((entity) => {
if (entity.dimension.getBlock(entity.location) == undefined) return;
const entityid = entity.typeId
const loc = entity.location
const lore = `${entityid}`
const newitem = new ItemStack("minecraft:stick", 1);
newitem.setLore([
"Captured " + lore
]);
entity.dimension.spawnItem(newitem, loc)
player.runCommandAsync(`tag @s remove dropitem`);
})
}
})
})
})
Oh I was using location, not what was executing it XD. Here this should work.
How do get you get variables from a function? I have a bunch of scoreboards I'm constantly getting numbers from that I want to make available everywhere.
return?
yes you'd use return for that
Thanks, then presumably I would have to unpack it on the other side with [#]?
?
It's a group of scores, not just one, just trying to figure out how I would separate them after it returns them
you can have a getScore function like this:
export function getScore(target, scoreboard) {
try {
return world.scoreboard.getObjective(scoreboard).getScore(target);
} catch (e) {
console.warn(`Error in getScore for ${target?.name ?? target}, ${e}`);
return 0;
}
}
and then use it like this:
import { getScore } from "./file path";
const kills = getScore(player, "kills");
if (kills > 5) {
//...
}
function getscores(
//time
const timeobj = world.scoreboard.getObjective(`time`);
const time = (timeobj?.getScore('variableholder') ?? 0);
//time2
const time2obj = world.scoreboard.getObjective(`time2`);
const time2 = (time2obj?.getScore('variableholder') ?? 0);
//time3
const time3obj = world.scoreboard.getObjective(`time3`);
const time3 = (time3obj?.getScore('variableholder') ?? 0);
return (time, time2, time3)
)
...where im refferencing it
const gettimescores = getscores()
const time = gettimescores[0]
const time2 = gettimescores[1]
const time3 = gettimescores[2]
Does that makes sense?
Can I grab them all as a group though?
yes, let me modify it real quick
K, thank you!
export function getScore(target, scoreboard) {
if (Array.isArray(scoreboard)) {
return scoreboard.map(obj => {
try {
return world.scoreboard.getObjective(obj).getScore(target);
} catch (e) {
console.warn(`Error in getScore for ${target?.name ?? target}, objective: ${obj}: ${e}`);
return 0;
}
});
}
try {
return world.scoreboard.getObjective(scoreboard).getScore(target);
} catch (e) {
console.warn(`Error in getScore for ${target?.name ?? target}, ${e}`);
return 0;
}
}
usage example:
const [time,time2,time3] = getScore(player, ["time", "time2", "time3"]);
sorry that took so long typing on mobile takes ages
haha no problem... ok going to take me a sec to unpack this. Awesome.
export function getscores(itemname, scores) {
...
//scores got here
...
if (Array.isArray(scores)) {
return scores.map(obj => {
[ time, time1, time2 ]
}
Can I do it like this too? I'm getting undefined for all variables for some reason.
Have you declared the variable time, time1 and time2
yes, they're defined with const.
So they shouuldnt be undefined
Ok, that's good. I must have missed something when passing it over to the function. Thank you!
I'll probably do that in the function. I think that's probably where it's disconnected.
Like
function someFunction(arg1) {
console.log(`${this.name} got called with input: ${this.arguments.join(", ")}`);
}
Nice, Coddy showed me I can also use console.error() and pop in the variable. Does this give more info?
Well info, error or warn, wont really change the shown content
But yes
You can use warn/error
Oh! wow I'm dum... I found it:
And show any content you have, or just a wimple text to be sure that its even getting called
Ohh thats good
export function getscores(itemname, scores) {
...
//scores got here
...
if (Array.isArray(scores)) {
return scores.map(obj => {
return[ time, time1, time2 ]
//^^^^ Forgot the second return
}
Getting the full container now
Yes you did, if scores is not an array, it will return undefined
And the second return ofc
All the variables are passing over thankfully. Oh yeah, no worries I have that setup right too, with "" around all the variable names. Thank you for helping!
Btw of you ever use TS, this mistake wont happen again
Youre welcome
How do you make the semi-transparent walls I've seen in some addons which are used to indicate areas or locked areas? Sorry for the bright screenshot, this is all I got
Entity bounding box, or particles.
do we have a built in method to scan blocks in a chunk?
How far it goes
getBlocks(volume, filter)
is chatsend event still in beta?
what does volume need?
blockVolume
yes
Thanks a lot Minatoπ«‘
np
you can just do
{from:vec3, to: vec3}
how would you store an array in a dynamicProperty? stringify and parse?
Yes
that's how you do it
same for objects
alright
it's fine to an array that might contain more than 1000 variables right? array[1000]?
system.runInterval(() => {
const tbsEntities = [
"space:null",
"space:integrity",
"space:the_broken_end",
"space:herobrine",
"space:far_away",
"space:no_texture",
"space:nothing_is_watching",
"space:hetzer",
"space:r2",
"space:circuit",
"space:sub_anomaly_1"
];
tbsEntities.forEach(type => {
const entities = overworld.getEntities({ typeId: type });
if (entities.length > 1) {
const entitiesToDespawn = entities.slice(1);
entitiesToDespawn.forEach(tbs => {
tbs.triggerEvent("despawn");
});
}
});
});
Why does this trigger event on all entities?
because it's { type: type } not { typeId: type }
Oh. But then why wasn't it returning an error?
Nvm my brain isn't working properly
more caffeine I suggest
Because extra properties on that object won't throw an error.
But if you for example pass a boolean to the typeId property when it's expecting a string, it will.
My bad
deum that code is very inefficient
put that const array outside of the Interval
and ur using to alot of foreach π
do it like this
for (const type of tbsEntities) {
const entities = overworld.getEntities({ typeId: type });
if (entities.length > 1) {
for (let i = 1; i < entities.length; i++) {
entities[i].triggerEvent("despawn");
}
}
}
don't we love trying to use the @minecraft/ packages on bds and it doesn't want to work π
doesn't matter where I place them it wants to cry about events not being there or HttpRequestMethod not existing :/
Are you using the right npm package?
{
"dependencies": {
"@minecraft/server": "^2.0.0-beta.1.21.84-stable",
"@minecraft/server-admin": "^1.0.0-beta.1.21.84-stable",
"@minecraft/server-net": "^1.0.0-beta.1.21.84-stable",
"@minecraft/server-ui": "^2.0.0-beta.1.21.84-stable"
}
}```
Got them all installed.. I tried on the root of the server and inside the Behavior Pack itself and neither want to work
What does the intellisense error say?
I just have these errors for my code but nothing else so far.. and the HttpRequestMethod wants to use the actual one of POST, GET, etc. instead of .Post, .Get, etc.. but when I go to the before events it shows playerPlaceBlock in there :/
I've tried restarting vsc and even my pc after installing the packages and it just wants to be weird about it
The npm packages dependencies might be outdated that you need to add an override.
Outdated? I'm grabbing all the latest ones from npmjs though.. shouldn't it just work out of the box?
Can you try just using the server npm package?
If that works then the issue is the other packages.
okay yeah i just installed them fresh and that seemed to have fixed it. for some reason the server package was originally being installed with an rc version of 1.21.9. after removing them all its now installing as the correct version
just weird since the package json has the versions in there so it should grab what its finding not installing some weird version of the preview.. even since it's labeled -stable
DUH i spent 2+ days just getting large cogwheel perpendicular meshing right
yes, i've tried ChatGPT, Claude.AI, Gemini, DeepSeek, they just give bunch of crap
Sorry, I'm not following, entity bounding box? It doesn't feel like particles
imagine using c++ with script api
GIMMEEEE
havent done this in a minute, but how do i test for the player has actually loaded into the server/world/realm
world.afterEvents.worldLoad
is that what you mean?
yess ty forgot what it was, but how do i detect that for an individual player?
im just trying to open a UI
Do you have the name of that individual player
uhh or maybe playerSpawn
im using that, but that doesnt detect them loading in
That's just world.getPlayers().forEach((player) => {})
I would like to stay with my beloved TypeScript
noooooo
hm alr
PlayerSpawnAfterEvent
am using that
import { world } from "@minecraft/server"
world.afterEvents.playerSpawn.subscribe(({ player, initialSpawn }) => {
if (!initialSpawn) return
form.show(player)
})
yea but that doesnt open the menu when they have loaded in
just show a form to a player
yeah. i did
can you show me your code?
world.afterEvents.playerSpawn.subscribe((data) => {
const player = data.player;
if (!data.initialSpawn) return
world.sendMessage(`Β§7Welcome back Β§f${player.name} Β§7to Β§fΒ§kWΒ§r Β§bBreeze Β§3PvP Β§fΒ§kW`)
player.runCommand(`scoreboard players add @s season_one 0`)
player.teleport({ x: 1000, y: 69, z: 1000 }, { facingLocation: { x: 1000, y: 69, z: 999 } })
rules(player)
if (getScore(player, "season_one") == 0) {
}
})
ignore the runcommand
that will be native soon lmao
Does that message send
yeah
can you show me rules function?
Then that's issue of your form
import { ActionFormData } from "@minecraft/server-ui";
export function rules(player) {
const form = new ActionFormData()
.title("Welcome back!")
.body("Β§ltest")
.button("understood!", "textures/items/writable_book")
form.show(player).then(response => {
if (response.canceled) return;
switch (response.selection) {
}
});
}
The rules functions I think is your form
Yeah okay
everything is okay in this code
are you importing rules to the file that listener is in?
moreover do you get any errors
nope
yup
i jus tthink it cant show because the player isnt loaded in yet
I m not into forms ui stuff so I can't tell about the rules functions lol
its correct
you can use forceShow function instead a regular show method
Yep
how do you do that?
import { FormCancelationReason } from "@minecraft/server"
export const forceShow = async (player, form) => {
while (true) {
const responseData = await form.show(player)
if (responseData.cancelationReason !== FormCancelationReason.UserBusy) return responseData
}
}
eh
how am i gonna forceshow it if its not even showing in the first place
mhh
Force show keeps attempting to display it to the player until they are not busy
playerSpawn event fires when the player loads in, but that doesn't mean the UI is fully loaded, so the player is considered "busy" when the form gets canceled
i dont get it bruh this is my form what do i add for the force show
export function rules(player) {
const form = new ActionFormData()
.title("Welcome back!")
.body("Β§ltest")
.button("understood!", "textures/items/writable_book")
form.show(player).then(response => {
if (response.canceled) return;
switch (response.selection) {
}
});
}
I think hes talkin about this
u dont need UserBusy if your not using a chat command like !help or something
I want to make it so if your holding a specific item and you hit an entity it runs a command
somethin like this could work but im not sure
i got it working already but ty
np
Thanks I'll check it out
np
Is there any way to make an event run when the environent light level changes without running an script the whole time?
And without player json ofc
Sorry I meant geo, could be an entity Geo but the problem with that is it doesnβt appear if your not directly looking at the collision box. Collision boxes get more laggy the larger they are.
Ah, it does need to be very big
Marking out huge areas
Particle outlines aren't ideal
how to force close ui in server ui
how do custom components work?
Elaborate.
I'm not too sure, this is the rough thing, except it doesn't necessarily need to be a box. https://youtu.be/mt00Eu6TRt4?si=Ws_a0aUH8JgaJYhm&t=156
This is a Minecraft Marketplace Add-On called Land Claims by Cubical. It costs 660 Minecoins. This is a showcase with no commentary.
Protect your builds, maximize security and log off safely with the Land Claims Add-On!
- Create LAND CLAIMS and EXTEND them when your builds get bigger for additional security
- INVITE FRIENDS and assign diffe...
It looks like just a flat plane
Yeah it's likely just an entity.
Possibly a square which can somehow be resized? I can't imagine there'd be one per block face
It's just using an animation likely.
like what are they used for?
Custom Block and Item events.
To change the scale? I'm not too sure about entity models
is it possible to make a block that can update itself with custom components
Elaborate. You can use ticking or randomtick to do stuff.
Because I'm trying to make functional custom walls
But they need to self update if that makes sense
Using the api to update them doesn't work as entendes
I need more elaboration but that sounds like using onTick to check every tick for certain conditions then do stuff.
Is there any documents about the onTick?
Chekc the bedrock wiki.
Smokey what is the Robot Overlord tag? lol
Bot managers.
Sorry, do you have any recommendations for which docs to check for this?
I would learn entity animations and the client entity file.
Alright, thanks
how to force close UI
@leaden elbow
i see it's using closeAllForms. how can i apply that in my code? UIManage.closeAllForms(player)?
oh idk
i dont use js
@leaden elbow
wait
arent u that one json ui person from realm hub
i saw your post earlier today lmao
yep lol
im not into scripting anymore and im practicing to make an ingame loading screen
i only know c# .ps1 css and html
thats why i wanna force close server form
can we go to dms rq
kk
anyone played around enough with custom command? am i missing something in this? or do you have any suggestions?
it doesn't have one? it is just a number
ye
why should it have desc
i don't really like it tbh, i might change it to black
Are custom enum supported?
Also in case you need description you can link this https://jaylydev.github.io/scriptapi-docs/latest/interfaces/_minecraft_server.CustomCommand.html
change it to the google dark mode colors
no yet
yeah i did use your examples, thanks
it doesn't really matter, but i think you should have used the enum after registerEnum in your example, i was looking for where you used it after that but i found it before, kinda weird imo
YO WHAT custom slash command creator?????!!!!!
Minato is on a cooking streak π π₯ π₯ π―
streak?, It's been a while since i made anything π
anyway
ok, shut up
i found that funny
π bruh
it kinda is, lol
remembers me of how my dad types
π
π the dad always says a thumbsup
gottem!
can't u run some code if the command is ran
this is getting off topic i feel the SmokeyStacks aura getting near this chat
eh, how?,
yes?,
yeah
() => {
}
that's really good ngl
that is what the function for
we KNOW what a callback is
huh?,
I mean like you can add a box where a specific function will run if the command is ran
implement also a full version of vscode so you can use script api in it
And it will generate code like
() =>{
theFunctionUserWantedToRun()
}
he already made it xd
that is not a bad idea
actually, no it is a bad idea
-# i am lazy
hahahahaha ok
function run() {}
system.run(() => {
run()
})
it's so hot cya gys
so rain and sun stops internet from working?
no- it makes my brain not working
35Β° c
a bit cold
Can I ask something what is the language for script API?
javascript
41Β° C
34Β°C
Ohhhh I thought it was typescript is there a difference between them
TypeScript is just JavaScript with type annotations
minato is near me
typescript is for people that don't know how to type
you got my ip
Is morroco near Italy? (Can we move to offtopic )
yes?
πΏ chad
well, not actually
Who from philipines here?
coddy (we all miss him)
most people are
Wait who is coddy sorry?
why isnt him online no more?
dude it is 3200 km
@dim tusk is this him? Sorry for ping
Bruh yes
he said he is having a hard time
ig
Ohhhhh is he a super great scripter?
he is
holy glazer
Yes?
Oh no
Sorry for pinging you
bro you alive whaa
finest is the minato's n1 fanboy
What'd you want?
We're just messaging
good reason for pinging
Aww... Okie.
I'm very sorry
Nah that's fine, I rarely open my DC now
there is worse than him, lol
but not in that way, kinda fell proud tbh
I still code tho not just javascript anymore, I moved to C++ rn
hope all going great
ohh noo wish you good luck π€ (uh can u make scripting api for c++)
no one glazing me for making some really good script resources
FVK NAH...
no one glaze at me in general lol
how should we do that, lol
jk it was becouse finest was glazing you
ok, yeah you actually have some great stuff there
So any good stuff rn?
script api V2?
I read the changelog and docs but not really making scripts
yeah
Ok I know this... It's gas ngl
custom commands, startup and shutdown events, a LOT of new methods for functions
hmm need to check docs again
I know that, before I left it's already there
hungerbar editing
except for that.
fov_set
REALLY?
I'll be reading docs and changelog again if I have time...
goodbye again, just tag me again to summon me...
yeah, in the cam command
lol, will do
take care
true, another runCommand
Quick question, can you move first person view now?
nope
ill hire a bot to ping you every 2 minutes
uninstall discord... duhh??
damn, to those people I gatekeep because of my situation... I'm sorry lol
client side scripts for camera, interface, animations, textures, would be the best thing mojang can add
imagine we can attach camera to anchor
How do u guys even make scripts?
They added custom commands... I have hope for before events of entityhurt.
hands + brain
Like genuinely how is there a app dedicated to doing that?
you are on pc or phone
if you're on a PC a lot of people use Vscode... If android there's Code Editor, Acode etc.
I have lazy hands but my brain eh I'm still confused
I don't use Vscode tho lol, I use notepad++
I use the app called squircle ce
i use bridge
don't worry Minato, I don't anymore... I can't use it in c++ shyt
anything will do
but if you need auto completion, you will need to go beyond that
lol
Ohhhh like what are your suggestions?
imagine an in real time changing form,
z rotation for camera for barrel roll elytra,
changing textures without needing block permutations,
AND THE BEST: no incompatibility issues due to json files
vscode is your best bet
Oh wait Minato remember I made a plugin for notepad++ to have auto completion for scripts like vscode?
if you re a noob and you dont want to waste time setupping things bridge is better
Is it avail on Android?
50/50.
can't find dingsel post
As an app itself? No, but as a website yes
Having a "giant" or "small" POV is sick.
minecraft bedrock camera is so bad, its so static \
it used to move when you pressed jump now it doesnt
byeee guys see you again. I'll be on hiatus again.
Why does Mojang doesn't want to add script API already and no beta api
bye coddy
Byee
what's the difference of setDynamicProperties and setDynamicProperty?
That's the purpose of beta. It's for testing
its alredy stable, but beta api is for the newest features
Setting multiple and setting single.
setDynamicProperties({ key: value, key: value })
how do I do the multiple one? ({id, value}, {id, value})
I see
thanks
it's helpful I guess
it doesn't bloat my script with repeatitions
not valid param lol
properTIES sests an object, and CLEARS all the other properties if not specified in the obj
{"key":"value"}
single properTY sets only one without deleting the others
nono, I don't think so.
It is still like property just that you don't make multiple ones.
Bro is still a pro even if he changed language
imagine if that gets added π we need to pray to get entityHurtBeforeEvent added
muscle memory.
If you check my old messages
I help a lot of people like every day not exaggerating
I'm new and back reading isn't one of my most favorite hobbies to do but wow
How
coddy said 2 times 'bye' but still messaging, which means coddy wants to stay with us for a while π don't leave us
unfortunately you should.
Oki oki
You need to learn without relying that much on others.
Ohhhhh
I mean by asking too much sorry
Especially if people don't know the answer, that's where back reading comes in.
Ohhhh
a lot of things changed so my old scripts might be unreliable but you can still ask here for clarification.
Okay
how do I use script debugger?
ask in script api, but no one knows \
Update how? Like vanilla walls?
yep
const TickComp ={
OnTick(event){
wall_Manager.updateWallsAround(event.block)
}
}
world.beforeEvents.worldInitialize.subscribe(({ blockComponentRegistry }) => {
blockComponentRegistry.registerCustomComponent(
"grass:custom_wall",
TickComp
);});
is this right?
because it doesn't work
onTick, not OnTick
what's one way to get a chunk location?
I want to iterate from the player.location
oh sorry I meant the jayly bot
it's fine now
Right Click or Press & Hold (Mobile) -> Apps -> Debug Scripts -> Follow Instructions
yep thanks
how to cancel player attack to any entity with script?
you cant
no event for it
so how do I cancel it if there no event for it?
only way is with json and damage_sensor component
There is no beforeEvent for entityHutEntity
No way to cancel hits with scripts
you can do it without ticking ya know
Actually no
If you use after and before events weird glitches pop up
And you'll have to make systems that check every vertical and horizontal axis
It's just too laggy
Finding who can make a good scripts like expert I can paid weekly depend of how much money per hour like 10$-20$ per hour
const blood = offHand.typeId.replace("occultismus_arcanus:blood_bottle", "");
if(item?.typeId === "occultismus_arcanus:needle" && offHand?.typeId.startsWith("occultismus_arcanus:blood_bottle")){
const bloodUpdate = new ItemStack(`occultismus_arcanus:blood_bottle${String(Number(blood) + 1).padStart(2, "0")}`, 1);
equippable.setEquipment(EquipmentSlot.Offhand, bloodUpdate);
console.warn("New item:", bloodUpdate.typeId);
}
Does anyone know why the item doesn't change?
Are there any errors? Does the console.warn function operate correctly?
also make sure it has privileges if that codes runs on read only tick
system.run(callback)
I found the error, it was the format version of blood bottle, it was 1.20.10, I changed it to 1.21.10 and it worked.
oh okay
is it possible to manipulate the text displays/ nametag? such as size, orientation and background color
Nope
dang java had it easy...
you can fully redo it if u want
like
use particles or something
or an entity
and put it above the thingy u wanna do
does setDynamicProperty cleara all or just adds it?
they are both the same right? the setProperty and the setProperties
JSON?
uhh what is a enum in slash comand
never used it
i just undertstand parameters
but what does a enum do
it's like custom parameters.
import { system, CustomCommandParamType } from "@minecraft/server";
system.beforeEvents.startUp.subscribe(({ customCommandRegistry: c }) => {
c.registerEnum("example:warp_locs", ["spawn", "shop", "idk"]);
c.registerCommand({
name: "example:warp",
mandatoryParameters: [
{
type: CustomCommandParamType.Enum,
name: "example:warp_locs"
}
]
}, (dontcare, warpLoc) => {
if (warpLoc === "spawn") {
//...
}
});
});
for example
could someone help me please lol
no
json editing
unless you describe your problem, or no one help you
ok
i would call it a problem its just a lack of knowledge
const plotSpot = player.getDynamicProperty('islandPosition')
world.structureManager.place("server:island3", player.dimension, plotSpot);```
how would i make the structure appear 3 blocks away from plotspot
like the way ~~~ works in commands
is this possible? can someone help me how to do it
offset the coordinates, like
const { x, y, z } = player.getDynamicProperty("islandPosition");
world.structureManager.place("server:island3", player.dimension, { x: x+3, y: y, z: z }); // or whatever coordinate you're offsetting
thanks
ill try it
With player interact with block event(i forgot the name) can you cancel the event? Like if i have a end portal and i activate it it counts as a interaction
function createLeaderboardMenu(player) {
const form = new ModalFormData();
form.title('Β§f-=- Β§dLeader Boards Β§f-=-Β§r');
form.textField('Β§dDisplay Name:Β§r', 'e.g. Β§d-Money-Β§r');
form.textField('Β§fScoreboard Variable To Display:Β§r', 'e.g. Money');
form.slider('Β§dThe amount of time measured in game ticks it the leaderboard pauses between updating Values\nΒ§d( Β§fThe lower The Laggier! Β§d)Β§r\n\nΒ§dRefresh TimeΒ§r', 20, 1000, 20, 200);
form.slider('\nΒ§dThe amount of score the player needs to be included on the leaderboard\n( Β§fThe lower the laggier!Β§d )Β§r\n\nΒ§dScore BufferΒ§r', 0, 20, 1, 10);
form.submitButton('Β§dApplyΒ§r');```
anyone know whats wrong??
line 45 is the first form.slider btw
Yes
If you are using @minecraft/server-ui 2.0.0-beta, the parameters for slider, textField and toggle have changed
form.slider('Your label', 20, 1000, { defaultValue: 20, valueStep: 100, tooltip: 'Optional tooltip for your slider' });
thanks man
system.runInterval(() => {
for (const player of world.getAllPlayers()) {
if (player.hasTag("logic_done")) continue;
const traumaScore = getScore(player, "Trauma");
const daysScore = getScore(player, "Days");
if (traumaScore >= 100 || daysScore >= 7) {
player.teleport(fixedSpawnLocation, world.getDimension("overworld"));
player.runCommandAsync("structure load smile ~-16.5~-2~-16.5 0_degrees none true");
player.addEffect("darkness", 2, { amplifier: 255, showParticles: false });
player.runCommandAsync("function movenot");
player.playSound("laugh", { volume: 1.0, pitch: 1.0 });
player.addTag("finalDay");
player.addTag("logic_done");
}
}
}, 20);```i wanna create a random 20 blocks ofset in the fixed spawn location like everytime the any player fullfills the condition the the fixed position will move 20 blocks randomly right or left or back and forward i wanna save it through a scoreboard so that the offset will keep increasing like 40 to 60 etc. is that possible cause i dont want the player generating an arena and boss overlapping at each other
this is the 99999th message in this post
And you are approximately the 30th person to have said that!
It's a bug with Discord's client. I guess it refuses to count beyond 100,000 messages in a given thread.
It does say 100k+ rather the 9999 count for me.
Chance. It sometimes says that. It sometimes says the other.
world.beforeEvents.playerPlaceBlock.subscribe(e=>{
console.log("working");
})```
Anyone know why I'm getting the error "cannot read property subscribe of undefined"
Apparently playerPlaceBlock is undefined?
hmm, I guess there's no beforeEvent for it?
I'm confused because the autocomplete showed there was
It works fine with afterEvents
hmm, no, it should work. It's on the wiki also
https://wiki.bedrock.dev/scripting/placement-prevention
Beta API.
ok it works on vanilla items but not custom items
world.beforeEvents.itemUse.subscribe(fr => {
const food = fr.itemStack;
const player = fr.source;
console.warn(food.getTags())
console.warn(player.hasTag("origins:vegetarian_custom"))
console.warn(food.hasTag("is_carnivore_food"))
});
Easily workaroundable. That is interesting it fails, perhaps it requires a namespace.
yep i did food.getTags().includes()
let me try with a namespace
still the same result
getTags and log the result to confirm
They did.
it works
yea that's the first console.warn is for unless warn and log are diff somehow
if no namespace is given to hasTag then it assumes minecraft:
as long as you specify a namespace it will work
but here i tried with namespace
send the script
tysm it works now
btw how would is_carnivore_food differ from the vanilla is_meat tag
it's for custom food items
scriptevent
system.currentTick "pauses" when the game isn't running, yes? Like if the world is not being played or the game is paused?
Yes.
right. But iirc, Date.now() doesn't pause even if the game is paused
Correct
Ty
Could you technically make a "paused for ..." timer if you wanted to?
Or do scripts also completely stop running?
Like when you unpause it says in chat or something "You were paused for 23 minutes and 17 seconds" 
Seems pointless but why not lmao
They stop running. You can use Date.now() for that tbh.
compare date.now() with system.currentTick I guess
Is having a few non repeat commands in your world bad?
I did a test where I ran 255 script methods Vs 255 commands, the script methods were about 30ms and the command were about 80ms
and this was 255 of each, so commands really aren't that laggy in general
when logs have "minecraft:logs_that_burn" as a tag but planks don't have "minecraft:planks_that_burn" π
how can i check for consecutive entity interactions? for example, if i interact with an entity, itll be first, and then if i interact with another entity that will be the second
Save the entities in a data structure whether dynamic properties or a temporary array.
i thought of nesting playerInteractWithEntity but that doesnt work
k, ill try that
is it possible to manipulate the UV of a particle through script via variables?
are particle variables molang queries?
I want to be taught the script API π
learn JS
real
Getting data using tags vs getting data using an object
What's better?
The object can be updated using Jigarbov's "add-on payload ecosystem", it's just a const in this example.
object, unless you want something other than script api to access it.
can RC be manipulated through script?
i wanna make better faction
What?
i mean essentials, I don't know how many times I failed to make essentials addon
some of my code leaks hopefully can be used and are suitable for this resource
https://discord.com/channels/523663022053392405/1370349334016561253
is it possible to detect lightlevel using scripts only? or do I need environment_sensor
const playerName = player.id;
player.dimension.spawnEntity("mz:smile", player.location, {
tags: [`owner_${playerName}`],
});``` is this the correct way of adding a specific tag to the entity spawned?
const entity = player.dimension.spawnEntity('mz:smile', player.location);
entity.addTag(`owner_${player.name}`);
I don't understand :v can you just teach me the basics?
@rare dawn Here's the bullet point breakdown of what I recommend learning:
- First understand that JavaScript is a bizarre, hybrid language that incorporates many different patterns. There's a hundred ways to do a thousand thingsβeveryone will do things slightly differently. You should focus on writing straightforward, easy-to-understand code, even if everybody else criticizes you for being "too verbose".
- Come to understand some basic JavaScript concepts:
- The basic syntax
- Primitives, like the number and string.
- Expressions and operators for assigning and manipulating primitives.
- Declaring and using functions.
- The object.
- Come to understand that the Scripting API is structured around an object-oriented pattern.
- Making changes to the world almost always involves invoking a certain object method (function).
- Accessing the object you want (e.g. an item in a slot in the player's inventory) involves using either a property or a method on an object to acquire another object. (e.g. world -> player -> inventory component -> container -> slot -> item).
- Certain constructs will require creating class instances, like making new ItemStacks for setting items in an inventory.
And of course, study by reading other people's code. There are a ton of threads in this forum you can consult for reference; you might be able to find whatever problem you want to solve by just searching this forum.
Ah, I forgot step 0. You will want to set up a proper development environment. Learning theory does no good if you cannot play with it in practice.
https://learn.microsoft.com/en-us/minecraft/creator/documents/scriptinggettingstarted?view=minecraft-bedrock-stable
After setting up the development environment, you'll want to start with doing something specific. Some easy ones I recommend are applying effects to all pigs every so often, and damaging the player when they begin sneaking.
starter template js npx create-mc-bedrock
To be honest, the #1067535712372654091 needs a cleaning. It has become a mess. And now it's hard to find the most useful resources. Posts such as a Item Database is too useful. Why not pin them? Also deleting the posts that accidentally go for ask help in the channel in the resources channel.
Sure
Well, is it possible to only lock and close them? Why not delete the posts
all the help threads should be deleted
I mean.. sorry if I said something wrong bcz I am not a mod. But locking the post just remains the forum channel, deleting could be a best choice?
I mostly see them only being locked
well thats not a channel for help anyway
list them in one msg
ah mb ok
https://discord.com/channels/523663022053392405/1366759085839749170
https://discord.com/channels/523663022053392405/1360331298727530507
https://discord.com/channels/523663022053392405/1367296158283862087
https://discord.com/channels/523663022053392405/1363173198836928543
https://discord.com/channels/523663022053392405/1362376530302599328
I couldn't link up much, my phone is lagging lol
https://discord.com/channels/523663022053392405/1367381731409264640 π lol joke post
https://discord.com/channels/523663022053392405/1357424091015024782
https://discord.com/channels/523663022053392405/1351692717004034088
https://discord.com/channels/523663022053392405/1346266789960618066
https://discord.com/channels/523663022053392405/1337741893152280697
https://discord.com/channels/523663022053392405/1275559013274353807
These too
Also hey. I don't know if this is kindof promoting of someone's work, But this is too useful for y'all. Can you pin this resource?
https://discord.com/channels/523663022053392405/1252014916496527380
It's sometimes hard to find the useful resources in a thousands of posts
uh not sure about that
Alr. No problem no need pinning it
name your posts better
discord search is shit, but you can add some keywords to your title
that may help
maybe we can have a single channel that reference good stuff and no one can chat in it
i mean post
good idea but really idk
https://discord.com/channels/523663022053392405/1378816381776171010
https://discord.com/channels/523663022053392405/1371942914229272728
https://discord.com/channels/523663022053392405/1367605702415351962
https://discord.com/channels/523663022053392405/1370875256545214514
https://discord.com/channels/523663022053392405/1367983150504083599
https://discord.com/channels/523663022053392405/1360975398720110854
https://discord.com/channels/523663022053392405/1357610959501262890
https://discord.com/channels/523663022053392405/1294597637387059262
srry I think I didn't link these :3
ahhahahahh I found some other useful functions I needed while searching for junk post lmao
i think deleted all of them
does anyone know the standard things bots check on xbox profiles to mitigate crashers?
if i missed any let me know
does async work with scrip api?
yes
let's gooo
world.afterEvents.playerBreakBlock(async (eventData) => {
await system.waitTicks(1);
})```
example of using async in events
thanks π
i have code that checks for entities in runInterval however i have a function which processes those entites and uses system.waitTicks(); my problem is, how do i wait ticks inside runInterval? or just are there other ways of accomplishing this?
also, i need to have the function constantly running
Moved methods StructureManager.placeJigsaw and StructureManager.placeJigsawStructure from beta to 1.19.0
So does this mean that Jigsaws are stable now?
From the Bedrock Update 1.21.80 in May
I think you already said what you need to do, just put that inside runTimeout, which you want to delay, inside runInterval. Don't worry it will be constantly running, just the code inside runTimeout will run a bit later each ticks
tysm
I could be wrong so You should try it testing out, and also use runTimeout instead of await system.waitTicks or do .then() maybe
k
That's such a smart idea.
Pinning a channel where all the good resources are briefly explained and the link to it.
TYSM it works, thank you
@wary edge what u think ? ^
yeah like a Categorized Index that would be much more helpful
on molangVairableMap, what does setVector3 does?
is just a vairable that a particle can read?
YES
One major con to that idea. Who is gonna maintain that and how long until they slack off on it? Manual labor becomes a burden over time.
People that there work didn't get included there will just fell like there work was a waste of time
hmm
I only brought it up because it's a common practice I see on xda-developers and although it can be nice and convenient to have a central location for finding stuff, maintenance was not pleasant and it was only a matter of time until it died off and was no longer being managed.
Many people can edit the post text if it is sent via a webhook or bot.
con mentioned? π
I want to know more context, are you talking about #1067535712372654091 being dogsh*
I don't think that much stuff is bad in there, but i don't really check them daily
Unfortuantly there isn't a balance between writing good quality code and letting everyone post whatever they want.
We used to maintain a GitHub repo that lets everyone with a GitHub account share their high quality code, but the entry requirement was a bit too strict and no one contributes now.
Second solution is to let everyone here post whatever they want in #1067535712372654091, and now people are complaining most resources there aren't useful.
there are good stuff tho
we should've had a repo that does this for minecraft addons instead lol
hmm
To me, it's neither here nor there. I just use the search bar. I was more or less giving my input about my thoughts pertaining to an idea shared by WavePlayz based on personal experience.
the search can be weird sometimes tbh, it try to give you words close to your search and don't prioritize the words themself
people should just keep track of good posts in a text file or a private server
discord search is shid ngl
hmm, how can i detect something using percentages?
like %50
-# im trying to detect the players health using percentages instead of numbers
(Current value / max value) x 100
yeah discord's search feature is absolute shit, imo a curated list of resources as well as #1067535712372654091 could be good
have a list that has like "verified" resources that you should look through first, and then if you can't find what you need there then you could checkout script-resources
const eHealth = currentValue / maxValue * 100;?
that gives you their health percent
good ig
also,
how can i detect the thrown potion? like detecting the instant health potion
Projectile
is there anything in the file?
yes
what's the entry set to in the manifest
index.js
Every time I zip a file and send it to the computer, the game doesn't detect it
Why does it not detect it?
do you mean to make smth like awesome-addons?
What's the best way to add orbital player spectating? It would be used on a realm to have an orbital camera following any player on the realm. Do I need to get the viewing player's character to follow, or can the camera go to chunks loaded by another player?
Orbital camera code requires a bit of math to do but there are resources online that already have it written. As for going into unloaded chunks, no, you need to tp the player to the other player they're currently spectating in spectator mode or something
Chunks only load around the local player, other players cannot see another player's loaded chunks.
Alrighty! Thanks so much I'll give it a go
Oh, would it be like, really simple to just show exactly what the other person sees, like copy their first person instead?
Hi
I have a bug I don't know how to fix
[Scripting][warning]-Error showing main menu: ReferenceError: Native function [ActionFormData::show] does not have required privileges.
Try wrapping it around system.run maybe
detecting the potion type is beta right?
its beta, but if you need it stable i got a resource to do it https://discord.com/channels/523663022053392405/1363509866081292509
Anyone know how to get js errors to map to ts
Why does my script file not work in bds server? I added the file to development_behavior_packs and added its uuid to the world behavior_packs.json and the bds/valid_packs.json. but it still doesn't work. I even added an intentional error but it doesn't show
Is there any tutorials on how to use custom components Version 2?
Thanks!
New version just dropped and I assume just switching 2.0.0-beta to 2.1.0-beta is the fix?
Can there not be an implementation to automatically work on update?
that would probably result in people forgetting about the dependency and never updating the version from beta even when APIs become stable
Like, on a realm, it's a pain to switch over packs when lots of people want to just hop right in to the new update. It'd be ideal if a pack could have a backup dependency which can be the new version when it's ready.
Dont use beta.
So you add 2.1.0-beta to the manifest, and it switches when the realm restarts for the new update
Beta is just so much better
yo guys
how do i make this work backwards
i want it to only appear for those without the tag
if (player.hasTag("r:3:Β§eREBORN")) form.button
if (!player.hasTag("r:3:Β§eREBORN")) form.button
thanks
const defaultRank = "Β§7Member"
world.beforeEvents.chatSend.subscribe((data) => {
const currentRank = data.sender.getDynamicProperty("rank") ?? defaultRank;
const message = data.message;
world.sendMessage(`Β§8[Β§r${currentRank}Β§rΒ§8]Β§r <${data.sender.name}Β§r> ${message}`);
data.cancel = true;
})```
What changed
worked like 20 mins ago
update broke it
beta api on?
nope
lol
thanks
i thought everything that was beta in the previous version became base in the next
wait does getState() still exist? i dont see it
how do u make a command without namespace
Namespaces are needed for add-on compatibility
If the name of the command without the namespace is not in use, an alias for the command will be registered e.g. /example:command can be written as /command
You shouldn't use the version without the namespace outside of chat
but how do i unregister the one without the namespace
you can't
bro this is so scuffed
Where are the patch notes for going between 2.0.0-beta and 2.1.0-beta? Looks like setGamemode changed
anyone know whats up with transferPlayer after the nethernet thing was added
@granite badger Idk how u update ur docs so fast but thank you mate
Legend
To get your pack working you have to copy the main UUID from the behaviour pack and then find the world_behavior_packs.json file inside of your world folder and add the UUID in there following this format:
[
{
"pack_id": "PASTE_UUID_HERE",
"version": [1, 0, 0]
}
]```
Is anyone else getting the problem of where you cant jump and you float while walking. this new update?
hi, someone knows how to update this piece of script, it has not been working since the last update.
I found the line of the patch note but I canβt find the solution
@minecraft/server-admin Updated transferPlayer to support NetherNet transfers. It now takes either a hostname/port combination or a NetherNet ID
system.runInterval(() => {
let allPlayers = world.getAllPlayers()
allPlayers.forEach(p => {
transferPlayer(p,"my ip", my port)
});
})
transferPlayer(player, {
hostname: "",
port: 1234
});
ok thank's you, it's worked
well, i think i should wait for it to be stable, to provide more downloads
I try not work
Well that's how that would work.. if form.show() requires privileges then you do system.run(() => form.show())
hmmm, is it possible to make a sound playing and only one specific player can hear it?
just like music or something
player.playSound
so none will ever hear the sound beside that player,
right?
good, ig..
anyways
hey @distant tulip can you just disable the custom select widget by default. it mostly doesnt work, and is very annoying
uhh I think I found a bug in the latest scripting
So many issues with "stable" in vv
I just flattened all the custom components, but now all my blocks have missing textures.
in my editor?
alr, i will see what i can do
should be done
Anti-dupe with scripts is now better with 1.21.90
yeah, there's a permission level enum thing with scripts
I have no idea why it work only some times
I will look into it later, gtg to sleep
Hmm try this,
system.run(() => {
try {
transferPlayer(player, { hostname: ip, port: port });
} catch (error) {
player.sendMessage(`Β§cTransfer failed: ${error.message}`);
return {
status: CustomCommandStatus.Failure,
};
}
});```
See if this helps
I got it fixed
Is there actually any way of enabling experiments on servers without having to move the world to your game and then back?
Trying to enable the Beta APIs but it can be a pain to keep moving worlds back and forth to servers
yea as i use hacker keyboard which has control keys the custom, so widget is of no use
i can now assign enum with permission?
everyone can use /myCommand
but operators can use /myCommand edit
like that?
should work now
there is a bug as i mentioned above
i might just disabled it and suggest that keyboard, tbh, it is kinda bad
thanks for the feedback
no
mojang screwed up fake chat commands
?
world.beforeEvents.chatSend.subscribe((eventData) => {
const player = eventData.sender;
switch (eventData.message) {
case "!gmc":
eventData.cancel = true;
player.runCommandAsync("gamemode c");
break;
case "!gms":
eventData.cancel = true;
player.runCommandAsync("gamemode s");
break;
default:
break;
}
});
what happened
some error with 'subscribe'
[Scripting][error]-TypeError: cannot read property 'subscribe' of undefined at <anonymous> (lootgamerule.js:3)
[Scripting][error]-Plugin [Minecraft but I get a random item every minute - 1.0.0] - [lootgamerule.js] ran with error: [TypeError: cannot read property 'subscribe' of undefined at <anonymous> (lootgamerule.js:3)
]
what is it now?
do you know?
does beforeEvents.chatSend exists?
wierd
used to
check world variable
also what script version?
ahh nvm i figured it out
what was the issue?
i'm not using 2.1.0-beta
lmao
Debug result for [code](#1067535608660107284 message)
transferPlayer now disabled on realms?
how did you fix it?
yes
You said you found a workaround, what is it?
i did?
not on realms
Are you using 2.0.0? Or perhaps its only for 2.1.0
damn.. they're trying super hard to not allow players to join via realms huh?
it's there already. I put the version as the version of the manifest and uuid of the manifest
How do i install npm packages into vscode?
You use the terminal....
idk
how do i install it, i want to get auto complete for my scripts