diff --git a/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisPilotingManager.java b/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisPilotingManager.java index eb87f0233..be7b075ec 100644 --- a/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisPilotingManager.java +++ b/common/src/main/java/whocraft/tardis_refined/common/tardis/manager/TardisPilotingManager.java @@ -27,7 +27,6 @@ import whocraft.tardis_refined.common.capability.upgrades.SpeedUpgrade; import whocraft.tardis_refined.common.capability.upgrades.Upgrade; import whocraft.tardis_refined.common.capability.upgrades.UpgradeHandler; -import whocraft.tardis_refined.registry.TRUpgrades; import whocraft.tardis_refined.common.tardis.TardisArchitectureHandler; import whocraft.tardis_refined.common.tardis.TardisNavLocation; import whocraft.tardis_refined.common.util.PlayerUtil; @@ -36,6 +35,7 @@ import whocraft.tardis_refined.constants.NbtConstants; import whocraft.tardis_refined.patterns.ConsolePattern; import whocraft.tardis_refined.registry.TRSoundRegistry; +import whocraft.tardis_refined.registry.TRUpgrades; import java.util.*; @@ -1046,19 +1046,16 @@ private void onRestoreFuel() { */ private int getLatestSpeedModifier() { UpgradeHandler upgradeHandler = this.operator.getUpgradeHandler(); - Upgrade upgrade = TRUpgrades.SPEED_III.get(); - - for (int i = 0; i < 3; i++) - { - if (!(upgrade instanceof SpeedUpgrade)) - return this.speedModifier; - - if (upgradeHandler.isUpgradeUnlocked(upgrade)) - return ((SpeedUpgrade) upgrade).getSpeedModifier(); - - upgrade = upgrade.getParent(); - } + this.speedModifier = TRUpgrades.UPGRADE_DEFERRED_REGISTRY.entrySet().stream() + .map(Map.Entry::getValue) + .filter(upgrade -> upgrade instanceof SpeedUpgrade) + .map(upgrade -> (SpeedUpgrade) upgrade) + .filter(upgradeHandler::isUpgradeUnlocked) + .mapToInt(SpeedUpgrade::getSpeedModifier) + .max() + .orElse(1); return this.speedModifier; } + } diff --git a/common/src/main/java/whocraft/tardis_refined/registry/TRUpgrades.java b/common/src/main/java/whocraft/tardis_refined/registry/TRUpgrades.java index 5ce7747b7..9b2c6386e 100644 --- a/common/src/main/java/whocraft/tardis_refined/registry/TRUpgrades.java +++ b/common/src/main/java/whocraft/tardis_refined/registry/TRUpgrades.java @@ -75,12 +75,18 @@ public class TRUpgrades { public static final RegistrySupplier FLIGHT_SYSTEM = UPGRADE_DEFERRED_REGISTRY.register("flight_system", () -> new Upgrade(Items.ELYTRA::getDefaultInstance, TARDIS_XP, RegistryHelper.makeKey("flight_system"), Upgrade.UpgradeType.MAIN_UPGRADE) .setSkillPointsRequired(1).setPosition(9, 1)); - public static final RegistrySupplier SPEED_I = UPGRADE_DEFERRED_REGISTRY.register("speed_i", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, FLIGHT_SYSTEM, RegistryHelper.makeKey("speed_i"), Upgrade.UpgradeType.SUB_UPGRADE).setSpeedModifier(2) + public static final RegistrySupplier SPEED_I = UPGRADE_DEFERRED_REGISTRY.register("speed_i", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, FLIGHT_SYSTEM, RegistryHelper.makeKey("speed_i"), Upgrade.UpgradeType.SUB_UPGRADE).setSpeedModifier(5) .setSkillPointsRequired(10).setPosition(9, 2)); - public static final RegistrySupplier SPEED_II = UPGRADE_DEFERRED_REGISTRY.register("speed_ii", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, SPEED_I, RegistryHelper.makeKey("speed_ii"), Upgrade.UpgradeType.SUB_UPGRADE).setSpeedModifier(5) + public static final RegistrySupplier SPEED_II = UPGRADE_DEFERRED_REGISTRY.register("speed_ii", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, SPEED_I, RegistryHelper.makeKey("speed_ii"), Upgrade.UpgradeType.SUB_UPGRADE).setSpeedModifier(10) .setSkillPointsRequired(20).setPosition(9, 3)); - public static final RegistrySupplier SPEED_III = UPGRADE_DEFERRED_REGISTRY.register("speed_iii", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, SPEED_II, RegistryHelper.makeKey("speed_iii"), Upgrade.UpgradeType.SUB_UPGRADE).setSpeedModifier(10) + public static final RegistrySupplier SPEED_III = UPGRADE_DEFERRED_REGISTRY.register("speed_iii", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, SPEED_II, RegistryHelper.makeKey("speed_iii"), Upgrade.UpgradeType.SUB_UPGRADE).setSpeedModifier(25) .setSkillPointsRequired(30).setPosition(9, 4)); + + public static final RegistrySupplier SPEED_IV = UPGRADE_DEFERRED_REGISTRY.register("speed_iv", () -> new SpeedUpgrade(Items.FIREWORK_ROCKET::getDefaultInstance, SPEED_II, RegistryHelper.makeKey("speed_iv"), Upgrade.UpgradeType.SUB_UPGRADE) + .setSpeedModifier(50) + .setSkillPointsRequired(50) + .setPosition(9, 5)); + } diff --git a/forge/src/main/java/whocraft/tardis_refined/common/data/LangProviderEnglish.java b/forge/src/main/java/whocraft/tardis_refined/common/data/LangProviderEnglish.java index ac2722b42..bf6c1e98b 100644 --- a/forge/src/main/java/whocraft/tardis_refined/common/data/LangProviderEnglish.java +++ b/forge/src/main/java/whocraft/tardis_refined/common/data/LangProviderEnglish.java @@ -274,9 +274,10 @@ protected void addTranslations() { addUpgrade(TRUpgrades.IMPROVED_GENERATION_TIME_II.get(), "Improved Generation II", "Lowers desktop wait times to 60 seconds"); addUpgrade(TRUpgrades.IMPROVED_GENERATION_TIME_III.get(), "Improved Generation III", "Lowers desktop wait times to 10 seconds"); addUpgrade(TRUpgrades.FLIGHT_SYSTEM.get(), "Flight System", "Allows upgrades to the TARDIS Flight System"); - addUpgrade(TRUpgrades.SPEED_I.get(), "Speed I", "Flight speed is 2x faster"); - addUpgrade(TRUpgrades.SPEED_II.get(), "Speed II", "Flight speed is 5x faster"); - addUpgrade(TRUpgrades.SPEED_III.get(), "Speed III", "Flight speed is 10x faster"); + addUpgrade(TRUpgrades.SPEED_I.get(), "Speed I", "Flight speed is 5x faster"); + addUpgrade(TRUpgrades.SPEED_II.get(), "Speed II", "Flight speed is 10x faster"); + addUpgrade(TRUpgrades.SPEED_III.get(), "Speed III", "Flight speed is 25x faster"); + addUpgrade(TRUpgrades.SPEED_IV.get(), "Speed IV", "Flight speed is 50x faster"); } diff --git a/gradle.properties b/gradle.properties index 8898d8c9d..192dfeeef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -46,7 +46,7 @@ neoforge_data_pack_format=18 ##Mod Information #Common Mod Information -mod_version=2.0.5 +mod_version=2.0.6 license=https://github.com/Whocraft/TardisRefined/blob/minecraft/1.20/LICENSE.MD credits=Commoble, Lucraft, starray1000000, Monsterwaill, TheJudge, LoxiGoose mod_authors=CommandrMoose / River, Jeryn99, Magic Man, ILikePandas, Jacob K, 50ap5ud5