Ocelot 1.0.2

Allows developers to track entities without having to rely on packets or NMS.

  1. BananaPuncher714
    Native Minecraft Version:
    1.15
    Tested Minecraft Versions:
    • 1.15
    Source Code:
    https://github.com/BananaPuncher714/Ocelot
    Ocelot
    Allows developers to track entities much more easily, without having to rely on packets or NMS. Find a tutorial here.

    Where to start
    To get started, add Ocelot to your plugin's dependencies. You can get the Ocelot instance like so:
    Code (Java):
    Ocelot ocelot = Ocelot.getInstance();
    Once you have your Ocelot instance, you can get an `OcelotTracker` for an entity:
    Code (Java):
    Entity entity;
    OcelotTracker entityTracker = ocelot.getTrackerFor( entity );
    The OcelotTracker will show you which players can view the given player, and can let you set the VisibilityController, which will allow you to determine whether an entity is visible to a player.

    Custom VisibilityController
    An example is provided below:
    Code (Java):
    public class VisibilityControllerDistance implements VisibilityController {
        protected double distance;
        protected double distanceSquared;

        public VisibilityControllerDistance( double distance ) {
            this.distance = distance;
            distanceSquared = distance * distance;
        }

        @Override
        public BooleanResult isVisible( Player player, OcelotTracker tracker ) {
            Entity entity = tracker.getEntity();
            if ( entity.getWorld() == player.getWorld() && entity.getLocation().distanceSquared( player.getLocation() ) <= distanceSquared ) {
                return BooleanResult.TRUE;
            }

            return BooleanResult.FALSE;
        }
    }
    Once you have a VisibilityController created, you can set it for any OcelotTracker:
    Code (Java):
    OcelotTracker entityTracker;
    VisibilityController controller = new VisibilityControllerDistance( 10 ); // 10 block viewing range
    entityTracker.setVisibilityController( controller );
    Calling the OcelotTracker#update() method is recommended after setting the visibility controller. Note that the trackers do not persist over entity despawn and respawn.

    Supported Versions
    Ocelot supports these versions:
    • 1.14.4
    • 1.15
    • 1.15.1

Recent Updates

  1. Javadocs and source
  2. 1.14.4 Support

Recent Reviews

  1. FishyHyper
    FishyHyper
    5/5,
    Version: 1.0.0
    What a legend, saves so much time but I wish it could support other versions like 1.13 / 1.12 still great job.
    1. BananaPuncher714
      Author's Response
      Thanks! I will definitely work on adding support for versions before 1.15