From 190d29ec4eecb6508a91288639b1b6194e077fda Mon Sep 17 00:00:00 2001 From: Yannick Marcotte-Gourde Date: Fri, 28 Jul 2023 09:03:54 -0400 Subject: Less hostile user interfaces (Buffer/Filter/Input bus) (#2165) * Made Emit Energy button a CycleButtonWidget * Made Emit Redstone button a CycleButtonWidget * Made Invert Redstone button a CycleButtonWidget * Made Stocking Mode button a CycleButtonWidget * Spotless apply * Made Invert Filter button a CycleButtonWidget * public bInvertFilter -> protected invertFilter * Deduplicated filter code * Made Allow NBT button a CycleButtonWidget * Made Ignore NBT button a CycleButtonWidget * public bNBTAllowed -> private allowNbt * public bNBTAllowed -> private ignoreNbt * Grey extended tooltips * Don't hardcode multiline tooltips * Document hidden functionality * Cleaned numeric constants * Fixed string constant declaration * Named constants in filter * Unify filter redstone behavior * Fix cover filter mode being inverted so that the displayed mode is the active one * Less magic numbers * Allow right clicking recipe filter * Display only machine type in recipe filter and cycle through compatible machines * Buffer tooltips show output voltage to clarify their role as passthroughs * Added more info to Emit EU/Redstone buttons * Added Sorting mode button to buffers/filters * Added Sorting mode button and stack limit button to input buses * Don't cycle prefixes when clicking with itemstack * Fixed tooltips to work off of the inventory * Fix RecipeFilter losing filter * Support multiblock machines * Use ModularUi syncers to sync state with client Thanks minecraft7771! * Grey text for recipe filter helper text * AnimatedTooltipHandler -> EnumChatFormatting * Explicited RecipeFilter filter building * Specify color for empty slot tooltip * Don't cache new uses of GT5U.MBTT.MachineType. Also corrected MachineType::description * Removed unused getItemExtraTooltip * Multiple returns in getItemStackMachineRecipeMap --- src/main/java/gregtech/api/enums/MachineType.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/main/java/gregtech/api/enums') diff --git a/src/main/java/gregtech/api/enums/MachineType.java b/src/main/java/gregtech/api/enums/MachineType.java index ecf894c92f..d0183051b1 100644 --- a/src/main/java/gregtech/api/enums/MachineType.java +++ b/src/main/java/gregtech/api/enums/MachineType.java @@ -1,9 +1,8 @@ package gregtech.api.enums; +import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; -import com.gtnewhorizon.gtnhlib.util.AnimatedTooltipHandler; - public enum MachineType { ALLOY_SMELTER(FunnyTexts.ALLOY_SMELTER, "gt.recipe.alloysmelter"), @@ -107,26 +106,29 @@ public enum MachineType { static final String WIREMILL = "gt.recipe.wiremill.description"; } - private static final String TT_machineType = StatCollector.translateToLocal("GT5U.MBTT.MachineType"); + private static final String TT_machineType = "GT5U.MBTT.MachineType"; private final String name; private final String description; MachineType(String machineDescription, String machineType) { - this.description = StatCollector.translateToLocal(machineDescription); - this.name = StatCollector.translateToLocal(machineType); + this.description = machineDescription; + this.name = machineType; } public String type() { - return this.name; + return StatCollector.translateToLocal(this.name); } public String description() { - return this.name; + return StatCollector.translateToLocal(this.description); } public String[] tooltipDescription() { - return new String[] { this.description, - TT_machineType + ": " + AnimatedTooltipHandler.YELLOW + this.name + AnimatedTooltipHandler.RESET }; + return new String[] { description(), + StatCollector.translateToLocal(TT_machineType) + ": " + + EnumChatFormatting.YELLOW + + type() + + EnumChatFormatting.RESET }; } } -- cgit