Skip to content

Commit

Permalink
Add custom music level event
Browse files Browse the repository at this point in the history
  • Loading branch information
romanalexander authored and SupremeMortal committed Aug 14, 2024
1 parent b9f49c0 commit d5511d2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.cloudburstmc.protocol.bedrock.codec.v388.serializer.AvailableCommandsSerializer_v388;
import org.cloudburstmc.protocol.bedrock.codec.v408.Bedrock_v408;
import org.cloudburstmc.protocol.bedrock.codec.v419.serializer.*;
import org.cloudburstmc.protocol.bedrock.data.LevelEvent;
import org.cloudburstmc.protocol.bedrock.data.LevelEventType;
import org.cloudburstmc.protocol.bedrock.data.PacketRecipient;
import org.cloudburstmc.protocol.bedrock.data.SoundEvent;
import org.cloudburstmc.protocol.bedrock.data.command.CommandParam;
Expand All @@ -25,6 +27,13 @@ public class Bedrock_v419 extends Bedrock_v408 {
.insert(318, SoundEvent.UNDEFINED)
.build();

protected static final TypeMap<LevelEventType> LEVEL_EVENTS = Bedrock_v408.LEVEL_EVENTS.toBuilder()
.insert(1900, LevelEvent.QUEUE_CUSTOM_MUSIC)
.insert(1901, LevelEvent.PLAY_CUSTOM_MUSIC)
.insert(1902, LevelEvent.STOP_CUSTOM_MUSIC)
.insert(1903, LevelEvent.SET_MUSIC_VOLUME)
.build();

public static BedrockCodec CODEC = Bedrock_v408.CODEC.toBuilder()
.protocolVersion(419)
.minecraftVersion("1.16.100")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ public enum LevelEvent implements LevelEventType {
SOUND_INK_SACE_USED,
SOUND_AMETHYST_RESONATE,

// music since v417
QUEUE_CUSTOM_MUSIC,
PLAY_CUSTOM_MUSIC,
STOP_CUSTOM_MUSIC,
SET_MUSIC_VOLUME,

// particles
PARTICLE_SHOOT,
PARTICLE_DESTROY_BLOCK,
Expand Down

0 comments on commit d5511d2

Please sign in to comment.