41
41
42
42
/**
43
43
* A Viewer is something that sees effects.
44
- * The Viewer class contains methods for spawning particles and playing sound
45
- * effects.
44
+ * E.g. the Viewer class contains methods for spawning particles and playing
45
+ * sound effects.
46
46
*/
47
47
public interface Viewer extends Audience {
48
48
49
49
/**
50
- * Sends the effect of being in a particular Vanilla world environment, such as the Nether,
50
+ * Sends the effect of being in a particular world environment, such as the Nether,
51
51
* as an effect to the viewer.
52
52
*
53
- * <p>For example, specifying {@link WorldTypes#THE_NETHER} will create a red skybox and
54
- * red hazy fog on the vanilla minecraft client</p>
53
+ * <p>For example, specifying {@link WorldTypes#THE_NETHER} will create an empty skybox
54
+ * and hazy fog on the vanilla minecraft client</p>
55
55
*
56
56
* @param worldType The world type
57
57
*/
58
58
void sendWorldType (WorldType worldType );
59
59
60
60
/**
61
- * Spawn a {@link ParticleEffect} at a given position.
62
- * All players within a default radius around the position will see the
63
- * particles.
61
+ * Spawn the given {@link ParticleEffect} at the given position.
64
62
*
65
63
* @param particleEffect The particle effect to spawn
66
- * @param position The position at which to spawn the particle effect
64
+ * @param position The position
67
65
*/
68
66
default void spawnParticles (final ParticleEffect particleEffect , final Vector3d position ) {
69
- this .spawnParticles (Objects .requireNonNull (particleEffect , "particleEffect" ), Objects .requireNonNull (position , "position" ), Integer .MAX_VALUE );
67
+ Objects .requireNonNull (position , "position" );
68
+ this .spawnParticles (particleEffect , position .x (), position .y (), position .z ());
70
69
}
71
70
72
71
/**
73
- * Spawn a {@link ParticleEffect} at a given position.
74
- * All players within a given radius around the position will see the
75
- * particles.
72
+ * Spawn the given {@link ParticleEffect} at the given position.
76
73
*
77
74
* @param particleEffect The particle effect to spawn
78
- * @param position The position at which to spawn the particle effect
79
- * @param radius The radius around the position where the particles can be
80
- * seen by players
75
+ * @param x The x position
76
+ * @param y The y position
77
+ * @param z The z position
81
78
*/
82
- void spawnParticles (ParticleEffect particleEffect , Vector3d position , int radius );
79
+ void spawnParticles (ParticleEffect particleEffect , double x , double y , double z );
83
80
84
81
/**
85
- * Plays a sound .
82
+ * Plays the given {@link Sound} at the given position .
86
83
*
87
- * @param sound the sound
88
- * @param pos the position to play the sound at
84
+ * @param sound The sound
85
+ * @param position The position
89
86
*/
90
- default void playSound (final @ NonNull Sound sound , final Vector3d pos ) {
91
- this .playSound (sound , pos .x (), pos .y (), pos .z ());
87
+ default void playSound (final @ NonNull Sound sound , final Vector3d position ) {
88
+ Objects .requireNonNull (position , "position" );
89
+ this .playSound (sound , position .x (), position .y (), position .z ());
92
90
}
93
91
94
92
/**
@@ -98,16 +96,44 @@ default void playSound(final @NonNull Sound sound, final Vector3d pos) {
98
96
* position will cancel the currently playing one.
99
97
*
100
98
* @param position The position
101
- * @param musicDiscType The music disc
99
+ * @param musicDisc The music disc
100
+ */
101
+ default void playMusicDisc (final Vector3i position , final MusicDisc musicDisc ) {
102
+ Objects .requireNonNull (position , "position" );
103
+ this .playMusicDisc (position .x (), position .y (), position .z (), musicDisc );
104
+ }
105
+
106
+ /**
107
+ * Plays the given {@link MusicDisc} at the given position. The benefit of playing
108
+ * {@link MusicDisc} instead of a {@link SoundType} allows you to stop them through
109
+ * the {@link #stopMusicDisc(Vector3i)}. Playing a new {@link MusicDisc} at the same
110
+ * position will cancel the currently playing one.
111
+ *
112
+ * @param x The x position
113
+ * @param y The y position
114
+ * @param z The z position
115
+ * @param musicDisc The music disc
102
116
*/
103
- void playMusicDisc (Vector3i position , MusicDisc musicDiscType );
117
+ void playMusicDisc (int x , int y , int z , MusicDisc musicDisc );
104
118
105
119
/**
106
120
* Stops the {@link MusicDisc} that is playing at the given position.
107
121
*
108
122
* @param position The position
109
123
*/
110
- void stopMusicDisc (Vector3i position );
124
+ default void stopMusicDisc (final Vector3i position ) {
125
+ Objects .requireNonNull (position , "position" );
126
+ this .stopMusicDisc (position .x (), position .y (), position .z ());
127
+ }
128
+
129
+ /**
130
+ * Stops the {@link MusicDisc} that is playing at the given position.
131
+ *
132
+ * @param x The x position
133
+ * @param y The y position
134
+ * @param z The z position
135
+ */
136
+ void stopMusicDisc (int x , int y , int z );
111
137
112
138
/**
113
139
* Sends a client-only block change.
@@ -119,7 +145,7 @@ default void playSound(final @NonNull Sound sound, final Vector3d pos) {
119
145
*/
120
146
default void sendBlockChange (final Vector3i position , final BlockState state ) {
121
147
Objects .requireNonNull (position , "position" );
122
- this .sendBlockChange (position .x (), position .y (), position .z (), Objects . requireNonNull ( state , "state" ) );
148
+ this .sendBlockChange (position .x (), position .y (), position .z (), state );
123
149
}
124
150
125
151
/**
0 commit comments