Record Class EntityProperties

java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.npc.entity.EntityProperties
Record Components:
child - If the entity is a child
invulnerable - If the entity is invulnerable
immovable - If the entity is immovable
nameplate - If the entity has a nameplate
health - The health of the entity
dimensions - The dimensions of the entity

public record EntityProperties(boolean child, boolean invulnerable, boolean immovable, boolean nameplate, float health, float eyeHeight, net.minecraft.world.entity.EntityDimensions dimensions, ResourceWithFallback icon) extends Record
An immutable record representing the properties of an NPC.
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<EntityProperties> CODEC
  • Constructor Details

    • EntityProperties

      public EntityProperties(boolean child, boolean invulnerable, boolean immovable, boolean nameplate, float health, float eyeHeight, net.minecraft.world.entity.EntityDimensions dimensions, ResourceWithFallback icon)
      Creates an instance of a EntityProperties record class.
      Parameters:
      child - the value for the child record component
      invulnerable - the value for the invulnerable record component
      immovable - the value for the immovable record component
      nameplate - the value for the nameplate record component
      health - the value for the health record component
      eyeHeight - the value for the eyeHeight record component
      dimensions - the value for the dimensions record component
      icon - the value for the icon record component
  • Method Details

    • defaultProperties

      public static final EntityProperties defaultProperties()
    • defaultChildProperties

      public static final EntityProperties defaultChildProperties()
    • asChild

      public EntityProperties asChild()
      Creates a new EntityProperties with the child property set to true.
      Returns:
      The modified properties
    • asAdult

      public EntityProperties asAdult()
      Creates a new EntityProperties with the child property set to false.
      Returns:
      The modified properties
    • setChild

      public EntityProperties setChild(boolean child)
      Creates a new EntityProperties with the child property set to the given value.
      Parameters:
      child - The new value
      Returns:
      The modified properties
    • makeInvulnerable

      public EntityProperties makeInvulnerable()
      Creates a new EntityProperties with the invulnerable property set to true.
      Returns:
      The modified properties
    • makeVulnerable

      public EntityProperties makeVulnerable()
      Creates a new EntityProperties with the invulnerable property set to false.
      Returns:
      The modified properties
    • setInvulnerable

      public EntityProperties setInvulnerable(boolean invulnerable)
      Creates a new EntityProperties with the invulnerable property set to the given value.
      Parameters:
      invulnerable - The new value
      Returns:
      The modified properties
    • makeMovable

      public EntityProperties makeMovable()
      Creates a new EntityProperties with the immovable property set to true.
      Returns:
      The modified properties
    • makeImmovable

      public EntityProperties makeImmovable()
      Creates a new EntityProperties with the immovable property set to false.
      Returns:
      The modified properties
    • setImmovable

      public EntityProperties setImmovable(boolean immovable)
      Creates a new EntityProperties with the immovable property set to the given value.
      Parameters:
      immovable - The new value
      Returns:
      The modified properties
    • withHealth

      public EntityProperties withHealth(double health)
      Creates a new EntityProperties with the health property set to the given value.
      Parameters:
      health - The new value
      Returns:
      The modified properties
    • withHealth

      public EntityProperties withHealth(float health)
      Creates a new EntityProperties with the health property set to the given value.
      Parameters:
      health - The new value
      Returns:
      The modified properties
    • withEyeHeight

      public EntityProperties withEyeHeight(double eyeHeight)
      Creates a new EntityProperties with the health property set to the given value.
      Parameters:
      eyeHeight - The new value
      Returns:
      The modified properties
    • withEyeHeight

      public EntityProperties withEyeHeight(float eyeHeight)
      Creates a new EntityProperties with the health property set to the given value.
      Parameters:
      eyeHeight - The new value
      Returns:
      The modified properties
    • withDimensions

      public EntityProperties withDimensions(net.minecraft.world.entity.EntityDimensions dimensions)
      Creates a new EntityProperties with the dimensions property set to the given value.
      Parameters:
      dimensions - The new value
      Returns:
      The modified properties
    • withNamePlate

      public EntityProperties withNamePlate()
      Creates a new EntityProperties with the nameplate property set to true.
      Returns:
      The modified properties
    • withoutNamePlate

      public EntityProperties withoutNamePlate()
      Creates a new EntityProperties with the nameplate property set to false.
      Returns:
      The modified properties
    • withNamePlate

      public EntityProperties withNamePlate(boolean nameplate)
      Creates a new EntityProperties with the nameplate property set to the given value.
      Parameters:
      nameplate - The new value
      Returns:
      The modified properties
    • withIcon

      public EntityProperties withIcon(ResourceWithFallback icon)
      Creates a new EntityProperties with the icon property set to the given value.
      Parameters:
      icon - The new value
      Returns:
      The modified properties
    • builder

      public static EntityProperties.Builder builder()
      Creates a new builder for the EntityProperties record.
      Returns:
      The new builder
    • 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.
    • child

      public boolean child()
      Returns the value of the child record component.
      Returns:
      the value of the child record component
    • invulnerable

      public boolean invulnerable()
      Returns the value of the invulnerable record component.
      Returns:
      the value of the invulnerable record component
    • immovable

      public boolean immovable()
      Returns the value of the immovable record component.
      Returns:
      the value of the immovable record component
    • nameplate

      public boolean nameplate()
      Returns the value of the nameplate record component.
      Returns:
      the value of the nameplate record component
    • health

      public float health()
      Returns the value of the health record component.
      Returns:
      the value of the health record component
    • eyeHeight

      public float eyeHeight()
      Returns the value of the eyeHeight record component.
      Returns:
      the value of the eyeHeight record component
    • dimensions

      public net.minecraft.world.entity.EntityDimensions dimensions()
      Returns the value of the dimensions record component.
      Returns:
      the value of the dimensions record component
    • icon

      public ResourceWithFallback icon()
      Returns the value of the icon record component.
      Returns:
      the value of the icon record component