#Script API General
1 messages · Page 10 of 1
why player["cooldown"]? what's that?
Meh, i actually just test whatever i see possible
It's like if undefined, assign 0
There's a calling for it, cant remember
temporary property
it removes when you leave the world
entity[entity.isValid() && "kill"]?.()
how do you use it? like the process of using it?
first you just define it like player['yeet'] = 0
Player/Entity object is a permanent object script-running wise
or whatever value you want to use
and then you use it anywhere
wait i was replying on wrong message
In runInterval, events as long as it's in same script pack
The "new" property that's attached to the object remains
Topic's prob object assignments
can you acces that like an array like
player.yeet?
oh cool huh
real quick whats the code for damaging a tool/weapon
itemStack durability component
.damage
itemStack.getComponent("durability").damage + 1 ?
Yes, but don't forget to update that item in that slot as well
thank you i have solved it
Its an assignation to the new property too
So the next time you "ask" for "cooldown" property it will be 0 instead of undefined
const test = {}
test.name??=5
if test doesn't have a "name " property create it and assign 5 to it
Oh , hmmm
&&=
||=
??=
I know but , will u assign getDP ?
There is a time and place for different things. You have to use common sense.
My common sense tells me ??= Shouldn't be used on getDynamicProprety
Nobody used it on that, except you for an outrageous example lol.
huh?
you can't use it with functions property
player.getDp(key)??=0 will throw error
Haha
how can I get player scoreboard?
Do you mean, all player objectives that players have?
Or a single score value
There are only objectives
Scoreboards are objectives shared between players
single
I did use titleraw to display it but I dont know other way so im asking
like displaying it to a form
does anyone have custom loot table that calculates the looting enchantment, and drops in an entity is killed?
i want more control but want to see if anyone has one first
in js
im hoping for a premade class
if not ill have to make it lol
Did you search in the channel? #1067535382285135923 ?
taking a look
I'm trying to use the itemUseOn event using a custom item but nothing is happening when I try to use the item. Is there something I need to do to the item so it can be used on blocks?
Do you have the use modifiers component for your custom item?
Don't think so. Is that all that's missing? Also, what would be the best values for an instant use item?
0.1
For both of the parameters (movement_modifier and use_duration)?
world.scoreboard.getObjective('insert').getScore(Player)
I've added use_modifiers and use_animation components to my item but it's still not working
Might still be an issue using rawtext, so use native getScore methods for now and put it in form
is there a way to check if a player/entity has an item in its inventory via scripting?
Yes, get the inventory component
does that always exist even if not defined in the json?
no
only the ones that have any kind of inventory
How do I stop this error from appearing:
[Scripting][error]-LocationOutOfWorldBoundariesError: Trying to access location (-2.0, -65.0, 1.0) which is outside of the world boundaries. at checkBlocks (treasure_detector.js:63)
at <anonymous> (treasure_detector.js:86)
where are you putting the locations at?
Add tickaeea
Add tickarea then delete it
Or use tp command
Or summon command
They both will work in this situation
It depends on what u are trying to do
if (dimension.heightRange.min <= y) continue
Show code if u may
I've put my script file up
I'll try that now, thanks
Wait
Not yet
I need to add thing
if (block.below(i -1).location.y === 64 ) break theloop ;
nextBlock = block.below(i);
Couldn't i break the for loop if it detects the final bedrock layer
theloop : for (let i = 1; i <= searchDistance; i++) {
@grave thistle
Now u see ur loop of check block
Add
theloop :
For it
Hmm ?
U can also break the loop if i === 65
I don't think it will work
Because y will change
@grave thistle
function checkBlocks(searchDistance, detectArray) {
if (entity.getBlockFromViewDirection({ maxDistance: 7, includeLiquidBlocks: false, includePassableBlocks: false }) === undefined) return;
if (detectArray.includes(block.type.id)) {
console.warn(`§a${block.type.id} detected!`);
return;
}
theloop : for (let i = 1; i <= searchDistance; i++) {
let nextBlock;
let bSide;
switch (bFace) {
case "North":
nextBlock = block.south(i)
bSide = "south";
break;
case "East":
nextBlock = block.west(i);
bSide = "west";
break;
case "South":
nextBlock = block.north(i);
bSide = "north";
break;
case "West":
nextBlock = block.east(i);
bSide = "east";
break;
case "Up":
if (block.below(i -1).location.y === -64 ) break theloop;
nextBlock = block.below(i);
bSide = "down";
break;
case "Down":
nextBlock = block.above(i);
bSide = "up";
break;
default: break;
}
if (detectArray.includes(nextBlock.type.id)) {
console.warn(`§a${nextBlock.type.id} detected ${i} blocks ${bSide}!`);
break;
}
}
}
if (hItem.type.id === "bbb:basic_treasure_detector") {
checkBlocks(20, bDetection);
} else if (hItem.type.id === "bbb:advanced_treasure_detector") {
checkBlocks(40, aDetection);
}
})
Change ur check block function with this one
The subtext behind this error: y=-65 is beyond the world boundaries.
Wait damn
Ensure y never goes below -64
for (.....) {
try {
switch (... ) {
}
} catch { continue }
} ```me when lazy
Yes i put 64 instead of -64
Use this
This will fix ur error
It's good, i managed to fix it. Thanks for the help, it opens my eyes
U welcome
can anyone see why hasTag and .includes are spitting out false? js const itemTags = item.getTags(); const itemId = item.typeId; world.sendMessage(`tag1: ${JSON.stringify(itemTags)} tag2:${potion[0].tag}`) world.sendMessage(`${item.hasTag(potion[0].tag)} `)
oh wait
yeah nvm idk
how can i make a command -ban with script
even itemTags.includes()?
that's the only way I got it to work
Intriguing, is anyone else having issues with the durability component?
system.afterEvents.scriptEventReceive.subscribe((eventData) => {
let s = eventData.sourceEntity
.getComponent('equippable')
.getEquipment(EquipmentSlot.Mainhand)
.getComponent('durability').damage;
console.warn(s);
});
If I substitute damage withi typeId it outputs minecraft:durability, but with damage it says fail to get property
when i click on the submit button with no info in the textfield i still get given a tag?
function add(player){
const add = new ModalFormData()
.title("create a name")
.textField("", "type here")
.submitButton("agree to name")
.show(player).then(r =>{
const input = r.formValues
if(input){
player.addTag(`rank:${input}`)
player.sendMessage("you have created a name")
} if(input == "") {
player.sendMessage("you did not type a name")
} else {
player.sendMessage("you did not type a name")
}
})
}
use input.length > 0
for the 2nd if statement?
hello
hey
Remember input is not a string, its ALL the formvalues, since there may be more than just one
So its an array
Thats your issue here
@glacial widget did u really learnt js ☠️
yes
only the basic stuff like data types, objects, arrays and etc
am still learning man
he's learning js, he just not used in reading the docs yet
I don't mean
I mean like something in the native language
Like using arrays methods on string
Etc
nah he must be just using other's examples, form samples are everywhere in here
People don't become experts overnight. Humble yourself, or you might find someone here asking you the very same question.
😜
How do I see if a mob has any components?
Documentation for @minecraft/server
1.15.0-beta ?
What is more optimized, a Boss entity made mostly in scripting or in json? In scripting it is better since it is more free, but for example to activate attacks I would have to define conditions in a runInterval, so I don't know if it is better optimized like this or in json.
In json on the other hand, it might not be better and more expensive to make and it doesn't always work the way I want, but maybe it's worth it as it's more optimized (?
Is it possible to check a custom component?
or just vanilla?
No
Can we trigger something when a player tries to equip an item/block, that is not normally equippable, in the head slot?
Like this, on stable API?
No
Unfortunate, thank you
?
Is there a component that if I hit a mob with a certain item, it won't cause damage to the mob?
Thats a #1067869022273667152 question. But to answer youll need damage sensors likely
I thought it was here, because what I'm doing is with scripts, and this involves vanilla mobs too
well we can't cancel damage with scripts yet, so our other possible choice is damage sensors
too bad it only applies to that specific entity with the sensor though, so you can't cancel all damage without modifying every mob to have those sensors
Well when yiu say component it usually means json
This is sad, so for this to happen with vanilla mobs do I need to edit them too?
yep
that's sadly the other option
if only it was possible with scripts, we wouldn't have to modify any mob files
The runInterval is a lot of load for the game and I want to optimize my addon, but I need to activate script codes for my entity, I was wondering if it is more optimized to activate the script code with scriptevent in a loop from my entity with some timer or something similar or simply keep the runInterval?
how do i get player coords and facing
.location and .getViewDirection()
ty
Can we detect when a block is used rather than placed?
What does used mean?
Like placing, but without placing.
you mean minecraft:on_use_on ?
an interactable item?
ooh
like a goat horn?
basically right click but blocks
yes
minecraft:on_use
It does, but I need it to work on nothing
Not on something specific
Compare it to a snowball item, you can right click to use it
For blocks, right click means place
I need it to have both
does anyone have a good tutorial to start coding mc addons, ive looked around at quite a few but i feel more lost than before.
Did I not explained myself good enough? lol
Does itemuseon not get triggered when placing block? That wouldnt work either way
It does, I believe
What are you trying to do that warrants a block right click in air?
Nothing yet, just need to visualize it on my mind before anything
This is for the heads we talked earlier
itemUse
itemUse does not trigger when the block can be placed, itemUseOn does not trigger when the block can't be placed
but you'll have problems at spam entries on ItemUseOn if its being used on a place where an entity stands
how do i invoke a function in a js file from a json file?
Use script events. Invoke /scriptevent from your behavior file, then subscribe to the scriptEventReceive event (under system afterEvents).
Relevant documentation:
https://learn.microsoft.com/en-us/minecraft/creator/commands/commands/scriptevent
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/systemafterevents
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/scripteventcommandmessageafterevent
now this is weird
content log says theres no module found
even though there is one

oh crap no wonder, i moved the files instead of pasting it
god i dont like android 'security'
My intense scripting fun for the last 2 days... 85% finished results... https://youtu.be/d1jcFGT1cOw
I need to incorporate placement for buttons and for some reason setblocking a door doesn't stick..
I started this after seeing a tag convo in here and I wanted to actually grab the tags from the blocks themselves. I get the block one after set and the itemStack one... just tryna make sense of it all..
Anyways, learned a lot... and King/Kiro, this is why I needed that vanilla data installed...
Playing around with Bedrocks's Scripting API
I built this for myself as an exercise and so I can gather undocumented (or damn near impossible to find) information on blocks, like those dang tags.
I still need to add code for the placement of the buttons and for some reason the doors are not happy. There are other anomalies, but I will deal wi...
how to i make EntityFilter to check if there is any match in familes array instead of checking for exact match
- which is better,
for (const e of entities)orentities.forEach(e => {})
getEntities({families:["monster"]})
afaik for loop is better for performance
im trying to check whether the entity has family type of player or mob but having both doesnt work
danke
Here is something you can use to get an idea on performance.
const runBenchmark = () => {
// Create a large array of numbers
const arraySize = 1000000;
const entitiesArray = Array(arraySize).fill(0).map((_, i) => i);
// Create a large object
const entitiesObject = {};
for (let i = 0; i < arraySize; i++) {
entitiesObject[i] = i;
}
// Benchmark for...of with array
console.time('Array for...of');
for (const e of entitiesArray) {
const square = e * e;
}
console.timeEnd('Array for...of');
// Benchmark forEach with array
console.time('Array forEach');
entitiesArray.forEach(e => {
const square = e * e;
});
console.timeEnd('Array forEach');
// Benchmark for loop with array
console.time('Array for');
for (let i = 0; i < entitiesArray.length; i++) {
const square = entitiesArray[i] * entitiesArray[i];
}
console.timeEnd('Array for');
// Benchmark for...in with object
console.time('Object for...in');
for (const key in entitiesObject) {
if (entitiesObject.hasOwnProperty(key)) {
const square = entitiesObject[key] * entitiesObject[key];
}
}
console.timeEnd('Object for...in');
// Benchmark Object.keys().forEach with object
console.time('Object Object.keys().forEach');
Object.keys(entitiesObject).forEach(key => {
const square = entitiesObject[key] * entitiesObject[key];
});
console.timeEnd('Object Object.keys().forEach');
// Benchmark for loop with object (via Object.keys())
console.time('Object for (Object.keys)');
const keys = Object.keys(entitiesObject);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
const square = entitiesObject[key] * entitiesObject[key];
}
console.timeEnd('Object for (Object.keys)');
};
// Run the benchmark
runBenchmark();
ok nvm not in minecraft
You can still do that too.
but holy hell that is REALLY fast
console.time is in Minecraft?
in mc its like 4 times slower but it still has similar result ratio
as far as i know its not
The script would probably need to be slightly modified. I'm not sure if time exists.
theres a similar thing called Date.now()
Yes
We are limited to console.warn and error.... I tested almost all of them and a no-go
now that i think about it, can i do this with for loop? 🤔
no wait that sounds stupid to me
You should be able to get all entities and pass to it a parameter based on EntityQueryOptions to limit what entities you return as an array.
Then use the array for loop logic if speed is your concern.
hmmmmm ill try
const queryEntityLookup = world.getDimension("overworld").getEntities( { families: ["player", "mob"] } );
for (let i = 0; i < queryEntityLookup.length; i++) {
console.warn(`${queryEntityLookup[i].typeId}`);
}
Something like that I believe.
That's what the options are for. If the entity is a family type of Player or mob then it adds them to the array stored in queryEntityLookup.
All other entities are ignored.
for i loops is much faster than for of? is that real
let i = 0, length = myArray.length;
while (i < length) {
// code
i++
}
so it won't calculate length everytime
length property of array is part of the array object itself
It is not calculated each time you access it
so the debugger says theres nothing wrong with this, yet minecraft says there is??
const chestInventory = blockAbove.getComponent("minecraft:inventory").container;
const itemInFirstSlot = chestInventory.getItem(0);
const itemInSecondSlot = chestInventory.getItem(1);
if (itemInFirstSlot.typeId === "minecraft:coal" && itemInSecondSlot.typeId === "minecraft:iron_ingot")
i just did it with if (player instanceof Player) return;
itemInFirstSlot?.typeId
try adding ternary operator
just like this
thank you both
idk man just saw it on stackoverflow
idk
the benchmark didn't help either
Roughly 4 times faster.
The difference between caching length and not caching length on a for loop is so small, you won't really notice the difference.
However, caching object keys, that's an entirely different discussion. Major improvement.
This is a flawed benchmark though, when benchmarking performance you really need to perform each test at least 30 times and take the average. You'll start to see that the results are extremely variable.
You also can't assume that any results from V8 (node or Chrome) are going to be similar for Minecraft's QuickJS implementation, because they won't be:
For an array with 10,000 items, the difference between for (const val of arr) and for (let index = 0; index < arr.length; index++) is maybe 2% faster, where 2% is 1-3 hundredths of a millisecond.
Here I did a test where each method of iterating the array of 10,000 was performed 1,000 times and timed, then I repeated that process 30 times and took the mean and standard deviation of both sets of trials. Then I calculated the Z-score of the difference between the two methods and calculated the p-value. The results are actually so close that they are not statistically significant.
onTestStructureLoaded: tick:for test
[2024-08-04 07:06:12:225 INFO] [Scripting] Average time for ForOf: 1.04432 ms (Std Dev: 0.10629309498182997)
[2024-08-04 07:06:12:225 INFO] [Scripting] Average time for For: 1.0153400000000001 ms (Std Dev: 0.12040943925301076)
[2024-08-04 07:06:12:225 INFO] [Scripting] The difference in performance between ForOf and For is not significant (p-value: 0.89970)
onTestPassed: tick:for test
For an array of 1,000,000 elements, it does start to become statistically significant, but for is only about 14% faster than for of:
[2024-08-04 07:34:14:889 INFO] [Scripting] Average time for ForOf: 80.96600000000001 ms (Std Dev: 2.8134233631659797)
[2024-08-04 07:34:14:890 INFO] [Scripting] Average time for For: 92.01 ms (Std Dev: 3.093789038096312)
[2024-08-04 07:34:14:890 INFO] [Scripting] ForOf is about 1.14 times faster than For.
[2024-08-04 07:34:14:890 INFO] [Scripting] The difference in performance between ForOf and For is significant (p-value: 0.00100)
All of that to say... Almost nobody should be worried about the difference for anything other than a very large (>10,000-100,000 element) array, or until you actually see lag due to this. Use what makes your code easier to read.
I'm fully aware of everything you just said. Different engines may produce different results. Every time you execute a benchmark, the time for those benchmarks will also change. This is common sense. Regardless of what the results are, math is math and the objective here is to produce a baseline because working off of a baseline is how you properly determine real results.
So it isn't "flawed".
Sorry, the approach isn't flawed for getting a baseline, the only flaw with that benchmark is running it in the browser instead of Minecraft.
Didn't mean to sound rude.
Nah, I understand, and I get that. Hence why I shared the code. I'm aware that different engines can produce different times. I believe ConMaster even chimed in to let the readers know this by stating the loops are slower in Minecraft but the ratio is still about the same. So even though it's slower, we know the baseline and from that baseline a developer can take the best course of action.
The availability of that script also makes it possible for other's to do bigger stress tests as well 😀
does this work?
(item.hasComponentComponent("enchantable"))
.hasComponent("enchantable")
But
e
yeah im surprise objects is much slower than for loops, I thought it was much faster for huge databases
Take a look at this script. Has more data to show.
All of these things are almost exactly the same in terms of performance unless you have a million items in them.
But objects and maps are much, much faster for getting a value than doing a find on an array
Yes
I literally don't know what I am doing, but wanted to share this. This executes this two events in the same tick, and idk what is going on, but it works. And tell me, is this great practice? 😪
world.beforeEvents.itemUse.subscribe((e) => {
const player = event.source;
if(!player.myCoolItem.isEquipped) return;
system.run(() => {
const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
system.run(() => world.afterEvents.entitySpawn.unsubscribe(x1));
if(spawnEvent.entity) {
console.warn("ENTITY IS CREATED: ", system.currentTick);
somethingToExecuteWhenCreated();
};
});
});
system.runTimeout(() => {
system.run(() => world.afterEvents.entityRemove.unsubscribe(x2));
const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
console.warn("ENTITY IS REMOVED: ", system.currentTick);
const removedEntity = removedEvent.typeId;
if(removedEntity !== myCoolEntityToFilter) return;
somethingToExecuteUponRemoving();
});
}, 0);
});
i was learning game loops in scripting api, and was trying to mess with stuffs
@honest spear sorry for pinging, not a question though. I was just amazed and confused at the same time (idk literally know what to say). I was trying to create an event when fishing rod is used like casting and reeling, and don't know how to do it perfectly. But this worked, you were the one who also told me to create like this events inside another event before, since its possible but the problem with creating an event inside another event it doesn't execute in the same tick. But this one, does (in my experience).
yep, i was trying to like listen the event in the next tick, and stop trying to listen after that. (Sorry for my bad english)
nah its right when event occurs then your code is executed thats right
in programing events do executes/triggers your registered callbacks
Cool, i am glad it works
but is this a great practice though?
wait le me add formating
world.beforeEvents.itemUse.subscribe((e) => {
const player: Player = event.source as Player;
if(!player.myCoolItem.isEquipped) return;
system.run(() => {
const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
system.run(() => world.afterEvents.entitySpawn.unsubscribe(x1));
if(spawnEvent.entity) {
console.warn("ENTITY IS CREATED: ", system.currentTick);
somethingToExecuteWhenCreated();
};
});
});
system.runTimeout(() => {
system.run(() => world.afterEvents.entityRemove.unsubscribe(x2));
const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
console.warn("ENTITY IS REMOVED: ", system.currentTick);
const removedEntity = removedEvent.typeId;
if(removedEntity !== myCoolEntityToFilter) return;
somethingToExecuteUponRemoving();
});
}, 0);
});
i am on mobile and ts is not displayed
okay wait lemme fix it
Well there are some points that could be simpliefied and even work in more reasonable way
When you unsubscribe from event you dont need a system.run, its still same tick but unsubscribing in callback it self is more safe and works as well
so unsubscribing the event doesn't need to be called in the system.run?
world.beforeEvents.itemUse.subscribe((e) => {
const player: Player = event.source as Player;
if(!player.myCoolItem.isEquipped) return;
const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
world.afterEvents.entitySpawn.unsubscribe(x1);
if(spawnEvent.entity) {
console.warn("ENTITY IS CREATED: ", system.currentTick);
somethingToExecuteWhenCreated();
};
});
const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
world.afterEvents.entityRemove.unsubscribe(x2);
console.warn("ENTITY IS REMOVED: ", system.currentTick);
const removedEntity = removedEvent.typeId;
if(removedEntity !== myCoolEntityToFilter) return;
somethingToExecuteUponRemoving();
});
});
Well you should check the entity id you are targing in remove event bc same tick more entities could be removed
i thought it was similar to this functionality:
subscribing an event inside another event means calling the event to start listening, and unsubscribing means stops the listening of a particular event.
as I still don't know what events truly are (dumdum
).
world.beforeEvents.itemUse.subscribe((e) => {
const player: Player = event.source as Player;
if(!player.myCoolItem.isEquipped) return;
let theRightEntityImWaitingFor = null;
const x1 = world.afterEvents.entitySpawn.subscribe( (spawnEvent) => {
if(theRightEntityImWaitingFor = thspawnEvent.entity) { //Ya here is assign intended
world.afterEvents.entitySpawn.unsubscribe(x1);
console.warn("ENTITY IS CREATED: ", system.currentTick);
somethingToExecuteWhenCreated();
};
});
const x2 = world.afterEvents.entityRemove.subscribe((removedEvent) => {
if(theRightEntityImWaitingFor?.id !== removeEvent.removedEntityId) return;
world.afterEvents.entityRemove.unsubscribe(x2);
console.warn("ENTITY IS REMOVED: ", system.currentTick);
const removedEntity = removedEvent.typeId;
somethingToExecuteUponRemoving();
});
});
well you should also check what type of entity are you looking for in entitySpawn event
well assign is expression, and that expression is returning value that was assigned so i am just checking the assign results
noted, thanks for the time
sorry to bother
no problem thank you for pinging me
An event is essentially a way of one developer (Mojang in this case) telling other developers "We're going to run a bunch of code every time this specific thing happens." For example, every time an item is used by a player, the game is going to run a bunch of the same code. When you use the Subscribe method, you're telling the game "I want you to run this function along with the stuff you're running "
Yes
Sorry, that's for Yang
The subscribe method returns a token of sorts so that if you want to unsubscribe your code from the event, you call unsubscribe with that token and the game code will know to throw out and not call your code during the event anymore
in this api implementation its just same function instance no token in need
Sorry, I'm not terribly well versed in JavaScript, but you're right, since you can assign functions as variables, it's not a token, it's the actual function.
Thanks for the reminder ConMaster. 🙂
where can I report a bug? or is this called a bug? or a file a request
it's just MineraftEntityTypes.FishingHook doesn't match with the typeId of an entity.typeId
MineraftEntityTypes.FishingHook = "fishing_hook, meanwhile entity.typeId is minecraft:fishing_hook or is this intended?
I am using vanilla-data = 1.21.3
EntityTypes is available on minrcraft-server
thanks for this detailed info, didn't actually know this xp (i mean i know some subscribe or event listeners from c# but not that well)
but i want to use types
instead of typing the string
Yeah good practice, i forgot EntityTypes from -server is not a enum soorryy
It's a matter of whether using an object, map, or an array is appropriate. So depending on the circumstances and what may be considered best in the code will determine which method based on those circumstances is best suited for the task. Not all things can be treated as an object, not all things can be treated as a map, and not all things can be treated as an array. It's too complex for something to be that simple.
it's okay 
Whats a good way to run commands in a script without an entity
you probably should not run commands in script
but if you are forced to use them (no apis for that) in dimension there is runCommand
https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/dimension?view=minecraft-bedrock-experimental#runcommand
i need to use fill
You should avoid using Minecraft*Types
anyway ty
why?
do you like create your own Minecraft*Types? instead using from vanilla-data?
@fallen cape it worked ty
In mz opinion zou should avoid usage of vanilla tzpes bc they are not versioned in same way as native modules, also yoi can just type the string
oh okay, I was using jayly's vanilla types class / enums, and was lazy to add some new stuffs in it, and used the vanilla types instead. Although typing errors starts to popup, so that's that. Imma just not be lazy next time. Thanks for letting me know.
But of course this is just personal preferences
most typos in a message speedrun
*mz zou tzpes yoi *
main.js
world.beforeEvents.worldInitialize.subscribe(setup => {
setup.itemComponentRegistry.registerCustomComponent("psm:durability_fix", {
onBeforeDurabilityDamage(event) {
psm.fixDurability(event);
}
});
})
functions.js
export function fixDurability(data) {
const player = data.attackingEntity
const item = data.itemStack;
const drb = item.getComponent("durability");
if (player.getGameMode() == "creative") return;
drb.damage -= 2;
player.getComponent("equippable").setEquipment("Mainhand", item);
};
[Scripting][error]-ReferenceError: Native property setter [ItemDurabilityComponent::damage] does not have required privileges. at fixDurability (functions.js:6)
at onBeforeDurabilityDamage (main.js:8)
Can anyone tell me how to fix this?
I just created a custom component for that haha
You'll need to use system.run
Wdym?
On mobile so bare with me:
system.run(()=>{
//Your code
})
Also you dont need to do that
I got it, but what I want to know is what to put in it
https://github.com/SmokeyStack/adk-lib/blob/78d2a82db8b8e385fbca670c7d20f931f64e8532/experimental/scripts/item/registry/on_before_durability_damage.ts#L96 take a look at how i implemented it
How do I set 2 lore to an item?
I finally understand ;P
The custom component does not have permissions to modify these properties, but with system.run you can access them
How do I identify if I have 5 diamond swords in my inventory?
setLore(["line1","line2"])
loop through the inv
or testfor command with hasitem property
[36m<REPL0>.js[0m:[33m12[0m:[33m22[0m - [31merror[0m[30m TS2322: [0mType 'string[]' is not assignable to type 'string'.
[7m12[0m newItem.setLore([lore,mobName])
[7m [0m [31m ~~~~[0m
Need " ?
is lore variable an array?
can someone help me why is my script doing this:
that not a script thing
look like json ui problem
i dont think it is lol
bc everything else works but this
all im doing is switching what form is being opening via 2 tags lol
export function fixDurability(data) {
system.run(() => {
const player = data.attackingEntity;
const item = data.itemStack;
player.getComponent("equippable").setEquipment("Mainhand", item);
});
};
This is how I fixed the error for anyone who needs it...
data.itemStack returns the item before it was damaged and system.run grants change permission...
No more durability damage when attacking ;D
I want to do it so that when I have a tag, and have 5 swords in the inventory or slots, I execute something, per script.
yeah that will work
?
I put this
let lore = hand.getLore()
lore.push(§fID: ${entityHurt.id})
@winter plaza
world.getAllPlayers().forEach(player => {
const diamondSwordAmount = getItemAmount(player, "diamond_sword");
if(player.hasTag("test") && diamondSwordAmount >= 5) {
//...code
}
})
function getItemAmount(player, itemType) {
let amount = 0
const inv = player.getComponent("inventory").container
for(let i = 0; i < inv.size; i++) {
const item = inv.getItem(i)
if(item?.typeId === itemType) amount += item.amount
}
return amount
}
it should be a string
do
newItem.setLore([...lore,mobName])
Its a json ui issue
Not scripting or form things
okay but how do i fix it lol bc it shouldnt happen bc its not a chestform its an actionform
world.afterEvents.itemUse.subscribe(({ source, itemStack }) => {
if (itemStack.typeId == 'kingdom:gui') {
if (source.hasTag("Spawn")) {
MainMenu(source);
} else if (source.hasTag("Pvp")) {
test(source);
}
}
});
function test(player) {
new ActionFormData()
.title(`-=- Main Menu -=-`)
.body(`Welcome ${player.name},\nPlease select what you would like to do!`)
.button(`Go to Lobby\n[ Click to Warp ]`, 'textures/items/map_locked')
.button(`Money Transfer\n[ Click to Transfer ]`, 'textures/ui/trade_icon')
.button(`Claim Starter Kit\n[ Click to Claim ]`, 'textures/items/wood_sword')
.show(player).then((result) => {
if (result.selection === 0) {
player.teleport({ x: 0, y: 0, z: 0 });
player.sendMessage(`§2[§aSystem§2] Teleported to §aLobby§2!`);
}
if (result.selection === 1) {
MoneyTransfer(player);
}
if (result.selection === 2) {
Kit(player);
}
});
}
function MainMenu(player) {
let form = new ActionFormData()
form.title(`Main Menu`)
form.body(`§2Welcome §a${player.name}§2, Select an option below on what type of §aManagement§2!`)
form.button(`§2Warps`,'textures/ui/icon_steve')
form.button(`§aMoney Transfer`,'textures/ui/icon_blackfriday')
form.button(`§2Code Redemption`,'textures/ui/permissions_op_crown')
form.button(`§aPersonal`,'textures/ui/absorption_effect')
form.button(`§2Information`,'textures/ui/icon_setting')
form.button(`§cGo Back`,'textures/ui/icon_import')
form.show(player).then((result) => {
if (result.selection === 0) SelectWarp(player)
if (result.selection === 1) MoneyTransfer(player)
if (result.selection === 2) CodeRedemption(player)
if (result.selection === 3) PersonalMenu(player)
if (result.selection === 4) Information(player)
})
}
I told you is not an form issue its an JSON UI issue
okay but howd you fix it?!
it would be funny if you are using the same name herobrine used in chestForm
yh im using herobrines chestform?
what did he use?
avoid the title '§c§h§e§s§t'
Because json ui
thanks
For some reason i am trying to learn c++ , and everything looks great
Is that good ?
Or i m on the wrong way ☠️
how can I make an ItemStack with a custom item?
const bruhItem = new ItemStack("fe:dingus", 3);
c++ is a great language to learn
Does that not work? Whats the error?
I never learnt py before
So idk if that bad or good ☠️
It s like going to hell by ur choice
Don't need to learn Python to learn C++.
Yeah but
It s like start learning from easy and after that go to hardest possible
yes it works lmao im dumb
Did u make its json correct?
@amber granite dm's
i want to put a border of bedrock around the world, what could i do, to make it work
my biggest problem its that the world isnt loaded for when i execute a script that loads that border
How is the cooldown counted by the game? in seconds? in ticks? in minutes? Could someone explain it to me?
What does the docs say?
or send something that could explain
I don't know, where could I look?
The wiki or ms docs
I saw it in a complement, and I was curious about one thing, it uses if (cooldown == 47) { and I didn't quite understand the logic of this, because the number in seconds is a fixed value, if it is changed it won't work, in this case the value is "duration": 2.4 and I just checked the docs and it says to be counted in seconds, so when there is a cooldown = q 47 seconds it will be able to execute? but the duration of inactivity needs to be at 2.4 why? What is the logic between them?
We dont have any context of what are you saying
I'm sorry
Cooldown in json is in seconds.
ScriptAPi returns the ticks
Documentation for @minecraft/server
guys i have a problem. im trying to define a let variable to a existing object property value but it throws a error expecting ":" but i know that changes the property value
pls sent snippets
ok
let serverinfo = JSON.parse(world.getDynamicProperty("serverinfo"));
const player = world.getAllPlayers()[z]
const senderprofanity = serverinfo?.players?[ev.sender.id].profanity
const playerprofanity = serverinfo?.players?[player.id].profanity
So, for me to know exactly the values, I need to convert the ticks into seconds?
Sure?
can someone help pls
Thanks, that's what I needed to know, so now it makes sense for the value in the json to be different from the value in the script
Looks like the issue is the ?[]
Add a dot in between
Whats the latest @minecraft/server version for education editon?
i used the "1.4.0-beta" but it broke now?
what edu version are you on?
latest, 1.21.03
should be 1.12.0-beta, according to https://jaylydev.github.io/scriptapi-docs/1.21.0/
Did they remove DynamicPropertiesDefintion
Do the codes given by Chat CGT work?
if you know what are you doing
when i ask for any help from it i provide the structure for everything present in the idea
can getEffect return duration and amplifier?
what do i change this to?
to match that?
ChatSendAfterEvent is gone?
Well you are using really old version
it was renamed in newer versions
npm i @minecraft/[email protected]
it's in the docs...
was MinecraftBlockTypes renamed?
No, the enum can be found in @minecraft/vanilla-data. If you don't need it then just specify the block by string.
is @minecraft/vanilla-data a new thing?
like, how do i include it?
do i add it to the manifest in the BP
just use BlockTypes and filter by name space "minecraft:"
It's not an actual module like @minecraft/server. Don't need to include it in your manifest. You can get it by using the following command in the terminal of vs code, or any other terminal which recognizes NPM installed on your machine.
npm i @minecraft/vanilla-data
If you do that at the root directory of your folder where you work on your behavior pack it should create a new folder called node_modules. There you will see vanilla-data. Just move the node_modules folder into the scripts folder and from there you can import it directly from that path. It's that simple.
The node_modules folder including vanilla-data will have to be shipped with your behavior pack in order to import and use it. Otherwise, use strings.
Copying a lib fron node_modules sounds like a bad idea no?
That isn't what we are doing. Like I said, vanilla-data isn't an actual module. In order to utilize the enums and other bits it offers you have to bundle it. I just explained how to do it manually versus using a tool.
And if you still question it then know that Mojang designed it this way. So yes, it's intentional by nature.
If your node_modules folder already exists and is populated with other stuff, then just create a new folder at the root of your scripts folder. Call it whatever you like. Just grab the vanilla-data folder from the actual node_modules folder and copy it over.
Congratulations, you have successfully bundled vanilla-data.
According to the semantic version standard you cannot include that last line "-"
This is the second time they have had that error. I'm tempted to try it.
I'll try it in a while. I'm researching some computer technologies.
https://jaylydev.github.io/scriptapi-docs/meta/cdn-links.html#minecraft-vanilla-data-mirror here's a single file for vanilla-data
Oh. What does the competition come with? XD hello boss.
Competition?
I'm the guy who's studying to design an Android IDE that surpasses bridge at least in Android versatility.
i just botched it, it works now
Of course, colleagues who achieve great things, I must also make an effort.
It's not a competition, releax
Any particular reason you wnat to use that instead of using strings? For autocomplete?
Jaja It's not a competition, that was a joke. They are a great support, since I plan to do quite rigorous things with json schemas.
Ye
autocomplete
In VSC I don't know if there is auto completion of strings, that's why enumerators exist in programming.
I am aware
It's just comfort for the lucky ones. I just use the documentation and that's it xD
By the way, I'll be calmer now. I calmed down now, I don't know why.
Is any of these a class with static getters or just enums from importing using npm?
I'm pretty sure they're enums
I think you're asking if it's native? Since the internal structure is irrelevant, it is a black box for me xD
Oh sadge, i thought it similar to jayly's vanilla types
I had one but pretty outdated, I used it to modify things easily such as creating new methoda or whatsoever
That's why I was looking forward with just making it a class with static getters
I don't know if it's native, they said yes but I have to verify. In any case, just make a translation and that's it, it's added to our folder. Using BabelJs it is transpiled.
In fact, the original library is offered by Mojang, so it is always updated. In npm.
Simple, you don't even have to do it by hand, also if you want to save yourself the use of Babel then I have a translator for multiple scripting+web languages.
Hope they also gave us some enums xp
Like EnchantmentSlot for example, cause I don't like creating an extendedEnchantmentSlot enums
Okay, mine always have constraints
X.X
Make sure the path is correct.
can player's unique id change if the player re enters the world?
It shouldnt but @valid ice has experienced it once
The chances are low but never 0. Goes for everything in life
hmmm
i made a thing where players can summon a pet using an item
and the player tracks their own pet by checking if the entity has a tag of player's id
well ig i can keep this since it rarely happens
or... i could just use name instead of id
Name can be changed
ID
yeah im being too paranoid
-# EntityIsTamedComponent
it doesnt summon 'tamed' kind of pets
alr
If you have the stable (non beta) server module installed via NPM then it's likely your script in vs code is targeting that which would explain why it is reporting that this method doesn't exist. Remove the import at the top of the file, then manually type in the import again. When it shows a list of autocompletes look and verify if it shows two of the same type for @minecraft/server. If it does, then one is your beta and the other is stable, or some other version that doesn't actively have that method available.
This reason is why I actually do not like installing these modules globally. I prefer to install them locally to the project itself. It prevents this from happening.
wdym?
i installed them to the node modules folder in the project folder
(i already deleted and remade the node modules folder aswell)
When you type out:
import { world } from "@minecraft/server";
See if the list of auto complete shows two options for "world".
This?
Delete the line with the original import. Then retype it again.
I'm not at my computer or else I would share a screenshot to show you what I mean.
ok, did that
same issue
it is going for the node_modules one (if that helps)
Yea, I know the issue will still be there. The point of doing that is to verify if it's showing two versions of @minecraft/server in the list of autocompletes.
Only shows 1 @minecraft/server
Show screenshot.
You have to delete the entire line where you import minecraft/server. I literally see it above in the screenshot....
Execute this in your terminal:
npm list -g @minecraft/server
Confirmed. How are you installing it locally?
Is this happening in a Game Test?
i am updating all of our codebases to a newer script version
and i bumped the manifest and package.json up
did a npm install (after deleting the node_modules)
and now intellisesne / compiler fucks up
i have another project where it does all work
Hmm, try closing vs code and opening it back up after installing the NPM package through package.json. Could be a cache issue. That's happened to me a few times on Windows. Never experienced it on Linux though.
Otherwise, I'm slightly baffled by the circumstances.
Just did another restart and same problem
I trust your package.json is correct, but would you be willing to show it?
{
"name": "scripting-starter",
"version": "0.1.0",
"productName": "Minecraft TypeScript Starter Project",
"description": "Minecraft TypeScript Starter Project",
"private": true,
"devDependencies": {
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-cli": "^2.3.0",
"gulp-rename": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-typescript": "^6.0.0-alpha.1",
"gulp-zip": "^5.1.0",
"source-map": "^0.7.4",
"typescript": "^4.4.3"
},
"scripts": {
"enablemcloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-1958404141-86561845-1752920682-3514627264-368642714-62675701-733520436",
"enablemcpreviewloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-424268864-5579737-879501358-346833251-474568803-887069379-4040235476"
},
"dependencies": {
"@minecraft/server": "^1.12.0-beta.1.21.0-stable",
"decode-uri-component": "^0.2.2",
"prismarine-nbt": "^2.2.1",
"readline-sync": "^1.4.10"
}
}
Oh, I know what is happening haha.
Add this line below "dependencies":{}
"overrides": {
"@minecraft/server": "1.12.0-beta.1.21.0-stable"
}
{
"name": "scripting-starter",
"version": "0.1.0",
"productName": "Minecraft TypeScript Starter Project",
"description": "Minecraft TypeScript Starter Project",
"private": true,
"devDependencies": {
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-cli": "^2.3.0",
"gulp-rename": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-typescript": "^6.0.0-alpha.1",
"gulp-zip": "^5.1.0",
"source-map": "^0.7.4",
"typescript": "^4.4.3"
},
"scripts": {
"enablemcloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-1958404141-86561845-1752920682-3514627264-368642714-62675701-733520436",
"enablemcpreviewloopback": "CheckNetIsolation.exe LoopbackExempt -a -p=S-1-15-2-424268864-5579737-879501358-346833251-474568803-887069379-4040235476"
},
"dependencies": {
"@minecraft/server": "1.12.0-beta.1.21.0-stable",
"decode-uri-component": "^0.2.2",
"prismarine-nbt": "^2.2.1",
"readline-sync": "^1.4.10"
},
"overrides": {
"@minecraft/server": "1.12.0-beta.1.21.0-stable"
}
}
Still a conflict
You may have to restart vscode afterwards
even after a restart
Conflict as the error in your screenshot or conflict as in the method is still not available?
Remove ^ from 1.12.0 in dependencies.
Delete node_modules folder.
Install again.
I edited the JSON above to remove ^
finally
hi there, when the EntityLifetimeState get removed what alternative can I use to test if the entity is loaded? or there isn`t?
can the isValid() on entity be a replacement?
Yuh
.isValid() is one of the primary checks that should be used often. It's in Component, Entity, Block, etc
its possible to get the output of a runCommand? I want to get the output of the /locate command
idk if there is a function similar to locate structure in scripting
I dont think so
what does this mean
Unhandled critical exception of type 'StackOverflow' in behavior pack '§u§lIsland Generation' also
Usually that means you performed too many operations at one time. Something like a for or while loop with no proper exit condition
a stack overflow is usually caused by a recursive function without a proper base case
target.playAnimation('animation.mammoth.charge_start', {
controller: 'controller.animation.mammoth_charge',
});
Im a little confused on this. Cant i just use the controller instead of adding the animation.
"controller.animation.mammoth_charge": {
"states": {
"default": {
"animations": ["charge_start"],
"transitions": [{ "phase_2": "query.any_animation_finished" }],
"blend_transition": 0.2
},
"phase_2": {
"animations": ["charge"],
"transitions": [{ "reset": "query.any_animation_finished" }],
"blend_transition": 0.2
},
"reset": {
"animations": ["general"]
}
}
}```
From what I know, controller doesn't specify an existing controller to use. It specifies the name for a brand new runtime controller, in case you want to run multiple /playanimation or playAnimation() methods.
Where each state is the name of the animation
hmmm so would it be better to trigger this through the entity file instead of script?
If at all possible, yes.
Is there a better way than scripts to modify the block drop pool?
If it's not possible with loot tables, creating your own through scripting is the best way
Is it?
is it possible to damage items?
item.durability = durability
That doesn't exist?
You should use item.getComponent("durability")
of course
const durability = item.getComponent('minecraft:durability');
if (durability) {
durability.damage = selectedItem.durability;
}```
-
* // Gives a player a half-damaged diamond sword * import { ItemStack, Player, ItemComponentTypes, EntityComponentTypes } from '@minecraft/server'; * import { MinecraftItemTypes } from '@minecraft/vanilla-data'; * * function giveHurtDiamondSword(player: Player) { * const hurtDiamondSword = new ItemStack(MinecraftItemTypes.DiamondSword); * const durabilityComponent = hurtDiamondSword.getComponent(ItemComponentTypes.Durability); * if (durabilityComponent !== undefined) { * durabilityComponent.damage = durabilityComponent.maxDurability / 2; * } * * const inventory = player.getComponent(EntityComponentTypes.Inventory); * if (inventory === undefined || inventory.container === undefined) { * return; * } * * inventory.container.addItem(hurtDiamondSword); * } * ```
what do you want to set?
the "data" like data syntax at command /give @s item amount data
itemStack.data = Number```
We don't expose item stack's data field directly.
You can access the specific type of data via components: https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/itemcomponent?view=minecraft-bedrock-stable
We don't have all of the data available yet, but it's coming along 🙂
/**
* Represents a container that can hold sets of items. Used
* with entities such as Players, Chest Minecarts, Llamas, and
* more.
* @example containers.js
* ```typescript
* let leftLocation = test.worldLocation({ x: 2, y: 2, z: 2 }); // left chest location
* let rightLocation = test.worldLocation({ x: 4, y: 2, z: 2 }); // right chest location
*
* const chestCart = test.spawn("chest_minecart", { x: 6, y: 2, z: 2 });
*
* let leftChestBlock = defaultDimension.getBlock(leftLocation);
* let rightChestBlock = defaultDimension.getBlock(rightLocation);
*
* leftChestBlock.setType(MinecraftBlockTypes.chest);
* rightChestBlock.setType(MinecraftBlockTypes.chest);
*
* const rightChestInventoryComp = rightChestBlock.getComponent("inventory");
* const leftChestInventoryComp = leftChestBlock.getComponent("inventory");
* const chestCartInventoryComp = chestCart.getComponent("inventory");
*
* const rightChestContainer = rightChestInventoryComp.container;
* const leftChestContainer = leftChestInventoryComp.container;
* const chestCartContainer = chestCartInventoryComp.container;
*
* rightChestContainer.setItem(0, new ItemStack(Items.apple, 10, 0));
* test.assert(rightChestContainer.getItem(0).id === "apple", "Expected apple in right container slot index 0");
*
* rightChestContainer.setItem(1, new ItemStack(Items.emerald, 10, 0));
* test.assert(rightChestContainer.getItem(1).id === "emerald", "Expected emerald in right container slot index 1");
*
* test.assert(rightChestContainer.size === 27, "Unexpected size: " + rightChestContainer.size);
* test.assert(
* rightChestContainer.emptySlotsCount === 25,
* "Unexpected emptySlotsCount: " + rightChestContainer.emptySlotsCount
* );
*
* const itemStack = rightChestContainer.getItem(0);
* test.assert(itemStack.id === "apple", "Expected apple");
* test.assert(itemStack.amount === 10, "Expected 10 apples");
* test.assert(itemStack.data === 0, "Expected 0 data");
*
* leftChestContainer.setItem(0, new ItemStack(Items.cake, 10, 0));
*
* rightChestContainer.transferItem(0, 4, chestCartContainer); // transfer the apple from the right chest to a chest cart
* rightChestContainer.swapItems(1, 0, leftChestContainer); // swap the cake and emerald
*
* test.assert(chestCartContainer.getItem(4).id === "apple", "Expected apple in left container slot index 4");
* test.assert(leftChestContainer.getItem(0).id === "emerald", "Expected emerald in left container slot index 0");
* test.assert(rightChestContainer.getItem(1).id === "cake", "Expected cake in right container slot index 1");
*
* ```
*/```
```js
* test.assert(itemStack.data === 0, "Expected 0 data");
@minecraft/server line 3964, is this not item data?
wait a minute, i just realized that i don't even need data field:v
I'm not sure what cursed thing Discord did to that copy paste, but ItemStack.data was removed and is only usable in mojang-minecraf version 0.1.0, which is old and probably should not be used (or even looked at too much lol)
My typescript files must be very old then
"dependencies": {
"@minecraft/server": "^1.2.0"
},```
Hmm looking at the 1.2.0 types and I don't see that but I could be missing it
https://www.npmjs.com/package/@minecraft/server?activeTab=code
Try scrolling down to line 2493
Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.. Latest version: 1.11.0, last published: 2 months ago. Start using @minecraft/server in your project by running npm i @minecraft/server. There are 47 other projects in the npm registry using @minecraft/server.
I think a workaround could be done via getting the inventory find a empty slot then use /give command with the data value and set it to the empty slot and just get the itemStack like that to do any additional gametest on the item
is there like a general tag that all vanilla blocks would have?
hmm ok might have to do without the 2d cardinal
What are you trying to do?
well im trying to recreate my spine block. it has modified stair rotation with an extra direction sorta. it has up down and side similar to pistons but also has cardinal im just having an issue getting the side to place. i can toggle it on and off just not place it normally not sure why
Well that did not paint a visual understanding for me. You may want to start a post with a pics of what is working and not working and possible old block code. Is the problem in scripts or in the block code? When was it last working? Or is this recreation from an idea?
Fun Fact I learned yesterday while tryna make my Every Block add-on be able to place doors.... You have to place the bottem and the top door with the correct state codesJS else if (blockInfo.name.endsWith('_door')) { const topDoorBlock = BlockPermutation.resolve(blockInfo.typeId, { direction: 0, door_hinge_bit: true, open_bit: false, upper_block_bit: true }); const bottomDoorBlock = BlockPermutation.resolve(blockInfo.typeId, { direction: 0, door_hinge_bit: true, open_bit: false, upper_block_bit: false }); dimension.setBlockPermutation({x:blockInfo.xyz.x,y:blockInfo.xyz.y+1,z:blockInfo.xyz.z}, topDoorBlock); dimension.setBlockPermutation(blockInfo.xyz, bottomDoorBlock); } Which means just dimension.setBlockType(blockInfo.xyz, 'minecraft:<type>_door')no worky
Yes since it's two blocks
Kinda thought their code would handle it... like when I made my door... the bottom places it's own top.
but now that I think about it... they cannot do that... 🫠 Well I mean they can, but a setBlock can't activate a hardcoded event
Also.... buttons, setblock default is face_direction = 0.... so you have to set it yourself, if not the bottom of another block. But, when I set it to zero... it stayed on the bottom of air block. I am not sure how long it would have stayed in an impossible state, because I quickly changed the code to 1.
is it intended for custom block components to not work if they are only in permutations.
because Im trying to make only some states of my block have certain custom components.
I dont want all them to have it. This is only a concern because I dont want a state to use the randomTick or onTick.
It's from a block that used hfc for directions. And yeah I plan too if I can't get it tonight.
guys is source maps possible when your debugging with bundled code?
Never had this issue
Are you using preview?
because maybe this is a bug and its only fixed in preview.
can someone help
does anyone has an idea how to fix this issue?
I used this:
let { x, y, z } = player.getViewDirection();
player.teleport({ x: player.location.x - x, y: player.location.y, z: player.location.z - z });
You can put the custom component in a permutation, so that the only the states you want can use it. You can have more that one custom component, it is an array, I believe.
i dont think you understand what im saying.
im aware I can put custom components within permutations, the problem is I have to define it outside of permutations first for it to work.
within scripts, correct?
So an empty array makes ot work?
I have to define the strings first too
custom components are script related.
Perhaps start a post, post the code and tell what it is doing that you DO NOT want it to do.
...
I did
link
nvm fixed
Yes, you have to set it up though. Are you using esbuild and emitting source maps?
is this what i'm supposed to do to add a delay
system.runTimeout.prototype(1)
system.runTimeout(() => {
console.log("Hello World");
}, 20);
Does getDamageChance just not work anymore? How else would I get the chance
Works for me last I checked
All I get is this: [Scripting][error]-Error: Failed to call function 'getDamageChance' at <anonymous> (treecap.js:16)
What are you using jt on?
Meaning the entity isn't loaded
Thats not true but sure
Im getting the player's mainhand item's durability and trying to grab the damage chance
What item?
Const item
Ah it only works on wolf armour last i checked
Im just grabbing the item the player is holding
Mhm, did u define the i t e m...
Wow major spelling mistake
Basically have player.getComponent('equippable').getEquipmentSlot('Mainhand').getItem()
Could you try wolf armour?
Last i tried only wolf armour and the carrot/fungus on a stick works
That was 2 months ago though
Check OSS?
Been away the last few days
You may say, "well can't you check your phone when away?"
Not when out of cell service, I can't 
Why must you touch grass
I ask myself the same question
Untested old code, but this is what I did a long time ago and it worked durability.getDamageChance(item.getComponent('enchantable').getEnchantment('unbreaking').level)
guys is source maps possible when your debugging with bundled code?
Support us on Patreon: https://www.patreon.com/crackermilk
Follow us on socials: https://linktr.ee/crackermilk
Buy our MERCH: https://crackermilk.myteespring.co/
FACEBOOK: https://www.facebook.com/Crackermilk
TWITTER: https://twitter.com/CrackerMilk
INSTAGRAM: https://www.instagram.com/crackermilk
For business enquiries: connor.crackermilk...
Don't worry this is relevant to the convo
itemStack.getComponent("durability").damage += 1;```
and then you also need it to set it in the slot
put the number of damage after the +=
i tried generating them through webpack but it doesnt work
well it gets generated
but it doesnt get applied i think
hello, anyone having an "TypeError" with runJob?
This one never works:
system.runJob((function* () {
world.sendMessage("TEST");
yield;
})());
Here's my manifest:
{
"module_name": "@minecraft/server",
"version": "1.11.0"
}
Installed this:
npm i @minecraft/[email protected]
and tried this:
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
I am currently playing Minecraft v1.21.2.
It produces a "TypeError, not a function" error, tried a function that exist, and tried this, still leaving with this error.
you aren't supposed to call the generator function. Just put it without calling it
Calling it would otherwise, return undefined which is why "Not a function" came from.
wait imma try it
Argument of type '() => Generator<any, void, unknown>' is not assignable to parameter of type 'Generator<void, void, void>'.
system.runJob((function*() {
world.sendMessage("TEST");
yield;
}));
Still error
Even the example from the documentation doesn't work 
You need to add 3 arguments.
system.runJob((function*(a,b,c) {
world.sendMessage("TEST");
yield;
}));
i think, its the minecraft version im using or manifest or the api i just installed
what minecraft u using?
Latest stable version
Do this
That's just how it work
IDK why it's so goofy, and need 3 arguments for it to work.
(a=null, b=null, c=null)
ig... I never use typings xd
i think it's my npm version or somewhat minecraft/manifest stuffs
methods from beta is not recognized when running inside the minecraft, but is autocompletion from tsserver works
nah, here's what void is
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/void
like findClosesBiomes it doesn't recognize it
void is just undefined.
@sudden nest try this:
You need to add 3 arguments. call it and add 3 arguments
system.runJob((function*(a,b,c) {
world.sendMessage("TEST");
yield;
})(0,0,0));
okay
or this...
function* genFunc(a,b,c) {
world.sendMessage("TEST");
yield;
};
system.runJob(genFunc(0,0,0));
still errors
i mean i used runJob before, it can easily recognize generator functions
still not a functiona... thanks for helping though. I think i'll might think about this first
your manifest still with 1.11.0? even with:
npm i @minecraft/[email protected]?
here's my package.json
i used to have 1.1.0 for common, but still the function still not recognized
*cough* *cough* i code on a phone
i used to code on phone, now my phone cannot access with data/folder
have u tried this? Yang
If it doesn't work. You can just go with a custom runJob by making an asynchronous function and await system.waitTicks(1) after accumulating enough attempts
but the docs said it was 1.11.0
i think it's not going to work too, since that's a method from beta. But, it works now. Thanks!
Ah, then... you can use the system.runTimeout() sleep function that exists somewhere in this server xd
that was a weird scene i have encountered. The game doesn't even tell me to update my manifest it just doesn't work even with typescript
Oh, system.runJob is still experimental. Your typing probably thinks you're on the correct manifest version, that's why it's suggested those... Then it says "Not a function" in-game, and probably referring to the .runJob() within system.runJob()
Not the generator function fault. But the property itself returns undefined and is called as if it were a function
yeah my manifest is dumdum, not throwing any error
there's no 1.12.0, in the available version in the docs, idk if this exists, but i just turned my manifest to this
the docs has only this available versions:
weird
The docs always use the preview things.
Maybe it's stable in the docs, but it is actually still in the preview.
Is there a way to properly modify the loottable of blocks?
Vanilla Blocks? Nuh-uh
It's always this workaround: kill the dropped item & spawn the new one
If it works, it ain't stupid janky.
hi guys
Gega, can i dm u
I have 4% on my phone batteries don't expect a reply
I'll still send it, reply when u free
You need to return. Even if its nothing
Just bad types made from mojangs side imo
One question, what computer technologies do you use? I'm collecting technology for my personality.
I will be a full stack programmer, I am starting this whole complex world.
Jaja
Is there a vanilla behavior pack somewhere that includes things like all of the basic structures and their generation conditions so they can be properly edited? The normal one doesn't seem to include it.
Is that sort of stuff even changeable in the first place?
- They’re stored as nbt files only in game files.
- Pretty sure jigsaw blocks don’t work for us
Damn
So Bedrock dedicated server has the raw .NBT files included in its vanilla data BP, I'm not sure if creating a behavior pack with the same folder structure would override them in the regular game client.
But if not maybe replacing them in the BDS folder might.
thanks, I'll give it a shot
do have to say though, it's weird af how they store everything in this
Can't even find where the actual generation conditions would be, I'm guessing somewhere in the mess of NBT files, but I'm also guessing it's way too much work for me to actually figure out where for each one lol
guess I'll just scrap this
can I change particle size with script
{
"format_version": "1.10.0",
"particle_effect": {
"description": {
"identifier": "ct:box",
"basic_render_parameters": {
"material": "particles_alpha",
"texture": "textures/particle/particles"
}
},
"components": {
"minecraft:emitter_initialization": {
"creation_expression": "variable.size_x = 10;variable.size_y = 10;variable.size_z = 10;"
},
"minecraft:emitter_rate_steady": {
"spawn_rate": 400,
"max_particles": 400
},
"minecraft:emitter_lifetime_looping": {
"active_time": 1
},
"minecraft:emitter_shape_box": {
"offset": [-12, "variable.size_y-5", 12],
"half_dimensions": ["variable.size_x", "variable.size_y", "variable.size_z"],
"surface_only": true,
"direction": [0, 1, 0]
},
"minecraft:particle_lifetime_expression": {
"max_lifetime": 1
},
"minecraft:particle_initial_speed": "math.random(1, 4)",
"minecraft:particle_appearance_billboard": {
"size": [0.2, 0.2],
"facing_camera_mode": "rotate_xyz",
"uv": {
"texture_width": 128,
"texture_height": 128,
"uv": [16, 48],
"uv_size": [7, 7]
}
},
"minecraft:particle_motion_collision": {},
"minecraft:particle_appearance_tinting": {
"color": ["variable.color.r", "variable.color.g", "variable.color.b", "variable.color.a"]
}
}
}
}
this is the particle I already have the variable but idk if I can use it in the molang
nvm I'm dumb I got it
what is the solution of this problem ?
The dependency with the id is missing. 'ad 1ec4d2-96ef-44e6-905e-61024a7a1c09' version
'1.0.0'.```
can someone help me
i want to edit my mod directly from minecraft files but when I look the folders they are empty
empty
Two questions.
Question 1: Are you looking inside the correct folder for your particular world? (Assuming you have multiple saved worlds)
Question 2: Did you apply the behavior pack to the world? (Won't be there unless you do)
- yes it is
- yesssss and the mod work
idk why is empty
Then you must be looking in the wrong folder.
no bs yesterday worked
Is it a development pack or a normal pack?
what do you mean by development pack
In the development_resource_pack or development_behavior_pack folders
packs stored in folders with development on the name
then its a development pack
Dev packs are not stored on the world; they do not show up in the world files
oh
They show up in another folder.
?
ye
empty
If you're using the dev folders, you do not need to work directly from the world files (and it is highly recommended against anyways)
mmh okay
As for that empty folder... no clue
thanks anyway
How do I update the server api again? I tried doing it through vscode like last time and I got a crap load of fatal errors from node and no clue why
?
What do you mean by "updating server api"
@minecraft/server 1.11.0 -> 1.12.0?
Do you mean your, types module? (npm)
Latest NPM Types
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
Beta APIs NPM Types
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
Preview Latest NPM Types
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
Preview Beta APIs NPM Types
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
npm i @minecraft/[email protected]
Huh?
Yes?
isSprinting
read-only isSprinting: boolean;
Whether the entity is sprinting. For example, a player using the sprint action, an ocelot running away or a pig boosting with Carrot on a Stick.
You tried printing it constantly?
well no not really, but i tied it to an event that fires when the player attacks
well that's probably why it would only play once...
Has anyone used this?
https://stirante.com/script/server/1.12.0-beta.1.21.3-stable/classes/Trigger.html
Documentation for @minecraft/server
What does that do
Hi
I honestly do not know. At face value it seems like a custom logic for creating your own events which can be triggered under certain circumstances according to how you implement it.
But I would need to see an example because it just seems like something no differently than doing a condition check and calling a function if the condition meets.
Just happened to stumble upon it lol.
Bye
Might be something internal that was accidentally released, like https://stirante.com/script/server/1.12.0-beta.1.21.3-stable/classes/MessageReceiveAfterEvent.html was?
Trigger really does not seem to have any use that I can tell- unless its something for triggering entity-file events or something odd like that.
Not sure. Not at my PC to mess with it. Probably mess with it later though.
So mc server 1.21.0 is stable? Sweet I'm still on 1.12 beta apparently
In preview 1.12.0 is stable, and in regular mc, 1.11.0 is stable
do you have script for tree captitator
no
Lol
Ok cool. I thought it got updated I keep seeing something about it I might just be crazy
I am trying to make one, but i don't know how to get the adjacent blocks of a block.
like when you break one block, all of the adjacent blocks will also break at once.
Can you help me making it
@valid ice
I'm good, thanks
hey can someone tell me what's the typeId of eye of ender?
is it "minecraft:ender_eye" or "minecraft:eye_of_ender" ?
minecraft:ender_eye
tysm
Just use floodfill, it's easy to implement, make sure to make it not recursive imo, just go with a queue. Also, use runJob to for efficiency.
How do I set a dynamic property for a player when they first join the world? I only want it set once and not every time they join.
I have a UI toggle and want it to be set to the dynamic property - menu.toggle("test", entity.getDynamicProperty("initial_spawn")); - but the toggle is always false when first opening the UI
playerSpawn event -> check initialSpawn property -> check if property is undefined
using typeof or an explicit undefined bc false is also false
what does runJob do?
So if (e.initialSpawn && player.getDynamicProperty("initial_spawn") === undefined) would suffice?
should
I'll try that now
schedules an operation (in form of a generator) over multiple ticks if its too heavy for a single tick
It works now, thanks!
@wary edge "undefined" is the value of this item property, I set the value of the property to "true", but nothing happens.
Can you provide information that would actually be usable to help you? A video is only going to show that it doesn't work, but we want to know why it doesn't work.
ok, but please don't make fun of my code :(
const ready = e.itemStack.getDynamicProperty("ready");
system.run(() => e.player.onScreenDisplay.setActionBar(`${ready}`));
if(ready) {
e.itemStack.setDynamicProperty("ready", false);
const target = e.block.location;
const source = e.itemStack.getDynamicProperty("source");
e.itemStack.setDynamicProperty("source");
const minX = Math.min(target.x, source.x), minY = Math.min(target.y, source.y), minZ = Math.min(target.z, source.z);
const maxX = Math.max(target.x, source.x), maxY = Math.max(target.y, source.y), maxZ = Math.max(target.z, source.z);
const storage = new Map();
for(let i = minX; i <= maxX; i++) {
for(let j = minY; j <= maxY; j++) {
for(let k = minZ; k <= maxZ; k++) {
const block = e.block.dimension.getBlock({ x: i, y: j, z: k });
if(block && !block.isAir) {
storage.set(block.typeId, (storage.get(block.typeId) ?? 0) + 1);
}
}
}
}
const list = [];
for(const [block, quantity] of storage) {
list.push(`${block} (${quantity}x)`);
}
system.run(() => e.player.onScreenDisplay.setActionBar(list.join(" §7-§r ")));
} else {
e.itemStack.setDynamicProperty("ready", true);
const target = e.block.location;
e.itemStack.setDynamicProperty("source", target);
// system.run(() => e.player.onScreenDisplay.setActionBar(`§7source position set to §s${target.x} ${target.y} ${target.z}§r`));
}
Can you throw a world.sendMessage right after you pull the dynamicProperty... but come to think of it, what event is this or need to see the code before this.
help
import * as mc from "@minecraft/server";
import * as q from "./mission_list.js";
import { getScore, random } from "./all.js";
mc.world.afterEvents.playerSpawn.subscribe((data) => {
if (data.source.hasTag("in_mission")) {
inMission(data.source, q.Mission.list[getScore("missions", data.player)]);
}
});
function inMission(player, mission) {
//my code
}
world beforeEvents.
playerInteractWithBlock
Help with....??????
Is that a custom item? did you want to have it use Custom Components instead? And did you do your itemstack confirmation before this code?
- It is a custom item
- I didn't understand what you said
- yes, I did an if-case with the itemStack's typeId
Read the docs: https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/playerspawnafterevent?view=minecraft-bedrock-stable
There is no source, just player
Anyone know how I can get the item type an item in the world is? When I try to get it's typeId it gives me "minecraft:item", because thats what the entity ID is. (I want the string "minecraft:diamond" for example, from the item, if it were a diamond)
Get the item component from the entity
const item = entity.getComponent("item").itemStack
const id = item.typeId
Thanks I was trying this before but was missing the .itemStack at the end
You now have, and have had for a little while, the ability to add a custom component onto your item so that it catches the events for that item. So instead of using the generic, which still works, but you have to test the item for the correct one. Which you may have to do if you share your component with other custom items that do similar things... Either way, just something to consider which you may do when you learn more about it and want to refactor..
Anyway... what happens if you show the contents of that property right after you get it.
by the way, it is more convenient to have a help session within a post instead of a crowded room.
what dose these numbers mean?
the max spike i get in game is 17 ms
how did you made it work? i tried script profiling too days ago but it doesn't work for me
send your launch.json
Total Time is the amount of time that was spent in that function while you had the profiler on (including functions that get called from your function).
The self time is the amount of time spent in that function not counting any sub functions that it calls. Do from the time you started the profiler to the time you stopped it, 22.4 seconds was spent getting the .size attribute of containers.
thanks
How can i stop a system run interval from running once is fired
See clearRun it has an example. You will need to put your run in a var as indicated by the example, so you can use it to clearhttps://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server_1_12_0_beta.System.html
Yes. and can do a for loop with just the runTimeout where you multiply the interval by 20
and seeing how JS works, can make your own class to do this so you jus send parms.... LOL
how, tried that at first
much nicer than the stinky system.run() loops we had in the past 👍
i have a month understanding script api, so i dont really know how hard this was back then
welll 20 would need to be in a variable```
const x = 20;
for(let i=1.....)
system.runTimeOut...... ,i*x)
Oh
I do not know which is more efficient... but both work. Just preference. I like yours.
It wasn't terrible... just using system interval looks nicer overall.
mmm, i need it for loading blocks with tickingareas around the world, imma try the first one
I probably should upgrade my loops tbh
I forgot you can double up on the vars in for loop... I'mma have to go upgrade some stuff... LOL or not... later
It gets messy fast; I would not reccommend it 😛
I like messy and complicated.. make me feel sMart
What you see above is double-nested in timeouts on top of what is already there
It's... bad
Me and system.run.... are good friends now.. since I made a thing to place every block in the game, in a pattern 8 directions from where I am and it has to move me and get block information once placed....
I learned... all the (acacia) wood blocks, except one, have the block tag Wood

cause no info... so I figured, why not just see what it has myself... I made, with chat command, queriable info,. It was just a fun exercise.
Nice 👍
so only the sapling does not have wood tag?
as it should not... it is a plant
Makes sense
How'd you query the ID? Manually or automatic?
Or is that just the position of that item/block in the array you use?
Anyone have big projects I can look at? How they structure their project and If which is better:
CamelCase or camelCase, and also I feel anxious with longer function names or variable names since i haven't looked any big projects lately
Or even if it's not big projects just some tips
I always use camelCase for variable names, no real reason behind it other than I do
Just do what makes sense for you
From what I know it comes down to the person really
As it is both object oriented and whatever function thing I called.
I made a class to hold the block info, added a location it would be in and then a structure hold the blockInfo array
I looked Nox's Villager project, and find out reminds me of Java (i miss and hate java lol)
I use camelCase, but with file names I use snack_case
Unless you want people using your code for something I wouldn't worry
Even then it just has to be clear and consistent
Well, it's PascalCase vs camelCase
That's th eproper term
I kinda want to blend my typing cases with scripting since I don't like inconsistent stuffs
I just recommend following the standard JS naming scheme
can we tell if a player is an operator with scripts?
Remember when I was conflicted about using a class... well this is what I decided and it occurred to me I can use the file.js like a class... so methods and data are hidden.```JS
class BlockInfo {
/**
* @param { import("@minecraft/server").Vector3 } location
* @param { number} index
* @param { string} key
/
constructor(index, key, location) {
this.index = index,
this.inValid = 0,
this.displayGroup = 0,
this.key = key,
this.typeId = MinecraftBlockTypes[ key ],
this.name = this.typeId.split(':')[ 1 ],
this.isAir = false,
this.isLiquid = false,
this.isSolid = true,
this.hasTags = false,
this.tags = [],
this.y_offset = ['cactus','waterlily'].includes(this.name) ? 1 : 0,
this.defaultStates = {},
/
button: facing_direction Fix LATER
*/
this.xyz = location,
this.isStackable = false,
this.maxAmount = 1,
this.hasItemTags = false,
this.itemTags = [],
this.placed = false;
}
x = () => this.xyz.x;
y = () => this.xyz.y;
z = () => this.xyz.z;
}
const vbKeys = Object.keys(MinecraftBlockTypes)
//.filter(k => { true })
.filter((k) => { return !k.startsWith("Chemistry"); })
.filter((k) => { return !k.startsWith("Chemical"); })
.filter((k) => { return !k.startsWith("Element"); })
.filter((k) => { return !k.startsWith("InfoUpdate"); })
.filter((k) => { return !k.startsWith("Reserved"); })
.filter((k) => { return !k.startsWith("Unknown"); })
.filter((k) => { return !(k.startsWith("Hard") && k.includes("Glass")); });
//==============================================================================
const vanillaBlocks = {
initialized: false,
blocksInGround: false,
baseDimension: world.getDimension("overworld"),
baseLocation: { x: 0, y: 0, z: 0 },
blocks: vbKeys.map((k, i) => {
const info = new BlockInfo(i, k, { x: 0, y: 0, z: 0 });
return info;
}),
count: () => vanillaBlocks.blocks.length
};```
How long is the fix later gonna stay there?
Okay, I'll look into it thanks
this doesn't exist.
it's neither a method nor a property for the player class
https://stirante.com/script/server/1.15.0-beta.1.21.30-preview.21/classes/Player.html#isOp And yet...it does
Documentation for @minecraft/server
ah, so it's gated behind the beta api of the latest beta, that's why i couldn't find it.
I mean...checking if a block isAir seems pretty simple and yet its still experimental...we love spaghetti codebase
Has anyone tried working on a actual block id/item id to texture path converter?
You are meaning the beta API version?
Whats the difference between runCommand and runCommandAsync
There's probably some out there, it shouldnt be hard
Async allows you to wait for a command to finish
i believe @inland merlin did
Oh ty
Ive done it, however It just somtimes dosnt work, for some weird items
And custom items that a realm owner might have woudnt be supported.
Is there a work around for that?
just edit the odd ones, and give namespaces to the custom items
I believe it's still broken when used in a Realm. It's inconsistency due to the complex permission system Mojang currently has implemented makes it unreliable right now.
What?
like change bow_standby to bow here
Im using the resource path texturelist to have them automatically generated
@woven halo has custom made 3d item textures for the blocks for chestform
i am saying you would need to edit the odd ones manually
I want to create a system in which such a action isnt needed
That would be nice
@mystic mortar Has mentioned that he is working on an automatic system for conversion

Hmm, well who ever does it first wins
good luck converting potion_bottle_moveSlowdown slowness_potion
The best I can think of would be using python or similar to set the shift variable based on a file count in the items folder
It can be doen with Js and just
https://github.com/Mojang/bedrock-samples/blob/main/resource_pack/textures/item_texture.json
https://github.com/Mojang/bedrock-samples/blob/main/resource_pack/blocks.json
However not all of them have the correct texture
I have a question, even if you only add the tickingarea to just a block, the whole chunk its added to the tickingarea?
One operates synchronously and the other asynchronously.
It's like counting from 1 to 10 and with each count you had a job to do and until that job was finished you couldn't move forward with the count. That's synchronous. Now assume you get to 3 and number 3 is asynchronous. You will continue counting to 10, meanwhile the job for 3 is still getting done.
With asynchronous you can use 'await' or not. 'await' basically tells the js engine to wait until the asynchronous job is completed before counting beyond 3 based on the illustration I gave. If you don't use 'await' then you keep counting while the job for 3 happens on the sidelines. In either cases, the asynchronous job will return a promise saying whether or not it is resolved.
wtf
it would be easy for custom items, just make a script that searches for the item id in the items folder, find the icon component and fetch the path from there
Correct
Its just a texture path library.
alright
ty
I may be thinking of a different Id than you guys are tbh
Scripting API dosnt have access to resource pack, I need a method to do it from within the realm just with gametest
no, i mean a python or node script
yes
I was trying to make my own ID system lol
I see ID and I go to numerical ID
an id like: minecraft:diamond
Mine is a manual textureID, by getting the items namespace and name and pairing it to its most likely texture.
The way I'm doing that is by making a list of items that break texture under the current number system.
if only numerical id don't shift when there is a custom item
Wouldn’t that break the enchanted texture, though?
Real
Average mojang system
i find it much easier to not use the aux value unless it's absolutely necessary
both ideas fail when it comes to custom items
i was looking for a way to crop a ui element if it is overlapping empty pixels of its parent element, just to avoid using the aux value for enchanted items
I didnt think of that lmao. Id have to mess with that to see if I can get a glint to work or not
Woah
Either way tho, we need a manual texture mapper and number offset.
for example, if a golden apple png was the parent element and the enchantment glint animation was the child element, i would want the child element to adjust its size to match the shape of the golden apple
I can probably make some makeshift script to make a temporary ingame fix to that. By just entering a number into a form to offset the numbers
how do i use source maps with miencraft
how do I do a or? I know that && is and but whats or?
its ||
ty

