Skip to content

Commit

Permalink
Create warnings for redstone activation based on control type
Browse files Browse the repository at this point in the history
  • Loading branch information
bukowski912 committed Dec 27, 2024
1 parent 118c6d3 commit 8eb4cf8
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 12 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,10 @@ private void addMisc() {
add(MekanismLang.ISSUE_INPUT_DOESNT_PRODUCE_OUTPUT, " - Input does not produce output");
add(MekanismLang.ISSUE_INVALID_OREDICTIONIFICATOR_FILTER, " - Filter is no longer valid or supported");
add(MekanismLang.ISSUE_FILTER_HAS_BLACKLISTED_ELEMENT, " - Filter contains at least one element that is blacklisted");
add(MekanismLang.ISSUE_REDSTONE_PREVENTS_ACTIVATION, " - Redstone conditions not met");
//Redstone Activation
add(MekanismLang.ISSUE_LOW_REDSTONE_SIGNAL, " - Redstone signal absent, provide one to activate.");
add(MekanismLang.ISSUE_HIGH_REDSTONE_SIGNAL, " - Redstone signal present, remove it to activate.");
add(MekanismLang.ISSUE_REDSTONE_PULSE_REQUIRED, " - Redstone pulse required to activate.");
//Laser Amplifier
add(MekanismLang.ENTITY_DETECTION, "Entity Detection");
add(MekanismLang.ENERGY_CONTENTS, "Energy Contents");
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/mekanism/client/gui/GuiMekanismTile.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import mekanism.common.inventory.container.tile.MekanismTileContainer;
import mekanism.common.inventory.warning.WarningTracker.WarningType;
import mekanism.common.tile.base.TileEntityMekanism;
import mekanism.common.tile.interfaces.IRedstoneControl.RedstoneControl;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -40,7 +41,10 @@ protected void addGenericTabs() {
upgradeWindowTab = addRenderableWidget(new GuiUpgradeWindowTab(this, tile, () -> upgradeWindowTab));
}
if (tile.supportsRedstone()) {
addRenderableWidget(new GuiRedstoneControlTab(this, tile).warning(WarningType.REDSTONE_PREVENTS_ACTIVATION, () -> !tile.isRedstoneActivated()));
addRenderableWidget(new GuiRedstoneControlTab(this, tile)
.warning(WarningType.LOW_REDSTONE_SIGNAL, () -> !tile.isRedstoneActivated() && tile.getControlType() == RedstoneControl.HIGH)
.warning(WarningType.HIGH_REDSTONE_SIGNAL, () -> !tile.isRedstoneActivated() && tile.getControlType() == RedstoneControl.LOW)
.warning(WarningType.REDSTONE_PULSE_REQUIRED, () -> !tile.isRedstoneActivated() && tile.getControlType() == RedstoneControl.PULSE));
}
//Note: We check if the capability is present rather than calling hasSecurity so that we don't add the tab to the security desk
if (tile.getLevel() != null && IBlockSecurityUtils.INSTANCE.securityCapability(tile.getLevel(), tile.getBlockPos(), tile) != null) {
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/mekanism/common/MekanismLang.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ public enum MekanismLang implements ILangEntry {
ISSUE_INPUT_DOESNT_PRODUCE_OUTPUT("gui", "issues.input_doesnt_produce_output"),
ISSUE_INVALID_OREDICTIONIFICATOR_FILTER("gui", "issues.invalid_oredictionificator_filter"),
ISSUE_FILTER_HAS_BLACKLISTED_ELEMENT("gui", "issues.filter_has_blacklisted_element"),
ISSUE_REDSTONE_PREVENTS_ACTIVATION("gui", "issues.redstone_prevents_activation"),
//Redstone Activation
ISSUE_LOW_REDSTONE_SIGNAL("gui", "issues.low_redstone_signal"),
ISSUE_HIGH_REDSTONE_SIGNAL("gui", "issues.high_redstone_signal"),
ISSUE_REDSTONE_PULSE_REQUIRED("gui", "issues.redstone_pulse_required"),
//Laser Amplifier
ENTITY_DETECTION("laser_amplifier", "entity_detection"),
ENERGY_CONTENTS("laser_amplifier", "energy_contents"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public enum WarningType {
NOT_ENOUGH_ENERGY_REDUCED_RATE(MekanismLang.ISSUE_NOT_ENOUGH_ENERGY_REDUCED_RATE),
INVALID_OREDICTIONIFICATOR_FILTER(MekanismLang.ISSUE_INVALID_OREDICTIONIFICATOR_FILTER, 4),
FILTER_HAS_BLACKLISTED_ELEMENT(MekanismLang.ISSUE_FILTER_HAS_BLACKLISTED_ELEMENT, 5),
REDSTONE_PREVENTS_ACTIVATION(MekanismLang.ISSUE_REDSTONE_PREVENTS_ACTIVATION),
LOW_REDSTONE_SIGNAL(MekanismLang.ISSUE_LOW_REDSTONE_SIGNAL),
HIGH_REDSTONE_SIGNAL(MekanismLang.ISSUE_HIGH_REDSTONE_SIGNAL),
REDSTONE_PULSE_REQUIRED(MekanismLang.ISSUE_REDSTONE_PULSE_REQUIRED),
;

private final ILangEntry langEntry;
Expand Down

0 comments on commit 8eb4cf8

Please sign in to comment.