Package com.codinglitch.simpleradio
Class SimpleRadioApi
java.lang.Object
com.codinglitch.simpleradio.SimpleRadioApi
- Direct Known Subclasses:
ClientSimpleRadioApi,ServerSimpleRadioApi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidabstract voidabstract Frequenciesabstract <T> Optional<T>Gets a config entry from a specified pathstatic SimpleRadioApistatic SimpleRadioApigetInstance(boolean isClient) static RoutergetRouterSided(UUID reference, boolean isClient) static RoutergetRouterSided(UUID reference, @Nullable String type, boolean isClient) abstract voidabstract <E extends SimpleRadioEvent>
voidabstract RouternewRouter(WorldlyPosition position) Creates a blank Router at the specified location with a random UUID.abstract RouterCreates a blank Router with the specified reference.abstract RouternewRouter(UUID reference, WorldlyPosition position) Creates a blank Router at the specified location with the specified reference.abstract SourcenewSource(UUID owner, WorldlyPosition location, byte[] data, float volume) abstract <R extends Router>
voidregisterRouter(R router) abstract <R extends Router>
voidregisterRouter(R router, @Nullable Frequency frequency) static voidregisterRouterSided(Router router, boolean isClient, @Nullable Frequency frequency) static RouterremoveRouterSided(WorldlyPosition position, boolean isClient) Removes the given router from the global map given the indicated side.static RouterremoveRouterSided(Router router, boolean isClient) Removes the given router from the global map given the indicated side.static RouterremoveRouterSided(UUID uuid, boolean isClient) Removes the given router from the global map given the indicated side.abstract <T> voidSets a config entry from a specified pathabstract net.minecraft.core.BlockPostravelExtension(net.minecraft.core.BlockPos pos, net.minecraft.world.level.LevelAccessor level) abstract void
-
Constructor Details
-
SimpleRadioApi
public SimpleRadioApi()
-
-
Method Details
-
getInstance
-
getInstance
-
frequencies
-
getConfig
Gets a config entry from a specified pathTo get the soundListening entry from the router config:
ServerSimpleRadioApi.getInstance().getConfig("router.soundListening");- Parameters:
path- The path to the config entry- Returns:
- An optional containing the value, if found
-
setConfig
Sets a config entry from a specified pathTo set the soundListening entry from the router config:
ServerSimpleRadioApi.getInstance().getConfig("router.soundListening", true);- Parameters:
path- The path to the config entryvalue- The value to set the config entry to
-
listen
-
travelExtension
public abstract net.minecraft.core.BlockPos travelExtension(net.minecraft.core.BlockPos pos, net.minecraft.world.level.LevelAccessor level) -
registerRouter
-
registerRouter
-
newRouter
Creates a blank Router with the specified reference.- Parameters:
reference- The reference. If you are creating a block entity with a router, this should be equivalent to a UUID you store and save.- Returns:
- The created router.
-
newRouter
Creates a blank Router at the specified location with a random UUID. Most of the time, you should instead usenewRouter(UUID)ornewRouter(UUID, WorldlyPosition).- Parameters:
position- The location of the router.- Returns:
- The created router
-
newRouter
Creates a blank Router at the specified location with the specified reference.- Parameters:
reference- The reference. If you are creating a block entity with a router, this should be equivalent to a UUID you store and save.position- The location of the router.- Returns:
- The created router
-
newSource
-
info
-
debug
-
warn
-
error
-
getRouterSided
-
getRouterSided
-
registerRouterSided
-
removeRouterSided
Removes the given router from the global map given the indicated side. This will consequently make this router invalid.It should be noted that this does not remove it from the individual router maps (Listeners, Speakers, etc.)
- Parameters:
uuid- The UUID of the router to remove.isClient- Whether or not to remove it from the client or server map.- Returns:
- The router that was removed, if it exists.
-
removeRouterSided
Removes the given router from the global map given the indicated side. This will consequently make this router invalid.It should be noted that this does not remove it from the individual router maps (Listeners, Speakers, etc.)
- Parameters:
router- The router to remove.isClient- Whether or not to remove it from the client or server map.- Returns:
- The router that was removed, if it exists.
-
removeRouterSided
Removes the given router from the global map given the indicated side. This will consequently make this router invalid.It should be noted that this does not remove it from the individual router maps (Listeners, Speakers, etc.)
- Parameters:
position- The position of the router to remove.isClient- Whether or not to remove it from the client or server map.- Returns:
- The router that was removed, if it exists.
-