pmmp / PocketMine-MP

A server software for Minecraft: Bedrock Edition in PHP
https://pmmp.io
GNU Lesser General Public License v3.0
3.25k stars 1.53k forks source link

Find a way to properly integrate particle events which are actually particle+sound events #5169

Open dktapps opened 2 years ago

dktapps commented 2 years ago

Description

In many places, Minecraft uses so-called "level events" to trigger certain sound or visual effects. This is useful because some effects are quite complex (involving many particles, and/or arranged in particular ways), and it would be a colossal pain in the ass to have to reverse-engineer the logic for these things, as well as being wasteful for bandwidth usage.

However, the PocketMine-MP API currently doesn't have any place for these sound+particle combination events. This has forced the direct use of packets in various places, and in other cases the misclassification of certain things (e.g. BlockBreakParticle).

In addition, there are various graphical events (block crack animations, weather change) which are neither sound or particle, and yet still need to be broadcasted.

We need an API for these things that properly describes what they do. However...

We already have an events system, so WorldEvent is too ambiguous, because it could be conflated with the actual WorldEvent (you know, the one from which ChunkLoadEvent and friends inherit from). However, if we could unchain the event registration system from plugins, we could implement these events as actual events, allowing plugins to cancel or modify them, and allowing NetworkSessions to subscribe to (until now, plugin-exclusive) events.

Alternative methods

Add something like pocketmine/world/soundAndParticle/ package? meh...

Govdim commented 1 year ago

Maybe pocketmine/world/levelevent? Or in this case, the "level" and the "world" are the same thing? :/

Then the event class will be called WorldLevelEventEvent :D Well, or WorldLevelEvent

dktapps commented 1 year ago

I think the name is too generic. What we're really dealing with is combination sfx + vfx events. We need a name that reflects that.

Govdim commented 1 year ago

I think the name is too generic. What we're really dealing with is combination sfx + vfx events. We need a name that reflects that.

Here are some options:

  1. SoundParticleEffect
  2. SoundParticleFusion
  3. SoundParticle Then the package name will be pocketmine/world/soundparticle