Compare commits

..
Author SHA1 Message Date
Connor Colenso addb2f92e1 Stop craftable fluids drawing their amount twice
The craftables panel drew the stack with its amount, so NEI's fluid item
drew the amount and drawStackSize drew it again on top. Draw fluids
without their amount, as bookmarks already do.
2026-11-26 23:48:17 +00:00
Connor Colenso b784769426 Show fluid amounts over slots in compact form, without the L
Fluid amounts drawn over slots drop their L, since 1 L is 1 mB, a unit
doesn't fit in a slot and it ignored the L/mB setting anyway. With GTNHLib
loaded they use its compact formatting, so they follow the player's number
settings: exact up to 9,999, then 12.3K, 1.5M, rounded down. Without it
they keep the old short form. Covers the fluid display item, bookmarks,
craftables, the crafting tree and item rows in tooltips. Item counts are
unchanged.
2026-11-26 23:47:50 +00:00
53 changed files with 921 additions and 1572 deletions

No files matched your search

@@ -11,11 +11,9 @@ 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"),
recipeBadge = color.rgb("recipeBadge", "0xFDD835"),
subsetWidget = color.rgb("subsetWidget", "0xAA00AA"),
recipeBadge = color.rgb("recipeBadge", "0xFDD835"),
buttonLabelNormal = color.rgb("buttonLabelNormal", "0xE0E0E0"),
buttonLabelHover = color.rgb("buttonLabelHover", "0xFFFFA0"),
buttonLabelDisabled = color.rgb("buttonLabelDisabled", "0x601010"),
@@ -26,7 +26,6 @@ import codechicken.nei.recipe.Recipe;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.StackInfo;
import codechicken.nei.util.ReadableNumberConverter;
public class ItemCraftablesPanel
extends AbstractSubpanel<ItemsGrid<ItemCraftablesPanel.CraftablesGridSlot, MouseContext>> {
@@ -36,12 +35,15 @@ public class ItemCraftablesPanel
protected final long realAmount;
protected final boolean isFluidDisplay;
protected final RecipeId recipeId;
protected final ItemStack drawnItemStack;
public CraftablesGridSlot(int slotIndex, int itemIndex, ItemStack itemStack, RecipeId recipeId) {
super(slotIndex, itemIndex, itemStack);
this.realAmount = StackInfo.getAmount(itemStack);
this.isFluidDisplay = StackInfo.isFluidDisplayItem(itemStack);
this.recipeId = recipeId;
final ItemStack empty = this.isFluidDisplay ? StackInfo.withAmount(itemStack, 0) : null;
this.drawnItemStack = empty != null ? empty : itemStack;
}
@Override
@@ -49,6 +51,11 @@ public class ItemCraftablesPanel
return this.recipeId;
}
@Override
public void drawItem(Rectangle4i rect) {
super.drawItem(this.drawnItemStack, rect);
}
@Override
public <M extends MouseContext> void afterDraw(Rectangle4i rect, M mouseContext) {
drawStackSize(rect);
@@ -59,17 +66,7 @@ public class ItemCraftablesPanel
if (stackSize > 1) {
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
String amountString = "";
if (stackSize < 10_000) {
amountString = String.valueOf(stackSize);
} else {
amountString = ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize);
}
if (this.isFluidDisplay) {
amountString += "L";
}
final String amountString = NEIClientUtils.formatSlotAmount(stackSize, this.isFluidDisplay);
NEIClientUtils.drawNEIOverlayText(
amountString,
@@ -68,10 +68,9 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
protected void drawAmount(Rectangle4i rect, ItemStack stack, long amount) {
final AmountText amountText = this.cache.computeIfAbsent(stack, key -> {
final boolean isFluidDisplay = StackInfo.isFluidDisplayItem(key);
final String text = formatAmount(key, amount);
return new AmountText(
isFluidDisplay && !text.isEmpty() ? text + "L" : text,
formatAmount(key, amount),
isFluidDisplay ? Alignment.BottomLeft : Alignment.BottomRight);
});
@@ -81,7 +80,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
}
protected String formatAmount(ItemStack stack, long amount) {
return amount == 0 ? "" : ReadableNumberConverter.INSTANCE.toWideReadableForm(amount);
return amount == 0 ? "" : NEIClientUtils.formatSlotAmount(amount, StackInfo.isFluidDisplayItem(stack));
}
}
@@ -11,9 +11,8 @@ import codechicken.nei.api.LayoutStyle;
public class LayoutStyleMinecraft extends LayoutStyle {
public static final int BUTTON_SIZE = 20;
public static final int MARGIN = 2;
public static final int SUBSET_BAR_HEIGHT = 16;
protected static final int BUTTON_SIZE = 20;
protected static final int MARGIN = 2;
public int buttonCount;
public int leftSize;
@@ -148,7 +147,7 @@ public class LayoutStyleMinecraft extends LayoutStyle {
LayoutManager.searchField.x += BUTTON_SIZE;
LayoutManager.searchField.w -= BUTTON_SIZE;
} else {
LayoutManager.dropDown.h = SUBSET_BAR_HEIGHT;
LayoutManager.dropDown.h = 16;
LayoutManager.dropDown.w = 150;
LayoutManager.dropDown.y = MARGIN;
LayoutManager.dropDown.x = (gui.width - LayoutManager.dropDown.w) / 2;
@@ -59,7 +59,6 @@ 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;
@@ -271,20 +270,9 @@ 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));
@@ -53,6 +53,7 @@ import org.lwjgl.opengl.GL11;
import com.google.common.collect.Iterables;
import com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil;
import com.gtnewhorizon.gtnhlib.util.numberformatting.options.CompactOptions;
import codechicken.lib.gui.GuiDraw;
import codechicken.lib.inventory.InventoryRange;
@@ -65,6 +66,7 @@ import codechicken.nei.api.ItemInfo;
import codechicken.nei.recipe.GuiOverlayButton.ItemOverlayState;
import codechicken.nei.recipe.StackInfo;
import codechicken.nei.util.NEIKeyboardUtils;
import codechicken.nei.util.ReadableNumberConverter;
public class NEIClientUtils extends NEIServerUtils {
@@ -154,6 +156,23 @@ public class NEIClientUtils extends NEIServerUtils {
return getDecimalFormat().format(aNumber) + " L";
}
/** Only loaded when GTNHLib is, since CompactOptions comes from it. */
private static final class FluidSlotAmountFormat {
private static final CompactOptions OPTIONS = new CompactOptions().setCompactThreshold(10_000)
.setDecimalPlaces(1).setRoundingMode(RoundingMode.DOWN);
}
/** The amount drawn over a slot. Fluids use GTNHLib's compact formatting when it's loaded and have no unit. */
public static String formatSlotAmount(long amount, boolean isFluid) {
if (isFluid && NEIModContainer.isGTNHLibLoaded()) {
return NumberFormatUtil.formatNumberCompact(amount, FluidSlotAmountFormat.OPTIONS);
}
return amount < 10_000 ? String.valueOf(amount) : ReadableNumberConverter.INSTANCE.toWideReadableForm(amount);
}
public static String formatChance(float chance) {
return CHANCE_FORMAT.format(chance);
}
@@ -363,17 +363,7 @@ public class BookmarksGridSlot extends ItemsGridSlot {
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
final long stackSize = this.bookmarkItem.getStackSize(amount);
int color = 0xFFFFFF;
String amountString = "";
if (stackSize < 10_000) {
amountString = String.valueOf(stackSize);
} else {
amountString = ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize);
}
if (this.isFluidDisplay) {
amountString += "L";
}
String amountString = NEIClientUtils.formatSlotAmount(stackSize, this.isFluidDisplay);
if (this.bookmarkItem.chance != PositionedStack.CHANCE_FULL) {
amountString = "~" + amountString;
@@ -29,7 +29,6 @@ import codechicken.nei.drawable.DrawableResource;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.scroll.GuiHelper;
import codechicken.nei.util.ReadableNumberConverter;
class CraftingTreeCanvas {
@@ -409,12 +408,7 @@ class CraftingTreeCanvas {
}
protected void drawStackSize(ItemTreeSlot node, long stackSize, int x, int y, boolean resolved) {
String amountString = stackSize < 10_000 ? String.valueOf(stackSize)
: ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize);
if (node.isFluidDisplay) {
amountString += "L";
}
String amountString = NEIClientUtils.formatSlotAmount(stackSize, node.isFluidDisplay);
final boolean hasOutputChance = node.prefItem != null && node.prefItem.chance != PositionedStack.CHANCE_FULL;
int color = 0xFFFFFF;
@@ -143,12 +143,7 @@ class StatsPanel extends ScrollContainer {
}
private void drawStackSize() {
String amountString = stackSize < 10_000 ? String.valueOf(stackSize)
: ReadableNumberConverter.INSTANCE.toWideReadableForm(stackSize);
if (this.isFluidDisplay) {
amountString += "L";
}
final String amountString = NEIClientUtils.formatSlotAmount(stackSize, this.isFluidDisplay);
NEIClientUtils.drawNEIOverlayText(
amountString,
@@ -3,15 +3,25 @@ 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;
@@ -40,8 +50,16 @@ public class TreeOverlayButton extends GuiRecipeButton {
}
@Override
protected DrawableResource getIcon() {
return UIRecipeTexture.ICON_OVERLAY_FILL;
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);
}
@Override
@@ -109,8 +109,6 @@ 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);
@@ -1,57 +0,0 @@
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 implements Drawable {
public class DrawableResource extends Image {
private final ResourceLocation resourceLocation;
private final int textureWidth;
@@ -9,8 +9,8 @@ import net.minecraftforge.fluids.FluidRegistry;
import org.lwjgl.opengl.GL11;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.item.FluidDrawer.FillDirection;
import codechicken.nei.util.ReadableNumberConverter;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -48,14 +48,7 @@ public class FluidDisplayRenderer implements IItemRenderer {
return;
}
String amountString = "";
if (amount < 10_000) {
amountString = String.valueOf(amount) + "L";
} else {
amountString = ReadableNumberConverter.INSTANCE.toWideReadableForm(amount) + "L";
}
final String amountString = NEIClientUtils.formatSlotAmount(amount, true);
final FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer;
float smallTextScale = fontRender.getUnicodeFlag() ? 3F / 4F : 1F / 2F;
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
@@ -11,6 +11,8 @@ 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;
@@ -22,18 +24,28 @@ 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 = UIRecipeTexture.ICON_FAVORITE_OFF;
protected static final DrawableResource ICON_STATE_ON = UIRecipeTexture.ICON_FAVORITE_ON;
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 final Recipe recipe;
protected boolean favorite = false;
@@ -82,13 +94,17 @@ public class GuiFavoriteButton extends GuiRecipeButton {
}
@Override
protected DrawableResource getIcon() {
return isFavorite() ? ICON_STATE_ON : ICON_STATE_OFF;
}
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;
@Override
protected void drawContent(Minecraft minecraft, int mouseX, int mouseY, boolean mouseOver) {
super.drawContent(minecraft, mouseX, mouseY, mouseOver);
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);
if (!mouseOver) {
this.selectedResult = null;
@@ -5,10 +5,13 @@ 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;
@@ -20,14 +23,20 @@ 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 = UIRecipeTexture.ITEM_MISSING;
protected static DrawableResource present = UIRecipeTexture.ITEM_PRESENT;
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();
public enum ItemOverlayFormat {
@@ -78,9 +87,24 @@ public class GuiOverlayButton extends GuiRecipeButton {
}
}
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 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 int BUTTON_ID_SHIFT = 4;
public final GuiContainer firstGui;
@@ -193,12 +217,22 @@ public class GuiOverlayButton extends GuiRecipeButton {
}
@Override
protected DrawableResource getIcon() {
protected void drawContent(Minecraft minecraft, int y, int x, boolean mouseOver) {
DrawableResource icon = ICON_OVERLAY;
if (this.canFillCraftingGrid && (!requireShiftForOverlayRecipe() || NEIClientUtils.shiftKey())) {
return this.missedMaterialsTooltipLineHandler == null ? ICON_FILL : ICON_FILL_ERROR;
icon = this.missedMaterialsTooltipLineHandler == null ? ICON_FILL : ICON_FILL_ERROR;
}
return ICON_OVERLAY;
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);
}
@Override
File diff suppressed because it is too large. Load diff
@@ -13,10 +13,11 @@ 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 {
@@ -50,11 +51,26 @@ public class GuiRecipeCatalyst extends ScrollContainer {
private static final int SLOT_SIZE = 16;
private static final int BORDER_PADDING = 6;
private static final int COLUMNS_BOTTOM_INSET = 5;
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 ScrollBar VERTICAL_SCROLLBAR = UIWidgetTexture.verticalScrollBar()
.setOverflowType(ScrollBar.OverflowType.AUTO)
.setTrackPadding(0, BORDER_PADDING - 1, -13, BORDER_PADDING - 1)
.setOverflowType(ScrollBar.OverflowType.AUTO).setTrackPadding(0, BORDER_PADDING, -13, BORDER_PADDING)
.setScrollPlace(ScrollBar.ScrollPlace.START);
private List<PositionedStack> items = Collections.emptyList();
@@ -63,7 +79,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
private int style = -1;
public GuiRecipeCatalyst() {
setPaddingBlock(BORDER_PADDING, BORDER_PADDING);
setPaddingBlock(BORDER_PADDING + 1, BORDER_PADDING + 1);
}
public void setCatalysts(List<PositionedStack> items) {
@@ -82,15 +98,13 @@ public class GuiRecipeCatalyst extends ScrollContainer {
return this.availableHeight;
}
@Override
public boolean isVisible() {
return this.showWidget && NEIClientConfig.getJEIStyleRecipeCatalysts() != 0;
public boolean isShowWidget() {
return this.showWidget;
}
public int getColumnCount() {
if (NEIClientConfig.getJEIStyleRecipeCatalysts() == 1) {
final int maxItemsPerColumn = Math
.max(0, this.availableHeight - COLUMNS_BOTTOM_INSET - 2 - BORDER_PADDING * 2) / SLOT_SIZE;
final int maxItemsPerColumn = Math.max(0, this.availableHeight - 2 - BORDER_PADDING * 2) / SLOT_SIZE;
return maxItemsPerColumn > 0 ? NEIServerUtils.divideCeil(this.items.size(), maxItemsPerColumn) : 0;
}
return 1;
@@ -106,7 +120,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
final int rows = getRowCount();
setVerticalScroll(null);
setPaddingInline(BORDER_PADDING, BORDER_PADDING - 3);
setPaddingInline(BORDER_PADDING + 1, BORDER_PADDING - 3);
this.style = NEIClientConfig.getJEIStyleRecipeCatalysts();
this.h = rows * SLOT_SIZE + this.paddingBlockStart + this.paddingBlockEnd;
@@ -118,7 +132,7 @@ public class GuiRecipeCatalyst extends ScrollContainer {
this.w += VERTICAL_SCROLLBAR.getTrackWidth();
setVerticalScroll(VERTICAL_SCROLLBAR);
setPaddingInline(this.paddingInlineStart + VERTICAL_SCROLLBAR.getTrackWidth(), this.paddingInlineEnd);
setPaddingInline(BORDER_PADDING + 1 + VERTICAL_SCROLLBAR.getTrackWidth(), this.paddingInlineEnd);
}
this.showWidget = rows * columns > 0;
@@ -148,14 +162,12 @@ public class GuiRecipeCatalyst extends ScrollContainer {
if (!this.showWidget) return;
GL11.glColor4f(1, 1, 1, 1);
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(
BG_TEXTURE.draw(
this.x - TRANSPARENCY_BORDER,
this.y - TRANSPARENCY_BORDER,
this.w + TRANSPARENCY_BORDER * 2,
this.h + TRANSPARENCY_BORDER * 2);
FG_TEXTURE.draw(
this.x + this.paddingInlineStart - 1,
this.y + this.paddingBlockStart - 1,
this.w - this.paddingInlineStart - this.paddingInlineEnd + 2,
@@ -10,6 +10,7 @@ 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;
@@ -25,11 +26,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 {
@@ -43,14 +44,29 @@ 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 = UIRecipeTexture.TAB_UNSELECTED.getWidth();
this.h = UIRecipeTexture.TAB_UNSELECTED.getHeight();
this.w = TAB_WIDTH;
this.h = TAB_HEIGHT;
this.handler = handler;
this.handlerName = handler.getHandlerId();
this.selected = false;
@@ -68,20 +84,21 @@ public abstract class GuiRecipeTab extends Widget {
drawForeground(mouseX, mouseY);
}
private void drawBackground(int mouseX, int mouseY) {
final DrawableResource image = this.selected ? UIRecipeTexture.TAB_SELECTED : UIRecipeTexture.TAB_UNSELECTED;
public void drawBackground(int mouseX, int mouseY) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glColor4f(1, 1, 1, 1);
image.draw(this.x, this.y, this.w, this.h);
final DrawableResource image = this.selected ? selectedTabImage : unselectedTabImage;
image.draw(this.x, this.y);
}
private void drawForeground(int mouseX, int mouseY) {
public void drawForeground(int mouseX, int mouseY) {
final int iconX = this.x + 4;
final int iconY = this.y + 4;
final FontRenderer fontRenderer = GuiDraw.fontRenderer;
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);
@@ -94,17 +111,24 @@ 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 != null && text.length() > 0) {
if (text.length() > 2) {
text = text.substring(0, 2);
}
} else {
text = "??";
} else if (text.length() > 2) {
text = text.substring(0, 2);
}
GuiDraw.drawStringC(text, iconX + 8, iconY + 4, color);
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);
GL11.glColor4f(1, 1, 1, 1);
}
}
@@ -2,23 +2,19 @@ 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.drawable.DrawableResource;
import codechicken.nei.theme.UIRecipeTexture;
import codechicken.nei.theme.UIWidgetTexture;
import codechicken.nei.NEIClientUtils;
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 = Collections.emptyList();
private List<? extends IRecipeHandler> currenthandlers;
private int pageCount = 1;
private int pageNumber = 0;
@@ -26,78 +22,56 @@ public class GuiRecipeTabs {
private int numHandlers = 1;
private int recipetype;
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;
}
private final Button prevTab = new Button("<") {
@Override
public boolean onButtonPress(boolean rightClick) {
return !rightClick && this.action.getAsBoolean();
if (!rightClick) {
NEIClientUtils.playClickSound();
return previousPage();
} else return false;
}
};
private final Button nextTab = new Button(">") {
@Override
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));
public boolean onButtonPress(boolean rightclick) {
if (!rightclick) {
NEIClientUtils.playClickSound();
return nextPage();
} else return false;
}
}
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 UIRecipeTexture.TAB_UNSELECTED.getWidth() - 1;
return GuiRecipeTab.TAB_WIDTH;
}
public static int getTabHeight() {
return UIRecipeTexture.TAB_UNSELECTED.getHeight();
return GuiRecipeTab.TAB_HEIGHT;
}
public void place(int navLeft, int navWidth, int guiTop) {
public void update(GuiRecipe<?> guiRecipe) {
final int tabWidth = getTabWidth();
final int tabHeight = getTabHeight();
final int perPage = (navWidth - 4) / tabWidth;
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.recipetype = guiRecipe.recipetype;
this.currenthandlers = guiRecipe.currenthandlers;
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();
refreshArrows();
updateArrows(tabHeight);
}
public void refreshPage() {
@@ -123,10 +97,17 @@ public class GuiRecipeTabs {
}
}
private void refreshArrows() {
private void updateArrows(int tabHeight) {
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);
}
@@ -163,17 +144,14 @@ public class GuiRecipeTabs {
public void handleTooltip(int mousex, int mousey, List<String> tooltips) {
if (!NEIClientConfig.areJEIStyleTabsVisible()) return;
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;
}
}
for (Button button : this.buttons) {
if (button.contains(mousex, mousey)) {
button.addTooltips(tooltips);
}
}
}
@@ -183,7 +161,7 @@ public class GuiRecipeTabs {
for (Button button : this.buttons) {
if (button.contains(x, y)) {
return button.handleClick(x, y, mouseButton);
return button.onButtonPress(mouseButton == 1);
}
}
@@ -36,9 +36,6 @@ 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;
@@ -192,22 +189,6 @@ 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;
@@ -315,16 +296,6 @@ 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,10 +45,6 @@ public interface IRecipeHandler {
return getRecipeName();
}
default int getRecipeWidth(int recipe) {
return 0;
}
default int getRecipeHeight(int recipe) {
return 0;
}
@@ -1,170 +0,0 @@
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, GuiRecipe.getRecipeListFilter()).getFilteredRecipes();
return new SearchRecipeHandler<>(handler).getFilteredRecipes();
}
private void writeFile(File file, List<? extends IRecipeHandler> handlers,
@@ -11,100 +11,60 @@ 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 int numRecipes = -1;
private int searchVersion = -1;
private int visibleHeight = -1;
private String cacheKey = "";
private int currentPageIndex = -1;
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;
private List<List<Widget>> pageWidgets = new ArrayList<>();
public RecipePageManager(SearchRecipeHandler<?> handler, HandlerInfo handlerInfo, ScrollContainer container,
ViewStates viewStates) {
public RecipePageManager(SearchRecipeHandler<?> handler, HandlerInfo handlerInfo, ScrollContainer container) {
this.handler = handler;
this.handlerInfo = handlerInfo;
this.container = container;
this.viewStates = viewStates;
this.recipeGap = handlerInfo.isRecipeSpacing() ? RECIPE_GAP : 0;
rebuildWidgets();
rebuildPages();
}
public boolean rebuildPages() {
final boolean widgetsChanged = this.numRecipes != getNumRecipes()
|| this.searchVersion != this.handler.getSearchVersion();
final int visibleHeight = this.container.getVisibleHeight();
final String cacheKey = handlerInfo.getHandlerName() + ":"
+ getNumRecipes()
+ ":"
+ this.container.getVisibleHeight()
+ ":"
+ GuiRecipe.searchField.text();
if (!widgetsChanged && visibleHeight == this.visibleHeight) {
if (cacheKey.equals(this.cacheKey)) {
return false;
}
this.visibleHeight = visibleHeight;
this.cacheKey = cacheKey;
if (widgetsChanged) {
rebuildWidgets();
}
final List<RecipeWidget> pausedWidgets = getPausedWidgets();
this.pageWidgets.clear();
this.pages.clear();
this.overflowY = false;
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");
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 int heightAvailable = this.container.getVisibleHeight();
final int width = Math.max(166, this.handlerInfo.getWidth());
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 recipeIndex : searchRecipes) {
for (int i = 0; i < numRecipes; i++) {
final int recipeIndex = searchRecipes.get(i);
final Object groupId = this.handler.original.getRecipeGroupId(recipeIndex);
final int groupIndex = groupId != null
? groupEndIndices.computeIfAbsent(groupId, k -> groupedRecipes.size())
@@ -117,121 +77,42 @@ public class RecipePageManager {
groupedRecipes.get(groupIndex).add(recipeIndex);
}
return groupedRecipes;
}
for (int groupIndex = 0; groupIndex < groupedRecipes.size(); groupIndex++) {
final RecipeWidget widget = new RecipeWidget(this.handler.original, groupedRecipes.get(groupIndex));
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;
// keep the pause of the rebuilt widgets
for (RecipeWidget paused : pausedWidgets) {
final int pausedIndex = paused.getRecipeHandlerRef().recipeIndex;
for (RecipeWidget widget : this.recipeWidgets) {
if (this.handlerInfo.isAllowOverflowY()) {
widget.setHeight(Math.min(widget.getContentHeight(), heightAvailable));
if (widget.containsRecipeIndex(pausedIndex)) {
widget.pinRecipe(pausedIndex, paused.getPinnedIngredients());
}
}
if (!widgets.isEmpty() && (!multipleWidgetsAllowed
|| !infiniteScroll && shiftY + this.recipeGap + widget.h > heightAvailable)) {
addPage(widgets);
widget.w = width;
if (allowOverflowY) {
widget.h = Math.min(handlerHeight, heightAvailable);
}
if (!widgets.isEmpty()
&& (!multipleWidgetsAllowed || !infiniteScroll && shiftY + widget.h > heightAvailable)) {
this.pageWidgets.add(widgets);
widgets = new ArrayList<>();
shiftY = 0;
}
if (!widgets.isEmpty()) {
shiftY += this.recipeGap;
}
widgets.add(widget);
shiftY += widget.h;
}
if (!widgets.isEmpty()) {
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;
this.pageWidgets.add(widgets);
}
final int heightAvailable = this.container.getVisibleHeight();
int maxHeight = 0;
changePage(0);
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");
return true;
}
public boolean isMultipleWidgetsAllowed() {
@@ -247,16 +128,7 @@ public class RecipePageManager {
}
public int getNumPages() {
return this.pages.size();
}
public int getMaxRecipeWidth() {
return this.maxRecipeWidth;
}
public int getCurrentPageWidth() {
final Page page = getCurrentPage();
return page != null ? page.width : 0;
return this.pageWidgets.size();
}
public void changePage(int delta) {
@@ -273,8 +145,8 @@ public class RecipePageManager {
public boolean gotoRecipeIndex(int recipeIndex) {
for (int page = 0; page < this.pages.size(); page++) {
for (Widget widget : this.pages.get(page).widgets) {
for (int page = 0; page < this.pageWidgets.size(); page++) {
for (Widget widget : this.pageWidgets.get(page)) {
if (widget instanceof RecipeWidget recipeWidget && recipeWidget.containsRecipeIndex(recipeIndex)) {
changePage(page - this.currentPageIndex);
return true;
@@ -285,10 +157,24 @@ 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 (Page page : this.pages) {
for (Widget widget : page.widgets) {
for (List<Widget> widgets : this.pageWidgets) {
for (Widget widget : widgets) {
if (widget instanceof RecipeWidget recipeWidget && recipeWidget.containsRecipeIndex(recipeIndex)) {
return recipeWidget.pinRecipe(recipeIndex, ingredients);
}
@@ -299,35 +185,32 @@ public class RecipePageManager {
}
public List<Widget> getCurrentPageWidgets() {
if (this.pages.isEmpty()) {
if (this.pageWidgets.isEmpty()) {
return Collections.emptyList();
}
final Page page = this.pages.get(this.currentPageIndex);
final int placeWidth = Math.max(this.container.w, page.width);
int shiftY = page.top;
List<Widget> currentWidgets = this.pageWidgets.get(this.currentPageIndex);
int shiftY = 0;
for (Widget widget : page.widgets) {
for (Widget widget : currentWidgets) {
if (widget instanceof RecipeWidget recipeWidget) {
final int offsetX = (placeWidth - widget.w) / 2;
recipeWidget.setLocation(offsetX, shiftY, placeWidth - widget.w - offsetX);
recipeWidget.setLocation(2, shiftY);
}
shiftY += widget.h + page.gap;
shiftY += widget.h;
}
return page.widgets;
return currentWidgets;
}
public List<Integer> getRecipeIndices() {
if (this.pages.isEmpty()) {
if (this.pageWidgets.isEmpty()) {
return Collections.emptyList();
}
final List<Integer> recipeIndices = new ArrayList<>();
for (Widget widget : this.pages.get(this.currentPageIndex).widgets) {
for (Widget widget : this.pageWidgets.get(this.currentPageIndex)) {
if (widget instanceof RecipeWidget recipeWidget) {
recipeIndices.add(recipeWidget.getRecipeHandlerRef().recipeIndex);
}
@@ -1,327 +0,0 @@
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,17 +8,30 @@ import org.lwjgl.opengl.GL11;
import codechicken.lib.gui.GuiDraw;
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
import codechicken.nei.ColorUtils;
import codechicken.nei.drawable.DrawableBuilder;
import codechicken.nei.drawable.DrawableResource;
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 = "";
@@ -67,16 +80,12 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
}
if (this.widget != null) {
return new Dimension(getContentWidth() + BG_PADDING * 2, this.widget.h + BG_PADDING * 2 + 12);
return new Dimension(this.widget.w + 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;
@@ -97,24 +106,25 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
GuiContainerManager.enable2DRender();
GL11.glColor4f(1, 1, 1, 1);
UIRecipeTexture.WIDGET.draw(0, 0, size.width, size.height);
BG_TEXTURE.draw(
-TRANSPARENCY_BORDER,
-TRANSPARENCY_BORDER,
size.width + TRANSPARENCY_BORDER * 2,
size.height + TRANSPARENCY_BORDER * 2);
GL11.glEnable(GL11.GL_ALPHA_TEST);
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);
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);
if (this.multiplier > 0) {
GuiDraw.drawString(
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.multiplier),
BG_PADDING + 2,
BG_PADDING + 2,
titleColor);
0xffffff);
}
this.widget.x = BG_PADDING + (getContentWidth() - this.widget.w) / 2;
GuiHelper.useScissor(
this.widget.x,
this.widget.y,
@@ -3,7 +3,6 @@ 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;
@@ -19,19 +18,18 @@ class SearchRecipeHandler<H extends IRecipeHandler> {
private List<Integer> filteredRecipes;
private volatile List<Integer> searchRecipes;
private List<Integer> searchRecipes;
private volatile int searchVersion;
public SearchRecipeHandler(H handler, IRecipeFilter filter) {
public SearchRecipeHandler(H handler) {
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 || !this.searchingAvailable()) {
if (filter == null) {
this.filteredRecipes = items.collect(Collectors.toList());
} else {
this.filteredRecipes = items.filter(recipe -> mathRecipe(this.original, recipe, filter))
@@ -66,43 +64,39 @@ class SearchRecipeHandler<H extends IRecipeHandler> {
public List<Integer> getSearchResult(IRecipeFilter filter) {
if (this.filteredRecipes.isEmpty() || !this.searchingAvailable()) {
if (filteredRecipes.isEmpty() || !this.searchingAvailable()) {
return null;
}
final List<Integer> positions = IntStream.range(0, this.filteredRecipes.size()).boxed()
.collect(Collectors.toList());
List<Integer> filtered = null;
final List<Integer> recipes = IntStream.range(0, filteredRecipes.size()).boxed().collect(Collectors.toList());
try {
return ItemList.forkJoinPool.submit(
() -> positions.parallelStream()
.filter(position -> mathRecipe(this.original, this.filteredRecipes.get(position), filter))
filtered = ItemList.forkJoinPool.submit(
() -> recipes.parallelStream()
.filter(recipe -> mathRecipe(this.original, filteredRecipes.get(recipe), filter))
.collect(Collectors.toList()))
.get();
filtered.sort((a, b) -> a - b);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
return null;
return filtered;
}
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 (search == null) {
if (this.searchRecipes == null) {
return this.filteredRecipes;
}
final List<Integer> search = this.searchRecipes;
final List<Integer> resolved = new ArrayList<>(search.size());
for (int idx : search) {
@@ -113,18 +107,21 @@ class SearchRecipeHandler<H extends IRecipeHandler> {
}
public int ref(int index) {
final List<Integer> search = this.searchRecipes;
if (search != null) {
index = search.get(index);
if (searchRecipes != null) {
index = searchRecipes.get(index);
}
return this.filteredRecipes.get(index);
return filteredRecipes.get(index);
}
public int numRecipes() {
final List<Integer> search = this.searchRecipes;
return search != null ? search.size() : this.filteredRecipes.size();
if (searchRecipes != null) {
return searchRecipes.size();
}
return filteredRecipes.size();
}
}
@@ -64,8 +64,6 @@ 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;
@@ -82,8 +80,6 @@ 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();
}
@@ -96,8 +92,6 @@ 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);
}
@@ -114,8 +108,6 @@ 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();
}
@@ -133,9 +125,7 @@ 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.windowWidth),
String.valueOf(this.recipeSpacing ? 1 : 0));
String.valueOf(this.showBadge ? 1 : 0));
}
public boolean isUnmodified() {
@@ -158,7 +148,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,WindowWidth,RecipeSpacing";
private static final String HEADER = "HandlerId,YShift,Height,Width,MultiWidgets,Order,AllowOverflowX,AllowOverflowY,ShowFavorites,ShowOverlay,ShowBadge";
private final int[] COLORS = new int[] { 0x2200FF00, 0x22FF0000, 0x220000FF, 0x2200FFFF, 0x22FF00FF, 0x22FFFF00 };
public static DebugHandlerWidget instance = new DebugHandlerWidget();
@@ -227,11 +217,6 @@ 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;
@@ -247,12 +232,7 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
y = addTextFieldWidget("Width", HandlerInfo.DEFAULT_WIDTH, (field, oldText) -> {
record.width = field.getInteger();
saveHandlerInfoPatch();
}, newValue -> newValue > 0, y);
y = addTextFieldWidget("WindowWidth", 0, (field, oldText) -> {
record.windowWidth = field.getInteger();
saveHandlerInfoPatch();
}, newValue -> newValue >= 0, y);
}, newValue -> newValue >= HandlerInfo.DEFAULT_WIDTH, y);
y = addCheckboxWidget("AllowOverflowX", button -> {
record.allowOverflowX = button.value;
@@ -494,8 +474,6 @@ 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));
@@ -767,8 +745,7 @@ public class DebugHandlerWidget extends Widget implements IContainerTooltipHandl
ClientHandler.loadSettingsFile("handlers.patch", lines -> {
final List<String> linesList = lines.collect(Collectors.toCollection(ArrayList::new));
// 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))) {
if (linesList.isEmpty() || !HEADER.equals(linesList.get(0))) {
return;
}
@@ -782,7 +759,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,null,null"));
record.apply((line + ",null,null,null,null,null,null,null,null,null,null"));
}
});
@@ -29,6 +29,7 @@ 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;
@@ -43,41 +44,39 @@ 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 = UIRecipeTexture.ICON_PAUSE;
protected static final DrawableResource PAUSE_MARKER = new DrawableBuilder(
"nei:textures/pinned_pause.png",
0,
0,
8,
8).setTextureSize(8, 8).build();
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) {
@@ -85,24 +84,14 @@ public class RecipeWidget extends Widget {
}
public RecipeWidget(IRecipeHandler handler, List<Integer> recipeIndices) {
this(handler, recipeIndices, null);
}
public RecipeWidget(IRecipeHandler handler, List<Integer> recipeIndices, ViewState state) {
this(new RecipeGroup(handler, recipeIndices), state);
this(new RecipeGroup(handler, recipeIndices));
}
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() {
@@ -117,81 +106,33 @@ 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, int spaceRight) {
public void setLocation(int x, int y) {
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.state.pinnedIngredients;
return this.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.state.pinnedIngredients = null;
this.pinnedIngredients = null;
this.pinnedSlots = Collections.emptyMap();
if (wasPaused) {
@@ -219,10 +160,9 @@ public class RecipeWidget extends Widget {
return false;
}
this.state.pinnedIngredients = ingredients;
this.pinnedIngredients = ingredients;
this.pinnedSlots = slots;
this.paused = true;
this.state.pausedRecipeIndex = recipeIndex;
setActiveMember(member);
updatePermutations();
@@ -279,39 +219,25 @@ 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()) {
this.h = getContentHeight();
}
int maxHeight = 0;
if (this.w != prevW || this.h != prevH) {
relayoutButtons();
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();
}
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);
}
@@ -326,55 +252,8 @@ public class RecipeWidget extends Widget {
return Collections.emptyList();
}
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;
}
return Collections
.unmodifiableList(initButtons(RecipeHandlerRef.of(this.handler, this.group.getRecipeIndex(member))));
}
private List<GuiRecipeButton> initButtons(RecipeHandlerRef ref) {
@@ -410,17 +289,22 @@ 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 (this.handlerInfo.getShowOverlayButton()) {
buttons.add(new GuiOverlayButton(guiContainer, ref, 0, 0));
if (showOverlay) {
buttons.add(new GuiOverlayButton(guiContainer, ref, x, y));
y -= GuiRecipeButton.BUTTON_HEIGHT + 1;
}
if (showFavoritesButton()) {
buttons.add(new GuiFavoriteButton(ref, 0, 0));
if (showFavorites) {
buttons.add(new GuiFavoriteButton(ref, x, y));
}
return buttons;
@@ -434,10 +318,10 @@ public class RecipeWidget extends Widget {
this.update = false;
if (this.lastcycle == -1) {
this.lastcycle = this.state.cycleticks / TICKS_PER_CYCLE;
this.lastcycle = 0;
applyCycle();
} else if (tickCycle() && !isCycleFrozen(mouseX, mouseY)) {
this.state.cycle++;
this.cycle++;
applyCycle();
} else if (this.favoriteRevision != FavoriteRecipes.getRevision()) {
this.favoriteRevision = FavoriteRecipes.getRevision();
@@ -849,8 +733,8 @@ public class RecipeWidget extends Widget {
private boolean tickCycle() {
if ((this.state.cycleticks++ / TICKS_PER_CYCLE) != this.lastcycle) {
this.lastcycle = this.state.cycleticks / TICKS_PER_CYCLE;
if ((this.cycleticks++ / TICKS_PER_CYCLE) != this.lastcycle) {
this.lastcycle = this.cycleticks / TICKS_PER_CYCLE;
return true;
}
@@ -865,14 +749,15 @@ public class RecipeWidget extends Widget {
return NEIClientConfig.freezeCycleOnHover() && !this.showAsWidget
&& contains(mouseX, mouseY)
&& (getPositionedStackMouseOver(mouseX, mouseY) != null || isOverButton(mouseX, mouseY));
&& (getPositionedStackMouseOver(mouseX, mouseY) != null
|| forEachButtons(button -> button.contains(mouseX, mouseY) ? true : null, false));
}
private void applyCycle() {
if (!this.paused) {
final List<Integer> allowed = this.group.getAllowedMembers();
setActiveMember(allowed.get(this.state.cycle % allowed.size()));
setActiveMember(allowed.get(this.cycle % allowed.size()));
}
this.group.refresh(this.activeMember);
@@ -880,7 +765,7 @@ public class RecipeWidget extends Widget {
}
private int getPermutationIndex() {
return this.state.cycle / this.group.getAllowedMembers().size();
return this.cycle / this.group.getAllowedMembers().size();
}
// keep the permutation index, move the member part of the counter to the active member
@@ -889,7 +774,7 @@ public class RecipeWidget extends Widget {
final int allowedIndex = allowed.indexOf(this.activeMember);
if (allowedIndex >= 0) {
this.state.cycle = this.state.cycle / allowed.size() * allowed.size() + allowedIndex;
this.cycle = this.cycle / allowed.size() * allowed.size() + allowedIndex;
}
}
@@ -938,7 +823,6 @@ public class RecipeWidget extends Widget {
}
}
this.state.recipeIndex = this.group.getRecipeIndex(member);
}
private boolean containsStack(PositionedStack pStack, ItemStack stack) {
@@ -1,17 +0,0 @@
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;
}
@@ -1,22 +0,0 @@
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,7 +3,6 @@ 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;
@@ -81,16 +80,6 @@ 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() {
@@ -1,47 +0,0 @@
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,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.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.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,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.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.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,,,,,,,,,,,,
1 handler modName itemName nbtInfo modId modRequired excludedModId yShift handlerHeight handlerWidth maxRecipesPerPage imageResource imageX imageY imageWidth imageHeight itemNotes useCustomScroll
346 de.katzenpapst.amunra.nei.recipehandler.ARCircuitFab Pra's Galacticraft Mod GalacticraftCore:tile.machine2:4 GalacticraftAmunRa TRUE
347 de.katzenpapst.amunra.nei.recipehandler.ARNasaWorkbenchShuttle Pra's Galacticraft Mod GalacticraftAmunRa:item.itemShuttle GalacticraftAmunRa TRUE 130 168 16
348 vazkii.botania.client.integration.nei.recipe.RecipeHandlerFloatingFlowers Botania Botania:miniIsland Botania TRUE 5
349 vazkii.botania.client.integration.nei.recipe.RecipeHandlerPetalApothecary Botania Botania:altar Botania TRUE 102 166 137 4
350 vazkii.botania.client.integration.nei.recipe.RecipeHandlerRunicAltar Botania Botania:runeAltar Botania TRUE 122 166 137 4
351 vazkii.botania.client.integration.nei.recipe.RecipeHandlerManaPool Botania Botania:pool Botania TRUE 90 166 137 4
352 vazkii.botania.client.integration.nei.recipe.RecipeHandlerElvenTrade Botania Botania:alfheimPortal Botania TRUE 90 166 130 4
353 vazkii.botania.client.integration.nei.recipe.RecipeHandlerBrewery Botania Botania:brewery Botania TRUE 4
354 vazkii.botania.client.integration.nei.recipe.RecipeHandlerPureDaisy Botania Botania:specialFlower {type:puredaisy} Botania TRUE 4
355 vazkii.botania.client.integration.nei.recipe.RecipeHandlerLexicaBotania Botania Botania:lexicon Botania TRUE
523 de.ellpeck.actuallyadditions.mod.nei.NEIReconstructorRecipe Actually Additions ActuallyAdditions:blockAtomicReconstructor ActuallyAdditions TRUE
524 de.ellpeck.actuallyadditions.mod.nei.NEITreasureChestRecipe Actually Additions ActuallyAdditions:blockTreasureChest ActuallyAdditions TRUE
525 vazkii.botania.client.integration.nei.RecipeHandlerFloatingFlowers Botania Botania:miniIsland Botania TRUE 5
526 vazkii.botania.client.integration.nei.RecipeHandlerPetalApothecary Botania Botania:altar Botania TRUE 102 166 137 4
527 vazkii.botania.client.integration.nei.RecipeHandlerRunicAltar Botania Botania:runeAltar Botania TRUE 122 166 137 4
528 vazkii.botania.client.integration.nei.RecipeHandlerManaPool Botania Botania:pool Botania TRUE 90 166 137 4
529 vazkii.botania.client.integration.nei.RecipeHandlerElvenTrade Botania Botania:alfheimPortal Botania TRUE 90 166 130 4
530 vazkii.botania.client.integration.nei.RecipeHandlerBrewery Botania Botania:brewery Botania TRUE 4
531 vazkii.botania.client.integration.nei.RecipeHandlerPureDaisy Botania Botania:specialFlower {type:puredaisy} Botania TRUE 4
532 vazkii.botania.client.integration.nei.RecipeHandlerLexicaBotania Botania Botania:lexicon Botania TRUE
@@ -343,9 +343,6 @@ 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
@@ -363,8 +360,6 @@ 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
@@ -635,8 +630,6 @@ 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,8 +213,6 @@ 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=Нет
@@ -259,9 +257,6 @@ 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=Режим рецептов
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B