Compare commits

..
Author SHA1 Message Date
slprime 903271b279 remove ingredients sorting 2025-03-27 10:59:46 +02:00
slprime 204c37fa36 Create Favorites Widget; More hotkeys; More Tooltips; 2025-03-26 08:15:00 +02:00
49 changed files with 695 additions and 1181 deletions

No files matched your search

+2 -2
View File
@@ -1,8 +1,8 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:CodeChickenCore:1.4.3:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.32:dev')
api('com.github.GTNewHorizons:CodeChickenCore:1.4.1:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.16:dev')
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
+1 -1
View File
@@ -14,7 +14,7 @@ modId = NotEnoughItems
modGroup = codechicken.nei
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.37'
}
@@ -1,5 +1,7 @@
package codechicken.nei;
import static codechicken.nei.NEIClientUtils.translate;
import java.awt.Point;
import java.io.File;
import java.io.FileInputStream;
@@ -38,6 +40,7 @@ import codechicken.nei.recipe.BookmarkRecipeId;
import codechicken.nei.recipe.Recipe;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.recipe.Recipe.RecipeIngredient;
import codechicken.nei.recipe.RecipeTooltipLineHandler;
import codechicken.nei.recipe.StackInfo;
import codechicken.nei.recipe.chain.RecipeChainMath;
import codechicken.nei.recipe.chain.RecipeChainTooltipLineHandler;
@@ -88,6 +91,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
public SortableGroup sortableGroup;
public GroupingItem groupingItem;
protected RecipeTooltipLineHandler recipeTooltipLineHandler;
protected AcceptsFollowingTooltipLineHandler acceptsFollowingTooltipLineHandler;
protected RecipeChainTooltipLineHandler recipeChainTooltipLineHandler;
@@ -146,7 +150,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
@Override
public String getButtonTip() {
return NEIClientUtils.translate("bookmark.pullBookmarkedItems.tip");
return translate("bookmark.pullBookmarkedItems.tip");
}
};
@@ -672,7 +676,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
if (overRowIndex != -1) {
final int groupId = this.grid.getRowGroupId(overRowIndex);
currenttip.add(NEIClientUtils.translate("bookmark.group"));
currenttip.add(translate("bookmark.group"));
if (groupId != BookmarkGrid.DEFAULT_GROUP_ID) {
currenttip = recipeChainTooltip(groupId, currenttip);
@@ -682,7 +686,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
} else
if (new Rectangle4i(pagePrev.x + pagePrev.w, pagePrev.y, pageNext.x - (pagePrev.x + pagePrev.w), pagePrev.h)
.contains(mousex, mousey)) {
currenttip.add(NEIClientUtils.translate("bookmark.group"));
currenttip.add(translate("bookmark.group"));
currenttip = recipeChainTooltip(BookmarkGrid.DEFAULT_GROUP_ID, currenttip);
} else {
this.recipeChainTooltipLineHandler = null;
@@ -729,36 +733,32 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
NEIClientUtils.getKeyName(
NEIClientUtils.CTRL_HASH,
NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL),
NEIClientUtils.translate("bookmark.change_quantity"));
NEIClientUtils.translate("bookmark.group.change_quantity"));
hotkeys.put(
NEIClientUtils.getKeyName(
NEIClientUtils.CTRL_HASH + NEIClientUtils.ALT_HASH,
NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL),
NEIClientUtils.translate("bookmark.change_quantity_step"));
NEIClientUtils.translate("bookmark.group.change_quantity_step"));
hotkeys.put(
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("bookmark.group.toggle_mode"));
hotkeys.put(NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_LMB), translate("bookmark.group.toggle_mode"));
hotkeys.put(
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_RMB),
NEIClientUtils.translate("bookmark.group.toggle_crafting_chain"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.remove_recipe"),
NEIClientUtils.translate("bookmark.group.remove_recipe"));
translate("bookmark.group.toggle_crafting_chain"));
hotkeys.put(NEIClientConfig.getKeyName("gui.remove_recipe"), translate("bookmark.group.remove_recipe"));
if (BookmarkContainerInfo.getBookmarkContainerHandler(gui) != null) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items"),
NEIClientUtils.translate("bookmark.group.pull_items"));
translate("bookmark.group.pull_items"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark_pull_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.pull_items_shift"));
translate("bookmark.group.pull_items_shift"));
}
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.ALT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("bookmark.group.toggle_collapse"));
translate("bookmark.group.toggle_collapse"));
}
if (overRowIndex != -1) {
@@ -766,7 +766,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
hotkeys.put(
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_LMB + NEIMouseUtils.MOUSE_DRAG),
NEIClientUtils.translate("bookmark.group.include_group"));
translate("bookmark.group.include_group"));
if (groupId != BookmarkGrid.DEFAULT_GROUP_ID) {
@@ -774,33 +774,33 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
NEIClientUtils.getKeyName(
NEIClientUtils.CTRL_HASH,
NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL),
NEIClientUtils.translate("bookmark.change_quantity"));
NEIClientUtils.translate("bookmark.group.change_quantity"));
hotkeys.put(
NEIClientUtils.getKeyName(
NEIClientUtils.CTRL_HASH + NEIClientUtils.ALT_HASH,
NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL),
NEIClientUtils.translate("bookmark.change_quantity_step"));
NEIClientUtils.translate("bookmark.group.change_quantity_step"));
hotkeys.put(
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_RMB + NEIMouseUtils.MOUSE_DRAG),
NEIClientUtils.translate("bookmark.group.exclude_group"));
translate("bookmark.group.exclude_group"));
hotkeys.put(
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("bookmark.group.toggle_mode"));
translate("bookmark.group.toggle_mode"));
hotkeys.put(
NEIMouseUtils.getKeyName(NEIMouseUtils.MOUSE_BTN_RMB),
NEIClientUtils.translate("bookmark.group.toggle_crafting_chain"));
translate("bookmark.group.toggle_crafting_chain"));
hotkeys.put(
NEIClientUtils.getKeyName(
NEIClientUtils.SHIFT_HASH,
NEIMouseUtils.MOUSE_BTN_LMB + NEIMouseUtils.MOUSE_DRAG),
NEIClientUtils.translate("bookmark.group.sorting"));
translate("bookmark.group.sorting"));
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.ALT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("bookmark.group.toggle_collapse"));
translate("bookmark.group.toggle_collapse"));
}
}
@@ -811,28 +811,22 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
NEIClientUtils.getKeyName(
NEIClientUtils.CTRL_HASH,
NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL),
NEIClientUtils.translate("bookmark.change_quantity"));
NEIClientUtils.translate("itempanel.change_quantity"));
hotkeys.put(
NEIClientUtils.getKeyName(
NEIClientUtils.CTRL_HASH + NEIClientUtils.ALT_HASH,
NEIMouseUtils.MOUSE_BTN_NONE + NEIMouseUtils.MOUSE_SCROLL),
NEIClientUtils.translate("bookmark.change_quantity_step"));
hotkeys.put(
NEIClientUtils.getKeyName(
NEIClientUtils.SHIFT_HASH,
NEIMouseUtils.MOUSE_BTN_LMB + NEIMouseUtils.MOUSE_DRAG),
NEIClientUtils.translate("bookmark.item.sorting"));
NEIClientUtils.translate("itempanel.change_quantity_step"));
if (group.collapsed) {
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.ALT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("bookmark.group.toggle_collapse"));
translate("bookmark.group.toggle_collapse"));
} else if (group.crafting != null) {
hotkeys.put(
NEIClientUtils.getKeyName(NEIClientUtils.ALT_HASH, NEIMouseUtils.MOUSE_BTN_LMB),
NEIClientUtils.translate("bookmark.recipe.toggle_collapse"));
translate("bookmark.recipe.toggle_collapse"));
}
if (this.acceptsFollowingTooltipLineHandler != null) {
@@ -887,6 +881,33 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
if (slot != null) {
if (!slot.isIngredient() && NEIClientConfig.getRecipeTooltipsMode() != 0) {
RecipeId recipeId = null;
if (slot.getRecipeId() != null) {
final int tooltipMode = NEIClientConfig.getRecipeTooltipsMode();
final BookmarkViewMode viewMode = slot.getGroup().viewMode;
if (tooltipMode == 3 || viewMode == BookmarkViewMode.DEFAULT && tooltipMode == 1
|| viewMode == BookmarkViewMode.TODO_LIST && tooltipMode == 2) {
recipeId = slot.getRecipeId();
}
}
if (recipeId == null) {
this.recipeTooltipLineHandler = null;
} else if (this.recipeTooltipLineHandler == null
|| !this.recipeTooltipLineHandler.getRecipeId().equals(recipeId)) {
this.recipeTooltipLineHandler = new RecipeTooltipLineHandler(recipeId);
}
if (this.recipeTooltipLineHandler != null) {
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(this.recipeTooltipLineHandler));
}
} else {
this.acceptsFollowingTooltipLineHandler = null;
}
if (slot.isIngredient() && slot.getRecipeId() != null && slot.getBookmarkItem().permutations.size() > 1) {
RecipeId recipeId = slot.getRecipeId();
@@ -910,6 +931,7 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
}
} else {
this.recipeTooltipLineHandler = null;
this.acceptsFollowingTooltipLineHandler = null;
}
@@ -19,14 +19,13 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiErrorScreen;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiSelectWorld;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.world.World;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.WorldEvent;
@@ -61,6 +60,7 @@ public class ClientHandler {
private static ClientHandler instance;
private final ArrayList<EntityItem> SMPmagneticItems = new ArrayList<>();
private World lastworld;
private GuiScreen lastGui;
public void addSMPMagneticItem(int i, World world) {
WorldClient cworld = (WorldClient) world;
@@ -257,17 +257,13 @@ public class ClientHandler {
}
public static void loadPluginsList() {
final boolean jarjar = Launch.blackboard.getOrDefault("jarjar.rfbPluginLoaded", Boolean.FALSE) == Boolean.TRUE;
if (!jarjar) {
if (!Loader.isModLoaded("jarjar")) {
// Do the old style class discovery
final ClassDiscoverer classDiscoverer = new ClassDiscoverer(
test -> test.startsWith("NEI") && test.endsWith("Config.class"),
IConfigureNEI.class);
NEIClientConfig.pluginsList.addAll(classDiscoverer.findClasses());
NEIClientConfig.logger
.info("Loading NEI Plugins via ClassDiscoverer: " + NEIClientConfig.pluginsList.size());
} else {
// If JarJar's loaded, the ASMDataTable now includes interfaces in addition to Annotations, so use that
// instead Includes a small change in behavior of no longer requiring the class to start with NEI and end
@@ -283,7 +279,6 @@ public class ClientHandler {
NEIClientConfig.logger.error("Failed to load plugin class {}", className, e);
}
}
NEIClientConfig.logger.info("Loading NEI Plugins via JarJar: " + NEIClientConfig.pluginsList.size());
}
}
@@ -307,19 +302,18 @@ public class ClientHandler {
if (mc.currentScreen == null) NEIController.processCreativeCycling(mc.thePlayer.inventory);
updateMagnetMode(mc.theWorld, mc.thePlayer);
} else {
lastworld = null;
}
}
@SubscribeEvent
public void onGuiScreen(GuiOpenEvent event) {
if (event.gui instanceof GuiSelectWorld) {
NEIClientConfig.reloadSaves();
} else if (event.gui == null) {
/* prevent WorldClient reference being held in the Gui */
NEIController.manager = null;
GuiScreen gui = mc.currentScreen;
if (gui != lastGui) {
if (gui instanceof GuiMainMenu) lastworld = null;
else if (gui instanceof GuiSelectWorld) NEIClientConfig.reloadSaves();
else if (gui == null) {
/* prevent WorldClient reference being held in the Gui */
NEIController.manager = null;
}
}
lastGui = gui;
}
@SubscribeEvent
@@ -338,7 +332,6 @@ public class ClientHandler {
Minecraft mc = Minecraft.getMinecraft();
if (event.world == mc.theWorld) {
NEIClientConfig.unloadWorld();
ItemMobSpawner.clearEntityReferences();
}
}
@@ -355,6 +348,8 @@ public class ClientHandler {
if (!Minecraft.getMinecraft().isSingleplayer()) // wait for server to initiate in singleplayer
NEIClientConfig.loadWorld("remote/" + ClientUtils.getServerIP().replace(':', '~'));
}
ItemMobSpawner.clearEntityReferences(world);
lastworld = world;
}
}
@@ -150,16 +150,10 @@ public class CollapsibleItems {
}
public static void putItem(ItemStack stack) {
int groupIndex = -1;
final GroupItem group = CollapsibleItems.groups.stream().filter(g -> g.matches(stack)).findFirst().orElse(null);
for (int i = 0; i < CollapsibleItems.groups.size() && groupIndex == -1; i++) {
if (CollapsibleItems.groups.get(i).matches(stack)) {
groupIndex = i;
}
}
if (groupIndex != -1) {
CollapsibleItems.cache.put(stack, groupIndex);
if (group != null) {
CollapsibleItems.cache.put(stack, CollapsibleItems.groups.indexOf(group));
}
}
@@ -21,7 +21,6 @@ public class FormattedTextField extends GuiTextField {
protected FontRenderer fontRenderer;
protected String rawText = "";
protected String formattedText = "";
protected String placeholder = "";
protected boolean editable = true;
protected int editableColor = 14737632;
protected int notEditableColor = 7368816;
@@ -38,10 +37,6 @@ public class FormattedTextField extends GuiTextField {
this.formatter = formatter;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
@Override
public void updateCursorCounter() {
super.updateCursorCounter();
@@ -108,14 +103,10 @@ public class FormattedTextField extends GuiTextField {
this.editable = p_146184_1_;
}
protected boolean beforeWrite(String text) {
return true;
}
@Override
public void writeText(String textPart) {
public void writeText(String p_146191_1_) {
String newText = "";
String substr = ChatAllowedCharacters.filerAllowedCharacters(textPart);
String substr = ChatAllowedCharacters.filerAllowedCharacters(p_146191_1_);
int cursorPosition = getCursorPosition();
int maxStringLength = getMaxStringLength();
String text = getText();
@@ -136,10 +127,8 @@ public class FormattedTextField extends GuiTextField {
cursorPosition = Math.min(textStart.length() + substr.length(), newText.length());
}
if (beforeWrite(newText)) {
setText(newText);
setCursorPosition(cursorPosition);
}
setText(newText);
setCursorPosition(cursorPosition);
}
@Override
@@ -149,99 +138,87 @@ public class FormattedTextField extends GuiTextField {
@Override
public void drawTextBox() {
if (!this.getVisible()) {
return;
}
if (this.getEnableBackgroundDrawing()) {
drawRect(
this.xPosition - 1,
this.yPosition - 1,
this.xPosition + this.width + 1,
this.yPosition + this.height + 1,
-6250336);
drawRect(
this.xPosition,
this.yPosition,
this.xPosition + this.width,
this.yPosition + this.height,
-16777216);
}
if (!this.rawText.equals(getText())) {
this.rawText = getText();
this.formattedText = this.formatter.format(this.rawText);
if (!EnumChatFormatting.getTextWithoutFormattingCodes(this.formattedText).toLowerCase()
.equals(this.rawText.toLowerCase())) {
this.formattedText = this.rawText;
if (this.getVisible()) {
if (this.getEnableBackgroundDrawing()) {
drawRect(
this.xPosition - 1,
this.yPosition - 1,
this.xPosition + this.width + 1,
this.yPosition + this.height + 1,
-6250336);
drawRect(
this.xPosition,
this.yPosition,
this.xPosition + this.width,
this.yPosition + this.height,
-16777216);
}
}
if (!isFocused() && this.formattedText.isEmpty()) {
int x = getEnableBackgroundDrawing() ? this.xPosition + 4 : this.xPosition;
int y = getEnableBackgroundDrawing() ? this.yPosition + (this.height - 8) / 2 : this.yPosition;
this.fontRenderer.drawStringWithShadow(
this.fontRenderer.trimStringToWidth(this.placeholder, this.getWidth()),
x,
y,
this.notEditableColor);
return;
}
int firstCharacterIndex = getFormattedTextShift(this.lineScrollOffset);
String rawTextClipped = this.fontRenderer
.trimStringToWidth(this.rawText.substring(this.lineScrollOffset), this.getWidth());
String textClipped = this.formattedText
.substring(firstCharacterIndex, getFormattedTextShift(this.lineScrollOffset + rawTextClipped.length()));
int cursorPosition = getFormattedTextShift(getCursorPosition());
int selectionEnd = getFormattedTextShift(getSelectionEnd());
int color = this.editable ? this.editableColor : this.notEditableColor;
int cursorA = cursorPosition - firstCharacterIndex;
int cursorB = selectionEnd - firstCharacterIndex;
boolean flag = cursorA >= 0 && cursorA <= textClipped.length();
boolean flag1 = isFocused() && this.frame / 6 % 2 == 0 && flag;
boolean flag2 = getCursorPosition() < this.rawText.length() || this.rawText.length() >= getMaxStringLength();
int x = getEnableBackgroundDrawing() ? this.xPosition + 4 : this.xPosition;
int y = getEnableBackgroundDrawing() ? this.yPosition + (this.height - 8) / 2 : this.yPosition;
int x2 = x;
if (cursorB > textClipped.length()) {
cursorB = textClipped.length();
}
if (textClipped.length() > 0) {
String s1 = flag ? textClipped.substring(0, cursorA) : textClipped;
String colorA = getPreviousColor(firstCharacterIndex);
x2 = this.fontRenderer.drawStringWithShadow(colorA + s1, x, y, color);
}
int k1 = x2;
if (!flag) {
k1 = cursorA > 0 ? x + this.width : x;
} else if (flag2) {
k1 = x2 - 1;
--x2;
}
if (textClipped.length() > 0 && flag && cursorA < textClipped.length()) {
String colorB = getPreviousColor(firstCharacterIndex + cursorA);
this.fontRenderer.drawStringWithShadow(colorB + textClipped.substring(cursorA), x2, y, color);
}
if (flag1) {
if (flag2) {
Gui.drawRect(k1, y - 1, k1 + 1, y + 1 + this.fontRenderer.FONT_HEIGHT, -3092272);
} else {
this.fontRenderer.drawStringWithShadow("_", k1, y, color);
if (!this.rawText.equals(getText())) {
this.rawText = getText();
this.formattedText = this.formatter.format(this.rawText);
if (!EnumChatFormatting.getTextWithoutFormattingCodes(this.formattedText).toLowerCase()
.equals(this.rawText.toLowerCase())) {
this.formattedText = this.rawText;
}
}
}
if (cursorB != cursorA) {
int l1 = x + this.fontRenderer.getStringWidth(textClipped.substring(0, cursorB));
drawCursorVertical(k1, y - 1, l1 - 1, y + 1 + this.fontRenderer.FONT_HEIGHT);
int firstCharacterIndex = getFormattedTextShift(this.lineScrollOffset);
String rawTextClipped = this.fontRenderer
.trimStringToWidth(this.rawText.substring(this.lineScrollOffset), this.getWidth());
String textClipped = this.formattedText.substring(
firstCharacterIndex,
getFormattedTextShift(this.lineScrollOffset + rawTextClipped.length()));
int cursorPosition = getFormattedTextShift(this.getCursorPosition());
int selectionEnd = getFormattedTextShift(this.getSelectionEnd());
int color = this.editable ? this.editableColor : this.notEditableColor;
int cursorA = cursorPosition - firstCharacterIndex;
int cursorB = selectionEnd - firstCharacterIndex;
boolean flag = cursorA >= 0 && cursorA <= textClipped.length();
boolean flag1 = this.isFocused() && this.frame / 6 % 2 == 0 && flag;
boolean flag2 = this.getCursorPosition() < this.rawText.length()
|| this.rawText.length() >= this.getMaxStringLength();
int x = this.getEnableBackgroundDrawing() ? this.xPosition + 4 : this.xPosition;
int y = this.getEnableBackgroundDrawing() ? this.yPosition + (this.height - 8) / 2 : this.yPosition;
int x2 = x;
if (cursorB > textClipped.length()) {
cursorB = textClipped.length();
}
if (textClipped.length() > 0) {
String s1 = flag ? textClipped.substring(0, cursorA) : textClipped;
String colorA = getPreviousColor(firstCharacterIndex);
x2 = this.fontRenderer.drawStringWithShadow(colorA + s1, x, y, color);
}
int k1 = x2;
if (!flag) {
k1 = cursorA > 0 ? x + this.width : x;
} else if (flag2) {
k1 = x2 - 1;
--x2;
}
if (textClipped.length() > 0 && flag && cursorA < textClipped.length()) {
String colorB = getPreviousColor(firstCharacterIndex + cursorA);
this.fontRenderer.drawStringWithShadow(colorB + textClipped.substring(cursorA), x2, y, color);
}
if (flag1) {
if (flag2) {
Gui.drawRect(k1, y - 1, k1 + 1, y + 1 + this.fontRenderer.FONT_HEIGHT, -3092272);
} else {
this.fontRenderer.drawStringWithShadow("_", k1, y, color);
}
}
if (cursorB != cursorA) {
int l1 = x + this.fontRenderer.getStringWidth(textClipped.substring(0, cursorB));
drawCursorVertical(k1, y - 1, l1 - 1, y + 1 + this.fontRenderer.FONT_HEIGHT);
}
}
}
@@ -15,10 +15,13 @@ import codechicken.nei.guihook.IContainerTooltipHandler;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.recipe.RecipeTooltipLineHandler;
import codechicken.nei.recipe.StackInfo;
public class ItemHistoryPanel extends Widget implements IContainerTooltipHandler {
protected RecipeTooltipLineHandler recipeTooltipLineHandler = null;
protected int mouseDownItemIndex = -1;
protected ItemsGrid<ItemsGridSlot, MouseContext> grid = new ItemsGrid<>() {
@@ -214,4 +217,27 @@ public class ItemHistoryPanel extends Widget implements IContainerTooltipHandler
this.mouseDownItemIndex = -1;
}
@Override
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
List<String> currenttip) {
if (itemstack != null && contains(mousex, mousey) && NEIClientConfig.getFavoriteRecipeTooltips()) {
final RecipeId recipeId = FavoriteRecipes.getFavorite(itemstack);
if (recipeId == null) {
recipeTooltipLineHandler = null;
} else if (recipeTooltipLineHandler == null || !recipeTooltipLineHandler.getRecipeId().equals(recipeId)) {
recipeTooltipLineHandler = new RecipeTooltipLineHandler(recipeId);
}
if (recipeTooltipLineHandler != null) {
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(recipeTooltipLineHandler));
}
} else {
recipeTooltipLineHandler = null;
}
return currenttip;
}
}
+22 -6
View File
@@ -8,6 +8,7 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinWorkerThread;
@@ -28,6 +29,7 @@ import codechicken.nei.ThreadOperationTimer.TimeoutException;
import codechicken.nei.api.ItemFilter;
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.recipe.StackInfo;
import codechicken.nei.search.TooltipFilter;
public class ItemList {
@@ -48,7 +50,7 @@ public class ItemList {
private static final HashSet<Item> erroredItems = new HashSet<>();
private static final HashSet<String> stackTraces = new HashSet<>();
private static Map<ItemStack, Integer> ordering = new HashMap<>();
private static HashMap<ItemStack, Integer> ordering = new HashMap<>();
/**
* Unlike {@link LayoutManager#itemsLoaded}, this indicates whether item loading is actually finished or not.
*/
@@ -214,7 +216,8 @@ public class ItemList {
IIcon icon = item.getIconIndex(itemstack);
String name = getTooltip(itemstack);
String s = name + "@" + (icon == null ? 0 : icon.hashCode());
if (damageIconSet.add(s)) {
if (!damageIconSet.contains(s)) {
damageIconSet.add(s);
permutations.add(itemstack);
}
} catch (TimeoutException t) {
@@ -237,11 +240,12 @@ public class ItemList {
}
private void updateOrdering(List<ItemStack> items) {
final Map<ItemStack, Integer> newOrdering = new HashMap<>();
ItemSorter.sort(items);
HashMap<ItemStack, Integer> newOrdering = new HashMap<>();
if (!CollapsibleItems.isEmpty()) {
final HashMap<Integer, Integer> groups = new HashMap<>();
HashMap<Integer, Integer> groups = new HashMap<>();
int orderIndex = 0;
for (ItemStack stack : items) {
@@ -308,6 +312,7 @@ public class ItemList {
ListMultimap<Item, ItemStack> itemMap = ArrayListMultimap.create();
ItemStackSet unique = new ItemStackSet();
timer.setLimit(NEIClientConfig.getItemLoadingTimeout());
StreamSupport.stream(((Iterable<Item>) Item.itemRegistry).spliterator(), true).forEach(item -> {
if (item == null || item.delegate.name() == null || erroredItems.contains(item)) return;
@@ -328,7 +333,6 @@ public class ItemList {
}
CollapsibleItems.putItem(stack);
TooltipFilter.getSearchTooltip(stack);
}
}
@@ -357,6 +361,10 @@ public class ItemList {
if (interrupted()) return;
updateOrdering(ItemList.items);
new Thread(
() -> ItemList.items.parallelStream().forEach(TooltipFilter::getSearchTooltip),
"NEI Tooltip Filter Loader").start();
loadFinished = true;
SubsetWidget.updateHiddenItems();
@@ -406,7 +414,8 @@ public class ItemList {
if (interrupted()) return;
filtered.sort(Comparator.comparingInt(ItemList.ordering::get));
Comparator<ItemStack> comparator = Comparator.comparingInt(ItemList.ordering::get);
filtered.sort(comparator);
if (interrupted()) return;
@@ -414,6 +423,13 @@ public class ItemList {
}
};
public static int getItemOrderIndex(ItemStack stack) {
final Optional<Map.Entry<ItemStack, Integer>> orderingEntry = ItemList.ordering.entrySet().parallelStream()
.filter(entry -> StackInfo.equalItemAndNBT(entry.getKey(), stack, true)).findAny();
return orderingEntry.isPresent() ? orderingEntry.get().getValue() : 0;
}
/**
* @deprecated Use updateFilter.restart()
*/
@@ -16,14 +16,10 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemMobSpawner extends ItemBlock {
private static final Map<Integer, EntityLiving> entityHashMap = new HashMap<>();
@@ -33,6 +29,7 @@ public class ItemMobSpawner extends ItemBlock {
public ItemMobSpawner() {
super(Blocks.mob_spawner);
hasSubtypes = true;
MinecraftForgeClient.registerItemRenderer(this, new SpawnerRenderer());
}
@@ -41,6 +38,7 @@ public class ItemMobSpawner extends ItemBlock {
* These are ASM translated from BlockMobSpawner
*/
public static int placedX;
public static int placedY;
public static int placedZ;
@@ -67,7 +65,6 @@ public class ItemMobSpawner extends ItemBlock {
return false;
}
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemstack, EntityPlayer par2EntityPlayer, List<String> list, boolean par4) {
setDefaultTag(itemstack);
@@ -76,17 +73,15 @@ public class ItemMobSpawner extends ItemBlock {
meta = idPig;
}
Entity e = getEntity(meta);
list.add(
(e instanceof IMob ? EnumChatFormatting.DARK_RED : EnumChatFormatting.DARK_AQUA)
+ IDtoNameMap.get(meta));
list.add("\u00A7" + (e instanceof IMob ? "4" : "3") + IDtoNameMap.get(meta));
}
public static EntityLiving getEntity(int ID) {
EntityLiving e = entityHashMap.get(ID);
if (e == null) {
loadSpawners();
Class<?> clazz = EntityList.IDtoClassMapping.get(ID);
World world = NEIClientUtils.mc().theWorld;
loadSpawners(world);
Class<?> clazz = (Class<?>) EntityList.IDtoClassMapping.get(ID);
try {
e = (EntityLiving) clazz.getConstructor(new Class[] { World.class }).newInstance(world);
} catch (Throwable t) {
@@ -100,31 +95,40 @@ public class ItemMobSpawner extends ItemBlock {
return e;
}
public static void clearEntityReferences() {
entityHashMap.clear();
public static void clearEntityReferences(World newWorld) {
entityHashMap.values().removeIf(e -> e.worldObj != newWorld);
}
private void setDefaultTag(ItemStack itemstack) {
if (!IDtoNameMap.containsKey(itemstack.getItemDamage())) itemstack.setItemDamage(idPig);
}
public static void loadSpawners() {
public static void loadSpawners(World world) {
if (loaded) return;
loaded = true;
for (Map.Entry<Class<? extends Entity>, String> entry : EntityList.classToStringMapping.entrySet()) {
final Class<? extends Entity> clazz = entry.getKey();
if (EntityLiving.class.isAssignableFrom(clazz)) {
Integer id = (Integer) EntityList.classToIDMapping.get(clazz);
if (id == null) continue;
String name = entry.getValue();
if (name == null) continue;
Map<Class<? extends Entity>, String> classToStringMapping = EntityList.classToStringMapping;
@SuppressWarnings("unchecked")
Map<Class<? extends Entity>, Integer> classToIDMapping = (Map<Class<? extends Entity>, Integer>) EntityList.classToIDMapping;
for (Class<? extends Entity> eclass : classToStringMapping.keySet()) {
if (!EntityLiving.class.isAssignableFrom(eclass)) continue;
try {
EntityLiving entityliving = (EntityLiving) eclass.getConstructor(new Class[] { World.class })
.newInstance(world);
entityliving.isChild();
int id = classToIDMapping.get(eclass);
String name = classToStringMapping.get(eclass);
if (name.equals("EnderDragon")) continue;
IDtoNameMap.put(id, name);
if (name.equals("Pig")) idPig = id;
if (clazz != EntityPig.class || name.equals("Pig")) {
IDtoNameMap.put(id, name);
}
}
} catch (Throwable ignored) {}
}
IDtoNameMap.entrySet()
.removeIf(e -> getEntity(e.getKey()).getClass() == EntityPig.class && !e.getValue().equals("Pig"));
}
@Override
+22 -1
View File
@@ -9,6 +9,8 @@ import net.minecraft.item.ItemStack;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemsPanelGrid.ItemsPanelGridSlot;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.recipe.RecipeTooltipLineHandler;
import codechicken.nei.util.NEIMouseUtils;
public class ItemPanel extends PanelWidget<ItemsPanelGrid> {
@@ -31,6 +33,7 @@ public class ItemPanel extends PanelWidget<ItemsPanelGrid> {
return super.getStackMouseOver(mousex, mousey);
}
protected RecipeTooltipLineHandler recipeTooltipLineHandler = null;
public ItemHistoryPanel historyPanel = new ItemHistoryPanel();
public Button toggleGroups;
@@ -204,7 +207,25 @@ public class ItemPanel extends PanelWidget<ItemsPanelGrid> {
}
}
return super.handleItemTooltip(gui, itemstack, mousex, mousey, currenttip);
currenttip = super.handleItemTooltip(gui, itemstack, mousex, mousey, currenttip);
if (itemstack != null && contains(mousex, mousey) && NEIClientConfig.getFavoriteRecipeTooltips()) {
RecipeId recipeId = FavoriteRecipes.getFavorite(itemstack);
if (recipeId == null) {
recipeTooltipLineHandler = null;
} else if (recipeTooltipLineHandler == null || !recipeTooltipLineHandler.getRecipeId().equals(recipeId)) {
recipeTooltipLineHandler = new RecipeTooltipLineHandler(recipeId);
}
if (recipeTooltipLineHandler != null) {
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(recipeTooltipLineHandler));
}
} else {
recipeTooltipLineHandler = null;
}
return currenttip;
}
@Override
@@ -1,9 +1,8 @@
package codechicken.nei;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import static codechicken.nei.NEIClientUtils.translate;
import org.lwjgl.input.Keyboard;
import net.minecraft.item.ItemStack;
import codechicken.nei.recipe.StackInfo;
@@ -15,63 +14,13 @@ public class ItemQuantityField extends TextField {
field.setDisabledTextColour(0xFF303030);
}
@Override
protected void initInternalTextField() {
field = new FormattedTextField(Minecraft.getMinecraft().fontRenderer, 0, 0, 0, 0) {
{
setPlaceholder(NEIClientUtils.translate("itempanel.quantity.default"));
}
@Override
public String getText() {
String text = super.getText();
return !isFocused() && "0".equals(text) ? "" : text;
}
@Override
protected boolean beforeWrite(String text) {
if (text == null || text.isEmpty()) return true;
try {
return Integer.parseInt(text) >= 0;
} catch (NumberFormatException e) {
return false;
}
}
@Override
public boolean textboxKeyTyped(char keyChar, int keyID) {
if (!isFocused()) return false;
if (super.textboxKeyTyped(keyChar, keyID)) {
return true;
} else if (keyID == Keyboard.KEY_DOWN) {
setText(Integer.toString(Math.max(0, getInteger() - 1)));
return true;
} else if (keyID == Keyboard.KEY_UP) {
setText(Integer.toString(getInteger() + 1));
return true;
}
return false;
}
private int getInteger() {
try {
return Math.max(0, Integer.parseInt(text()));
} catch (NumberFormatException nfe) {
return 0;
}
}
};
field.setMaxStringLength(maxSearchLength);
field.setCursorPositionZero();
public int intValue() {
return intValue(text());
}
private int getInteger() {
public int intValue(String s) {
try {
return Math.max(0, Integer.parseInt(text()));
return Math.max(0, Integer.parseInt(s));
} catch (NumberFormatException nfe) {
return 0;
}
@@ -107,21 +56,36 @@ public class ItemQuantityField extends TextField {
@Override
public void onTextChange(String oldText) {
NEIClientUtils.setItemQuantity(getInteger());
NEIClientUtils.setItemQuantity(intValue());
}
@Override
public void draw(int mousex, int mousey) {
if (!focused() && intValue() == 0) {
field.setText(translate("itempanel.quantity.default"));
field.setCursorPositionZero();
field.setEnabled(false);
super.draw(mousex, mousey);
field.setEnabled(true);
field.setText("0");
} else {
super.draw(mousex, mousey);
}
}
@Override
public boolean onMouseWheel(int i, int mx, int my) {
if (!contains(mx, my)) return false;
int multiplier = 1;
if (NEIClientUtils.shiftKey()) {
multiplier = 10;
} else if (NEIClientUtils.controlKey()) {
multiplier = 64;
}
setText(Integer.toString(Math.max(0, getInteger() + i * multiplier)));
int quantity = intValue() + i * multiplier;
setText(Integer.toString(quantity));
return true;
}
+1 -1
View File
@@ -40,7 +40,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
@Override
public void draw(int mx, int my) {
if (this.stack != null && this.availableAreaWidth >= SLOT_SIZE * 2
if (this.stack != null
&& (NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled")
|| NEIClientConfig.isKeyHashDown("gui.itemzoom_hold"))
&& GuiContainerManager.shouldShowTooltip(NEIClientUtils.getGuiContainer())) {
+3 -3
View File
@@ -178,14 +178,14 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
protected void drawItem(ItemStack stack, Rectangle4i rect) {
if (rect.w != DEFAULT_SLOT_SIZE) {
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
GL11.glTranslatef(rect.x + 1, rect.y + 1, 0);
final float panelFactor = rect.w / DEFAULT_SLOT_SIZE;
GL11.glTranslatef(rect.x + panelFactor, rect.y + panelFactor, 0);
GL11.glScaled(panelFactor, panelFactor, 1);
GuiContainerManager.drawItem(0, 0, stack, true, "");
GL11.glScaled(1f / panelFactor, 1f / panelFactor, 1);
GL11.glTranslatef(-1 * (rect.x + 1), -1 * (rect.y + 1), 0);
GL11.glTranslatef(-1 * (rect.x + panelFactor), -1 * (rect.y + panelFactor), 0);
} else {
GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, stack, true, "");
}
@@ -51,10 +51,13 @@ public class ItemsPanelGrid extends ItemsGrid<ItemsPanelGrid.ItemsPanelGridSlot,
public void drawItem(Rectangle4i rect) {
if (!this.extended && getBGItem() != null) {
int scale = (int) Math.ceil(Math.min(rect.w, rect.h) / DEFAULT_SLOT_SIZE);
GuiContainerManager.drawItems.zLevel -= 10F;
super.drawItem(getBGItem(), rect.offset(1, -1));
super.drawItem(getBGItem(), rect.offset(1 * scale, -1 * scale));
GuiContainerManager.drawItems.zLevel += 10F;
super.drawItem(getItemStack(), rect.offset(-2, 2));
super.drawItem(getItemStack(), rect.offset(-2 * scale, 2 * scale));
} else {
super.drawItem(rect);
}
@@ -75,7 +78,7 @@ public class ItemsPanelGrid extends ItemsGrid<ItemsPanelGrid.ItemsPanelGridSlot,
}
public static void updateScale() {
SLOT_SIZE = 2 + (int) Math.ceil(8f * NEIClientConfig.getIntSetting("inventory.itempanelScale") / 100) * 2;
SLOT_SIZE = (int) Math.ceil(9f * NEIClientConfig.getIntSetting("inventory.itempanelScale") / 100) * 2;
}
@Override
@@ -136,8 +136,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
@Override
public void onPreDraw(GuiContainer gui) {
// Reset the gui to the center of the screen, for potion effect offsets etc
if (isEnabled() && gui instanceof InventoryEffectRenderer) {
if (!isHidden() && isEnabled() && gui instanceof InventoryEffectRenderer) // Reset the gui to the center of the
// screen, for potion effect offsets
// etc
{
gui.guiLeft = (gui.width - gui.xSize) / 2;
gui.guiTop = (gui.height - gui.ySize) / 2;
@@ -17,6 +17,7 @@ import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraft.world.storage.SaveFormatComparator;
import net.minecraftforge.common.MinecraftForge;
@@ -145,8 +146,7 @@ public class NEIClientConfig {
tag.getTag("inventory.widgetsenabled").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.widgetsenabled"));
tag.getTag("inventory.autocrafting").getBooleanValue(true);
tag.getTag("inventory.dynamicFontSize").getBooleanValue(true);
tag.getTag("inventory.autocrafting").getBooleanValue(false);
tag.getTag("inventory.hidden").getBooleanValue(false);
tag.getTag("inventory.cheatmode").getIntValue(2);
tag.getTag("inventory.lockmode").setComment(
@@ -197,14 +197,6 @@ public class NEIClientConfig {
tag.getTag("inventory.bookmarks.showRecipeMarkerMode").setComment("Show Recipe Marker").getIntValue(0);
API.addOption(new OptionCycled("inventory.bookmarks.showRecipeMarkerMode", 3, true));
tag.getTag("inventory.bookmarks.recipeMarkerColor").setComment("Color of the icon marker")
.getHexValue(0xADADAD);
API.addOption(
new OptionIntegerField(
"inventory.bookmarks.recipeMarkerColor",
0,
OptionIntegerField.UNSIGNED_INT_MAX));
tag.getTag("inventory.bookmarks.recipeChainDir").getIntValue(1);
API.addOption(new OptionCycled("inventory.bookmarks.recipeChainDir", 2, true));
@@ -212,10 +204,6 @@ public class NEIClientConfig {
.getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.bookmarks.ignorePotionOverlap", true));
tag.getTag("inventory.bookmarks.bookmarkItemsWithRecipe").setComment("Bookmark items with recipe")
.getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.bookmarks.bookmarkItemsWithRecipe", true));
tag.getTag("inventory.guirecipe.jeiStyleTabs").setComment("Enable/disable JEI Style Tabs")
.getBooleanValue(true);
API.addOption(new OptionToggleButtonBoubs("inventory.guirecipe.jeiStyleTabs", true));
@@ -248,15 +236,15 @@ public class NEIClientConfig {
.setComment("Require holding shift to move items when overlaying recipe").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.guirecipe.shiftOverlayRecipe", true));
tag.getTag("inventory.guirecipe.profile").getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.guirecipe.profile", true));
tag.getTag("inventory.subsets.enabled").setComment("Enable/disable Subsets Dropdown").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.subsets.enabled", true));
tag.getTag("inventory.subsets.widgetPosition").setComment("Subsets Widget Position").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.subsets.widgetPosition", true));
tag.getTag("inventory.guirecipe.profile").getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.guirecipe.profile", true));
tag.getTag("inventory.history.enabled").setComment("Enable/disable History Panel").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.history.enabled", true));
@@ -412,9 +400,6 @@ public class NEIClientConfig {
.getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.optimize_gui_overlap_computation", true));
tag.getTag("inventory.autocrafting").setComment("Autocrafting").getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.autocrafting", true));
tag.getTag("tools.handler_load_from_config").setComment("ADVANCED: Load handlers from config")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("tools.handler_load_from_config", true) {
@@ -716,13 +701,9 @@ public class NEIClientConfig {
}
});
tag.getTag("inventory.favorites.showRecipeTooltipInPanel").setComment("Show recipe tooltips in Items Panel")
tag.getTag("inventory.favorites.showRecipeTooltip").setComment("Show recipe tooltips in Items Panel")
.getBooleanValue(true);
API.addOption(new OptionToggleButton("inventory.favorites.showRecipeTooltipInPanel", true));
tag.getTag("inventory.favorites.showRecipeTooltipInGui").setComment("Show recipe tooltips in Recipe Gui")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.favorites.showRecipeTooltipInGui", true));
API.addOption(new OptionToggleButton("inventory.favorites.showRecipeTooltip", true));
tag.getTag("inventory.favorites.depth").setComment("Bookmark creation depth").getIntValue(3);
API.addOption(new OptionIntegerField("inventory.favorites.depth", 0, 100));
@@ -746,7 +727,7 @@ public class NEIClientConfig {
API.addHashBind("gui.remove_recipe", Keyboard.KEY_A + NEIClientUtils.SHIFT_HASH);
API.addKeyBind("gui.bookmark_pull_items", Keyboard.KEY_V);
API.addKeyBind("gui.overlay", Keyboard.KEY_S);
API.addKeyBind("gui.craft_items", Keyboard.KEY_C);
API.addHashBind("gui.craft", Keyboard.KEY_C + NEIClientUtils.SHIFT_HASH);
API.addHashBind("gui.hide_bookmarks", Keyboard.KEY_B);
API.addKeyBind("gui.getprevioussearch", Keyboard.KEY_UP);
API.addKeyBind("gui.getnextsearch", Keyboard.KEY_DOWN);
@@ -792,7 +773,7 @@ public class NEIClientConfig {
}
world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg")));
bootNEI();
bootNEI(ClientUtils.getWorld());
onWorldLoad(newWorld);
}
}
@@ -887,11 +868,11 @@ public class NEIClientConfig {
return NEIKeyboardUtils.getKeyName(hash + meta);
}
public static void bootNEI() {
public static void bootNEI(World world) {
if (!mainNEIConfigLoaded) {
// main NEI config loading
ItemInfo.load();
ItemInfo.load(world);
GuiInfo.load();
RecipeInfo.load();
HeldItemHandler.load();
@@ -981,12 +962,8 @@ public class NEIClientConfig {
return getIntSetting("inventory.bookmarks.recipeTooltipsMode");
}
public static boolean showRecipeTooltipInPanel() {
return getBooleanSetting("inventory.favorites.showRecipeTooltipInPanel");
}
public static boolean showRecipeTooltipInGui() {
return getBooleanSetting("inventory.favorites.showRecipeTooltipInGui");
public static boolean getFavoriteRecipeTooltips() {
return getBooleanSetting("inventory.favorites.showRecipeTooltip");
}
public static int showRecipeMarkerMode() {
@@ -52,7 +52,6 @@ import codechicken.lib.gui.GuiDraw;
import codechicken.lib.inventory.InventoryRange;
import codechicken.lib.inventory.InventoryUtils;
import codechicken.lib.util.LangProxy;
import codechicken.lib.vec.Rectangle4i;
import codechicken.nei.api.GuiInfo;
import codechicken.nei.api.IInfiniteItemHandler;
import codechicken.nei.api.ItemInfo;
@@ -61,36 +60,6 @@ import codechicken.nei.util.NEIMouseUtils;
public class NEIClientUtils extends NEIServerUtils {
public static class Alignment {
public final int x, y;
public static final Alignment TopLeft = new Alignment(-1, -1);
public static final Alignment TopCenter = new Alignment(0, -1);
public static final Alignment TopRight = new Alignment(1, -1);
public static final Alignment CenterLeft = new Alignment(-1, 0);
public static final Alignment Center = new Alignment(0, 0);
public static final Alignment CenterRight = new Alignment(1, 0);
public static final Alignment BottomLeft = new Alignment(-1, 1);
public static final Alignment BottomCenter = new Alignment(0, 1);
public static final Alignment BottomRight = new Alignment(1, 1);
public Alignment(int x, int y) {
this.x = x;
this.y = y;
}
public float getX(float parentWidth, float childWidth) {
final float x = (this.x + 1) / 2f;
return parentWidth * x - childWidth * x;
}
public float getY(float parentHeight, float childHeight) {
final float y = (this.y + 1) / 2f;
return parentHeight * y - childHeight * y;
}
}
public static LangProxy lang = new LangProxy("nei");
/** Formats a number with group separator and at most 2 fraction digits. */
@@ -540,35 +509,35 @@ public class NEIClientUtils extends NEIServerUtils {
GL11.glDisable(GL11.GL_BLEND);
}
public static void drawNEIOverlayText(String text, Rectangle4i rect, float scale, int color, boolean shadow,
Alignment alignment) {
public static void drawMarker(float x, float y, float scale, String text, int color, boolean alignRight,
boolean alignBottom) {
final float screenScale = mc().currentScreen.width * 1f / mc().displayWidth;
final double smallTextScale = Math
.max(screenScale, (Math.max(scale, 1f) * (GuiDraw.fontRenderer.getUnicodeFlag() ? 3F / 4F : 1F / 2F)));
final float smallTextScale = Math
.max(screenScale, Math.max(scale, 1f) * (GuiDraw.fontRenderer.getUnicodeFlag() ? 3F / 4F : 1F / 2F));
NEIClientUtils.gl2DRenderContext(() -> {
final int width = GuiDraw.fontRenderer.getStringWidth(text);
final float partW = rect.w / 2f;
final float partH = rect.h / 2f;
final double offsetX = Math
.ceil(rect.x + partW + partW * alignment.x - (width / 2f * (alignment.x + 1)) * smallTextScale);
final double offsetY = Math.ceil(
rect.y + partH
+ partH * alignment.y
- (GuiDraw.fontRenderer.FONT_HEIGHT / 2f * (alignment.y + 1)) * smallTextScale);
double offsetX = Math.ceil(x);
double offsetY = Math.ceil(y);
if (alignRight) {
offsetX = Math.ceil(x + 16 * scale - GuiDraw.fontRenderer.getStringWidth(text) * smallTextScale);
}
if (alignBottom) {
offsetY = Math
.ceil(y + 16 * scale - GuiDraw.fontRenderer.FONT_HEIGHT * smallTextScale + smallTextScale);
}
GL11.glTranslated(offsetX, offsetY, 0);
GL11.glScaled(smallTextScale, smallTextScale, 1);
GuiDraw.fontRenderer.drawString(text, 0, 0, color, shadow);
GL11.glScaled(1 / smallTextScale, 1 / smallTextScale, 1);
GL11.glScalef(smallTextScale, smallTextScale, 1f);
GuiDraw.fontRenderer.drawStringWithShadow(text, 0, 0, color);
GL11.glScalef(1f / smallTextScale, 1f / smallTextScale, 1f);
GL11.glTranslated(-1 * offsetX, -1 * offsetY, 0);
});
}
public static void drawNEIOverlayText(String text, int x, int y) {
drawNEIOverlayText(text, new Rectangle4i(x, y, 16, 16), 0.5f, 0xFDD835, false, Alignment.TopLeft);
}
public static void gl2DRenderContext(Runnable callback) {
boolean isLighting = GL11.glGetBoolean(GL11.GL_LIGHTING);
boolean isDepthTest = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
@@ -46,22 +46,9 @@ import codechicken.nei.PacketIDs.S2C;
import codechicken.nei.util.NBTHelper;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class NEIServerUtils {
private static Class<?> gtMetaBaseItem;
static {
try {
final ClassLoader loader = NEIServerUtils.class.getClassLoader();
NEIServerUtils.gtMetaBaseItem = ReflectionHelper
.getClass(loader, "gregtech.api.items.MetaBaseItem", "gregtech.api.items.GT_MetaBase_Item");
} catch (Exception ignored) {
/* Do nothing */
}
}
public static boolean isRaining(World world) {
return world.getWorldInfo().isRaining();
}
@@ -159,7 +146,7 @@ public class NEIServerUtils {
/**
* NBT-friendly version of {@link #areStacksSameType(ItemStack, ItemStack)}
*
*
* @param stack1 The {@link ItemStack} being compared.
* @param stack2 The {@link ItemStack} to compare to.
* @return whether the two items are the same in terms of itemID, damage and NBT.
@@ -190,35 +177,19 @@ public class NEIServerUtils {
/**
* NBT-friendly version of {@link #areStacksSameTypeCrafting(ItemStack, ItemStack)}
*
*
* @param stack1 The {@link ItemStack} being compared.
* @param stack2 The {@link ItemStack} to compare to.
* @return whether the two items are the same from the perspective of a crafting inventory.
*/
public static boolean areStacksSameTypeCraftingWithNBT(ItemStack stack1, ItemStack stack2) {
if (NEIServerUtils.areStacksSameTypeCrafting(stack2, stack1)) {
if (NBTHelper.matchTag(stack1.getTagCompound(), stack2.getTagCompound())) return true;
if (isItemTool(stack1)
&& (stack1.stackTagCompound == null || stack1.stackTagCompound.hasKey("GT.ToolStats"))
&& (stack2.stackTagCompound == null || stack2.stackTagCompound.hasKey("GT.ToolStats")))
return true;
return stack1.getMaxStackSize() == 1 && stack2.getMaxStackSize() == 1
&& (stack1.stackTagCompound == null ^ stack2.stackTagCompound == null);
}
return false;
}
/**
* GT Items don't have any NBT set for the recipe, so if either of the stacks has a NULL nbt, and the other doesn't,
* pretend they stack
*
* @param ItemStack stack
* @return
*/
public static boolean isItemTool(ItemStack stack) {
return NEIServerUtils.gtMetaBaseItem != null && NEIServerUtils.gtMetaBaseItem.isInstance(stack.getItem());
return stack1 != null && stack2 != null
&& stack1.getItem() == stack2.getItem()
&& (stack1.getItemDamage() == stack2.getItemDamage()
|| stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| stack2.getItemDamage() == OreDictionary.WILDCARD_VALUE
|| stack1.getItem().isDamageable())
&& NBTHelper.matchTag(stack1.getTagCompound(), stack2.getTagCompound());
}
/**
@@ -100,8 +100,6 @@ public class SearchField extends TextField implements ItemFilterProvider {
super(Minecraft.getMinecraft().fontRenderer, 0, 0, 0, 0);
this.searchParser = searchParser;
setFormatter(new SearchTextFormatter(searchParser));
setDisabledTextColour(0xFF303030);
setPlaceholder(NEIClientUtils.translate("inventory.search.placeholder"));
}
public ItemFilter getFilter() {
@@ -126,24 +126,19 @@ public class SearchTokenParser {
Language currentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage();
if (!currentLanguage.getLanguageCode().equals(providersCache.languageCode)) {
providersCache.providers = new ArrayList<>();
providersCache.languageCode = currentLanguage.getLanguageCode();
Map<Character, ISearchParserProvider> providers = new HashMap<>();
for (int index = this.searchProviders.size() - 1; index >= 0; index--) {
ISearchParserProvider provider = this.searchProviders.get(index);
if (provider.getMatchingLanguages().contains(currentLanguage)) {
if (provider.getSearchMode() == SearchMode.PREFIX && !providers.containsKey(provider.getPrefix())) {
providers.put(provider.getPrefix(), provider);
} else if (provider.getSearchMode() == SearchMode.ALWAYS) {
providersCache.providers.add(provider);
}
if (!providers.containsKey(provider.getPrefix())
&& provider.getMatchingLanguages().contains(currentLanguage)) {
providers.put(provider.getPrefix(), provider);
}
}
providersCache.providers.addAll(providers.values());
providersCache.providers = new ArrayList<>(providers.values());
providersCache.languageCode = currentLanguage.getLanguageCode();
}
return providersCache.providers;
@@ -163,7 +158,7 @@ public class SearchTokenParser {
return this.filtersCache.computeIfAbsent(filterText, text -> {
final String[] parts = text.split("\\|");
final List<ItemFilter> searchTokens = Arrays.stream(parts).map(this::parseSearchText).filter(s -> s != null)
.collect(Collectors.toList());
.collect(Collectors.toCollection(ArrayList::new));
if (searchTokens.isEmpty()) {
return new EverythingItemFilter();
@@ -9,6 +9,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
@@ -26,16 +27,21 @@ public class SpawnerRenderer implements IItemRenderer {
public void renderInventoryItem(RenderBlocks render, ItemStack item) {
int meta = item.getItemDamage();
if (meta == 0) meta = ItemMobSpawner.idPig;
String bossName = BossStatus.bossName;
int bossTimeout = BossStatus.statusBarTime;
boolean bossHasColorModifier = BossStatus.hasColorModifier;
Entity entity = ItemMobSpawner.getEntity(meta);
try {
World world = NEIClientUtils.mc().theWorld;
ItemMobSpawner.loadSpawners(world);
CCRenderState.changeTexture(TextureMap.locationBlocksTexture);
render.renderBlockAsItem(Blocks.mob_spawner, 0, 1F);
entity.setWorld(render.minecraftRB.theWorld);
GL11.glPushMatrix();
Entity entity = ItemMobSpawner.getEntity(meta);
entity.setWorld(world);
float f1 = 0.4375F;
if (entity.getShadowSize() > 1.5) f1 = 0.1F;
GL11.glRotatef((float) (ClientUtils.getRenderTime() * 10), 0.0F, 1.0F, 0.0F);
@@ -45,6 +51,7 @@ public class SpawnerRenderer implements IItemRenderer {
entity.setLocationAndAngles(0, 0, 0, 0.0F, 0.0F);
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 0);
GL11.glPopMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
@@ -4,11 +4,9 @@ import java.awt.Point;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -358,18 +356,16 @@ public class SubsetWidget extends Button implements ItemFilterProvider, IContain
private static class DefaultParserProvider implements ISearchParserProvider {
public ItemFilter getFilter(String searchText) {
final String pathPart = searchText.replaceAll("\\s+", "").toLowerCase();
final AnyMultiItemFilter filter = new AnyMultiItemFilter();
final Set<ItemStack> filteredItems = new HashSet<>();
final String pathPart = searchText.replaceAll("\\s+", "").toLowerCase();
for (SubsetTag tag : tags.values()) {
if (tag.filter != null && tag.path.contains(pathPart)) {
filteredItems.addAll(tag.items);
filter.filters.add(tag.filter);
}
}
return stack -> filteredItems.contains(stack) || !ItemList.items.contains(stack) && filter.matches(stack);
return filter;
}
public char getPrefix() {
@@ -589,13 +585,13 @@ public class SubsetWidget extends Button implements ItemFilterProvider, IContain
public void execute() {
try {
final List<SubsetTag> list = new ArrayList<>(tags.values());
List<SubsetTag> list = new ArrayList<>(tags.values());
root.clearCache();
list.parallelStream().forEach(tag -> {
tag.clearCache();
ItemList.items.stream().filter(tag.filter::matches)
ItemList.items.stream().filter(tag.filter::matches).map(ItemStack::copy)
.collect(Collectors.toCollection(() -> tag.items));
});
+2 -8
View File
@@ -3,7 +3,6 @@ package codechicken.nei.api;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import net.minecraft.block.Block;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -165,13 +164,8 @@ public class API {
* Add or replace the name normally shown on the item tooltip
*/
public static void setOverrideName(ItemStack item, String name) {
String existing = ItemInfo.nameOverrides.get(item);
if (!Objects.equals(name, existing)) {
if (name == null) {
ItemInfo.nameOverrides.remove(item);
} else {
ItemInfo.nameOverrides.put(item, name);
}
if (!name.equals(ItemInfo.nameOverrides.get(item))) {
ItemInfo.nameOverrides.put(item, name);
LayoutManager.markItemsDirty();
}
}
@@ -1,27 +1,14 @@
package codechicken.nei.api;
import java.util.Optional;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
public interface IStackStringifyHandler {
default NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize) {
return null;
}
public NBTTagCompound convertItemStackToNBT(ItemStack stack, boolean saveStackSize);
default ItemStack convertNBTToItemStack(NBTTagCompound nbtTag) {
return null;
}
default FluidStack getFluid(ItemStack stack) {
return null;
}
default Optional<ItemStack> getContainerItem(ItemStack stack) {
return null;
}
public ItemStack convertNBTToItemStack(NBTTagCompound nbtTag);
public FluidStack getFluid(ItemStack stack);
}
+78 -43
View File
@@ -5,7 +5,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.minecraft.block.Block;
@@ -124,12 +123,12 @@ public class ItemInfo {
addMobSpawnerItem();
}
public static void load() {
public static void load(World world) {
addVanillaBlockProperties();
addDefaultDropDowns();
searchItems();
parseModItems();
ItemMobSpawner.loadSpawners();
ItemMobSpawner.loadSpawners(world);
addSpawnEggs();
addInfiniteHandlers();
addInputHandlers();
@@ -269,8 +268,7 @@ public class ItemInfo {
@SuppressWarnings("unchecked")
private static void parseModItems() {
final Map<String, ItemStackSet> modSubsets = new HashMap<>();
HashMap<String, ItemStackSet> modSubsets = new HashMap<>();
for (Item item : (Iterable<Item>) Item.itemRegistry) {
UniqueIdentifier ident = null;
try {
@@ -282,12 +280,14 @@ public class ItemInfo {
continue;
}
itemOwners.put(item, ident.modId);
modSubsets.computeIfAbsent(ident.modId, i -> new ItemStackSet()).with(item);
String modId = ident.modId;
itemOwners.put(item, modId);
ItemStackSet itemset = modSubsets.get(modId);
if (itemset == null) modSubsets.put(modId, itemset = new ItemStackSet());
itemset.with(item);
}
API.addSubset("Mod.Minecraft", modSubsets.remove("minecraft"));
for (Entry<String, ItemStackSet> entry : modSubsets.entrySet()) {
ModContainer mc = FMLCommonHandler.instance().findContainerFor(entry.getKey());
if (mc == null) NEIClientConfig.logger.error("Missing container for " + entry.getKey());
@@ -323,29 +323,44 @@ public class ItemInfo {
}
private static void addDefaultDropDowns() {
final Item mob_spawner = Item.getItemFromBlock(Blocks.mob_spawner);
API.addSubset("Items", item -> Block.getBlockFromItem(item.getItem()) == Blocks.air);
API.addSubset("Blocks", item -> Block.getBlockFromItem(item.getItem()) != Blocks.air);
API.addSubset("Blocks.MobSpawners", item -> item.getItem() == mob_spawner);
API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner));
}
@SuppressWarnings("unchecked")
private static void searchItems() {
final Map<Integer, ItemStackSet> creativeTabRanges = new HashMap<>();
final List<ItemStack> stackList = new LinkedList<>();
ItemStackSet tools = new ItemStackSet();
ItemStackSet picks = new ItemStackSet();
ItemStackSet shovels = new ItemStackSet();
ItemStackSet axes = new ItemStackSet();
ItemStackSet hoes = new ItemStackSet();
ItemStackSet swords = new ItemStackSet();
ItemStackSet chest = new ItemStackSet();
ItemStackSet helmets = new ItemStackSet();
ItemStackSet legs = new ItemStackSet();
ItemStackSet boots = new ItemStackSet();
ItemStackSet other = new ItemStackSet();
ItemStackSet ranged = new ItemStackSet();
ItemStackSet food = new ItemStackSet();
ItemStackSet potioningredients = new ItemStackSet();
ArrayList<ItemStackSet> creativeTabRanges = new ArrayList<>(CreativeTabs.creativeTabArray.length);
List<ItemStack> stackList = new LinkedList<>();
for (Item item : (Iterable<Item>) Item.itemRegistry) {
if (item == null) continue;
for (CreativeTabs itemTab : item.getCreativeTabs()) {
if (itemTab != null) {
final ItemStackSet itemset = creativeTabRanges
.computeIfAbsent(itemTab.getTabIndex(), i -> new ItemStackSet());
while (itemTab.getTabIndex() >= creativeTabRanges.size()) creativeTabRanges.add(null);
ItemStackSet set = creativeTabRanges.get(itemTab.getTabIndex());
if (set == null) creativeTabRanges.set(itemTab.getTabIndex(), set = new ItemStackSet());
try {
stackList.clear();
item.getSubItems(item, itemTab, stackList);
itemset.addAll(stackList);
for (ItemStack stack : stackList) set.add(stack);
} catch (Exception e) {
NEIClientConfig.logger
.error("Error loading sub-items for: " + item + ". Tab: " + itemTab.getTabLabel(), e);
@@ -353,13 +368,41 @@ public class ItemInfo {
}
}
try {
final List<ItemStack> subItems = new LinkedList<>();
item.getSubItems(item, null, subItems);
if (item.isDamageable()) {
tools.with(item);
if (item instanceof ItemPickaxe) picks.with(item);
else if (item instanceof ItemSpade) shovels.with(item);
else if (item instanceof ItemAxe) axes.with(item);
else if (item instanceof ItemHoe) hoes.with(item);
else if (item instanceof ItemSword) swords.with(item);
else if (item instanceof ItemArmor) switch (((ItemArmor) item).armorType) {
case 0:
helmets.with(item);
break;
case 1:
chest.with(item);
break;
case 2:
legs.with(item);
break;
case 3:
boots.with(item);
break;
}
else if (item == Items.arrow || item == Items.bow) ranged.with(item);
else if (item == Items.fishing_rod || item == Items.flint_and_steel || item == Items.shears)
other.with(item);
}
if (item instanceof ItemFood) food.with(item);
try {
LinkedList<ItemStack> subItems = new LinkedList<>();
item.getSubItems(item, null, subItems);
for (ItemStack stack : subItems) {
if (item.isPotionIngredient(stack) && item.getPotionEffect(stack) != null) {
BrewingRecipeHandler.ingredients.add(stack);
potioningredients.add(stack);
}
}
@@ -367,33 +410,25 @@ public class ItemInfo {
NEIClientConfig.logger.error("Error loading brewing ingredients for: " + item, e);
}
}
API.addSubset("Items.Tools.Pickaxes", item -> item.getItem() instanceof ItemPickaxe);
API.addSubset("Items.Tools.Shovels", item -> item.getItem() instanceof ItemSpade);
API.addSubset("Items.Tools.Axes", item -> item.getItem() instanceof ItemAxe);
API.addSubset("Items.Tools.Hoes", item -> item.getItem() instanceof ItemHoe);
API.addSubset(
"Items.Tools.Other",
item -> item.getItem() == Items.fishing_rod || item.getItem() == Items.flint_and_steel
|| item.getItem() == Items.shears);
API.addSubset("Items.Weapons.Swords", item -> item.getItem() instanceof ItemSword);
API.addSubset("Items.Weapons.Ranged", item -> item.getItem() == Items.arrow || item.getItem() == Items.bow);
API.addSubset("Items.Armor.Helmets", item -> item.getItem() instanceof ItemArmor armor && armor.armorType == 0);
API.addSubset(
"Items.Armor.Chestplates",
item -> item.getItem() instanceof ItemArmor armor && armor.armorType == 1);
API.addSubset(
"Items.Armor.Leggings",
item -> item.getItem() instanceof ItemArmor armor && armor.armorType == 2);
API.addSubset("Items.Armor.Boots", item -> item.getItem() instanceof ItemArmor armor && armor.armorType == 3);
API.addSubset("Items.Food", item -> item.getItem() instanceof ItemFood);
API.addSubset("Items.Potions.Ingredients", BrewingRecipeHandler.ingredients);
API.addSubset("Items.Tools.Pickaxes", picks);
API.addSubset("Items.Tools.Shovels", shovels);
API.addSubset("Items.Tools.Axes", axes);
API.addSubset("Items.Tools.Hoes", hoes);
API.addSubset("Items.Tools.Other", other);
API.addSubset("Items.Weapons.Swords", swords);
API.addSubset("Items.Weapons.Ranged", ranged);
API.addSubset("Items.Armor.Chestplates", chest);
API.addSubset("Items.Armor.Leggings", legs);
API.addSubset("Items.Armor.Helmets", helmets);
API.addSubset("Items.Armor.Boots", boots);
API.addSubset("Items.Food", food);
API.addSubset("Items.Potions.Ingredients", potioningredients);
for (CreativeTabs tab : CreativeTabs.creativeTabArray) {
final ItemStackSet itemset = creativeTabRanges.get(tab.getTabIndex());
if (itemset != null && !itemset.isEmpty()) {
API.addSubset("CreativeTabs." + I18n.format(tab.getTranslatedTabLabel()), itemset);
}
if (tab.getTabIndex() >= creativeTabRanges.size()) continue;
ItemStackSet set = creativeTabRanges.get(tab.getTabIndex());
if (set != null && !set.isEmpty())
API.addSubset("CreativeTabs." + I18n.format(tab.getTranslatedTabLabel()), set);
}
BrewingRecipeHandler.searchPotions();
@@ -9,7 +9,6 @@ import java.util.Map;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
@@ -66,20 +65,11 @@ public abstract class ShortcutInputHandler {
return ItemPanels.bookmarkPanel.pullBookmarkItems(groupId, NEIClientUtils.shiftKey());
}
if (NEIClientConfig.autocraftingEnabled() && NEIClientConfig.isKeyHashDown("gui.craft_items")
&& NEIClientUtils.shiftKey()
&& ItemPanels.bookmarkPanel.getGrid().isCraftingMode(groupId)) {
final RecipeChainMath math = ItemPanels.bookmarkPanel.getGrid().createRecipeChainMath(groupId);
if (math != null) {
if (!NEIClientUtils.controlKey()) {
autocraftingIgnoreInventory(math);
}
AutoCraftingManager.runProcessing(math);
return true;
}
if (NEIClientConfig.autocraftingEnabled() && ItemPanels.bookmarkPanel.getGrid().isCraftingMode(groupId)
&& NEIClientConfig.isKeyHashDown("gui.craft")) {
AutoCraftingManager
.runProcessing(ItemPanels.bookmarkPanel.getGrid().createRecipeChainMath(groupId));
return true;
}
}
@@ -117,9 +107,8 @@ public abstract class ShortcutInputHandler {
return pullRecipeItems(stackover, NEIClientUtils.shiftKey());
}
if (NEIClientConfig.autocraftingEnabled() && NEIClientConfig.isKeyHashDown("gui.craft_items")
&& NEIClientUtils.shiftKey()) {
return runAutoCrafting(stackover, !NEIClientUtils.controlKey());
if (NEIClientConfig.autocraftingEnabled() && NEIClientConfig.isKeyHashDown("gui.craft")) {
return runAutoCrafting(stackover);
}
return false;
@@ -167,7 +156,7 @@ public abstract class ShortcutInputHandler {
return true;
}
private static boolean runAutoCrafting(ItemStack stackover, boolean ignoreInventory) {
private static boolean runAutoCrafting(ItemStack stackover) {
final RecipeId recipeId = GuiCraftingRecipe.getRecipeId(NEIClientUtils.getGuiContainer(), stackover);
if (recipeId != null) {
@@ -195,11 +184,6 @@ public abstract class ShortcutInputHandler {
}
if (math != null) {
if (ignoreInventory) {
autocraftingIgnoreInventory(math);
}
AutoCraftingManager.runProcessing(math);
return true;
}
@@ -258,8 +242,7 @@ public abstract class ShortcutInputHandler {
} else {
final RecipeId recipeId = recipe != null ? recipe.getRecipeId() : null;
final boolean existsRecipe = recipeId != null
&& ItemPanels.bookmarkPanel.existsRecipe(recipeId, BookmarkGrid.DEFAULT_GROUP_ID)
|| NEIClientConfig.getBooleanSetting("inventory.bookmarks.bookmarkItemsWithRecipe");
&& ItemPanels.bookmarkPanel.existsRecipe(recipeId, BookmarkGrid.DEFAULT_GROUP_ID);
if (!ItemPanels.bookmarkPanel
.removeItem(stackover, existsRecipe ? recipeId : null, BookmarkGrid.DEFAULT_GROUP_ID)) {
@@ -350,13 +333,7 @@ public abstract class ShortcutInputHandler {
}
if (NEIClientConfig.autocraftingEnabled() && ItemPanels.bookmarkPanel.getGrid().isCraftingMode(groupId)) {
hotkeys.put(
NEIClientConfig
.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("bookmark.group.craft_missing"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.group.craft_all"));
hotkeys.put(NEIClientConfig.getKeyName("gui.craft"), NEIClientUtils.translate("bookmark.group.craft"));
}
}
@@ -370,12 +347,13 @@ public abstract class ShortcutInputHandler {
if (slot != null) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark"),
NEIClientUtils.translate(slot.isIngredient() ? "bookmark.remove_item" : "bookmark.remove_recipe"));
NEIClientUtils
.translate(slot.isIngredient() ? "itempanel.remove_item" : "itempanel.remove_recipe"));
if (slot.isIngredient()) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.remove_recipe"));
NEIClientUtils.translate("itempanel.remove_recipe"));
}
if (BookmarkContainerInfo.getBookmarkContainerHandler(gui) != null) {
@@ -388,18 +366,18 @@ public abstract class ShortcutInputHandler {
}
} else {
hotkeys.put(NEIClientConfig.getKeyName("gui.bookmark"), NEIClientUtils.translate("bookmark.add_item"));
hotkeys.put(NEIClientConfig.getKeyName("gui.bookmark"), NEIClientUtils.translate("itempanel.add_item"));
if (StackInfo.getAmount(stack) > 0) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("bookmark.add_item_with_count"));
NEIClientUtils.translate("itempanel.add_item_with_count"));
}
if (recipeId != null) {
hotkeys.put(
NEIClientConfig.getKeyName("gui.bookmark", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("bookmark.add_item_with_recipe"));
NEIClientUtils.translate("itempanel.add_item_with_recipe"));
}
}
@@ -452,14 +430,7 @@ public abstract class ShortcutInputHandler {
}
if (NEIClientConfig.autocraftingEnabled()) {
hotkeys.put(
NEIClientConfig.getKeyName(
"gui.craft_items",
NEIClientUtils.SHIFT_HASH + NEIClientUtils.CTRL_HASH),
NEIClientUtils.translate("itempanel.craft_missing"));
hotkeys.put(
NEIClientConfig.getKeyName("gui.craft_items", NEIClientUtils.SHIFT_HASH),
NEIClientUtils.translate("itempanel.craft_all"));
hotkeys.put(NEIClientConfig.getKeyName("gui.craft"), NEIClientUtils.translate("itempanel.craft"));
}
}
@@ -468,28 +439,6 @@ public abstract class ShortcutInputHandler {
return hotkeys;
}
private static void autocraftingIgnoreInventory(RecipeChainMath math) {
final GuiContainer guiContainer = NEIClientUtils.getGuiContainer();
final InventoryPlayer playerInventory = guiContainer.mc.thePlayer.inventory;
final RecipeId rootRecipeId = math.createMasterRoot();
for (BookmarkItem item : math.recipeIngredients) {
if (item.amount > 0 && rootRecipeId.equals(item.recipeId)) {
long amount = 0;
for (ItemStack stack : playerInventory.mainInventory) {
if (stack != null && NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack, item.itemStack)) {
amount += StackInfo.getAmount(stack);
}
}
if (amount >= item.amount) {
item.factor = item.amount = amount + item.amount - (amount % item.amount);
}
}
}
}
private static RecipeId getHotkeyRecipeId(GuiContainer gui, int mousex, int mousey, ItemStack stack,
BookmarksGridSlot slot) {
@@ -413,7 +413,7 @@ public class NEITransformer implements IClassTransformer {
if (name.equals("net.minecraftforge.oredict.OreDictionary")) {
ClassReader cr = new ClassReader(bytes);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
cr.accept(new OreDictionaryVisitor(ASM5, cw), 0);
cr.accept(new OreDictionaryVisitor(ASM5, cw), ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
bytes = cw.toByteArray();
}
bytes = transformSubclasses(name, bytes);
@@ -1024,7 +1024,8 @@ public class BookmarkGrid extends ItemsGrid<BookmarksGridSlot, BookmarkGrid.Book
}
if (bookmarkItem != null && (group.crafting != null && group.viewMode == BookmarkViewMode.DEFAULT
|| group.viewMode == BookmarkViewMode.TODO_LIST && !sortableItem.bookmarkItem.isIngredient)) {
|| group.viewMode == BookmarkViewMode.TODO_LIST)) {
while (sortIndex > 0 && bookmarkItem.equalsRecipe(getCalculatedItem(sortedIndexes.get(sortIndex - 1)))) {
sortIndex--;
}
@@ -1054,8 +1055,7 @@ public class BookmarkGrid extends ItemsGrid<BookmarksGridSlot, BookmarkGrid.Book
if (nextSortIndex < sortedIndexes.size()) {
final int nextItemIndex = sortedIndexes.get(nextSortIndex);
if (group.viewMode == BookmarkViewMode.TODO_LIST && !target.isIngredient
&& target.equalsRecipe(getCalculatedItem(nextItemIndex))) {
if (group.viewMode == BookmarkViewMode.TODO_LIST && target.equalsRecipe(getCalculatedItem(nextItemIndex))) {
return -1;
}
@@ -10,7 +10,7 @@ import java.util.Map;
import java.util.stream.Collectors;
import codechicken.nei.BookmarkPanel.BookmarkViewMode;
import codechicken.nei.ItemSorter;
import codechicken.nei.ItemList;
import codechicken.nei.bookmark.RecipeChainDetails.BookmarkChainItem;
import codechicken.nei.bookmark.RecipeChainDetails.CalculatedType;
import codechicken.nei.recipe.Recipe.RecipeId;
@@ -236,10 +236,11 @@ public class BookmarkGridGenerator {
index++;
} else if (viewMode == BookmarkViewMode.DEFAULT) {
return index;
} else if (isFirstColumn && (meta.recipeId == null || previousMeta == null
} else if (isFirstColumn && (meta.recipeId == null || !meta.isIngredient
|| previousMeta == null
|| previousMeta.groupId != meta.groupId
|| !meta.recipeId.equals(previousMeta.recipeId)
|| index + 1 < maxIndex && this.grid.isInvalidSlot((index + 1) % maxIndex))) {
|| index + 1 < maxIndex && this.grid.isInvalidSlot((index + 1) % maxIndex)
|| meta.isIngredient && !meta.recipeId.equals(previousMeta.recipeId))) {
// In first column must be an item without recipe, a recipe result, or an ingredient
// if the second column is occupied
return index;
@@ -286,10 +287,7 @@ public class BookmarkGridGenerator {
private Comparator<Integer> generateSortingComparator(Map<Integer, BookmarkChainItem> calculatedItems) {
return Comparator.comparingInt((Integer index) -> calculatedItems.get(index).calculatedType.toInt())
.thenComparing(index -> StackInfo.getFluid(calculatedItems.get(index).getItem().itemStack) != null)
.thenComparing(
(i1, i2) -> ItemSorter.instance.compare(
calculatedItems.get(i1).getItem().itemStack,
calculatedItems.get(i2).getItem().itemStack));
.thenComparing(index -> ItemList.getItemOrderIndex(calculatedItems.get(index).getItem().itemStack));
}
private void splitGridMask() {
@@ -9,7 +9,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.recipe.Recipe;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.recipe.Recipe.RecipeIngredient;
@@ -17,8 +16,6 @@ import codechicken.nei.recipe.StackInfo;
public class BookmarkItem {
private static Map<ItemStack, String> fuzzyPermutations = new HashMap<>();
public int groupId;
public long amount = 0L;
@@ -123,24 +120,13 @@ public class BookmarkItem {
return Collections.singletonMap(getItemGUID(stack), stack);
}
private static synchronized String getItemGUID(ItemStack stack) {
private static String getItemGUID(ItemStack stack) {
final FluidStack fluidStack = StackInfo.getFluid(stack);
if (fluidStack != null) {
return fluidStack.getFluid().getName() + ":" + fluidStack.tag;
} else {
for (Map.Entry<ItemStack, String> entry : BookmarkItem.fuzzyPermutations.entrySet()) {
if (NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack, entry.getKey())) {
BookmarkItem.fuzzyPermutations.put(stack, entry.getValue());
return entry.getValue();
}
}
final String stackGUID = StackInfo.getItemStackGUID(stack);
BookmarkItem.fuzzyPermutations.put(stack, stackGUID);
return stackGUID;
return StackInfo.getItemStackGUID(stack);
}
}
@@ -11,7 +11,6 @@ import codechicken.nei.ItemsGrid.ItemsGridSlot;
import codechicken.nei.ItemsGrid.MouseContext;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIClientUtils.Alignment;
import codechicken.nei.bookmark.BookmarkGrid.BookmarkMouseContext;
import codechicken.nei.bookmark.RecipeChainDetails.CalculatedType;
import codechicken.nei.recipe.Recipe.RecipeId;
@@ -91,8 +90,7 @@ public class BookmarksGridSlot extends ItemsGridSlot {
final BookmarkGrid grid = ItemPanels.bookmarkPanel.getGrid();
final BookmarkItem prevItem = grid.getCalculatedItem(
grid.gridGenerator.slotToItem.getOrDefault(grid.gridGenerator.itemToSlot.get(this.itemIndex) - 1, -1));
this.isFirstOutput = this.itemIndex >= 0 && !this.bookmarkItem.isIngredient
&& ((this.slotIndex % grid.getColumns()) == 0 || group.viewMode == BookmarkViewMode.DEFAULT)
this.isFirstOutput = this.itemIndex >= 0
&& (prevItem == null || prevItem.isIngredient || !this.bookmarkItem.equalsRecipe(prevItem));
this.rowIndex = this.slotIndex / grid.getColumns();
}
@@ -254,35 +252,26 @@ public class BookmarksGridSlot extends ItemsGridSlot {
drawMarker(
rect,
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.realMultiplier),
0xFFFFFF);
0xAAAAAA);
} else if (shownItemType == ShownItemType.SHIFT) {
drawMarker(rect, "x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(getMultiplier()), 0xFFFFFF);
} else if (this.isOutputRecipe || this.realMultiplier > 1) {
} else if (this.isOutputRecipe) {
drawMarker(
rect,
"x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(this.realMultiplier),
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
0xAAAAAA);
} else if (NEIClientConfig.showRecipeMarkerMode() == 1) {
drawMarker(
rect,
"R",
NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
drawMarker(rect, "R", 0xA0A0A0);
}
} else if (NEIClientConfig.showRecipeMarkerMode() == 1) {
drawMarker(rect, "R", NEIClientConfig.getSetting("inventory.bookmarks.recipeMarkerColor").getHexValue());
drawMarker(rect, "R", 0xA0A0A0);
}
}
protected void drawMarker(Rectangle4i rect, String text, int color) {
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
NEIClientUtils.drawNEIOverlayText(
text,
new Rectangle4i(rect.x + 1, rect.y + 1, rect.w - 2, rect.h - 2),
panelFactor,
color,
true,
Alignment.TopLeft);
final float panelFactor = rect.w / DEFAULT_SLOT_SIZE;
NEIClientUtils.drawMarker(rect.x + panelFactor, rect.y + panelFactor, panelFactor, text, color, false, false);
}
protected void drawStackSize(Rectangle4i rect, ShownItemType shownItemType) {
@@ -295,7 +284,7 @@ public class BookmarksGridSlot extends ItemsGridSlot {
}
if (amount > 0 || shownItemType == ShownItemType.REAL && this.bookmarkItem.factor > 0) {
final float panelFactor = (rect.w - 2) / (DEFAULT_SLOT_SIZE - 2);
final float panelFactor = rect.w / DEFAULT_SLOT_SIZE;
final long stackSize = this.bookmarkItem.getStackSize(amount);
String amountString = "";
@@ -309,13 +298,14 @@ public class BookmarksGridSlot extends ItemsGridSlot {
amountString += "L";
}
NEIClientUtils.drawNEIOverlayText(
amountString,
new Rectangle4i(rect.x + 1, rect.y + 1, rect.w - 2, rect.h - 2),
NEIClientUtils.drawMarker(
rect.x + panelFactor,
rect.y + panelFactor,
panelFactor,
amountString,
0xFFFFFF,
true,
this.isFluidDisplay ? Alignment.BottomLeft : Alignment.BottomRight);
!this.isFluidDisplay,
true);
}
}
@@ -180,11 +180,7 @@ public class GuiContainerManager {
namelist.set(0, stack.getRarity().rarityColor.toString() + namelist.get(0));
for (int i = 1; i < namelist.size(); i++) {
if (namelist.get(i) == null) {
namelist.set(i, "");
} else if (!namelist.get(i).startsWith(GuiDraw.TOOLTIP_HANDLER)) {
namelist.set(i, EnumChatFormatting.GRAY + namelist.get(i) + EnumChatFormatting.RESET);
}
namelist.set(i, EnumChatFormatting.GRAY + namelist.get(i) + EnumChatFormatting.RESET);
}
return namelist;
@@ -216,15 +212,15 @@ public class GuiContainerManager {
@Nullable
public static String itemCountDetails(ItemStack stack) {
final FluidStack fluid = StackInfo.getFluid(stack);
FluidStack fluid = StackInfo.getFluid(stack);
if (fluid != null) {
return fluidAmountDetails(fluid.amount * Math.max(1, stack.stackSize));
} else {
return countDetails(
stack.stackSize,
stack.getMaxStackSize(),
translate("inventory.tooltip.count.item", "%s = %s * %s + %s"),
translate("inventory.tooltip.count.item", "%s = %s * %s"));
"Count: %s = %s * %s + %s",
"Count: %s = %s * %s");
}
}
@@ -236,11 +232,7 @@ public class GuiContainerManager {
@Nullable
public static String fluidAmountDetails(int amount) {
return countDetails(
amount,
144,
translate("inventory.tooltip.count.fluid", "%s L = %s * %s L + %s L"),
translate("inventory.tooltip.count.fluid", "%s L = %s * %s L"));
return countDetails(amount, 144, "Amount: %s L = %s * %s L + %s L", "Amount: %s L = %s * %s L");
}
/**
@@ -313,19 +305,14 @@ public class GuiContainerManager {
if (stackSize == null) {
if (itemstack.stackSize > 1) {
stackSize = ReadableNumberConverter.INSTANCE.toWideReadableForm(itemstack.stackSize);
if (NEIClientConfig.getBooleanSetting("inventory.dynamicFontSize")) {
stackSize = ReadableNumberConverter.INSTANCE.toWideReadableForm(itemstack.stackSize);
if (stackSize.length() == 3) {
scale = 0.8f;
} else if (stackSize.length() == 4) {
scale = 0.6f;
} else if (stackSize.length() > 4) {
scale = 0.5f;
}
} else {
stackSize = String.valueOf(itemstack.stackSize);
if (stackSize.length() == 3) {
scale = 0.8f;
} else if (stackSize.length() == 4) {
scale = 0.6f;
} else if (stackSize.length() > 4) {
scale = 0.5f;
}
} else {
@@ -731,18 +718,15 @@ public class GuiContainerManager {
final List<String> currentTooltip = tooltips.get(tooltipPage);
if (maxTooltipPage > 1) {
final String lastLine = currentTooltip.remove(currentTooltip.size() - 1);
final String pageTooltip = EnumChatFormatting.ITALIC + NEIClientUtils.translate(
"inventory.tooltip.page",
tooltipPage + 1,
maxTooltipPage,
NEIClientConfig.getKeyName("gui.next_tooltip"));
if (lastLine.startsWith(GuiDraw.TOOLTIP_HANDLER)) {
currentTooltip.add(lastLine);
} else {
currentTooltip.add(lastLine + GuiDraw.TOOLTIP_LINESPACE);
}
currentTooltip.set(
currentTooltip.size() - 1,
currentTooltip.get(currentTooltip.size() - 1) + GuiDraw.TOOLTIP_LINESPACE);
currentTooltip.add(pageTooltip);
}
@@ -43,7 +43,7 @@ public class AcceptsFollowingTooltipLineHandler extends ItemsTooltipLineHandler
super.drawItem(x, y, drawStack, stackSize);
if (FavoriteRecipes.contains(drawStack)) {
NEIClientUtils.drawNEIOverlayText("F", x, y);
NEIClientUtils.drawMarker(x, y, 1f, "F", 0xA0A0A0, false, false);
}
}
@@ -2,11 +2,14 @@ package codechicken.nei.recipe;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import codechicken.nei.ItemStackAmount;
import codechicken.nei.NEIClientUtils;
@@ -22,11 +25,16 @@ public class AutoCraftingManager {
private static final RestartableTask task = new RestartableTask("NEI Bookmark AutoCraft Processing") {
private static final ItemStack ROOT_ITEM = new ItemStack(Blocks.fire);
private static final RecipeId ROOT_RECIPE_ID = RecipeId
.of(ROOT_ITEM, "recipe-autocrafting", Collections.emptyList());
@Override
public void execute() {
final GuiContainer guiContainer = NEIClientUtils.getGuiContainer();
final InventoryPlayer playerInventory = guiContainer.mc.thePlayer.inventory;
final ItemStackAmount inventory = ItemStackAmount.of(Arrays.asList(playerInventory.mainInventory));
final RecipeChainMath math = createMasterRoot(AutoCraftingManager.math);
final List<BookmarkItem> initialItems = prepareInitialItems(math, inventory);
boolean processed = false;
boolean changed = false;
@@ -83,6 +91,31 @@ public class AutoCraftingManager {
return interrupted() || guiContainer != NEIClientUtils.getGuiContainer();
}
private RecipeChainMath createMasterRoot(RecipeChainMath math) {
final List<BookmarkItem> rootIngredients = new ArrayList<>();
for (BookmarkItem item : math.recipeResults) {
if (math.outputRecipes.containsKey(item.recipeId)) {
long amount = item.factor * math.outputRecipes.get(item.recipeId);
rootIngredients.add(
BookmarkItem.of(
-1,
item.getItemStack(amount),
item.getStackSize(amount),
ROOT_RECIPE_ID,
true,
BookmarkItem.generatePermutations(item.itemStack, null)));
}
}
math.outputRecipes.clear();
math.outputRecipes.put(ROOT_RECIPE_ID, 1L);
math.recipeResults.add(BookmarkItem.of(-1, ROOT_ITEM, 1, ROOT_RECIPE_ID, false));
math.recipeIngredients.addAll(rootIngredients);
return math;
}
private List<BookmarkItem> prepareInitialItems(RecipeChainMath math, ItemStackAmount inventory) {
final List<BookmarkItem> initialItems = new ArrayList<>();
@@ -106,7 +139,6 @@ public class AutoCraftingManager {
AutoCraftingManager.math = math;
if (AutoCraftingManager.math != null) {
math.createMasterRoot();
task.restart();
}
}
@@ -36,10 +36,11 @@ public class CheatItemHandler extends INEIGuiAdapter {
draggedStack.stackSize -= total - contents;
}
return true;
} else {
draggedStack.stackSize = 0;
}
return true;
}
return false;
@@ -6,11 +6,9 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
@@ -19,11 +17,26 @@ import net.minecraft.item.ItemStack;
import codechicken.lib.inventory.InventoryUtils;
import codechicken.nei.FastTransferManager;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.api.IOverlayHandler;
import codechicken.nei.util.NBTHelper;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class DefaultOverlayHandler implements IOverlayHandler {
private static Class<?> gtItem;
static {
try {
final ClassLoader loader = DefaultOverlayHandler.class.getClassLoader();
gtItem = ReflectionHelper
.getClass(loader, "gregtech.api.items.MetaBaseItem", "gregtech.api.items.GT_MetaBase_Item");
} catch (Exception ignored) {
/* Do nothing */
}
}
public static class DistributedIngred {
public DistributedIngred(ItemStack item) {
@@ -35,7 +48,6 @@ public class DefaultOverlayHandler implements IOverlayHandler {
public int distributed;
public int numSlots;
public int recipeAmount;
public boolean isContainerItem = false;
}
public static class IngredientDistribution {
@@ -123,8 +135,6 @@ public class DefaultOverlayHandler implements IOverlayHandler {
}
clearIngredients(firstGui);
return craft;
}
@@ -140,103 +150,67 @@ public class DefaultOverlayHandler implements IOverlayHandler {
}
}
return dropOffMouseStack(thePlayer, gui);
return true;
}
private void moveIngredients(GuiContainer gui, List<IngredientDistribution> assignedIngredients, int multiplier) {
final EntityClientPlayerMP thePlayer = NEIClientUtils.mc().thePlayer;
for (IngredientDistribution distrib : assignedIngredients) {
if (distrib.slots.length == 0) continue;
for (Slot slot : gui.inventorySlots.inventorySlots) {
if (slot instanceof SlotCrafting || !slot.getHasStack()
|| !canMoveFrom(slot, gui)
|| !slot.canTakeStack(thePlayer))
continue;
ItemStack stack = slot.getStack();
int slotTransferCap = stack.getMaxStackSize();
ItemStack pstack = distrib.permutation;
int transferCap = multiplier * pstack.stackSize;
int transferred = 0;
for (IngredientDistribution distrib : assignedIngredients) {
if (distrib.slots.length == 0 || !slot.getHasStack() || !canStack(distrib.permutation, stack)) continue;
int transferCap = Math.min(slotTransferCap, multiplier * distrib.permutation.stackSize);
int stackSize = slot.getStack().stackSize;
boolean pickup = false;
int destSlotIndex = 0;
Slot dest = distrib.slots[0];
int slotTransferred = 0;
int slotTransferCap = pstack.getMaxStackSize();
for (Slot dest : distrib.slots) {
int amount = Math
.min(transferCap - (dest.getHasStack() ? dest.getStack().stackSize : 0), stackSize);
for (Slot slot : gui.inventorySlots.inventorySlots) {
if (!slot.getHasStack() || !canMoveFrom(slot, gui)) continue;
if (stackSize <= amount) {
ItemStack stack = slot.getStack();
if (!canStack(pstack, stack)) continue;
if (!pickup) {
FastTransferManager.clickSlot(gui, slot.slotNumber);
}
FastTransferManager.clickSlot(gui, dest.slotNumber);
break;
} else {
for (int c = 0; c < amount; c++) {
if (pickup != (pickup = true)) {
FastTransferManager.clickSlot(gui, slot.slotNumber);
}
FastTransferManager.clickSlot(gui, dest.slotNumber, 1);
stackSize--;
int amount = Math.min(transferCap - transferred, stack.stackSize);
FastTransferManager.clickSlot(gui, slot.slotNumber);
for (int c = 0; c < amount; c++) {
FastTransferManager.clickSlot(gui, dest.slotNumber, 1);
transferred++;
slotTransferred++;
if (slotTransferred >= slotTransferCap) {
destSlotIndex++;
if (destSlotIndex == distrib.slots.length) {
dest = null;
break;
}
dest = distrib.slots[destSlotIndex];
slotTransferred = 0;
}
}
if (thePlayer.inventory.getItemStack() != null) {
FastTransferManager.clickSlot(gui, slot.slotNumber);
}
}
}
}
protected boolean dropOffMouseStack(EntityPlayer entityPlayer, GuiContainer gui) {
if (entityPlayer.inventory.getItemStack() == null) {
return true;
}
for (int i = 0; i < gui.inventorySlots.inventorySlots.size(); i++) {
Slot slot = gui.inventorySlots.inventorySlots.get(i);
if (slot.inventory == entityPlayer.inventory) {
ItemStack mouseItem = entityPlayer.inventory.getItemStack();
ItemStack slotStack = slot.getStack();
if (slotStack == null || NEIClientUtils.areStacksSameType(mouseItem, slotStack)) {
FastTransferManager.clickSlot(gui, i, 0, 0);
}
if (entityPlayer.inventory.getItemStack() == null) {
return true;
}
FastTransferManager.clickSlot(gui, slot.slotNumber);
if (transferred >= transferCap || dest == null) break;
}
}
return entityPlayer.inventory.getItemStack() == null;
}
private int calculateRecipeQuantity(List<IngredientDistribution> assignedIngredients) {
int quantity = Integer.MAX_VALUE;
for (IngredientDistribution distrib : assignedIngredients) {
final DistributedIngred istack = distrib.distrib;
DistributedIngred istack = distrib.distrib;
if (istack.numSlots == 0) return 0;
final int maxStackSize = istack.stack.getMaxStackSize();
if (maxStackSize == 1 && istack.isContainerItem) {
int allSlots = istack.invAmount;
if (allSlots / istack.numSlots > maxStackSize) allSlots = istack.numSlots * maxStackSize;
final int newQuantity = allSlots / istack.distributed;
if (maxStackSize == 1) {
// If non-stackable, fill up as much as possible of the other ingredients
continue;
}
final int allSlots = Math.min(istack.invAmount, istack.numSlots * maxStackSize);
quantity = Math.min(quantity, allSlots / istack.distributed);
quantity = Math.min(quantity, newQuantity);
}
if (quantity == Integer.MAX_VALUE) {
@@ -331,20 +305,9 @@ public class DefaultOverlayHandler implements IOverlayHandler {
private void findInventoryQuantities(GuiContainer gui, List<DistributedIngred> ingredStacks) {
for (Slot slot : gui.inventorySlots.inventorySlots) /* work out how much we have to go round */ {
if (slot.getHasStack() && canMoveFrom(slot, gui)) {
final ItemStack pstack = slot.getStack();
final DistributedIngred istack = findIngred(ingredStacks, pstack);
if (istack != null) {
istack.invAmount += pstack.stackSize;
if (!istack.isContainerItem && pstack.getMaxStackSize() == 1
&& pstack.getItem().hasContainerItem(pstack)) {
final Optional<ItemStack> containerItem = StackInfo.getContainerItem(pstack);
if (containerItem != null && containerItem.isPresent()) {
istack.isContainerItem = pstack.getItem() == containerItem.get().getItem();
}
}
}
ItemStack pstack = slot.getStack();
DistributedIngred istack = findIngred(ingredStacks, pstack);
if (istack != null) istack.invAmount += pstack.stackSize;
}
}
}
@@ -388,6 +351,16 @@ public class DefaultOverlayHandler implements IOverlayHandler {
protected boolean canStack(ItemStack stack1, ItemStack stack2) {
if (stack1 == null || stack2 == null) return true;
return NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack1, stack2);
if (NEIServerUtils.areStacksSameTypeCrafting(stack2, stack1)) {
if (NBTHelper.matchTag(stack1.getTagCompound(), stack2.getTagCompound())) return true;
// GT Items don't have any NBT set for the recipe, so if either of the stacks has a NULL nbt, and the other
// doesn't, pretend they stack
if (((gtItem != null && gtItem.isInstance(stack1.getItem()))
|| (stack1.getMaxStackSize() == 1 && stack2.getMaxStackSize() == 1))
&& (stack1.stackTagCompound == null ^ stack2.stackTagCompound == null))
return true;
}
return false;
}
}
@@ -18,7 +18,7 @@ public class FillFluidContainerHandler extends INEIGuiAdapter {
return false;
}
if (StackInfo.isFluidContainer(draggedStack)) {
if (draggedStack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(draggedStack)) {
ItemStack overItemStack = ItemPanels.itemPanel.getStackMouseOver(mouseX, mouseY);
if (overItemStack == null) {
@@ -627,7 +627,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
}
public Recipe getFocusedRecipe() {
final List<Integer> indices = getRecipeIndices();
List<Integer> indices = getRecipeIndices();
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
final int recipeIndex = indices.get(refIndex);
@@ -641,6 +641,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
protected boolean recipeInFocus(int refIndex, int recipeIndex) {
final PositionedStack result = handler.original.getResultStack(recipeIndex);
if (result != null && isMouseOver(result, refIndex)) {
return true;
}
@@ -655,15 +656,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
return false;
}
public boolean isMouseOver(PositionedStack stack, int refIndex) {
Point p = getRefIndexPosition(refIndex);
Point mousepos = GuiDraw.getMousePosition();
Slot stackSlot = slotcontainer.getSlotWithStack(stack, p.x, p.y);
Slot mouseoverSlot = getSlotAtPosition(mousepos.x, mousepos.y);
return stackSlot == mouseoverSlot;
}
public String getHandlerName() {
return handlerInfo.getHandlerName();
}
@@ -882,19 +874,14 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
if (NEIClientConfig.showCycledIngredientsTooltip() && itemstack != null) {
PositionedStack hovered = null;
outer: for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
for (int refIndex = 0; refIndex < indices.size() && hovered == null; refIndex++) {
final int recipeIndex = indices.get(refIndex);
final List<PositionedStack> stacks = handler.original.getIngredientStacks(recipeIndex);
List<List<PositionedStack>> stackGroups = Arrays.asList(
handler.original.getIngredientStacks(recipeIndex),
handler.original.getOtherStacks(recipeIndex));
for (List<PositionedStack> group : stackGroups) {
for (PositionedStack pStack : group) {
if (isMouseOver(pStack, refIndex)) {
hovered = pStack;
break outer;
}
for (PositionedStack pStack : stacks) {
if (isMouseOver(pStack, refIndex)) {
hovered = pStack;
break;
}
}
}
@@ -1217,6 +1204,15 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
return firstGuiGeneral;
}
public boolean isMouseOver(PositionedStack stack, int refIndex) {
Point p = getRefIndexPosition(refIndex);
Point mousepos = GuiDraw.getMousePosition();
Slot stackSlot = slotcontainer.getSlotWithStack(stack, p.x, p.y);
Slot mouseoverSlot = getSlotAtPosition(mousepos.x, mousepos.y);
return stackSlot == mouseoverSlot;
}
private int getRecipesPerPage() {
return limitToOneRecipe ? 1 : getRecipesPerPage(handlerInfo);
}
@@ -14,7 +14,6 @@ import codechicken.nei.recipe.Recipe.RecipeId;
public class RecipeHandlerRef {
private static final LRUCache<Class<?>, Boolean> transferAlghoritmCache = new LRUCache<>(200);
private static final LRUCache<RecipeId, RecipeHandlerRef> recipeRefCache = new LRUCache<>(200);
public final IRecipeHandler handler;
public final int recipeIndex;
@@ -140,36 +139,20 @@ public class RecipeHandlerRef {
public boolean allowedTransferAlghoritm(GuiContainer gui) {
final IOverlayHandler overlayHandler = getOverlayHandler(gui);
if (overlayHandler == null) {
return false;
}
return transferAlghoritmCache.computeIfAbsent(overlayHandler.getClass(), clazz -> {
if (overlayHandler != null) {
try {
if (overlayHandler instanceof DefaultOverlayHandler) {
final Class<?> overlayRecipeClazz = overlayHandler.getClass()
.getMethod(
"overlayRecipe",
GuiContainer.class,
IRecipeHandler.class,
int.class,
boolean.class)
.getDeclaringClass();
if (overlayRecipeClazz.equals(DefaultOverlayHandler.class)) {
return true;
}
}
return !overlayHandler.getClass()
.getMethod("transferRecipe", GuiContainer.class, IRecipeHandler.class, int.class, int.class)
.getDeclaredMethod(
"transferRecipe",
GuiContainer.class,
IRecipeHandler.class,
int.class,
int.class)
.isDefault();
} catch (NoSuchMethodException e) {}
}
return false;
});
return false;
}
public IRecipeOverlayRenderer getRecipeOverlayRenderer(GuiContainer gui) {
@@ -1,28 +1,17 @@
package codechicken.nei.recipe;
import java.util.List;
import java.util.Map;
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.BookmarkPanel.BookmarkViewMode;
import codechicken.nei.FavoriteRecipes;
import codechicken.nei.ItemPanels;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.api.ShortcutInputHandler;
import codechicken.nei.bookmark.BookmarksGridSlot;
import codechicken.nei.guihook.GuiContainerManager;
import codechicken.nei.guihook.IContainerInputHandler;
import codechicken.nei.guihook.IContainerTooltipHandler;
import codechicken.nei.recipe.Recipe.RecipeId;
public class RecipeItemInputHandler implements IContainerInputHandler, IContainerTooltipHandler {
protected RecipeTooltipLineHandler recipeTooltipLineHandler = null;
public static void load() {
RecipeItemInputHandler recipeHandler = new RecipeItemInputHandler();
GuiContainerManager.addInputHandler(recipeHandler);
@@ -58,63 +47,6 @@ public class RecipeItemInputHandler implements IContainerInputHandler, IContaine
return hotkeys;
}
@Override
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
List<String> currenttip) {
if (itemstack != null) {
final RecipeId recipeId = getHoveredRecipeId(gui, itemstack, mousex, mousey);
if (recipeId == null) {
recipeTooltipLineHandler = null;
} else if (recipeTooltipLineHandler == null || !recipeTooltipLineHandler.getRecipeId().equals(recipeId)) {
recipeTooltipLineHandler = new RecipeTooltipLineHandler(recipeId);
}
if (recipeTooltipLineHandler != null) {
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(recipeTooltipLineHandler));
}
} else {
recipeTooltipLineHandler = null;
}
return currenttip;
}
private RecipeId getHoveredRecipeId(GuiContainer gui, ItemStack itemstack, int mousex, int mousey) {
if (ItemPanels.bookmarkPanel.contains(mousex, mousey)) {
final BookmarksGridSlot slot = ItemPanels.bookmarkPanel.getSlotMouseOver(mousex, mousey);
if (slot != null && slot.getRecipeId() != null
&& !slot.isIngredient()
&& NEIClientConfig.getRecipeTooltipsMode() != 0) {
final int tooltipMode = NEIClientConfig.getRecipeTooltipsMode();
final BookmarkViewMode viewMode = slot.getGroup().viewMode;
if (tooltipMode == 3 || viewMode == BookmarkViewMode.DEFAULT && tooltipMode == 1
|| viewMode == BookmarkViewMode.TODO_LIST && tooltipMode == 2) {
return slot.getRecipeId();
}
}
return null;
}
if (ItemPanels.itemPanel.contains(mousex, mousey)
|| ItemPanels.itemPanel.historyPanel.contains(mousex, mousey)) {
return NEIClientConfig.showRecipeTooltipInPanel() ? FavoriteRecipes.getFavorite(itemstack) : null;
}
if (gui instanceof GuiRecipe<?>guiRecipe
&& new Rectangle4i(gui.guiLeft, gui.guiTop, gui.xSize, gui.ySize).contains(mousex, mousey)
&& NEIClientConfig.showRecipeTooltipInGui()
&& guiRecipe.getFocusedRecipe() == null) {
return FavoriteRecipes.getFavorite(itemstack);
}
return null;
}
@Override
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {}
@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
@@ -74,16 +73,6 @@ public class StackInfo {
return stack;
}
public static Optional<ItemStack> getContainerItem(ItemStack stack) {
Optional<ItemStack> result = null;
for (int i = stackStringifyHandlers.size() - 1; i >= 0 && result == null; i--) {
result = stackStringifyHandlers.get(i).getContainerItem(stack);
}
return result;
}
public static ItemStack withAmount(ItemStack stack, long customCount) {
if (stack == null) return null;
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
@@ -101,7 +90,7 @@ public class StackInfo {
return false;
}
if (useNBT && stackA != stackB) {
if (useNBT) {
NBTTagCompound tagCompoundA = itemStackToNBT(stackA, false);
NBTTagCompound tagCompoundB = itemStackToNBT(stackB, false);
@@ -6,14 +6,11 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import codechicken.nei.ItemStackAmount;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.bookmark.BookmarkItem;
import codechicken.nei.recipe.Recipe;
import codechicken.nei.recipe.Recipe.RecipeId;
@@ -22,10 +19,6 @@ import codechicken.nei.recipe.StackInfo;
public class RecipeChainMath {
private static final ItemStack ROOT_ITEM = new ItemStack(Blocks.fire);
private static final RecipeId ROOT_RECIPE_ID = RecipeId
.of(ROOT_ITEM, "recipe-autocrafting", Collections.emptyList());
public final Map<RecipeId, Long> outputRecipes = new HashMap<>();
public final List<BookmarkItem> initialItems = new ArrayList<>();
@@ -34,8 +27,6 @@ public class RecipeChainMath {
public final Map<BookmarkItem, BookmarkItem> preferredItems = new HashMap<>();
public final Map<BookmarkItem, Long> requiredAmount = new HashMap<>();
public final List<ItemStack> containerItems = new ArrayList<>();
private final List<ItemStack> containerItemsBlacklist = new ArrayList<>();
private RecipeChainMath(List<BookmarkItem> recipeItems, Set<RecipeId> collapsedRecipes) {
final Map<RecipeId, Integer> recipeState = new HashMap<>();
@@ -71,32 +62,29 @@ public class RecipeChainMath {
while (true) {
Map<BookmarkItem, BookmarkItem> maxReference = Collections.emptyMap();
RecipeId maxRecipeId = null;
long maxMultiplier = 0;
int maxDepth = 0;
for (Map.Entry<RecipeId, Long> entry : multipliers.entrySet()) {
final RecipeId recipeId = entry.getKey();
for (RecipeId recipeId : multipliers.keySet()) {
if (!this.outputRecipes.containsKey(recipeId) && this.preferredItems.values().stream()
.noneMatch(resItem -> resItem.recipeId.equals(recipeId))) {
final Map<BookmarkItem, BookmarkItem> references = new HashMap<>(this.preferredItems);
collectPreferredItems(recipeId, references, new HashSet<>());
final int depth = getMaxDepth(recipeId, references);
final int depth = collectPreferredItems(recipeId, references, new HashSet<>());
if (maxDepth < depth || maxDepth == depth && entry.getValue() > maxMultiplier) {
maxMultiplier = entry.getValue();
if (maxDepth < depth) {
maxReference = references;
maxRecipeId = recipeId;
maxDepth = depth;
}
}
}
if (maxReference.isEmpty()) {
if (!maxReference.isEmpty()) {
this.preferredItems.putAll(maxReference);
this.outputRecipes.put(maxRecipeId, multipliers.get(maxRecipeId));
} else {
break;
}
this.preferredItems.putAll(maxReference);
this.outputRecipes.put(maxRecipeId, multipliers.get(maxRecipeId));
}
for (Map.Entry<RecipeId, Long> entry : multipliers.entrySet()) {
@@ -114,9 +102,9 @@ public class RecipeChainMath {
}
}
private void collectPreferredItems(RecipeId recipeId, Map<BookmarkItem, BookmarkItem> preferredItems,
private int collectPreferredItems(RecipeId recipeId, Map<BookmarkItem, BookmarkItem> preferredItems,
Set<RecipeId> visited) {
int maxDepth = 0;
visited.add(recipeId);
for (BookmarkItem ingrItem : this.recipeIngredients) {
@@ -125,6 +113,7 @@ public class RecipeChainMath {
for (BookmarkItem item : this.recipeResults) {
if (item.factor > (prefItem == null ? 0 : prefItem.factor) && item.containsItems(ingrItem)
&& !item.recipeId.equals(recipeId)
&& !visited.contains(item.recipeId)) {
prefItem = item;
}
@@ -132,56 +121,16 @@ public class RecipeChainMath {
if (prefItem != null) {
preferredItems.put(ingrItem, prefItem);
collectPreferredItems(prefItem.recipeId, preferredItems, visited);
maxDepth = Math
.max(maxDepth, collectPreferredItems(prefItem.recipeId, preferredItems, visited) + 1);
}
}
}
visited.remove(recipeId);
}
private int getMaxDepth(RecipeId recipeId, Map<BookmarkItem, BookmarkItem> preferredItems) {
int maxDepth = 0;
for (BookmarkItem ingrItem : this.recipeIngredients) {
if (ingrItem.factor > 0 && recipeId.equals(ingrItem.recipeId) && preferredItems.containsKey(ingrItem)) {
maxDepth = Math.max(maxDepth, getMaxDepth(preferredItems.get(ingrItem).recipeId, preferredItems) + 1);
}
}
return maxDepth;
}
public RecipeId createMasterRoot() {
final List<BookmarkItem> rootIngredients = new ArrayList<>();
for (BookmarkItem item : this.recipeResults) {
if (this.outputRecipes.containsKey(item.recipeId) && !ROOT_RECIPE_ID.equals(item.recipeId)) {
final long amount = item.factor * this.outputRecipes.get(item.recipeId);
rootIngredients.add(
BookmarkItem.of(
-1,
item.getItemStack(amount),
item.getStackSize(amount),
ROOT_RECIPE_ID,
true,
BookmarkItem.generatePermutations(item.itemStack, null)));
}
}
this.outputRecipes.clear();
this.outputRecipes.put(ROOT_RECIPE_ID, 1L);
this.recipeResults.removeIf(item -> ROOT_RECIPE_ID.equals(item.recipeId));
this.recipeResults.add(BookmarkItem.of(-1, ROOT_ITEM, 1, ROOT_RECIPE_ID, false));
this.recipeIngredients.addAll(rootIngredients);
return ROOT_RECIPE_ID;
}
public boolean hasMasterRoot() {
return this.outputRecipes.containsKey(ROOT_RECIPE_ID);
}
public static RecipeChainMath of(List<BookmarkItem> chainItems, Set<RecipeId> collapsedRecipes) {
return new RecipeChainMath(chainItems, collapsedRecipes);
}
@@ -250,36 +199,22 @@ public class RecipeChainMath {
this.preferredItems.clear();
this.requiredAmount.clear();
this.containerItems.clear();
this.containerItemsBlacklist.clear();
for (RecipeId recipeId : this.outputRecipes.keySet()) {
collectPreferredItems(recipeId, this.preferredItems, new HashSet<>());
}
}
public RecipeChainMath refresh() {
resetCalculation();
if (this.outputRecipes.containsKey(ROOT_RECIPE_ID)) {
for (BookmarkItem ingrItem : this.recipeIngredients) {
if (ROOT_RECIPE_ID.equals(ingrItem.recipeId)
&& ingrItem.itemStack.getItem().hasContainerItem(ingrItem.itemStack)) {
this.containerItemsBlacklist.add(ingrItem.itemStack);
}
}
}
for (BookmarkItem prefItem : this.recipeResults) {
if (prefItem.factor > 0 && this.outputRecipes.containsKey(prefItem.recipeId)) {
final long prefAmount = prefItem.factor * this.outputRecipes.get(prefItem.recipeId);
if (prefItem.itemStack.getItem().hasContainerItem(prefItem.itemStack)) {
this.containerItemsBlacklist.add(prefItem.itemStack);
}
this.preferredItems.put(prefItem, prefItem);
calculateSuitableRecipe(prefItem, prefAmount, new ArrayList<>());
calculateSuitableRecipe(prefItem, prepareAmount(prefItem, prefAmount), new ArrayList<>());
this.preferredItems.remove(prefItem);
}
}
@@ -298,7 +233,7 @@ public class RecipeChainMath {
private void prepareIngredients(RecipeId recipeId, long stepShift, List<RecipeId> visited) {
for (BookmarkItem item : this.recipeIngredients) {
if (item.factor > 0 && recipeId.equals(item.recipeId)) {
calculateSuitableRecipe(item, item.factor * stepShift, visited);
calculateSuitableRecipe(item, prepareAmount(item, item.factor * stepShift), visited);
}
}
}
@@ -306,41 +241,18 @@ public class RecipeChainMath {
private void calculateSuitableRecipe(BookmarkItem ingrItem, long ingrAmount, List<RecipeId> visited) {
final BookmarkItem prefItem = this.preferredItems.get(ingrItem);
// calculate existing containers
if (ingrAmount > 0) {
for (ItemStack stack : ingrItem.permutations.values()) {
if (hasContainerItem(stack)) {
final long stackSize = ingrItem.getStackSize(ingrAmount);
final long shiftSize = shiftContainerItems(stack, stackSize);
if (stackSize != shiftSize && (ingrAmount = shiftSize * ingrItem.fluidCellAmount) == 0) {
break;
}
}
}
}
// calculate existing initial items
if (ingrAmount > 0) {
for (BookmarkItem item : this.initialItems) {
if (item.containsItems(ingrItem)
&& (ingrAmount = addRequiredAmount(item, ingrAmount, item.amount)) == 0) {
break;
}
}
}
// shift amount
if (prefItem == null) {
addRequiredAmount(ingrItem, ingrAmount, Long.MAX_VALUE);
this.requiredAmount.put(ingrItem, this.requiredAmount.getOrDefault(ingrItem, 0L) + ingrAmount);
} else if (visited.contains(prefItem.recipeId)) {
addRequiredAmount(prefItem, ingrAmount, Long.MAX_VALUE);
this.requiredAmount.put(prefItem, this.requiredAmount.getOrDefault(prefItem, 0L) + ingrAmount);
} else {
addRequiredAmount(prefItem, ingrAmount, Long.MAX_VALUE);
this.requiredAmount.put(prefItem, this.requiredAmount.getOrDefault(prefItem, 0L) + ingrAmount);
final long shift = (long) Math
.ceil((this.requiredAmount.get(prefItem) - prefItem.amount) / (double) prefItem.factor);
if (shift > 0) {
addShift(prefItem.recipeId, shift);
visited.add(prefItem.recipeId);
prepareIngredients(prefItem.recipeId, shift, visited);
visited.remove(prefItem.recipeId);
@@ -349,85 +261,23 @@ public class RecipeChainMath {
}
private long addRequiredAmount(BookmarkItem prefItem, long ingrAmount, long maxAmount) {
long shiftAmount = this.requiredAmount.getOrDefault(prefItem, 0L);
private long prepareAmount(BookmarkItem ingrItem, long ingrAmount) {
if (ingrAmount == 0) return 0;
if (hasContainerItem(prefItem.itemStack)) {
ItemStack itemStack = prefItem.itemStack;
while (ingrAmount > 0 && shiftAmount < maxAmount) {
itemStack = itemStack.copy();
itemStack.stackSize = 1;
this.containerItems.add(itemStack);
ingrAmount = shiftContainerItems(itemStack, prefItem.getStackSize(ingrAmount))
* prefItem.fluidCellAmount;
shiftAmount += prefItem.fluidCellAmount;
for (BookmarkItem item : this.initialItems) {
if (item.containsItems(ingrItem)) {
long initAmount = Math.min(ingrAmount, item.amount - this.requiredAmount.getOrDefault(item, 0L));
if (initAmount > 0) {
this.requiredAmount.put(item, this.requiredAmount.getOrDefault(item, 0L) + initAmount);
ingrAmount -= initAmount;
if (ingrAmount == 0) break;
}
}
} else {
long initAmount = Math.min(ingrAmount, maxAmount - shiftAmount);
shiftAmount += initAmount;
ingrAmount -= initAmount;
}
this.requiredAmount.put(prefItem, shiftAmount);
return ingrAmount;
}
private long shiftContainerItems(ItemStack aStack, long steps) {
for (int i = 0; i < this.containerItems.size() && steps > 0; i++) {
ItemStack bStack = this.containerItems.get(i);
if (bStack != null && NEIClientUtils.areStacksSameTypeCraftingWithNBT(aStack, bStack)) {
while (bStack != null && steps > 0) {
final Optional<ItemStack> containerItem = StackInfo.getContainerItem(bStack);
steps--;
if (containerItem != null && containerItem.isPresent()) {
bStack = containerItem.get();
if (aStack.getItem() != bStack.getItem()) {
this.containerItems.add(bStack);
bStack = null;
}
} else {
bStack = null;
}
}
this.containerItems.set(i, bStack);
}
}
this.containerItems.removeIf(stack -> stack == null);
return steps;
}
private boolean hasContainerItem(ItemStack aStack) {
if (aStack.getItem().hasContainerItem(aStack)) {
for (ItemStack bStack : this.containerItemsBlacklist) {
if (NEIClientUtils.areStacksSameTypeCraftingWithNBT(aStack, bStack)) {
return false;
}
}
return true;
}
return false;
}
private void addShift(RecipeId recipeId, long shift) {
for (BookmarkItem item : this.recipeIngredients) {
if (recipeId.equals(item.recipeId)) {
@@ -2,27 +2,21 @@ package codechicken.nei.recipe.chain;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import codechicken.lib.gui.GuiDraw;
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
import codechicken.nei.ItemSorter;
import codechicken.nei.ItemList;
import codechicken.nei.ItemStackAmount;
import codechicken.nei.ItemsTooltipLineHandler;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.bookmark.BookmarkItem;
import codechicken.nei.recipe.Recipe.RecipeId;
import codechicken.nei.recipe.StackInfo;
public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
@@ -31,14 +25,12 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
public final boolean crafting;
protected final RecipeChainMath math;
protected final List<BookmarkItem> initialItems;
protected final Map<RecipeId, Long> outputRecipes;
protected ItemsTooltipLineHandler available;
protected ItemsTooltipLineHandler inputs;
protected ItemsTooltipLineHandler outputs;
protected ItemsTooltipLineHandler remainder;
protected boolean lastShiftKey = false;
protected boolean lastControlKey = false;
protected Dimension size = new Dimension();
@@ -47,7 +39,6 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
this.crafting = crafting;
this.math = math;
this.initialItems = new ArrayList<>(this.math.initialItems);
this.outputRecipes = new HashMap<>(this.math.outputRecipes);
}
private void onUpdate() {
@@ -56,52 +47,21 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
final List<ItemStack> outputs = new ArrayList<>();
final List<ItemStack> remainder = new ArrayList<>();
final ItemStackAmount inventory = new ItemStackAmount();
final GuiContainer currentGui = NEIClientUtils.getGuiContainer();
final EntityClientPlayerMP thePlayer = currentGui.mc.thePlayer;
if (this.lastShiftKey) {
for (Slot slot : currentGui.inventorySlots.inventorySlots) {
if (slot.getHasStack() && !(slot instanceof SlotCrafting) && slot.canTakeStack(thePlayer)) {
inventory.add(slot.getStack());
}
}
if (lastShiftKey) {
inventory.addAll(Arrays.asList(NEIClientUtils.mc().thePlayer.inventory.mainInventory));
}
if (!this.math.outputRecipes.isEmpty()) {
this.math.initialItems.clear();
this.math.outputRecipes.clear();
this.math.outputRecipes.putAll(this.outputRecipes);
if (this.lastShiftKey) {
if (!this.lastControlKey) {
final List<ItemStack> items = inventory.values();
for (BookmarkItem item : math.recipeResults) {
if (item.factor > 0 && this.math.outputRecipes.containsKey(item.recipeId)) {
long amount = 0;
for (ItemStack stack : items) {
if (stack != null
&& NEIClientUtils.areStacksSameTypeCraftingWithNBT(stack, item.itemStack)) {
amount += StackInfo.getAmount(stack);
}
}
if (amount >= item.amount) {
final long itemAmount = item.factor * this.math.outputRecipes.get(item.recipeId);
amount += itemAmount - amount % itemAmount;
this.math.outputRecipes.put(
item.recipeId,
Math.max(this.math.outputRecipes.get(item.recipeId), amount / item.factor));
}
}
if (lastShiftKey) {
for (ItemStack stack : inventory.values()) {
long invStackSize = inventory.get(stack);
if (invStackSize > 0) {
this.math.initialItems.add(BookmarkItem.of(-1, stack.copy()));
}
}
for (ItemStack stack : inventory.values()) {
this.math.initialItems.add(BookmarkItem.of(-1, stack.copy()));
}
} else {
this.math.initialItems.addAll(initialItems);
}
@@ -112,7 +72,7 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
final long amount = math.requiredAmount.getOrDefault(item, 0L);
if (amount > 0) {
if (this.lastShiftKey) {
if (lastShiftKey) {
available.add(item.getItemStack(amount));
} else {
inputs.add(item.getItemStack(amount));
@@ -136,21 +96,13 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
if (amount > 0) {
if (math.outputRecipes.containsKey(item.recipeId)) {
outputs.add(item.getItemStack(amount));
} else if (this.lastShiftKey) {
} else if (lastShiftKey) {
remainder.add(item.getItemStack(amount));
}
}
}
if (this.lastShiftKey) {
for (ItemStack stack : math.containerItems) {
if (stack != null) {
remainder.add(stack.copy());
}
}
}
} else if (this.lastShiftKey) {
} else if (lastShiftKey) {
for (BookmarkItem item : this.math.initialItems) {
if (inventory.contains(item.itemStack)) {
@@ -173,16 +125,16 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
inputs.sort(
Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
.thenComparing(ItemSorter.instance));
.thenComparing(stack -> ItemList.getItemOrderIndex(stack)));
outputs.sort(
Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
.thenComparing(ItemSorter.instance));
.thenComparing(stack -> ItemList.getItemOrderIndex(stack)));
remainder.sort(
Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
.thenComparing(ItemSorter.instance));
.thenComparing(stack -> ItemList.getItemOrderIndex(stack)));
this.inputs = new ItemsTooltipLineHandler(
this.lastShiftKey ? NEIClientUtils.translate("bookmark.crafting_chain.missing")
lastShiftKey ? NEIClientUtils.translate("bookmark.crafting_chain.missing")
: NEIClientUtils.translate("bookmark.crafting_chain.input"),
inputs,
true,
@@ -206,7 +158,7 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
true,
Integer.MAX_VALUE);
if (this.lastShiftKey) {
if (lastShiftKey) {
this.inputs.setLabelColor(EnumChatFormatting.RED);
this.available.setLabelColor(EnumChatFormatting.GREEN);
}
@@ -236,11 +188,7 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
@Override
public Dimension getSize() {
boolean update = this.outputs == null;
update = this.lastShiftKey != (this.lastShiftKey = NEIClientUtils.shiftKey()) || update;
update = this.lastControlKey != (this.lastControlKey = NEIClientUtils.controlKey()) || update;
if (update) {
if (this.lastShiftKey != (this.lastShiftKey = NEIClientUtils.shiftKey()) || this.outputs == null) {
onUpdate();
}
return this.size;
@@ -1,7 +1,5 @@
package codechicken.nei.recipe.stackinfo;
import java.util.Optional;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -57,15 +55,4 @@ public class DefaultStackStringifyHandler implements IStackStringifyHandler {
return fluidStack;
}
@Override
public Optional<ItemStack> getContainerItem(ItemStack stack) {
if (stack.getItem().hasContainerItem(stack)) {
return Optional.ofNullable(stack.getItem().getContainerItem(stack));
}
return null;
}
}
@@ -1,7 +1,6 @@
package codechicken.nei.recipe.stackinfo;
import java.lang.reflect.Method;
import java.util.Optional;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -20,8 +19,6 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
protected static Method getFluidDisplayStack = null;
protected static Method getFluidFromDisplayStack = null;
public static boolean replaceAE2FCFluidDrop = false;
private static Class<?> gtMetaGeneratedTool = null;
private static Method getContainerItem = null;
static {
try {
@@ -35,11 +32,6 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
"gregtech.common.items.GT_FluidDisplayItem");
getFluidFromDisplayStack = gtUtility.getMethod("getFluidFromDisplayStack", ItemStack.class);
getFluidDisplayStack = gtUtility.getMethod("getFluidDisplayStack", FluidStack.class, boolean.class);
gtMetaGeneratedTool = ReflectionHelper.getClass(loader, "gregtech.api.items.MetaGeneratedTool");
getContainerItem = gtMetaGeneratedTool
.getDeclaredMethod("getContainerItem", ItemStack.class, boolean.class, boolean.class);
getContainerItem.setAccessible(true);
} catch (Exception ignored) {
/* Do nothing */
}
@@ -112,17 +104,4 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
return null;
}
@Override
public Optional<ItemStack> getContainerItem(ItemStack stack) {
if (getContainerItem != null && gtMetaGeneratedTool.isInstance(stack.getItem())
&& stack.getItem().hasContainerItem(stack)) {
try {
return Optional.ofNullable((ItemStack) getContainerItem.invoke(stack.getItem(), stack, false, true));
} catch (Exception ex) {}
}
return null;
}
}
@@ -16,9 +16,8 @@
#
minecraft:portal
minecraft:end_portal
r/minecraft:fire$/
r/minecraft:water$/
r/minecraft:lava$/
minecraft:fire
minecraft:lava
minecraft:mob_spawner
minecraft:anvil !0
minecraft:flowing_water
@@ -12,8 +12,6 @@ appeng.integration.modules.NEIHelpers.NEIFacadeRecipeHandler,Applied Energistics
appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler,Applied Energistics 2,appliedenergistics2:tile.BlockGrinder,,appliedenergistics2,TRUE,,,,,,,,,,,
appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler,Applied Energistics 2,appliedenergistics2:tile.BlockInscriber,,appliedenergistics2,TRUE,,,70,,5,,,,,,
appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler,Applied Energistics 2,appliedenergistics2:item.ItemMultiMaterial:9,,appliedenergistics2,TRUE,,,85,,5,,,,,,There's only some explanatory text for fluix crystals and QEDs
appeng.integration.modules.NEIHelpers.NEICellViewHandler,Applied Energistics 2,appliedenergistics2:item.ItemBasicStorageCell.64k,,appliedenergistics2,TRUE,,,180,,1,,,,,,,
com.glodblock.github.nei.NEICellViewHandler,AE2 Fluid Crafting,ae2fc:multi_fluid_storage64,,ae2fc,TRUE,,,,,1,,,,,,,
aroma1997.core.recipes.nei.ShapedAromicRecipeHandler,AromaBackup,minecraft:crafting_table,,AromaBackup,TRUE,,,65,,5,,,,,,
aroma1997.core.recipes.nei.ShapelessAromicRecipeHandler,AromaBackup,minecraft:crafting_table,,AromaBackup,TRUE,,,,,,,,,,,
fox.spiteful.avaritia.compat.nei.CompressionHandler,Avaritia,Avaritia:Neutronium_Compressor,,Avaritia,TRUE,,,50,,6,,,,,,
1 handler modName itemName nbtInfo modId modRequired excludedModId yShift handlerHeight handlerWidth maxRecipesPerPage imageResource imageX imageY imageWidth imageHeight itemNotes
12 appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler Applied Energistics 2 appliedenergistics2:tile.BlockGrinder appliedenergistics2 TRUE
13 appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler Applied Energistics 2 appliedenergistics2:tile.BlockInscriber appliedenergistics2 TRUE 70 5
14 appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler Applied Energistics 2 appliedenergistics2:item.ItemMultiMaterial:9 appliedenergistics2 TRUE 85 5 There's only some explanatory text for fluix crystals and QEDs
appeng.integration.modules.NEIHelpers.NEICellViewHandler Applied Energistics 2 appliedenergistics2:item.ItemBasicStorageCell.64k appliedenergistics2 TRUE 180 1
com.glodblock.github.nei.NEICellViewHandler AE2 Fluid Crafting ae2fc:multi_fluid_storage64 ae2fc TRUE 1
15 aroma1997.core.recipes.nei.ShapedAromicRecipeHandler AromaBackup minecraft:crafting_table AromaBackup TRUE 65 5
16 aroma1997.core.recipes.nei.ShapelessAromicRecipeHandler AromaBackup minecraft:crafting_table AromaBackup TRUE
17 fox.spiteful.avaritia.compat.nei.CompressionHandler Avaritia Avaritia:Neutronium_Compressor Avaritia TRUE 50 6
+20 -33
View File
@@ -26,20 +26,13 @@ nei.bookmark.group.toggle_mode=Toggle Group Mode
nei.bookmark.group.toggle_collapse=Toggle Collapse/Expand
nei.bookmark.group.toggle_crafting_chain=Toggle Crafting Chain
nei.bookmark.group.overlay_use=Fill Crafting Grid
nei.bookmark.group.sorting=Move Position
nei.bookmark.group.sorting=Sorting
nei.bookmark.group.remove_recipe=Remove Group
nei.bookmark.group.pull_items=Pull all Items
nei.bookmark.group.pull_items_shift=Pull missing Items
nei.bookmark.group.craft_missing=Craft Missing Items
nei.bookmark.group.craft_all=Craft Items
nei.bookmark.item.sorting=Move Position
nei.bookmark.remove_recipe=Remove Recipe
nei.bookmark.remove_item=Remove Item
nei.bookmark.add_item=Add Bookmark
nei.bookmark.add_item_with_recipe=Add Bookmark with Recipe
nei.bookmark.add_item_with_count=Add Bookmark with Count
nei.bookmark.change_quantity=Change Quantity
nei.bookmark.change_quantity_step=Change Quantity with Multiplier
nei.bookmark.group.craft=Craft Group
nei.bookmark.group.change_quantity=Change Quantity
nei.bookmark.group.change_quantity_step=Change Quantity with Multiplier
nei.bookmark.recipe.toggle_collapse=Toggle Collapse/Expand
nei.bookmark.crafting_chain=Crafting Chain
nei.bookmark.crafting_chain.input=Ingredients
@@ -47,20 +40,29 @@ nei.bookmark.crafting_chain.missing=Missing Items
nei.bookmark.crafting_chain.output=Results
nei.bookmark.crafting_chain.remainder=Remainders
nei.bookmark.crafting_chain.available=Available Items
nei.inventory.search.placeholder=Search...
nei.itempanel.quantity.default=One stack
nei.itempanel.loading=Loading Item List...
nei.itempanel.deleteItem=Delete Item
nei.itempanel.collapsed.button.tip=Collapse/Expand All Collapsible Items
nei.itempanel.collapsed.hint.expand=Expand Group (%d items)
nei.itempanel.collapsed.hint.collapse=Collapse Group (%d items)
nei.itempanel.remove_recipe=Remove Recipe
nei.itempanel.remove_item=Remove Item
nei.itempanel.add_item=Add Bookmark
nei.itempanel.add_item_with_recipe=Add Bookmark with Recipe
nei.itempanel.add_item_with_count=Add Bookmark with Count
nei.itempanel.change_quantity=Change Quantity
nei.itempanel.change_quantity_step=Change Quantity with Multiplier
nei.itempanel.overlay_recipe=Overlay Recipe
nei.itempanel.craft_missing=Craft Missing Items
nei.itempanel.craft_all=Craft Items
nei.itempanel.craft=Craft Recipe
nei.itempanel.fill_crafting_grid=Fill Crafting Grid
nei.itempanel.fill_crafting_grid_quantity=Fill Crafting Grid With Quantity
nei.itempanel.open_crafting=Recipe to make this item
nei.itempanel.open_usage=Recipes that use this item
nei.itempanel.sort_item=Sorting
nei.itempanel.sort_recipe=Sorting
nei.itempanel.copy_name=Copy Item Name
nei.itempanel.copy_oredict=Copy Item OreDictionary
@@ -112,8 +114,6 @@ nei.inventory.current.gamemode.1=Current gamemode: creative
nei.inventory.current.gamemode.2=Current gamemode: creative+
nei.inventory.current.gamemode.3=Current gamemode: adventure
nei.inventory.tooltip.page=Page: %s / %s [Press %s to see next page]
nei.inventory.tooltip.count.item=Count: %s
nei.inventory.tooltip.count.fluid=Amount: %s
nei.inventory.gamemode.0=Click: Set gamemode to survival
nei.inventory.gamemode.1=Click: Set gamemode to creative
@@ -172,7 +172,7 @@ nei.options.keys.gui.getprevioussearch=Previous Search
nei.options.keys.gui.getnextsearch=Next Search
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.craft=Craft Recipe
nei.options.keys.gui.copy_oredict=Copy Item OreDictionary
nei.options.keys.gui.itemzoom_toggle=Toggle Item Zoom
nei.options.keys.gui.itemzoom_hold=Hold to Display Item Zoom
@@ -211,16 +211,12 @@ 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.2=Background
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
nei.options.inventory.bookmarks.ignorePotionOverlap.false=No
nei.options.inventory.bookmarks.worldSpecific=World Specific
nei.options.inventory.bookmarks.worldSpecific.true=Yes
nei.options.inventory.bookmarks.worldSpecific.false=No
nei.options.inventory.bookmarks.bookmarkItemsWithRecipe=Bookmark items with recipe
nei.options.inventory.bookmarks.bookmarkItemsWithRecipe.true=Yes
nei.options.inventory.bookmarks.bookmarkItemsWithRecipe.false=No
nei.options.inventory.favorites=Favorites
nei.options.inventory.favorites.enabled=Visibility
nei.options.inventory.favorites.enabled.true=Visible
@@ -228,12 +224,9 @@ nei.options.inventory.favorites.enabled.false=Hidden
nei.options.inventory.favorites.worldSpecific=World Specific
nei.options.inventory.favorites.worldSpecific.true=Yes
nei.options.inventory.favorites.worldSpecific.false=No
nei.options.inventory.favorites.showRecipeTooltipInPanel=Show Recipe Tooltips in Right Panel
nei.options.inventory.favorites.showRecipeTooltipInPanel.true=Yes
nei.options.inventory.favorites.showRecipeTooltipInPanel.false=No
nei.options.inventory.favorites.showRecipeTooltipInGui=Show Recipe Tooltips in Recipe Gui
nei.options.inventory.favorites.showRecipeTooltipInGui.true=Yes
nei.options.inventory.favorites.showRecipeTooltipInGui.false=No
nei.options.inventory.favorites.showRecipeTooltip=Show Recipe Tooltips in Right Panel
nei.options.inventory.favorites.showRecipeTooltip.true=Yes
nei.options.inventory.favorites.showRecipeTooltip.false=No
nei.options.inventory.favorites.depth=Depth
nei.options.inventory.hotkeysHelpText=Show Hotkeys Help Text
nei.options.inventory.hotkeysHelpText.true=Yes
@@ -312,9 +305,6 @@ nei.options.inventory.guirecipe.creativeTabStyle.false=JEI
nei.options.inventory.optimize_gui_overlap_computation=Optimize computation for GUI overlap
nei.options.inventory.optimize_gui_overlap_computation.true=Yes
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
@@ -441,9 +431,6 @@ nei.options.tools.handler_load_from_config.false=JAR
nei.options.tools.catalyst_load_from_config=Load catalysts from Config
nei.options.tools.catalyst_load_from_config.true=Config
nei.options.tools.catalyst_load_from_config.false=JAR
nei.options.tools.handler_info=Handler Info Widget
nei.options.tools.handler_info.true=Enabled
nei.options.tools.handler_info.false=Disabled
nei.options.tools.dump=Data Dumps
nei.options.tools.dump.dump=Dump
nei.options.tools.dump.dumped=%s IDs dumped to %s