Record Class MobDefinition
java.lang.Object
java.lang.Record
fr.fidorial.entity.mob.MobDefinition
- Record Components:
key- the identifier the mob is summoned and saved undernetworkType- the vanilla entity type the client rendersmaxHealth- the health ceiling in half-heartsmovementSpeed- the walking speed in blocks per tickwidth- the hitbox width in blocksheight- the hitbox height in blocksfollowRange- the radius in blocks the mob picks targets within,0to never targetattackDamage- the damage one hit dealssoundSource- the sound category the mob's sounds are played inbehaviour- builds the brain of each mob of this kindpersistent- whether the mob is written to the region files
public record MobDefinition(Key key, Key networkType, float maxHealth, double movementSpeed, double width, double height, double followRange, float attackDamage, Sound.Source soundSource, MobBehaviour.Factory behaviour, boolean persistent)
extends Record
Everything the server needs to build a mob a plugin invented.
- Since:
- 0.1.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMobDefinition(Key key, Key networkType, float maxHealth, double movementSpeed, double width, double height, double followRange, float attackDamage, Sound.Source soundSource, MobBehaviour.Factory behaviour, boolean persistent) Creates an instance of aMobDefinitionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the value of theattackDamagerecord component.Returns the value of thebehaviourrecord component.static MobDefinition.Builderfinal booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of thefollowRangerecord component.final inthashCode()Returns a hash code value for this object.doubleheight()Returns the value of theheightrecord component.key()Returns the value of thekeyrecord component.floatReturns the value of themaxHealthrecord component.doubleReturns the value of themovementSpeedrecord component.Returns the value of thenetworkTyperecord component.booleanReturns the value of thepersistentrecord component.Returns the value of thesoundSourcerecord component.final StringtoString()Returns a string representation of this record class.doublewidth()Returns the value of thewidthrecord component.
-
Constructor Details
-
MobDefinition
public MobDefinition(Key key, Key networkType, float maxHealth, double movementSpeed, double width, double height, double followRange, float attackDamage, Sound.Source soundSource, MobBehaviour.Factory behaviour, boolean persistent) Creates an instance of aMobDefinitionrecord class.- Parameters:
key- the value for thekeyrecord componentnetworkType- the value for thenetworkTyperecord componentmaxHealth- the value for themaxHealthrecord componentmovementSpeed- the value for themovementSpeedrecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord componentfollowRange- the value for thefollowRangerecord componentattackDamage- the value for theattackDamagerecord componentsoundSource- the value for thesoundSourcerecord componentbehaviour- the value for thebehaviourrecord componentpersistent- the value for thepersistentrecord component
-
-
Method Details
-
builder
- Parameters:
key- the identifier the mob is summoned and saved undernetworkType- the vanilla entity type the client renders- Returns:
- a builder pre-filled with the defaults of a small walking animal
- Since:
- 0.1.0
-
toString
-
hashCode
-
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 thecomparemethod from their corresponding wrapper classes. -
key
-
networkType
Returns the value of thenetworkTyperecord component.- Returns:
- the value of the
networkTyperecord component
-
maxHealth
-
movementSpeed
public double movementSpeed()Returns the value of themovementSpeedrecord component.- Returns:
- the value of the
movementSpeedrecord component
-
width
-
height
-
followRange
public double followRange()Returns the value of thefollowRangerecord component.- Returns:
- the value of the
followRangerecord component
-
attackDamage
public float attackDamage()Returns the value of theattackDamagerecord component.- Returns:
- the value of the
attackDamagerecord component
-
soundSource
Returns the value of thesoundSourcerecord component.- Returns:
- the value of the
soundSourcerecord component
-
behaviour
-
persistent
public boolean persistent()Returns the value of thepersistentrecord component.- Returns:
- the value of the
persistentrecord component
-