Skip to content

Commit

Permalink
chore: update to kotlin 1.9.23
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemmmy committed Mar 23, 2024
1 parent adb6553 commit 4d05814
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 24 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ group = mavenGroup
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
apiVersion = "1.7"
languageVersion = "1.7"
apiVersion = "1.9"
languageVersion = "1.9"
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ yarnMappings = 1.20.1+build.10
loaderVersion = 0.15.7

kotlin.code.style = official
systemProp.kotlinVersion = 1.7.10
fabricKotlinVersion = 1.8.4+kotlin.1.7.20
systemProp.kotlinVersion = 1.9.23
fabricKotlinVersion = 1.10.19+kotlin.1.9.23

# Mod Properties
modVersion = 1.10.6
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/sc3/plethora/core/DefaultCostHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import java.util.concurrent.Callable
* @see PlethoraCore.initializeCore
*/
class DefaultCostHandler : ICostHandler {
private val cfg by Plethora.config::costSystem
private val cfg
get() = Plethora.config.costSystem

private var value: Double = cfg.initial
@Synchronized
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/sc3/plethora/core/RegisteredMethod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ abstract class RegisteredMethod<T>(
mod: String,
val target: Class<T>
) : RegisteredValue(regName, mod) {
private val cfg by Plethora.config::costSystem
private val cfg
get() = Plethora.config.costSystem

private var cost = 0

abstract val method: IMethod<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import kotlin.math.sin
import kotlin.math.sqrt

object LaserMethods {
private val cfg by Plethora.config::laser
private val cfg
get() = Plethora.config.laser

val FIRE = SubtargetedModuleMethod.of(
"fire", PlethoraModules.LASER_M, IWorldLocation::class.java,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package io.sc3.plethora.gameplay.modules.laser

import dan200.computercraft.api.client.TransformedModel
import io.sc3.plethora.Plethora
import io.sc3.plethora.api.module.IModuleHandler
import io.sc3.plethora.gameplay.modules.ModuleItem
import io.sc3.plethora.gameplay.registry.PlethoraModules
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.entity.LivingEntity
import net.minecraft.entity.player.PlayerEntity
Expand All @@ -9,10 +13,6 @@ import net.minecraft.util.*
import net.minecraft.util.math.AffineTransformation
import net.minecraft.util.math.RotationAxis
import net.minecraft.world.World
import io.sc3.plethora.Plethora
import io.sc3.plethora.api.module.IModuleHandler
import io.sc3.plethora.gameplay.modules.ModuleItem
import io.sc3.plethora.gameplay.registry.PlethoraModules

private const val MAX_TICKS = 72000
private const val USE_TICKS = 30
Expand All @@ -26,7 +26,8 @@ private const val USE_TICKS = 30
private const val LASER_MAX_SPREAD = (0.1 / 0.0075).toFloat()

class LaserModuleItem(settings: Settings) : ModuleItem("laser", settings), IModuleHandler {
private val cfg by Plethora.config::laser
private val cfg
get() = Plethora.config.laser

override fun getModule(): Identifier = PlethoraModules.LASER_M

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import io.sc3.plethora.gameplay.registry.PlethoraModules.SCANNER_M
import net.minecraft.util.Identifier

class ScannerModuleItem(settings: Settings) : LevelableModuleItem("scanner", settings) {
private val cfg by Plethora.config::scanner
private val cfg
get() = Plethora.config.scanner

override fun getModule(): Identifier = SCANNER_M

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import io.sc3.plethora.gameplay.registry.PlethoraModules.SENSOR_M
import net.minecraft.util.Identifier

class SensorModuleItem(settings: Settings) : LevelableModuleItem("sensor", settings) {
private val cfg by Plethora.config::sensor
private val cfg
get() = Plethora.config.sensor

override fun getModule(): Identifier = SENSOR_M

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import net.minecraft.util.math.BlockPos
import net.minecraft.world.World

object ScannerOverlayRenderer : FlareOverlayRenderer() {
private val cfg by Plethora.config::scanner
private val cfg
get() = Plethora.config.scanner

private val blockColorCache = mutableMapOf<Block, FlareColor>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import net.minecraft.util.TypeFilter
import net.minecraft.util.math.Box

object SensorOverlayRenderer : FlareOverlayRenderer() {
private val cfg by Plethora.config::sensor
private val cfg
get() = Plethora.config.sensor

private val entityColorCache: MutableMap<EntityType<*>, FlareColor> = HashMap()

Expand Down
17 changes: 9 additions & 8 deletions src/main/java/io/sc3/plethora/util/config/ModMenuIntegration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package io.sc3.plethora.util.config

import com.terraformersmc.modmenu.api.ConfigScreenFactory
import com.terraformersmc.modmenu.api.ModMenuApi
import io.sc3.plethora.Plethora
import io.sc3.plethora.gameplay.overlay.ScannerOverlayRenderer
import io.sc3.plethora.gameplay.overlay.SensorOverlayRenderer
import me.shedaniel.clothconfig2.api.ConfigBuilder
import net.fabricmc.api.EnvType
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags.ORES
Expand All @@ -11,19 +14,17 @@ import net.minecraft.block.RedstoneOreBlock
import net.minecraft.registry.Registries
import net.minecraft.text.Text.of
import net.minecraft.text.Text.translatable
import io.sc3.plethora.Plethora
import io.sc3.plethora.gameplay.overlay.ScannerOverlayRenderer
import io.sc3.plethora.gameplay.overlay.SensorOverlayRenderer
import java.awt.Color

object ModMenuIntegration : ModMenuApi {
private const val lang = "gui.plethora.config"
private val cfg by Plethora::config
private const val key = "gui.plethora.config"
private val cfg
get() = Plethora.config

override fun getModConfigScreenFactory(): ConfigScreenFactory<*> {
return ConfigScreenFactory { parent ->
val builder = ConfigBuilder.create().setParentScreen(parent)
.setTitle(translatable("$lang.title"))
.setTitle(translatable("$key.title"))
.setSavingRunnable {
ConfigLoader.saveConfig(cfg)

Expand All @@ -36,9 +37,9 @@ object ModMenuIntegration : ModMenuApi {
// ======================================================================
// Scanner
// ======================================================================
val scanner = builder.getOrCreateCategory(translatable("$lang.scanner.title"))
val scanner = builder.getOrCreateCategory(translatable("$key.scanner.title"))

val oreColours = builder.entryBuilder().startSubCategory(translatable("$lang.scanner.ore_colours"))
val oreColours = builder.entryBuilder().startSubCategory(translatable("$key.scanner.ore_colours"))
oreColours.addAll(getOreBlocks().map { block ->
val id = Registries.BLOCK.getId(block).toString()
val currentColor = (cfg.scanner.oreColours[id] ?: "#FFFFFF").color()
Expand Down

0 comments on commit 4d05814

Please sign in to comment.