Record Class TriggerVolumeCreateAction
- All Implemented Interfaces:
EventAction
The action reads the LocationContext stored under LocationKey, registers the
configured Volume at that position under a generated unique ID, and writes a
TriggerVolumeContext under VolumeKey. Later actions reference the volume through
that key, typically a TriggerVolumeRemoveAction. If the volume is never removed
explicitly, the context destroys it when the event ends.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final RecordCodec<TriggerVolumeCreateAction> static final StringFields inherited from interface EventAction
ARRAY_CODEC, EMPTY_ARRAY, TYPE_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionTriggerVolumeCreateAction(ContextKey locationKey, ContextKey volumeKey, org.joml.Vector3d offset, TriggerVolume volume) Creates an instance of aTriggerVolumeCreateActionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapply(Ref<EntityStore> ref, CommandBuffer<EntityStore> buffer, WorldEvent event) Executes the action.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of thelocationKeyrecord component.org.joml.Vector3doffset()Returns the value of theoffsetrecord component.final StringtoString()Returns a string representation of this record class.voidCalled at asset-load time so the action can register theContextKeyvalues it depends on, enabling the validator to catch dangling or mismatched key names.volume()Returns the value of thevolumerecord component.Returns the value of thevolumeKeyrecord component.
-
Field Details
-
ID
- See Also:
-
CODEC
-
-
Constructor Details
-
TriggerVolumeCreateAction
public TriggerVolumeCreateAction(@Nonnull ContextKey locationKey, @Nonnull ContextKey volumeKey, @Nullable org.joml.Vector3d offset, @Nonnull TriggerVolume volume) Creates an instance of aTriggerVolumeCreateActionrecord class.- Parameters:
locationKey- the value for thelocationKeyrecord componentvolumeKey- the value for thevolumeKeyrecord componentoffset- the value for theoffsetrecord componentvolume- the value for thevolumerecord component
-
-
Method Details
-
validate
Description copied from interface:EventActionCalled at asset-load time so the action can register theContextKeyvalues it depends on, enabling the validator to catch dangling or mismatched key names.Call
Validator.addReferencedKey(String, String, ContextKey)for each key this action reads from context, andValidator.addDefinedKey(String, String, ContextKey)for each key this action writes to context.- Specified by:
validatein interfaceEventAction- Parameters:
validator- the validator to register key references with
-
apply
public boolean apply(@Nonnull Ref<EntityStore> ref, @Nonnull CommandBuffer<EntityStore> buffer, @Nonnull WorldEvent event) Description copied from interface:EventActionExecutes the action.Actions that read from the event context should check for
nullvalues and returnfalsewith a warning log if a required entry is missing, as the context may not have been populated if an earlier condition or action failed.ECS mutations (spawning entities, setting blocks, etc.) should be submitted through
bufferrather than applied directly, to maintain world-thread consistency.- Specified by:
applyin interfaceEventAction- Parameters:
ref- the entity reference for the world event entitybuffer- the command buffer used to submit ECS mutationsevent- the running world event, including its context- Returns:
trueif the action succeeded;falseto abort the current stage
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
locationKey
Returns the value of thelocationKeyrecord component.- Returns:
- the value of the
locationKeyrecord component
-
volumeKey
Returns the value of thevolumeKeyrecord component.- Returns:
- the value of the
volumeKeyrecord component
-
offset
@Nullable public org.joml.Vector3d offset()Returns the value of theoffsetrecord component.- Returns:
- the value of the
offsetrecord component
-
volume
Returns the value of thevolumerecord component.- Returns:
- the value of the
volumerecord component
-