#enchantment registry
73 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Can you give a vanilla example of a particle effect from an enchantment?
because I'm going to lean towards.... you don't
that needs player tick to check if the item in hand has this enchantment
particle minecraft:soul ~ ~0.5 ~ 0.5 0.5 0.5 0.01 3
Yeah, so how would I do that
huh? that's a particle sure, that's not what I asked
PlayerEvents.tick(e=>{
if(e.player.mainHandItem.hasEnchantment('idk', 1) || e.player.offHandItem.hasEnchantment('idk', 1)){
//code
}
})
or
PlayerEvents.tick(e=>{
e.player.handSlots.some(item => {
if(!item.hasEnchantment('idk', 1)) return;
//code
})
})
So like this?
yes
and now, the particle
uuuuhhhhhhhhh what
I'm also getting this error
oh wait, it's the player tick
yeah...
use forEach then
let executed = false;
e.player.handSlots.forEach(item => {
if(executed || !item.hasEnchantment('idk', 1)) return;
executed = true;
//code
})
in this case just use this
i'm making it over complicated
Oh definitely want to optimize that down the line by flagging players who contain the item rather than iterating through slots every tick.
also the particles are at world spawn
I think
Because you are running as server but I could be wrong
yes
Try running the command in a command block first
~ should be ${e.player.x}
So I have it at
event.server.runCommandSilent(`execute as ${event.player.name} at ${event.player.name} run particle minecraft:soul ${event.player.x} ${event.player.y + 0.5} ${event.player.z} 0.5 0.5 0.5 0.01 3`)
add this check to first line of player tick would be faster, i'm just being lazy:
if(e.player.age % 10) return;
PlayerEvents.tick(event => {
event.player.handSlots.forEach(item => {
if(event.player.age % 10 || !item.hasEnchantment('kubejs:spectral_touch', 1)) return;
event.server.runCommandSilent(`execute as ${event.player.name} at ${event.player.name} run particle minecraft:soul ${event.player.x} ${event.player.y + 0.5} ${event.player.z} 0.5 0.5 0.5 0.01 3`)
})
})
No particles (but it does get called)
const {x, eyeY:y, z} = e.player
event.server.runCommandSilent(`particle soul ${x} ${y} ${z} 0.5 0.5 0.5 0.01 3`)
don't run that check in iteration
PlayerEvents.tick(event => {
if(event.player.age % 10) return;
const {x, eyeY:y, z} = e.player
if(!e.player.mainHandItem.hasEnchantment('kubejs:spectral_touch', 1) && !e.player.offHandItem.hasEnchantment('kubejs:spectral_touch', 1)) return;
event.server.runCommandSilent(`particle soul ${x} ${y} ${z} 0.5 0.5 0.5 0.01 3`)
})
runCommandSilent → runCommand , check the log
Paste version of server.log from @unique fulcrum
OHHH
I get particles
yet it told me it was okay
Now how can it be like a ring around the player
function particleRing(mode, count, delay, dist, x, y, z, particleId, speed) {
const modeMap = {
'static': '',
'spread': '10000000000000',
'gather': '-10000000000000'
};
for(let i = 0, counter = 0; i < count; i++) {
Utils.server.scheduleInTicks(delay*i, () => {
counter++;
Utils.server.runCommandSilent(`execute rotated ${counter * 360/count} 0 positioned ${x} ${y} ${z} run particle ${particleId} ^ ^ ^${dist} ^ ^ ^${modeMap[mode]} ${(speed*0.00000000000001).toFixed(18)} 0 force`)
});
};
};
example use:
particleRing('spread', 20, 0, 0, px, py+0.8, pz, 'cloud', 4);
It’s a bit late to ask but do you have particles enabled in your options?