File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
common/src/main/kotlin/io/github/techtastic/cc_vs Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import dan200.computercraft.shared.computer.core.ServerContext
55import dev.architectury.event.events.common.LifecycleEvent
66import io.github.techtastic.cc_vs.apis.ShipAPI
77import io.github.techtastic.cc_vs.ship.PhysTickEventHandler
8+ import io.github.techtastic.cc_vs.ship.PhysicsTicksEventHandler
89import org.valkyrienskies.core.impl.hooks.VSEvents
910
1011object CCVSMod {
@@ -18,6 +19,10 @@ object CCVSMod {
1819 ComputerCraftAPI .registerAPIFactory(::ShipAPI )
1920
2021 VSEvents .shipLoadEvent.on { huh -> huh.ship.setAttachment(PhysTickEventHandler ::class .java, null ) }
22+
23+ VSEvents .tickEndEvent.on { huh -> huh.world.loadedShips.forEach { ship ->
24+ PhysicsTicksEventHandler .getOrCreateControl(ship).resetData()
25+ } }
2126 }
2227
2328 @JvmStatic
Original file line number Diff line number Diff line change @@ -19,11 +19,9 @@ class PhysicsTicksEventHandler: ShipForcesInducer {
1919 }
2020
2121 @JsonIgnore
22- fun getData (): Array <LuaPhysShip > {
23- val data = this .queuedData.toTypedArray()
24- this .queuedData.clear()
25- return data
26- }
22+ fun getData () = this .queuedData.toTypedArray()
23+
24+ fun resetData () = this .queuedData.clear()
2725
2826 companion object {
2927 fun getOrCreateControl (ship : ServerShip ): PhysicsTicksEventHandler {
You can’t perform that action at this time.
0 commit comments