Interface Viewer

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

public interface Viewer extends Audience
A Viewer is something that sees effects. E.g. 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 world environment, such as the Nether, as an effect to the viewer.

      For example, specifying WorldTypes.THE_NETHER will create an empty skybox and hazy fog on the vanilla minecraft client

      Parameters:
      worldType - The world type
    • spawnParticles

      default void spawnParticles(ParticleEffect particleEffect, Vector3d position)
      Spawn the given ParticleEffect at the given position.
      Parameters:
      particleEffect - The particle effect to spawn
      position - The position
    • spawnParticles

      void spawnParticles(ParticleEffect particleEffect, double x, double y, double z)
      Spawn the given ParticleEffect at the given position.
      Parameters:
      particleEffect - The particle effect to spawn
      x - The x position
      y - The y position
      z - The z position
    • playSound

      default void playSound(@NonNull Sound sound, Vector3d position)
      Plays the given Sound at the given position.
      Parameters:
      sound - The sound
      position - The position
    • playMusicDisc

      default void playMusicDisc(Vector3i position, MusicDisc musicDisc)
      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
      musicDisc - The music disc
    • playMusicDisc

      void playMusicDisc(int x, int y, int z, MusicDisc musicDisc)
      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:
      x - The x position
      y - The y position
      z - The z position
      musicDisc - The music disc
    • stopMusicDisc

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

      void stopMusicDisc(int x, int y, int z)
      Stops the MusicDisc that is playing at the given position.
      Parameters:
      x - The x position
      y - The y position
      z - The z 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
    • sendBlockProgress

      default void sendBlockProgress(Vector3i position, double progress)
      Sends a client-only block breaking progress.
      Parameters:
      position - The position
      progress - The breaking progress from 0 to 1
    • sendBlockProgress

      void sendBlockProgress(int x, int y, int z, double progress)
      Sends a client-only block breaking progress.
      Parameters:
      x - The x position
      y - The y position
      z - The z position
      progress - The breaking progress from 0 to 1
    • resetBlockProgress

      default void resetBlockProgress(Vector3i position)
      Resets the client's view of the provided position to actual breaking progress.

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

      Parameters:
      position - The position
    • resetBlockProgress

      void resetBlockProgress(int x, int y, int z)
      Resets the client's view of the provided position to actual breaking progress.

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

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