Plompi / VinURL

A Minecraft Fabric mod to download your favourite Tunes
https://modrinth.com/mod/vinurl
Other
2 stars 0 forks source link

Music Stops Playing Upon Player Rejoining the Game #9

Open Handyfon opened 3 weeks ago

Handyfon commented 3 weeks ago

Currently, when a player disconnects and then rejoins the game, any music that was playing ceases to continue. This affects the game's ambiance and player experience, particularly in environments where music is a key element of gameplay.

Expected Behavior Music should ideally continue playing from where it left off when a player rejoins the game, or restart based on the game's context. This would enhance continuity and improve the player's immersive experience in the game.

Suggested Solution Implement a system to keep track of each player's last music track and its playtime upon disconnection. This information can be used to resume music playback when the player rejoins. Here’s a potential approach using pseudocode:

@Mixin(ServerPlayerEntity.class) public abstract class ServerPlayerEntityMixin {

@Inject(method = "onSpawn", at = @At("HEAD"))
private void onSpawn(CallbackInfo ci) {
    ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
    UUID playerId = player.getUuid();
    // Retrieve and resume player-specific music track and position
}

}

Steps to Reproduce Log into the game and start any music track. Disconnect from the game. Reconnect to the game. Observe that the music does not continue playing upon rejoining.