Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
463d8d1f12 | ||
|
|
c7188f1952 | ||
|
|
db9dc1706b |
No files matched your search
@@ -11,9 +11,11 @@ public class ColorUtils {
|
||||
textGray = color.rgb("textGray", "0x404040"),
|
||||
textLightGray = color.rgb("textLightGray", "0x606060"),
|
||||
recipeTitle = color.rgb("recipeTitle", "0xFFFFFF"),
|
||||
recipeTitleBG = color.argb("recipeTitleBG", "0x30000000"),
|
||||
recipeTitleHover = color.rgb("recipeTitleHover", "0xFFFF55"),
|
||||
subsetWidget = color.rgb("subsetWidget", "0xAA00AA"),
|
||||
recipeBadge = color.rgb("recipeBadge", "0xFDD835"),
|
||||
|
||||
subsetWidget = color.rgb("subsetWidget", "0xAA00AA"),
|
||||
buttonLabelNormal = color.rgb("buttonLabelNormal", "0xE0E0E0"),
|
||||
buttonLabelHover = color.rgb("buttonLabelHover", "0xFFFFA0"),
|
||||
buttonLabelDisabled = color.rgb("buttonLabelDisabled", "0x601010"),
|
||||
|
||||
@@ -11,8 +11,9 @@ import codechicken.nei.api.LayoutStyle;
|
||||
|
||||
public class LayoutStyleMinecraft extends LayoutStyle {
|
||||
|
||||
protected static final int BUTTON_SIZE = 20;
|
||||
protected static final int MARGIN = 2;
|
||||
public static final int BUTTON_SIZE = 20;
|
||||
public static final int MARGIN = 2;
|
||||
public static final int SUBSET_BAR_HEIGHT = 16;
|
||||
|
||||
public int buttonCount;
|
||||
public int leftSize;
|
||||
@@ -147,7 +148,7 @@ public class LayoutStyleMinecraft extends LayoutStyle {
|
||||
LayoutManager.searchField.x += BUTTON_SIZE;
|
||||
LayoutManager.searchField.w -= BUTTON_SIZE;
|
||||
} else {
|
||||
LayoutManager.dropDown.h = 16;
|
||||
LayoutManager.dropDown.h = SUBSET_BAR_HEIGHT;
|
||||
LayoutManager.dropDown.w = 150;
|
||||
LayoutManager.dropDown.y = MARGIN;
|
||||
LayoutManager.dropDown.x = (gui.width - LayoutManager.dropDown.w) / 2;
|
||||
|
||||
@@ -59,6 +59,7 @@ import codechicken.nei.config.preset.GuiPresetList;
|
||||
import codechicken.nei.event.NEIConfigsLoadedEvent;
|
||||
import codechicken.nei.moboverlay.MobOverlayScan;
|
||||
import codechicken.nei.moboverlay.MobOverlayStyle;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.InformationHandler;
|
||||
import codechicken.nei.recipe.RecipeCatalysts;
|
||||
@@ -270,9 +271,20 @@ public class NEIClientConfig {
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.infiniteScroll", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.evenRecipeSpacing").setComment("Spread recipes evenly across the page height")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.evenRecipeSpacing", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.topMargin").setComment("Recipe GUI Top Margin").getIntValue(0);
|
||||
API.addOption(new OptionIntegerField("inventory.guirecipe.topMargin", 0, 200));
|
||||
|
||||
tag.getTag("inventory.guirecipe.maxHeight").setComment("Recipe GUI Max Height").getIntValue(370);
|
||||
API.addOption(new OptionIntegerField("inventory.guirecipe.maxHeight", 166, 4000));
|
||||
|
||||
tag.getTag("inventory.guirecipe.minWidth").setComment("Recipe GUI Min Width")
|
||||
.getIntValue(HandlerInfo.DEFAULT_WIDTH);
|
||||
API.addOption(new OptionIntegerField("inventory.guirecipe.minWidth", HandlerInfo.DEFAULT_WIDTH, 4000));
|
||||
|
||||
tag.getTag("inventory.guirecipe.shiftOverlayRecipe")
|
||||
.setComment("Require holding shift to move items when overlaying recipe").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.shiftOverlayRecipe", true));
|
||||
|
||||
@@ -3,25 +3,15 @@ package codechicken.nei.bookmark.tree;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.recipe.GuiRecipeButton;
|
||||
import codechicken.nei.recipe.Recipe;
|
||||
import codechicken.nei.recipe.RecipeHandlerRef;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
|
||||
public class TreeOverlayButton extends GuiRecipeButton {
|
||||
|
||||
protected static final DrawableResource ICON_FILL = new DrawableBuilder(
|
||||
"nei:textures/nei_sprites.png",
|
||||
28,
|
||||
76,
|
||||
9,
|
||||
10).build();
|
||||
protected static final int BUTTON_ID_SHIFT = 4;
|
||||
|
||||
public final GuiCraftingTree treeGui;
|
||||
@@ -50,16 +40,8 @@ public class TreeOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawContent(Minecraft minecraft, int y, int x, boolean mouseOver) {
|
||||
final int iconX = this.xPosition + (this.width - ICON_FILL.width - 1) / 2;
|
||||
final int iconY = this.yPosition + (this.height - ICON_FILL.height) / 2;
|
||||
|
||||
GL11.glColor4f(1, 1, 1, this.enabled ? 1 : 0.5f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
ICON_FILL.draw(iconX, iconY);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
protected DrawableResource getIcon() {
|
||||
return UIRecipeTexture.ICON_OVERLAY_FILL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -109,6 +109,8 @@ public class IMCHandler {
|
||||
info.setShowFavoritesButton(!tag.hasKey("showFavoritesButton") || tag.getBoolean("showFavoritesButton"));
|
||||
info.setShowOverlayButton(!tag.hasKey("showOverlayButton") || tag.getBoolean("showOverlayButton"));
|
||||
info.setShowBadge(tag.hasKey("showBadge") && tag.getBoolean("showBadge"));
|
||||
info.setWindowWidth(tag.getInteger("windowWidth"));
|
||||
info.setRecipeSpacing(tag.getBoolean("recipeSpacing"));
|
||||
|
||||
GuiRecipeTab.handlerAdderFromIMC.remove(handler);
|
||||
GuiRecipeTab.handlerAdderFromIMC.put(handler, info);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package codechicken.nei.drawable;
|
||||
|
||||
public interface Drawable {
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Painter {
|
||||
|
||||
public void draw(int x, int y, int width, int height);
|
||||
}
|
||||
|
||||
public int getWidth();
|
||||
|
||||
public int getHeight();
|
||||
|
||||
public void draw(int x, int y, int width, int height);
|
||||
|
||||
default void draw(int x, int y) {
|
||||
draw(x, y, getWidth(), getHeight());
|
||||
}
|
||||
|
||||
public static Drawable of(int width, int height, Painter painter) {
|
||||
return new Drawable() {
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y, int w, int h) {
|
||||
painter.draw(x, y, w, h);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// every layer is drawn into the whole rectangle, the first one at the bottom
|
||||
public static Drawable stack(Drawable... layers) {
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
||||
for (Drawable layer : layers) {
|
||||
width = Math.max(width, layer.getWidth());
|
||||
height = Math.max(height, layer.getHeight());
|
||||
}
|
||||
|
||||
return of(width, height, (x, y, w, h) -> {
|
||||
for (Drawable layer : layers) {
|
||||
layer.draw(x, y, w, h);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.Image;
|
||||
|
||||
public class DrawableResource extends Image {
|
||||
public class DrawableResource extends Image implements Drawable {
|
||||
|
||||
private final ResourceLocation resourceLocation;
|
||||
private final int textureWidth;
|
||||
|
||||
@@ -11,8 +11,6 @@ import java.util.Set;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.BookmarkPanel.BookmarkViewMode;
|
||||
import codechicken.nei.FavoriteRecipes;
|
||||
@@ -24,28 +22,18 @@ import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.bookmark.tree.GuiCraftingTree;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.Recipe.RecipeIngredient;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.util.NEIMouseUtils;
|
||||
|
||||
public class GuiFavoriteButton extends GuiRecipeButton {
|
||||
|
||||
private static final int BUTTON_ID_START = 14;
|
||||
|
||||
protected static final DrawableResource ICON_STATE_OFF = new DrawableBuilder(
|
||||
"nei:textures/nei_sprites.png",
|
||||
10,
|
||||
76,
|
||||
9,
|
||||
10).build();
|
||||
protected static final DrawableResource ICON_STATE_ON = new DrawableBuilder(
|
||||
"nei:textures/nei_sprites.png",
|
||||
19,
|
||||
76,
|
||||
9,
|
||||
10).build();
|
||||
protected static final DrawableResource ICON_STATE_OFF = UIRecipeTexture.ICON_FAVORITE_OFF;
|
||||
protected static final DrawableResource ICON_STATE_ON = UIRecipeTexture.ICON_FAVORITE_ON;
|
||||
|
||||
protected final Recipe recipe;
|
||||
protected boolean favorite = false;
|
||||
@@ -94,17 +82,13 @@ public class GuiFavoriteButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawContent(Minecraft minecraft, int y, int x, boolean mouseOver) {
|
||||
final DrawableResource icon = isFavorite() ? ICON_STATE_ON : ICON_STATE_OFF;
|
||||
final int iconX = this.xPosition + (this.width - icon.width - 1) / 2;
|
||||
final int iconY = this.yPosition + (this.height - icon.height) / 2;
|
||||
protected DrawableResource getIcon() {
|
||||
return isFavorite() ? ICON_STATE_ON : ICON_STATE_OFF;
|
||||
}
|
||||
|
||||
GL11.glColor4f(1, 1, 1, this.enabled ? 1 : 0.5f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
icon.draw(iconX, iconY);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
@Override
|
||||
protected void drawContent(Minecraft minecraft, int mouseX, int mouseY, boolean mouseOver) {
|
||||
super.drawContent(minecraft, mouseX, mouseY, mouseOver);
|
||||
|
||||
if (!mouseOver) {
|
||||
this.selectedResult = null;
|
||||
|
||||
@@ -5,13 +5,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.ItemsTooltipLineHandler;
|
||||
@@ -23,20 +20,14 @@ import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.bookmark.BookmarkGrid;
|
||||
import codechicken.nei.bookmark.BookmarkPayload;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.util.NEIMouseUtils;
|
||||
|
||||
public class GuiOverlayButton extends GuiRecipeButton {
|
||||
|
||||
protected static DrawableResource notPresent = new DrawableBuilder(
|
||||
"nei:textures/nei_tabbed_sprites.png",
|
||||
0,
|
||||
40,
|
||||
8,
|
||||
8).build();
|
||||
protected static DrawableResource present = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 8, 40, 8, 8)
|
||||
.build();
|
||||
protected static DrawableResource notPresent = UIRecipeTexture.ITEM_MISSING;
|
||||
protected static DrawableResource present = UIRecipeTexture.ITEM_PRESENT;
|
||||
|
||||
public enum ItemOverlayFormat {
|
||||
|
||||
@@ -87,24 +78,9 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
}
|
||||
|
||||
protected static final DrawableResource ICON_FILL = new DrawableBuilder(
|
||||
"nei:textures/nei_sprites.png",
|
||||
28,
|
||||
76,
|
||||
9,
|
||||
10).build();
|
||||
protected static final DrawableResource ICON_FILL_ERROR = new DrawableBuilder(
|
||||
"nei:textures/nei_sprites.png",
|
||||
37,
|
||||
76,
|
||||
9,
|
||||
10).build();
|
||||
protected static final DrawableResource ICON_OVERLAY = new DrawableBuilder(
|
||||
"nei:textures/nei_sprites.png",
|
||||
46,
|
||||
76,
|
||||
9,
|
||||
10).build();
|
||||
protected static final DrawableResource ICON_FILL = UIRecipeTexture.ICON_OVERLAY_FILL;
|
||||
protected static final DrawableResource ICON_FILL_ERROR = UIRecipeTexture.ICON_OVERLAY_FILL_ERROR;
|
||||
protected static final DrawableResource ICON_OVERLAY = UIRecipeTexture.ICON_OVERLAY;
|
||||
protected static final int BUTTON_ID_SHIFT = 4;
|
||||
|
||||
public final GuiContainer firstGui;
|
||||
@@ -217,22 +193,12 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawContent(Minecraft minecraft, int y, int x, boolean mouseOver) {
|
||||
DrawableResource icon = ICON_OVERLAY;
|
||||
|
||||
protected DrawableResource getIcon() {
|
||||
if (this.canFillCraftingGrid && (!requireShiftForOverlayRecipe() || NEIClientUtils.shiftKey())) {
|
||||
icon = this.missedMaterialsTooltipLineHandler == null ? ICON_FILL : ICON_FILL_ERROR;
|
||||
return this.missedMaterialsTooltipLineHandler == null ? ICON_FILL : ICON_FILL_ERROR;
|
||||
}
|
||||
|
||||
final int iconX = this.xPosition + (this.width - icon.width - 1) / 2;
|
||||
final int iconY = this.yPosition + (this.height - icon.height) / 2;
|
||||
|
||||
GL11.glColor4f(1, 1, 1, this.enabled ? 1 : 0.5f);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
icon.draw(iconX, iconY);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
return ICON_OVERLAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,11 +13,10 @@ import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.api.ShortcutInputHandler;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.scroll.ScrollBar;
|
||||
import codechicken.nei.scroll.ScrollContainer;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.theme.UIWidgetTexture;
|
||||
|
||||
public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
@@ -51,26 +50,11 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
|
||||
private static final int SLOT_SIZE = 16;
|
||||
private static final int BORDER_PADDING = 6;
|
||||
private static final int TRANSPARENCY_BORDER = 4;
|
||||
private static final DrawableResource BG_TEXTURE = new DrawableBuilder(
|
||||
"nei:textures/catalyst_tab.png",
|
||||
0,
|
||||
0,
|
||||
28 + TRANSPARENCY_BORDER * 2,
|
||||
28 + TRANSPARENCY_BORDER * 2)
|
||||
.setTextureSize(28 + TRANSPARENCY_BORDER * 2, 28 + TRANSPARENCY_BORDER * 2)
|
||||
.setSlices(
|
||||
BORDER_PADDING + TRANSPARENCY_BORDER,
|
||||
BORDER_PADDING + TRANSPARENCY_BORDER,
|
||||
BORDER_PADDING + TRANSPARENCY_BORDER,
|
||||
BORDER_PADDING + TRANSPARENCY_BORDER)
|
||||
.build();
|
||||
|
||||
private static final DrawableResource FG_TEXTURE = new DrawableBuilder("nei:textures/slot.png", 0, 0, 18, 18)
|
||||
.setTextureSize(18, 18).setSlices(1, 1, 1, 1).build();
|
||||
private static final int COLUMNS_BOTTOM_INSET = 5;
|
||||
|
||||
private static final ScrollBar VERTICAL_SCROLLBAR = UIWidgetTexture.verticalScrollBar()
|
||||
.setOverflowType(ScrollBar.OverflowType.AUTO).setTrackPadding(0, BORDER_PADDING, -13, BORDER_PADDING)
|
||||
.setOverflowType(ScrollBar.OverflowType.AUTO)
|
||||
.setTrackPadding(0, BORDER_PADDING - 1, -13, BORDER_PADDING - 1)
|
||||
.setScrollPlace(ScrollBar.ScrollPlace.START);
|
||||
|
||||
private List<PositionedStack> items = Collections.emptyList();
|
||||
@@ -79,7 +63,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
private int style = -1;
|
||||
|
||||
public GuiRecipeCatalyst() {
|
||||
setPaddingBlock(BORDER_PADDING + 1, BORDER_PADDING + 1);
|
||||
setPaddingBlock(BORDER_PADDING, BORDER_PADDING);
|
||||
}
|
||||
|
||||
public void setCatalysts(List<PositionedStack> items) {
|
||||
@@ -98,13 +82,15 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
return this.availableHeight;
|
||||
}
|
||||
|
||||
public boolean isShowWidget() {
|
||||
return this.showWidget;
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return this.showWidget && NEIClientConfig.getJEIStyleRecipeCatalysts() != 0;
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() == 1) {
|
||||
final int maxItemsPerColumn = Math.max(0, this.availableHeight - 2 - BORDER_PADDING * 2) / SLOT_SIZE;
|
||||
final int maxItemsPerColumn = Math
|
||||
.max(0, this.availableHeight - COLUMNS_BOTTOM_INSET - 2 - BORDER_PADDING * 2) / SLOT_SIZE;
|
||||
return maxItemsPerColumn > 0 ? NEIServerUtils.divideCeil(this.items.size(), maxItemsPerColumn) : 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -120,7 +106,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
final int rows = getRowCount();
|
||||
|
||||
setVerticalScroll(null);
|
||||
setPaddingInline(BORDER_PADDING + 1, BORDER_PADDING - 3);
|
||||
setPaddingInline(BORDER_PADDING, BORDER_PADDING - 3);
|
||||
|
||||
this.style = NEIClientConfig.getJEIStyleRecipeCatalysts();
|
||||
this.h = rows * SLOT_SIZE + this.paddingBlockStart + this.paddingBlockEnd;
|
||||
@@ -132,7 +118,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
this.w += VERTICAL_SCROLLBAR.getTrackWidth();
|
||||
|
||||
setVerticalScroll(VERTICAL_SCROLLBAR);
|
||||
setPaddingInline(BORDER_PADDING + 1 + VERTICAL_SCROLLBAR.getTrackWidth(), this.paddingInlineEnd);
|
||||
setPaddingInline(this.paddingInlineStart + VERTICAL_SCROLLBAR.getTrackWidth(), this.paddingInlineEnd);
|
||||
}
|
||||
|
||||
this.showWidget = rows * columns > 0;
|
||||
@@ -162,12 +148,14 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
if (!this.showWidget) return;
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
BG_TEXTURE.draw(
|
||||
this.x - TRANSPARENCY_BORDER,
|
||||
this.y - TRANSPARENCY_BORDER,
|
||||
this.w + TRANSPARENCY_BORDER * 2,
|
||||
this.h + TRANSPARENCY_BORDER * 2);
|
||||
FG_TEXTURE.draw(
|
||||
|
||||
if (this.h < this.availableHeight) {
|
||||
UIRecipeTexture.CATALYST_TAB_JOINED.draw(this.x, this.y, this.w, this.h);
|
||||
} else {
|
||||
UIRecipeTexture.CATALYST_TAB.draw(this.x, this.y, this.w, this.h);
|
||||
}
|
||||
|
||||
UIRecipeTexture.CATALYST_SLOT.draw(
|
||||
this.x + this.paddingInlineStart - 1,
|
||||
this.y + this.paddingBlockStart - 1,
|
||||
this.w - this.paddingInlineStart - this.paddingInlineEnd + 2,
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -26,11 +25,11 @@ import codechicken.nei.ColorUtils;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.debug.DebugHandlerWidget;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public abstract class GuiRecipeTab extends Widget {
|
||||
@@ -44,29 +43,14 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
protected final String handlerName;
|
||||
protected final String handlerID;
|
||||
|
||||
public static final int TAB_WIDTH = 24;
|
||||
public static final int TAB_HEIGHT = 24;
|
||||
private static final DrawableResource selectedTabImage = new DrawableBuilder(
|
||||
"nei:textures/nei_tabbed_sprites.png",
|
||||
0,
|
||||
16,
|
||||
24,
|
||||
24).build();
|
||||
private static final DrawableResource unselectedTabImage = new DrawableBuilder(
|
||||
"nei:textures/nei_tabbed_sprites.png",
|
||||
24,
|
||||
16,
|
||||
24,
|
||||
24).build();
|
||||
|
||||
private boolean selected;
|
||||
|
||||
public GuiRecipeTab(IRecipeHandler handler, int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = TAB_WIDTH;
|
||||
this.h = TAB_HEIGHT;
|
||||
this.w = UIRecipeTexture.TAB_UNSELECTED.getWidth();
|
||||
this.h = UIRecipeTexture.TAB_UNSELECTED.getHeight();
|
||||
this.handler = handler;
|
||||
this.handlerName = handler.getHandlerId();
|
||||
this.selected = false;
|
||||
@@ -84,21 +68,20 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
drawForeground(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void drawBackground(int mouseX, int mouseY) {
|
||||
private void drawBackground(int mouseX, int mouseY) {
|
||||
final DrawableResource image = this.selected ? UIRecipeTexture.TAB_SELECTED : UIRecipeTexture.TAB_UNSELECTED;
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
final DrawableResource image = this.selected ? selectedTabImage : unselectedTabImage;
|
||||
image.draw(this.x, this.y);
|
||||
image.draw(this.x, this.y, this.w, this.h);
|
||||
}
|
||||
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
final int iconX = this.x + 4;
|
||||
final int iconY = this.y + 4;
|
||||
|
||||
final FontRenderer fontRenderer = GuiDraw.fontRenderer;
|
||||
private void drawForeground(int mouseX, int mouseY) {
|
||||
final HandlerInfo handlerInfo = getHandlerInfo(this.handlerName, this.handlerID);
|
||||
final DrawableResource icon = handlerInfo != null ? handlerInfo.getImage() : null;
|
||||
final ItemStack itemStack = handlerInfo != null ? handlerInfo.getItemStack() : null;
|
||||
final int iconX = this.x + (this.w - 16) / 2;
|
||||
final int iconY = this.y + this.h - 16 - 6;
|
||||
|
||||
if (icon != null) {
|
||||
icon.draw(iconX + 1, iconY + 1);
|
||||
@@ -111,24 +94,17 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
if (!isEnabled) GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
} else {
|
||||
// Text fallback
|
||||
final int color = this.selected ? ColorUtils.buttonLabelHover.getColor()
|
||||
: ColorUtils.buttonLabelNormal.getColor();
|
||||
String text = this.handler.getRecipeName();
|
||||
if (text != null && text.length() > 0) {
|
||||
if (text.length() > 2) {
|
||||
text = text.substring(0, 2);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (text == null || text.length() == 0) {
|
||||
text = "??";
|
||||
} else if (text.length() > 2) {
|
||||
text = text.substring(0, 2);
|
||||
}
|
||||
|
||||
int textCenterX = this.x + (int) (this.w / 2f);
|
||||
int textCenterY = this.y + (int) (this.h / 2f) - 3;
|
||||
int color = this.selected ? ColorUtils.buttonLabelHover.getColor()
|
||||
: ColorUtils.buttonLabelNormal.getColor();
|
||||
fontRenderer.drawStringWithShadow(
|
||||
text,
|
||||
textCenterX - (int) (fontRenderer.getStringWidth(text) / 2f),
|
||||
textCenterY,
|
||||
color);
|
||||
GuiDraw.drawStringC(text, iconX + 8, iconY + 4, color);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,23 @@ package codechicken.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.theme.UIWidgetTexture;
|
||||
|
||||
public class GuiRecipeTabs {
|
||||
|
||||
private final List<GuiRecipeTab> tabs = new ArrayList<>();
|
||||
private final List<Button> buttons = new ArrayList<>();
|
||||
private final Rectangle area = new Rectangle();
|
||||
private List<? extends IRecipeHandler> currenthandlers;
|
||||
private List<? extends IRecipeHandler> currenthandlers = Collections.emptyList();
|
||||
|
||||
private int pageCount = 1;
|
||||
private int pageNumber = 0;
|
||||
@@ -22,56 +26,78 @@ public class GuiRecipeTabs {
|
||||
private int numHandlers = 1;
|
||||
private int recipetype;
|
||||
|
||||
private final Button prevTab = new Button("<") {
|
||||
private static class TabArrowButton extends Button {
|
||||
|
||||
private final DrawableResource icon;
|
||||
private final BooleanSupplier action;
|
||||
|
||||
private TabArrowButton(DrawableResource icon, BooleanSupplier action) {
|
||||
this.icon = icon;
|
||||
this.action = action;
|
||||
this.w = 8;
|
||||
this.h = 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightClick) {
|
||||
if (!rightClick) {
|
||||
NEIClientUtils.playClickSound();
|
||||
return previousPage();
|
||||
} else return false;
|
||||
return !rightClick && this.action.getAsBoolean();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private final Button nextTab = new Button(">") {
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) {
|
||||
NEIClientUtils.playClickSound();
|
||||
return nextPage();
|
||||
} else return false;
|
||||
public void draw(int mouseX, int mouseY) {
|
||||
UIWidgetTexture.BUTTON
|
||||
.draw(this.x, this.y, this.w, this.h, this.icon, true, false, contains(mouseX, mouseY));
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
private final Button prevTab = new TabArrowButton(UIRecipeTexture.ICON_PREV, this::previousPage);
|
||||
private final Button nextTab = new TabArrowButton(UIRecipeTexture.ICON_NEXT, this::nextPage);
|
||||
|
||||
public static int getTabWidth() {
|
||||
return GuiRecipeTab.TAB_WIDTH;
|
||||
return UIRecipeTexture.TAB_UNSELECTED.getWidth() - 1;
|
||||
}
|
||||
|
||||
public static int getTabHeight() {
|
||||
return GuiRecipeTab.TAB_HEIGHT;
|
||||
return UIRecipeTexture.TAB_UNSELECTED.getHeight();
|
||||
}
|
||||
|
||||
public void update(GuiRecipe<?> guiRecipe) {
|
||||
public void place(int navLeft, int navWidth, int guiTop) {
|
||||
final int tabWidth = getTabWidth();
|
||||
final int tabHeight = getTabHeight();
|
||||
final int perPage = (navWidth - 4) / tabWidth;
|
||||
|
||||
this.recipetype = guiRecipe.recipetype;
|
||||
this.currenthandlers = guiRecipe.currenthandlers;
|
||||
this.area.width = perPage * tabWidth;
|
||||
this.area.height = tabHeight;
|
||||
|
||||
this.area.x = navLeft + (navWidth - this.area.width) / 2;
|
||||
this.area.y = guiTop - tabHeight + 4;
|
||||
|
||||
this.prevTab.y = this.nextTab.y = guiTop - this.prevTab.h + 1;
|
||||
this.prevTab.x = this.area.x - this.prevTab.w + 1;
|
||||
this.nextTab.x = this.area.x + this.area.width - 1;
|
||||
|
||||
if (this.categoriesPerPage != perPage) {
|
||||
this.categoriesPerPage = perPage;
|
||||
rebuild();
|
||||
} else {
|
||||
refreshPage();
|
||||
}
|
||||
}
|
||||
|
||||
public void update(List<? extends IRecipeHandler> handlers, int recipetype) {
|
||||
this.currenthandlers = handlers;
|
||||
this.recipetype = recipetype;
|
||||
|
||||
rebuild();
|
||||
}
|
||||
|
||||
private void rebuild() {
|
||||
this.numHandlers = this.currenthandlers.size();
|
||||
this.categoriesPerPage = (guiRecipe.xSize - 4) / tabWidth;
|
||||
this.pageNumber = this.recipetype / Math.max(this.categoriesPerPage, 1);
|
||||
this.pageCount = (int) Math.ceil((float) this.numHandlers / this.categoriesPerPage);
|
||||
|
||||
this.area.width = this.categoriesPerPage * tabWidth;
|
||||
this.area.height = tabHeight;
|
||||
this.area.x = guiRecipe.guiLeft + 4;
|
||||
this.area.y = guiRecipe.guiTop - tabHeight + 3;
|
||||
|
||||
refreshPage();
|
||||
updateArrows(tabHeight);
|
||||
refreshArrows();
|
||||
}
|
||||
|
||||
public void refreshPage() {
|
||||
@@ -97,17 +123,10 @@ public class GuiRecipeTabs {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateArrows(int tabHeight) {
|
||||
private void refreshArrows() {
|
||||
this.buttons.clear();
|
||||
|
||||
if (this.numHandlers > this.categoriesPerPage) {
|
||||
this.prevTab.w = this.nextTab.w = 8;
|
||||
this.prevTab.h = this.nextTab.h = tabHeight - 4;
|
||||
this.prevTab.y = this.nextTab.y = this.area.y + 2;
|
||||
|
||||
this.prevTab.x = this.area.x - this.prevTab.w + 1;
|
||||
this.nextTab.x = this.area.x + this.area.width - 1;
|
||||
|
||||
this.buttons.add(this.prevTab);
|
||||
this.buttons.add(this.nextTab);
|
||||
}
|
||||
@@ -144,14 +163,17 @@ public class GuiRecipeTabs {
|
||||
public void handleTooltip(int mousex, int mousey, List<String> tooltips) {
|
||||
if (!NEIClientConfig.areJEIStyleTabsVisible()) return;
|
||||
|
||||
for (GuiRecipeTab tab : this.tabs) {
|
||||
if (tab.contains(mousex, mousey)) {
|
||||
tab.addTooltips(tooltips);
|
||||
}
|
||||
}
|
||||
for (Button button : this.buttons) {
|
||||
if (button.contains(mousex, mousey)) {
|
||||
button.addTooltips(tooltips);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (GuiRecipeTab tab : this.tabs) {
|
||||
if (tab.contains(mousex, mousey)) {
|
||||
tab.addTooltips(tooltips);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +183,7 @@ public class GuiRecipeTabs {
|
||||
|
||||
for (Button button : this.buttons) {
|
||||
if (button.contains(x, y)) {
|
||||
return button.onButtonPress(mouseButton == 1);
|
||||
return button.handleClick(x, y, mouseButton);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ public class HandlerInfo {
|
||||
private boolean allowOverflowX = true;
|
||||
private boolean allowOverflowY = false;
|
||||
|
||||
private int windowWidth = 0;
|
||||
private boolean recipeSpacing = false;
|
||||
|
||||
private ItemStack itemStack = null;
|
||||
private DrawableResource image = null;
|
||||
|
||||
@@ -189,6 +192,22 @@ public class HandlerInfo {
|
||||
this.allowOverflowY = allowOverflowY;
|
||||
}
|
||||
|
||||
public int getWindowWidth() {
|
||||
return this.windowWidth;
|
||||
}
|
||||
|
||||
public void setWindowWidth(int windowWidth) {
|
||||
this.windowWidth = windowWidth;
|
||||
}
|
||||
|
||||
public boolean isRecipeSpacing() {
|
||||
return this.recipeSpacing;
|
||||
}
|
||||
|
||||
public void setRecipeSpacing(boolean recipeSpacing) {
|
||||
this.recipeSpacing = recipeSpacing;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private final HandlerInfo info;
|
||||
@@ -296,6 +315,16 @@ public class HandlerInfo {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setWindowWidth(int windowWidth) {
|
||||
this.info.windowWidth = windowWidth;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setRecipeSpacing(boolean recipeSpacing) {
|
||||
this.info.recipeSpacing = recipeSpacing;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HandlerInfo build() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,10 @@ public interface IRecipeHandler {
|
||||
return getRecipeName();
|
||||
}
|
||||
|
||||
default int getRecipeWidth(int recipe) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
default int getRecipeHeight(int recipe) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.ColorUtils;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.theme.UIWidgetTexture;
|
||||
|
||||
class NavigationBar extends Widget {
|
||||
|
||||
protected class NavButton extends Button {
|
||||
|
||||
private final DrawableResource icon;
|
||||
private final Runnable action;
|
||||
private final BooleanSupplier isEnabled;
|
||||
|
||||
protected NavButton(DrawableResource icon, BooleanSupplier isEnabled, Runnable action) {
|
||||
this.icon = icon;
|
||||
this.action = action;
|
||||
this.isEnabled = isEnabled;
|
||||
this.w = BUTTON_SIZE;
|
||||
this.h = BUTTON_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
final boolean enabled = this.isEnabled.getAsBoolean();
|
||||
final boolean active = (this.state & 0x3) == 2;
|
||||
|
||||
UIWidgetTexture.BUTTON.draw(this.x, this.y, this.w, this.h, this.icon, enabled, active, contains(mx, my));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (rightclick) return false;
|
||||
this.action.run();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected static final int BUTTON_SIZE = 12;
|
||||
protected static final int GAP = 2;
|
||||
|
||||
private final NavButton prev;
|
||||
private final NavButton next;
|
||||
|
||||
protected boolean enabled = true;
|
||||
|
||||
protected String label = "";
|
||||
protected int color = 0xffffff;
|
||||
protected int hoverColor = 0xffffff;
|
||||
|
||||
protected int insetLeft;
|
||||
protected Runnable labelAction;
|
||||
|
||||
public String labelTooltip;
|
||||
private String croppedLabel;
|
||||
private int croppedLabelWidth;
|
||||
private String croppedLabelSource;
|
||||
private int croppedLabelMaxWidth;
|
||||
|
||||
public NavigationBar(Runnable labelAction, Runnable onPrev, Runnable onNext) {
|
||||
this.prev = new NavButton(UIRecipeTexture.ICON_PREV, () -> NavigationBar.this.enabled, onPrev);
|
||||
this.next = new NavButton(UIRecipeTexture.ICON_NEXT, () -> NavigationBar.this.enabled, onNext);
|
||||
this.labelAction = labelAction;
|
||||
this.h = BUTTON_SIZE;
|
||||
}
|
||||
|
||||
protected int plateX() {
|
||||
return this.x + BUTTON_SIZE + GAP;
|
||||
}
|
||||
|
||||
protected int plateWidth() {
|
||||
return this.w - (BUTTON_SIZE + GAP) * 2;
|
||||
}
|
||||
|
||||
public void place(int x, int y, int w) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = w;
|
||||
this.prev.x = x;
|
||||
this.prev.y = y;
|
||||
this.next.x = x + w - BUTTON_SIZE;
|
||||
this.next.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
GuiDraw.drawRect(
|
||||
plateX() + this.insetLeft,
|
||||
this.y,
|
||||
plateWidth() - this.insetLeft,
|
||||
this.h,
|
||||
ColorUtils.recipeTitleBG.getColor());
|
||||
|
||||
this.prev.draw(mx, my);
|
||||
this.next.draw(mx, my);
|
||||
|
||||
if (!this.label.isEmpty()) {
|
||||
final FontRenderer font = NEIClientUtils.mc().fontRenderer;
|
||||
updateCroppedLabel(font);
|
||||
font.drawStringWithShadow(
|
||||
this.croppedLabel,
|
||||
labelX(),
|
||||
labelY(font),
|
||||
isLabelHovered(mx, my) ? this.hoverColor : this.color);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCroppedLabel(FontRenderer font) {
|
||||
final int maxWidth = plateWidth() - this.insetLeft;
|
||||
|
||||
if (!this.label.equals(this.croppedLabelSource) || maxWidth != this.croppedLabelMaxWidth) {
|
||||
this.croppedLabel = NEIClientUtils.cropText(font, this.label, maxWidth - 2);
|
||||
this.croppedLabelSource = this.label;
|
||||
this.croppedLabelMaxWidth = maxWidth;
|
||||
this.croppedLabelWidth = font.getStringWidth(this.croppedLabel);
|
||||
}
|
||||
}
|
||||
|
||||
private int labelX() {
|
||||
return plateX() + this.insetLeft + (plateWidth() - this.insetLeft) / 2 - this.croppedLabelWidth / 2;
|
||||
}
|
||||
|
||||
private int labelY(FontRenderer font) {
|
||||
return this.y + (this.h - font.FONT_HEIGHT) / 2 + 1;
|
||||
}
|
||||
|
||||
private boolean isLabelHovered(int mx, int my) {
|
||||
if (this.labelAction == null || this.label.isEmpty()) return false;
|
||||
|
||||
final FontRenderer font = NEIClientUtils.mc().fontRenderer;
|
||||
updateCroppedLabel(font);
|
||||
final int textX = labelX();
|
||||
final int textY = labelY(font);
|
||||
|
||||
return mx >= textX && mx < textX + this.croppedLabelWidth && my >= textY && my < textY + font.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mx, int my, List<String> tooltip) {
|
||||
if (tooltip.isEmpty() && this.labelTooltip != null && isLabelHovered(mx, my)) {
|
||||
tooltip.add(this.labelTooltip);
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
if (button == 0 && isLabelHovered(mx, my)) {
|
||||
this.labelAction.run();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!this.enabled) return false;
|
||||
if (this.prev.contains(mx, my)) return this.prev.handleClick(mx, my, button);
|
||||
if (this.next.contains(mx, my)) return this.next.handleClick(mx, my, button);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class RecipeJsonWriter {
|
||||
}
|
||||
|
||||
private static List<Integer> filteredRecipes(IRecipeHandler handler) {
|
||||
return new SearchRecipeHandler<>(handler).getFilteredRecipes();
|
||||
return new SearchRecipeHandler<>(handler, GuiRecipe.getRecipeListFilter()).getFilteredRecipes();
|
||||
}
|
||||
|
||||
private void writeFile(File file, List<? extends IRecipeHandler> handlers,
|
||||
|
||||
@@ -11,60 +11,100 @@ import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.recipe.widget.RecipeWidget;
|
||||
import codechicken.nei.recipe.widget.ViewStates;
|
||||
import codechicken.nei.scroll.ScrollContainer;
|
||||
|
||||
public class RecipePageManager {
|
||||
|
||||
private static final int RECIPE_GAP = 4;
|
||||
|
||||
private static final class Page {
|
||||
|
||||
private final List<Widget> widgets;
|
||||
private final int width;
|
||||
private final boolean overflowY;
|
||||
private int top;
|
||||
private int gap;
|
||||
|
||||
private Page(List<Widget> widgets, int width, boolean overflowY, int gap) {
|
||||
this.widgets = widgets;
|
||||
this.width = width;
|
||||
this.overflowY = overflowY;
|
||||
this.gap = gap;
|
||||
}
|
||||
}
|
||||
|
||||
private SearchRecipeHandler<?> handler;
|
||||
private ScrollContainer container;
|
||||
private HandlerInfo handlerInfo;
|
||||
|
||||
private String cacheKey = "";
|
||||
private int numRecipes = -1;
|
||||
private int searchVersion = -1;
|
||||
private int visibleHeight = -1;
|
||||
private int currentPageIndex = -1;
|
||||
private List<List<Widget>> pageWidgets = new ArrayList<>();
|
||||
private final List<RecipeWidget> recipeWidgets = new ArrayList<>();
|
||||
private final List<Page> pages = new ArrayList<>();
|
||||
private final ViewStates viewStates;
|
||||
private int maxRecipeWidth;
|
||||
private boolean overflowY;
|
||||
private final int recipeGap;
|
||||
|
||||
public RecipePageManager(SearchRecipeHandler<?> handler, HandlerInfo handlerInfo, ScrollContainer container) {
|
||||
public RecipePageManager(SearchRecipeHandler<?> handler, HandlerInfo handlerInfo, ScrollContainer container,
|
||||
ViewStates viewStates) {
|
||||
this.handler = handler;
|
||||
this.handlerInfo = handlerInfo;
|
||||
this.container = container;
|
||||
this.viewStates = viewStates;
|
||||
this.recipeGap = handlerInfo.isRecipeSpacing() ? RECIPE_GAP : 0;
|
||||
|
||||
rebuildPages();
|
||||
rebuildWidgets();
|
||||
}
|
||||
|
||||
public boolean rebuildPages() {
|
||||
final String cacheKey = handlerInfo.getHandlerName() + ":"
|
||||
+ getNumRecipes()
|
||||
+ ":"
|
||||
+ this.container.getVisibleHeight()
|
||||
+ ":"
|
||||
+ GuiRecipe.searchField.text();
|
||||
final boolean widgetsChanged = this.numRecipes != getNumRecipes()
|
||||
|| this.searchVersion != this.handler.getSearchVersion();
|
||||
final int visibleHeight = this.container.getVisibleHeight();
|
||||
|
||||
if (cacheKey.equals(this.cacheKey)) {
|
||||
if (!widgetsChanged && visibleHeight == this.visibleHeight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.cacheKey = cacheKey;
|
||||
this.visibleHeight = visibleHeight;
|
||||
|
||||
final List<RecipeWidget> pausedWidgets = getPausedWidgets();
|
||||
this.pageWidgets.clear();
|
||||
if (widgetsChanged) {
|
||||
rebuildWidgets();
|
||||
}
|
||||
|
||||
final boolean allowOverflowY = this.handlerInfo.isAllowOverflowY();
|
||||
final int handlerHeight = this.handlerInfo.getHeight() + this.handlerInfo.getYShift();
|
||||
final boolean multipleWidgetsAllowed = !allowOverflowY && handlerInfo.isMultipleWidgetsAllowed();
|
||||
final boolean infiniteScroll = !allowOverflowY
|
||||
&& NEIClientConfig.getBooleanSetting("inventory.guirecipe.infiniteScroll");
|
||||
this.pages.clear();
|
||||
this.overflowY = false;
|
||||
|
||||
final int heightAvailable = this.container.getVisibleHeight();
|
||||
final int width = Math.max(166, this.handlerInfo.getWidth());
|
||||
buildPages();
|
||||
buildSpreadGaps();
|
||||
changePage(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void rebuildWidgets() {
|
||||
this.numRecipes = getNumRecipes();
|
||||
this.searchVersion = this.handler.getSearchVersion();
|
||||
this.recipeWidgets.clear();
|
||||
|
||||
for (List<Integer> group : groupRecipes()) {
|
||||
this.recipeWidgets.add(
|
||||
new RecipeWidget(this.handler.original, group, this.viewStates.get(this.handler.original, group)));
|
||||
}
|
||||
|
||||
this.maxRecipeWidth = this.recipeWidgets.stream().mapToInt(widget -> widget.w).max()
|
||||
.orElse(this.handlerInfo.getWidth());
|
||||
}
|
||||
|
||||
private List<List<Integer>> groupRecipes() {
|
||||
final List<Integer> searchRecipes = this.handler.getFilteredRecipes();
|
||||
final int numRecipes = searchRecipes.size();
|
||||
final List<List<Integer>> groupedRecipes = new ArrayList<>();
|
||||
final Map<Object, Integer> groupEndIndices = new HashMap<>();
|
||||
List<Widget> widgets = new ArrayList<>();
|
||||
int shiftY = 0;
|
||||
|
||||
for (int i = 0; i < numRecipes; i++) {
|
||||
final int recipeIndex = searchRecipes.get(i);
|
||||
for (int recipeIndex : searchRecipes) {
|
||||
final Object groupId = this.handler.original.getRecipeGroupId(recipeIndex);
|
||||
final int groupIndex = groupId != null
|
||||
? groupEndIndices.computeIfAbsent(groupId, k -> groupedRecipes.size())
|
||||
@@ -77,42 +117,121 @@ public class RecipePageManager {
|
||||
groupedRecipes.get(groupIndex).add(recipeIndex);
|
||||
}
|
||||
|
||||
for (int groupIndex = 0; groupIndex < groupedRecipes.size(); groupIndex++) {
|
||||
final RecipeWidget widget = new RecipeWidget(this.handler.original, groupedRecipes.get(groupIndex));
|
||||
return groupedRecipes;
|
||||
}
|
||||
|
||||
// keep the pause of the rebuilt widgets
|
||||
for (RecipeWidget paused : pausedWidgets) {
|
||||
final int pausedIndex = paused.getRecipeHandlerRef().recipeIndex;
|
||||
private void buildPages() {
|
||||
final boolean multipleWidgetsAllowed = isMultipleWidgetsAllowed();
|
||||
final boolean infiniteScroll = isInfiniteScroll();
|
||||
final int heightAvailable = this.container.getVisibleHeight();
|
||||
List<Widget> widgets = new ArrayList<>();
|
||||
int shiftY = 0;
|
||||
|
||||
if (widget.containsRecipeIndex(pausedIndex)) {
|
||||
widget.pinRecipe(pausedIndex, paused.getPinnedIngredients());
|
||||
}
|
||||
for (RecipeWidget widget : this.recipeWidgets) {
|
||||
if (this.handlerInfo.isAllowOverflowY()) {
|
||||
widget.setHeight(Math.min(widget.getContentHeight(), heightAvailable));
|
||||
}
|
||||
|
||||
widget.w = width;
|
||||
|
||||
if (allowOverflowY) {
|
||||
widget.h = Math.min(handlerHeight, heightAvailable);
|
||||
}
|
||||
|
||||
if (!widgets.isEmpty()
|
||||
&& (!multipleWidgetsAllowed || !infiniteScroll && shiftY + widget.h > heightAvailable)) {
|
||||
this.pageWidgets.add(widgets);
|
||||
if (!widgets.isEmpty() && (!multipleWidgetsAllowed
|
||||
|| !infiniteScroll && shiftY + this.recipeGap + widget.h > heightAvailable)) {
|
||||
addPage(widgets);
|
||||
widgets = new ArrayList<>();
|
||||
shiftY = 0;
|
||||
}
|
||||
|
||||
if (!widgets.isEmpty()) {
|
||||
shiftY += this.recipeGap;
|
||||
}
|
||||
|
||||
widgets.add(widget);
|
||||
shiftY += widget.h;
|
||||
}
|
||||
|
||||
if (!widgets.isEmpty()) {
|
||||
this.pageWidgets.add(widgets);
|
||||
addPage(widgets);
|
||||
}
|
||||
}
|
||||
|
||||
private void addPage(List<Widget> widgets) {
|
||||
final int pageWidth = widgets.stream().mapToInt(widget -> widget.w).max().orElse(0);
|
||||
final int pageHeight = widgets.stream().mapToInt(widget -> widget.h).sum()
|
||||
+ this.recipeGap * (widgets.size() - 1);
|
||||
|
||||
final boolean pageOverflowsY = pageHeight > this.container.getVisibleHeight();
|
||||
|
||||
this.overflowY |= pageOverflowsY;
|
||||
this.pages.add(new Page(widgets, pageWidth, pageOverflowsY, this.recipeGap));
|
||||
}
|
||||
|
||||
public boolean needsVerticalScroll() {
|
||||
return this.overflowY;
|
||||
}
|
||||
|
||||
private Page getCurrentPage() {
|
||||
return this.currentPageIndex >= 0 && this.currentPageIndex < this.pages.size()
|
||||
? this.pages.get(this.currentPageIndex)
|
||||
: null;
|
||||
}
|
||||
|
||||
public boolean currentPageNeedsVerticalScroll() {
|
||||
final Page page = getCurrentPage();
|
||||
return page != null && page.overflowY;
|
||||
}
|
||||
|
||||
private void buildSpreadGaps() {
|
||||
if (!isMultipleWidgetsAllowed() || isInfiniteScroll()
|
||||
|| !NEIClientConfig.getBooleanSetting("inventory.guirecipe.evenRecipeSpacing")) {
|
||||
return;
|
||||
}
|
||||
|
||||
changePage(0);
|
||||
final int heightAvailable = this.container.getVisibleHeight();
|
||||
int maxHeight = 0;
|
||||
|
||||
return true;
|
||||
for (Page page : this.pages) {
|
||||
for (Widget widget : page.widgets) {
|
||||
maxHeight = Math.max(maxHeight, widget.h);
|
||||
}
|
||||
}
|
||||
|
||||
final int slots = maxHeight > 0 ? (heightAvailable + this.recipeGap) / (maxHeight + this.recipeGap) : 0;
|
||||
|
||||
// a page that fits a single recipe has nothing to spread
|
||||
if (slots <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int index = 0; index < this.pages.size(); index++) {
|
||||
final Page page = this.pages.get(index);
|
||||
int totalHeight = 0;
|
||||
|
||||
for (Widget widget : page.widgets) {
|
||||
totalHeight += widget.h;
|
||||
}
|
||||
|
||||
int spreadGap = (heightAvailable - totalHeight) / (page.widgets.size() + 1);
|
||||
|
||||
if (index == this.pages.size() - 1) {
|
||||
final int fullPageGap;
|
||||
|
||||
if (index > 0) {
|
||||
fullPageGap = this.pages.get(index - 1).top;
|
||||
} else {
|
||||
fullPageGap = (heightAvailable - slots * maxHeight) / (slots + 1);
|
||||
}
|
||||
|
||||
spreadGap = Math.min(spreadGap, fullPageGap);
|
||||
}
|
||||
|
||||
if (spreadGap >= this.recipeGap) {
|
||||
page.top = spreadGap;
|
||||
page.gap = spreadGap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isInfiniteScroll() {
|
||||
return !this.handlerInfo.isAllowOverflowY()
|
||||
&& NEIClientConfig.getBooleanSetting("inventory.guirecipe.infiniteScroll");
|
||||
}
|
||||
|
||||
public boolean isMultipleWidgetsAllowed() {
|
||||
@@ -128,7 +247,16 @@ public class RecipePageManager {
|
||||
}
|
||||
|
||||
public int getNumPages() {
|
||||
return this.pageWidgets.size();
|
||||
return this.pages.size();
|
||||
}
|
||||
|
||||
public int getMaxRecipeWidth() {
|
||||
return this.maxRecipeWidth;
|
||||
}
|
||||
|
||||
public int getCurrentPageWidth() {
|
||||
final Page page = getCurrentPage();
|
||||
return page != null ? page.width : 0;
|
||||
}
|
||||
|
||||
public void changePage(int delta) {
|
||||
@@ -145,8 +273,8 @@ public class RecipePageManager {
|
||||
|
||||
public boolean gotoRecipeIndex(int recipeIndex) {
|
||||
|
||||
for (int page = 0; page < this.pageWidgets.size(); page++) {
|
||||
for (Widget widget : this.pageWidgets.get(page)) {
|
||||
for (int page = 0; page < this.pages.size(); page++) {
|
||||
for (Widget widget : this.pages.get(page).widgets) {
|
||||
if (widget instanceof RecipeWidget recipeWidget && recipeWidget.containsRecipeIndex(recipeIndex)) {
|
||||
changePage(page - this.currentPageIndex);
|
||||
return true;
|
||||
@@ -157,24 +285,10 @@ public class RecipePageManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<RecipeWidget> getPausedWidgets() {
|
||||
final List<RecipeWidget> paused = new ArrayList<>();
|
||||
|
||||
for (List<Widget> widgets : this.pageWidgets) {
|
||||
for (Widget widget : widgets) {
|
||||
if (widget instanceof RecipeWidget recipeWidget && recipeWidget.isPaused()) {
|
||||
paused.add(recipeWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return paused;
|
||||
}
|
||||
|
||||
public boolean pinRecipe(int recipeIndex, List<ItemStack> ingredients) {
|
||||
|
||||
for (List<Widget> widgets : this.pageWidgets) {
|
||||
for (Widget widget : widgets) {
|
||||
for (Page page : this.pages) {
|
||||
for (Widget widget : page.widgets) {
|
||||
if (widget instanceof RecipeWidget recipeWidget && recipeWidget.containsRecipeIndex(recipeIndex)) {
|
||||
return recipeWidget.pinRecipe(recipeIndex, ingredients);
|
||||
}
|
||||
@@ -185,32 +299,35 @@ public class RecipePageManager {
|
||||
}
|
||||
|
||||
public List<Widget> getCurrentPageWidgets() {
|
||||
if (this.pageWidgets.isEmpty()) {
|
||||
|
||||
if (this.pages.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<Widget> currentWidgets = this.pageWidgets.get(this.currentPageIndex);
|
||||
int shiftY = 0;
|
||||
final Page page = this.pages.get(this.currentPageIndex);
|
||||
final int placeWidth = Math.max(this.container.w, page.width);
|
||||
int shiftY = page.top;
|
||||
|
||||
for (Widget widget : currentWidgets) {
|
||||
for (Widget widget : page.widgets) {
|
||||
if (widget instanceof RecipeWidget recipeWidget) {
|
||||
recipeWidget.setLocation(2, shiftY);
|
||||
final int offsetX = (placeWidth - widget.w) / 2;
|
||||
recipeWidget.setLocation(offsetX, shiftY, placeWidth - widget.w - offsetX);
|
||||
}
|
||||
shiftY += widget.h;
|
||||
shiftY += widget.h + page.gap;
|
||||
}
|
||||
|
||||
return currentWidgets;
|
||||
return page.widgets;
|
||||
}
|
||||
|
||||
public List<Integer> getRecipeIndices() {
|
||||
|
||||
if (this.pageWidgets.isEmpty()) {
|
||||
if (this.pages.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final List<Integer> recipeIndices = new ArrayList<>();
|
||||
|
||||
for (Widget widget : this.pageWidgets.get(this.currentPageIndex)) {
|
||||
for (Widget widget : this.pages.get(this.currentPageIndex).widgets) {
|
||||
if (widget instanceof RecipeWidget recipeWidget) {
|
||||
recipeIndices.add(recipeWidget.getRecipeHandlerRef().recipeIndex);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,327 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.RecipeSearchField;
|
||||
import codechicken.nei.RestartableTask;
|
||||
import codechicken.nei.SearchField;
|
||||
import codechicken.nei.SearchTokenParser.ISearchParserProvider;
|
||||
import codechicken.nei.SearchTokenParser.SearchMode;
|
||||
import codechicken.nei.api.IRecipeFilter;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.search.SearchExpressionUtils;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
|
||||
class RecipeSearchBar extends NavigationBar {
|
||||
|
||||
private static final int FIELD_MARGIN = 40;
|
||||
|
||||
private final RestartableTask updateFilter = new RestartableTask("NEI Recipe Filtering") {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (!(NEIClientUtils.mc().currentScreen instanceof GuiRecipe<?>guiRecipe)) return;
|
||||
|
||||
final SearchRecipeHandler<?> searchHandler = guiRecipe.getSearchHandler();
|
||||
if (searchHandler == null) return;
|
||||
|
||||
final IRecipeFilter filter = getRecipeFilter();
|
||||
final List<Integer> found = filter != null ? searchHandler.getSearchResult(filter) : null;
|
||||
|
||||
if (interrupted() || filter != null && found == null) return;
|
||||
searchHandler.setSearchIndices(found);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private final RecipeSearchField field = new RecipeSearchField("") {
|
||||
|
||||
@Override
|
||||
protected boolean noResults() {
|
||||
final GuiScreen currentScreen = NEIClientUtils.mc().currentScreen;
|
||||
return !(currentScreen instanceof GuiRecipe<?>guiRecipe) || guiRecipe.getNumRecipes() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if (!text().equals(oldText)) {
|
||||
RecipeSearchBar.this.updateFilter.restart();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private final NavButton toggle = new NavButton(UIRecipeTexture.ICON_SEARCH, () -> true, this::toggleField) {
|
||||
|
||||
@Override
|
||||
public void addTooltips(List<String> tooltip) {
|
||||
tooltip.add(NEIClientUtils.translate("recipe.search.tooltip.name") + GuiDraw.TOOLTIP_LINESPACE);
|
||||
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.input",
|
||||
SearchExpressionUtils.HIGHLIGHTS.RECIPE + "<"));
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.output",
|
||||
SearchExpressionUtils.HIGHLIGHTS.RECIPE + ">"));
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.text",
|
||||
SearchExpressionUtils.HIGHLIGHTS.RECIPE + "~"));
|
||||
|
||||
final int patternMode = NEIClientConfig.getIntSetting("inventory.search.patternMode");
|
||||
|
||||
if (patternMode != 2) {
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.auxiliary",
|
||||
SearchExpressionUtils.HIGHLIGHTS.RECIPE + "^"));
|
||||
}
|
||||
|
||||
if (patternMode == 3) {
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.all",
|
||||
SearchExpressionUtils.HIGHLIGHTS.RECIPE + "<&"));
|
||||
}
|
||||
|
||||
for (ISearchParserProvider provider : SearchField.searchParser.getProviders()) {
|
||||
if (provider.getSearchMode() == SearchMode.PREFIX) {
|
||||
addPrefixTooltip(tooltip, provider);
|
||||
}
|
||||
}
|
||||
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.exclude",
|
||||
SearchExpressionUtils.HIGHLIGHTS.NEGATE + "-"));
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.exclude_recipe",
|
||||
SearchExpressionUtils.HIGHLIGHTS.NEGATE + "!"));
|
||||
tooltip.add(
|
||||
NEIClientUtils
|
||||
.translate("recipe.search.tooltip.or", SearchExpressionUtils.HIGHLIGHTS.OR.f + "|"));
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.exact",
|
||||
SearchExpressionUtils.HIGHLIGHTS.QUOTED + "\"",
|
||||
SearchExpressionUtils.HIGHLIGHTS.QUOTED + "\""));
|
||||
|
||||
if (patternMode == 1 || patternMode == 3) {
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.regex",
|
||||
SearchExpressionUtils.HIGHLIGHTS.REGEX + "r/",
|
||||
SearchExpressionUtils.HIGHLIGHTS.REGEX + "/"));
|
||||
}
|
||||
} else {
|
||||
tooltip.add(NEIClientUtils.translate("recipe.search.tooltip.shift"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addPrefixTooltip(List<String> tooltip, ISearchParserProvider provider) {
|
||||
final char prefix = SearchField.searchParser.getRedefinedPrefix(provider.getPrefix());
|
||||
final String modeName = NEIClientUtils.translate("recipe.search.tooltip.prefix." + provider.getName());
|
||||
|
||||
tooltip.add(
|
||||
NEIClientUtils.translate(
|
||||
"recipe.search.tooltip.prefix",
|
||||
provider.getHighlightedColor() + String.valueOf(prefix),
|
||||
modeName));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
private boolean available = false;
|
||||
private String pageInfo = "";
|
||||
private String pageCounter = "";
|
||||
private boolean pageInfoCropped;
|
||||
private String pageLabel = "";
|
||||
|
||||
public RecipeSearchBar(Runnable onPrev, Runnable onNext) {
|
||||
super(null, onPrev, onNext);
|
||||
}
|
||||
|
||||
public void setPages(int current, int total) {
|
||||
this.pageInfo = current + "/" + total;
|
||||
this.pageLabel = NEIClientUtils.translate("recipe.page", current, total);
|
||||
updateCounter();
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
private void updateCounter() {
|
||||
this.pageCounter = NEIClientUtils.cropText(GuiDraw.fontRenderer, this.pageInfo, FIELD_MARGIN - GAP);
|
||||
this.pageInfoCropped = !this.pageCounter.equals(this.pageInfo);
|
||||
}
|
||||
|
||||
private void updateLabel() {
|
||||
this.label = this.field.isVisible() ? "" : this.pageLabel;
|
||||
}
|
||||
|
||||
private void toggleField() {
|
||||
if (this.field.isVisible()) {
|
||||
this.field.setText("");
|
||||
this.field.setFocus(false);
|
||||
this.field.setVisible(false);
|
||||
this.toggle.state = 0;
|
||||
} else {
|
||||
this.field.setVisible(true);
|
||||
this.field.setFocus(true);
|
||||
this.toggle.state = 2;
|
||||
}
|
||||
|
||||
updateLabel();
|
||||
}
|
||||
|
||||
public void setAvailable(boolean available) {
|
||||
this.available = available;
|
||||
this.insetLeft = available ? this.toggle.w + GAP : 0;
|
||||
}
|
||||
|
||||
public void place(int x, int y, int w) {
|
||||
super.place(x, y, w);
|
||||
|
||||
this.toggle.x = plateX();
|
||||
this.toggle.y = y;
|
||||
|
||||
this.field.x = this.toggle.x + this.toggle.w + 1;
|
||||
this.field.y = y - 1;
|
||||
this.field.w = plateWidth() - this.toggle.w - FIELD_MARGIN;
|
||||
this.field.h = 14;
|
||||
|
||||
updateCounter();
|
||||
}
|
||||
|
||||
public ItemFilter getFilter() {
|
||||
return this.field.getFilter();
|
||||
}
|
||||
|
||||
public IRecipeFilter getRecipeFilter() {
|
||||
return this.field.text().isEmpty() ? null : this.field.getRecipeFilter();
|
||||
}
|
||||
|
||||
public RecipeSearchField getSearchField() {
|
||||
return this.field;
|
||||
}
|
||||
|
||||
public void updateFilter() {
|
||||
this.updateFilter.restart();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.field.setText("");
|
||||
this.field.setVisible(false);
|
||||
this.toggle.state = 0;
|
||||
updateLabel();
|
||||
updateFilter();
|
||||
}
|
||||
|
||||
public boolean overSearch(int px, int py) {
|
||||
return this.available && this.toggle.contains(px, py) || this.field.isVisible() && this.field.contains(px, py);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int px, int py) {
|
||||
return super.contains(px, py) || overSearch(px, py);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
super.draw(mx, my);
|
||||
|
||||
if (this.available) {
|
||||
this.toggle.draw(mx, my);
|
||||
}
|
||||
|
||||
if (this.field.isVisible()) {
|
||||
this.field.draw(mx, my);
|
||||
|
||||
final FontRenderer font = GuiDraw.fontRenderer;
|
||||
final int textY = this.y + (this.h - font.FONT_HEIGHT) / 2 + 1;
|
||||
GuiDraw.drawStringC(this.pageCounter, this.field.x + this.field.w + FIELD_MARGIN / 2, textY, 0xffffff);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
if (this.available) {
|
||||
|
||||
if (this.toggle.contains(mx, my)) {
|
||||
return this.toggle.handleClick(mx, my, button);
|
||||
} else if (this.field.isVisible() && this.field.contains(mx, my)) {
|
||||
return this.field.handleClick(mx, my, button);
|
||||
}
|
||||
|
||||
this.field.onGuiClick(mx, my);
|
||||
}
|
||||
|
||||
return super.handleClick(mx, my, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyPress(int keyID, char keyChar) {
|
||||
return isFocused() && this.field.handleKeyPress(keyID, keyChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused() {
|
||||
return this.field.isVisible() && this.field.focused();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseFocus() {
|
||||
this.field.setFocus(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lastKeyTyped(int keyID, char keyChar) {
|
||||
if (isFocused()) {
|
||||
this.field.lastKeyTyped(keyID, keyChar);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onHotkeyPressed() {
|
||||
return this.field.isVisible() && this.field.onHotkeyPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mx, int my, List<String> tooltip) {
|
||||
|
||||
if (this.available) {
|
||||
tooltip = this.toggle.handleTooltip(mx, my, tooltip);
|
||||
}
|
||||
|
||||
if (tooltip.isEmpty() && this.field.isVisible()
|
||||
&& mx >= this.field.x + this.field.w
|
||||
&& mx < plateX() + plateWidth()
|
||||
&& my >= this.y
|
||||
&& my < this.y + this.h
|
||||
&& this.pageInfoCropped) {
|
||||
tooltip.add(this.pageInfo);
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
public boolean handleDragNDrop(int mx, int my, ItemStack draggedStack) {
|
||||
|
||||
if (this.field.isVisible() && this.field.contains(mx, my)) {
|
||||
this.field.setText(SearchField.getEscapedSearchText(draggedStack));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -8,30 +8,17 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.ColorUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.widget.RecipeWidget;
|
||||
import codechicken.nei.scroll.GuiHelper;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
|
||||
public class RecipeTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
private static final int BG_PADDING = 5;
|
||||
private static final int TRANSPARENCY_BORDER = 4;
|
||||
private final DrawableResource BG_TEXTURE = new DrawableBuilder(
|
||||
"nei:textures/gui/recipebg.png",
|
||||
0,
|
||||
0,
|
||||
176 + TRANSPARENCY_BORDER * 2,
|
||||
166 + TRANSPARENCY_BORDER * 2)
|
||||
.setSlices(
|
||||
BG_PADDING + TRANSPARENCY_BORDER,
|
||||
BG_PADDING + TRANSPARENCY_BORDER,
|
||||
BG_PADDING + TRANSPARENCY_BORDER,
|
||||
BG_PADDING + TRANSPARENCY_BORDER)
|
||||
.build();
|
||||
|
||||
protected long lastUpdate = System.currentTimeMillis();
|
||||
protected String recipeName = "";
|
||||
@@ -80,12 +67,16 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
|
||||
}
|
||||
|
||||
if (this.widget != null) {
|
||||
return new Dimension(this.widget.w + BG_PADDING * 2, this.widget.h + BG_PADDING * 2 + 12);
|
||||
return new Dimension(getContentWidth() + BG_PADDING * 2, this.widget.h + BG_PADDING * 2 + 12);
|
||||
}
|
||||
|
||||
return new Dimension(0, 0);
|
||||
}
|
||||
|
||||
private int getContentWidth() {
|
||||
return Math.max(this.widget.w, GuiDraw.getStringWidth(this.recipeName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
if (this.widget == null) return;
|
||||
@@ -106,25 +97,24 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
|
||||
GuiContainerManager.enable2DRender();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
BG_TEXTURE.draw(
|
||||
-TRANSPARENCY_BORDER,
|
||||
-TRANSPARENCY_BORDER,
|
||||
size.width + TRANSPARENCY_BORDER * 2,
|
||||
size.height + TRANSPARENCY_BORDER * 2);
|
||||
UIRecipeTexture.WIDGET.draw(0, 0, size.width, size.height);
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
|
||||
GuiDraw.drawRect(BG_PADDING, BG_PADDING, size.width - BG_PADDING * 2, 12, 0x30000000);
|
||||
GuiDraw.drawStringC(this.recipeName, this.widget.w / 2, BG_PADDING + 2, 0xffffff);
|
||||
final int titleColor = ColorUtils.recipeTitle.getColor();
|
||||
GuiDraw.drawRect(BG_PADDING, BG_PADDING, size.width - BG_PADDING * 2, 12, ColorUtils.recipeTitleBG.getColor());
|
||||
GuiDraw.drawStringC(this.recipeName, size.width / 2, BG_PADDING + 2, titleColor);
|
||||
|
||||
if (this.multiplier > 0) {
|
||||
GuiDraw.drawString(
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.multiplier),
|
||||
BG_PADDING + 2,
|
||||
BG_PADDING + 2,
|
||||
0xffffff);
|
||||
titleColor);
|
||||
}
|
||||
|
||||
this.widget.x = BG_PADDING + (getContentWidth() - this.widget.w) / 2;
|
||||
|
||||
GuiHelper.useScissor(
|
||||
this.widget.x,
|
||||
this.widget.y,
|
||||
|
||||
@@ -3,6 +3,7 @@ package codechicken.nei.recipe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.IntPredicate;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -18,18 +19,19 @@ class SearchRecipeHandler<H extends IRecipeHandler> {
|
||||
|
||||
private List<Integer> filteredRecipes;
|
||||
|
||||
private List<Integer> searchRecipes;
|
||||
private volatile List<Integer> searchRecipes;
|
||||
|
||||
public SearchRecipeHandler(H handler) {
|
||||
private volatile int searchVersion;
|
||||
|
||||
public SearchRecipeHandler(H handler, IRecipeFilter filter) {
|
||||
this.original = handler;
|
||||
|
||||
if (this.original.numRecipes() == 0) {
|
||||
this.filteredRecipes = Collections.emptyList();
|
||||
} else {
|
||||
final Stream<Integer> items = IntStream.range(0, this.original.numRecipes()).boxed();
|
||||
final IRecipeFilter filter = this.searchingAvailable() ? GuiRecipe.getRecipeListFilter() : null;
|
||||
|
||||
if (filter == null) {
|
||||
if (filter == null || !this.searchingAvailable()) {
|
||||
this.filteredRecipes = items.collect(Collectors.toList());
|
||||
} else {
|
||||
this.filteredRecipes = items.filter(recipe -> mathRecipe(this.original, recipe, filter))
|
||||
@@ -64,39 +66,43 @@ class SearchRecipeHandler<H extends IRecipeHandler> {
|
||||
|
||||
public List<Integer> getSearchResult(IRecipeFilter filter) {
|
||||
|
||||
if (filteredRecipes.isEmpty() || !this.searchingAvailable()) {
|
||||
if (this.filteredRecipes.isEmpty() || !this.searchingAvailable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Integer> filtered = null;
|
||||
final List<Integer> recipes = IntStream.range(0, filteredRecipes.size()).boxed().collect(Collectors.toList());
|
||||
final List<Integer> positions = IntStream.range(0, this.filteredRecipes.size()).boxed()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
filtered = ItemList.forkJoinPool.submit(
|
||||
() -> recipes.parallelStream()
|
||||
.filter(recipe -> mathRecipe(this.original, filteredRecipes.get(recipe), filter))
|
||||
return ItemList.forkJoinPool.submit(
|
||||
() -> positions.parallelStream()
|
||||
.filter(position -> mathRecipe(this.original, this.filteredRecipes.get(position), filter))
|
||||
.collect(Collectors.toList()))
|
||||
.get();
|
||||
|
||||
filtered.sort((a, b) -> a - b);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return filtered;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setSearchIndices(List<Integer> searchRecipes) {
|
||||
if (Objects.equals(this.searchRecipes, searchRecipes)) return;
|
||||
this.searchRecipes = searchRecipes;
|
||||
this.searchVersion++;
|
||||
}
|
||||
|
||||
public int getSearchVersion() {
|
||||
return this.searchVersion;
|
||||
}
|
||||
|
||||
public List<Integer> getFilteredRecipes() {
|
||||
final List<Integer> search = this.searchRecipes;
|
||||
|
||||
if (this.searchRecipes == null) {
|
||||
if (search == null) {
|
||||
return this.filteredRecipes;
|
||||
}
|
||||
|
||||
final List<Integer> search = this.searchRecipes;
|
||||
final List<Integer> resolved = new ArrayList<>(search.size());
|
||||
|
||||
for (int idx : search) {
|
||||
@@ -107,21 +113,18 @@ class SearchRecipeHandler<H extends IRecipeHandler> {
|
||||
}
|
||||
|
||||
public int ref(int index) {
|
||||
final List<Integer> search = this.searchRecipes;
|
||||
|
||||
if (searchRecipes != null) {
|
||||
index = searchRecipes.get(index);
|
||||
if (search != null) {
|
||||
index = search.get(index);
|
||||
}
|
||||
|
||||
return filteredRecipes.get(index);
|
||||
return this.filteredRecipes.get(index);
|
||||
}
|
||||
|
||||
public int numRecipes() {
|
||||
|
||||
if (searchRecipes != null) {
|
||||
return searchRecipes.size();
|
||||
}
|
||||
|
||||
return filteredRecipes.size();
|
||||
final List<Integer> search = this.searchRecipes;
|
||||
return search != null ? search.size() : this.filteredRecipes.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,6 +64,8 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
public boolean showFavorites;
|
||||
public boolean showOverlay;
|
||||
public boolean showBadge;
|
||||
public int windowWidth;
|
||||
public boolean recipeSpacing;
|
||||
|
||||
private String csvLine;
|
||||
|
||||
@@ -80,6 +82,8 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
this.showFavorites = info.getShowFavoritesButton();
|
||||
this.showOverlay = info.getShowOverlayButton();
|
||||
this.showBadge = info.getShowBadge();
|
||||
this.windowWidth = info.getWindowWidth();
|
||||
this.recipeSpacing = info.isRecipeSpacing();
|
||||
this.csvLine = toCsvLine();
|
||||
}
|
||||
|
||||
@@ -92,6 +96,8 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
this.info.setShowFavoritesButton(this.showFavorites);
|
||||
this.info.setShowOverlayButton(this.showOverlay);
|
||||
this.info.setShowBadge(this.showBadge);
|
||||
this.info.setWindowWidth(this.windowWidth);
|
||||
this.info.setRecipeSpacing(this.recipeSpacing);
|
||||
NEIClientConfig.handlerOrdering.put(this.handlerKey, this.order);
|
||||
}
|
||||
|
||||
@@ -108,6 +114,8 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
this.showFavorites = intOrDefault(parts[8], this.showFavorites ? 1 : 0) == 1;
|
||||
this.showOverlay = intOrDefault(parts[9], this.showOverlay ? 1 : 0) == 1;
|
||||
this.showBadge = intOrDefault(parts[10], this.showBadge ? 1 : 0) == 1;
|
||||
this.windowWidth = intOrDefault(parts[11], this.windowWidth);
|
||||
this.recipeSpacing = intOrDefault(parts[12], this.recipeSpacing ? 1 : 0) == 1;
|
||||
|
||||
apply();
|
||||
}
|
||||
@@ -125,7 +133,9 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
String.valueOf(this.allowOverflowY ? 1 : 0),
|
||||
String.valueOf(this.showFavorites ? 1 : 0),
|
||||
String.valueOf(this.showOverlay ? 1 : 0),
|
||||
String.valueOf(this.showBadge ? 1 : 0));
|
||||
String.valueOf(this.showBadge ? 1 : 0),
|
||||
String.valueOf(this.windowWidth),
|
||||
String.valueOf(this.recipeSpacing ? 1 : 0));
|
||||
}
|
||||
|
||||
public boolean isUnmodified() {
|
||||
@@ -148,7 +158,7 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
private static final int LABEL_WIDTH = 50;
|
||||
|
||||
private static final String TOOLTIP_PREFIX = "debug.RecipeHandler.";
|
||||
private static final String HEADER = "HandlerId,YShift,Height,Width,MultiWidgets,Order,AllowOverflowX,AllowOverflowY,ShowFavorites,ShowOverlay,ShowBadge";
|
||||
private static final String HEADER = "HandlerId,YShift,Height,Width,MultiWidgets,Order,AllowOverflowX,AllowOverflowY,ShowFavorites,ShowOverlay,ShowBadge,WindowWidth,RecipeSpacing";
|
||||
private final int[] COLORS = new int[] { 0x2200FF00, 0x22FF0000, 0x220000FF, 0x2200FFFF, 0x22FF00FF, 0x22FFFF00 };
|
||||
|
||||
public static DebugHandlerWidget instance = new DebugHandlerWidget();
|
||||
@@ -217,6 +227,11 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
saveHandlerInfoPatch();
|
||||
}, y);
|
||||
|
||||
y = addCheckboxWidget("RecipeSpacing", button -> {
|
||||
record.recipeSpacing = button.value;
|
||||
saveHandlerInfoPatch();
|
||||
}, y);
|
||||
|
||||
final LabelWidget readonly = new LabelWidget(0xffffff, true);
|
||||
|
||||
readonly.y = y;
|
||||
@@ -232,7 +247,12 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
y = addTextFieldWidget("Width", HandlerInfo.DEFAULT_WIDTH, (field, oldText) -> {
|
||||
record.width = field.getInteger();
|
||||
saveHandlerInfoPatch();
|
||||
}, newValue -> newValue >= HandlerInfo.DEFAULT_WIDTH, y);
|
||||
}, newValue -> newValue > 0, y);
|
||||
|
||||
y = addTextFieldWidget("WindowWidth", 0, (field, oldText) -> {
|
||||
record.windowWidth = field.getInteger();
|
||||
saveHandlerInfoPatch();
|
||||
}, newValue -> newValue >= 0, y);
|
||||
|
||||
y = addCheckboxWidget("AllowOverflowX", button -> {
|
||||
record.allowOverflowX = button.value;
|
||||
@@ -474,6 +494,8 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
this.values.get("height").updateValue(String.valueOf(this.record.height));
|
||||
this.values.get("height_readonly").updateValue(String.valueOf(this.record.height));
|
||||
this.values.get("width").updateValue(String.valueOf(this.record.width));
|
||||
this.values.get("windowwidth").updateValue(String.valueOf(this.record.windowWidth));
|
||||
this.values.get("recipespacing").updateValue(String.valueOf(this.record.recipeSpacing));
|
||||
|
||||
this.values.get("multiwidgets").updateValue(String.valueOf(this.record.multiWidgets));
|
||||
this.values.get("allowoverflowx").updateValue(String.valueOf(this.record.allowOverflowX));
|
||||
@@ -745,7 +767,8 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
ClientHandler.loadSettingsFile("handlers.patch", lines -> {
|
||||
final List<String> linesList = lines.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
if (linesList.isEmpty() || !HEADER.equals(linesList.get(0))) {
|
||||
// files saved before new columns were appended have a prefix of the current header
|
||||
if (linesList.isEmpty() || linesList.get(0).isEmpty() || !HEADER.startsWith(linesList.get(0))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -759,7 +782,7 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
|
||||
key -> new HandlerInfoRecord(
|
||||
key,
|
||||
GuiRecipeTab.handlerMap.getOrDefault(key, GuiRecipeTab.DEFAULT_HANDLER_INFO)));
|
||||
record.apply((line + ",null,null,null,null,null,null,null,null,null,null"));
|
||||
record.apply((line + ",null,null,null,null,null,null,null,null,null,null,null,null"));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -29,7 +29,6 @@ import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.api.IGuiContainerOverlay;
|
||||
import codechicken.nei.api.ShortcutInputHandler;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.AcceptsFollowingTooltipLineHandler;
|
||||
@@ -44,39 +43,41 @@ import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.RecipeHandlerRef;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.recipe.debug.DebugHandlerWidget;
|
||||
import codechicken.nei.theme.UIRecipeTexture;
|
||||
import codechicken.nei.util.NEIMouseUtils;
|
||||
|
||||
public class RecipeWidget extends Widget {
|
||||
|
||||
protected static final int TICKS_PER_CYCLE = 20;
|
||||
protected static final DrawableResource PAUSE_MARKER = new DrawableBuilder(
|
||||
"nei:textures/pinned_pause.png",
|
||||
0,
|
||||
0,
|
||||
8,
|
||||
8).setTextureSize(8, 8).build();
|
||||
protected static final DrawableResource PAUSE_MARKER = UIRecipeTexture.ICON_PAUSE;
|
||||
protected static final int PAUSE_MARKER_OFFSET = 1;
|
||||
|
||||
protected static final int BUTTON_GAP = 2;
|
||||
protected static final int BUTTON_SPACING = 2;
|
||||
protected static final int BUTTON_BOTTOM_OFFSET = 6;
|
||||
|
||||
protected final RecipeGroup group;
|
||||
protected final IRecipeHandler handler;
|
||||
protected final HandlerInfo handlerInfo;
|
||||
|
||||
protected final Map<PositionedStack, List<Badge>> badgeCache = new WeakHashMap<>();
|
||||
protected final Map<Integer, List<GuiRecipeButton>> buttonCache = new HashMap<>();
|
||||
protected final Map<Integer, List<GuiRecipeButton>> layoutCache = new HashMap<>();
|
||||
|
||||
protected AcceptsFollowingTooltipLineHandler acceptsTooltip;
|
||||
|
||||
protected int recipeHeight = 0;
|
||||
protected int spaceRight = 0;
|
||||
|
||||
protected final ViewState state;
|
||||
|
||||
protected int activeMember = 0;
|
||||
// single state counter: member = allowed[cycle % size], permutation index = cycle / size
|
||||
protected int cycle = 0;
|
||||
protected int cycleticks = 0;
|
||||
protected int lastcycle = -1;
|
||||
protected int favoriteRevision = FavoriteRecipes.getRevision();
|
||||
|
||||
protected boolean showAsWidget = false;
|
||||
protected boolean update = true;
|
||||
protected boolean paused = false;
|
||||
protected List<ItemStack> pinnedIngredients = null;
|
||||
protected Map<Point, ItemStack> pinnedSlots = Collections.emptyMap();
|
||||
|
||||
public RecipeWidget(RecipeHandlerRef handlerRef) {
|
||||
@@ -84,14 +85,24 @@ public class RecipeWidget extends Widget {
|
||||
}
|
||||
|
||||
public RecipeWidget(IRecipeHandler handler, List<Integer> recipeIndices) {
|
||||
this(new RecipeGroup(handler, recipeIndices));
|
||||
this(handler, recipeIndices, null);
|
||||
}
|
||||
|
||||
public RecipeWidget(IRecipeHandler handler, List<Integer> recipeIndices, ViewState state) {
|
||||
this(new RecipeGroup(handler, recipeIndices), state);
|
||||
}
|
||||
|
||||
public RecipeWidget(RecipeGroup group) {
|
||||
this(group, null);
|
||||
}
|
||||
|
||||
public RecipeWidget(RecipeGroup group, ViewState state) {
|
||||
this.group = group;
|
||||
this.handler = group.getHandler();
|
||||
this.handlerInfo = group.getHandlerInfo();
|
||||
this.state = state != null ? state : new ViewState();
|
||||
update();
|
||||
restore();
|
||||
}
|
||||
|
||||
public RecipeHandlerRef getRecipeHandlerRef() {
|
||||
@@ -106,33 +117,81 @@ public class RecipeWidget extends Widget {
|
||||
return this.group.contains(recipeIndex);
|
||||
}
|
||||
|
||||
// the state may come from a group with other members, then its cycle no longer fits
|
||||
private void restore() {
|
||||
final int member = this.group.indexOf(this.state.recipeIndex);
|
||||
|
||||
if (member < 0 || this.state.groupSize != this.group.size()) {
|
||||
this.state.cycle = 0;
|
||||
}
|
||||
|
||||
this.state.groupSize = this.group.size();
|
||||
|
||||
// a pause on a recipe hidden by the search stays in the state until the recipe is shown again
|
||||
if (this.state.pausedRecipeIndex >= 0
|
||||
&& pinRecipe(this.state.pausedRecipeIndex, this.state.pinnedIngredients)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setActiveMember(Math.max(member, 0));
|
||||
syncCycle();
|
||||
}
|
||||
|
||||
public HandlerInfo getHandlerInfo() {
|
||||
return this.handlerInfo;
|
||||
}
|
||||
|
||||
public void setLocation(int x, int y) {
|
||||
public void setLocation(int x, int y, int spaceRight) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
if (this.spaceRight != spaceRight) {
|
||||
this.spaceRight = spaceRight;
|
||||
relayoutButtons();
|
||||
}
|
||||
}
|
||||
|
||||
public void setHeight(int h) {
|
||||
if (this.h != h) {
|
||||
this.h = h;
|
||||
relayoutButtons();
|
||||
}
|
||||
}
|
||||
|
||||
public void showAsWidget(boolean show) {
|
||||
this.showAsWidget = show;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(int px, int py) {
|
||||
return super.contains(px, py) || isOverButton(px, py);
|
||||
}
|
||||
|
||||
private boolean isOverButton(int px, int py) {
|
||||
for (GuiRecipeButton button : getRecipeButtonsIfInit()) {
|
||||
if (button.contains(px - this.x, py - this.y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPaused() {
|
||||
return this.paused;
|
||||
}
|
||||
|
||||
public List<ItemStack> getPinnedIngredients() {
|
||||
return this.pinnedIngredients;
|
||||
return this.state.pinnedIngredients;
|
||||
}
|
||||
|
||||
public void setPaused(boolean paused) {
|
||||
final boolean wasPaused = this.paused;
|
||||
this.paused = paused && this.group.canCycle();
|
||||
this.state.pausedRecipeIndex = this.paused ? this.state.recipeIndex : -1;
|
||||
|
||||
if (!this.paused) {
|
||||
this.pinnedIngredients = null;
|
||||
this.state.pinnedIngredients = null;
|
||||
this.pinnedSlots = Collections.emptyMap();
|
||||
|
||||
if (wasPaused) {
|
||||
@@ -160,9 +219,10 @@ public class RecipeWidget extends Widget {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.pinnedIngredients = ingredients;
|
||||
this.state.pinnedIngredients = ingredients;
|
||||
this.pinnedSlots = slots;
|
||||
this.paused = true;
|
||||
this.state.pausedRecipeIndex = recipeIndex;
|
||||
setActiveMember(member);
|
||||
updatePermutations();
|
||||
|
||||
@@ -219,25 +279,39 @@ public class RecipeWidget extends Widget {
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
final int prevW = this.w;
|
||||
final int prevH = this.h;
|
||||
int recipeWidth = 0;
|
||||
this.recipeHeight = 0;
|
||||
|
||||
for (int member = 0; member < this.group.size(); member++) {
|
||||
final int recipe = this.group.getRecipeIndex(member);
|
||||
recipeWidth = Math.max(recipeWidth, this.handler.getRecipeWidth(recipe));
|
||||
this.recipeHeight = Math.max(this.recipeHeight, this.handler.getRecipeHeight(recipe));
|
||||
}
|
||||
|
||||
this.w = recipeWidth > 0 ? recipeWidth : this.handlerInfo.getWidth();
|
||||
|
||||
if (this.showAsWidget || !this.handlerInfo.isAllowOverflowY()) {
|
||||
int maxHeight = 0;
|
||||
this.h = getContentHeight();
|
||||
}
|
||||
|
||||
for (int member = 0; member < this.group.size(); member++) {
|
||||
final int recipeHeight = this.handler.getRecipeHeight(this.group.getRecipeIndex(member));
|
||||
|
||||
if (recipeHeight > 0) {
|
||||
maxHeight = Math.max(maxHeight, recipeHeight);
|
||||
}
|
||||
}
|
||||
|
||||
this.w = Math.max(166, this.handlerInfo.getWidth());
|
||||
this.h = (maxHeight > 0 ? maxHeight : this.handlerInfo.getHeight()) + this.handlerInfo.getYShift();
|
||||
if (this.w != prevW || this.h != prevH) {
|
||||
relayoutButtons();
|
||||
}
|
||||
|
||||
this.update = true;
|
||||
}
|
||||
|
||||
public int getContentHeight() {
|
||||
return (this.recipeHeight > 0 ? this.recipeHeight : this.handlerInfo.getHeight())
|
||||
+ this.handlerInfo.getYShift();
|
||||
}
|
||||
|
||||
private boolean showFavoritesButton() {
|
||||
return NEIClientConfig.favoritesEnabled() && this.handlerInfo.getShowFavoritesButton();
|
||||
}
|
||||
|
||||
public List<GuiRecipeButton> getRecipeButtons() {
|
||||
return this.buttonCache.computeIfAbsent(this.activeMember, this::createButtons);
|
||||
}
|
||||
@@ -252,8 +326,55 @@ public class RecipeWidget extends Widget {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Collections
|
||||
.unmodifiableList(initButtons(RecipeHandlerRef.of(this.handler, this.group.getRecipeIndex(member))));
|
||||
final List<GuiRecipeButton> buttons = initButtons(
|
||||
RecipeHandlerRef.of(this.handler, this.group.getRecipeIndex(member)));
|
||||
final List<GuiRecipeButton> unplaced = new ArrayList<>();
|
||||
|
||||
// NEI creates its buttons at (0, 0), so anything else was placed by a mod and keeps its position.
|
||||
for (GuiRecipeButton button : buttons) {
|
||||
if (button.xPosition == 0 && button.yPosition == 0) {
|
||||
unplaced.add(button);
|
||||
}
|
||||
}
|
||||
|
||||
this.layoutCache.put(member, unplaced);
|
||||
layoutButtons(unplaced);
|
||||
|
||||
return Collections.unmodifiableList(buttons);
|
||||
}
|
||||
|
||||
private void relayoutButtons() {
|
||||
for (List<GuiRecipeButton> buttons : this.layoutCache.values()) {
|
||||
layoutButtons(buttons);
|
||||
}
|
||||
}
|
||||
|
||||
private void layoutButtons(List<GuiRecipeButton> buttons) {
|
||||
final int top = this.handlerInfo.getYShift();
|
||||
final int bottom = this.h - BUTTON_BOTTOM_OFFSET;
|
||||
int columnX = 0;
|
||||
int columnWidth = 0;
|
||||
int y = bottom;
|
||||
|
||||
for (GuiRecipeButton button : buttons) {
|
||||
if (y != bottom && y - button.height < top) {
|
||||
columnX += columnWidth + BUTTON_SPACING;
|
||||
columnWidth = 0;
|
||||
y = bottom;
|
||||
}
|
||||
|
||||
y -= button.height;
|
||||
button.xPosition = columnX;
|
||||
button.yPosition = y;
|
||||
y -= BUTTON_SPACING;
|
||||
columnWidth = Math.max(columnWidth, button.width);
|
||||
}
|
||||
|
||||
final int left = this.w + Math.min(BUTTON_GAP, this.spaceRight - columnX - columnWidth);
|
||||
|
||||
for (GuiRecipeButton button : buttons) {
|
||||
button.xPosition += left;
|
||||
}
|
||||
}
|
||||
|
||||
private List<GuiRecipeButton> initButtons(RecipeHandlerRef ref) {
|
||||
@@ -289,22 +410,17 @@ public class RecipeWidget extends Widget {
|
||||
private List<GuiRecipeButton> getDefaultButtons(RecipeHandlerRef ref) {
|
||||
GuiContainer guiContainer = NEIClientUtils.getGuiContainer();
|
||||
final List<GuiRecipeButton> buttons = new ArrayList<>();
|
||||
final boolean showFavorites = NEIClientConfig.favoritesEnabled() && handlerInfo.getShowFavoritesButton();
|
||||
final boolean showOverlay = handlerInfo.getShowOverlayButton();
|
||||
final int x = Math.min(166, this.w) - GuiRecipeButton.BUTTON_WIDTH;
|
||||
int y = this.h - GuiRecipeButton.BUTTON_HEIGHT - 6;
|
||||
|
||||
if (guiContainer instanceof IGuiContainerOverlay overlay) {
|
||||
guiContainer = overlay.getFirstScreen();
|
||||
}
|
||||
|
||||
if (showOverlay) {
|
||||
buttons.add(new GuiOverlayButton(guiContainer, ref, x, y));
|
||||
y -= GuiRecipeButton.BUTTON_HEIGHT + 1;
|
||||
if (this.handlerInfo.getShowOverlayButton()) {
|
||||
buttons.add(new GuiOverlayButton(guiContainer, ref, 0, 0));
|
||||
}
|
||||
|
||||
if (showFavorites) {
|
||||
buttons.add(new GuiFavoriteButton(ref, x, y));
|
||||
if (showFavoritesButton()) {
|
||||
buttons.add(new GuiFavoriteButton(ref, 0, 0));
|
||||
}
|
||||
|
||||
return buttons;
|
||||
@@ -318,10 +434,10 @@ public class RecipeWidget extends Widget {
|
||||
this.update = false;
|
||||
|
||||
if (this.lastcycle == -1) {
|
||||
this.lastcycle = 0;
|
||||
this.lastcycle = this.state.cycleticks / TICKS_PER_CYCLE;
|
||||
applyCycle();
|
||||
} else if (tickCycle() && !isCycleFrozen(mouseX, mouseY)) {
|
||||
this.cycle++;
|
||||
this.state.cycle++;
|
||||
applyCycle();
|
||||
} else if (this.favoriteRevision != FavoriteRecipes.getRevision()) {
|
||||
this.favoriteRevision = FavoriteRecipes.getRevision();
|
||||
@@ -733,8 +849,8 @@ public class RecipeWidget extends Widget {
|
||||
|
||||
private boolean tickCycle() {
|
||||
|
||||
if ((this.cycleticks++ / TICKS_PER_CYCLE) != this.lastcycle) {
|
||||
this.lastcycle = this.cycleticks / TICKS_PER_CYCLE;
|
||||
if ((this.state.cycleticks++ / TICKS_PER_CYCLE) != this.lastcycle) {
|
||||
this.lastcycle = this.state.cycleticks / TICKS_PER_CYCLE;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -749,15 +865,14 @@ public class RecipeWidget extends Widget {
|
||||
|
||||
return NEIClientConfig.freezeCycleOnHover() && !this.showAsWidget
|
||||
&& contains(mouseX, mouseY)
|
||||
&& (getPositionedStackMouseOver(mouseX, mouseY) != null
|
||||
|| forEachButtons(button -> button.contains(mouseX, mouseY) ? true : null, false));
|
||||
&& (getPositionedStackMouseOver(mouseX, mouseY) != null || isOverButton(mouseX, mouseY));
|
||||
}
|
||||
|
||||
private void applyCycle() {
|
||||
|
||||
if (!this.paused) {
|
||||
final List<Integer> allowed = this.group.getAllowedMembers();
|
||||
setActiveMember(allowed.get(this.cycle % allowed.size()));
|
||||
setActiveMember(allowed.get(this.state.cycle % allowed.size()));
|
||||
}
|
||||
|
||||
this.group.refresh(this.activeMember);
|
||||
@@ -765,7 +880,7 @@ public class RecipeWidget extends Widget {
|
||||
}
|
||||
|
||||
private int getPermutationIndex() {
|
||||
return this.cycle / this.group.getAllowedMembers().size();
|
||||
return this.state.cycle / this.group.getAllowedMembers().size();
|
||||
}
|
||||
|
||||
// keep the permutation index, move the member part of the counter to the active member
|
||||
@@ -774,7 +889,7 @@ public class RecipeWidget extends Widget {
|
||||
final int allowedIndex = allowed.indexOf(this.activeMember);
|
||||
|
||||
if (allowedIndex >= 0) {
|
||||
this.cycle = this.cycle / allowed.size() * allowed.size() + allowedIndex;
|
||||
this.state.cycle = this.state.cycle / allowed.size() * allowed.size() + allowedIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -823,6 +938,7 @@ public class RecipeWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
this.state.recipeIndex = this.group.getRecipeIndex(member);
|
||||
}
|
||||
|
||||
private boolean containsStack(PositionedStack pStack, ItemStack stack) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package codechicken.nei.recipe.widget;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public final class ViewState {
|
||||
|
||||
public int recipeIndex = -1;
|
||||
public int groupSize = 0;
|
||||
|
||||
// single state counter: member = allowed[cycle % size], permutation index = cycle / size
|
||||
public int cycle = 0;
|
||||
public int cycleticks = 0;
|
||||
public int pausedRecipeIndex = -1;
|
||||
public List<ItemStack> pinnedIngredients = null;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package codechicken.nei.recipe.widget;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public final class ViewStates {
|
||||
|
||||
private final Map<Object, ViewState> groupStates = new HashMap<>();
|
||||
private final Map<Integer, ViewState> recipeStates = new HashMap<>();
|
||||
|
||||
// a group keeps its state while a search hides some of its recipes, a search can't split or merge groups
|
||||
public ViewState get(IRecipeHandler handler, List<Integer> group) {
|
||||
final int firstRecipe = group.get(0);
|
||||
final Object groupId = handler.getRecipeGroupId(firstRecipe);
|
||||
|
||||
return groupId != null ? this.groupStates.computeIfAbsent(groupId, k -> new ViewState())
|
||||
: this.recipeStates.computeIfAbsent(firstRecipe, k -> new ViewState());
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package codechicken.nei.scroll;
|
||||
import java.awt.Point;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@@ -80,6 +81,16 @@ public class ScrollContainer extends WidgetContainer {
|
||||
getVisibleHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidgets(List<Widget> widgets) {
|
||||
|
||||
for (Widget widget : widgets) {
|
||||
this.relativePosition.remove(widget);
|
||||
}
|
||||
|
||||
super.setWidgets(widgets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package codechicken.nei.theme;
|
||||
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
|
||||
public final class UIRecipeTexture {
|
||||
|
||||
public static final DrawableResource WINDOW = UISprite
|
||||
.of("recipe/window", 176, 109, new int[] { 6, 6, 6, 6 }, new int[] { 5, 33, 5, 5 });
|
||||
public static final DrawableResource WIDGET = UISprite
|
||||
.of("recipe/widget", 176, 95, new int[] { 6, 6, 6, 6 }, new int[] { 5, 19, 5, 5 });
|
||||
|
||||
private static final DrawableResource[] TAB = UISprite.frames("recipe/tab", 24, 27, 2);
|
||||
private static final DrawableResource[] NAV = UISprite.frames("recipe/icon_nav", 12, 12, 2);
|
||||
private static final DrawableResource[] FAVORITE = UISprite.frames("recipe/icon_favorite", 12, 12, 2);
|
||||
private static final DrawableResource[] OVERLAY = UISprite.frames("recipe/icon_overlay", 12, 12, 3);
|
||||
private static final DrawableResource[] ITEM_STATUS = UISprite.frames("recipe/item_status", 12, 12, 2);
|
||||
|
||||
public static final DrawableResource TAB_SELECTED = TAB[0];
|
||||
public static final DrawableResource TAB_UNSELECTED = TAB[1];
|
||||
|
||||
private static final DrawableResource[] CATALYST = UISprite
|
||||
.frames("recipe/catalyst_tab", 23, 28, 2, new int[] { 6, 6, 0, 6 }, new int[] { 5, 5, 5, 5 });
|
||||
|
||||
public static final DrawableResource CATALYST_TAB = CATALYST[0];
|
||||
public static final DrawableResource CATALYST_TAB_JOINED = CATALYST[1];
|
||||
public static final DrawableResource CATALYST_SLOT = UISprite
|
||||
.of("recipe/catalyst_slot", 18, 18, UISprite.DEFAULT_SPACE, new int[] { 1, 1, 1, 1 });
|
||||
|
||||
public static final DrawableResource ICON_PREV = NAV[0];
|
||||
public static final DrawableResource ICON_NEXT = NAV[1];
|
||||
|
||||
public static final DrawableResource ICON_SEARCH = UISprite.of("recipe/icon_search", 12, 12);
|
||||
public static final DrawableResource ICON_PAUSE = UISprite.of("recipe/icon_pause", 12, 12);
|
||||
|
||||
public static final DrawableResource ICON_FAVORITE_OFF = FAVORITE[0];
|
||||
public static final DrawableResource ICON_FAVORITE_ON = FAVORITE[1];
|
||||
|
||||
public static final DrawableResource ICON_OVERLAY = OVERLAY[0];
|
||||
public static final DrawableResource ICON_OVERLAY_FILL = OVERLAY[1];
|
||||
public static final DrawableResource ICON_OVERLAY_FILL_ERROR = OVERLAY[2];
|
||||
|
||||
public static final DrawableResource ITEM_MISSING = ITEM_STATUS[0];
|
||||
public static final DrawableResource ITEM_PRESENT = ITEM_STATUS[1];
|
||||
|
||||
private UIRecipeTexture() {}
|
||||
|
||||
}
|
||||
@@ -346,10 +346,10 @@ moze_intel.projecte.integration.NEI.NEIAlchBagHandler,ProjectE,ProjectE:item.pe_
|
||||
de.katzenpapst.amunra.nei.recipehandler.ARCircuitFab,Pra's Galacticraft Mod,GalacticraftCore:tile.machine2:4,,GalacticraftAmunRa,TRUE,,,,,,,,,,,,
|
||||
de.katzenpapst.amunra.nei.recipehandler.ARNasaWorkbenchShuttle,Pra's Galacticraft Mod,GalacticraftAmunRa:item.itemShuttle,,GalacticraftAmunRa,TRUE,,,130,168,16,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerFloatingFlowers,Botania,Botania:miniIsland,,Botania,TRUE,,,,,5,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerPetalApothecary,Botania,Botania:altar,,Botania,TRUE,,,102,137,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerRunicAltar,Botania,Botania:runeAltar,,Botania,TRUE,,,122,137,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerManaPool,Botania,Botania:pool,,Botania,TRUE,,,90,137,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerElvenTrade,Botania,Botania:alfheimPortal,,Botania,TRUE,,,90,130,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerPetalApothecary,Botania,Botania:altar,,Botania,TRUE,,,102,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerRunicAltar,Botania,Botania:runeAltar,,Botania,TRUE,,,122,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerManaPool,Botania,Botania:pool,,Botania,TRUE,,,90,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerElvenTrade,Botania,Botania:alfheimPortal,,Botania,TRUE,,,90,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerBrewery,Botania,Botania:brewery,,Botania,TRUE,,,,,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerPureDaisy,Botania,Botania:specialFlower,"{type:puredaisy}",Botania,TRUE,,,,,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.recipe.RecipeHandlerLexicaBotania,Botania,Botania:lexicon,,Botania,TRUE,,,,,,,,,,,,
|
||||
@@ -523,10 +523,10 @@ de.ellpeck.actuallyadditions.mod.nei.NEICompostRecipe,Actually Additions,Actuall
|
||||
de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe,Actually Additions,ActuallyAdditions:blockAtomicReconstructor,,ActuallyAdditions,TRUE,,,,,,,,,,,,
|
||||
de.ellpeck.actuallyadditions.mod.nei.NEITreasureChestRecipe,Actually Additions,ActuallyAdditions:blockTreasureChest,,ActuallyAdditions,TRUE,,,,,,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerFloatingFlowers,Botania,Botania:miniIsland,,Botania,TRUE,,,,,5,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerPetalApothecary,Botania,Botania:altar,,Botania,TRUE,,,102,137,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerRunicAltar,Botania,Botania:runeAltar,,Botania,TRUE,,,122,137,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerManaPool,Botania,Botania:pool,,Botania,TRUE,,,90,137,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerElvenTrade,Botania,Botania:alfheimPortal,,Botania,TRUE,,,90,130,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerPetalApothecary,Botania,Botania:altar,,Botania,TRUE,,,102,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerRunicAltar,Botania,Botania:runeAltar,,Botania,TRUE,,,122,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerManaPool,Botania,Botania:pool,,Botania,TRUE,,,90,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerElvenTrade,Botania,Botania:alfheimPortal,,Botania,TRUE,,,90,166,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerBrewery,Botania,Botania:brewery,,Botania,TRUE,,,,,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerPureDaisy,Botania,Botania:specialFlower,"{type:puredaisy}",Botania,TRUE,,,,,4,,,,,,,
|
||||
vazkii.botania.client.integration.nei.RecipeHandlerLexicaBotania,Botania,Botania:lexicon,,Botania,TRUE,,,,,,,,,,,,
|
||||
|
||||
|
@@ -343,6 +343,9 @@ nei.options.inventory.guirecipe.slotHighlightPresent.false=No
|
||||
nei.options.inventory.guirecipe.infiniteScroll=Use Infinite Scroll
|
||||
nei.options.inventory.guirecipe.infiniteScroll.true=Yes
|
||||
nei.options.inventory.guirecipe.infiniteScroll.false=No
|
||||
nei.options.inventory.guirecipe.evenRecipeSpacing=Spread Recipes Evenly
|
||||
nei.options.inventory.guirecipe.evenRecipeSpacing.true=Yes
|
||||
nei.options.inventory.guirecipe.evenRecipeSpacing.false=No
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst=JEI Style Recipe Catalysts
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.0=None
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.1=Grid
|
||||
@@ -360,6 +363,8 @@ nei.options.inventory.guirecipe.scrollPages.true=Enabled
|
||||
nei.options.inventory.guirecipe.scrollPages.false=Disabled
|
||||
|
||||
nei.options.inventory.guirecipe.maxHeight=Max Height
|
||||
nei.options.inventory.guirecipe.minWidth=Minimum Recipe Screen Width
|
||||
nei.options.inventory.guirecipe.topMargin=Recipe Screen Top Margin
|
||||
nei.options.inventory.showItemQuantityWidget=Show Item Quantity Widget
|
||||
nei.options.inventory.showItemQuantityWidget.true=Yes
|
||||
nei.options.inventory.showItemQuantityWidget.false=No
|
||||
@@ -630,6 +635,8 @@ nei.debug.RecipeHandler.yShift=yShift
|
||||
nei.debug.RecipeHandler.MultiWidgets=Multi Widgets
|
||||
nei.debug.RecipeHandler.Height=Height
|
||||
nei.debug.RecipeHandler.Width=Width
|
||||
nei.debug.RecipeHandler.WindowWidth=Window Width
|
||||
nei.debug.RecipeHandler.RecipeSpacing=Recipe Spacing
|
||||
nei.debug.RecipeHandler.ShowFavorites=Show Favorites
|
||||
nei.debug.RecipeHandler.ShowOverlay=Show Overlays
|
||||
nei.debug.RecipeHandler.ShowBadge=Show Badge
|
||||
|
||||
@@ -213,6 +213,8 @@ nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.2=Скролл
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip=Подсказка циклических ингредиентов
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.true=Показывать
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.false=Скрыть
|
||||
nei.options.inventory.guirecipe.minWidth=Минимальная ширина окна рецептов
|
||||
nei.options.inventory.guirecipe.topMargin=Верхний отступ окна рецептов
|
||||
nei.options.inventory.showItemQuantityWidget=Показывать виджет количества предметов
|
||||
nei.options.inventory.showItemQuantityWidget.true=Да
|
||||
nei.options.inventory.showItemQuantityWidget.false=Нет
|
||||
@@ -257,6 +259,9 @@ nei.options.inventory.guirecipe.shiftOverlayRecipe.false=Нет
|
||||
nei.options.inventory.guirecipe.freezeCycleOnHover=Останавливать перелистывание рецепта при наведении на предмет или кнопку
|
||||
nei.options.inventory.guirecipe.freezeCycleOnHover.true=Да
|
||||
nei.options.inventory.guirecipe.freezeCycleOnHover.false=Нет
|
||||
nei.options.inventory.guirecipe.evenRecipeSpacing=Равномерно распределять рецепты по высоте
|
||||
nei.options.inventory.guirecipe.evenRecipeSpacing.true=Да
|
||||
nei.options.inventory.guirecipe.evenRecipeSpacing.false=Нет
|
||||
nei.options.inventory.widgetsenabled.true=NEI включен
|
||||
nei.options.inventory.widgetsenabled.false=NEI выключен
|
||||
nei.options.inventory.cheatmode.0=Режим рецептов
|
||||
|
||||
|
Before Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 104 B |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 172 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 194 B |
|
After Width: | Height: | Size: 110 B |
|
After Width: | Height: | Size: 146 B |
|
After Width: | Height: | Size: 206 B |
|
After Width: | Height: | Size: 202 B |
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 554 B |
|
Before Width: | Height: | Size: 103 B |