meisterhau-ll
    Preparing search index...

    Interface ParticleEmitter

    interface ParticleEmitter {
        attachTo: any;
        curve: ParticleCurve;
        duration?: number;
    }
    Index

    Properties

    attachTo: any

    绑定粒子发射器的生物

    粒子动画的曲线

    // 水平方向从-90°到90度的粒子动画
    const startAngle = -90
    const angle = 180
    const radius = 4

    function circle(progress, pos, facing) {
    const { x, y, z, dimid } = pos
    const rotYaw = facing.yaw
    + progress * angle
    + startAngle // 计算粒子相对当前绑定生物的面朝方向的偏航角

    return {
    type: 'particle',
    particle: 'minecraft:heart_particle', // 心型粒子
    pos: {
    x: x + Math.sin(rotYaw * Math.PI / 180), //角度转弧度进行sin计算
    y: y, //保证粒子不会在竖直方向上随着视角方向变化
    z: z + Math.cos(rotYaw * Math.PI / 180),
    dimid: dimid
    }
    }
    }
    duration?: number

    粒子发射器持续时间,默认1tick