Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.squad.utils;
- /**
- * @author Serj
- * Copyright all for Serj and Mojang
- * Crate Date 03.03.2018
- * Do not touch the code
- */
- public class Counter
- {
- private long lastMS;
- public long getCurrentMS()
- {
- return System.nanoTime() / 1000000L;
- }
- public long getLastMS()
- {
- return this.lastMS;
- }
- public long getValue()
- {
- return getCurrentMS() - this.lastMS;
- }
- public boolean hasReached(final double milliseconds)
- {
- return this.getCurrentMS() - this.lastMS >= milliseconds;
- }
- public boolean hasReached(final int milliseconds)
- {
- return this.getCurrentMS() - this.lastMS >= milliseconds;
- }
- public boolean hasReached(final long milliseconds)
- {
- return this.getCurrentMS() - this.lastMS >= milliseconds;
- }
- public boolean hasReached(final float milliseconds)
- {
- return this.getCurrentMS() - this.lastMS >= milliseconds;
- }
- public boolean hasReached(final Float milliseconds)
- {
- return this.getCurrentMS() - this.lastMS >= milliseconds;
- }
- public void reset()
- {
- this.lastMS = this.getCurrentMS();
- }
- public void setLastMS(final long currentMS)
- {
- this.lastMS = currentMS;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement