Interface ICircleComponent

All Known Implementing Classes:
BlockAbstractImpetus, BlockBooleanDirectrix, BlockCircleComponent, BlockEmptyDirectrix, BlockEmptyImpetus, BlockLookingImpetus, BlockRedstoneDirectrix, BlockRedstoneImpetus, BlockRightClickImpetus, BlockSlate

public interface ICircleComponent
Implement this on a block to make circles interact with it.

This is its own interface so you can have your blocks subclass something else, and to avoid enormous files. The mod doesn't check for the interface on anything but blocks.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    acceptControlFlow(at.petrak.hexcasting.api.casting.eval.vm.CastingImage imageIn, CircleCastEnv env, net.minecraft.core.Direction enterDir, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.server.level.ServerLevel world)
    The heart of the interface! Functionally modify the casting environment.
    boolean
    canEnterFromDirection(net.minecraft.core.Direction enterDir, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.server.level.ServerLevel world)
    Can this component get transferred to from a block coming in from that direction, with the given normal?
    net.minecraft.world.level.block.state.BlockState
    endEnergized(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
    End the ICircleComponent at the given position glowing.
    default com.mojang.datafixers.util.Pair<net.minecraft.core.BlockPos,net.minecraft.core.Direction>
    exitPositionFromDirection(net.minecraft.core.BlockPos pos, net.minecraft.core.Direction dir)
    Given the current position and a direction, return a pair of the new position after a step in that direction, along with the direction (this is a helper function for creating ICircleComponent.ControlFlows.
    default void
    fakeThrowMishap(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, at.petrak.hexcasting.api.casting.eval.vm.CastingImage image, CircleCastEnv env, at.petrak.hexcasting.api.casting.mishaps.Mishap mishap)
    Helper function to "throw a mishap"
    boolean
    isEnergized(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
    Returns whether the ICircleComponent at the given position is energized.
    EnumSet<net.minecraft.core.Direction>
    possibleExitDirections(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
    This determines the directions the control flow can exit from.
    static void
    sfx(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world, BlockEntityAbstractImpetus impetus, boolean success)
     
    net.minecraft.world.level.block.state.BlockState
    startEnergized(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
    Start the ICircleComponent at the given position glowing.
  • Method Details

    • acceptControlFlow

      ICircleComponent.ControlFlow acceptControlFlow(at.petrak.hexcasting.api.casting.eval.vm.CastingImage imageIn, CircleCastEnv env, net.minecraft.core.Direction enterDir, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.server.level.ServerLevel world)
      The heart of the interface! Functionally modify the casting environment.

      With the new update you can have the side effects happen inline. In fact, you have to have the side effects happen inline.

      Also, return a list of directions that the control flow can exit this block in. The circle environment will mishap if not exactly 1 of the returned directions can be accepted from.

    • canEnterFromDirection

      @Contract(pure=true) boolean canEnterFromDirection(net.minecraft.core.Direction enterDir, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.server.level.ServerLevel world)
      Can this component get transferred to from a block coming in from that direction, with the given normal?
    • possibleExitDirections

      @Contract(pure=true) EnumSet<net.minecraft.core.Direction> possibleExitDirections(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
      This determines the directions the control flow can exit from. It's called at the beginning of execution to see if the circle actually forms a loop.

      For most blocks, this should be the same as returned from acceptControlFlow(at.petrak.hexcasting.api.casting.eval.vm.CastingImage, at.petrak.hexcasting.api.casting.eval.env.CircleCastEnv, net.minecraft.core.Direction, net.minecraft.core.BlockPos, net.minecraft.world.level.block.state.BlockState, net.minecraft.server.level.ServerLevel) Things like directrices might return otherwise. Whatever is returned when controlling flow must be a subset of this set.

    • exitPositionFromDirection

      @Contract(pure=true) default com.mojang.datafixers.util.Pair<net.minecraft.core.BlockPos,net.minecraft.core.Direction> exitPositionFromDirection(net.minecraft.core.BlockPos pos, net.minecraft.core.Direction dir)
      Given the current position and a direction, return a pair of the new position after a step in that direction, along with the direction (this is a helper function for creating ICircleComponent.ControlFlows.
    • startEnergized

      net.minecraft.world.level.block.state.BlockState startEnergized(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
      Start the ICircleComponent at the given position glowing. Returns the new state of the given block. // TODO: determine if this should just be in acceptControlFlow(CastingImage, CircleCastEnv, Direction, BlockPos, BlockState, ServerLevel).
    • isEnergized

      boolean isEnergized(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
      Returns whether the ICircleComponent at the given position is energized.
    • endEnergized

      net.minecraft.world.level.block.state.BlockState endEnergized(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world)
      End the ICircleComponent at the given position glowing. Returns the new state of the given block.
    • sfx

      static void sfx(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, net.minecraft.world.level.Level world, BlockEntityAbstractImpetus impetus, boolean success)
    • fakeThrowMishap

      default void fakeThrowMishap(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState bs, at.petrak.hexcasting.api.casting.eval.vm.CastingImage image, CircleCastEnv env, at.petrak.hexcasting.api.casting.mishaps.Mishap mishap)
      Helper function to "throw a mishap"