Class ProjectileConfig

java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.config.ProjectileConfig
All Implemented Interfaces:
JsonAsset<String>, JsonAssetWithMap<String, DefaultAssetMap<String, ProjectileConfig>>, NetworkSerializable<ProjectileConfig>, BallisticData

A configuration defining the properties and behavior of a projectile.
  • Field Details

  • Constructor Details

    • ProjectileConfig

      public ProjectileConfig()
  • Method Details

    • getAssetStore

      @Nonnull public static AssetStore<String, ProjectileConfig, DefaultAssetMap<String, ProjectileConfig>> getAssetStore()
      Returns:
      the asset store for ProjectileConfig instances.
    • getAssetMap

      @Nonnull public static DefaultAssetMap<String, ProjectileConfig> getAssetMap()
      Returns:
      the asset map for ProjectileConfig instances.
    • getId

      @Nullable public String getId()
      Specified by:
      getId in interface JsonAsset<String>
      Returns:
      the unique identifier for this projectile config.
    • getPhysicsConfig

      @Nonnull public PhysicsConfig getPhysicsConfig()
      Returns:
      the physics configuration for this projectile.
    • getModelAsset

      @Nullable public ModelAsset getModelAsset()
      Returns:
      the resolved model asset for this projectile, or null if the asset doesn't exist.
    • getModel

      @Nonnull public Model getModel()
      Returns:
      the unit-scale base model for this projectile, used as the network template.
    • createSpawnModel

      @Nonnull public Model createSpawnModel(@Nullable Long scaleSeed)
      Parameters:
      scaleSeed - A deterministic seed for the model scale, or null for a random scale.
      Returns:
      a new spawn model. Scaled within the model asset's min/max range when UseModelScale is set, otherwise at unit scale.
    • createSpawnModel

      @Nonnull public Model createSpawnModel(@Nullable Long scaleSeed, float scaleMultiplier)
      Parameters:
      scaleSeed - A deterministic seed for the model scale, or null for a random scale.
      scaleMultiplier - A multiplier on the resulting scale. Scales the model and its hitbox uniformly (e.g. an AoE rune growing an ability projectile).
      Returns:
      a new spawn model.
    • getLaunchForce

      public double getLaunchForce()
      Returns:
      the launch force of this projectile.
    • getDirectionalHitBox

      @Nullable public DirectionalHitBoxConfig getDirectionalHitBox()
    • getMuzzleVelocity

      public double getMuzzleVelocity()
      Specified by:
      getMuzzleVelocity in interface BallisticData
      Returns:
      the muzzle velocity of the projectile in blocks/second.
    • getGravity

      public double getGravity()
      Specified by:
      getGravity in interface BallisticData
      Returns:
      the gravitational acceleration applied to the projectile in blocks/second².
    • getVerticalCenterShot

      public double getVerticalCenterShot()
      Specified by:
      getVerticalCenterShot in interface BallisticData
      Returns:
      the vertical offset from the shooter's eye position to the projectile spawn point.

      Positive values indicate the projectile spawns above the eye position.

    • getHorizontalCenterShot

      public double getHorizontalCenterShot()
      Specified by:
      getHorizontalCenterShot in interface BallisticData
      Returns:
      the horizontal offset from the shooter's eye position to the projectile spawn point.

      Positive values indicate the projectile spawns in front of the eye position.

    • getDepthShot

      public double getDepthShot()
      Specified by:
      getDepthShot in interface BallisticData
      Returns:
      the forward depth offset from the shooter's position to the projectile spawn point.

      Used to compensate for projectile spawning distance from the shooter.

    • isPitchAdjustShot

      public boolean isPitchAdjustShot()
      Specified by:
      isPitchAdjustShot in interface BallisticData
      Returns:
      true if the depth offset should be adjusted based on pitch angle, false if the offset remains constant regardless of pitch.
    • getInteractions

      @Nonnull public Map<InteractionType, String> getInteractions()
      Returns:
      the interactions this projectile can perform.
    • getLaunchWorldSoundEventIndex

      public int getLaunchWorldSoundEventIndex()
      Returns:
      the sound event index of the local launch sound.
    • getProjectileSoundEventIndex

      public int getProjectileSoundEventIndex()
      Returns:
      the sound event index of the local launch sound.
    • getSpawnOffset

      @Nonnull public org.joml.Vector3f getSpawnOffset()
      Returns:
      the spawn offset of this projectile.
    • isRotateSpawnOffsetByPitch

      public boolean isRotateSpawnOffsetByPitch()
      Returns:
      whether the spawn offset is rotated by the launch pitch.
    • isRotateSpawnOffsetByYaw

      public boolean isRotateSpawnOffsetByYaw()
      Returns:
      whether the spawn offset is rotated by the launch yaw.
    • getSpawnRotationOffset

      @Nonnull public Direction getSpawnRotationOffset()
      Returns:
      the spawn rotation offset of this projectile.
    • getCalculatedOffset

      @Nonnull public org.joml.Vector3d getCalculatedOffset(float pitch, float yaw)
      Called to calculate and return the rotated spawn offset based on the given pitch and yaw.
      Parameters:
      pitch - The given pitch.
      yaw - The given yaw.
      Returns:
      the calculated offset.
    • toPacket

      @Nonnull public ProjectileConfig toPacket()
      Specified by:
      toPacket in interface NetworkSerializable<ProjectileConfig>