Skip to content

Commit

Permalink
Update sf4k
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan committed Apr 10, 2024
1 parent 9d891b7 commit 2323b25
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.9.22" apply false
kotlin("jvm") version "1.9.23" apply false
}

allprojects {
Expand Down
12 changes: 6 additions & 6 deletions plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
plugins {
kotlin("jvm")
kotlin("plugin.serialization") version "1.9.23"
id("com.google.devtools.ksp") version "1.9.23-1.0.20"

id("com.github.johnrengelman.shadow") version "8.1.1"
id("net.minecrell.plugin-yml.bukkit") version "0.5.3"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("xyz.jpenilla.run-paper") version "2.2.0"

id("com.google.devtools.ksp") version "1.9.22-1.0.17"
}

repositories {
Expand Down Expand Up @@ -42,14 +43,14 @@ dependencies {
implementation("co.aikar:acf-paper:0.5.1-SNAPSHOT")
implementation("com.jeff_media:MorePersistentDataTypes:2.4.0")

implementation("io.github.seggan:sf4k:0.1.1")
implementation("io.github.seggan:sf4k:0.3.2")

implementation(project(":uom"))
ksp(project(":uom-processor"))

testImplementation(kotlin("test"))
testImplementation("io.kotest:kotest-assertions-core:5.8.0")
testImplementation("com.github.seeseemelk:MockBukkit-v1.20:3.78.0")
testImplementation("com.github.seeseemelk:MockBukkit-v1.20:3.80.0")
testImplementation("com.github.shynixn.mccoroutine:mccoroutine-bukkit-test:2.14.0")
}

Expand Down Expand Up @@ -85,7 +86,6 @@ tasks.shadowJar {
doRelocate("co.aikar.commands")
doRelocate("co.aikar.locales")
doRelocate("com.jeff_media.morepersistentdatatypes")
doRelocate("org.jetbrains.kotlinx")

dependencies {
exclude(dependency("org.jetbrains.kotlin:kotlin-stdlib"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ import kotlin.time.Duration.Companion.hours

open class Galactifun2 : AbstractAddon() {

lateinit var manager: PaperCommandManager
private set
private lateinit var manager: PaperCommandManager

var isTest = classLoader.javaClass.packageName.startsWith("be.seeseemelk.mockbukkit")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class RocketInfo(
private fun deltaV(engines: List<RocketEngine>, wetMass: Mass, dryMass: Mass): Velocity {
val ispNeum = engines.sumBy { it.thrust }.newtons
val ispDenom = engines.sumOf { it.thrust.newtons / it.specificImpulse.doubleSeconds }
val isp = (ispNeum / ispDenom).seconds
val isp = if (ispDenom == 0.0) 0.seconds else (ispNeum / ispDenom).seconds

return EARTH_GRAVITY * isp * ln(wetMass / dryMass)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Gf2Command : BaseCommand() {
fun distance(player: Player, planet: PlanetaryObject) {
val start = PlanetManager.getByWorld(player.world) ?: return
val distance = start.getDeltaVForTransferTo(planet, Clock.System.now())
player.sendMessage("The delta-v required to transfer to %s is %.2f m/s".format(planet.name, distance))
player.sendMessage("The delta-v required to transfer to %s is %.2f m/s".format(planet.name, distance.metersPerSecond))
}

@Subcommand("selector")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import io.github.addoncommunity.galactifun.util.general.mergeMaps
import io.github.addoncommunity.galactifun.util.general.with
import io.github.addoncommunity.galactifun.util.items.TickingBlock
import io.github.addoncommunity.galactifun.util.items.buildMenu
import io.github.seggan.sf4k.serial.*
import io.github.seggan.sf4k.serial.blockstorage.getBlockStorage
import io.github.seggan.sf4k.serial.blockstorage.setBlockStorage
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType
Expand Down Expand Up @@ -43,11 +44,6 @@ class FuelTank(
input(INPUT with 0).addBorder()
item(0 with 0, CustomItemStack(Material.WATER_BUCKET, "&fContents"))
}

private val fuelDataType = MapBlockStorageDataType(
EnumBlockStorageDataType(Gas::class),
BlockStorageDataType.DOUBLE
)
}

override fun tick(b: Block) {
Expand Down Expand Up @@ -115,11 +111,11 @@ class FuelTank(
}

fun getFuelLevel(block: Block): Map<Gas, Volume> {
return block.getBlockStorage("fuel", fuelDataType)?.mapValues { it.value.liters } ?: emptyMap()
return block.getBlockStorage<Map<Gas, Volume>>("fuel") ?: emptyMap()
}

fun setFuelLevel(block: Block, fuel: Map<Gas, Volume>) {
block.setBlockStorage("fuel", fuel.mapValues { it.value.liters }, fuelDataType)
block.setBlockStorage("fuel", fuel)
}

override fun getMass(block: Block): Mass = 729.kilograms // based on a 1 m^3 tank with 0.5 m thick walls of aluminum
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class UomProcessor(
.addOriginatingKSFile(classDeclaration.containingFile!!)
.addModifiers(KModifier.VALUE)
.jvmInline()
.addAnnotation(ClassName("kotlinx.serialization", "Serializable"))
.addSuperinterface(COMPARABLE.parameterizedBy(clazzName))
.addSuperinterface(Formattable::class)

Expand Down

0 comments on commit 2323b25

Please sign in to comment.