package aeronicamc.mods.mxtune.events;

import aeronicamc.mods.mxtune.Reference;
import aeronicamc.mods.mxtune.managers.PlayManager;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
import net.minecraftforge.event.entity.player.PlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Mod.EventBusSubscriber(modid = Reference.MOD_ID)
public class ModPlayerEvents
{
    private static final Logger LOGGER = LogManager.getLogger(ModPlayerEvents.class.getSimpleName());
    @SubscribeEvent
    public static void event(PlayerEvent.StartTracking event)
    {
        if (!event.getPlayer().level.isClientSide() && event.getTarget() instanceof ServerPlayerEntity)
        {
            PlayManager.sendPlayersTuneTo((ServerPlayerEntity) event.getPlayer(), event.getTarget());
            LOGGER.debug("{} Start Tracking {}", event.getPlayer(), event.getTarget());
        }
    }

    @SubscribeEvent
    public static void event(PlayerEvent.StopTracking event)
    {
        if (!event.getPlayer().level.isClientSide() && event.getTarget() instanceof ServerPlayerEntity)
        {
            LOGGER.debug("{} Stop Tracking {}", event.getPlayer(), event.getTarget());
        }
    }

    @SubscribeEvent
    public static void event(PlayerContainerEvent.Open event)
    {
        if(!event.getEntityLiving().getCommandSenderWorld().isClientSide())
            PlayManager.stopPlayingEntity(event.getEntityLiving());
    }
}

@@ -74,16 +74,69 @@
 erence;%0A
+import aeronicamc.mods.mxtune.entity.SittableEntity;%0A
 import a
@@ -861,32 +861,34 @@
 ClientSide() && 
+((
 event.getTarget(
@@ -911,32 +911,81 @@
 verPlayerEntity)
+ %7C%7C event.getTarget() instanceof SittableEntity))
 %0A        %7B%0A     
@@ -1328,16 +1328,18 @@
 de() && 
+((
 event.ge
@@ -1378,16 +1378,65 @@
 rEntity)
+ %7C%7C event.getTarget() instanceof SittableEntity))
 %0A       

Enable sittable entity as a music source for tracking.