Class ProjectileInteraction

All Implemented Interfaces:
JsonAsset<String>, JsonAssetWithMap<String, IndexedLookupTableAssetMap<String, Interaction>>, NetworkSerializable<Interaction>, Operation, BallisticDataProvider

public class ProjectileInteraction extends SimpleInstantInteraction implements BallisticDataProvider
An interaction type that spawns a projectile, using the given projectile config, relative to the entities position and rotation.
  • Field Details

  • Constructor Details

    • ProjectileInteraction

      public ProjectileInteraction()
  • Method Details

    • getConfig

      @Nullable public ProjectileConfig getConfig()
      Lazily resolves and returns the ProjectileConfig for this interaction.
      Returns:
      the resolved ProjectileConfig, or null if the asset doesn't exist.
    • getBallisticData

      @Nullable public BallisticData getBallisticData()
      Description copied from interface: BallisticDataProvider
      Returns the ballistic data for this interaction, used for NPC aiming calculations.
      Specified by:
      getBallisticData in interface BallisticDataProvider
      Returns:
      the BallisticData for this interaction, or null if not available.
    • getWaitForDataFrom

      @Nonnull public WaitForDataFrom getWaitForDataFrom()
      Specified by:
      getWaitForDataFrom in interface Operation
      Overrides:
      getWaitForDataFrom in class SimpleInteraction
    • needsRemoteSync

      public boolean needsRemoteSync()
      Description copied from class: Interaction
      Returns whether this interaction must be synced to any remote clients in order to function correctly. Ignored when the interaction is running without a client.

      This method is used as an optimization when the interactions are being run by a manager with a remote client. If all interactions in a chain don't require a client in order to function (if this method returns false for all interactions in the chain) then we can skip executing/syncing the chain to the client and instead run the chain completely server-side instead.

      This method has no effect on interaction managers that run without a remote attached. It may also be ignored in some cases as this method only functions as a hint.

      If Operation.getWaitForDataFrom() returns WaitForDataFrom.Client then this must return true.

      Overrides:
      needsRemoteSync in class SimpleInteraction
      Returns:
      whether this interaction requires being synced to remote clients in order to function correctly for them.