Skip to content

Commit a480cea

Browse files
committed
new computer communication system, status display
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
1 parent fc38628 commit a480cea

File tree

81 files changed

+297
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+297
-161
lines changed

src/main/kotlin/nl/enjarai/doabarrelroll/compat/flightassistant/DaBRRollComputer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import nl.enjarai.doabarrelroll.DoABarrelRoll
66
import nl.enjarai.doabarrelroll.api.RollEntity
77
import ru.octol1ttle.flightassistant.api.autoflight.roll.RollSource
88
import ru.octol1ttle.flightassistant.api.computer.Computer
9-
import ru.octol1ttle.flightassistant.api.computer.ComputerView
9+
import ru.octol1ttle.flightassistant.api.computer.ComputerBus
1010
import ru.octol1ttle.flightassistant.api.util.FATickCounter
1111

12-
class DaBRRollComputer(computers: ComputerView) : Computer(computers), RollSource {
12+
class DaBRRollComputer(computers: ComputerBus) : Computer(computers), RollSource {
1313
override fun isActive(): Boolean {
1414
return (computers.data.player as RollEntity).`doABarrelRoll$isRolling`()
1515
}

src/main/kotlin/nl/enjarai/doabarrelroll/compat/flightassistant/DaBRThrustComputer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import nl.enjarai.doabarrelroll.api.event.ThrustEvents
88
import nl.enjarai.doabarrelroll.config.ModConfig
99
import ru.octol1ttle.flightassistant.api.autoflight.thrust.ThrustSource
1010
import ru.octol1ttle.flightassistant.api.computer.Computer
11-
import ru.octol1ttle.flightassistant.api.computer.ComputerView
11+
import ru.octol1ttle.flightassistant.api.computer.ComputerBus
1212

13-
class DaBRThrustComputer(computers: ComputerView) : Computer(computers), ThrustSource {
13+
class DaBRThrustComputer(computers: ComputerBus) : Computer(computers), ThrustSource {
1414
override val priority: ThrustSource.Priority = ThrustSource.Priority.HIGH
1515
override val supportsReverse: Boolean = true
1616
override val optimumClimbPitch: Float = 30.0f

src/main/kotlin/ru/octol1ttle/flightassistant/FAKeyMappings.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.mojang.blaze3d.platform.InputConstants
44
import net.minecraft.client.KeyMapping
55
import org.lwjgl.glfw.GLFW
66
import ru.octol1ttle.flightassistant.FlightAssistant.mc
7-
import ru.octol1ttle.flightassistant.api.computer.ComputerView
7+
import ru.octol1ttle.flightassistant.api.computer.ComputerBus
88
import ru.octol1ttle.flightassistant.config.FAConfig
99
import ru.octol1ttle.flightassistant.screen.FlightAssistantSetupScreen
1010

@@ -48,7 +48,7 @@ object FAKeyMappings {
4848
return keyBinding
4949
}
5050

51-
fun checkPressed(computers: ComputerView) {
51+
fun checkPressed(computers: ComputerBus) {
5252
while (toggleEnabled.consumeClick()) {
5353
FAConfig.global.modEnabled = !FAConfig.global.modEnabled
5454
}

src/main/kotlin/ru/octol1ttle/flightassistant/api/alert/Alert.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package ru.octol1ttle.flightassistant.api.alert
22

3-
import ru.octol1ttle.flightassistant.api.computer.ComputerView
3+
import ru.octol1ttle.flightassistant.api.computer.ComputerBus
44
import ru.octol1ttle.flightassistant.config.options.SafetyOptions
55

66
/**
77
* A class that represents an alert. Only a single instance of this class is present for each actual alert
88
*/
9-
abstract class Alert(val computers: ComputerView) {
9+
abstract class Alert(val computers: ComputerBus) {
1010
/**
1111
* The data that this alert uses. Impacts the priority of this alert, its sound and category color
1212
*/

src/main/kotlin/ru/octol1ttle/flightassistant/api/alert/AlertCategory.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package ru.octol1ttle.flightassistant.api.alert
22

33
import net.minecraft.network.chat.Component
44
import ru.octol1ttle.flightassistant.FlightAssistant
5-
import ru.octol1ttle.flightassistant.api.computer.ComputerView
5+
import ru.octol1ttle.flightassistant.api.computer.ComputerBus
66

77
/**
88
* A class that represents a category of alerts.
@@ -28,7 +28,7 @@ class AlertCategory(val categoryText: Component) {
2828
return this
2929
}
3030

31-
fun updateActiveAlerts(computers: ComputerView) {
31+
fun updateActiveAlerts(computers: ComputerBus) {
3232
for (alert: Alert in registeredAlerts) {
3333
try {
3434
if (alert.shouldActivate()) {

src/main/kotlin/ru/octol1ttle/flightassistant/api/alert/AlertCategoryRegistrationCallback.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package ru.octol1ttle.flightassistant.api.alert
33
import dev.architectury.event.Event
44
import dev.architectury.event.EventFactory
55
import java.util.function.Consumer
6-
import ru.octol1ttle.flightassistant.api.computer.ComputerView
6+
import ru.octol1ttle.flightassistant.api.computer.ComputerBus
77

88
fun interface AlertCategoryRegistrationCallback {
99
/**
1010
* Called when the client has started, after all built-in alert categories have been initialized.
1111
* Register your custom alert categories in this event using the provided function
1212
*/
13-
fun register(computers: ComputerView, registerFunction: Consumer<AlertCategory>)
13+
fun register(computers: ComputerBus, registerFunction: Consumer<AlertCategory>)
1414

1515
companion object {
1616
@JvmField

src/main/kotlin/ru/octol1ttle/flightassistant/api/autoflight/FlightController.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package ru.octol1ttle.flightassistant.api.autoflight
44
* Represents a flight controller that can provide thrust, pitch, heading or roll inputs. Implementing all methods is optional.
55
* @see [ControlInput]
66
*/
7+
@Deprecated("Dispatch ComputerQueries instead")
78
interface FlightController {
89
fun getThrustInput(): ControlInput? {
910
return null

src/main/kotlin/ru/octol1ttle/flightassistant/api/autoflight/heading/HeadingControllerRegistrationCallback.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import dev.architectury.event.EventFactory
55
import java.util.function.Consumer
66
import ru.octol1ttle.flightassistant.api.autoflight.FlightController
77

8+
@Deprecated("Respond to ComputerQueries instead")
89
fun interface HeadingControllerRegistrationCallback {
910
/**
1011
* Called during [ru.octol1ttle.flightassistant.api.computer.Computer.invokeEvents].

src/main/kotlin/ru/octol1ttle/flightassistant/api/autoflight/pitch/PitchControllerRegistrationCallback.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import dev.architectury.event.EventFactory
55
import java.util.function.Consumer
66
import ru.octol1ttle.flightassistant.api.autoflight.FlightController
77

8+
@Deprecated("Respond to ComputerQueries instead")
89
fun interface PitchControllerRegistrationCallback {
910
/**
1011
* Called during [ru.octol1ttle.flightassistant.api.computer.Computer.invokeEvents].

src/main/kotlin/ru/octol1ttle/flightassistant/api/autoflight/pitch/PitchLimiter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package ru.octol1ttle.flightassistant.api.autoflight.pitch
22

33
import ru.octol1ttle.flightassistant.api.autoflight.ControlInput
44

5+
// TODO: Pitch Limit Hint (for smooth pitch limits and to allow diversion from actual pitch limit)
56
interface PitchLimiter {
67
fun getMinimumPitch(): ControlInput? {
78
return null

0 commit comments

Comments
 (0)