Package ke.ric.renderer.api
Record Class VisibleEntity
java.lang.Object
java.lang.Record
ke.ric.renderer.api.VisibleEntity
- Record Components:
uuid- stable captured entity UUIDobjectId- nonzero native object identity within this render resulttype- nonblank namespaced entity type, such as minecraft:playername- captured display label, which may be nullvisiblePixels- 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
ConstructorsConstructorDescriptionVisibleEntity(UUID uuid, int objectId, String type, String name, int visiblePixels) Constructs a validated immutable value. -
Method Summary
Modifier and TypeMethodDescriptiondoublecoverage(int totalPixels) Returns this entity's fraction of all native-pass image pixels.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.intobjectId()Returns the value of theobjectIdrecord component.booleanplayer()Tests the captured type without consulting a live Bukkit entity.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.uuid()Returns the value of theuuidrecord component.intReturns the value of thevisiblePixelsrecord component.
-
Constructor Details
-
VisibleEntity
Constructs a validated immutable value.- Throws:
IllegalArgumentException- for blank type, zero object ID or negative coverageNullPointerException- if uuid or type is null
-
-
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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
uuid
Returns the value of theuuidrecord component.- Returns:
- the value of the
uuidrecord component
-
objectId
public int objectId()Returns the value of theobjectIdrecord component.- Returns:
- the value of the
objectIdrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
visiblePixels
public int visiblePixels()Returns the value of thevisiblePixelsrecord component.- Returns:
- the value of the
visiblePixelsrecord component
-