Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config options for storage upgrade multipliers and how much it should be divided by for fluid drawers and controllers, closes #18 closes #262 #285

Merged
merged 3 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,33 @@ 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")
@ConfigVal.InRangeInt(min = 1)
public static int FLUID_DIVISOR = 2;

@ConfigVal(comment = "How much should the range be divided by for any given Storage Upgrade")
@ConfigVal.InRangeInt(min = 1)
public static int RANGE_DIVISOR = 4;

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 @@ -111,7 +111,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
Expand Up @@ -82,7 +82,7 @@ public int getStorageSlotAmount() {

@Override
public double getStorageDiv() {
return 4;
return FunctionalStorageConfig.RANGE_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,9 +38,9 @@ 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.range", this.storageTier.getStorageMultiplier() / 4 + "").withStyle(ChatFormatting.GRAY));
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 + ""));
tooltip.add(Component.translatable("storageupgrade.desc.range", FunctionalStorageConfig.getLevelMult(this.storageTier.getLevel()) / FunctionalStorageConfig.RANGE_DIVISOR + "").withStyle(ChatFormatting.GRAY));
}
}

Expand All @@ -60,22 +61,22 @@ public Component getName(ItemStack p_41458_) {
}

public static enum StorageTier {
COPPER(8, Mth.color(204/255f, 109/255f, 81/255f)),
GOLD(16, Mth.color(233/255f, 177/255f, 21/255f)),
DIAMOND(24, Mth.color(32/255f, 197/255f, 181/255f)),
NETHERITE(32, Mth.color(49, 41, 42)),
IRON(1, Mth.color(130/255f, 130/255f, 130/255f));
COPPER(1, Mth.color(204/255f, 109/255f, 81/255f)),
GOLD(2, Mth.color(233/255f, 177/255f, 21/255f)),
DIAMOND(3, Mth.color(32/255f, 197/255f, 181/255f)),
NETHERITE(4, Mth.color(49, 41, 42)),
IRON(0, Mth.color(130/255f, 130/255f, 130/255f));

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