Package org.spongepowered.api.effect
Interface Viewer
- All Known Subinterfaces:
ClientPlayer
,ClientWorld
,LocalPlayer
,Player
,RemotePlayer
,ServerPlayer
,ServerWorld
,World<W,
L>
A Viewer is something that sees effects.
The Viewer class contains methods for spawning particles and playing sound
effects.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
playMusicDisc
(Vector3i position, MusicDisc musicDiscType) Plays the givenMusicDisc
at the given position.default void
Plays a sound.void
resetBlockChange
(int x, int y, int z) Resets the client's view of the provided position to what actually exists in theWorld
.default void
resetBlockChange
(Vector3i position) Resets the client's view of the provided position to what actually exists in theWorld
.void
sendBlockChange
(int x, int y, int z, BlockState state) Sends a client-only block change.default void
sendBlockChange
(Vector3i position, BlockState state) Sends a client-only block change.void
sendWorldType
(WorldType worldType) Sends the effect of being in a particular Vanilla world environment, such as the Nether, as an effect to the viewer.default void
spawnParticles
(ParticleEffect particleEffect, Vector3d position) Spawn aParticleEffect
at a given position.void
spawnParticles
(ParticleEffect particleEffect, Vector3d position, int radius) Spawn aParticleEffect
at a given position.void
stopMusicDisc
(Vector3i position) Stops theMusicDisc
that is playing at the given position.Methods inherited from interface net.kyori.adventure.audience.Audience
clearTitle, filterAudience, forEachAudience, hideBossBar, openBook, openBook, playSound, playSound, playSound, resetTitle, sendActionBar, sendActionBar, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendPlayerListFooter, sendPlayerListFooter, sendPlayerListHeader, sendPlayerListHeader, sendPlayerListHeaderAndFooter, sendPlayerListHeaderAndFooter, sendTitlePart, showBossBar, showTitle, stopSound, stopSound
Methods inherited from interface net.kyori.adventure.pointer.Pointered
get, getOrDefault, getOrDefaultFrom, pointers
-
Method Details
-
sendWorldType
Sends the effect of being in a particular Vanilla world environment, such as the Nether, as an effect to the viewer.For example, specifying
WorldTypes.THE_NETHER
will create a red skybox and red hazy fog on the vanilla minecraft client- Parameters:
worldType
- The world type
-
spawnParticles
Spawn aParticleEffect
at a given position. All players within a default radius around the position will see the particles.- Parameters:
particleEffect
- The particle effect to spawnposition
- The position at which to spawn the particle effect
-
spawnParticles
Spawn aParticleEffect
at a given position. All players within a given radius around the position will see the particles.- Parameters:
particleEffect
- The particle effect to spawnposition
- The position at which to spawn the particle effectradius
- The radius around the position where the particles can be seen by players
-
playSound
Plays a sound.- Parameters:
sound
- the soundpos
- the position to play the sound at
-
playMusicDisc
Plays the givenMusicDisc
at the given position. The benefit of playingMusicDisc
instead of aSoundType
allows you to stop them through thestopMusicDisc(Vector3i)
. Playing a newMusicDisc
at the same position will cancel the currently playing one.- Parameters:
position
- The positionmusicDiscType
- The music disc
-
stopMusicDisc
Stops theMusicDisc
that is playing at the given position.- Parameters:
position
- The position
-
sendBlockChange
Sends a client-only block change.This will not change the
World
in any way.- Parameters:
position
- The positionstate
- The block state
-
sendBlockChange
Sends a client-only block change.This will not change the
World
in any way.- Parameters:
x
- The x positiony
- The y positionz
- The z positionstate
- The block state
-
resetBlockChange
Resets the client's view of the provided position to what actually exists in theWorld
.This is useful for resetting what the client sees after sending a
block change
.- Parameters:
position
- The position
-
resetBlockChange
void resetBlockChange(int x, int y, int z) Resets the client's view of the provided position to what actually exists in theWorld
.This is useful for resetting what the client sees after sending a
block change
.- Parameters:
x
- The x positiony
- The y positionz
- The z position
-