You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var autoRemount by setting("Auto Remount", false, description ="Automatically remounts if you get off")
38
+
var autoMountEntities by setting("Auto Mount Entities", true, description ="Automatically mounts nearby entities in range")
39
+
var autoMountEntityList by setting("Auto Mount Entity List", mutableListOf<EntityType<*>>(), mutableListOf(Registries.ENTITY_TYPE.toList())) { autoMountEntities }
40
+
41
+
var interval by setting("Interval", 50, 1..200, 1, unit ="ms", description ="Interact interval")
42
+
var range by setting("Range", 5.0, 1.0..10.0, 0.1, description ="Mount range")
43
+
44
+
val intervalTimer =Timer()
45
+
var lastEntity:Entity?=null
46
+
47
+
init {
48
+
listen<TickEvent.Pre> {
49
+
if (!intervalTimer.timePassed(interval.milliseconds)) {
50
+
return@listen
51
+
}
52
+
if (autoMountEntities &&!player.isRiding) {
53
+
val entity = fastEntitySearch<Entity>(range) {
54
+
autoMountEntityList.contains(it.type) && canRide(it) && it.distanceTo(player) <= range
55
+
}
56
+
entity.firstOrNull()?.let {
57
+
intervalTimer.reset()
58
+
player.startRiding(it)
59
+
}
60
+
}
61
+
if (autoRemount) {
62
+
if (player.isRiding) {
63
+
lastEntity = player.vehicle
64
+
} else {
65
+
lastEntity?.let {
66
+
if (it.isRemoved || it.distanceTo(player) > range) {
0 commit comments