mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-18 19:39:06 +00:00
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d4f912ea0 | ||
|
|
483ecb58c2 | ||
|
|
f1823ca676 | ||
|
|
37dd696fc3 | ||
|
|
997b1562e5 | ||
|
|
75ab04ca2f | ||
|
|
7a0b26dd4c | ||
|
|
8ce6a65721 | ||
|
|
eb6a7d3e16 | ||
|
|
a10f2d9052 | ||
|
|
3e727629b4 | ||
|
|
fb952aba15 | ||
|
|
619c152cd2 | ||
|
|
f5e9388cb2 | ||
|
|
534056e8b2 | ||
|
|
99c33a728d | ||
|
|
8a6bbb24fc | ||
|
|
900d8ed828 |
No files matched your search
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.44'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,22 +18,20 @@ public SearchExpressionLexer(CharStream input, SearchTokenParser searchParser) {
|
||||
// Lexer rules
|
||||
REGEX_LEFT : 'r'? '/' -> pushMode(REGEX) ;
|
||||
QUOTE_LEFT : '"' -> pushMode(QUOTED) ;
|
||||
|
||||
DASH : '-' ;
|
||||
|
||||
RECIPE_INGREDIENTS : '<&' | '<' ;
|
||||
RECIPE_RESULT : '>&' | '>' ;
|
||||
RECIPE_OTHERS : '^&' | '^' ;
|
||||
|
||||
PREFIX : CLEAN_SYMBOL {searchParser.hasRedefinedPrefix(getText().charAt(0))}? ;
|
||||
OR : '|' ;
|
||||
LEFT_BRACKET : '{' ;
|
||||
RIGHT_BRACKET : '}' ;
|
||||
PLAIN_TEXT : (CLEAN_SYMBOL | ESCAPED_SYMBOL)+ {!searchParser.hasRedefinedPrefix(getText().charAt(0))}? ;
|
||||
NEWLINE_OR_TAB : [\t\r\n] -> skip ;
|
||||
SPACE : ' ' ;
|
||||
ESCAPED_SYMBOL : '\\' . ;
|
||||
|
||||
PREFIX : CLEAN_SYMBOL {searchParser.hasRedefinedPrefix(getText().charAt(0))}? ;
|
||||
CLEAN_SYMBOL : ~[-<>^{}|/\\ "] ;
|
||||
fragment ESCAPED_SYMBOL : '\\' . ;
|
||||
fragment CLEAN_SYMBOL : ~[-<>^{}|/\\ "] ;
|
||||
|
||||
mode REGEX;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ prefixedExpression
|
||||
token[Character prefix]
|
||||
: regex[prefix]
|
||||
| quoted[prefix]
|
||||
| plainText
|
||||
| PLAIN_TEXT
|
||||
;
|
||||
|
||||
regex[Character prefix]
|
||||
@@ -67,7 +67,4 @@ quoted[Character prefix]
|
||||
: QUOTE_LEFT QUOTED_CONTENT QUOTE_RIGHT?
|
||||
;
|
||||
|
||||
plainText
|
||||
: (CLEAN_SYMBOL | ESCAPED_SYMBOL)+
|
||||
;
|
||||
|
||||
@@ -185,24 +185,22 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
|
||||
&& this.grid.existsRecipe(recipeId, BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(itemStack);
|
||||
long factor = nbTag.getInteger("Count");
|
||||
long count = factor;
|
||||
|
||||
if (existsRecipe) {
|
||||
|
||||
for (int i = 0; i < this.grid.size(); i++) {
|
||||
if (this.grid.getBookmarkItem(i).equalsRecipe(recipeId, groupId)) {
|
||||
count *= this.grid.getBookmarkItem(i).getMultiplier();
|
||||
final long multiplier = this.grid.getBookmarkItem(i).getMultiplier();
|
||||
factor *= multiplier;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (factor == 0) {
|
||||
} else {
|
||||
factor = nbTag.hasKey("gtFluidName") ? Math.min(144, nbTag.getInteger("Count")) : 1;
|
||||
}
|
||||
|
||||
this.grid.addItem(
|
||||
BookmarkItem.of(groupId, StackInfo.withAmount(itemStack, count), factor, recipeId, false),
|
||||
true);
|
||||
this.grid.addItem(BookmarkItem.of(groupId, itemStack, factor, recipeId, false), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiErrorScreen;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiSelectWorld;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -154,7 +153,6 @@ public class ClientHandler {
|
||||
loadHiddenHandlers();
|
||||
loadEnableAutoFocus();
|
||||
loadGuiCraftablesBlacklist();
|
||||
loadDefaultBookmarkContainers();
|
||||
ItemInfo.preInit();
|
||||
StackInfo.loadGuidFilters();
|
||||
}
|
||||
@@ -255,20 +253,6 @@ public class ClientHandler {
|
||||
lines -> ItemCraftablesPanel.guiBlacklist = lines.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public static void loadDefaultBookmarkContainers() {
|
||||
loadSettingsFile("defaultbookmarkcontainers.cfg", lines -> {
|
||||
for (String clazz : lines.collect(Collectors.toList())) {
|
||||
try {
|
||||
API.registerBookmarkContainerHandler(
|
||||
(Class<? extends GuiContainer>) Class.forName(clazz),
|
||||
new DefaultBookmarkContainerHandler());
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Failed to load class '{}' for defaultbookmarkcontainers.cfg", clazz);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void loadHiddenItems() {
|
||||
loadSettingsFile("hiddenitems.cfg", lines -> lines.forEach(API::hideItem));
|
||||
}
|
||||
|
||||
@@ -117,14 +117,12 @@ public class FavoriteRecipes {
|
||||
final RecipeId recipeId = RecipeId.of(jsonObject.getAsJsonObject("recipeId"));
|
||||
final ItemStack stack = StackInfo.loadFromNBT(itemStackNBT);
|
||||
|
||||
if (recipeId == null || stack == null) {
|
||||
continue;
|
||||
}
|
||||
if (stack != null) {
|
||||
final String fluidKey = getFluidKey(stack);
|
||||
|
||||
final String fluidKey = getFluidKey(stack);
|
||||
|
||||
if (fluidKey != null) {
|
||||
fluids.put(fluidKey, recipeId);
|
||||
if (fluidKey != null) {
|
||||
fluids.put(fluidKey, recipeId);
|
||||
}
|
||||
}
|
||||
|
||||
items.put(itemStackNBT, recipeId);
|
||||
@@ -134,8 +132,8 @@ public class FavoriteRecipes {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Failed to load favorite from json string: {}", itemStr);
|
||||
} catch (IllegalArgumentException | JsonSyntaxException | IllegalStateException e) {
|
||||
NEIClientConfig.logger.error("Failed to load favorite from json string:\n{}", itemStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,11 +42,13 @@ public class HUDRenderer implements IKeyStateTracker {
|
||||
&& mc.objectMouseOver != null
|
||||
&& mc.objectMouseOver.typeOfHit == MovingObjectType.BLOCK) {
|
||||
World world = mc.theWorld;
|
||||
final List<ItemStack> items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver);
|
||||
ItemStack[] items = ItemInfo.getIdentifierItems(world, mc.thePlayer, mc.objectMouseOver)
|
||||
.toArray(new ItemStack[0]);
|
||||
|
||||
if (items.isEmpty()) return;
|
||||
if (items.length == 0) return;
|
||||
|
||||
ItemStack stack = StackInfo.getItemStackWithMinimumDamage(items);
|
||||
|
||||
final ItemStack stack = StackInfo.getItemStackWithMinimumDamage(items.toArray(new ItemStack[0]));
|
||||
renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, mc.objectMouseOver), getPositioning());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,6 +281,8 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
|
||||
protected boolean[] invalidSlotMap;
|
||||
|
||||
protected Label messageLabel = new Label(getMessageOnEmpty(), true);
|
||||
|
||||
protected ScreenCapture screenCapture = null;
|
||||
|
||||
public ArrayList<ItemStack> getItems() {
|
||||
@@ -358,6 +360,9 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
rows = height / SLOT_SIZE;
|
||||
|
||||
paddingLeft = (width % SLOT_SIZE) / 2;
|
||||
|
||||
messageLabel.x = marginLeft + width / 2;
|
||||
messageLabel.y = marginTop + height / 2;
|
||||
}
|
||||
|
||||
public void shiftPage(int shift) {
|
||||
@@ -561,6 +566,12 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
afterDrawItems(mousex, mousey, mouseContext);
|
||||
}
|
||||
|
||||
public void setVisible() {
|
||||
if (getItems().isEmpty() && getMessageOnEmpty() != null) {
|
||||
LayoutManager.addWidget(messageLabel);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(int px, int py) {
|
||||
final Rectangle4i rect = new Rectangle4i(
|
||||
marginLeft + paddingLeft,
|
||||
@@ -575,4 +586,7 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
return !isInvalidSlot(columns * getRowIndex(py) + getColumnIndex(px));
|
||||
}
|
||||
|
||||
public String getMessageOnEmpty() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import java.util.Set;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemsGrid.ItemsGridSlot;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
@@ -238,18 +237,9 @@ public class ItemsPanelGrid extends ItemsGrid<ItemsPanelGrid.ItemsPanelGridSlot,
|
||||
Math.min((int) (color.getAlpha() + (255f / 5) * 2), 255));
|
||||
}
|
||||
|
||||
public void draw(int mousex, int mousey) {
|
||||
if (ItemList.loadFinished) {
|
||||
super.draw(mousex, mousey);
|
||||
} else {
|
||||
GuiDraw.drawStringC(
|
||||
NEIClientUtils
|
||||
.cropText(GuiDraw.fontRenderer, NEIClientUtils.translate("itempanel.loading"), width - 10),
|
||||
marginLeft + width / 2,
|
||||
marginTop + height / 2,
|
||||
0xffffff,
|
||||
true);
|
||||
}
|
||||
@Override
|
||||
public String getMessageOnEmpty() {
|
||||
return ItemList.loadFinished ? null : NEIClientUtils.translate("itempanel.loading");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -70,8 +70,8 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
}
|
||||
|
||||
public void setActiveStack(ItemStack activeStack) {
|
||||
final ItemStack realStack = items.stream()
|
||||
.filter(stack -> NEIClientUtils.areStacksSameTypeWithNBT(stack, activeStack)).findFirst().orElse(null);
|
||||
final ItemStack realStack = items.stream().filter(stack -> StackInfo.equalItemAndNBT(stack, activeStack, true))
|
||||
.findFirst().orElse(null);
|
||||
this.activeStackIndex = items.indexOf(realStack);
|
||||
}
|
||||
|
||||
@@ -100,15 +100,13 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
fontRenderer.drawStringWithShadow(this.labelColor + this.label + ":", x, y, 0);
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
final int xTranslation = x;
|
||||
final int yTranslation = y + fontRenderer.FONT_HEIGHT + 2;
|
||||
final int zTranslation = GuiContainerManager.TOOLTIP_Z_OFFSET;
|
||||
GL11.glTranslatef(xTranslation, yTranslation, zTranslation);
|
||||
GL11.glScaled(1, 1, 3);
|
||||
GL11.glTranslatef(x, y + fontRenderer.FONT_HEIGHT + 2, 0);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
int indexShift = 0;
|
||||
|
||||
@@ -144,7 +142,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
});
|
||||
}
|
||||
|
||||
GL11.glTranslatef(-xTranslation, -yTranslation, -zTranslation);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
|
||||
@@ -907,9 +907,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
final int ty2 = ty + 20 - h2 - te;
|
||||
final int tx2 = 200 - w2 - te;
|
||||
|
||||
final boolean is2DTexture = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
changeTexture("textures/gui/widgets.png");
|
||||
drawTexturedModalRect(x, y, tx1, ty1, w1, h1); // top left
|
||||
drawTexturedModalRect(x, y2, tx1, ty2, w1, h2); // bottom left
|
||||
@@ -922,8 +919,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
drawTexturedModalRect(x2, y, tx2, ty1, w2, h1); // top right
|
||||
drawTexturedModalRect(x2, y2, tx2, ty2, w2, h2); // bottom right
|
||||
|
||||
if (!is2DTexture) GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent, boolean slotHighlight) {
|
||||
|
||||
@@ -210,10 +210,6 @@ public class NEIClientConfig {
|
||||
0,
|
||||
OptionIntegerField.UNSIGNED_INT_MAX));
|
||||
|
||||
tag.getTag("inventory.bookmarks.showRecipeHandlerIcon").setComment("Show Recipe Handler Icon")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.showRecipeHandlerIcon", true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.recipeChainDir").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.bookmarks.recipeChainDir", 2, true));
|
||||
|
||||
@@ -229,9 +225,13 @@ public class NEIClientConfig {
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButtonBoubs("inventory.guirecipe.jeiStyleTabs", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.jeiStyleRecipeCatalyst")
|
||||
.setComment("JEI Style Recipe Catalysts (0 - none, 1 - grid, 2 - scroll)").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.guirecipe.jeiStyleRecipeCatalyst", 3, true));
|
||||
tag.getTag("inventory.guirecipe.jeiStyleRecipeCatalyst").setComment("Enable/disable JEI Style Recipe Catalysts")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.jeiStyleRecipeCatalyst", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.jeiStyleCycledIngredients").setComment("JEI styled cycled ingredients")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.jeiStyleCycledIngredients", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.cycledIngredientsTooltip").setComment("Show cycled ingredients tooltip")
|
||||
.getBooleanValue(true);
|
||||
@@ -834,7 +834,6 @@ public class NEIClientConfig {
|
||||
API.addKeyBind("world.creative", 0);
|
||||
API.addHashBind("gui.copy_name", Keyboard.KEY_C + NEIClientUtils.CTRL_HASH);
|
||||
API.addHashBind("gui.copy_oredict", Keyboard.KEY_D + NEIClientUtils.CTRL_HASH);
|
||||
API.addHashBind("gui.copy_id", Keyboard.KEY_X + NEIClientUtils.CTRL_HASH);
|
||||
API.addHashBind("gui.chat_link_item", Keyboard.KEY_L + NEIClientUtils.CTRL_HASH);
|
||||
}
|
||||
|
||||
@@ -895,10 +894,6 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static void unloadWorld() {
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ItemPanels.bookmarkPanel != null) {
|
||||
ItemPanels.bookmarkPanel.save();
|
||||
}
|
||||
@@ -909,8 +904,6 @@ public class NEIClientConfig {
|
||||
|
||||
if (world != null) {
|
||||
world.saveNBT();
|
||||
NEIClientConfig.worldPath = null;
|
||||
world = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1105,8 +1098,8 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.guirecipe.slotHighlightPresent");
|
||||
}
|
||||
|
||||
public static int getJEIStyleRecipeCatalysts() {
|
||||
return getIntSetting("inventory.guirecipe.jeiStyleRecipeCatalyst");
|
||||
public static boolean areJEIStyleRecipeCatalystsVisible() {
|
||||
return getBooleanSetting("inventory.guirecipe.jeiStyleRecipeCatalyst");
|
||||
}
|
||||
|
||||
public static boolean useCreativeTabStyle() {
|
||||
@@ -1125,6 +1118,10 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.optimize_gui_overlap_computation");
|
||||
}
|
||||
|
||||
public static boolean useJEIStyledCycledIngredients() {
|
||||
return getBooleanSetting("inventory.guirecipe.jeiStyleCycledIngredients");
|
||||
}
|
||||
|
||||
public static boolean showCycledIngredientsTooltip() {
|
||||
return getBooleanSetting("inventory.guirecipe.cycledIngredientsTooltip");
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ public abstract class PanelWidget<T extends ItemsGrid<? extends ItemsGridSlot, ?
|
||||
LayoutManager.addWidget(pagePrev);
|
||||
LayoutManager.addWidget(pageNext);
|
||||
LayoutManager.addWidget(pageLabel);
|
||||
this.grid.setVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -421,38 +421,30 @@ public class ItemInfo {
|
||||
Block mouseoverBlock = world.getBlock(x, y, z);
|
||||
|
||||
ArrayList<ItemStack> items = new ArrayList<>();
|
||||
ArrayList<IHighlightHandler> handlers = new ArrayList<>();
|
||||
|
||||
ArrayList<IHighlightHandler> handlers = new ArrayList<>();
|
||||
if (highlightIdentifiers.containsKey(null)) handlers.addAll(highlightIdentifiers.get(null));
|
||||
if (highlightIdentifiers.containsKey(mouseoverBlock)) handlers.addAll(highlightIdentifiers.get(mouseoverBlock));
|
||||
|
||||
for (IHighlightHandler ident : handlers) {
|
||||
final ItemStack item = ident.identifyHighlight(world, player, hit);
|
||||
ItemStack item = ident.identifyHighlight(world, player, hit);
|
||||
if (item != null) items.add(item);
|
||||
}
|
||||
|
||||
if (!items.isEmpty()) return items;
|
||||
if (items.size() > 0) return items;
|
||||
|
||||
try {
|
||||
final ItemStack pick = mouseoverBlock.getPickBlock(hit, world, x, y, z, player);
|
||||
if (pick != null) items.add(pick);
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (!items.isEmpty()) return items;
|
||||
|
||||
if (mouseoverBlock instanceof IShearable shearable) {
|
||||
if (shearable.isShearable(new ItemStack(Items.shears), world, x, y, z)) {
|
||||
items.addAll(shearable.onSheared(new ItemStack(Items.shears), world, x, y, z, 0));
|
||||
}
|
||||
}
|
||||
|
||||
if (!items.isEmpty()) return items;
|
||||
ItemStack pick = mouseoverBlock.getPickBlock(hit, world, x, y, z, player);
|
||||
if (pick != null) items.add(pick);
|
||||
|
||||
try {
|
||||
items.addAll(mouseoverBlock.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0));
|
||||
} catch (Exception ignored) {}
|
||||
if (mouseoverBlock instanceof IShearable) {
|
||||
IShearable shearable = (IShearable) mouseoverBlock;
|
||||
if (shearable.isShearable(new ItemStack(Items.shears), world, x, y, z))
|
||||
items.addAll(shearable.onSheared(new ItemStack(Items.shears), world, x, y, z, 0));
|
||||
}
|
||||
|
||||
if (items.isEmpty()) items.add(new ItemStack(mouseoverBlock, 1, world.getBlockMetadata(x, y, z)));
|
||||
if (items.size() == 0) items.add(0, new ItemStack(mouseoverBlock, 1, world.getBlockMetadata(x, y, z)));
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@@ -42,31 +42,6 @@ import codechicken.nei.util.NEIMouseUtils;
|
||||
|
||||
public abstract class ShortcutInputHandler {
|
||||
|
||||
private static class HotkeysCache {
|
||||
|
||||
public int mousex;
|
||||
public int mousey;
|
||||
public ItemStack stack;
|
||||
public int groupId;
|
||||
public Map<String, String> hotkeys = new HashMap<>();
|
||||
|
||||
public boolean matches(int mousex, int mousey, ItemStack stack, int groupId) {
|
||||
return Math.abs(this.mousex - mousex) < 16 && Math.abs(this.mousey - mousey) < 16
|
||||
&& (this.stack == null ? stack == null && this.groupId == groupId
|
||||
: stack != null && NEIClientUtils.areStacksSameTypeWithNBT(stack, this.stack));
|
||||
}
|
||||
|
||||
public void update(int mousex, int mousey, ItemStack stack, int groupId, Map<String, String> hotkeys) {
|
||||
this.mousex = mousex;
|
||||
this.mousey = mousey;
|
||||
this.stack = stack != null ? stack.copy() : null;
|
||||
this.groupId = groupId;
|
||||
this.hotkeys = hotkeys;
|
||||
}
|
||||
}
|
||||
|
||||
private static HotkeysCache hotkeysCache = new HotkeysCache();
|
||||
|
||||
public static boolean handleKeyEvent(ItemStack stackover) {
|
||||
|
||||
if (!NEIClientConfig.isLoaded()) {
|
||||
@@ -123,9 +98,6 @@ public abstract class ShortcutInputHandler {
|
||||
if (NEIClientConfig.isKeyHashDown("gui.copy_name")) {
|
||||
return copyItemStackName(stackover);
|
||||
}
|
||||
if (NEIClientConfig.isKeyHashDown("gui.copy_id")) {
|
||||
return copyItemStackID(stackover);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.copy_oredict")) {
|
||||
return copyItemStackOreDictionary(stackover);
|
||||
@@ -187,14 +159,6 @@ public abstract class ShortcutInputHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean copyItemStackID(ItemStack stackover) {
|
||||
if (stackover == null || stackover.getItem() == null) return false;
|
||||
GuiScreen.setClipboardString(
|
||||
stackover.getItem().delegate.name()
|
||||
+ (stackover.getItemDamage() != 0 ? "/" + stackover.getItemDamage() : ""));
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean sendItemStackChatLink(ItemStack stackover) {
|
||||
if (stackover == null) return false;
|
||||
|
||||
@@ -416,13 +380,8 @@ public abstract class ShortcutInputHandler {
|
||||
}
|
||||
|
||||
public static Map<String, String> handleHotkeys(int mousex, int mousey, ItemStack stack) {
|
||||
final int groupId = ItemPanels.bookmarkPanel.getHoveredGroupId(true);
|
||||
|
||||
if (hotkeysCache.matches(mousex, mousey, stack, groupId)) {
|
||||
return hotkeysCache.hotkeys;
|
||||
}
|
||||
|
||||
final GuiContainer gui = NEIClientUtils.getGuiContainer();
|
||||
final int groupId = ItemPanels.bookmarkPanel.getHoveredGroupId(true);
|
||||
final Map<String, String> hotkeys = new HashMap<>();
|
||||
|
||||
if (groupId != -1) {
|
||||
@@ -449,13 +408,9 @@ public abstract class ShortcutInputHandler {
|
||||
NEIClientConfig.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
|
||||
NEIClientUtils.translate("bookmark.group.craft_all"));
|
||||
}
|
||||
|
||||
hotkeysCache.update(mousex, mousey, stack, groupId, hotkeys);
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
if (stack == null) {
|
||||
hotkeysCache.update(mousex, mousey, stack, groupId, hotkeys);
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
@@ -556,7 +511,6 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
hotkeys.put(NEIClientConfig.getKeyName("gui.copy_name"), NEIClientUtils.translate("itempanel.copy_name"));
|
||||
hotkeys.put(NEIClientConfig.getKeyName("gui.copy_oredict"), NEIClientUtils.translate("itempanel.copy_oredict"));
|
||||
hotkeys.put(NEIClientConfig.getKeyName("gui.copy_id"), NEIClientUtils.translate("itempanel.copy_id"));
|
||||
hotkeys.put(
|
||||
NEIClientConfig.getKeyName("gui.chat_link_item"),
|
||||
NEIClientUtils.translate("itempanel.chat_link_item"));
|
||||
@@ -616,8 +570,6 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
}
|
||||
|
||||
hotkeysCache.update(mousex, mousey, stack, groupId, hotkeys);
|
||||
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.awt.Color;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.BookmarkPanel.BookmarkViewMode;
|
||||
import codechicken.nei.ItemPanels;
|
||||
@@ -16,9 +14,6 @@ import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIClientUtils.Alignment;
|
||||
import codechicken.nei.bookmark.BookmarkGrid.BookmarkMouseContext;
|
||||
import codechicken.nei.bookmark.RecipeChainDetails.CalculatedType;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
@@ -56,7 +51,6 @@ public class BookmarksGridSlot extends ItemsGridSlot {
|
||||
protected final CalculatedType calculatedType;
|
||||
protected final CalculatedType realType;
|
||||
protected final BookmarkItem bookmarkItem;
|
||||
protected HandlerInfo handlerInfo = null;
|
||||
|
||||
protected final boolean isOutputRecipe;
|
||||
protected final boolean isFirstOutput;
|
||||
@@ -181,13 +175,6 @@ public class BookmarksGridSlot extends ItemsGridSlot {
|
||||
&& mouseContext.recipeId.equals(this.group.crafting.itemToRecipe.get(this.itemIndex));
|
||||
}
|
||||
|
||||
protected HandlerInfo getHandlerInfo() {
|
||||
if (this.bookmarkItem.recipeId != null && this.handlerInfo == null) {
|
||||
this.handlerInfo = GuiRecipeTab.getHandlerInfo(this.bookmarkItem.recipeId.getHandleName(), null);
|
||||
}
|
||||
return this.handlerInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawItem(Rectangle4i rect) {
|
||||
super.drawItem(this.emptyItemStack, rect);
|
||||
@@ -268,67 +255,27 @@ public class BookmarksGridSlot extends ItemsGridSlot {
|
||||
drawMarker(
|
||||
rect,
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.realMultiplier),
|
||||
0xFFFFFF,
|
||||
Alignment.TopLeft);
|
||||
0xFFFFFF);
|
||||
} else if (shownItemType == ShownItemType.SHIFT) {
|
||||
drawMarker(
|
||||
rect,
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMultiplier()),
|
||||
0xFFFFFF,
|
||||
Alignment.TopLeft);
|
||||
drawMarker(rect, "x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMultiplier()), 0xFFFFFF);
|
||||
} else if (this.isOutputRecipe || this.realMultiplier > 1) {
|
||||
drawMarker(
|
||||
rect,
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.realMultiplier),
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue(),
|
||||
Alignment.TopLeft);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.bookmarks.showRecipeHandlerIcon")
|
||||
&& getHandlerInfo() != null) {
|
||||
drawHandlerIcon(rect);
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
|
||||
} else if (NEIClientConfig.showRecipeMarkerMode() == 1) {
|
||||
drawMarker(
|
||||
rect,
|
||||
"R",
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue(),
|
||||
Alignment.TopRight);
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
|
||||
}
|
||||
|
||||
} else if (NEIClientConfig.showRecipeMarkerMode() == 1) {
|
||||
drawMarker(
|
||||
rect,
|
||||
"R",
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue(),
|
||||
Alignment.TopRight);
|
||||
drawMarker(rect, "R", NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void drawHandlerIcon(Rectangle4i rect) {
|
||||
float panelFactor = 1;
|
||||
|
||||
if (rect.w != DEFAULT_SLOT_SIZE) {
|
||||
panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
|
||||
}
|
||||
|
||||
panelFactor *= 0.4f;
|
||||
float x = rect.x + 2 + 16 - 16 * panelFactor;
|
||||
|
||||
GL11.glTranslatef(x, rect.y, 0);
|
||||
GL11.glScaled(panelFactor, panelFactor, 1.5f);
|
||||
|
||||
if (this.handlerInfo.getImage() != null) {
|
||||
this.handlerInfo.getImage().draw(0, 0);
|
||||
} else {
|
||||
GuiContainerManager.drawItem(0, 0, this.handlerInfo.getItemStack(), true, "");
|
||||
}
|
||||
|
||||
GL11.glScaled(1f / panelFactor, 1f / panelFactor, 1f / 1.5f);
|
||||
GL11.glTranslatef(-1 * x, -1 * rect.y, 0);
|
||||
}
|
||||
|
||||
protected void drawMarker(Rectangle4i rect, String text, int color, Alignment alignment) {
|
||||
protected void drawMarker(Rectangle4i rect, String text, int color) {
|
||||
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
|
||||
NEIClientUtils.drawNEIOverlayText(
|
||||
text,
|
||||
@@ -336,7 +283,7 @@ public class BookmarksGridSlot extends ItemsGridSlot {
|
||||
panelFactor,
|
||||
color,
|
||||
true,
|
||||
alignment);
|
||||
Alignment.TopLeft);
|
||||
}
|
||||
|
||||
protected void drawStackSize(Rectangle4i rect, ShownItemType shownItemType) {
|
||||
|
||||
@@ -82,9 +82,6 @@ public class GuiContainerManager {
|
||||
public static final LinkedList<IContainerSlotClickHandler> slotClickHandlers = new HideousLinkedList<>(
|
||||
new CopyOnWriteArrayList<>());
|
||||
|
||||
// Any item rendered with this z offset should render it on top of every other gui element
|
||||
public static final int TOOLTIP_Z_OFFSET = 400;
|
||||
|
||||
static {
|
||||
addSlotClickHandler(new DefaultSlotClickHandler());
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import codechicken.nei.NEIClientUtils;
|
||||
|
||||
public class AcceptsFollowingTooltipLineHandler extends ItemsTooltipLineHandler {
|
||||
|
||||
protected static final int DEFAULT_MAX_ROWS = 4;
|
||||
protected static final int DEFAULT_MAX_ROWS = 5;
|
||||
|
||||
public Object tooltipGUID;
|
||||
|
||||
|
||||
@@ -179,12 +179,6 @@ public class DebugHandlerWidget extends Widget implements IContainerInputHandler
|
||||
|
||||
this.handlerHeight = new IntegerField("handlerHeight", HandlerInfo.DEFAULT_HEIGHT) {
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
this.field.setEnabled(handler.getRecipeHeight(0) <= 0);
|
||||
super.draw(mx, my);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if (getInteger() != handlerInfo.getHeight()) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public class FurnaceRecipeHandler extends TemplateRecipeHandler {
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return Collections.singletonList(ingred);
|
||||
return getCycledIngredients(cycleticks / 48, Collections.singletonList(ingred));
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
|
||||
@@ -65,8 +65,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
private static final int BUTTON_WIDTH = 13;
|
||||
private static final int BUTTON_HEIGHT = 12;
|
||||
|
||||
protected static final ScrollBar VERTICAL_SCROLLBAR = new ScrollBar().setScrollbarSize(14).setMarginStart(-6)
|
||||
.setOverflowType(OverflowType.AUTO).setScrollPlace(ScrollPlace.END)
|
||||
protected static final ScrollBar VERTICAL_SCROLLBAR = new ScrollBar().setScrollbarSize(14)
|
||||
.setOverflowType(OverflowType.AUTO).setScrollPlace(ScrollPlace.OUTSIDE)
|
||||
.setTrackTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 42, 90, 13, 21).build(), 9, 9)
|
||||
.setThumbTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 21, 96, 8, 9).build(), 3, 2)
|
||||
.setThumbPadding(6);
|
||||
@@ -351,7 +351,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
if (!cacheKey.equals(this.recipePageCacheKey)) {
|
||||
this.recipePageCacheKey = cacheKey;
|
||||
|
||||
final boolean expandVertically = this.handlerInfo.expandVertically();
|
||||
final boolean recipeGrow = this.handlerInfo.getUseCustomScroll()
|
||||
&& this.handlerInfo.getMaxRecipesPerPage() <= 1;
|
||||
final List<Widget> widgets = new ArrayList<>();
|
||||
int shiftY = 0;
|
||||
|
||||
@@ -360,7 +361,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
.getRecipeWidget();
|
||||
widget.setLocation(Math.max(0, (this.container.w - widget.w) / 2), shiftY);
|
||||
|
||||
if (expandVertically) {
|
||||
if (recipeGrow) {
|
||||
widget.h = Math.min(
|
||||
this.handlerInfo.getHeight() + this.handlerInfo.getYShift(),
|
||||
this.container.getVisibleHeight());
|
||||
@@ -379,7 +380,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
} else {
|
||||
this.container.setVerticalScroll(
|
||||
ScrollBar.defaultVerticalBar().setOverflowType(OverflowType.OVERLAY)
|
||||
.setScrollPlace(ScrollPlace.END));
|
||||
.setScrollPlace(ScrollPlace.OUTSIDE));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,6 +423,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
GuiRecipe.toggleSearch.state = 0;
|
||||
|
||||
this.container.setVerticalScrollOffset(0);
|
||||
this.container.setHorizontalScrollOffset(0);
|
||||
this.page = Math.min(Math.max(0, refIndex), this.numRecipes() - 1) / getRecipesPerPage();
|
||||
changePage(0);
|
||||
|
||||
@@ -708,10 +710,10 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
refreshPage();
|
||||
this.container.update();
|
||||
|
||||
this.recipeCatalyst.setAvailableHeight(this.ySize - 5);
|
||||
this.recipeCatalyst.y = this.guiTop;
|
||||
this.recipeCatalyst.x = this.guiLeft - this.recipeCatalyst.w + 4;
|
||||
this.recipeCatalyst.setAvailableHeight(this.container.h);
|
||||
this.recipeCatalyst.update();
|
||||
this.recipeCatalyst.y = this.guiTop;
|
||||
this.recipeCatalyst.x = this.guiLeft - this.recipeCatalyst.w + 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -831,6 +833,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
if (this.page != oldPage) {
|
||||
this.container.setVerticalScrollOffset(0);
|
||||
this.container.setHorizontalScrollOffset(0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -862,11 +865,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
GL11.glTranslatef(-guiLeft, -guiTop, 0);
|
||||
this.container.draw(mouseX, mouseY);
|
||||
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() != 0 && this.recipeCatalyst.isShowWidget()) {
|
||||
this.recipeCatalyst.draw(mouseX, mouseY);
|
||||
}
|
||||
|
||||
GL11.glTranslatef(guiLeft, guiTop, 0);
|
||||
}
|
||||
|
||||
@@ -943,6 +941,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
this.recipeTabs.draw(mouseX, mouseY);
|
||||
|
||||
if (NEIClientConfig.areJEIStyleRecipeCatalystsVisible()) {
|
||||
this.recipeCatalyst.draw(mouseX, mouseY);
|
||||
}
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
}
|
||||
@@ -1025,7 +1028,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
final Rectangle4i rect = new Rectangle4i(x, y, w, h);
|
||||
// Because some of the handlers *cough avaritia* are oversized
|
||||
|
||||
if (this.recipeCatalyst.isShowWidget() && this.recipeCatalyst.boundsOutside().intersects(rect)) {
|
||||
if (this.recipeCatalyst.isShowWidget() && this.recipeCatalyst.bounds().intersects(rect)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,13 @@ package codechicken.nei.recipe;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -15,37 +18,8 @@ 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;
|
||||
|
||||
public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
|
||||
protected static class ItemStackWidget extends Widget {
|
||||
|
||||
private final PositionedStack pStack;
|
||||
|
||||
public ItemStackWidget(PositionedStack pStack) {
|
||||
this.pStack = pStack;
|
||||
this.x = pStack.relx;
|
||||
this.y = pStack.rely;
|
||||
this.w = SLOT_SIZE;
|
||||
this.h = SLOT_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
GuiContainerManager.drawItem(this.x, this.y, this.pStack.item);
|
||||
|
||||
if (contains(mx, my)) {
|
||||
NEIClientUtils.gl2DRenderContext(() -> GuiDraw.drawRect(this.x, this.y, this.w, this.h, 0x80FFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
return ShortcutInputHandler.handleMouseClick(this.pStack.item);
|
||||
}
|
||||
}
|
||||
public class GuiRecipeCatalyst extends Widget {
|
||||
|
||||
private static final int SLOT_SIZE = 16;
|
||||
private static final int BORDER_PADDING = 6;
|
||||
@@ -59,29 +33,17 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
private static final DrawableResource FG_TEXTURE = new DrawableBuilder("nei:textures/slot.png", 0, 0, 18, 18)
|
||||
.setTextureSize(18, 18).build();
|
||||
|
||||
private static final ScrollBar VERTICAL_SCROLLBAR = ScrollBar.defaultVerticalBar()
|
||||
.setOverflowType(ScrollBar.OverflowType.AUTO).setMarginStart(BORDER_PADDING).setMarginEnd(BORDER_PADDING)
|
||||
.setPadding(-13).setScrollPlace(ScrollBar.ScrollPlace.START);
|
||||
|
||||
private final List<PositionedStack> items = new ArrayList<>();
|
||||
private boolean showWidget = false;
|
||||
private int availableHeight = 0;
|
||||
|
||||
public GuiRecipeCatalyst() {
|
||||
setPaddingBlock(BORDER_PADDING + 1, BORDER_PADDING + 1);
|
||||
}
|
||||
private boolean showWidget = false;
|
||||
|
||||
public void setCatalysts(List<PositionedStack> items) {
|
||||
this.items.clear();
|
||||
this.items.addAll(items);
|
||||
createWidgets();
|
||||
}
|
||||
|
||||
public void setAvailableHeight(int height) {
|
||||
if (this.availableHeight != height) {
|
||||
this.availableHeight = height;
|
||||
createWidgets();
|
||||
}
|
||||
this.availableHeight = height;
|
||||
}
|
||||
|
||||
public int getAvailableHeight() {
|
||||
@@ -93,11 +55,8 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
}
|
||||
|
||||
public int getColumnCount() {
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() == 1) {
|
||||
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;
|
||||
final int maxItemsPerColumn = Math.max(0, this.availableHeight - 2 - BORDER_PADDING * 2) / SLOT_SIZE;
|
||||
return maxItemsPerColumn > 0 ? NEIServerUtils.divideCeil(this.items.size(), maxItemsPerColumn) : 0;
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
@@ -105,35 +64,20 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
return columnCount > 0 ? NEIServerUtils.divideCeil(this.items.size(), columnCount) : 0;
|
||||
}
|
||||
|
||||
protected void createWidgets() {
|
||||
@Override
|
||||
public void update() {
|
||||
final int columns = getColumnCount();
|
||||
final int rows = getRowCount();
|
||||
|
||||
setVerticalScroll(null);
|
||||
setPaddingInline(BORDER_PADDING + 1, BORDER_PADDING - 3);
|
||||
|
||||
this.h = rows * SLOT_SIZE + this.paddingBlockStart + this.paddingBlockEnd;
|
||||
this.w = columns * SLOT_SIZE + this.paddingInlineStart + this.paddingInlineEnd;
|
||||
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() == 2
|
||||
&& rows * SLOT_SIZE + this.paddingBlockStart + this.paddingBlockEnd > this.availableHeight) {
|
||||
this.h = Math.min(this.h, this.availableHeight);
|
||||
this.w += VERTICAL_SCROLLBAR.getScrollbarSize();
|
||||
|
||||
setVerticalScroll(VERTICAL_SCROLLBAR);
|
||||
setPaddingInline(BORDER_PADDING + 1 + VERTICAL_SCROLLBAR.getScrollbarSize(), this.paddingInlineEnd);
|
||||
}
|
||||
|
||||
this.showWidget = rows * columns > 0;
|
||||
this.w = columns * SLOT_SIZE + 2 + BORDER_PADDING * 2;
|
||||
this.h = rows * SLOT_SIZE + 2 + BORDER_PADDING * 2;
|
||||
|
||||
if (rows == 0 || columns == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int visibleWidth = getVisibleWidth();
|
||||
final List<Widget> widgets = new ArrayList<>();
|
||||
int index = 0;
|
||||
|
||||
for (PositionedStack pStack : this.items) {
|
||||
|
||||
if (pStack.items.length > 1) {
|
||||
@@ -142,45 +86,75 @@ public class GuiRecipeCatalyst extends ScrollContainer {
|
||||
pStack.setPermutationToRender(stackIndex);
|
||||
}
|
||||
|
||||
pStack.relx = visibleWidth - SLOT_SIZE - (index / rows) * SLOT_SIZE;
|
||||
pStack.rely = (index % rows) * SLOT_SIZE;
|
||||
pStack.relx = this.w - BORDER_PADDING - 1 - SLOT_SIZE - (index / rows) * SLOT_SIZE;
|
||||
pStack.rely = BORDER_PADDING + 1 + (index % rows) * SLOT_SIZE;
|
||||
index++;
|
||||
|
||||
widgets.add(new ItemStackWidget(pStack));
|
||||
}
|
||||
|
||||
setWidgets(widgets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
if (!this.showWidget) return;
|
||||
|
||||
GL11.glTranslatef(this.x, this.y, 0);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
BG_TEXTURE.draw(this.x, this.y, this.w, this.h, BORDER_PADDING, BORDER_PADDING, BORDER_PADDING, BORDER_PADDING);
|
||||
|
||||
BG_TEXTURE.draw(0, 0, this.w, this.h, BORDER_PADDING, BORDER_PADDING, BORDER_PADDING, BORDER_PADDING);
|
||||
FG_TEXTURE.draw(
|
||||
this.x + this.paddingInlineStart - 1,
|
||||
this.y + this.paddingBlockStart - 1,
|
||||
this.w - this.paddingInlineStart - this.paddingInlineEnd + 2,
|
||||
this.h - this.paddingBlockStart - this.paddingBlockEnd + 2,
|
||||
BORDER_PADDING,
|
||||
BORDER_PADDING,
|
||||
this.w - BORDER_PADDING * 2,
|
||||
this.h - BORDER_PADDING * 2,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1);
|
||||
|
||||
super.draw(mx, my);
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
for (PositionedStack pStack : this.items) {
|
||||
GuiContainerManager.drawItem(pStack.relx, pStack.rely, pStack.item);
|
||||
|
||||
if (pStack.contains(mx - this.x, my - this.y)) {
|
||||
NEIClientUtils.gl2DRenderContext(
|
||||
() -> GuiDraw.drawRect(pStack.relx, pStack.rely, SLOT_SIZE, SLOT_SIZE, -2130706433));
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glTranslatef(-this.x, -this.y, 0);
|
||||
}
|
||||
|
||||
public PositionedStack getPositionedStackMouseOver(int mx, int my) {
|
||||
final Widget widget = getWidgetUnderMouse(mx, my);
|
||||
|
||||
if (widget instanceof ItemStackWidget stackWidget) {
|
||||
return stackWidget.pStack;
|
||||
for (PositionedStack pStack : this.items) {
|
||||
if (pStack.contains(mx - this.x, my - this.y)) {
|
||||
return pStack;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackMouseOver(int mx, int my) {
|
||||
final PositionedStack pStack = getPositionedStackMouseOver(mx, my);
|
||||
|
||||
if (pStack != null) {
|
||||
return pStack.item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mx, int my, int button) {
|
||||
return ShortcutInputHandler.handleMouseClick(getStackMouseOver(mx, my));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final int ingredientSize = 16;
|
||||
@Deprecated
|
||||
|
||||
@@ -99,7 +99,7 @@ public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
private static IUsageHandler getUsageOrCatalystHandler(IUsageHandler handler, String inputId,
|
||||
Object... ingredients) {
|
||||
boolean skipCatalyst = NEIClientUtils.controlKey();
|
||||
if (NEIClientConfig.getJEIStyleRecipeCatalysts() != 0 && !skipCatalyst) {
|
||||
if (NEIClientConfig.areJEIStyleRecipeCatalystsVisible() && !skipCatalyst) {
|
||||
return handler.getUsageAndCatalystHandler(inputId, ingredients);
|
||||
} else {
|
||||
return handler.getUsageHandler(inputId, ingredients);
|
||||
|
||||
@@ -133,10 +133,6 @@ public class HandlerInfo {
|
||||
this.useCustomScroll = useCustomScroll;
|
||||
}
|
||||
|
||||
public boolean expandVertically() {
|
||||
return this.useCustomScroll && this.maxRecipesPerPage <= 1;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private final HandlerInfo info;
|
||||
|
||||
@@ -44,10 +44,6 @@ public interface IRecipeHandler {
|
||||
return getRecipeName();
|
||||
}
|
||||
|
||||
default int getRecipeHeight(int recipe) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The number of recipes that this handler contains.
|
||||
|
||||
@@ -99,7 +99,7 @@ public class InformationHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return Collections.singletonList(this.stack);
|
||||
return getCycledIngredients(cycleticks / 20, Collections.singletonList(this.stack));
|
||||
}
|
||||
|
||||
public InformationPage getPage() {
|
||||
|
||||
@@ -5,9 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -19,7 +17,6 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.FavoriteRecipes;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
@@ -32,16 +29,13 @@ import codechicken.nei.recipe.GuiRecipeButton.UpdateRecipeButtonsEvent;
|
||||
|
||||
public class NEIRecipeWidget extends Widget {
|
||||
|
||||
protected final WeakHashMap<PositionedStack, List<ItemStack>> permutations = new WeakHashMap<>();
|
||||
protected boolean needUpdate = true;
|
||||
protected int cycleticks = 0;
|
||||
protected int lastcycle = 0;
|
||||
|
||||
protected final RecipeHandlerRef handlerRef;
|
||||
protected final HandlerInfo handlerInfo;
|
||||
|
||||
protected boolean showAsWidget = false;
|
||||
protected List<GuiRecipeButton> recipeButtons = null;
|
||||
protected boolean firstDraw = true;
|
||||
protected boolean needUpdate = true;
|
||||
|
||||
public NEIRecipeWidget(RecipeHandlerRef handlerRef) {
|
||||
this.handlerRef = handlerRef;
|
||||
@@ -55,18 +49,14 @@ public class NEIRecipeWidget extends Widget {
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.w = Math.max(166, this.handlerInfo.getWidth());
|
||||
this.w = this.handlerInfo.getWidth();
|
||||
|
||||
if (this.showAsWidget || !this.handlerInfo.expandVertically()) {
|
||||
final int recipeHeight = this.handlerRef.handler.getRecipeHeight(this.handlerRef.recipeIndex);
|
||||
this.h = recipeHeight > 0 ? recipeHeight : this.handlerInfo.getHeight();
|
||||
this.h += this.handlerInfo.getYShift();
|
||||
if (this.showAsWidget || !this.handlerInfo.getUseCustomScroll()
|
||||
|| this.handlerInfo.getMaxRecipesPerPage() > 1) {
|
||||
this.h = this.handlerInfo.getHeight() + this.handlerInfo.getYShift();
|
||||
}
|
||||
|
||||
if (!this.needUpdate && !NEIClientUtils.shiftKey() && (this.cycleticks++) / 20 != this.lastcycle) {
|
||||
this.lastcycle = this.cycleticks / 20;
|
||||
this.needUpdate = true;
|
||||
}
|
||||
this.needUpdate = true;
|
||||
}
|
||||
|
||||
public List<GuiRecipeButton> getRecipeButtons() {
|
||||
@@ -162,12 +152,7 @@ public class NEIRecipeWidget extends Widget {
|
||||
public void draw(int mouseX, int mouseY) {
|
||||
final int yShift = this.handlerInfo.getYShift();
|
||||
|
||||
if (this.needUpdate) {
|
||||
this.needUpdate = false;
|
||||
updatePermutations();
|
||||
}
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glTranslatef(this.x, this.y + yShift, 0);
|
||||
|
||||
this.handlerRef.handler.drawBackground(this.handlerRef.recipeIndex);
|
||||
@@ -176,35 +161,22 @@ public class NEIRecipeWidget extends Widget {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
GuiContainerManager.enableMatrixStackLogging();
|
||||
if (this.firstDraw) {
|
||||
this.firstDraw = false;
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex)) {
|
||||
pStack.setPermutationToRender(pStack.getFilteredPermutations().get(0));
|
||||
}
|
||||
}
|
||||
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex)) {
|
||||
for (PositionedStack pStack : getItems(!this.needUpdate)) {
|
||||
GuiContainerManager.drawItem(pStack.relx, pStack.rely, pStack.item);
|
||||
|
||||
if (pStack.contains(mouseX - this.x, mouseY - this.y - yShift)) {
|
||||
NEIClientUtils.gl2DRenderContext(() -> GuiDraw.drawRect(pStack.relx, pStack.rely, 16, 16, 0x80FFFFFF));
|
||||
NEIClientUtils.gl2DRenderContext(() -> GuiDraw.drawRect(pStack.relx, pStack.rely, 16, 16, -2130706433));
|
||||
}
|
||||
}
|
||||
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getOtherStacks(this.handlerRef.recipeIndex)) {
|
||||
GuiContainerManager.drawItem(pStack.relx, pStack.rely, pStack.item);
|
||||
|
||||
if (pStack.contains(mouseX - this.x, mouseY - this.y - yShift)) {
|
||||
NEIClientUtils.gl2DRenderContext(() -> GuiDraw.drawRect(pStack.relx, pStack.rely, 16, 16, 0x80FFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
final PositionedStack pStackResult = this.handlerRef.handler.getResultStack(this.handlerRef.recipeIndex);
|
||||
if (pStackResult != null) {
|
||||
GuiContainerManager.drawItem(pStackResult.relx, pStackResult.rely, pStackResult.item);
|
||||
if (pStackResult.contains(mouseX - this.x, mouseY - this.y - yShift)) {
|
||||
NEIClientUtils.gl2DRenderContext(
|
||||
() -> GuiDraw.drawRect(pStackResult.relx, pStackResult.rely, 16, 16, 0x80FFFFFF));
|
||||
}
|
||||
}
|
||||
|
||||
GuiContainerManager.disableMatrixStackLogging();
|
||||
|
||||
this.needUpdate = false;
|
||||
this.handlerRef.handler.drawForeground(this.handlerRef.recipeIndex);
|
||||
|
||||
final GuiRecipeButton overlayButton = getRecipeButtons().stream()
|
||||
@@ -328,37 +300,12 @@ public class NEIRecipeWidget extends Widget {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (scrollPermutations(scroll, mx, my)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final GuiRecipe<?> guiRecipe = getGuiRecipe();
|
||||
|
||||
return guiRecipe != null
|
||||
&& this.handlerRef.handler.mouseScrolled(guiRecipe, scroll, this.handlerRef.recipeIndex);
|
||||
}
|
||||
|
||||
protected boolean scrollPermutations(int scroll, int mx, int my) {
|
||||
if (!NEIClientUtils.shiftKey()) return false;
|
||||
final PositionedStack overStack = getPositionedStackMouseOver(mx, my);
|
||||
|
||||
if (overStack != null && overStack.items.length > 1) {
|
||||
final List<ItemStack> items = overStack.getFilteredPermutations();
|
||||
final int stackIndex = overStack.getPermutationIndex(overStack.item);
|
||||
final ItemStack stack = items.get((items.size() - scroll + stackIndex) % items.size());
|
||||
|
||||
Stream.concat(
|
||||
this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex).stream(),
|
||||
this.handlerRef.handler.getOtherStacks(this.handlerRef.recipeIndex).stream())
|
||||
.filter(pStack -> pStack.containsWithNBT(stack))
|
||||
.forEach(pStack -> pStack.setPermutationToRender(stack));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected <R> R forEachButtons(Function<GuiRecipeButton, R> callback, R defaultValue) {
|
||||
|
||||
for (GuiRecipeButton button : getRecipeButtonsIfInit()) {
|
||||
@@ -398,23 +345,12 @@ public class NEIRecipeWidget extends Widget {
|
||||
public PositionedStack getPositionedStackMouseOver(int mx, int my) {
|
||||
final int yShift = this.handlerInfo.getYShift();
|
||||
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex)) {
|
||||
for (PositionedStack pStack : getItems(true)) {
|
||||
if (pStack.contains(mx - this.x, my - this.y - yShift)) {
|
||||
return pStack;
|
||||
}
|
||||
}
|
||||
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getOtherStacks(this.handlerRef.recipeIndex)) {
|
||||
if (pStack.contains(mx - this.x, my - this.y - yShift)) {
|
||||
return pStack;
|
||||
}
|
||||
}
|
||||
|
||||
final PositionedStack pStackResult = this.handlerRef.handler.getResultStack(this.handlerRef.recipeIndex);
|
||||
if (pStackResult != null && pStackResult.contains(mx - this.x, my - this.y - yShift)) {
|
||||
return pStackResult;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -444,31 +380,20 @@ public class NEIRecipeWidget extends Widget {
|
||||
return guiContainer;
|
||||
}
|
||||
|
||||
protected void updatePermutations() {
|
||||
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex)) {
|
||||
if (pStack.items.length > 1) {
|
||||
final List<ItemStack> permutations = this.permutations
|
||||
.computeIfAbsent(pStack, stack -> stack.getFilteredPermutations(FavoriteRecipes::contains));
|
||||
pStack.setPermutationToRender(permutations.get(this.lastcycle % permutations.size()));
|
||||
}
|
||||
}
|
||||
|
||||
for (PositionedStack pStack : this.handlerRef.handler.getOtherStacks(this.handlerRef.recipeIndex)) {
|
||||
if (pStack.items.length > 1) {
|
||||
final List<ItemStack> permutations = this.permutations
|
||||
.computeIfAbsent(pStack, stack -> stack.getFilteredPermutations(FavoriteRecipes::contains));
|
||||
pStack.setPermutationToRender(permutations.get(this.lastcycle % permutations.size()));
|
||||
}
|
||||
}
|
||||
|
||||
protected List<PositionedStack> getItems(boolean disableCycledIngredients) {
|
||||
final PositionedStack pStackResult = this.handlerRef.handler.getResultStack(this.handlerRef.recipeIndex);
|
||||
if (pStackResult != null && pStackResult.items.length > 1) {
|
||||
final List<ItemStack> permutations = this.permutations
|
||||
.computeIfAbsent(pStackResult, stack -> stack.getFilteredPermutations(FavoriteRecipes::contains));
|
||||
pStackResult.setPermutationToRender(permutations.get(this.lastcycle % permutations.size()));
|
||||
final List<PositionedStack> itemStacks = new ArrayList<>();
|
||||
|
||||
TemplateRecipeHandler.disableCycledIngredients = disableCycledIngredients;
|
||||
itemStacks.addAll(this.handlerRef.handler.getIngredientStacks(this.handlerRef.recipeIndex));
|
||||
itemStacks.addAll(this.handlerRef.handler.getOtherStacks(this.handlerRef.recipeIndex));
|
||||
TemplateRecipeHandler.disableCycledIngredients = true;
|
||||
|
||||
if (pStackResult != null) {
|
||||
itemStacks.add(pStackResult);
|
||||
}
|
||||
|
||||
return itemStacks;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
@@ -312,8 +311,7 @@ public class Recipe {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stackA) {
|
||||
return getPermutations().stream()
|
||||
.anyMatch(stackB -> NEIClientUtils.areStacksSameTypeWithNBT(stackB, stackA));
|
||||
return getPermutations().stream().anyMatch(stackB -> StackInfo.equalItemAndNBT(stackA, stackB, true));
|
||||
}
|
||||
|
||||
public List<ItemStack> getPermutations() {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
|
||||
@@ -80,30 +84,37 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
final Dimension size = getSize();
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glTranslatef(x, y, 0);
|
||||
GL11.glScaled(1, 1, 3);
|
||||
GL11.glTranslatef(x, y, 0);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
|
||||
final int zTranslation = GuiContainerManager.TOOLTIP_Z_OFFSET;
|
||||
GL11.glTranslatef(x, y, zTranslation);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
GuiContainerManager.enable2DRender();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
BG_TEXTURE.draw(0, 0, size.width, size.height, BG_PADDING, BG_PADDING, BG_PADDING, BG_PADDING);
|
||||
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
if (this.gui.slotcontainer != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
List<Slot> slots = this.gui.slotcontainer.inventorySlots;
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
GuiHelper.useScissor(
|
||||
this.widget.x,
|
||||
this.widget.y,
|
||||
this.widget.w,
|
||||
this.widget.h,
|
||||
() -> { this.widget.draw(0, 0); });
|
||||
GuiHelper.useScissor(
|
||||
this.widget.x,
|
||||
this.widget.y,
|
||||
this.widget.w,
|
||||
this.widget.h,
|
||||
() -> { this.widget.draw(0, 0); });
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glTranslatef(-x, -y, -zTranslation);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class ShapedRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return ingredients;
|
||||
return getCycledIngredients(cycleticks / 20, ingredients);
|
||||
}
|
||||
|
||||
public PositionedStack getResult() {
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler {
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return ingredients;
|
||||
return getCycledIngredients(cycleticks / 20, ingredients);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,11 +9,13 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -29,6 +31,8 @@ import org.lwjgl.opengl.GL11;
|
||||
import com.google.common.base.Stopwatch;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.FavoriteRecipes;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
@@ -174,16 +178,43 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
/**
|
||||
* This will perform default cycling of ingredients, mulitItem capable
|
||||
*
|
||||
* @param cycle Current cycle step
|
||||
* @param ingredients List of ItemStacks to cycle
|
||||
* @return The provided list of ingredients, with their permutations cycled to a different permutation, if one
|
||||
* is available
|
||||
*/
|
||||
public List<PositionedStack> getCycledIngredients(int cycle, List<PositionedStack> ingredients) {
|
||||
|
||||
if (!NEIClientUtils.shiftKey() && !disableCycledIngredients) {
|
||||
randomRenderPermutation(ingredients, cycle);
|
||||
}
|
||||
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {}
|
||||
public void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
cycle = NEIClientConfig.useJEIStyledCycledIngredients() ? cycle
|
||||
: Math.abs(new Random(cycle + offset).nextInt());
|
||||
|
||||
for (PositionedStack pStack : stacks) {
|
||||
if (pStack.items.length <= 1) continue;
|
||||
final List<ItemStack> items = pStack.getFilteredPermutations(FavoriteRecipes::contains);
|
||||
pStack.setPermutationToRender(items.get((int) (cycle % items.size())));
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void randomRenderPermutation(PositionedStack stack, long cycle) {}
|
||||
public void randomRenderPermutation(PositionedStack stack, long cycle) {
|
||||
cycle = NEIClientConfig.useJEIStyledCycledIngredients() ? cycle
|
||||
: Math.abs(new Random(cycle + offset).nextInt());
|
||||
|
||||
if (stack.items.length <= 1) return;
|
||||
final List<ItemStack> items = stack.getFilteredPermutations(FavoriteRecipes::contains);
|
||||
stack.setPermutationToRender(items.get((int) (cycle % items.size())));
|
||||
}
|
||||
|
||||
public void setIngredientPermutation(Collection<PositionedStack> ingredients, ItemStack ingredient) {
|
||||
for (PositionedStack stack : ingredients) {
|
||||
@@ -375,6 +406,8 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
*/
|
||||
public LinkedList<RecipeTransferRect> transferRects = new LinkedList<>();
|
||||
|
||||
public static boolean disableCycledIngredients = true;
|
||||
|
||||
public TemplateRecipeHandler() {
|
||||
loadTransferRects();
|
||||
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
|
||||
@@ -608,7 +641,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
cycleticks++;
|
||||
if (!NEIClientUtils.shiftKey()) cycleticks++;
|
||||
}
|
||||
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe) {
|
||||
@@ -667,9 +700,49 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiRecipe<?> gui, int scroll, int recipe) {
|
||||
if (!NEIClientUtils.shiftKey()) return false;
|
||||
|
||||
final Point pos = GuiDraw.getMousePosition();
|
||||
final Point offset = gui.getRecipePosition(recipe);
|
||||
final Point relMouse = new Point(pos.x - gui.guiLeft - offset.x, pos.y - gui.guiTop - offset.y);
|
||||
final PositionedStack overStack = getIngredientMouseOver(relMouse.x, relMouse.y, recipe);
|
||||
|
||||
if (overStack != null && overStack.items.length > 1) {
|
||||
final List<ItemStack> items = overStack.getFilteredPermutations();
|
||||
final int stackIndex = getPermutationIndex(overStack.item, items);
|
||||
final ItemStack stack = items.get((items.size() - scroll + stackIndex) % items.size());
|
||||
|
||||
if (NEIClientConfig.useJEIStyledCycledIngredients()) {
|
||||
Stream.concat(getIngredientStacks(recipe).stream(), getOtherStacks(recipe).stream())
|
||||
.filter(pStack -> pStack.containsWithNBT(stack))
|
||||
.forEach(pStack -> pStack.setPermutationToRender(stack));
|
||||
} else {
|
||||
overStack.setPermutationToRender(stack);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getPermutationIndex(ItemStack stack, List<ItemStack> items) {
|
||||
|
||||
for (int index = 0; index < items.size(); index++) {
|
||||
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(items.get(index), stack)) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private PositionedStack getIngredientMouseOver(int mousex, int mousey, int recipe) {
|
||||
return Stream.concat(getIngredientStacks(recipe).stream(), getOtherStacks(recipe).stream())
|
||||
.filter(pStack -> new Rectangle4i(pStack.relx, pStack.rely, 18, 18).contains(mousex, mousey))
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
private boolean transferRect(GuiRecipe<?> gui, int recipe, boolean usage) {
|
||||
Point offset = gui.getRecipePosition(recipe);
|
||||
return transferRect(gui, transferRects, offset.x, offset.y, usage);
|
||||
|
||||
@@ -406,46 +406,14 @@ public class RecipeChainMath {
|
||||
ItemStack itemStack = prefItem.itemStack;
|
||||
|
||||
while (ingrAmount > 0 && shiftAmount < maxAmount) {
|
||||
long multiplier = 1;
|
||||
itemStack = itemStack.copy();
|
||||
itemStack.stackSize = 1;
|
||||
|
||||
this.containerItems.add(itemStack);
|
||||
ingrAmount = shiftContainerItems(itemStack, prefItem.getStackSize(ingrAmount))
|
||||
* prefItem.fluidCellAmount;
|
||||
|
||||
if (ingrAmount > 0) {
|
||||
long steps = prefItem.getStackSize(ingrAmount);
|
||||
final ContainerItemResult result = getToolsContainerItems(itemStack, steps);
|
||||
|
||||
if (result.stack == null) {
|
||||
multiplier = steps / (steps - result.leftSteps);
|
||||
steps = steps % (steps - result.leftSteps);
|
||||
} else {
|
||||
steps = result.leftSteps;
|
||||
}
|
||||
|
||||
if (result.containerItem != null) {
|
||||
long stackSize = result.containerItem.stackSize * multiplier;
|
||||
|
||||
while (stackSize > Integer.MAX_VALUE) {
|
||||
final ItemStack copy = result.containerItem.copy();
|
||||
copy.stackSize = Integer.MAX_VALUE;
|
||||
this.containerItems.add(copy);
|
||||
stackSize -= copy.stackSize;
|
||||
}
|
||||
|
||||
result.containerItem.stackSize = (int) stackSize;
|
||||
this.containerItems.add(result.containerItem);
|
||||
}
|
||||
|
||||
if (result.stack != null) {
|
||||
this.containerItems.add(result.stack);
|
||||
}
|
||||
|
||||
ingrAmount = steps * prefItem.fluidCellAmount;
|
||||
}
|
||||
|
||||
shiftAmount += multiplier * prefItem.fluidCellAmount;
|
||||
shiftAmount += prefItem.fluidCellAmount;
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -461,9 +429,8 @@ public class RecipeChainMath {
|
||||
}
|
||||
|
||||
private long shiftContainerItems(ItemStack aStack, long steps) {
|
||||
final int initialSize = this.containerItems.size();
|
||||
|
||||
for (int i = 0; i < initialSize && steps > 0; i++) {
|
||||
for (int i = 0; i < this.containerItems.size() && steps > 0; i++) {
|
||||
ItemStack bStack = this.containerItems.get(i);
|
||||
|
||||
if (bStack != null && NEIClientUtils.areStacksSameTypeCraftingWithNBT(aStack, bStack)) {
|
||||
@@ -496,12 +463,12 @@ public class RecipeChainMath {
|
||||
final NBTTagCompound toolStats = tagCompound.getCompoundTag("GT.ToolStats");
|
||||
final long maxDamage = toolStats.getLong("MaxDamage");
|
||||
final long damage = toolStats.getLong("Damage");
|
||||
final long leftSteps = (long) Math.ceil((maxDamage - damage) / (double) damagePerContainerCraft);
|
||||
final long leftSteps = (maxDamage - damage) / damagePerContainerCraft;
|
||||
final long availableSteps = Math.min(steps, Math.max(1, leftSteps));
|
||||
|
||||
steps -= availableSteps;
|
||||
|
||||
if ((damage + availableSteps * damagePerContainerCraft) >= maxDamage || leftSteps <= 0) {
|
||||
if ((damage + availableSteps * damagePerContainerCraft) == maxDamage || leftSteps <= 0) {
|
||||
aStack = null;
|
||||
} else {
|
||||
toolStats.setLong("Damage", damage + availableSteps * damagePerContainerCraft);
|
||||
|
||||
@@ -208,8 +208,6 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
this.available.setLabelColor(EnumChatFormatting.GREEN);
|
||||
}
|
||||
|
||||
this.size.height = this.size.width = 0;
|
||||
|
||||
if (!this.inputs.isEmpty() || !this.outputs.isEmpty()
|
||||
|| !this.remainder.isEmpty()
|
||||
|| !this.available.isEmpty()) {
|
||||
@@ -227,6 +225,8 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
this.size.height += this.inputs.getSize().height + this.outputs.getSize().height
|
||||
+ this.remainder.getSize().height
|
||||
+ this.available.getSize().height;
|
||||
} else {
|
||||
this.size.height = this.size.width = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,21 +31,18 @@ public class ScrollBar {
|
||||
}
|
||||
|
||||
public enum ScrollPlace {
|
||||
START,
|
||||
END
|
||||
INSIDE,
|
||||
OUTSIDE
|
||||
}
|
||||
|
||||
private ScrollType scrollType = ScrollType.VERTICAL;
|
||||
private OverflowType overflowType = OverflowType.SCROLL;
|
||||
private ScrollPlace scrollPlace = ScrollPlace.END;
|
||||
private ScrollPlace scrollPlace = ScrollPlace.INSIDE;
|
||||
private float handleClickOffset = -1;
|
||||
|
||||
private int scrollbarSize = 6;
|
||||
private int thumbPadding = 0;
|
||||
|
||||
private int padding = 0;
|
||||
private int marginStart = 0;
|
||||
private int marginEnd = 0;
|
||||
private int margin = 0;
|
||||
|
||||
private DrawableResource thumbTexture;
|
||||
private int thumbSliceStart;
|
||||
@@ -61,13 +58,14 @@ public class ScrollBar {
|
||||
|
||||
public static ScrollBar defaultVerticalBar() {
|
||||
return new ScrollBar().setScrollbarSize(8)
|
||||
.setTrackTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 28, 95, 11, 11).build(), 3, 4)
|
||||
.setThumbTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 21, 96, 7, 9).build(), 3, 2)
|
||||
.setTrackTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 29, 95, 12, 11).build(), 3, 4)
|
||||
.setThumbTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 21, 96, 8, 9).build(), 3, 2)
|
||||
.setThumbPadding(1);
|
||||
}
|
||||
|
||||
public static ScrollBar defaultHorizontalBar() {
|
||||
return new ScrollBar().setScrollbarSize(8).setOverflowType(OverflowType.SCROLL).setScrollPlace(ScrollPlace.END)
|
||||
return new ScrollBar().setScrollbarSize(8).setOverflowType(OverflowType.SCROLL)
|
||||
.setScrollPlace(ScrollPlace.INSIDE)
|
||||
.setTrackTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 0, 97, 11, 8).build(), 3, 4)
|
||||
.setThumbTexture(new DrawableBuilder("nei:textures/nei_sprites.png", 12, 97, 9, 7).build(), 3, 2)
|
||||
.setThumbPadding(1);
|
||||
@@ -83,31 +81,13 @@ public class ScrollBar {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScrollBar setPadding(int padding) {
|
||||
this.padding = padding;
|
||||
public ScrollBar setMargin(int margin) {
|
||||
this.margin = margin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getPadding() {
|
||||
return this.padding;
|
||||
}
|
||||
|
||||
public ScrollBar setMarginStart(int start) {
|
||||
this.marginStart = start;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMarginStart() {
|
||||
return this.marginStart;
|
||||
}
|
||||
|
||||
public ScrollBar setMarginEnd(int end) {
|
||||
this.marginEnd = end;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMarginEnd() {
|
||||
return this.marginEnd;
|
||||
public int getMargin() {
|
||||
return this.margin;
|
||||
}
|
||||
|
||||
public int getScrollbarSize() {
|
||||
@@ -173,9 +153,22 @@ public class ScrollBar {
|
||||
|
||||
private int getMaxTrackSize(ScrollContainer container) {
|
||||
if (this.scrollType == ScrollType.HORIZONTAL) {
|
||||
return container.w - this.marginStart - this.marginEnd;
|
||||
int visibleSize = container.w;
|
||||
|
||||
if (container.canScrollVertical() && container.getVerticalScroll().getScrollPlace() == ScrollPlace.INSIDE) {
|
||||
visibleSize -= container.getVerticalScroll().getScrollbarSize();
|
||||
}
|
||||
|
||||
return visibleSize;
|
||||
} else {
|
||||
return container.h - this.marginStart - this.marginEnd;
|
||||
int visibleSize = container.h;
|
||||
|
||||
if (container.canScrollHorizontal()
|
||||
&& container.getHorizontalScroll().getScrollPlace() == ScrollPlace.INSIDE) {
|
||||
visibleSize -= container.getHorizontalScroll().getScrollbarSize();
|
||||
}
|
||||
|
||||
return visibleSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,41 +205,23 @@ public class ScrollBar {
|
||||
}
|
||||
|
||||
public Rectangle4i trackBounds(ScrollContainer container) {
|
||||
|
||||
if (this.scrollType == ScrollType.HORIZONTAL) {
|
||||
|
||||
if (this.scrollPlace == ScrollPlace.START) {
|
||||
return new Rectangle4i(
|
||||
container.x + this.marginStart,
|
||||
container.y - this.padding - this.scrollbarSize,
|
||||
getMaxTrackSize(container),
|
||||
this.scrollbarSize);
|
||||
} else {
|
||||
return new Rectangle4i(
|
||||
container.x + this.marginStart,
|
||||
container.y + container.h + this.padding,
|
||||
getMaxTrackSize(container),
|
||||
this.scrollbarSize);
|
||||
}
|
||||
|
||||
return new Rectangle4i(
|
||||
container.x,
|
||||
container.y + container.h
|
||||
+ this.margin
|
||||
- (this.scrollPlace == ScrollPlace.INSIDE ? scrollbarSize : 0),
|
||||
getMaxTrackSize(container),
|
||||
scrollbarSize);
|
||||
} else {
|
||||
|
||||
if (this.scrollPlace == ScrollPlace.START) {
|
||||
return new Rectangle4i(
|
||||
container.x - this.padding - this.scrollbarSize,
|
||||
container.y + this.marginStart,
|
||||
this.scrollbarSize,
|
||||
getMaxTrackSize(container));
|
||||
} else {
|
||||
return new Rectangle4i(
|
||||
container.x + container.w + this.padding,
|
||||
container.y + this.marginStart,
|
||||
this.scrollbarSize,
|
||||
getMaxTrackSize(container));
|
||||
}
|
||||
|
||||
return new Rectangle4i(
|
||||
container.x + container.w
|
||||
+ this.margin
|
||||
- (this.scrollPlace == ScrollPlace.INSIDE ? scrollbarSize : 0),
|
||||
container.y,
|
||||
scrollbarSize,
|
||||
getMaxTrackSize(container));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Rectangle4i thumbBounds(ScrollContainer container) {
|
||||
@@ -413,36 +388,9 @@ public class ScrollBar {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (this.scrollType == ScrollType.HORIZONTAL) {
|
||||
|
||||
if (this.scrollPlace == ScrollPlace.START) {
|
||||
texture.draw(
|
||||
bounds.x,
|
||||
bounds.y + (bounds.h - texture.getHeight()) / 2,
|
||||
bounds.w,
|
||||
texture.getHeight(),
|
||||
sliceStart,
|
||||
sliceEnd,
|
||||
0,
|
||||
0);
|
||||
} else {
|
||||
texture.draw(bounds.x, bounds.y, bounds.w, texture.getHeight(), sliceStart, sliceEnd, 0, 0);
|
||||
}
|
||||
|
||||
texture.draw(bounds.x, bounds.y, bounds.w, texture.getHeight(), sliceStart, sliceEnd, 0, 0);
|
||||
} else {
|
||||
|
||||
if (this.scrollPlace == ScrollPlace.START) {
|
||||
texture.draw(
|
||||
bounds.x + (bounds.w - texture.getWidth()) / 2,
|
||||
bounds.y,
|
||||
texture.getWidth(),
|
||||
bounds.h,
|
||||
0,
|
||||
0,
|
||||
sliceStart,
|
||||
sliceEnd);
|
||||
} else {
|
||||
texture.draw(bounds.x, bounds.y, texture.getWidth(), bounds.h, 0, 0, sliceStart, sliceEnd);
|
||||
}
|
||||
texture.draw(bounds.x, bounds.y, texture.getWidth(), bounds.h, 0, 0, sliceStart, sliceEnd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.WidgetContainer;
|
||||
import codechicken.nei.scroll.ScrollBar.OverflowType;
|
||||
import codechicken.nei.scroll.ScrollBar.ScrollPlace;
|
||||
import codechicken.nei.scroll.ScrollBar.ScrollType;
|
||||
|
||||
public class ScrollContainer extends WidgetContainer {
|
||||
@@ -33,10 +34,8 @@ public class ScrollContainer extends WidgetContainer {
|
||||
protected int actualWidth = 0;
|
||||
protected int actualHeight = 0;
|
||||
|
||||
protected int paddingInlineStart = 0;
|
||||
protected int paddingInlineEnd = 0;
|
||||
protected int paddingBlockStart = 0;
|
||||
protected int paddingBlockEnd = 0;
|
||||
protected int marginInline = 0;
|
||||
protected int marginBlock = 0;
|
||||
|
||||
protected final Map<Widget, Point> relativePostion = new HashMap<>();
|
||||
protected ScrollBar horizontalScrollBar;
|
||||
@@ -46,36 +45,30 @@ public class ScrollContainer extends WidgetContainer {
|
||||
public Rectangle4i boundsOutside() {
|
||||
int width = this.w;
|
||||
int height = this.h;
|
||||
int x = this.x;
|
||||
int y = this.y;
|
||||
|
||||
if (canScrollVertical() && (this.verticalScrollBar.getOverflowType() == OverflowType.SCROLL
|
||||
|| this.verticalScrollBar.getOverflowType() == OverflowType.AUTO)) {
|
||||
final Rectangle4i trackBounds = this.verticalScrollBar.trackBounds(this);
|
||||
x = Math.min(x, trackBounds.x);
|
||||
y = Math.min(y, trackBounds.y);
|
||||
height = Math.max(this.y + height, trackBounds.y + trackBounds.h) - y;
|
||||
width = Math.max(this.x + width, trackBounds.x + trackBounds.w) - x;
|
||||
width += this.verticalScrollBar.getMargin();
|
||||
|
||||
if (this.verticalScrollBar.getScrollPlace() == ScrollPlace.OUTSIDE) {
|
||||
width += this.verticalScrollBar.getScrollbarSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (canScrollHorizontal() && (this.horizontalScrollBar.getOverflowType() == OverflowType.SCROLL
|
||||
|| this.horizontalScrollBar.getOverflowType() == OverflowType.AUTO)) {
|
||||
final Rectangle4i trackBounds = this.horizontalScrollBar.trackBounds(this);
|
||||
x = Math.min(x, trackBounds.x);
|
||||
y = Math.min(y, trackBounds.y);
|
||||
height = Math.max(this.y + height, trackBounds.y + trackBounds.h) - y;
|
||||
width = Math.max(this.x + width, trackBounds.x + trackBounds.w) - x;
|
||||
height += this.horizontalScrollBar.getMargin();
|
||||
|
||||
if (this.horizontalScrollBar.getScrollPlace() == ScrollPlace.OUTSIDE) {
|
||||
height += this.horizontalScrollBar.getScrollbarSize();
|
||||
}
|
||||
}
|
||||
|
||||
return new Rectangle4i(x, y, width, height);
|
||||
}
|
||||
|
||||
public Rectangle4i boundsInside() {
|
||||
return new Rectangle4i(
|
||||
x + this.paddingInlineStart,
|
||||
y + this.paddingBlockStart,
|
||||
getVisibleWidth(),
|
||||
getVisibleHeight());
|
||||
return new Rectangle4i(x, y, getVisibleWidth(), getVisibleHeight());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,18 +92,31 @@ public class ScrollContainer extends WidgetContainer {
|
||||
return this.relativePostion.get(widget);
|
||||
}
|
||||
|
||||
public void setPaddingInline(int start, int end) {
|
||||
this.paddingInlineStart = start;
|
||||
this.paddingInlineEnd = end;
|
||||
public void setMarginInline(int marginInline) {
|
||||
this.marginInline = marginInline;
|
||||
}
|
||||
|
||||
public void setPaddingBlock(int start, int end) {
|
||||
this.paddingBlockStart = start;
|
||||
this.paddingBlockEnd = end;
|
||||
public void setMarginBlock(int marginBlock) {
|
||||
this.marginBlock = marginBlock;
|
||||
}
|
||||
|
||||
public int getMarginInline() {
|
||||
return this.marginInline;
|
||||
}
|
||||
|
||||
public int getMarginBlock() {
|
||||
return this.marginBlock;
|
||||
}
|
||||
|
||||
public int getVisibleWidth() {
|
||||
return this.w - this.paddingInlineStart - this.paddingInlineEnd;
|
||||
|
||||
if (canScrollVertical() && this.verticalScrollBar.getScrollPlace() == ScrollPlace.INSIDE
|
||||
&& (this.verticalScrollBar.getOverflowType() == OverflowType.SCROLL
|
||||
|| this.verticalScrollBar.getOverflowType() == OverflowType.AUTO)) {
|
||||
return this.w - this.verticalScrollBar.getScrollbarSize();
|
||||
}
|
||||
|
||||
return this.w;
|
||||
}
|
||||
|
||||
public int getActualWidth() {
|
||||
@@ -119,7 +125,7 @@ public class ScrollContainer extends WidgetContainer {
|
||||
|
||||
public boolean setHorizontalScrollOffset(int offset) {
|
||||
|
||||
if (!canScrollHorizontal() && getVisibleWidth() < getActualWidth()) {
|
||||
if (!canScrollHorizontal() && this.w < getActualWidth()) {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
@@ -144,9 +150,9 @@ public class ScrollContainer extends WidgetContainer {
|
||||
}
|
||||
|
||||
public boolean canScrollHorizontal() {
|
||||
return this.horizontalScrollBar != null && (this.horizontalScrollBar.getOverflowType() != OverflowType.NONE
|
||||
&& getVisibleWidth() < getActualWidth()
|
||||
|| this.horizontalScrollBar.getOverflowType() == OverflowType.SCROLL);
|
||||
return this.horizontalScrollBar != null
|
||||
&& (this.horizontalScrollBar.getOverflowType() != OverflowType.NONE && this.w < getActualWidth()
|
||||
|| this.horizontalScrollBar.getOverflowType() == OverflowType.SCROLL);
|
||||
}
|
||||
|
||||
public ScrollBar getHorizontalScroll() {
|
||||
@@ -168,7 +174,14 @@ public class ScrollContainer extends WidgetContainer {
|
||||
}
|
||||
|
||||
public int getVisibleHeight() {
|
||||
return this.h - this.paddingBlockStart - this.paddingBlockEnd;
|
||||
|
||||
if (canScrollHorizontal() && this.horizontalScrollBar.getScrollPlace() == ScrollPlace.INSIDE
|
||||
&& (this.horizontalScrollBar.getOverflowType() == OverflowType.SCROLL
|
||||
|| this.horizontalScrollBar.getOverflowType() == OverflowType.AUTO)) {
|
||||
return this.h - this.horizontalScrollBar.getScrollbarSize();
|
||||
}
|
||||
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public int getActualHeight() {
|
||||
@@ -177,7 +190,7 @@ public class ScrollContainer extends WidgetContainer {
|
||||
|
||||
public boolean setVerticalScrollOffset(int offset) {
|
||||
|
||||
if (!canScrollVertical() && getVisibleHeight() < getActualHeight()) {
|
||||
if (!canScrollVertical() && this.h < getActualHeight()) {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
@@ -202,9 +215,9 @@ public class ScrollContainer extends WidgetContainer {
|
||||
}
|
||||
|
||||
public boolean canScrollVertical() {
|
||||
return this.verticalScrollBar != null && (this.verticalScrollBar.getOverflowType() != OverflowType.NONE
|
||||
&& getVisibleHeight() < getActualHeight()
|
||||
|| this.verticalScrollBar.getOverflowType() == OverflowType.SCROLL);
|
||||
return this.verticalScrollBar != null
|
||||
&& (this.verticalScrollBar.getOverflowType() != OverflowType.NONE && this.h < getActualHeight()
|
||||
|| this.verticalScrollBar.getOverflowType() == OverflowType.SCROLL);
|
||||
}
|
||||
|
||||
public ScrollBar getVerticalScroll() {
|
||||
@@ -232,13 +245,13 @@ public class ScrollContainer extends WidgetContainer {
|
||||
|
||||
if (canScrollVertical || canScrollHorizontal) {
|
||||
GuiHelper.useScissor(
|
||||
this.x + this.paddingInlineStart,
|
||||
this.y + this.paddingBlockStart,
|
||||
this.w - this.paddingInlineStart - this.paddingInlineEnd,
|
||||
this.h - this.paddingBlockStart - this.paddingBlockEnd,
|
||||
this.x,
|
||||
this.y,
|
||||
getVisibleWidth(),
|
||||
getVisibleHeight(),
|
||||
() -> drawContent(mousex, mousey));
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
if (canScrollVertical) {
|
||||
this.verticalScrollBar.draw(this, mousex, mousey, getScrollBarOpacity());
|
||||
@@ -282,15 +295,12 @@ public class ScrollContainer extends WidgetContainer {
|
||||
|
||||
super.update();
|
||||
|
||||
final int x = this.x + this.paddingInlineStart - this.xScroll;
|
||||
final int y = this.y + this.paddingBlockStart - this.yScroll;
|
||||
|
||||
for (Widget widget : this.widgets) {
|
||||
this.actualWidth = Math.max(this.actualWidth, widget.x + widget.w);
|
||||
this.actualHeight = Math.max(this.actualHeight, widget.y + widget.h);
|
||||
this.actualWidth = Math.max(this.actualWidth, widget.x + widget.w + this.marginInline * 2);
|
||||
this.actualHeight = Math.max(this.actualHeight, widget.y + widget.h + this.marginBlock * 2);
|
||||
|
||||
widget.x += x;
|
||||
widget.y += y;
|
||||
widget.x += this.marginInline + this.x - this.xScroll;
|
||||
widget.y += this.marginBlock + this.y - this.yScroll;
|
||||
}
|
||||
|
||||
if (this.fade > 0) {
|
||||
|
||||
@@ -20,7 +20,7 @@ import codechicken.nei.api.ItemFilter;
|
||||
public class ItemFilterVisitor extends AbstractSearchExpressionVisitor<ItemFilter> {
|
||||
|
||||
private static final Pattern REGEX_ESCAPED_SPACE_PATTERN = Pattern.compile("([^\\\\](?:\\\\\\\\)+)?\\\\ ");
|
||||
private static final Pattern ESCAPED_SYMBOL_PATTERN = Pattern.compile("\\\\(.)");
|
||||
private static final Pattern PLAIN_TEXT_ESCAPED_PATTERN = Pattern.compile("\\\\(.)");
|
||||
private static final Pattern ESCAPED_QUOTE_PATTERN = Pattern.compile("\\\\\"");
|
||||
private static final Pattern ESCAPED_SPACE_PATTERN = Pattern.compile("\\\\ ");
|
||||
|
||||
@@ -69,21 +69,21 @@ public class ItemFilterVisitor extends AbstractSearchExpressionVisitor<ItemFilte
|
||||
@Override
|
||||
public ItemFilter visitPrefixedExpression(SearchExpressionParser.PrefixedExpressionContext ctx) {
|
||||
if (ctx.token() != null) {
|
||||
final String cleanPattern = getCleanPattern(ctx.token());
|
||||
final String cleanText = getTokenCleanText(ctx.token());
|
||||
final SearchTokenParser.ISearchParserProvider provider = searchParser.getProvider(ctx.token().prefix);
|
||||
if (cleanPattern == null || provider == null) {
|
||||
if (cleanText == null || provider == null) {
|
||||
return defaultResult();
|
||||
}
|
||||
return provider.getFilter(cleanPattern);
|
||||
return provider.getFilter(cleanText);
|
||||
}
|
||||
return defaultResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFilter visitToken(SearchExpressionParser.TokenContext ctx) {
|
||||
final String cleanPattern = getCleanPattern(ctx);
|
||||
if (cleanPattern != null) {
|
||||
return getAlwaysProvidersFilter(cleanPattern);
|
||||
final String cleanText = getTokenCleanText(ctx);
|
||||
if (cleanText != null) {
|
||||
return getAlwaysProvidersFilter(cleanText);
|
||||
}
|
||||
return defaultResult();
|
||||
}
|
||||
@@ -118,36 +118,36 @@ public class ItemFilterVisitor extends AbstractSearchExpressionVisitor<ItemFilte
|
||||
return constructFilter(filters, AllMultiItemFilter::new);
|
||||
}
|
||||
|
||||
private String getCleanPattern(SearchExpressionParser.TokenContext ctx) {
|
||||
String cleanPattern = null;
|
||||
if (ctx.plainText() != null) {
|
||||
cleanPattern = Pattern.quote(
|
||||
ESCAPED_SYMBOL_PATTERN.matcher(ctx.plainText().getText())
|
||||
private String getTokenCleanText(SearchExpressionParser.TokenContext ctx) {
|
||||
String cleanText = null;
|
||||
if (ctx.PLAIN_TEXT() != null) {
|
||||
cleanText = Pattern.quote(
|
||||
PLAIN_TEXT_ESCAPED_PATTERN.matcher(ctx.PLAIN_TEXT().getSymbol().getText())
|
||||
// Unescape everything in search expression
|
||||
.replaceAll("$1"));
|
||||
} else if (ctx.regex() != null) {
|
||||
if (ctx.regex().REGEX_CONTENT() != null) {
|
||||
cleanPattern = ctx.regex().REGEX_CONTENT().getSymbol().getText();
|
||||
cleanText = ctx.regex().REGEX_CONTENT().getSymbol().getText();
|
||||
final int spaceModeEnabled = NEIClientConfig.getIntSetting("inventory.search.spaceMode");
|
||||
// Unescape spaces
|
||||
if (spaceModeEnabled == 1) {
|
||||
cleanPattern = REGEX_ESCAPED_SPACE_PATTERN.matcher(cleanPattern).replaceAll("$1 ");
|
||||
cleanText = REGEX_ESCAPED_SPACE_PATTERN.matcher(cleanText).replaceAll("$1 ");
|
||||
}
|
||||
}
|
||||
} else if (ctx.quoted() != null) {
|
||||
if (ctx.quoted().QUOTED_CONTENT() != null) {
|
||||
cleanPattern = ctx.quoted().QUOTED_CONTENT().getSymbol().getText();
|
||||
cleanText = ctx.quoted().QUOTED_CONTENT().getSymbol().getText();
|
||||
// Unescape quotes
|
||||
cleanPattern = ESCAPED_QUOTE_PATTERN.matcher(cleanPattern).replaceAll("\"");
|
||||
cleanPattern = Pattern.quote(cleanPattern);
|
||||
cleanText = ESCAPED_QUOTE_PATTERN.matcher(cleanText).replaceAll("\"");
|
||||
cleanText = Pattern.quote(cleanText);
|
||||
final int spaceModeEnabled = NEIClientConfig.getIntSetting("inventory.search.spaceMode");
|
||||
// Unescape spaces
|
||||
if (spaceModeEnabled == 1) {
|
||||
cleanPattern = ESCAPED_SPACE_PATTERN.matcher(cleanPattern).replaceAll(" ");
|
||||
cleanText = ESCAPED_SPACE_PATTERN.matcher(cleanText).replaceAll(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return cleanPattern;
|
||||
return cleanText;
|
||||
}
|
||||
|
||||
private ItemFilter visitChildren(ParserRuleContext node, Function<List<ItemFilter>, ItemFilter> filterConstructor) {
|
||||
|
||||
@@ -62,8 +62,8 @@ public class SearchExpressionFormatVisitor extends AbstractSearchExpressionVisit
|
||||
private String getTokenCleanText(SearchExpressionParser.TokenContext ctx, Character prefix) {
|
||||
String cleanText = null;
|
||||
final int spaceModeEnabled = NEIClientConfig.getIntSetting("inventory.search.spaceMode");
|
||||
if (ctx.plainText() != null) {
|
||||
cleanText = ctx.plainText().getText();
|
||||
if (ctx.PLAIN_TEXT() != null) {
|
||||
cleanText = ctx.PLAIN_TEXT().getSymbol().getText();
|
||||
// Unescape spaces
|
||||
if (spaceModeEnabled == 1) {
|
||||
cleanText = ESCAPED_SPACE_PATTERN.matcher(cleanText).replaceAll(" ");
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# This file contains a list of GUIs that can use the DefaultBookmarkContainerHandler for bookmarks.
|
||||
# It serves as an alternative to API.registerBookmarkContainerHandler and is intended for cases
|
||||
# where you can't modify the mod itself and its GUI doesn't have custom slots.
|
||||
# Each line in this file should either be a comment (starting with '#') or a guiContainer class name.
|
||||
# If you delete this file, it will be regenerated with the default bookmark containers list.
|
||||
@@ -1,5 +1,4 @@
|
||||
# This file contains a list of GUIs for which craftable item panels will not work.
|
||||
# Each line in this file should either be a comment (line starts with '#'), or guiContainer class name.
|
||||
# Each line in this file should either be a comment (line starts with '#'), handler name or handler id.
|
||||
# If you delete this file, it will be regenerated with the default handlers list.
|
||||
appeng.client.gui.implementations.GuiPatternTerm
|
||||
appeng.client.gui.implementations.GuiPatternTermEx
|
||||
|
||||
@@ -65,7 +65,6 @@ nei.itempanel.open_crafting=Recipe to make this item
|
||||
nei.itempanel.open_usage=Recipes that use this item
|
||||
nei.itempanel.copy_name=Copy Item Name
|
||||
nei.itempanel.copy_oredict=Copy Item OreDictionary
|
||||
nei.itempanel.copy_id=Copy Item ID
|
||||
nei.itempanel.chat_link_item=Send item link to chat
|
||||
|
||||
nei.enchant=Enchant
|
||||
@@ -193,7 +192,6 @@ nei.options.keys.gui.next_tooltip=Next Tooltip
|
||||
nei.options.keys.gui.copy_name=Copy Item Name
|
||||
nei.options.keys.gui.craft_items=Craft Items
|
||||
nei.options.keys.gui.copy_oredict=Copy Item OreDictionary
|
||||
nei.options.keys.gui.copy_id=Copy Item ID
|
||||
nei.options.keys.gui.chat_link_item=Send item link to chat
|
||||
nei.options.keys.gui.itemzoom_toggle=Toggle Item Zoom
|
||||
nei.options.keys.gui.itemzoom_hold=Hold to Display Item Zoom
|
||||
@@ -231,12 +229,8 @@ nei.options.inventory.bookmarks.recipeTooltipsMode.2=In Vertical View
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.3=Always
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode=Show Recipe Marker
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.0=None
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.1=Text
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.1=Icon
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.2=Background
|
||||
nei.options.inventory.bookmarks.showRecipeHandlerIcon=Show Handler Icon
|
||||
nei.options.inventory.bookmarks.showRecipeHandlerIcon.true=Yes
|
||||
nei.options.inventory.bookmarks.showRecipeHandlerIcon.false=No
|
||||
|
||||
nei.options.inventory.bookmarks.recipeMarkerColor=Recipe Marker Color
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap=Ignore overlap with potion effect HUD
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap.true=Yes
|
||||
@@ -282,9 +276,8 @@ 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.jeiStyleRecipeCatalyst=JEI Style Recipe Catalysts
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.0=None
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.1=Grid
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.2=Scroll
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.true=Yes
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.false=No
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip=Cycled Ingredients Tooltip
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.true=Show
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.false=Hide
|
||||
@@ -353,6 +346,9 @@ nei.options.inventory.optimize_gui_overlap_computation.false=No
|
||||
nei.options.inventory.autocrafting=Autocrafting
|
||||
nei.options.inventory.autocrafting.true=Enabled
|
||||
nei.options.inventory.autocrafting.false=Disabled
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients=JEI styled cycled ingredients
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.true=Yes
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.false=No
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe=Require holding shift to move items when overlaying recipe
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.true=Yes
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.false=No
|
||||
|
||||
@@ -179,7 +179,7 @@ nei.options.inventory.bookmarks.recipeTooltipsMode.2=В вертикальном
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.3=Всегда
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode=Показывать маркер рецепта
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.0=Нет
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.1=Текст
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.1=Иконка
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.2=Фон
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap=Игнорировать перекрытие с HUD эффектов зелий
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap.true=Да
|
||||
@@ -199,9 +199,8 @@ nei.options.inventory.guirecipe.slotHighlightPresent=Подсвечивать п
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent.true=Да
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent.false=Нет
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst=Катализаторы рецептов в стиле JEI
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.0=Нет
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.1=Грид
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.2=Скролл
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.true=Да
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.false=Нет
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip=Подсказка циклических ингредиентов
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.true=Показывать
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.false=Скрыть
|
||||
@@ -249,6 +248,9 @@ nei.options.inventory.guirecipe.creativeTabStyle.false=JEI
|
||||
nei.options.inventory.optimize_gui_overlap_computation=Оптимизация вычислений при перекрытии GUI
|
||||
nei.options.inventory.optimize_gui_overlap_computation.true=Да
|
||||
nei.options.inventory.optimize_gui_overlap_computation.false=Нет
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients=Циклические ингредиенты в стиле JEI
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.true=Да
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.false=Нет
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe=Требовать удержание Shift для перемещения предметов при отображении рецепта
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.true=Да
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.false=Нет
|
||||
|
||||
@@ -111,7 +111,6 @@ nei.options.keys.gui.getprevioussearch=上一个搜索
|
||||
nei.options.keys.gui.getnextsearch=下一个搜索
|
||||
nei.options.keys.gui.copy_name=复制物品名称
|
||||
nei.options.keys.gui.copy_oredict=复制物品矿词词典
|
||||
nei.options.keys.gui.copy_id=复制物品ID
|
||||
nei.options.keys.world=世界
|
||||
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
|
||||
nei.options.keys.world.moboverlay=刷怪区域显示
|
||||
@@ -136,6 +135,8 @@ nei.options.inventory.guirecipe.jeiStyleTabs=JEI标签页
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.true=是
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.false=否 [不会吧]
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst=JEI风格可执行合成表机器显示[测试中]
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.true=是
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.false=否
|
||||
nei.options.inventory.bookmarks.animation=REI风格书签动画
|
||||
nei.options.inventory.bookmarks.animation.true=是
|
||||
nei.options.inventory.bookmarks.animation.false=否
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -88,11 +88,6 @@ public class SearchTokenParserTest {
|
||||
protected String getIdentifier(ItemStack stack) {
|
||||
return getStringIdentifier(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PREFIX(" + pattern.toString() + ")";
|
||||
}
|
||||
};
|
||||
|
||||
private static MockedStatic<NEIClientConfig> config;
|
||||
@@ -289,14 +284,12 @@ public class SearchTokenParserTest {
|
||||
searchParser.addProvider(defaultParserProvider);
|
||||
searchParser
|
||||
.addProvider(parserProvider('?', "custom", SearchTokenParser.SearchMode.PREFIX, customCreateFilter));
|
||||
searchParser
|
||||
.addProvider(parserProvider('*', "custom2", SearchTokenParser.SearchMode.PREFIX, customCreateFilter));
|
||||
|
||||
Set<ItemStack> matchedItems = testFilterAgainstAllItems(
|
||||
spaceMode,
|
||||
patternMode,
|
||||
searchParser,
|
||||
"\"" + itemA.getDisplayName() + "\"?A*A");
|
||||
"\"" + itemA.getDisplayName() + "\"?A");
|
||||
|
||||
assertEquals(1, matchedItems.size());
|
||||
assertTrue(matchedItems.contains(itemA));
|
||||
|
||||
Reference in new issue
Block a user