Class RadioRouter
java.lang.Object
com.codinglitch.simpleradio.radio.RadioRouter
- Direct Known Subclasses:
RadioListener,RadioReceiver,RadioSpeaker,RadioTransmitter
Routes RadioSources to other routers.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanfloatintfloatintnet.minecraft.world.phys.Vec3booleanshortClass<?> net.minecraft.world.entity.Entityorg.joml.Quaternionfboolean -
Constructor Summary
ConstructorsConstructorDescriptionRadioRouter(WorldlyPosition location) RadioRouter(WorldlyPosition location, UUID reference) RadioRouter(UUID reference) -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts the message, notifying any integrations (such as CC:Tweaked) before taking the message.Links another router to this one.voidMarks that this router can distribute messages through wires.voidcompileActivity(Message message) voiddispatch()This method is called on the dispatcher thread, when every audio frame is meant to move at once.doubledistanceTo(RadioRouter other) doubledistanceTo(Router other) extract()floatintnet.minecraft.world.phys.Vec3net.minecraft.world.phys.Vec3de.maxhenkel.voicechat.api.opus.OpusDecodergetDecoder(UUID sender) @Nullable FrequencyshortRetrieves the identifier that refers to this router.Class<?> getLink()Gets the effective location of this router.@Nullable net.minecraft.world.entity.EntitygetOwner()@Nullable WorldlyPositionintRetrieves the reference that refers to this router.org.joml.QuaternionfOverride this to expose a given router to wires.static @Nullable ReceivergetRouterFromReceivers(UUID reference) static @Nullable TransmittergetRouterFromTransmitters(UUID reference) getWires()voidvoidInserts a message into the buffer, where it will be extracted by the courier.voidbooleanisActive()@Nullable BooleanbooleanisValid()prepareSource(RadioMessage message, RadioRouter destination) voidpush(short[] audio) Pushes audio data into a separate buffer that dynamically splits it into the needed frame size.voidRoutes the given message to all the routers connected to this one.voidroute(Message message, @Nullable Predicate<RadioRouter> criteria) send(byte[] data, float volume) send(short[] data, float volume) send(WorldlyPosition at, byte[] data, float volume) send(WorldlyPosition at, short[] data, float volume) send(WorldlyPosition at, UUID sender, byte[] data, float volume) Builds aMessageand sends it to this router.send(WorldlyPosition at, UUID sender, short[] data, float volume) Builds aMessageand sends it to this router.voidsend(WorldlyPosition at, UUID sender, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> soundHolder, float volume, float pitch, float offset, long seed) voidsend(WorldlyPosition at, UUID sender, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> soundHolder, float volume, float pitch, long seed) voidsetAcceptingCriteria(Predicate<Message> criteria) voidsetActive(boolean active) voidsetConnectionOffset(net.minecraft.world.phys.Vec3 connectionOffset) voidvoidsetOwner(net.minecraft.world.entity.Entity owner) voidsetPosition(WorldlyPosition position) voidsetRotation(org.joml.Quaternionf rotation) voidsetRoutingCriteria(BiPredicate<Message, Router> criteria) booleanshouldRouteTo(RadioMessage message, RadioRouter destination) voidTakes the message, and pushes it if this router is capable of doing so.voidtick(int tickCount) toString()tryAddRouter(RadioRouter router) tryAddRouter(Router router) Tries to link another router to this one if it doesn't already exist.voidupdateLocation(WorldlyPosition location) voidupdateRotation(org.joml.Quaternionf rotation) booleanvalidate()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.codinglitch.simpleradio.central.Socket
canConnect, canConnectTo, connect, disconnect, disconnect, distribute, hasWire, hasWire, shortCircuit
-
Field Details
-
wires
-
routers
-
pending
-
routerAcceptor
-
routeCriteria
-
acceptCriteria
-
active
public boolean active -
distributes
public boolean distributes -
valid
public boolean valid -
identifier
public short identifier -
reference
-
owner
public net.minecraft.world.entity.Entity owner -
position
-
activity
public float activity -
activityTime
public int activityTime -
compiledActivity
public float compiledActivity -
compiledSamples
public int compiledSamples -
link
-
rotation
public org.joml.Quaternionf rotation -
connectionOffset
public net.minecraft.world.phys.Vec3 connectionOffset
-
-
Constructor Details
-
RadioRouter
-
RadioRouter
public RadioRouter() -
RadioRouter
-
RadioRouter
-
-
Method Details
-
getRouterFromReceivers
-
getRouterFromTransmitters
-
setRoutingCriteria
- Specified by:
setRoutingCriteriain interfaceRouter
-
setAcceptingCriteria
- Specified by:
setAcceptingCriteriain interfaceRouter
-
getRouter
Description copied from interface:SocketOverride 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. -
getReference
Description copied from interface:RouterRetrieves the reference that refers to this router. This is not necessarily unique for each router, but will persist across reloads, and is the same across the server-client boundary.
Routers that belong to the same purpose will share the same reference, but two unrelated routers will have a different reference. That is, a transceiver can have 4 different routers with the same reference differentiated by their class.- Specified by:
getReferencein interfaceRouter- Specified by:
getReferencein interfaceSocket- Returns:
- The reference of this router
-
getIdentifier
public short getIdentifier()Description copied from interface:RouterRetrieves the identifier that refers to this router. Identifiers are unique for every router, but are ephemeral, so they do not persist across reloads. You should not rely on this to be the same or stay the same.
For a short-livedMessage, this is used to keep a record of every router it has visited, to ensure that it cannot loop forever and cause a potential stack overflow or memory leak.- Specified by:
getIdentifierin interfaceRouter- Specified by:
getIdentifierin interfaceSocket- Returns:
- The identifier of this router
-
isActive
public boolean isActive() -
isValid
public boolean isValid() -
getConnectionOffset
public net.minecraft.world.phys.Vec3 getConnectionOffset()- Specified by:
getConnectionOffsetin interfaceRouter
-
getLink
-
getWires
-
getDecoder
-
getFrequency
- Specified by:
getFrequencyin interfaceRouter
-
isClientSide
- Specified by:
isClientSidein interfaceRouter
-
getLocation
Description copied from interface:RouterGets the effective location of this router. If position is provided, will use that, otherwise will infer the position from the entity owning this router.- Specified by:
getLocationin interfaceRouter
-
getPosition
- Specified by:
getPositionin interfaceRouter
-
getOwner
@Nullable public @Nullable net.minecraft.world.entity.Entity getOwner() -
getRouter
-
getRouters
- Specified by:
getRoutersin interfaceRouter
-
getConnectionPosition
public net.minecraft.world.phys.Vec3 getConnectionPosition()- Specified by:
getConnectionPositionin interfaceRouter
-
getPending
- Specified by:
getPendingin interfaceRouter
-
getActivity
public float getActivity()- Specified by:
getActivityin interfaceRouter
-
getActivityTime
public int getActivityTime()- Specified by:
getActivityTimein interfaceRouter
-
getRedstoneMappedActivity
public int getRedstoneMappedActivity()- Specified by:
getRedstoneMappedActivityin interfaceRouter
-
getRotation
public org.joml.Quaternionf getRotation()- Specified by:
getRotationin interfaceRouter
-
allowDistribution
public void allowDistribution()Description copied from interface:RouterMarks that this router can distribute messages through wires.- Specified by:
allowDistributionin interfaceRouter
-
setOwner
public void setOwner(net.minecraft.world.entity.Entity owner) -
setActive
public void setActive(boolean active) -
setLink
-
setConnectionOffset
public void setConnectionOffset(net.minecraft.world.phys.Vec3 connectionOffset) - Specified by:
setConnectionOffsetin interfaceRouter
-
setPosition
- Specified by:
setPositionin interfaceRouter
-
setRotation
public void setRotation(org.joml.Quaternionf rotation) - Specified by:
setRotationin interfaceRouter
-
distanceTo
- Specified by:
distanceToin interfaceRouter
-
distanceTo
-
tryAddRouter
Description copied from interface:RouterTries to link another router to this one if it doesn't already exist.- Specified by:
tryAddRouterin interfaceRouter
-
tryAddRouter
-
addRouter
Description copied from interface:RouterLinks another router to this one. -
accept
Description copied from interface:RouterAccepts the message, notifying any integrations (such as CC:Tweaked) before taking the message. -
dispatch
public void dispatch()Description copied from interface:RouterThis method is called on the dispatcher thread, when every audio frame is meant to move at once. It is overridden by the speaker to stream audio data to clients.
(Note that this is called after the router has received its message) -
take
Description copied from interface:RouterTakes the message, and pushes it if this router is capable of doing so. -
insert
Description copied from interface:RouterInserts a message into the buffer, where it will be extracted by the courier. This method does not make any checks and will forcefully insert the message. -
push
public void push(short[] audio) Description copied from interface:RouterPushes audio data into a separate buffer that dynamically splits it into the needed frame size. This method may leave leftover samples if the total amount is not a multiple of the frame size. -
extract
-
send
public void send(WorldlyPosition at, UUID sender, net.minecraft.core.Holder<net.minecraft.sounds.SoundEvent> soundHolder, float volume, float pitch, long seed) -
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) -
send
Description copied from interface:RouterBuilds aMessageand sends it to this router. -
send
-
send
-
send
-
send
Description copied from interface:RouterBuilds aMessageand sends it to this router. -
send
-
send
-
send
-
updateLocation
-
updateRotation
public void updateRotation(org.joml.Quaternionf rotation) -
tick
public void tick(int tickCount) -
prepareSource
-
shouldRouteTo
-
route
-
route
Description copied from interface:RouterRoutes the given message to all the routers connected to this one.
If the router allows distribution through wires, this will also relay it across those. -
compileActivity
-
informActivity
public void informActivity() -
invalidate
public void invalidate()- Specified by:
invalidatein interfaceRouter
-
validate
public boolean validate() -
toString
-