Class RadioRouter

java.lang.Object
com.codinglitch.simpleradio.radio.RadioRouter
All Implemented Interfaces:
Socket, Router
Direct Known Subclasses:
RadioListener, RadioReceiver, RadioSpeaker, RadioTransmitter

public class RadioRouter extends Object implements Socket, Router
Routes RadioSources to other routers.
  • Field Details

    • wires

      public List<Wiring> wires
    • routers

      public List<Router> routers
    • routerAcceptor

      public Function<RadioSource,Boolean> routerAcceptor
    • routeCriteria

      public BiPredicate<Source,Router> routeCriteria
    • acceptCriteria

      public Predicate<Source> acceptCriteria
    • active

      public boolean active
    • distributes

      public boolean distributes
    • valid

      public boolean valid
    • identifier

      public short identifier
    • reference

      public UUID reference
    • owner

      public net.minecraft.world.entity.Entity owner
    • position

      public WorldlyPosition position
    • oldPosition

      public org.joml.Vector3f oldPosition
    • velocity

      public org.joml.Vector3f velocity
    • activity

      public float activity
    • activityTime

      public int activityTime
    • compiledActivity

      public float compiledActivity
    • compiledSamples

      public int compiledSamples
    • rotation

      public org.joml.Quaternionf rotation
    • connectionOffset

      public net.minecraft.world.phys.Vec3 connectionOffset
  • Constructor Details

    • RadioRouter

      public RadioRouter(UUID reference)
    • RadioRouter

      public RadioRouter()
    • RadioRouter

      public RadioRouter(WorldlyPosition location)
    • RadioRouter

      public RadioRouter(WorldlyPosition location, UUID reference)
  • Method Details

    • getRouterFromReceivers

      @Nullable public static @Nullable Receiver getRouterFromReceivers(UUID reference)
    • getRouterFromTransmitters

      @Nullable public static @Nullable Transmitter getRouterFromTransmitters(UUID reference)
    • setRoutingCriteria

      public void setRoutingCriteria(BiPredicate<Source,Router> criteria)
      Specified by:
      setRoutingCriteria in interface Router
    • setAcceptingCriteria

      public void setAcceptingCriteria(Predicate<Source> criteria)
      Specified by:
      setAcceptingCriteria in interface Router
    • getRouter

      public RadioRouter getRouter()
      Description copied from interface: Socket
      Override this to expose a given router to wires.
      Allows blocks with more than one router to choose which of their routers wires will connect to.
      Specified by:
      getRouter in interface Socket
      Returns:
      The router to be exposed
    • getReference

      public UUID getReference()
      Specified by:
      getReference in interface Router
      Specified by:
      getReference in interface Socket
    • getIdentifier

      public short getIdentifier()
      Specified by:
      getIdentifier in interface Router
      Specified by:
      getIdentifier in interface Socket
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface Router
    • isValid

      public boolean isValid()
      Specified by:
      isValid in interface Router
    • getConnectionOffset

      public net.minecraft.world.phys.Vec3 getConnectionOffset()
      Specified by:
      getConnectionOffset in interface Router
    • getLink

      public Class<?> getLink()
      Specified by:
      getLink in interface Router
    • getWires

      public List<Wiring> getWires()
      Specified by:
      getWires in interface Router
      Specified by:
      getWires in interface Socket
    • getDecoder

      public de.maxhenkel.voicechat.api.opus.OpusDecoder getDecoder(UUID sender)
    • getEncoder

      public de.maxhenkel.voicechat.api.opus.OpusEncoder getEncoder(UUID sender)
    • getFrequency

      @Nullable public @Nullable Frequency getFrequency()
      Specified by:
      getFrequency in interface Router
    • isClientSide

      @Nullable public @Nullable Boolean isClientSide()
      Specified by:
      isClientSide in interface Router
    • getLocation

      public WorldlyPosition getLocation()
      Specified by:
      getLocation in interface Router
    • getPosition

      @Nullable public @Nullable WorldlyPosition getPosition()
      Specified by:
      getPosition in interface Router
    • getOwner

      @Nullable public @Nullable net.minecraft.world.entity.Entity getOwner()
      Specified by:
      getOwner in interface Router
    • getRouter

      public Router getRouter(UUID id)
      Specified by:
      getRouter in interface Router
    • getRouters

      public List<Router> getRouters()
      Specified by:
      getRouters in interface Router
    • getConnectionPosition

      public net.minecraft.world.phys.Vec3 getConnectionPosition()
      Specified by:
      getConnectionPosition in interface Router
    • getVelocity

      public org.joml.Vector3f getVelocity()
      Specified by:
      getVelocity in interface Router
    • getActivity

      public float getActivity()
      Specified by:
      getActivity in interface Router
    • getActivityTime

      public int getActivityTime()
      Specified by:
      getActivityTime in interface Router
    • getRedstoneMappedActivity

      public int getRedstoneMappedActivity()
      Specified by:
      getRedstoneMappedActivity in interface Router
    • getRotation

      public org.joml.Quaternionf getRotation()
      Specified by:
      getRotation in interface Router
    • allowDistribution

      public void allowDistribution()
      Specified by:
      allowDistribution in interface Router
    • setOwner

      public void setOwner(net.minecraft.world.entity.Entity owner)
      Specified by:
      setOwner in interface Router
    • setActive

      public void setActive(boolean active)
      Specified by:
      setActive in interface Router
    • setLink

      public void setLink(Class<?> link)
      Specified by:
      setLink in interface Router
    • setConnectionOffset

      public void setConnectionOffset(net.minecraft.world.phys.Vec3 connectionOffset)
      Specified by:
      setConnectionOffset in interface Router
    • setPosition

      public void setPosition(WorldlyPosition position)
      Specified by:
      setPosition in interface Router
    • setRotation

      public void setRotation(org.joml.Quaternionf rotation)
      Specified by:
      setRotation in interface Router
    • distanceTo

      public double distanceTo(Router other)
      Specified by:
      distanceTo in interface Router
    • distanceTo

      public double distanceTo(RadioRouter other)
    • tryAddRouter

      public Router tryAddRouter(Router router)
      Specified by:
      tryAddRouter in interface Router
    • tryAddRouter

      public Router tryAddRouter(RadioRouter router)
    • addRouter

      public Router addRouter(Router router)
      Specified by:
      addRouter in interface Router
    • accept

      public void accept(Source source)
      Specified by:
      accept in interface Router
    • take

      public void take(Source source)
    • send

      public void send(WorldlyPosition at, UUID sender, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> soundHolder, float volume, float pitch, long seed)
      Specified by:
      send in interface Router
    • send

      public void send(WorldlyPosition at, UUID sender, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> soundHolder, float volume, float pitch, float offset, long seed)
      Specified by:
      send in interface Router
    • send

      public Source send(WorldlyPosition at, UUID sender, short[] data, float volume)
      Description copied from interface: Router
      Builds a Source and sends it to this router.
      Specified by:
      send in interface Router
      Parameters:
      at - The location to send it from.
      sender - The sender of the audio.
      data - The data to send, in raw PCM format.
      volume - The overall volume of the audio.
    • send

      public Source send(WorldlyPosition at, short[] data, float volume)
      Specified by:
      send in interface Router
    • send

      public Source send(UUID sender, short[] data, float volume)
      Specified by:
      send in interface Router
    • send

      public Source send(short[] data, float volume)
      Specified by:
      send in interface Router
    • send

      public Source send(WorldlyPosition at, UUID sender, byte[] data, float volume)
      Description copied from interface: Router
      Builds a Source and sends it to this router.
      Specified by:
      send in interface Router
      Parameters:
      at - The location to send it from.
      sender - The sender of the audio.
      data - The data to send, in Opus-encoded format.
      volume - The overall volume of the audio.
    • send

      public Source send(WorldlyPosition at, byte[] data, float volume)
      Specified by:
      send in interface Router
    • send

      public Source send(UUID sender, byte[] data, float volume)
      Specified by:
      send in interface Router
    • send

      public Source send(byte[] data, float volume)
      Specified by:
      send in interface Router
    • updateLocation

      public void updateLocation(WorldlyPosition location)
    • updateRotation

      public void updateRotation(org.joml.Quaternionf rotation)
    • tick

      public void tick(int tickCount)
    • prepareSource

      public RadioSource prepareSource(RadioSource source, RadioRouter destination)
    • shouldRouteTo

      public boolean shouldRouteTo(RadioSource source, RadioRouter destination)
    • route

      public void route(Source source, @Nullable @Nullable Predicate<RadioRouter> criteria)
    • route

      public void route(Source source)
      Specified by:
      route in interface Router
    • compileActivity

      public void compileActivity(Source source)
    • informActivity

      public void informActivity()
    • invalidate

      public void invalidate()
      Specified by:
      invalidate in interface Router
    • validate

      public boolean validate()
      Specified by:
      validate in interface Router
    • toString

      public String toString()
      Overrides:
      toString in class Object