Skip to content
Open
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 @@ -280,7 +280,11 @@ default boolean isLeftHandSidePanel() {

@ApiStatus.Experimental
boolean doDisplayIMEHints();


boolean doesPartialRecipesWarning();

void setDoesPartialRecipesWarning(boolean showWarning);

boolean doesFastEntryRendering();

boolean doesCacheEntryRendering();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,16 @@ public boolean doDisplayIMEHints() {
public void setDoDisplayIMEHints(boolean displayIMEHints) {
advanced.tooltips.displayIMEHints = displayIMEHints;
}


@Override
public boolean doesPartialRecipesWarning() {
return advanced.doesPartialRecipesWarning;
}

public void setDoesPartialRecipesWarning(boolean showWarning) {
advanced.doesPartialRecipesWarning = showWarning;
}

@Override
public boolean doesFastEntryRendering() {
return advanced.miscellaneous.newFastEntryRendering;
Expand Down Expand Up @@ -672,7 +681,9 @@ public static class Advanced {
public Commands commands = new Commands();
public Miscellaneous miscellaneous = new Miscellaneous();
public Filtering filtering = new Filtering();


public boolean doesPartialRecipesWarning = true;

public static class Tooltips {
@Comment("Declares whether REI should append mod names to entries.")
public boolean appendModNames = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static <T> OptionGroup make(String id) {
.add(APPEND_MOD_NAMES)
.add(APPEND_FAVORITES_HINT);
OptionGroup APPEARANCE_ADVANCED = make("appearance.advanced")
.add(PARTIAL_RECIPES_WARNING)
.add(RAINBOW);
OptionGroup INPUT_KEYBINDS = make("input.keybinds")
.add(RECIPE_KEYBIND)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ static ComparableValue<Double>[] doubleRange(double start, double end, double st
CompositeOption<DisplayScreenType> RECIPE_LOOKUP_STYLE = make("appearance.recipe_lookup_style", i -> i.appearance.recipeScreenType, (i, v) -> i.appearance.recipeScreenType = v)
.options(DisplayScreenType.ORIGINAL, DisplayScreenType.COMPOSITE)
.defaultValue(() -> DisplayScreenType.ORIGINAL);
CompositeOption<Boolean> PARTIAL_RECIPES_WARNING = make("appearance.partial_recipes_warning", i -> i.advanced.doesPartialRecipesWarning, (i, v) -> i.advanced.doesPartialRecipesWarning = v)
.enabledDisabled();
CompositeOption<Boolean> RAINBOW = make("appearance.rainbow", i -> i.appearance.rainbow, (i, v) -> i.appearance.rainbow = v)
.enabledDisabled();
CompositeOption<Boolean> APPEND_MOD_NAMES = make("appearance.append_mod_names", i -> i.advanced.tooltips.appendModNames, (i, v) -> i.advanced.tooltips.appendModNames = v)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import me.shedaniel.math.Rectangle;
import me.shedaniel.rei.RoughlyEnoughItemsCoreClient;
import me.shedaniel.rei.api.client.ClientHelper;
import me.shedaniel.rei.api.client.config.ConfigManager;
import me.shedaniel.rei.api.client.config.ConfigObject;
import me.shedaniel.rei.api.client.gui.config.DisplayPanelLocation;
import me.shedaniel.rei.api.client.gui.widgets.WidgetWithBounds;
import me.shedaniel.rei.api.client.gui.widgets.Widgets;
Expand All @@ -50,7 +52,8 @@ public class ImportantWarningsWidget extends WidgetWithBounds {
private static boolean dirty = false;
private boolean visible;
private final Rectangle bounds;
private final Rectangle buttonBounds = new Rectangle();
private final Rectangle okayButtonBounds = new Rectangle();
private final Rectangle doNotShowButtonBounds = new Rectangle();
private List<Component> texts;

public ImportantWarningsWidget() {
Expand All @@ -66,7 +69,7 @@ public ImportantWarningsWidget() {
dirty = dirty && !ClientHelper.getInstance().canUseMovePackets();
}

this.visible = dirty;
this.visible = dirty && ConfigObject.getInstance().doesPartialRecipesWarning();
this.texts = List.of(
Component.translatable("text.rei.recipes.not.full.title").withStyle(ChatFormatting.RED),
Component.translatable("text.rei.recipes.not.full.desc", Component.translatable("text.rei.recipes.not.full.desc.command").withStyle(ChatFormatting.AQUA, ChatFormatting.UNDERLINE)).withStyle(ChatFormatting.GRAY)
Expand Down Expand Up @@ -102,23 +105,46 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
y += Minecraft.getInstance().font.wordWrapHeight(text, bounds.width * 2) / 2 + 5;
graphics.pose().popPose();
}


MutableComponent doNotShowText = Component.translatable("text.rei.recipes.not.full.button.do_not_show_again").
withStyle(ChatFormatting.RED);
MutableComponent okayText = Component.translatable("text.rei.recipes.not.full.button.okay");
int doNotShowTextWidth = Minecraft.getInstance().font.width(doNotShowText);
int okayTextWidth = Minecraft.getInstance().font.width(okayText);
int boundsMaxY = bounds.getMaxY();

graphics.pose().pushPose();
graphics.pose().translate(bounds.x + bounds.width / 2 - Minecraft.getInstance().font.width(okayText) * 0.75 / 2, bounds.getMaxY() - 9, 0);
graphics.pose().translate(bounds.x, boundsMaxY - 9, 0);
graphics.pose().scale(0.75f, 0.75f, 1);
this.buttonBounds.setBounds(bounds.x, bounds.getMaxY() - 20, bounds.width, 20);
graphics.drawString(Minecraft.getInstance().font, okayText, 0, 0,
buttonBounds.contains(mouseX, mouseY) ? 0xfffff8de : 0xAAFFFFFF);

int textHeight = 10;
int buttonSpacingGap = 6;
int doNotShowButtonAlignCenter = (int) (bounds.x + bounds.width / 2.0 - Minecraft.getInstance().font.width(doNotShowText) * 0.75 / 2);
int okayButtonAlignCenter = (int) (bounds.x + bounds.width / 2.0 - Minecraft.getInstance().font.width(okayText) * 0.75 / 2);

this.doNotShowButtonBounds.setBounds(bounds.x, boundsMaxY - (textHeight * 2),
bounds.getMaxX(), textHeight);
this.okayButtonBounds.setBounds(bounds.x, boundsMaxY - textHeight + buttonSpacingGap,
bounds.getMaxX(), textHeight - buttonSpacingGap);

graphics.drawString(Minecraft.getInstance().font, doNotShowText,
doNotShowButtonAlignCenter, -textHeight,
doNotShowButtonBounds.contains(mouseX, mouseY) ? 0xfffff8de : 0xAAFFFFFF);
graphics.drawString(Minecraft.getInstance().font, okayText,
okayButtonAlignCenter, buttonSpacingGap,
okayButtonBounds.contains(mouseX, mouseY) ? 0xfffff8de : 0xAAFFFFFF);
graphics.pose().popPose();
graphics.pose().popPose();
}

@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (this.visible && button == 0 && buttonBounds.contains(mouseX, mouseY)) {
if ((this.visible && button == 0) && (okayButtonBounds.contains(mouseX, mouseY) || doNotShowButtonBounds.contains(mouseX, mouseY))) {
dirty = false;
this.visible = false;
if (doNotShowButtonBounds.contains(mouseX, mouseY)) {
ConfigObject.getInstance().setDoesPartialRecipesWarning(false);
}
Widgets.produceClickSound();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"text.rei.recipes.not.full.title": "Partial Recipes Data Warning",
"text.rei.recipes.not.full.desc": "REI does not have access to all recipes data!\nHere's what you can do:\n• If you are on a vanilla server and have operator permissions, running %s will unlock some recipes.\n• If you are on a modded server, ask the server owner to install REI on the server.",
"text.rei.recipes.not.full.desc.command": "/recipe give @p *",
"text.rei.recipes.not.full.button.do_not_show_again": "Do not show again",
"text.rei.recipes.not.full.button.okay": "Okay, I understand!",
"text.rei.config.menu.dark_theme": "Dark Theme",
"text.rei.config.menu.reduced_motion": "Reduced Motion",
Expand Down Expand Up @@ -280,6 +281,8 @@
"config.rei.options.appearance.append_favorites_hint": "Append Favorites Hint",
"config.rei.options.appearance.append_favorites_hint.desc": "Shows a hint on how to favorite an entry, or a recipe.",
"config.rei.options.groups.appearance.advanced": "Advanced",
"config.rei.options.appearance.partial_recipes_warning": "Partial Recipes Warning",
"config.rei.options.appearance.partial_recipes_warning.desc": "Whether to show partial recipes warning or not.",
"config.rei.options.appearance.rainbow": "Rainbow o(〒﹏〒)o",
"config.rei.options.groups.input.keybinds": "Keybinds",
"config.rei.options.input.recipe": "View Recipes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@
"config.rei.options.appearance.append_favorites_hint": "附加收藏夹提示:",
"config.rei.options.appearance.append_favorites_hint.desc": "将在提示框中添加将项目或配方添加至收藏夹的提示。",
"config.rei.options.groups.appearance.advanced": "高级",
"config.rei.options.appearance.partial_recipes_warning": "缺少配方警告",
"config.rei.options.appearance.partial_recipes_warning.desc": "决定是否显示缺少配方警告。",
"config.rei.options.appearance.rainbow": "彩虹 o(〒﹏〒)o",
"config.rei.options.groups.input.keybinds": "按键绑定",
"config.rei.options.input.recipe": "查看食谱",
Expand Down