mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 10:44:45 +00:00
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ea9ae1eb9 | ||
|
|
f7f0596fda | ||
|
|
d5e919a9cd | ||
|
|
a0ed5da699 | ||
|
|
99fb5a656e | ||
|
|
4b663222b1 | ||
|
|
3e5d0088bc | ||
|
|
948be399d2 | ||
|
|
5f6091924d | ||
|
|
c5bd1f897a | ||
|
|
61d4b6ab62 | ||
|
|
791d05d5f5 | ||
|
|
66001275c4 | ||
|
|
db6b83c906 | ||
|
|
58ef6c85e0 |
No files matched your search
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.4.7:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.6.39:dev')
|
||||
implementation('com.github.GTNewHorizons:GTNHLib:0.7.0:dev')
|
||||
|
||||
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
|
||||
|
||||
|
||||
@@ -18,20 +18,22 @@ 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 : '\\' . ;
|
||||
|
||||
fragment ESCAPED_SYMBOL : '\\' . ;
|
||||
fragment CLEAN_SYMBOL : ~[-<>^{}|/\\ "] ;
|
||||
PREFIX : CLEAN_SYMBOL {searchParser.hasRedefinedPrefix(getText().charAt(0))}? ;
|
||||
CLEAN_SYMBOL : ~[-<>^{}|/\\ "] ;
|
||||
|
||||
mode REGEX;
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ prefixedExpression
|
||||
token[Character prefix]
|
||||
: regex[prefix]
|
||||
| quoted[prefix]
|
||||
| PLAIN_TEXT
|
||||
| plainText
|
||||
;
|
||||
|
||||
regex[Character prefix]
|
||||
@@ -67,4 +67,7 @@ quoted[Character prefix]
|
||||
: QUOTE_LEFT QUOTED_CONTENT QUOTE_RIGHT?
|
||||
;
|
||||
|
||||
plainText
|
||||
: (CLEAN_SYMBOL | ESCAPED_SYMBOL)+
|
||||
;
|
||||
|
||||
@@ -185,22 +185,24 @@ 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)) {
|
||||
final long multiplier = this.grid.getBookmarkItem(i).getMultiplier();
|
||||
factor *= multiplier;
|
||||
count *= this.grid.getBookmarkItem(i).getMultiplier();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if (factor == 0) {
|
||||
factor = nbTag.hasKey("gtFluidName") ? Math.min(144, nbTag.getInteger("Count")) : 1;
|
||||
}
|
||||
|
||||
this.grid.addItem(BookmarkItem.of(groupId, itemStack, factor, recipeId, false), true);
|
||||
this.grid.addItem(
|
||||
BookmarkItem.of(groupId, StackInfo.withAmount(itemStack, count), factor, recipeId, false),
|
||||
true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,8 +180,9 @@ public class ClientHandler {
|
||||
new InputStreamReader(res.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
NEIClientConfig.logger.info("Loading '{}' from jar {}", resource, location);
|
||||
callback.accept(
|
||||
IOUtils.readLines(reader).stream().map(String::trim)
|
||||
.filter(line -> !line.isEmpty() && !line.startsWith("#")));
|
||||
IOUtils.readLines(reader).stream()
|
||||
.map(line -> line.contains("#") ? line.substring(0, line.indexOf('#')) : line)
|
||||
.map(String::trim).filter(line -> !line.isEmpty()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -209,8 +210,9 @@ public class ClientHandler {
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
NEIClientConfig.logger.info("Loading '{}' file {}", resource, file);
|
||||
callback.accept(
|
||||
IOUtils.readLines(reader).stream().map(String::trim)
|
||||
.filter(line -> !line.isEmpty() && !line.startsWith("#")));
|
||||
IOUtils.readLines(reader).stream()
|
||||
.map(line -> line.contains("#") ? line.substring(0, line.indexOf('#')) : line)
|
||||
.map(String::trim).filter(line -> !line.isEmpty()));
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to load '{}' file {}", resource, file, e);
|
||||
|
||||
@@ -20,6 +20,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ListMultimap;
|
||||
@@ -31,6 +32,7 @@ import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.recipe.InformationHandler;
|
||||
import codechicken.nei.search.TooltipFilter;
|
||||
import codechicken.nei.util.ItemUntranslator;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
public class ItemList {
|
||||
|
||||
@@ -297,6 +299,57 @@ public class ItemList {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void runChecked(ItemStack stack, Runnable action, String reason) {
|
||||
int hashOld = 0;
|
||||
if (stack.hasTagCompound()) {
|
||||
hashOld = stack.stackTagCompound.hashCode();
|
||||
}
|
||||
|
||||
action.run();
|
||||
|
||||
if (stack.hasTagCompound() && hashOld != stack.stackTagCompound.hashCode()) {
|
||||
FMLLog.warning("NEI: Forced tag update with reason (" + reason + ") for " + stack);
|
||||
}
|
||||
}
|
||||
|
||||
private void forceTagCompoundInitialization(ItemStack stack) {
|
||||
Item item = stack.getItem();
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
if (item instanceof IFluidContainerItem) {
|
||||
IFluidContainerItem fluidItem = (IFluidContainerItem) item;
|
||||
runChecked(stack, () -> fluidItem.getFluid(stack), "getFluid");
|
||||
}
|
||||
runChecked(stack, () -> item.isDamaged(stack), "isDamaged");
|
||||
runChecked(stack, () -> item.getDamage(stack), "getDamage");
|
||||
runChecked(stack, () -> item.showDurabilityBar(stack), "showDurabilityBar");
|
||||
runChecked(stack, () -> item.getAttributeModifiers(stack), "getAttributeModifiers");
|
||||
runChecked(stack, () -> item.getDurabilityForDisplay(stack), "getDurabilityForDisplay");
|
||||
runChecked(stack, () -> item.getItemStackLimit(stack), "getItemStackLimit");
|
||||
runChecked(stack, () -> item.getToolClasses(stack), "getToolClasses");
|
||||
runChecked(stack, () -> item.getUnlocalizedNameInefficiently(stack), "getUnlocalizedNameInefficiently");
|
||||
runChecked(stack, () -> item.hasEffect(stack), "hasEffect");
|
||||
|
||||
/*
|
||||
* unused... for now runChecked(stack, () -> GameRegistry.getFuelValue(stack), "getFuelValue");
|
||||
* runChecked(stack, () -> item.getUnlocalizedName(stack), "getUnlocalizedName"); runChecked(stack, () ->
|
||||
* item.doesContainerItemLeaveCraftingGrid(stack), "doesContainerItemLeaveCraftingGrid"); runChecked(stack,
|
||||
* () -> item.getItemUseAction(stack), "getItemUseAction"); runChecked(stack, () ->
|
||||
* item.getMaxItemUseDuration(stack), "getMaxItemUseDuration"); runChecked(stack, () ->
|
||||
* item.getPotionEffect(stack), "getPotionEffect"); runChecked(stack, () -> item.isPotionIngredient(stack),
|
||||
* "isPotionIngredient"); runChecked(stack, () -> item.getRarity(stack), "getRarity"); runChecked(stack, ()
|
||||
* -> item.hasCustomEntity(stack), "hasCustomEntity"); runChecked(stack, () ->
|
||||
* item.getSmeltingExperience(stack), "getSmeltingExperience"); runChecked(stack, () ->
|
||||
* item.getMaxDamage(stack), "getMaxDamage"); runChecked(stack, () -> item.getDamage(stack), "getDamage");
|
||||
* runChecked(stack, stack::isItemDamaged, "isItemDamaged"); runChecked(stack, () -> item.hasEffect(stack,
|
||||
* 0), "hasEffect"); runChecked(stack, () -> item.getItemEnchantability(stack), "getItemEnchantability");
|
||||
* runChecked(stack, () -> item.isBeaconPayment(stack), "isBeaconPayment"); runChecked(stack, () ->
|
||||
* item.getDamage(stack), "getDamage"); runChecked(stack, () -> item.getDamage(stack), "getDamage");
|
||||
* runChecked(stack, () -> item.getDamage(stack), "getDamage");
|
||||
*/
|
||||
}
|
||||
|
||||
// Generate itemlist, permutations, orders, collapsibleitems, and informationhandler stacks
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -336,6 +389,8 @@ public class ItemList {
|
||||
items.add(stack);
|
||||
}
|
||||
|
||||
forceTagCompoundInitialization(stack);
|
||||
|
||||
CollapsibleItems.putItem(stack);
|
||||
TooltipFilter.getSearchTooltip(stack);
|
||||
InformationHandler.populateStacks(stack);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GuiContainerManager.enable2DRender();
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.showName")) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
}
|
||||
|
||||
public void captureScreen(Runnable callback, int mode) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
|
||||
resetFramebuffer();
|
||||
this.framebuffer.bindFramebuffer(false);
|
||||
@@ -281,8 +281,6 @@ 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() {
|
||||
@@ -360,9 +358,6 @@ 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) {
|
||||
@@ -566,12 +561,6 @@ 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,
|
||||
@@ -586,7 +575,4 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
return !isInvalidSlot(columns * getRowIndex(py) + getColumnIndex(px));
|
||||
}
|
||||
|
||||
public String getMessageOnEmpty() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ 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;
|
||||
@@ -237,9 +238,18 @@ public class ItemsPanelGrid extends ItemsGrid<ItemsPanelGrid.ItemsPanelGridSlot,
|
||||
Math.min((int) (color.getAlpha() + (255f / 5) * 2), 255));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageOnEmpty() {
|
||||
return ItemList.loadFinished ? null : NEIClientUtils.translate("itempanel.loading");
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
fontRenderer.drawStringWithShadow(this.labelColor + this.label + ":", x, y, 0);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
|
||||
@@ -147,6 +147,8 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.widgetsenabled").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.widgetsenabled"));
|
||||
|
||||
tag.getTag("findFuelsParallel").getBooleanValue(true);
|
||||
|
||||
tag.getTag("inventory.autocrafting").getBooleanValue(true);
|
||||
tag.getTag("inventory.dynamicFontSize").getBooleanValue(true);
|
||||
tag.getTag("inventory.hidden").getBooleanValue(false);
|
||||
@@ -207,6 +209,10 @@ 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));
|
||||
|
||||
@@ -880,6 +886,10 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static void unloadWorld() {
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ItemPanels.bookmarkPanel != null) {
|
||||
ItemPanels.bookmarkPanel.save();
|
||||
}
|
||||
@@ -890,6 +900,8 @@ public class NEIClientConfig {
|
||||
|
||||
if (world != null) {
|
||||
world.saveNBT();
|
||||
NEIClientConfig.worldPath = null;
|
||||
world = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ public class NEIController implements IContainerSlotClickHandler, IContainerInpu
|
||||
return true;
|
||||
}
|
||||
|
||||
if (button == 1 && slot instanceof SlotCrafting) // right click
|
||||
if (button == 1 && modifier != 2 && slot instanceof SlotCrafting) // right click
|
||||
{
|
||||
for (int i1 = 0; i1 < 64; i1++) // click this slot 64 times
|
||||
manager.handleSlotClick(slot.slotNumber, button, 0);
|
||||
|
||||
@@ -147,7 +147,6 @@ public abstract class PanelWidget<T extends ItemsGrid<? extends ItemsGridSlot, ?
|
||||
LayoutManager.addWidget(pagePrev);
|
||||
LayoutManager.addWidget(pageNext);
|
||||
LayoutManager.addWidget(pageLabel);
|
||||
this.grid.setVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -788,7 +788,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, IContain
|
||||
|
||||
root.resize(screen, parent, dropRight);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GuiContainerManager.enable2DRender();
|
||||
GuiContainerManager.drawItems.zLevel += 100;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DefaultOverlayRenderer implements IRecipeOverlayRenderer {
|
||||
|
||||
@Override
|
||||
public void renderOverlay(GuiContainerManager gui, Slot slot) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(770, 1);
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ 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;
|
||||
@@ -14,6 +16,9 @@ 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;
|
||||
@@ -51,6 +56,7 @@ 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;
|
||||
@@ -175,6 +181,13 @@ 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);
|
||||
@@ -255,27 +268,67 @@ public class BookmarksGridSlot extends ItemsGridSlot {
|
||||
drawMarker(
|
||||
rect,
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.realMultiplier),
|
||||
0xFFFFFF);
|
||||
0xFFFFFF,
|
||||
Alignment.TopLeft);
|
||||
} else if (shownItemType == ShownItemType.SHIFT) {
|
||||
drawMarker(rect, "x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMultiplier()), 0xFFFFFF);
|
||||
drawMarker(
|
||||
rect,
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMultiplier()),
|
||||
0xFFFFFF,
|
||||
Alignment.TopLeft);
|
||||
} else if (this.isOutputRecipe || this.realMultiplier > 1) {
|
||||
drawMarker(
|
||||
rect,
|
||||
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.realMultiplier),
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue(),
|
||||
Alignment.TopLeft);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.bookmarks.showRecipeHandlerIcon")
|
||||
&& getHandlerInfo() != null) {
|
||||
drawHandlerIcon(rect);
|
||||
} else if (NEIClientConfig.showRecipeMarkerMode() == 1) {
|
||||
drawMarker(
|
||||
rect,
|
||||
"R",
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue(),
|
||||
Alignment.TopRight);
|
||||
}
|
||||
|
||||
} else if (NEIClientConfig.showRecipeMarkerMode() == 1) {
|
||||
drawMarker(rect, "R", NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
|
||||
drawMarker(
|
||||
rect,
|
||||
"R",
|
||||
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue(),
|
||||
Alignment.TopRight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void drawMarker(Rectangle4i rect, String text, int color) {
|
||||
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) {
|
||||
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
|
||||
NEIClientUtils.drawNEIOverlayText(
|
||||
text,
|
||||
@@ -283,7 +336,7 @@ public class BookmarksGridSlot extends ItemsGridSlot {
|
||||
panelFactor,
|
||||
color,
|
||||
true,
|
||||
Alignment.TopLeft);
|
||||
alignment);
|
||||
}
|
||||
|
||||
protected void drawStackSize(Rectangle4i rect, ShownItemType shownItemType) {
|
||||
|
||||
@@ -47,7 +47,7 @@ public class OptionUtilities extends OptionStringSet {
|
||||
LayoutManager.drawIcon(x + 4, 4, new Image(132, 12, 12, 12));
|
||||
x += 24;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
ItemStack sword = new ItemStack(Items.diamond_sword);
|
||||
|
||||
@@ -404,7 +404,7 @@ public class GuiContainerManager {
|
||||
|
||||
public static void enableMatrixStackLogging() {
|
||||
if (!contextEnabled) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
modelviewDepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH);
|
||||
contextEnabled = true;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,13 @@ public class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
|
||||
private ArrayList<T> getRecipeHandlersParallel() throws InterruptedException, ExecutionException {
|
||||
// Pre-find the fuels so we're not fighting over it
|
||||
FuelRecipeHandler.findFuelsOnceParallel();
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("findFuelsParallel")) {
|
||||
FuelRecipeHandler.findFuelsOnceParallel();
|
||||
} else {
|
||||
FuelRecipeHandler.findFuelsOnce();
|
||||
}
|
||||
|
||||
ArrayList<T> handlers = getSerialHandlersWithRecipes();
|
||||
handlers.addAll(getHandlersWithRecipes());
|
||||
handlers.sort(NEIClientConfig.HANDLER_COMPARATOR);
|
||||
|
||||
@@ -66,7 +66,7 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(1, 1, 3);
|
||||
GL11.glTranslatef(x, y, 0);
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
this.gui.drawGuiContainerBackgroundLayer(0.0f, -100, -100);
|
||||
@@ -74,7 +74,7 @@ public class RecipeTooltipLineHandler implements ITooltipLineHandler {
|
||||
GL11.glPopAttrib();
|
||||
|
||||
if (this.gui.slotcontainer != null) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
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);
|
||||
|
||||
@@ -45,6 +45,7 @@ import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
/**
|
||||
* A Template Recipe Handler! How about that. Because it was sooo hard, and more seriously required lots of copied code
|
||||
@@ -108,10 +109,15 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
private static FurnaceRecipeHandler.FuelPair identifyFuel(final ItemStack itemStack) {
|
||||
if (efuels.contains(itemStack.getItem())) return null;
|
||||
final int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
|
||||
if (burnTime <= 0) return null;
|
||||
return new FurnaceRecipeHandler.FuelPair(itemStack.copy(), burnTime);
|
||||
try {
|
||||
if (efuels.contains(itemStack.getItem())) return null;
|
||||
final int burnTime = TileEntityFurnace.getItemBurnTime(itemStack);
|
||||
if (burnTime <= 0) return null;
|
||||
return new FurnaceRecipeHandler.FuelPair(itemStack.copy(), burnTime);
|
||||
} catch (Exception e) {
|
||||
FMLLog.getLogger().error("NEI: Error identifying fuel for item " + itemStack.getItem());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,7 @@ public class DefaultStackStringifyHandler implements IStackStringifyHandler {
|
||||
nbTag.setShort("Damage", (short) stack.getItemDamage());
|
||||
|
||||
if (stack.hasTagCompound() && !stack.getTagCompound().hasNoTags()) {
|
||||
nbTag.setTag("tag", stack.getTagCompound());
|
||||
nbTag.setTag("tag", stack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
return nbTag;
|
||||
|
||||
@@ -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 PLAIN_TEXT_ESCAPED_PATTERN = Pattern.compile("\\\\(.)");
|
||||
private static final Pattern ESCAPED_SYMBOL_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 cleanText = getTokenCleanText(ctx.token());
|
||||
final String cleanPattern = getCleanPattern(ctx.token());
|
||||
final SearchTokenParser.ISearchParserProvider provider = searchParser.getProvider(ctx.token().prefix);
|
||||
if (cleanText == null || provider == null) {
|
||||
if (cleanPattern == null || provider == null) {
|
||||
return defaultResult();
|
||||
}
|
||||
return provider.getFilter(cleanText);
|
||||
return provider.getFilter(cleanPattern);
|
||||
}
|
||||
return defaultResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFilter visitToken(SearchExpressionParser.TokenContext ctx) {
|
||||
final String cleanText = getTokenCleanText(ctx);
|
||||
if (cleanText != null) {
|
||||
return getAlwaysProvidersFilter(cleanText);
|
||||
final String cleanPattern = getCleanPattern(ctx);
|
||||
if (cleanPattern != null) {
|
||||
return getAlwaysProvidersFilter(cleanPattern);
|
||||
}
|
||||
return defaultResult();
|
||||
}
|
||||
@@ -118,36 +118,36 @@ public class ItemFilterVisitor extends AbstractSearchExpressionVisitor<ItemFilte
|
||||
return constructFilter(filters, AllMultiItemFilter::new);
|
||||
}
|
||||
|
||||
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())
|
||||
private String getCleanPattern(SearchExpressionParser.TokenContext ctx) {
|
||||
String cleanPattern = null;
|
||||
if (ctx.plainText() != null) {
|
||||
cleanPattern = Pattern.quote(
|
||||
ESCAPED_SYMBOL_PATTERN.matcher(ctx.plainText().getText())
|
||||
// Unescape everything in search expression
|
||||
.replaceAll("$1"));
|
||||
} else if (ctx.regex() != null) {
|
||||
if (ctx.regex().REGEX_CONTENT() != null) {
|
||||
cleanText = ctx.regex().REGEX_CONTENT().getSymbol().getText();
|
||||
cleanPattern = ctx.regex().REGEX_CONTENT().getSymbol().getText();
|
||||
final int spaceModeEnabled = NEIClientConfig.getIntSetting("inventory.search.spaceMode");
|
||||
// Unescape spaces
|
||||
if (spaceModeEnabled == 1) {
|
||||
cleanText = REGEX_ESCAPED_SPACE_PATTERN.matcher(cleanText).replaceAll("$1 ");
|
||||
cleanPattern = REGEX_ESCAPED_SPACE_PATTERN.matcher(cleanPattern).replaceAll("$1 ");
|
||||
}
|
||||
}
|
||||
} else if (ctx.quoted() != null) {
|
||||
if (ctx.quoted().QUOTED_CONTENT() != null) {
|
||||
cleanText = ctx.quoted().QUOTED_CONTENT().getSymbol().getText();
|
||||
cleanPattern = ctx.quoted().QUOTED_CONTENT().getSymbol().getText();
|
||||
// Unescape quotes
|
||||
cleanText = ESCAPED_QUOTE_PATTERN.matcher(cleanText).replaceAll("\"");
|
||||
cleanText = Pattern.quote(cleanText);
|
||||
cleanPattern = ESCAPED_QUOTE_PATTERN.matcher(cleanPattern).replaceAll("\"");
|
||||
cleanPattern = Pattern.quote(cleanPattern);
|
||||
final int spaceModeEnabled = NEIClientConfig.getIntSetting("inventory.search.spaceMode");
|
||||
// Unescape spaces
|
||||
if (spaceModeEnabled == 1) {
|
||||
cleanText = ESCAPED_SPACE_PATTERN.matcher(cleanText).replaceAll(" ");
|
||||
cleanPattern = ESCAPED_SPACE_PATTERN.matcher(cleanPattern).replaceAll(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
return cleanText;
|
||||
return cleanPattern;
|
||||
}
|
||||
|
||||
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.PLAIN_TEXT() != null) {
|
||||
cleanText = ctx.PLAIN_TEXT().getSymbol().getText();
|
||||
if (ctx.plainText() != null) {
|
||||
cleanText = ctx.plainText().getText();
|
||||
// Unescape spaces
|
||||
if (spaceModeEnabled == 1) {
|
||||
cleanText = ESCAPED_SPACE_PATTERN.matcher(cleanText).replaceAll(" ");
|
||||
|
||||
@@ -822,6 +822,7 @@ gt.recipe.largeboilerfakefuels,gregtech:gt.blockmachines:1023,,gregtech,TRUE,gre
|
||||
gt.recipe.vacuumfreezer,gregtech:gt.blockmachines:1002,,gregtech,TRUE,gregapi_post,,,,,
|
||||
smelting,gregtech:gt.blockmachines:1003,,gregtech,TRUE,gregapi_post,,,,,
|
||||
smelting,gregtech:gt.blockmachines:15412,,gregtech,TRUE,gregapi_post,,,,,
|
||||
smelting,gregtech:gt.blockmachines:31087,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1110,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1111,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1112,,gregtech,TRUE,gregapi_post,,,,,
|
||||
@@ -1254,8 +1255,6 @@ bw.recipe.biolab,gregtech:gt.blockmachines:12705,,bartworks,TRUE,,,,,,
|
||||
bw.recipe.biolab,gregtech:gt.blockmachines:12706,,bartworks,TRUE,,,,,,
|
||||
bw.recipe.biolab,gregtech:gt.blockmachines:12707,,bartworks,TRUE,,,,,,
|
||||
bw.recipe.biolab,gregtech:gt.blockmachines:12708,,bartworks,TRUE,,,,,,
|
||||
bw.recipe.biolab,gregtech:gt.blockmachines:12709,,bartworks,TRUE,,,,,,
|
||||
bw.recipe.biolab,gregtech:gt.blockmachines:12710,,bartworks,TRUE,,,,,,
|
||||
bw.recipe.BacteriaVat,gregtech:gt.blockmachines:12712,,bartworks,TRUE,,,,,,
|
||||
gt.recipe.electricimplosioncompressor,gregtech:gt.blockmachines:12734,,bartworks,TRUE,,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1113,,GoodGenerator,TRUE,,,,,,
|
||||
@@ -1484,4 +1483,4 @@ straywolfe.cookingwithtfc.client.nei.ClayOvenRecipeHandler,cookingwithtfc:item.c
|
||||
factorization.nei.RecipeGrinder,factorization:diamond_cutting_head,,factorization,TRUE,,,,,,,,,,,
|
||||
factorization.nei.RecipeMixer,factorization:FzBlock:18,,factorization,TRUE,,,,,,,,,,,
|
||||
ua.pp.shurgent.tfctech.nei.WireDrawBenchRecipeHandler,tfctech:item.Wire Draw Bench,,tfctech,TRUE,,,,,,,,,,,
|
||||
mekanism.client.nei.ElectrolyticSeparatorRecipeHandler,Mekanism:MachineBlock2:4,,Mekanism,TRUE,,,,,,,,,,,
|
||||
mekanism.client.nei.ElectrolyticSeparatorRecipeHandler,Mekanism:MachineBlock2:4,,Mekanism,TRUE,,,,,,,,,,,
|
||||
|
@@ -229,8 +229,12 @@ 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=Icon
|
||||
nei.options.inventory.bookmarks.showRecipeMarkerMode.1=Text
|
||||
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
|
||||
|
||||
@@ -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=Да
|
||||
|
||||
@@ -88,6 +88,11 @@ public class SearchTokenParserTest {
|
||||
protected String getIdentifier(ItemStack stack) {
|
||||
return getStringIdentifier(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PREFIX(" + pattern.toString() + ")";
|
||||
}
|
||||
};
|
||||
|
||||
private static MockedStatic<NEIClientConfig> config;
|
||||
@@ -284,12 +289,14 @@ 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");
|
||||
"\"" + itemA.getDisplayName() + "\"?A*A");
|
||||
|
||||
assertEquals(1, matchedItems.size());
|
||||
assertTrue(matchedItems.contains(itemA));
|
||||
|
||||
Reference in new issue
Block a user