From 3f03bd78990eaa2aa3ca0fe860ac871d933fc8af Mon Sep 17 00:00:00 2001 From: SavageCabbage64 Date: Fri, 24 May 2024 15:16:13 -0500 Subject: [PATCH 1/2] added config options for modifying storage upgrade multipliers and divisors --- .../block/config/FunctionalStorageConfig.java | 24 +++++++++++++++++ .../block/tile/FluidDrawerTile.java | 2 +- .../item/StorageUpgradeItem.java | 27 ++++++++++--------- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java b/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java index c571a37f..2726c151 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java +++ b/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java @@ -31,4 +31,28 @@ public class FunctionalStorageConfig { @ConfigVal(comment = "How many items the collector upgrade will try to pull") public static int UPGRADE_COLLECTOR_ITEMS = 4; + @ConfigVal(comment = "How much the storage of an item drawer with a Copper Upgrade should be multiplied by") + public static int COPPER_MULTIPLIER = 8; + + @ConfigVal(comment = "How much the storage of an item drawer with a Gold Upgrade should be multiplied by") + public static int GOLD_MULTIPLIER = 16; + + @ConfigVal(comment = "How much the storage of an item drawer with a Diamond Upgrade should be multiplied by") + public static int DIAMOND_MULTIPLIER = 24; + + @ConfigVal(comment = "How much the storage of an item drawer with a Netherite Upgrade should be multiplied by") + public static int NETHERITE_MULTIPLIER = 32; + + @ConfigVal(comment = "How much should the fluid storage be divided by for any given Storage Upgrade") + public static int FLUID_DIVISOR = 2; + + public static int getLevelMult(int level){ + return switch (level){ + case 1 -> COPPER_MULTIPLIER; + case 2 -> GOLD_MULTIPLIER; + case 3 -> DIAMOND_MULTIPLIER; + case 4 -> NETHERITE_MULTIPLIER; + default -> 1; + }; + } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java index a928bd9d..9cd7a696 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java +++ b/src/main/java/com/buuz135/functionalstorage/block/tile/FluidDrawerTile.java @@ -113,7 +113,7 @@ public LazyOptional getCapability(@Nonnull Capability cap, @Nullable D @Override public double getStorageDiv() { - return 2; + return FunctionalStorageConfig.FLUID_DIVISOR; } @Override diff --git a/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java b/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java index 6c7e217a..dae8aee2 100644 --- a/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java +++ b/src/main/java/com/buuz135/functionalstorage/item/StorageUpgradeItem.java @@ -1,5 +1,6 @@ package com.buuz135.functionalstorage.item; +import com.buuz135.functionalstorage.block.config.FunctionalStorageConfig; import com.hrznstudio.titanium.item.BasicItem; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; @@ -24,7 +25,7 @@ public StorageUpgradeItem(StorageTier tier) { } public int getStorageMultiplier() { - return storageTier.storageMultiplier; + return FunctionalStorageConfig.getLevelMult(storageTier.getLevel()); } public StorageTier getStorageTier() { @@ -37,8 +38,8 @@ public void addTooltipDetails(@Nullable BasicItem.Key key, ItemStack stack, List if (storageTier == StorageTier.IRON){ tooltip.add(Component.translatable("item.utility.downgrade").withStyle(ChatFormatting.GRAY)); } else { - tooltip.add(Component.translatable("storageupgrade.desc.item").withStyle(ChatFormatting.GRAY).append(this.storageTier.getStorageMultiplier() + "")); - tooltip.add(Component.translatable("storageupgrade.desc.fluid").withStyle(ChatFormatting.GRAY).append(this.storageTier.getStorageMultiplier() / 2 + "")); + tooltip.add(Component.translatable("storageupgrade.desc.item").withStyle(ChatFormatting.GRAY).append(FunctionalStorageConfig.getLevelMult(this.storageTier.getLevel()) + "")); + tooltip.add(Component.translatable("storageupgrade.desc.fluid").withStyle(ChatFormatting.GRAY).append(FunctionalStorageConfig.getLevelMult(this.storageTier.getLevel()) / FunctionalStorageConfig.FLUID_DIVISOR + "")); } } @@ -59,22 +60,22 @@ public Component getName(ItemStack p_41458_) { } public static enum StorageTier { - COPPER(8, Mth.color(204, 109, 81)), - GOLD(16, Mth.color(233, 177, 21)), - DIAMOND(24, Mth.color(32, 197, 181)), - NETHERITE(32, Mth.color(49, 41, 42)), - IRON(1, Mth.color(130, 130, 130)); + COPPER(1, Mth.color(204, 109, 81)), + GOLD(2, Mth.color(233, 177, 21)), + DIAMOND(3, Mth.color(32, 197, 181)), + NETHERITE(4, Mth.color(49, 41, 42)), + IRON(0, Mth.color(130, 130, 130)); - private final int storageMultiplier; + private final int level; private final int color; - StorageTier(int storageMultiplier, int color) { - this.storageMultiplier = storageMultiplier; + StorageTier(int level, int color) { + this.level = level; this.color = color; } - public int getStorageMultiplier() { - return storageMultiplier; + public int getLevel() { + return level; } public int getColor() { From 6ea4999938a76202180d250a281f01404ed96e91 Mon Sep 17 00:00:00 2001 From: SavageCabbage64 Date: Sun, 26 May 2024 15:14:26 -0500 Subject: [PATCH 2/2] added minimal range --- .../functionalstorage/block/config/FunctionalStorageConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java b/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java index 2726c151..7bb3a4ce 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java +++ b/src/main/java/com/buuz135/functionalstorage/block/config/FunctionalStorageConfig.java @@ -44,6 +44,7 @@ public class FunctionalStorageConfig { public static int NETHERITE_MULTIPLIER = 32; @ConfigVal(comment = "How much should the fluid storage be divided by for any given Storage Upgrade") + @ConfigVal.InRangeInt(min = 1) public static int FLUID_DIVISOR = 2; public static int getLevelMult(int level){