Class ProjectileHelper

java.lang.Object
com.teampotato.potacore.entity.ProjectileHelper

public class ProjectileHelper extends Object
A utility class for handling projectile-related entity operations with deduplication logic.

This class provides a method to process two potentially related entities while ensuring the same entity isn't processed twice when both references point to the same entity.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    handle(@Nullable net.minecraft.world.entity.Entity entity, @Nullable net.minecraft.world.entity.Entity directEntity, @NotNull Runnable action)
    Processes the specified entities with the given action, avoiding duplicate processing when both parameters refer to the same entity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProjectileHelper

      public ProjectileHelper()
  • Method Details

    • handle

      public static void handle(@Nullable @Nullable net.minecraft.world.entity.Entity entity, @Nullable @Nullable net.minecraft.world.entity.Entity directEntity, @NotNull @NotNull Runnable action)
      Processes the specified entities with the given action, avoiding duplicate processing when both parameters refer to the same entity.
      Parameters:
      entity - The primary entity to process (typically a projectile). May be null.
      directEntity - The direct source entity to process (typically the projectile owner). May be null.
      action - The non-null runnable action to perform.
      Throws:
      NullPointerException - if action is null