diff options
author | nea <nea@nea.moe> | 2023-01-26 12:35:17 +0100 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-01-26 12:35:17 +0100 |
commit | e29354f810f69a509fba8e6c2ac58d1ce65c5483 (patch) | |
tree | 887c7eb64f54e98c41543c0f0613151f7715ed09 /src/main/kotlin/io | |
parent | f89a90e08d2b6cff70d84bb4c35bbdc8a0b49bc0 (diff) | |
parent | f1a5ba28e92da4f46b39da27277b1c8b7a6ec4bb (diff) | |
download | NotEnoughUpdates-disabledoptions.tar.gz NotEnoughUpdates-disabledoptions.tar.bz2 NotEnoughUpdates-disabledoptions.zip |
Merge remote-tracking branch 'origin/master' into disabledoptionsdisabledoptions
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)) } |