#Script API General
1 messages · Page 118 of 1
If its only xyz then you can save it directly to a dynamic property
If it has more properties, then you can stringify it and then save it to a dynamic property
IS there a way to check if a player has OP?
there a good way to get an equipped items id aux?
there are no ways at all
frickkkkkkk.. so i would have to make a tuple that has EVERYTHING??
This won't help either. Every time you add a new item/block, the IDs will shift.
bruh. wasnt there some calculation you could do based on the items id? is that broken now?
@valid ice updates this every update so just use this.. https://github.com/Herobrine643928/Chest-UI/blob/main/BP/scripts/extensions/typeIds.js
is there any way to get entity equipment slot?
import { system, world } from "@minecraft/server";
{
system.afterEvents.scriptEventReceive.subscribe((event) => {
const { id, sourceEntity } = event;
if (id === "jockey:riding" && sourceEntity) {
const direction = sourceEntity.getViewDirection();
const horizontalStrength = -2.0;
const verticalStrength = 1.2;
sourceEntity.applyKnockback(
{x:direction.x * horizontalStrength,
z:direction.z * horizontalStrength},
verticalStrength
);
}
});
}```
can anyone tell me why this is giving me some errors
there must be another event somewhere
there def is one
the error type logs can be made by doing console.error()
i mean if you're talking about a possibility that there are two events with the same name then no.
and the error type logs don't happen via console.error either.
@warped kelp
odd
yea
Nyah
What happens specifically?
The scriptevent doesn't fire?
I'm at version 1.21.113 so I'm not really sure my input can help much xd
yea and instead
it gives an error
lol
yea no.
this is so frustrating
😭
and when i relog the object still exists? this sounds too good to be true i only have eerience with other languages
Dynamic properties are saved into the world's data, so later you can get the object with world.getDynamicProperty
why does the leather gear just not have the dyable component? it's supported by script API, but never returned as a valid component of the item
what the max string size for dynamic property value
32767
ty
How do I change the amount of an item in the players inventory? Im trying and if I set it to air it doesnt update but does work. and if I change the .amount it doesnt work.
Even just doing .setItem(i) which removes it but doesnt update it nvm forgot to save lol
setting the items to new itemstack with the amount work but is a little annoying
Someone knows how to do that
i believe its automatically forcing them to download the packs
which is only possible via featured servers
is there an event for world saving?
world.beforeEvents.playerInteractWithBlock.subscribe((event) => {
if (
event.block.typeId === "jay:juggernog_bottom", "jay:juggernog_middle", "jay:juggernog_top"
) {
event.cancel = true;
const player = event.player;
player.runCommandAsync("say hi");
}
});
```any reason for this 😓
idk
so ngl its with every block
you could create an array
mm ik theres a simple way of doing it i fr j forgot how
wait what problem do u have
im trying to make it run a command when I interact with my blocks
but anytime I place any block or interact it runs the command
and with already placed blocks it spams it
yeah idk why that happens, i dont know how to fix that
damn 😭
im sorry im not a trained professional
unlike a lot of these ppl in the discord server
why does this return as a not a function ?
const activeWandUsers = new Map();
system.runInterval(() => {
const players = world.getAllPlayers();
for (const player of players) {
const inventory = player.getComponent("inventory");
const container = inventory?.container;
const item = container?.getItem(player.selectedSlotIndex);
if (item?.typeId === "sh:furnace_wand") {
handleWandActive(player);
} else {
if (activeWandUsers.has(player.id)) {
handleWandInactive(player);
}
}
}
});
function handleWandActive(player) {
player.runCommandAsync("inputpermission set @s movement disabled");
const furnacePerm = BlockPermutation.resolve("minecraft:furnace");
targetBlock.setPermutation(furnacePerm);
activeWandUsers.set(player.id, {
placedBlockLocation: blockInFrontLoc,
dimensionId: dimension.id,
});
}```
Run command async is no longer a thing
const array = [
"jay:juggernog_bottom", "jay:juggernog_middle", "jay:juggernog_top"
]
world.beforeEvents.playerInteractWithBlock.subscribe((event) => {
if (!event.isFirstEvent && !array.includes(event.block.typeId)) return;
event.cancel = true;
const player = event.player;
player.runCommandAsync("say hi");
});```
can u try this im not sure i've been not scripting for awhile
Ai detected
it's giving that vibe?
yeah
the logic is wrong
if (!(event.isFirstEvent && array.includes(event.block.typeId))) return;
wait, commas work on conditions here?
no
then that's the issue right?
in this case, this condition will always be true
not only
or wait..
Commas are generally not allowed in if as far as I remember.
let me test..
They work the same way as ||
so, yes
it will always be true
yeah it always prints the last one
isnt that the same?
bro...lol
yep
gimini detected
i figured out that there is not .set by seeing the docs
yeah plus gemini is alot worse than chatgpt at scripting
eeeeeeeeeeeeeeeeeeeee idk soo but claud is the better one also gimini can fix things by givin him the docs link
chatgpt is alot better from what ive tested
how i do make item fire immune with script api
you cant by script api
not directly
like you can stop lava flow from destroying item
i think i need overide item entity as json
Create a map called timer and add a 2 sec cooldown to the interact. That's why I fixed the spam for blocks
no it still spams it 😭
i literally did this before but forgot how to
isFirstEvent is faster and requires less code
is dimension.playSound bugged or something?
the sound completely disappears when i am 16 blocks away from the location of the sound
Completely disappears when you first play the sound, then leave the radius while it's active?
Or it simply stops playing more sounds when you leave that radius?
Latter indicates the volume is set too low. You'll want a higher volume for players in a larger radius to hear the sound. Each 1 value in volume is 16 blocks in radius
(This is the volume passed to the playSound method)
If the volume is larger than 1 and you still cannot hear it from more than 16 blocks, might be the sound itself is attenuating too soon. Now you need to increase the max_dist property of the sound's definition.
(Ensure your sound definition's format version is 1.20.20, see MCPE-154378)
also, how much does this affect performance? a lot? a little?
I don't think it affects performance unless you are setting and/or getting a lot of dynamic properties every tick
always love when these display incorrectly 💀 (chest ui - been fixing it)
beta
thank you
Can i make an entity not be pushed by water?
is anyone else having a problem with getBiome crashing the game?
nvm
what do i use to set a entity's nameTag?
nvm i was using nameTag() instaed of nameTag
i have 4 points, each a vector3 with an x y and z component. is there a better way to add a certain amount for every axis and point? something better than this:
this.p1.x = this.p1.x + pos.x;
this.p1.y = this.p1.y + pos.y;
this.p1.z = this.p1.z + pos.z;
repeated 4 times for each point (p1, p2, p3, p4)
if i give a entity a dynamic property if that entity gets removed does the dynamic property persist? or does it get removed?
well the entity is gone so the dynamic property goes with it
ur storing it on the entity
so if no entity
no storage for dynamic property
try asking any ai for such topic. If u want more complex ways, u can ask here ig... 👀
im opposed to ai...i guess ill try it now lol
u can also take a look at these as well
good question 👀
oh yeah tyy that helps
aight, so normally the dynamic property saved in the entity gets removed as well when the entity is removed from the game like despawn or killed
when they're saved in structure, however, their dynamic property persists exclusively in the entity.
so u gota load the structure where the entity is saved to get the relative dynamic property
if u wana use the property again even after the entity gets removed, u can save the data on world (e.g. world.setDynamicProperty(entity.id, data)
nah i was just making nametags for items and i just wanted to double check the property gets removed when the item entity gets "removed" so the worlds dont get spammed and overflown with properties
What does Enum mean in CustomCommandParamType ?
the name of the enumeration to use
What’s the difference between the onPlayerDestroy and onPlayerBreak custom components
destroy is v1, break is v2
btw those are event hooks, custom components are the things that contain the event hooks
it works when i call this.onPower() within onPower() but not within onPlayerInteract
(waiting for my screenshot to send)
why is this happening?
Ah, are you exporting the component from another file and using it somewhere?
Can you show me how do you call onPlayerInteractEvent method?
Its important to call it on the object it self
It is presumably being used in a custom component. And for whatever reason the call site of custom components is null
ahh yea
I assume the API takes the objects and kinda pulls the methods out, so we lose the context of the object it came from
yea the object it self is more like bunch of options
and one of the options is onPlayerInteract
but not method
I would follow this pattern instead:
const component = {
onPlayerInteract(event) {
component.onPower(event);
},
onPower({ block }) {
// ...
}
}
export default component;
Might work better?
If not, then this pattern:
function onPower({ block }) {
// ...
}
const component = {
onPlayerInteract: (event) => onPower(event)
}
export default component;
I like classes.
yea using classes would be much cleaner
i would suggest something like this
class MyCustomClass
{
onPower()...{}
asComponent()...{
return {
onPlayerInteract: (event) => this.onPower(event)
}
}
}
guys
This is basically mines
abstract class FeatureFlag implements BlockCustomComponent {
onTick(
_componentData: BlockComponentTickEvent,
_paramData?: CustomComponentParameters,
): void {}
abstract onPlace(
componentData: BlockComponentOnPlaceEvent,
paramData?: CustomComponentParameters,
): void;
abstract onBreak(
componentData: BlockComponentBlockBreakEvent,
paramData?: CustomComponentParameters,
): void;
}
i removed my main.js file from my addon, but it keeps being registrated at minecraft
maybe you are not in development folder?
yeah im not, but when i was working on other addons that werent on development folder that didnt happen
just use devlopment folder and you sure it would use the latest version of it
ok
that makes sense
this is what i ended up doing
can't be bothered with classes
does player.id change everytime i join the world?
or it is set according to my account
It should be saved when you rejoin, in theory.
and is it always different on other worlds?
idk
I can say for sure that the world host always has the same ID.
Does anyone have a wrapper for simulating players?
Guys I have a question: is there anyway to turn off the vanilla swing animation without using player.json (the entity file of player in resource pack) using script or anything
cant u just override the animation
I still have to modify the player animation file tho
maybe make a new animation then play it when the player swings
I try use my Own animation file to overdrive it but it not work
The problem is that the vanilla swing animation alway trigger before the animation in the script
So there will be a frame where the player begin to jitter before the animation got override
nah
why modify the entire file?
just make an animation with the same name
then it will alway playing that animation i only want to play it in certain scenario
i9 found the way btw
by using haste effect
How would I go about running a command when I interact with a entity? I cant rlly find any example docs on it
what does abstract do?
force you to implement their abstract feilds, and abstract class can not be instanced it self
I see
Cease.
FINALLY
Added class EntityHurtBeforeEventSignal to beta
Added interface EntityHurtAfterEventOptions to beta
Added interface EntityHurtBeforeEventOptions to beta
Added WorldBeforeEvents.entityHurt to beta
Changed EntityHurtAfterEventSignal to use EntityHurtAfterEventOptions in beta
Added enum EntityHealCause to beta
Added class EntityHealSource to beta
Added class EntityHealAfterEvent to beta
Added class EntityHealBeforeEvent to beta
Added class EntityHealBeforeEventSignal to beta
Added class EntityHealAfterEventSignal to beta
Added property WorldAfterEvents.entityHeal to beta
Added property WorldBeforeEvents.entityHeal to beta
Added interface EntityHealEventOptions to beta ```
WE GOT EntityHurtBeforeEvent FINALLY
does this mean we can cancel it
indeed
Usually takes more than one release cycle for script API methods to go from Beta to stable I think from what I've seen.
Really no solid timeline, just whenever Mojang feels it's in a solid state
i mean using beta
Oh yeah should be in current preview and would likely be added in Beta APIs for the next full release to start using in scripting
https://feedback.minecraft.net/hc/en-us/articles/41627058435213-Minecraft-Beta-Preview-26-0-23
bet ty
Installation for @minecraft/server
Latest API module install:
npm i @minecraft/[email protected]
Beta API module install:
npm i @minecraft/[email protected]
Preview API module install:
npm i @minecraft/[email protected]
Preview Beta API module install:
npm i @minecraft/[email protected]
yao, its been a while since i last checked, is it possible to detect when the player jumps yet? like not detecting when the button is pressed or something, detecting when the player entity jumps, similar to the one inside the player exhaustion component, where u can set the jump exhaustion value every time the player jumps,
at LEAST we can detect when entityHurtBeforeEvents, which means custom totems are now possible, or extra hardcore lives are now possible!
speaking of extra hardcore lives, i think its a nice addon that i will be making! like u can craft an item that gives u one extra life, it will appear right next to ur hearts to show u that u have an extra life available, it will only work when u are not holding any kind of totems in ur hands and only work when u take a fatal damage, it will consume some of ur hearts tho, but u can regain those missing hearts later by doing something else
this addon will save u from many Bedrock Moments or at least give u enough time to get ur other totems before dying
just one simple feature have given us lots of possibilities! thank u mojang
omd
i can finally rest in peace
So detecting when the player is actually jumping
Not just clicking a button
There's no direct way to do it...
there might be a way but i think its too inefficient, like detecting the exhaustion value and see how much it has gained (using the jumping exhaustion value) u can detect when the player jumps by using the exhaustion value.
However, you could use some logic to simulate it
Like detecting when the player begins jumping, then detecting like 2 ticks afterwards to see if they're off the ground, which would assumedly mean that the player must've therefore "jumped"
thats just a cheap workaround ig, and has some bugs that are literally terrible
It is a cheap workaround, but what are the terrible bugs (can't think of any)
jumping while standing under a block will cause the event to fire endlessly, like jumping under a not full block like a slab or something similar
that will infact cause issues, why do i know? bec i have already tried it before.
Huh, minorly confused, if the player is jumping constantly under a block is it not meant to keep going
in another clear word, it wont work like how the player exhaustion works.
Mind if I see what you did if it still exists
Cause I feel like we're talking about 2 extremely similar different things, but idk
nah its gone by now
😭
im just asking to see if its possible now or not, and it still not possible
like only if they update the isJumping component and make it runs only when the player jumps that will be awesome
But that would break my script 🥺 😭
then switch to input mode and check if the player is pressing the jump button
pressing / holding
But that equals extra effort 🥺
then:
world.afterEvents.playerJump.subscribe(({player}) => {player?.remove});;```
or
```js
world.beforeEvents.playerJump.subscribe((event) => {if (!event.player?.hasTag('ableToJump')) event.cancel});;```
mojang bts: taking notes
-# hopefully
XD
please mojang bts, its a very simple feature but highly needed
what would be the difference between that and system.runInterval, it both would spam code quickly
lag depends on what you run in the interval.
and how r u getting the player in first place
a simple for loop of all players would be performant heavy?
so my core interval has alot, alot of codes and i am sending them all every tick, that will run alot better than giving each code its own interval, right?
if they all should trigger at the same time, it would not make sense to have them in separate intervals
anyways,
unless the event would actually trigger when they jump, not just when holding down the spacebar like player.isJumping.
would be nice yeah
...
-# cuz i cant explain stuff correctly
anyways yay entity beforeHurt
-# or sometimes I dont think about things right away
Im trying to make a binary string that compresses data so I can fit more in a string dynamic property but for some reason it seems to just remove most of it. can anyone help?
these are the methods to make it a string and back
toBinaryString(): string {
let out = "";
for (let i = 0; i < this.offset; i++)
out += String.fromCharCode(this.buffer[i]);
return out;
};
static fromBinaryString(str: string): ByteArray {
const arr = new ByteArray(new Uint8Array(str.length));
for (let i = 0; i < str.length; i++)
arr.buffer[i] = str.charCodeAt(i);
arr.offset = 0;
return arr;
};
buffer is a Uint8Array
Is there a variable I can use in scripting that can also be used in a query client side?
An entity property
that requires editing the entity file, im assuming he means just from scripting alone
Yes, because the entity in question would be the player, sorry forgot to mention that :b
Me too, but he didn't specify so 🤷
He'll never make that mistake again...
huh lol
It is better to split the string into substrings and save them in different dynamic properties, this will be much faster than compression
I'm actually a little upset about the new EntityHurtBeforeEvent..
Now he will always be too in depth about his problem and no one will ever have to ask him for follow up information ever again
maniacal laughter
lmao
whats wrong
Well... that makes my system, even though it's a "hack", less unique...
It's like what I spent months working on is now easily accessible to almost everyone
thats how it goes
How many lines was it?
Well, it's actually a nearly completely redesigned protection system, taking into account addon systems, events, and much more, which isn't actually the same "EntityHurtBeforeEvent." It's about 1,200 lines
Great Scott. Im so sorry for the loss of your time and effort
But the core is still EntityHurtBeforeEvent, which makes the system much less unique, although I still think it's pretty cool
And EntityHurtBeforeEvent solves only two of my problems, but gives me one huge
Same thing with my Jigsaw system
I think it sounds cool too (haven't seen it)
It's easier for developers to make their add-ons compatible at least.
I know the benefits it gives to me and to others and to the players, but that doesn't really make me feel any better
Try to enhance community's workflow in a different way then!
the entityhurtbeforeevent is really a christmas gift to me
though theres one issue...
for my use case at least
Wdym?
what
i cant change the vanilla knockback with it
so i have to cancel damages as whole and reapply using applyDamage so that i can customize everything
but that can cause loops
some people are reporting that player knockback doesnt get cancelled
What
when you cancel the event, players can still knockback entities
god damnit
and the knockback enchantment
i kinda expected this
then again, its not entityHit its entityHurt beforeEvent
i feel like canceling the hit would make more sense to cancel knockback right?
well its in preview so
maybe theres time
lol
i saw someone using clearvelocity which helps a little
Is there a good way to get a script to fire ONE time on the worlds very first load ever, then never again..?
(I’m a noob sorry)
very first load?
hmm
what about a tag?
Like on world gen, world initialization, world creation, idk what to call it, and wdym?
its technially world initialization (in scripting words)
Ah
theres not really a good way to check if the world was loaded for very first time
at least with scripting api stuff
you can use anything that persists in the world regardless of anything (restarting or etc)
Ok, thanks
so yeah thats why i suggested tag
it can be manually removed by player command but it still does persist
Dynamic properties ._.
they shoud add event.knockback = false\true
is there an event that emits when player receives a tag or remove a tag
no
why don't just
worldLoadAfterEvent(() => {
if (!world.getDynamicProperty("check")) {
//your stuff
world.setDynamicProperty("check", true)
}
})```
not the correct syntax but you get the idea lol
i see, thanks
Did we get any sort of input detection for when a player is lunging or is my best bet to check velocity?
Lunging?
with the spear
Hi, does anyone know if system.runTimeout respects game pausing?
like if a player pauses their game, does the timeout stop running momentarily too?
okay, tested, it does
Bonus info; Date().now doesnt respect game pausing, for counting ticks/seconds, use system.currentTick, it stops when you pause game
(Depending on what you want to do in case real-world time suits you mechanisms better)
Is there away to set an item in an itemframe? with script?
Only if you use pre-created structures, but there is no direct method in the API
hell nah I need over 1k strcuture for every item xD that would not work. thank you anyway
You can get the item, but not set it
Ik but I want to set it
how?
but how to get the item in frame
not the block item
i just said how?
wait..
it return the item in it if it is not empty
alr
#1067535608660107284 message
what code
Minecraft code needed for the frame to work
im kinda scared to see minecraft's code in general
i think it is just using whatever the pick block thing uses
-# not because i think it would be bad, its because im not a game developer lol
Well, although I have already figured out how to do it "the right way", but I’m not sure that this is what they use
that is the exact behavior ctrl+middle mouse click do tho
its just makes sense that it would be
yeah
we'll never know though
unless a mojang developer comes in and confirms it rn, 2% chance of that happening
lol
i mean, we can ask the devs
but idk if that a valid reason to ping them lol
so valid
😠
why are you angry
I wanted to say about asking Mojang, but you already did it
you focus on the wrong things man
Just kidding. I'm not angry, lol
yeah I didnt think you were serious
Okay, so now I can't say I'm waiting for EntityHurtBeforeEvent...
i cant believe we finally got it
what else is there
i cant think of any else to wait for now
-# for me anyway
hmmmmmm
hmm...
stable and NOT read-only entity.target?
oh yeah, that would be nice
we also got biome tag methods in the preview so thats taken care of
hm...
or native method to make mobs navigate to a location
a method to see if a player is in UI
yeah..
well yeah, but the method im suggesting would be better and you could use it for this
just check if its undefined
but if they will fix BlockCustomComponent.onBreak it will be easy to recreate this
Ahh, I need a bigger vocabulary :/
?
well, we could make a custom block dynamic properties system, using world properties
still a "hack"
Alright
@cursive forge
rewritable MolangVariableMap values..
this is only for custom blocks
so like
.
I was joking
pfft
there is a 0.2% chance, that he will reply
that is my alt
lol
oh thats not the real one
lol
soo...
thinking
thinking aswell
BlockUpdateBeforeEvent
yeah
or after at least
Dimension is not even in early execution, so how would that work
eh wait, nvm what i said
HMMMMMMM
mhhh
subcommands?
why didnt i mention that, I was just complaining to myself earlier that we didnt have it
yes, subcommands would be great
idk, i feel like this should be something like custom dimensions
you define the dimension the the biomes within
a radius property in ExplosionAfterEvent
before event tho
what use case you would have for that
yeah in beforeEvent so you can edit it, would be nice
it could carry the read only too, lol
and to knew the explosion "power", because blocks... well not an accurate method
?
and u can use setImpactedBlocks for that
nvm..
and "minecraft:destructable_by_explosion" component
and "destructable_by_mining"
damage component for weapons
yeeahh, I need it
he meant that him suggesting it for AE mean BE too sense the BE extend the AE
custom enchantments
equippable component for non-players
that's it
now Im waiting for equippable component
Well, I never stopped waiting for it..
dimension change beforeEvent I guess
Block.getJson()
mhm
tame component getting fixed...
its not the tame component itself
what's wrong with it?
yeah
the tame component gets removed in some vanilla entities after being tamed
ahh, that..
probably all
I didnt check
it's actually a json code issue
yes
only vanilla ones
vanilla mobs, yes
hmm, what other bugs are there
loot table match all query is still broken but thats not script related
recipe manager
and "craft" method
and support for all recipe types
or just give us an array of json code
just learned the other day that you can use the crafter in script api to validate a recipe
PlayerCraft Events
fishing events
maybe
and a loot table property to go with it
not maybe, that would be neat
cmon
it is too specific lol
LeverActionAfterEvent
Plates..
ok, maybe not
like, those are useful
tripWireTrip
what else
Dimension.getMap(volume:BlockVolume): RGB[]
WhiteGalzedTerracottaBreakWIthEnchantedDiamondPickaxeAfterEvent
?
yeaah
we have get block color already
and ItemStackMapComponent
TPS 📉
get block + get map color is slow
lol
I want this
The clients should spawn particles by themselves
ChunkLoad
ChunkUnload
yeah
but...
Im not sure it would be optimized to even use them
dynamic property option in EntityQueryOptions
filter function works fine but wouldnt hurt
like, a lot of chunks could be loaded and unloaded in one tick
and commands
?
target selectors
whaa
😵💫
not sue how doable is this
structureLoaded
huh?
bro doesnt know what a target selector is
😵💫
detect when a structure is loaded
kill @s[has_dynamic_property={}]
what is "a structure" in this context?
a structure...
village
nether fortress
...
and a dynamic property query
please mojang
how? dynamic properties are binded to packs
man im not a game developer
i dont know how they would do it
lol
entityEquipmentChanged
well, we got /packstats..
needed
entityTargetChanged
yeah
custom effects
also to make sense in before event
yess
yeah we need beforeEvents for the change events
bro agrees with his own words
I responded to the wrong comment man
ik
leave me bee
i bet you would do that though
mr. im no longer unique
lol
🙄 🙄 🙄 🙄 🙄 🙄 🙄 🙄 🙄 🙄 🙄 🙄
mr. i must state something first before someone else does
im kidding man
dont roll your eyes too far
entityPathFinding
and it return the path somehow and we can change it or cancel it
👀 -> 🚀
like, as a vector maybe?
i dont know how that would work
make a fourth axis
whatever the game uses internally ig
also, we don't have playerCameraChanged do we?
did i
yeah
that was serty
lol, alr
yeah I just double checked
waserty
mb minato, you and serty are so alike yk
i mean, while we are at it, make some for furnaces and so on
lol, kinda yeah
joke
I already said that 🤓
now this is a good idea
what you guys think
lmao
do we have a ride event?
nope
AnvilFallOnYourFaceEvent
(I didn't mean you)
I mean, like, the playewr
Ah yes, and maybe DimensionChangeAndGetSwarmedByHoglinEvent
oh how about property change event?
maybe
we need an event for all actions
yeah, tho not useful that much
BeforeBeforeEvent
hey thats my idea
.
oh, lol
setRedstonePower()
itemPickup
itemDroppe
playerHungerChange
entityTame
entityBreed
screenOpene (inv, furnace, and so on)
screenClose
indeed
I like "itemDroppe"
screen open/close can just be compacted to screenChange
but yeah
true
||takePlayersMinecoins()||
maybe screenChange could also detect titles too
could be cool
idk how useful but yeah
as I said, we need client-side scripts
screenType
most of them are server side
||getCreditCardDetails()||
:>
beside the events, there is a lot of other functions too
||getHomeLocationDetails()||
lol
dimension.fillBiome()
oh shit, yeah
pretty useless tho
how about a biomeEnter event
yeah idk man
Custom enchantments, effects
set only make sense if the thing before is what getting set, weird example but "blockVolume.setBiome()"
BiomeChange
that sounds weird tho
that sounds like after a biome gets changed
nah, so it have fromBiome toBiome
no I understand what you mean
What happens when you change biome? - Nothing. So such an event is unlikely
yeah just like the dimension one
huh
well
yeah nothing happens but if we had an event we can make something happen
lol
idk
system.runInterval + getBiome
there is probably some weird use case
duh
Mojang would have to do the same thing, only in C++, not JS
yeah but it would perform better no
km.ajsgdklajshdbajksd
dwerwearfwer
idk what to say
there is probably something in game that trigger on biome change, so they just add an api there
server side tho? i dont think so
I think there isn't
give me Dimension.loadedChunks
or Dimension.getLoadedChunks()
thats already a thing
isChunkLoaded is slow..
?
what makes you think this new method wouldnt be as slow then
just wish the current method would be faster
lol
...
cuz there is probably an array of ticking chunks, that is used for a lot of actions
because why calculating it N times in tick
when u can do it one time
i gtg to sleep, i will see you guys around
cya man
well...
well
its 6pm for me, so I have a little longer before I sleep
well, Im homeschooled now, and I don't need to wake up early...
you do you
i just fixed my sleep schedule recently
congrats
I just ruined mine recently
lol
yeah the process sucks to fix it
early waking up is cool, cuz u have much more time, but I hate going to sleep early, so...
😵💫
try waking up earlier
once your sleep schedule is fixed
youll have time
my parents will make me do some work
so my free time won't really change
well, about coding..
🤷
I have a little bit of code left for what I need... and it's pretty routine, so tomorrow
(I'll fall asleep only in +-2 years)\
lol
quick question, how do yall turn off PlayerName joined/left the game?
anyone knows when 1.21.130 stable will be released?
No idea if this is how it's properly done, but you can probably edit the translation message in a resource pack and make it blank
wait, i need to make sure if im understanding this correctly
if i attack with 4 damage while the victim has resistance 4, the final damage would be 0.8
would the damage value in entityhurt beforeevent be 0.8?
i wish i could test it by myself but i cant for reasons
Yea, the damage value reflects the final damage taken.
i see, thanks
would be nice if we had access to first initial damage too tbh
but this alone opens a lot of possibilities
how to set player fire immune? without fire resistance effect
With scripting only it isn't possible, I believe
The closest you can come is running a runInterval that just uses player.extinguishFire() every 0.05 seconds but you can't actually make them immune to the fire
with the new entityhurt beforeevent, you could technically make players to not take damages from fire, fire tick or lava
its in preview tho
True, completely forgot it existed (or technically hasn't existed) already somehow
i think it's editable 😅
not stable tho so yeah
I'm waiting for that 🔥
it isn't
absolutely needed too
i think that's an event, a real one, i could be wrong tho
it is.
that's exactly what i need
I wasnt suggesting it to exist.
oh
I was referencing it
np
hm but i used it a couple months ago
it definitely is editable
it was just one ping 😭
but it doesn't last
they can pick another target
Two actually
I don't mind, was just joking
this is so AWESOMEEEEEE
entityHeal beforeEvent is also really nice
++++++++++++
there's a before event for the heal?
or are you suggesting
oh
the types must be wrong or something
yes, it exists
cuz I'm sure i used it
let me test it then
it just doesn't last long
its not
dang
they must've made it read-only
cuz i remember i used it a couple versions ago maybe
no they did not make it read only, we are just seeing things
the messages are a lie
nooooo
I'm double hallucinating
noooo
lol
oh well, my bad for the inconvenience
i forgot how long ago they made it read only
i do remember making a staff of undead that failed miserably tho
must've been before then.
they target enemies for a couple seconds and then target whatever they want next.
had to use an interval just to keep them engaged
you know whats kinda lame too, they removed fallDistance property
yes
now that's interesting
i didn't know it existed
i do see why tho
it could be a bit inaccurate and unperformant
but maybe there are other reasons they removed it for
tho it would be really cool
using it i mean
anyway I'm gonna go
have a fantastic afternoon
maybe in the legacy gametest or what it was called
oh hey
a block destroy method
we dont have that
the event or a func?
I said method
so ye
an event for a block being destroyed in general, not just be a player would be cool too
yeah
and yes im aware theres a custom block component event for that
but thats only for custom blocks ofc
hmm? what are you referring to
?
what event
i thought it is a general event
nope, but thats what im wishing for
Has anybody here ever had issues with server forms sometimes not rendering on IOS?
server forms sometimes dont appear at all for me, but its rare
perhaps its a bit more common on iOS?
Thanks! Do you get soft locked in a blank screen, or does it just fail to open?
when the bug happens, it hides the hud but doesnt show the form itself
but i can safely get out of it by pressing ESC
Okay, thank you!
can you get the food item component of vanilla food?
const foodComponent = itemStack.getComponent(`minecraft:food`)
console.warn(foodComponent , itemStack.typeId)
It doesn't work on most vanilla items
weird it would be great if that did work
but we might ask for it, i remember durability didn't worked on vanilla as well before
if i am not wrong, it has something to do with data driven items, it work on apples for example
Cooked Beef is data driven.
welp, i am wrong then
How to prevent player death when health drops below 0.5
player.json file, or wait a little bit once the preview is released to stable they added the entityHurt before event
level_tick
What does this mean? I'm getting these errors from my custom components for some items.
Update your format version
No, never do that, that is the first red flag people look for in viruses, anything that is a passworded zip is 99.9% of the time a virus, terrible idea.
I just realized that message was from 2024 💀...
well since I'm remaking the staff, are there any better ideas?
i can add a tag to the entities i want the undead mobs to target
but I don't want external undead mobs to target
i know I'll have to edit the entities' .json
but I'm not exactly familiar with how to make certain entities target certain entities
if anyone has any idea what i should do, please go ahead and suggest away.
There's only a handful of undead entities that exist in the game
Soo
You could literally make your own ones that target whatever you want and not edit the entity.json files
Then have them transform into the actual vanilla entity if you wanted to, even
how do i have them only target a set of players?
nice
this is the main problem tho:
What distinguishing features does the set of players have?
tags
properties
anything
that i can add in the script
and that the json can use
So you're ok with using player.json
yeah
I'm completely fine with it
it's an addon for my server so i don't worry too much about add-on compatibility
and i can merge player.json(s) if i ever need to
but not using it would be pretty good too
so like
any solutions?
We don't even need it for this
You can use tags
Properties
Player.json is the it in question for your information
what should i do in it then?
by the way, when i said properties and tags, i meant target.addTag and target.setPropertyOverride...
i can use player.json but I'd like to avoid it
I'm trying to make the undead mobs target the nearest players
players that are targets > normal players in priority
but to pick normal players if no targets available
and I don't want the undead mobs to target teammates
I'm still not exactly sure how this can do all of that
if you wouldn't mind, could you send an example? or a snippet of what to do
i don't need to be spoon fed scripts but I don't exactly know what to do
if you got any documentation for how to do something close to this, please send it
Has the minimum version changed?
Why /playsound command plays sounds louder than .playMusic method? how to make .playMusic volume same as /playsound command
I mean I used to{ volume: } but it changed nothing
That's strange, it might depend on the source running the script.
You'll need to edit the nearest_attackable_target component for the entity and remove everything in it other than the player and add in a test for entities with the tag that you're using
If you want an example I can make one
Also I don't know how summoning the entity works so adding the tags is something I might need more for
Does Dimension.getBlockFromRay() not work on all occasions? Basically some of my custom blocks don't get caught on for some reason?
⤴️ this function sucks, I made one my own
is it possible to give players items with impossible enchants using script api?
no structures
no
can we manipulate a player's movement speed using scripts? With the new beforeHurt event coming soon, this will be the last thing I need in order to drop player.json
you can get the movement component
and use the setCurrentValue method, however the speed gets reset when the player sprints.
or whenever the speed gets altered in general
that's some pretty annoying variables to keep track of. Do you know of them all, or is that part vague?
like everything that resets it?
uh
well im assuming that other things do here, so maybe I shouldnt have said this
I only know sprinting for sure does
that sounds like a lot of trial and error to test before it hits stable. Thanks either way.
i dont think there's a good solution for this
like what are you going to try to do? check if the player is sprinting in system runInterval to keep setting the movement value?
it wouldnt be consistent I imagine
that or an async function was my plan, yeah
better off just using the speed effect for now, no?
unfortunately, speed is limited to specific intervals, and it also warps FOV to hyperdrive for those who leave dynamic FOV on.
I've been looking for alternatives that give me small increments without FOV adjustments, hence player.json
it would warp the fov anyway.