Skip to content

Commit 37ff182

Browse files
committed
Merge branch 'api-8' into api-9
2 parents ccafce0 + c1a4dde commit 37ff182

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

src/main/java/org/spongepowered/api/scheduler/ScheduledUpdateList.java

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.spongepowered.api.block.BlockType;
2828
import org.spongepowered.api.fluid.FluidType;
2929
import org.spongepowered.api.registry.DefaultedRegistryReference;
30+
import org.spongepowered.api.util.Ticks;
3031
import org.spongepowered.math.vector.Vector3i;
3132

3233
import java.time.Duration;
@@ -186,6 +187,57 @@ default ScheduledUpdate<T> schedule(
186187
*/
187188
ScheduledUpdate<T> schedule(int x, int y, int z, T target, Duration delay, TaskPriority priority);
188189

190+
/**
191+
*
192+
* @param x The x coordinate
193+
* @param y The y coordinate
194+
* @param z The z coordinate
195+
* @param target The target
196+
* @param ticks The delay, in {@link Ticks}
197+
* @param priority The priority of the scheduled update
198+
* @return The scheduled update
199+
*/
200+
default ScheduledUpdate<T> schedule(
201+
final int x, final int y, final int z, final T target, final Ticks ticks, final DefaultedRegistryReference<? extends TaskPriority> priority) {
202+
return this.schedule(x, y, z, target, ticks, priority.get());
203+
}
204+
205+
/**
206+
*
207+
* @param x The x coordinate
208+
* @param y The y coordinate
209+
* @param z The z coordinate
210+
* @param target The target
211+
* @param delay The delay
212+
* @return The scheduled update
213+
*/
214+
default ScheduledUpdate<T> schedule(int x, int y, int z, final T target, final Ticks delay) {
215+
return this.schedule(x, y, z, target, delay, TaskPriorities.NORMAL.get());
216+
}
217+
218+
/**
219+
*
220+
* @param pos The position
221+
* @param target The target
222+
* @param delay The delay
223+
* @return The scheduled update
224+
*/
225+
default ScheduledUpdate<T> schedule(final Vector3i pos, final T target, final Ticks delay) {
226+
return this.schedule(pos.x(), pos.y(), pos.z(), target, delay, TaskPriorities.NORMAL.get());
227+
}
228+
229+
/**
230+
*
231+
* @param pos The position
232+
* @param target The target
233+
* @param delay The delay
234+
* @param priority The priority of the scheduled update
235+
* @return The scheduled update
236+
*/
237+
default ScheduledUpdate<T> schedule(final Vector3i pos, final T target, final Ticks delay, final TaskPriority priority) {
238+
return this.schedule(pos.x(), pos.y(), pos.z(), target, delay, priority);
239+
}
240+
189241
/**
190242
*
191243
* @param x The x coordinate
@@ -200,6 +252,20 @@ default ScheduledUpdate<T> schedule(final int x, final int y, final int z, final
200252
return this.schedule(x, y, z, target, delay, priority.get());
201253
}
202254

255+
/**
256+
* Schedules a new update at the desired position after the specified
257+
* number of {@link Ticks}.
258+
*
259+
* @param x The x coordinate
260+
* @param y The y coordinate
261+
* @param z The z coordinate
262+
* @param target The target
263+
* @param delay The delay, in {@link Ticks}
264+
* @param priority The priority of the scheduled update
265+
* @return The scheduled update
266+
*/
267+
ScheduledUpdate<T> schedule(int x, int y, int z, T target, Ticks delay, TaskPriority priority);
268+
203269
/**
204270
* Gets whether there's a scheduled update at the desired position with the provided target.
205271
*

src/main/java/org/spongepowered/api/world/server/ServerLocation.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.spongepowered.api.scheduler.ScheduledUpdate;
4343
import org.spongepowered.api.scheduler.TaskPriority;
4444
import org.spongepowered.api.util.Direction;
45+
import org.spongepowered.api.util.Ticks;
4546
import org.spongepowered.api.world.BlockChangeFlag;
4647
import org.spongepowered.api.world.LocatableBlock;
4748
import org.spongepowered.api.world.Location;
@@ -259,6 +260,16 @@ static ServerLocation of(final ResourceKey worldKey, final Vector3i position) {
259260
*/
260261
ScheduledUpdate<BlockType> scheduleBlockUpdate(int delay, TemporalUnit temporalUnit);
261262

263+
/**
264+
* Adds a new {@link ScheduledUpdate} for the block at this location.
265+
*
266+
* @param delay The delay, in {@link Ticks}, before the scheduled update
267+
* should be processed
268+
* @param priority The priority of the scheduled update
269+
* @return The newly created scheduled update
270+
*/
271+
ScheduledUpdate<BlockType> scheduleBlockUpdate(Ticks delay, TaskPriority priority);
272+
262273
/**
263274
* Adds a new {@link ScheduledUpdate} for the block at this location.
264275
*
@@ -269,6 +280,15 @@ static ServerLocation of(final ResourceKey worldKey, final Vector3i position) {
269280
*/
270281
ScheduledUpdate<BlockType> scheduleBlockUpdate(int delay, TemporalUnit temporalUnit, TaskPriority priority);
271282

283+
/**
284+
* Adds a new {@link ScheduledUpdate} for the block at this location.
285+
*
286+
* @param delay The delay, in {@link Ticks}, before the scheduled update
287+
* should be processed
288+
* @return The newly created scheduled update
289+
*/
290+
ScheduledUpdate<BlockType> scheduleBlockUpdate(Ticks delay);
291+
272292
/**
273293
* Adds a new {@link ScheduledUpdate} for the block at this location.
274294
*
@@ -312,6 +332,25 @@ static ServerLocation of(final ResourceKey worldKey, final Vector3i position) {
312332
*/
313333
ScheduledUpdate<FluidType> scheduleFluidUpdate(int delay, TemporalUnit temporalUnit, TaskPriority priority);
314334

335+
/**
336+
* Adds a new {@link ScheduledUpdate} for the fluid at this location.
337+
*
338+
* @param ticks The delay, in {@link Ticks}, before the scheduled update
339+
* should be processed
340+
* @return The newly created scheduled update
341+
*/
342+
ScheduledUpdate<FluidType> scheduleFluidUpdate(Ticks ticks);
343+
344+
/**
345+
* Adds a new {@link ScheduledUpdate} for the fluid at this location.
346+
*
347+
* @param ticks The delay, in {@link Ticks}, before the scheduled update
348+
* should be processed
349+
* @param priority The priority of the scheduled update
350+
* @return The newly created scheduled update
351+
*/
352+
ScheduledUpdate<FluidType> scheduleFluidUpdate(Ticks ticks, TaskPriority priority);
353+
315354
/**
316355
* Adds a new {@link ScheduledUpdate} for the fluid at this location.
317356
*

0 commit comments

Comments
 (0)