Class AbstractCrystallizeElementalReaction

java.lang.Object
io.github.xrickastley.sevenelements.element.reaction.ElementalReaction
io.github.xrickastley.sevenelements.element.reaction.AbstractCrystallizeElementalReaction
Direct Known Subclasses:
CryoCrystallizeElementalReaction, ElectroCrystallizeElementalReaction, FrozenCrystallizeElementalReaction, HydroCrystallizeElementalReaction, PyroCrystallizeElementalReaction

  • Field Details

    • AIR_BLOCKS

      private static final Set<Block> AIR_BLOCKS
  • Constructor Details

  • Method Details

    • onReaction

      protected void onReaction(LivingEntity entity, ElementalApplication auraElement, ElementalApplication triggeringElement, double reducedGauge, @Nullable @Nullable LivingEntity origin)
      Description copied from class: ElementalReaction
      The function to execute after the Elemental Reaction has been triggered. This function is executed after both elements have reacted and have been reduced.
      Specified by:
      onReaction in class ElementalReaction
      Parameters:
      entity - The LivingEntity this Elemental Reaction was triggered on.
      auraElement - The aura element that triggered this reaction.
      triggeringElement - The triggering element that reacted with the aura element.
      reducedGauge - The gauge units reduced from both Elements. This will always be Math.min(auraElementGU, triggeringElementGU * reactionCoefficient)
      origin - The LivingEntity that triggered this Elemental Reaction.
    • toAbsolutePos

      private Vec3d toAbsolutePos(LivingEntity entity, Vec3d lookingPos)
    • clampToGround

      private Vec3d clampToGround(World world, Vec3d pos)
    • scan

      private Optional<BlockPos> scan(World world, BlockPos originPos, Vec3i shift, Predicate<BlockState> blockPredicate, Predicate<BlockPos> posPredicate)
      Starting from the specified initialBlockPos, continuously scan by shfiting the initialBlockPos by shift until the Block at the shifted pos fulfills the blockPredicate or until posPredicate returns false.

      Returns either an Optional containing the BlockPos such that blockPredicate.test(world.getBlockState(blockPos)) returns false or an empty Optional when posPredicate.test(blockPos) prematurely returns false.
      Parameters:
      world - The world.
      originPos - The origin block pos.
      shift - How much to shift by per iteration.
      blockPredicate - The condition that must be fulfilled by the block at the specified position.
      posPredicate - The condition that must be fulfilled for a next iteration to execute.