Skip to content

Commit

Permalink
Add config option for spent nuclear waste within the radioactive cell
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Oct 1, 2023
1 parent e781ed4 commit 227dab6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ public final class MEGAConfig implements ConfigData {
@ConfigEntry.BoundedDiscrete(min = 2, max = 12)
private int CompressionChainLimit = 3;

@ConfigEntry.Gui.Tooltip
private boolean AllowSpentWaste = false;

public int getCompressionChainLimit() {
return CompressionChainLimit;
}

public boolean isSpentWasteAllowed() {
return AllowSpentWaste;
}

public static void load() {
if (INSTANCE != null) {
throw new IllegalStateException("Config has already been loaded");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public enum MEGATranslations implements LocalizationEnum {
CompressionChainLimitTooltip(
"The maximum number of variants that a compression-enabled Bulk Cell may report as being stored.",
Type.CONFIG_TOOLTIP,
CompressionChainLimit);
CompressionChainLimit),
AllowSpentWaste("(AppMek) Allow Spent Nuclear Waste", Type.CONFIG_OPTION),
AllowSpentWasteToolltip(
"Whether the MEGA Radioactive Cell should be able to store Spent Nuclear Waste.",
Type.CONFIG_TOOLTIP,
AllowSpentWaste);

private final String englishText;
private final Type type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import mekanism.api.chemical.attribute.ChemicalAttributeValidator;
import mekanism.common.registries.MekanismGases;

import gripe._90.megacells.definition.MEGAConfig;

public class RadioactiveCellInventory implements StorageCell {

private static final String KEY = "key";
Expand Down Expand Up @@ -115,8 +117,11 @@ private ConfigInventory getConfigInventory() {

public boolean isBlackListed(AEKey what) {
if (what instanceof MekanismKey key) {
return ChemicalAttributeValidator.DEFAULT.process(key.getStack())
|| key.getStack().getRaw().getChemical() == MekanismGases.SPENT_NUCLEAR_WASTE.getChemical();
if (key.getStack().getRaw().getChemical() == MekanismGases.SPENT_NUCLEAR_WASTE.getChemical()) {
return !MEGAConfig.INSTANCE.isSpentWasteAllowed();
} else {
return ChemicalAttributeValidator.DEFAULT.process(key.getStack());
}
} else {
return true;
}
Expand Down

0 comments on commit 227dab6

Please sign in to comment.