Record Class VisibleEntity

java.lang.Object
java.lang.Record
ke.ric.renderer.api.VisibleEntity
Record Components:
uuid - stable captured entity UUID
objectId - nonzero native object identity within this render result
type - nonblank namespaced entity type, such as minecraft:player
name - captured display label, which may be null
visiblePixels - number of image pixels whose primary ray is owned by this entity

public record VisibleEntity(UUID uuid, int objectId, String type, String name, int visiblePixels) extends Record
Immutable identity and primary-ray pixel coverage of an entity in a rendered image. This describes captured evidence, not a live Bukkit entity. Transparent contributors that do not own the primary ray are not counted; names are labels and never identity keys.
  • Constructor Summary

    Constructors
    Constructor
    Description
    VisibleEntity(UUID uuid, int objectId, String type, String name, int visiblePixels)
    Constructs a validated immutable value.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    coverage(int totalPixels)
    Returns this entity's fraction of all native-pass image pixels.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    int
    Returns the value of the objectId record component.
    boolean
    Tests the captured type without consulting a live Bukkit entity.
    final String
    Returns a string representation of this record class.
    Returns the value of the type record component.
    Returns the value of the uuid record component.
    int
    Returns the value of the visiblePixels record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

  • Method Details

    • player

      public boolean player()
      Tests the captured type without consulting a live Bukkit entity.
      Returns:
      true exactly when type is minecraft:player
    • coverage

      public double coverage(int totalPixels)
      Returns this entity's fraction of all native-pass image pixels. This is not reconstructed from a display name or from final composited colours.
      Parameters:
      totalPixels - positive width×height for the corresponding render result
      Returns:
      primary-ray coverage in 0..1
      Throws:
      IllegalArgumentException - if totalPixels is not positive or smaller than visiblePixels
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • uuid

      public UUID uuid()
      Returns the value of the uuid record component.
      Returns:
      the value of the uuid record component
    • objectId

      public int objectId()
      Returns the value of the objectId record component.
      Returns:
      the value of the objectId record component
    • type

      public String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • visiblePixels

      public int visiblePixels()
      Returns the value of the visiblePixels record component.
      Returns:
      the value of the visiblePixels record component