Skip to content

Commit

Permalink
added config options for modifying storage upgrade multipliers and di…
Browse files Browse the repository at this point in the history
…visors
  • Loading branch information
ProGoofster committed May 24, 2024
1 parent 2418662 commit 3f03bd7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public <U> LazyOptional<U> getCapability(@Nonnull Capability<U> cap, @Nullable D

@Override
public double getStorageDiv() {
return 2;
return FunctionalStorageConfig.FLUID_DIVISOR;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -24,7 +25,7 @@ public StorageUpgradeItem(StorageTier tier) {
}

public int getStorageMultiplier() {
return storageTier.storageMultiplier;
return FunctionalStorageConfig.getLevelMult(storageTier.getLevel());
}

public StorageTier getStorageTier() {
Expand All @@ -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 + ""));
}
}

Expand All @@ -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() {
Expand Down

0 comments on commit 3f03bd7

Please sign in to comment.