-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Notifications.VisualRange setting, added TimerUtil
- Loading branch information
Showing
9 changed files
with
100 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
progreso-client/src/main/kotlin/org/progreso/client/events/entity/EntityDeathEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.progreso.client.events.entity | ||
|
||
import net.minecraft.entity.Entity | ||
import org.progreso.api.event.Event | ||
|
||
data class EntityDeathEvent(val entity: Entity) : Event() |
6 changes: 0 additions & 6 deletions
6
progreso-client/src/main/kotlin/org/progreso/client/events/entity/PlayerDeathEvent.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
progreso-client/src/main/kotlin/org/progreso/client/util/client/TimerUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.progreso.client.util.client | ||
|
||
object TimerUtil { | ||
fun createTimer(unit: TimeUnit): Timer { | ||
return Timer(unit) | ||
} | ||
|
||
class Timer(val unit: TimeUnit) { | ||
private val currentTime get() = System.currentTimeMillis() | ||
|
||
var time = currentTime; private set | ||
|
||
fun tick(number: Long): Boolean { | ||
return (currentTime - time > number * unit.milliseconds).also { | ||
if (it) reset() | ||
} | ||
} | ||
|
||
fun skip(number: Long) { | ||
time = currentTime - number * unit.milliseconds | ||
} | ||
|
||
fun reset() { | ||
time = currentTime | ||
} | ||
} | ||
|
||
enum class TimeUnit(val milliseconds: Long) { | ||
Millisecond(1), | ||
Second(1000), | ||
Tick(50) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters