Skip to content

Commit e779970

Browse files
MrHell228Faithcaio
authored andcommitted
Add Viewer#sendBlockProgress
1 parent 734374c commit e779970

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

src/main/java/org/spongepowered/api/effect/Viewer.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,60 @@ default void resetBlockChange(final Vector3i position) {
161161
*/
162162
void resetBlockChange(int x, int y, int z);
163163

164+
/**
165+
* Sends a client-only block breaking progress.
166+
*
167+
* <p>In vanilla breaking progress will not be rendered if player
168+
* is further than 32 blocks from given position.<br>
169+
* Sent breaking progress expires on client 400 ticks after receiving.</p>
170+
*
171+
* @param position The position
172+
* @param progress The breaking progress from 0 to 1 (1 excluded)
173+
*/
174+
default void sendBlockProgress(final Vector3i position, final float progress) {
175+
Objects.requireNonNull(position, "position");
176+
this.sendBlockProgress(position.x(), position.y(), position.z(), progress);
177+
}
178+
179+
/**
180+
* Sends a client-only block breaking progress.
181+
*
182+
* <p>In vanilla breaking progress will not be rendered if player
183+
* is further than 32 blocks from given position.<br>
184+
* Sent breaking progress expires on client 400 ticks after receiving.</p>
185+
*
186+
* @param x The x position
187+
* @param y The y position
188+
* @param z The z position
189+
* @param progress The breaking progress from 0 to 1 (1 excluded)
190+
*/
191+
void sendBlockProgress(int x, int y, int z, float progress);
192+
193+
/**
194+
* Resets the client's view of the provided position to actual
195+
* breaking progress.
196+
*
197+
* <p>This is useful for resetting what the client sees
198+
* after sending a {@link #sendBlockProgress block progress}.</p>
199+
*
200+
* @param position The position
201+
*/
202+
default void resetBlockProgress(final Vector3i position) {
203+
Objects.requireNonNull(position, "position");
204+
this.resetBlockProgress(position.x(), position.y(), position.z());
205+
}
206+
207+
/**
208+
* Resets the client's view of the provided position to actual
209+
* breaking progress.
210+
*
211+
* <p>This is useful for resetting what the client sees
212+
* after sending a {@link #sendBlockProgress block progress}.</p>
213+
*
214+
* @param x The x position
215+
* @param y The y position
216+
* @param z The z position
217+
*/
218+
void resetBlockProgress(int x, int y, int z);
219+
164220
}

0 commit comments

Comments
 (0)