diff options
Diffstat (limited to 'src/main/kotlin/io')
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt index e9327ac3..7351a4a0 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/EnforcedConfigValues.kt @@ -21,6 +21,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures import com.google.gson.JsonElement import io.github.moulberry.notenoughupdates.NotEnoughUpdates +import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent import io.github.moulberry.notenoughupdates.util.NotificationHandler import io.github.moulberry.notenoughupdates.util.Shimmy @@ -31,6 +32,7 @@ import net.minecraftforge.client.event.GuiOpenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import net.minecraftforge.fml.common.gameevent.TickEvent +@NEUAutoSubscribe object EnforcedConfigValues { class EnforcedValue { diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt index 56f84d54..99066e52 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/PetLeveling.kt @@ -23,7 +23,9 @@ import com.google.gson.JsonObject import io.github.moulberry.notenoughupdates.events.RepositoryReloadEvent import io.github.moulberry.notenoughupdates.miscfeatures.PetInfoOverlay.Rarity import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe +@NEUAutoSubscribe object PetLeveling { data class ExpLadder( @@ -100,7 +102,7 @@ object PetLeveling { val petConstants = this.petConstants ?: Constants.PETS ?: return stubExpLadder var levels = petConstants["pet_levels"]?.asJsonArray?.map { it.asLong }?.toMutableList() ?: return stubExpLadder val customLeveling = petConstants["custom_pet_leveling"]?.asJsonObject?.get(petIdWithoutRarity) - val offset = petConstants["pet_rarity_offset"]?.asJsonObject?.get(rarity.name)?.asInt ?: return stubExpLadder + var rarityOffsets = petConstants["pet_rarity_offset"]?.asJsonObject var maxLevel = 100 if (customLeveling is JsonObject) { val customLevels by lazy { customLeveling["pet_levels"]?.asJsonArray?.map { it.asLong } } @@ -109,7 +111,10 @@ object PetLeveling { 2 -> levels = customLevels?.toMutableList() ?: return stubExpLadder } maxLevel = customLeveling["max_level"]?.asInt ?: maxLevel + rarityOffsets = customLeveling["rarity_offset"]?.asJsonObject ?: rarityOffsets } + val offset = rarityOffsets?.get(rarity.name)?.asInt ?: return stubExpLadder + return ExpLadder(levels.drop(offset).take(maxLevel - 1)) } |