Interface Viewer

All Superinterfaces:
Audience, Pointered
All Known Subinterfaces:
ClientPlayer, ClientWorld, LocalPlayer, Player, RemotePlayer, ServerPlayer, ServerWorld, World<W,L>

public interface Viewer extends Audience
A Viewer is something that sees effects. The Viewer class contains methods for spawning particles and playing sound effects.
  • Method Details

    • sendWorldType

      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.

      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

      default void spawnParticles(ParticleEffect particleEffect, Vector3d position)
      Spawn a ParticleEffect at a given position. All players within a default radius around the position will see the particles.
      Parameters:
      particleEffect - The particle effect to spawn
      position - The position at which to spawn the particle effect
    • spawnParticles

      void spawnParticles(ParticleEffect particleEffect, Vector3d position, int radius)
      Spawn a ParticleEffect at a given position. All players within a given radius around the position will see the particles.
      Parameters:
      particleEffect - The particle effect to spawn
      position - The position at which to spawn the particle effect
      radius - The radius around the position where the particles can be seen by players
    • playSound

      default void playSound(@NonNull Sound sound, Vector3d pos)
      Plays a sound.
      Parameters:
      sound - the sound
      pos - the position to play the sound at
    • playMusicDisc

      void playMusicDisc(Vector3i position, MusicDisc musicDiscType)
      Plays the given MusicDisc at the given position. The benefit of playing MusicDisc instead of a SoundType allows you to stop them through the stopMusicDisc(Vector3i). Playing a new MusicDisc at the same position will cancel the currently playing one.
      Parameters:
      position - The position
      musicDiscType - The music disc
    • stopMusicDisc

      void stopMusicDisc(Vector3i position)
      Stops the MusicDisc that is playing at the given position.
      Parameters:
      position - The position
    • sendBlockChange

      default void sendBlockChange(Vector3i position, BlockState state)
      Sends a client-only block change.

      This will not change the World in any way.

      Parameters:
      position - The position
      state - The block state
    • sendBlockChange

      void sendBlockChange(int x, int y, int z, BlockState state)
      Sends a client-only block change.

      This will not change the World in any way.

      Parameters:
      x - The x position
      y - The y position
      z - The z position
      state - The block state
    • resetBlockChange

      default void resetBlockChange(Vector3i position)
      Resets the client's view of the provided position to what actually exists in the World.

      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 the World.

      This is useful for resetting what the client sees after sending a block change.

      Parameters:
      x - The x position
      y - The y position
      z - The z position