Record Class GameEvent.Context
java.lang.Object
java.lang.Record
net.minecraft.world.level.gameevent.GameEvent.Context
- Enclosing class:
- GameEvent
public static record GameEvent.Context(@Nullable Entity sourceEntity, @Nullable BlockState affectedState)
extends Record
-
Field Summary
Modifier and TypeFieldDescriptionprivate final BlockState
The field for theaffectedState
record component.private final Entity
The field for thesourceEntity
record component. -
Constructor Summary
ConstructorDescriptionContext
(Entity sourceEntity, BlockState affectedState) Creates an instance of aContext
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theaffectedState
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static GameEvent.Context
static GameEvent.Context
of
(Entity p_223720_, BlockState p_223721_) static GameEvent.Context
of
(BlockState p_223723_) Returns the value of thesourceEntity
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
sourceEntity
The field for thesourceEntity
record component. -
affectedState
The field for theaffectedState
record component.
-
-
Constructor Details
-
Context
Creates an instance of aContext
record class.- Parameters:
sourceEntity
- the value for thesourceEntity
record componentaffectedState
- the value for theaffectedState
record component
-
-
Method Details
-
of
-
of
-
of
-
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. All components in this record class are compared withObjects::equals(Object,Object)
. -
sourceEntity
Returns the value of thesourceEntity
record component.- Returns:
- the value of the
sourceEntity
record component
-
affectedState
Returns the value of theaffectedState
record component.- Returns:
- the value of the
affectedState
record component
-