feat: 完善粒子播放

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2023-02-08 16:23:05 +08:00
parent d9dffa704d
commit 65832c9fae
3 changed files with 50 additions and 52 deletions

View File

@ -1,32 +1,15 @@
import { provideSingleton } from '@ccms/container'
import { particle, plugin } from '@ccms/api'
import { particle } from '@ccms/api'
@provideSingleton(particle.ParticleManager)
export class SpongeParticleManager extends particle.ParticleManager {
private globalSpawner = new SpongeParticleSpawner()
constructor() {
super()
particle.ParticleManager.globalSpawner = this.globalSpawner
}
protected getGlobalSpawner() {
return this.globalSpawner
}
}
@provideSingleton(particle.ParticleSpawner)
export class SpongeParticleSpawner extends particle.ParticleSpawner {
spawnParticle(location: org.spongepowered.api.world.Location<any>, particle: any, count: number = 1) {
location.getPosition()
// location.getWorld().spawnParticle(particle, location, count)
}
spawn(location: any, particle: particle.Particle) {
location.getWorld().spawnParticle(
particle.getParticle(),
location,
particle.getCount(),
particle.getOffsetX(),
particle.getOffsetY(),
particle.getOffsetZ(),
particle.getExtra(),
particle.getData()
)
throw new Error('Not Impl.')
}
spawnToPlayer(player: any, location: any, particle: particle.Particle) {
throw new Error('Not Impl.')
}
}