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 SummaryFieldsModifier and TypeFieldDescriptionprivate final BlockStateThe field for theaffectedStaterecord component.private final EntityThe field for thesourceEntityrecord component.
- 
Constructor SummaryConstructorsConstructorDescriptionContext(Entity sourceEntity, BlockState affectedState) Creates an instance of aContextrecord class.
- 
Method SummaryModifier and TypeMethodDescriptionReturns the value of theaffectedStaterecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static GameEvent.Contextstatic GameEvent.Contextof(Entity p_223720_, BlockState p_223721_) static GameEvent.Contextof(BlockState p_223723_) Returns the value of thesourceEntityrecord component.final StringtoString()Returns a string representation of this record class.
- 
Field Details- 
sourceEntityThe field for thesourceEntityrecord component.
- 
affectedStateThe field for theaffectedStaterecord component.
 
- 
- 
Constructor Details- 
ContextCreates an instance of aContextrecord class.- Parameters:
- sourceEntity- the value for the- sourceEntityrecord component
- affectedState- the value for the- affectedStaterecord component
 
 
- 
- 
Method Details- 
of
- 
of
- 
of
- 
toStringReturns 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.
- 
hashCodepublic 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.
- 
equalsIndicates 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).
- 
sourceEntityReturns the value of thesourceEntityrecord component.- Returns:
- the value of the sourceEntityrecord component
 
- 
affectedStateReturns the value of theaffectedStaterecord component.- Returns:
- the value of the affectedStaterecord component
 
 
-