Interface IActionSource


public interface IActionSource
The source of any action. This can either be a Player or an IActionHost. In most cases this is used for security checks, but can be used to validate the source itself.
  • Method Details

    • empty

      static IActionSource empty()
      Create a new empty source.
    • ofPlayer

      static IActionSource ofPlayer(net.minecraft.world.entity.player.Player player)
      Create a source for a player.
    • ofPlayer

      static IActionSource ofPlayer(net.minecraft.world.entity.player.Player player, @Nullable @Nullable IActionHost maybeHost)
      Create a source for a player and optionally a machine too (the machine the request is happening through).
    • ofMachine

      static IActionSource ofMachine(IActionHost machine)
      Create a source for a machine.
    • player

      Optional<net.minecraft.world.entity.player.Player> player()
      If present, AE will consider the player being the source for the action. This will take precedence over machine() in any case.
      Returns:
      An optional player issuing the action.
    • machine

      Optional<IActionHost> machine()
      If present, it indicates the IActionHost of the source. Should player() be absent, it will consider a machine as source. It is recommended to include the machine even when a player is present.
      Returns:
      An optional machine issuing the action or acting as proxy for a player.
    • context

      <T> Optional<T> context(Class<T> key)
      An IActionSource can have multiple optional contexts. It is strongly recommended to limit the uses for absolutely necessary cases. Currently there are no public contexts made available by AE. An example would be the context interfaces use internally to avoid looping items between each other.