Async Scheduler
This commit is contained in:
parent
241254ee4e
commit
8d03a0038d
1 changed files with 8 additions and 8 deletions
|
|
@ -41,16 +41,16 @@ public class Bbsdfia extends JavaPlugin implements Listener {
|
||||||
World world = Bukkit.getServer().getWorld("world");
|
World world = Bukkit.getServer().getWorld("world");
|
||||||
Location spawnLoc = new Location(world, 100, 50, 0);
|
Location spawnLoc = new Location(world, 100, 50, 0);
|
||||||
*/
|
*/
|
||||||
Bukkit.getScheduler().runTask(this, () -> {
|
Bukkit.getAsyncScheduler().runNow(this, task -> {
|
||||||
FallingBlock dummy = loc2.getWorld().spawnFallingBlock(loc2, ((FallingBlock) entity).getBlockData());
|
FallingBlock dummy = loc2.getWorld().spawnFallingBlock(loc2, ((FallingBlock) entity).getBlockData());
|
||||||
Vector dummyVel = vel.clone();
|
Vector dummyVel = vel.clone();
|
||||||
dummyVel.setY(-dummyVel.getY());
|
dummyVel.setY(-dummyVel.getY());
|
||||||
dummyVel.multiply(new Vector(2, 2, 2)); // double the velocity
|
dummyVel.multiply(new Vector(2, 2, 2)); // double the velocity
|
||||||
|
|
||||||
// add a constant downward velocity to simulate gravity
|
// add a constant downward velocity to simulate gravity
|
||||||
dummyVel.add(new Vector(0, 0.3, 0));
|
dummyVel.add(new Vector(0, 0.3, 0));
|
||||||
|
|
||||||
dummy.setVelocity(dummyVel);
|
dummy.setVelocity(dummyVel);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue