Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ allprojects {
options.release = 17
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
}
}
java {
withSourcesJar()
}
Expand Down
Binary file added common/AcceleratedRaycasting-0.0.1-dev.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ open class BaseConfigDelegate <T : Any>(var it:T, var range: Pair<T, T>? = null,

class CInt (it:Int, description: String="No comment", range: Pair<Int, Int>? = Pair(Int.MIN_VALUE, Int.MAX_VALUE), do_show: Boolean=true): BaseConfigDelegate<Int> (it, range, description, do_show)
class CLong (it:Long, description: String="No comment", range: Pair<Long, Long>? = Pair(Long.MIN_VALUE, Long.MAX_VALUE), do_show: Boolean=true): BaseConfigDelegate<Long> (it, range, description, do_show)
class CDouble(it:Double, description: String="No comment", range: Pair<Double, Double>? = Pair(Double.MIN_VALUE, Double.MAX_VALUE), do_show: Boolean=true): BaseConfigDelegate<Double> (it, range, description, do_show)
class CDouble(it:Double, description: String="No comment", range: Pair<Double, Double>? = Pair(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), do_show: Boolean=true): BaseConfigDelegate<Double> (it, range, description, do_show)
class CBool (it:Boolean, description: String="No comment", do_show: Boolean=true): BaseConfigDelegate<Boolean>(it, null, description, do_show)
class CString(it:String, description: String="No comment", do_show: Boolean=true): BaseConfigDelegate<String> (it, null, description, do_show)
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import net.spaceeye.someperipherals.SomePeripheralsConfig
import net.spaceeye.someperipherals.integrations.cc.makeErrorReturn
import net.spaceeye.someperipherals.stuff.utils.entityToMapRadar
import net.spaceeye.someperipherals.stuff.utils.getEntitiesWithTimeout
import org.valkyrienskies.core.api.ships.ServerShip
import org.valkyrienskies.mod.common.getShipManagingPos
import org.valkyrienskies.mod.common.shipObjectWorld
import org.valkyrienskies.mod.common.toWorldCoordinates
import org.valkyrienskies.mod.common.transformToNearbyShipsAndWorld
import kotlin.math.max
import kotlin.math.min

Expand All @@ -26,6 +27,24 @@ private fun getScanPos(level: Level, pos: BlockPos): BlockPos {
}
}

private fun getShipsWithinRadius(level: ServerLevel, pos: BlockPos, radius: Double): List<ServerShip> {
val scanX = pos.x.toDouble()
val scanY = pos.y.toDouble()
val scanZ = pos.z.toDouble()
val radiusSq = radius * radius

return level.shipObjectWorld.allShips
.asSequence()
.filterIsInstance<ServerShip>()
.filter { ship ->
val dx = ship.transform.positionInWorld.x() - scanX
val dy = ship.transform.positionInWorld.y() - scanY
val dz = ship.transform.positionInWorld.z() - scanZ
(dx * dx + dy * dy + dz * dz) <= radiusSq
}
.distinctBy { it.id }
.toList()
}

private fun scanForEntities(r: Double, level: ServerLevel, pos: BlockPos): MutableList<Any> {
val pos = getScanPos(level, pos)
Expand Down Expand Up @@ -58,14 +77,20 @@ private fun scanForShips(radius: Double, level: ServerLevel, pos: BlockPos): Mut
val pos = getScanPos(level, pos)

val res = mutableListOf<Any>()
val seenShips = mutableSetOf<Long>()

val cur_ship = level.getShipManagingPos(pos)
if (cur_ship != null) {res.add(shipToMap(cur_ship))}
if (cur_ship != null) {
res.add(shipToMap(cur_ship))
seenShips.add(cur_ship.id)
}

for (ship_pos in level.transformToNearbyShipsAndWorld(pos.x.toDouble(), pos.y.toDouble(), pos.z.toDouble(), radius)) {
val ship = level.getShipManagingPos(ship_pos) ?: continue
if (ship == cur_ship) {continue}
res.add(shipToMap(ship))
val allShips = getShipsWithinRadius(level, pos, radius)
for (ship in allShips) {
if (!seenShips.contains(ship.id)) {
res.add(shipToMap(ship))
seenShips.add(ship.id)
}
}

return res
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added fabric/build/libs/Some-Peripherals-0.0.12.jar
Binary file not shown.
48 changes: 48 additions & 0 deletions fabric/build/resources/main/fabric.mod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"schemaVersion": 1,
"id": "some_peripherals",
"version": "0.0.12",

"name": "Some Peripherals",
"description": "",
"authors": ["SpaceEye"],
"contributors": ["Illuc", "Tetrode", ", sashafiesta"],
"contact": {
"homepage": "https://modrinth.com/mod/some-peripherals",
"sources": "https://github.com/SuperSpaceEye/Some-Peripherals"
},

"license": "MIT",

"environment": "*",
"entrypoints": {
"main": [
{
"adapter": "kotlin",
"value": "net.spaceeye.someperipherals.fabric.SomePeripheralsFabric"
}
],
"client": [
{
"adapter": "kotlin",
"value": "net.spaceeye.someperipherals.fabric.SomePeripheralsFabricClient"
}
]
},
"mixins": [
"some_peripherals-common.mixins.json"
],
"depends": {
"fabricloader": ">=0.14.22",
"minecraft": ">=1.18",
"fabric-language-kotlin": ">=1.10.10+kotlin.1.9.10",
"fabric-api": ">=0.76.0+1.18.2",
"architectury": ">=4.11.93",
"com_electronwill_night-config_core": "*",
"com_electronwill_night-config_toml": "*"
},
"suggests": {
"computercraft": ">=1.100.8",
"valkyrienskies": ">=2.1.0-beta.14"
}
}
13 changes: 13 additions & 0 deletions fabric/build/resources/main/some_peripherals.mixins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"required": true,
"minVersion": "0.8",
"package": "net.spaceeye.someperipherals.fabric.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
],
"client": [
],
"injectors": {
"defaultRequire": 1
}
}
Binary file added fabric/build/tmp/.cache/expanded/expanded.lock
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions fabric/build/tmp/jar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

2 changes: 2 additions & 0 deletions fabric/build/tmp/remapJar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

2 changes: 2 additions & 0 deletions fabric/build/tmp/remapSourcesJar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

2 changes: 2 additions & 0 deletions fabric/build/tmp/shadowJar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

2 changes: 2 additions & 0 deletions fabric/build/tmp/sourcesJar/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

13 changes: 12 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
<<<<<<< HEAD
org.gradle.jvmargs=-Xmx1G
=======
org.gradle.jvmargs=-Xmx2G -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8
org.gradle.workers.max=2
org.gradle.parallel=false
kotlin.compiler.execution.strategy=in-process
>>>>>>> aa60f2d (fix(radar): detect unloaded VS ships and fix radius config double clamp on 1.18.2)

minecraft_version=1.18.2

Expand All @@ -16,4 +23,8 @@ forge_version=1.18.2-40.2.10
vs2_version=2.1.0-beta.14+acba7d4175
vs_core_version=1.1.0+8a93383ce5

accelerated_raycasting_path=/home/spaceeye/IdeaProjects/Some-Peripherals/AcceleratedRaycasting-0.0.1-dev.jar
<<<<<<< HEAD
accelerated_raycasting_path=/home/spaceeye/IdeaProjects/Some-Peripherals/AcceleratedRaycasting-0.0.1-dev.jar
=======
accelerated_raycasting_path=./AcceleratedRaycasting-0.0.1-dev.jar
>>>>>>> aa60f2d (fix(radar): detect unloaded VS ships and fix radius config double clamp on 1.18.2)
Loading