-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[SNAPSHOT] Migrate WorldBorder API to use ticks #13223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/snapshot
Are you sure you want to change the base?
Changes from all commits
bf6d66b
df6d372
6a4d35d
8be126d
bcd07b8
9503ba1
0b2886b
e97d6ce
5ab7914
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| package org.bukkit.craftbukkit; | ||
|
|
||
| import com.google.common.base.Preconditions; | ||
| import java.time.Duration; | ||
| import java.util.concurrent.TimeUnit; | ||
| import io.papermc.paper.util.Tick; | ||
| import net.minecraft.core.BlockPos; | ||
| import org.bukkit.Location; | ||
| import org.bukkit.World; | ||
|
|
@@ -44,7 +46,7 @@ public void setSize(double newSize) { | |
|
|
||
| @Override | ||
| public void setSize(double newSize, long time) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method and the other one should probably be deprecated (with a new method) now since the duration is in ticks and 20 ticks is not always equivalent to 1s especially with the tick command. That's the whole reason the bukkit scheduler doesn't have the TimeUnit equivalent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How can replace this? |
||
| this.setSize(Math.min(this.getMaxSize(), Math.max(1.0D, newSize)), TimeUnit.SECONDS, Math.min(9223372036854775L, Math.max(0L, time))); | ||
| this.setSize(Math.min(this.getMaxSize(), Math.max(1.0D, newSize)), TimeUnit.SECONDS, Math.clamp(time, 0L, Integer.MAX_VALUE)); | ||
| } | ||
|
|
||
| @Override | ||
|
|
@@ -54,7 +56,8 @@ public void setSize(double newSize, TimeUnit unit, long time) { | |
| Preconditions.checkArgument(newSize >= 1.0D && newSize <= this.getMaxSize(), "newSize must be between 1.0D and %s", this.getMaxSize()); | ||
|
|
||
| if (time > 0L) { | ||
| this.handle.lerpSizeBetween(this.handle.getSize(), newSize, unit.toMillis(time), this.getWorld().getGameTime()); | ||
| final long startTime = (this.getWorld() != null) ? this.getWorld().getGameTime() : 0; // Virtual Borders don't have a World | ||
| this.handle.lerpSizeBetween(this.handle.getSize(), newSize, Tick.tick().fromDuration(Duration.of(time, unit.toChronoUnit())), startTime); | ||
| } else { | ||
| this.handle.setSize(newSize); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.