mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-15 17:54:50 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6bc98253e2 | ||
|
|
0f65cf8069 | ||
|
|
87988e69eb | ||
|
|
f2d6b52c90 | ||
|
|
89bf12611c | ||
|
|
3b3227b09d | ||
|
|
83696ca9ae | ||
|
|
e3be08c970 | ||
|
|
6f0a26c74b |
No files matched your search
@@ -2,5 +2,6 @@
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.3.6:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Hodgepodge:2.5.43-pre:dev') // TODO: change to proper tag
|
||||
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
|
||||
public class AutoFocusWidget implements IContainerInputHandler {
|
||||
|
||||
/**
|
||||
* Implement this interface on a GuiContainer to enable the autofocus search in NEI (if the autofocus option is
|
||||
* enabled) without needing to add the classname to the config file .
|
||||
*/
|
||||
public interface INEIAutoFocusSearchEnable {
|
||||
}
|
||||
|
||||
public static AutoFocusWidget instance = new AutoFocusWidget();
|
||||
|
||||
public static List<String> enableAutoFocusPrefixes = new ArrayList<>();
|
||||
|
||||
protected boolean autofocus = false;
|
||||
protected Point mouse;
|
||||
|
||||
public AutoFocusWidget() {
|
||||
GuiContainerManager.addInputHandler(this);
|
||||
}
|
||||
|
||||
public void load(GuiContainer gui) {
|
||||
this.autofocus = LayoutManager.searchField.isVisible() && NEIClientConfig.searchWidgetAutofocus() != 0
|
||||
&& isAllowedGuiAutoSearchFocus(gui);
|
||||
this.mouse = getMousePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
|
||||
if (this.autofocus) {
|
||||
this.autofocus = false;
|
||||
|
||||
if (!this.mouse.equals(getMousePosition())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.searchWidgetAutofocus() == 2
|
||||
&& GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindInventory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_NUMPADENTER
|
||||
|| keyCode == Keyboard.KEY_ESCAPE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
LayoutManager.searchField.setFocus(true);
|
||||
LayoutManager.searchField.handleKeyPress(keyCode, keyChar);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
this.autofocus = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
this.autofocus = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
this.autofocus = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {
|
||||
this.autofocus = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
this.autofocus = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
this.autofocus = false;
|
||||
}
|
||||
|
||||
protected boolean isAllowedGuiAutoSearchFocus(GuiContainer gui) {
|
||||
if (gui instanceof INEIAutoFocusSearchEnable) {
|
||||
return true;
|
||||
}
|
||||
String guiClassName = gui.getClass().getName();
|
||||
for (String prefix : enableAutoFocusPrefixes) {
|
||||
if (guiClassName.startsWith(prefix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public class BookmarkCraftingChain {
|
||||
|
||||
public HashMap<ItemStack, ItemStack> inputs = new HashMap<>();
|
||||
public HashMap<ItemStack, ItemStack> outputs = new HashMap<>();
|
||||
public HashMap<ItemStack, ItemStack> remainder = new HashMap<>();
|
||||
public HashMap<ItemStack, ItemStack> intermediate = new HashMap<>();
|
||||
|
||||
protected static class CraftingChainItem {
|
||||
@@ -206,6 +207,7 @@ public class BookmarkCraftingChain {
|
||||
|
||||
this.inputs.clear();
|
||||
this.outputs.clear();
|
||||
this.remainder.clear();
|
||||
this.intermediate.clear();
|
||||
this.calculatedItems.clear();
|
||||
this.multiplier.clear();
|
||||
@@ -245,18 +247,20 @@ public class BookmarkCraftingChain {
|
||||
}
|
||||
|
||||
} else { // output
|
||||
long iCount = calculateCount(request, request.inputs.get(item.stackIndex))
|
||||
- iShift.getOrDefault(item.stackIndex, 0L);
|
||||
long iCalcCount = calculateCount(request, request.inputs.get(item.stackIndex));
|
||||
long iCount = iCalcCount - iShift.getOrDefault(item.stackIndex, 0L);
|
||||
this.multiplier.put(item.stack, item.factor > 0 ? (int) (count / item.factor) : 0);
|
||||
|
||||
if (iCount < count) {
|
||||
this.outputs.put(item.stack, item.getItemStack(count - iCount));
|
||||
iShift.put(item.stackIndex, iShift.getOrDefault(item.stackIndex, 0L) + iCount);
|
||||
} else if (iCount >= count) {
|
||||
if (iCount >= count) {
|
||||
this.intermediate.put(item.stack, item.getItemStack(0));
|
||||
iShift.put(item.stackIndex, iShift.getOrDefault(item.stackIndex, 0L) + count);
|
||||
} else if (iCalcCount > 0) {
|
||||
this.remainder.put(item.stack, item.getItemStack(count - iCount));
|
||||
iShift.put(item.stackIndex, iShift.getOrDefault(item.stackIndex, 0L) + iCount);
|
||||
} else {
|
||||
this.outputs.put(item.stack, item.getItemStack(count - iCount));
|
||||
iShift.put(item.stackIndex, iShift.getOrDefault(item.stackIndex, 0L) + iCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -42,6 +42,7 @@ import codechicken.core.GuiModListScroll;
|
||||
import codechicken.lib.packet.PacketCustom;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import cpw.mods.fml.client.CustomModLoadingErrorDisplayException;
|
||||
@@ -243,7 +244,7 @@ public class ClientHandler {
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
NEIClientConfig.logger.info("Loading enable auto focus from file {}", file);
|
||||
NEIClientConfig.enableAutoFocusPrefixes = IOUtils.readLines(reader).stream()
|
||||
AutoFocusWidget.enableAutoFocusPrefixes = IOUtils.readLines(reader).stream()
|
||||
.filter((line) -> !line.startsWith("#")).collect(Collectors.toCollection(ArrayList::new));
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to load enable auto focus from file {}", file, e);
|
||||
@@ -265,6 +266,7 @@ public class ClientHandler {
|
||||
|
||||
public static void postInit() {
|
||||
loadHandlerOrdering();
|
||||
GuiContainerManager.registerReloadResourceListener();
|
||||
}
|
||||
|
||||
public static void loadHandlerOrdering() {
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -18,10 +19,17 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.EverythingItemFilter;
|
||||
@@ -216,15 +224,21 @@ public class CollapsibleItems {
|
||||
|
||||
protected static class GroupItem {
|
||||
|
||||
protected static int lastGroupIndex = 0;
|
||||
|
||||
public final int groupIndex;
|
||||
public final ItemFilter filter;
|
||||
public String guid;
|
||||
public ItemFilter filter;
|
||||
public boolean expanded = false;
|
||||
public String displayName = "";
|
||||
|
||||
public GroupItem(ItemFilter filter) {
|
||||
this.groupIndex = lastGroupIndex++;
|
||||
public GroupItem() {}
|
||||
|
||||
public void setFilter(String filter) {
|
||||
this.filter = CollapsibleItems.groupParser.getFilter(filter.trim());
|
||||
this.guid = UUID.nameUUIDFromBytes(filter.getBytes()).toString();
|
||||
}
|
||||
|
||||
public void setFilter(ItemFilter filter, String guid) {
|
||||
this.filter = filter;
|
||||
this.guid = guid;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
@@ -232,8 +246,9 @@ public class CollapsibleItems {
|
||||
}
|
||||
}
|
||||
|
||||
protected File statesFile;
|
||||
protected static final GroupTokenParser groupParser = new GroupTokenParser();
|
||||
protected final Map<Integer, GroupItem> groups = new ConcurrentHashMap<>();
|
||||
protected final List<GroupItem> groups = new ArrayList<>();
|
||||
protected final Map<ItemStack, Integer> cache = new ConcurrentHashMap<>();
|
||||
|
||||
static {
|
||||
@@ -242,18 +257,24 @@ public class CollapsibleItems {
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
GroupItem.lastGroupIndex = 0;
|
||||
this.groups.clear();
|
||||
this.cache.clear();
|
||||
|
||||
for (int i = PresetsList.presets.size() - 1; i >= 0; i--) {
|
||||
Preset preset = PresetsList.presets.get(i);
|
||||
if (preset.enabled && preset.mode == PresetMode.GROUP) {
|
||||
addGroup(preset);
|
||||
GroupItem group = new GroupItem();
|
||||
group.setFilter(preset, UUID.nameUUIDFromBytes(preset.items.toString().getBytes()).toString());
|
||||
group.displayName = preset.name;
|
||||
addGroup(group);
|
||||
}
|
||||
}
|
||||
|
||||
loadCollapsibleItems();
|
||||
if (NEIClientConfig.enableCollapsibleItems()) {
|
||||
loadCollapsibleItems();
|
||||
}
|
||||
|
||||
loadStates();
|
||||
|
||||
if (ItemList.loadFinished) {
|
||||
LayoutManager.markItemsDirty();
|
||||
@@ -277,27 +298,75 @@ public class CollapsibleItems {
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
NEIClientConfig.logger.info("Loading collapsible items from file {}", file);
|
||||
IOUtils.readLines(reader).stream().filter((line) -> !line.startsWith("#") && !line.trim().isEmpty())
|
||||
.forEach(this::addGroup);
|
||||
parseFile(IOUtils.readLines(reader));
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to load collapsible items from file {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addGroup(String filterText) {
|
||||
addGroup(CollapsibleItems.groupParser.getFilter(filterText.trim()));
|
||||
public void parseFile(List<String> itemStrings) {
|
||||
final JsonParser parser = new JsonParser();
|
||||
GroupItem group = new GroupItem();
|
||||
|
||||
for (String itemStr : itemStrings) {
|
||||
|
||||
if (itemStr.startsWith("#") || itemStr.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
if (itemStr.startsWith("; ")) {
|
||||
JsonObject settings = parser.parse(itemStr.substring(2)).getAsJsonObject();
|
||||
|
||||
if (settings.get("displayName") != null) {
|
||||
group.displayName = settings.get("displayName").getAsString();
|
||||
}
|
||||
|
||||
if (settings.get("unlocalizedName") != null) {
|
||||
String displayName = StatCollector
|
||||
.translateToLocal(settings.get("unlocalizedName").getAsString());
|
||||
|
||||
if (!displayName.equals(settings.get("unlocalizedName").getAsString())) {
|
||||
group.displayName = displayName;
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.get("expanded") != null) {
|
||||
group.expanded = settings.get("expanded").getAsBoolean();
|
||||
}
|
||||
|
||||
} else {
|
||||
group.setFilter(itemStr);
|
||||
}
|
||||
|
||||
if (group != null && group.filter != null) {
|
||||
addGroup(group);
|
||||
group = new GroupItem();
|
||||
}
|
||||
|
||||
} catch (IllegalArgumentException | JsonSyntaxException | IllegalStateException e) {
|
||||
NEIClientConfig.logger.error("Failed to load collapsible items from json string:\n{}", itemStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addGroup(ItemFilter filter) {
|
||||
if (filter == null || filter instanceof EverythingItemFilter || filter instanceof NothingItemFilter) return;
|
||||
GroupItem group = new GroupItem(filter);
|
||||
this.groups.put(group.groupIndex, group);
|
||||
protected void addGroup(GroupItem group) {
|
||||
if (group == null || group.filter == null
|
||||
|| group.filter instanceof EverythingItemFilter
|
||||
|| group.filter instanceof NothingItemFilter)
|
||||
return;
|
||||
this.groups.add(group);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.groups.isEmpty();
|
||||
}
|
||||
|
||||
public ItemFilter getItemFilter() {
|
||||
AnyMultiItemFilter filter = new AnyMultiItemFilter();
|
||||
|
||||
for (GroupItem group : this.groups.values()) {
|
||||
for (GroupItem group : this.groups) {
|
||||
filter.filters.add(group.filter);
|
||||
}
|
||||
|
||||
@@ -310,10 +379,10 @@ public class CollapsibleItems {
|
||||
try {
|
||||
|
||||
ItemList.forkJoinPool.submit(() -> items.parallelStream().forEach(stack -> {
|
||||
GroupItem group = this.groups.values().stream().filter(g -> g.matches(stack)).findFirst().orElse(null);
|
||||
GroupItem group = this.groups.stream().filter(g -> g.matches(stack)).findFirst().orElse(null);
|
||||
|
||||
if (group != null) {
|
||||
this.cache.put(stack, group.groupIndex);
|
||||
this.cache.put(stack, this.groups.indexOf(group));
|
||||
}
|
||||
})).get();
|
||||
|
||||
@@ -332,9 +401,18 @@ public class CollapsibleItems {
|
||||
return this.cache.getOrDefault(stack, -1);
|
||||
}
|
||||
|
||||
public String getDisplayName(int groupIndex) {
|
||||
|
||||
if (groupIndex < this.groups.size()) {
|
||||
return this.groups.get(groupIndex).displayName;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isExpanded(int groupIndex) {
|
||||
|
||||
if (this.groups.containsKey(groupIndex)) {
|
||||
if (groupIndex < this.groups.size()) {
|
||||
return this.groups.get(groupIndex).expanded;
|
||||
}
|
||||
|
||||
@@ -343,22 +421,60 @@ public class CollapsibleItems {
|
||||
|
||||
public void setExpanded(int groupIndex, boolean expanded) {
|
||||
|
||||
if (this.groups.containsKey(groupIndex)) {
|
||||
if (groupIndex < this.groups.size()) {
|
||||
this.groups.get(groupIndex).expanded = expanded;
|
||||
saveStates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void toggleGroups(Boolean expanded) {
|
||||
|
||||
if (expanded == null) {
|
||||
expanded = !this.groups.values().stream().filter(g -> g.expanded).findAny().isPresent();
|
||||
expanded = !this.groups.stream().filter(g -> g.expanded).findAny().isPresent();
|
||||
}
|
||||
|
||||
for (GroupItem group : this.groups.values()) {
|
||||
for (GroupItem group : this.groups) {
|
||||
group.expanded = expanded;
|
||||
}
|
||||
|
||||
saveStates();
|
||||
}
|
||||
|
||||
private void loadStates() {
|
||||
|
||||
try {
|
||||
|
||||
if (NEIClientConfig.world.nbt.hasKey("collapsibleitems")) {
|
||||
NBTTagCompound states = NEIClientConfig.world.nbt.getCompoundTag("collapsibleitems");
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, NBTPrimitive> list = (Map<String, NBTPrimitive>) states.tagMap;
|
||||
final Map<String, GroupItem> mapping = new HashMap<>();
|
||||
|
||||
for (GroupItem group : this.groups) {
|
||||
mapping.put(group.guid, group);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, NBTPrimitive> nbtEntry : list.entrySet()) {
|
||||
if (mapping.containsKey(nbtEntry.getKey())) {
|
||||
mapping.get(nbtEntry.getKey()).expanded = nbtEntry.getValue().func_150290_f() == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Error loading collapsible items states", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void saveStates() {
|
||||
NBTTagCompound list = new NBTTagCompound();
|
||||
|
||||
for (GroupItem group : this.groups) {
|
||||
list.setBoolean(group.guid, group.expanded);
|
||||
}
|
||||
|
||||
NEIClientConfig.world.nbt.setTag("collapsibleitems", list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.api.INEIAutoFocusSearchEnable;
|
||||
import codechicken.nei.AutoFocusWidget.INEIAutoFocusSearchEnable;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
|
||||
public class HeldItemHandler implements IContainerInputHandler, IContainerTooltipHandler {
|
||||
|
||||
protected HeldItemHandler() {
|
||||
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
HeldItemHandler instance = new HeldItemHandler();
|
||||
GuiContainerManager.addInputHandler(instance);
|
||||
GuiContainerManager.addTooltipHandler(instance);
|
||||
}
|
||||
|
||||
protected boolean contains(int mousex, int mousey) {
|
||||
return NEIClientUtils.getHeldItem() != null
|
||||
&& (ItemPanels.bookmarkPanel.contains(mousex, mousey) || ItemPanels.itemPanel.contains(mousex, mousey)
|
||||
|| ItemPanels.itemPanel.historyPanel.contains(mousex, mousey));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
|
||||
if (contains(mousex, mousey)) {
|
||||
|
||||
if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item")) {
|
||||
if (button == 1) {
|
||||
NEIClientUtils.decreaseSlotStack(-999);
|
||||
} else {
|
||||
NEIClientUtils.deleteHeldItem();
|
||||
}
|
||||
} else {
|
||||
NEIClientUtils.dropHeldItem();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
|
||||
if (contains(mousex, mousey)) {
|
||||
currenttip.clear();
|
||||
currenttip.add(EnumChatFormatting.RED + translate("itempanel.deleteItem"));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -120,28 +120,8 @@ public class ItemHistoryPanel extends Widget {
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button) {
|
||||
|
||||
if (handleClickExt(mousex, mousey, button)) return true;
|
||||
|
||||
if (NEIClientUtils.getHeldItem() != null) {
|
||||
|
||||
if (!grid.contains(mousex, mousey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item")) {
|
||||
if (button == 1) {
|
||||
NEIClientUtils.decreaseSlotStack(-999);
|
||||
} else {
|
||||
NEIClientUtils.deleteHeldItem();
|
||||
}
|
||||
} else {
|
||||
NEIClientUtils.dropHeldItem();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
|
||||
if (hoverSlot != null) {
|
||||
|
||||
@@ -168,7 +148,8 @@ public class ItemHistoryPanel extends Widget {
|
||||
if (hoverSlot != null && hoverSlot.slotIndex == mouseDownSlot && ItemPanels.itemPanel.draggedStack == null) {
|
||||
ItemStack item = hoverSlot.item.copy();
|
||||
|
||||
if (NEIController.manager.window instanceof GuiRecipe || !NEIClientConfig.canCheatItem(item)) {
|
||||
if (NEIController.manager.window instanceof GuiRecipe || NEIClientUtils.shiftKey()
|
||||
|| !NEIClientConfig.canCheatItem(item)) {
|
||||
|
||||
if (button == 0) {
|
||||
GuiCraftingRecipe.openRecipeGui("item", item);
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.stream.Collectors;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
@@ -90,7 +91,8 @@ public class ItemList {
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return pattern.matcher(item.getDisplayName()).find();
|
||||
String displayName = EnumChatFormatting.getTextWithoutFormattingCodes(item.getDisplayName());
|
||||
return !displayName.isEmpty() && pattern.matcher(displayName).find();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +232,7 @@ public class ItemList {
|
||||
|
||||
ItemSorter.sort(items);
|
||||
|
||||
if (NEIClientConfig.enableCollapsibleItems()) {
|
||||
if (!ItemList.collapsibleItems.isEmpty()) {
|
||||
HashMap<Integer, Integer> groups = new HashMap<>();
|
||||
int orderIndex = 0;
|
||||
|
||||
|
||||
@@ -17,11 +17,11 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
|
||||
public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
public class ItemPanel extends PanelWidget {
|
||||
|
||||
/**
|
||||
* Backwards compat :-/
|
||||
@@ -66,6 +66,7 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
protected static class MaskMetadata {
|
||||
|
||||
public int groupIndex = -1;
|
||||
public String displayName = "";
|
||||
public boolean extended = false;
|
||||
|
||||
public Color bgColor = null;
|
||||
@@ -97,7 +98,7 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
this.groupItems.clear();
|
||||
this.forceExpand = false;
|
||||
|
||||
if (NEIClientConfig.enableCollapsibleItems() && !this.newItems.isEmpty()) {
|
||||
if (!ItemList.collapsibleItems.isEmpty() && !this.newItems.isEmpty()) {
|
||||
final Set<Integer> groups = new HashSet<>();
|
||||
boolean outsideGroup = false;
|
||||
|
||||
@@ -196,6 +197,7 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
MaskMetadata metadata = new MaskMetadata();
|
||||
|
||||
metadata.groupIndex = groupIndex;
|
||||
metadata.displayName = ItemList.collapsibleItems.getDisplayName(groupIndex);
|
||||
metadata.extended = this.forceExpand || ItemList.collapsibleItems.isExpanded(groupIndex);
|
||||
metadata.bgColor = metadata.extended ? expandedColor : collapsedColor;
|
||||
metadata.color = darkerColor(metadata.bgColor);
|
||||
@@ -317,7 +319,6 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
|
||||
public ItemPanel() {
|
||||
grid = new ItemPanelGrid();
|
||||
GuiContainerManager.addTooltipHandler(this);
|
||||
}
|
||||
|
||||
public static void updateItemList(ArrayList<ItemStack> newItems) {
|
||||
@@ -481,7 +482,7 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
LayoutManager.addWidget(quantity);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.enableCollapsibleItems()) {
|
||||
if (!ItemList.collapsibleItems.isEmpty()) {
|
||||
LayoutManager.addWidget(toggleGroups);
|
||||
}
|
||||
|
||||
@@ -513,16 +514,6 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
@@ -537,6 +528,12 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
if (metadata != null) {
|
||||
final List<ItemStack> items = panelGrid.groupItems.get(metadata.groupIndex);
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.collapsibleItems.customName") && !metadata.extended
|
||||
&& !"".equals(metadata.displayName)) {
|
||||
currenttip.clear();
|
||||
currenttip.add(metadata.displayName + GuiDraw.TOOLTIP_LINESPACE);
|
||||
}
|
||||
|
||||
if (items != null && items.size() > 1) {
|
||||
String message = metadata.extended ? "itempanel.collapsed.hint.collapse"
|
||||
: "itempanel.collapsed.hint.expand";
|
||||
@@ -549,7 +546,7 @@ public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
return super.handleItemTooltip(gui, itemstack, mousex, mousey, currenttip);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
|
||||
public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
|
||||
public static final int MIN_ZOOM = 0;
|
||||
public static final int MAX_ZOOM = 1000;
|
||||
|
||||
private static final int MIN_SCALE = 2;
|
||||
private static final int SLOT_SIZE = 16;
|
||||
|
||||
private Boolean previousKeyboardRepeatEnabled = null;
|
||||
|
||||
private ItemStack stack = null;
|
||||
private String displayName = "";
|
||||
private int availableAreaWidth = 0;
|
||||
private float xPosition = 0;
|
||||
private float yPosition = 0;
|
||||
private float scale = 1;
|
||||
|
||||
public ItemZoom() {
|
||||
GuiContainerManager.addInputHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
|
||||
if (this.stack != null
|
||||
&& (NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled")
|
||||
|| NEIClientConfig.isKeyHashDown("gui.itemzoom_hold"))
|
||||
&& GuiContainerManager.shouldShowTooltip(NEIClientUtils.getGuiContainer())) {
|
||||
final float inverseScaleFactor = 1.0f / this.scale;
|
||||
final float screenScale = getScreenScale();
|
||||
final float size = SLOT_SIZE * this.scale;
|
||||
int shiftText = 10;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(screenScale, screenScale, 1);
|
||||
GL11.glScaled(this.scale, this.scale, 2);
|
||||
GL11.glTranslated(this.xPosition * inverseScaleFactor, this.yPosition * inverseScaleFactor, 0);
|
||||
|
||||
GuiContainerManager.drawItem(0, 0, this.stack, false, "");
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.showName")) {
|
||||
String dispalyName = NEIClientUtils.cropText(fontRenderer, this.displayName, this.availableAreaWidth);
|
||||
drawStringC(
|
||||
dispalyName,
|
||||
(int) ((this.xPosition + size / 2) * screenScale),
|
||||
(int) ((this.yPosition + size) * screenScale) + shiftText,
|
||||
NEIClientConfig.getSetting("inventory.itemzoom.nameColor").getHexValue());
|
||||
shiftText += fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled")
|
||||
&& NEIClientConfig.getBooleanSetting("inventory.itemzoom.helpText")) {
|
||||
int key = NEIClientConfig.getKeyBinding("gui.itemzoom_toggle");
|
||||
|
||||
if (key > 0) {
|
||||
String helpText = NEIClientUtils
|
||||
.translate("itemzoom.toggle", NEIClientConfig.getKeyName(key, true));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> lines = fontRenderer.listFormattedStringToWidth(helpText, this.availableAreaWidth);
|
||||
|
||||
for (String line : lines) {
|
||||
drawStringC(
|
||||
line,
|
||||
(int) ((this.xPosition + size / 2) * screenScale),
|
||||
(int) ((this.yPosition + size) * screenScale) + 10 + shiftText,
|
||||
0x66555555);
|
||||
shiftText += fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void resize(GuiContainer gui) {
|
||||
final ItemStack stack = getStackMouseOver(gui);
|
||||
|
||||
if (stack != null && (!NEIClientConfig.getBooleanSetting("inventory.itemzoom.onlySolid")
|
||||
|| Block.getBlockFromItem(stack.getItem()).getMaterial().isSolid())) {
|
||||
final float screenScale = 1.0f / getScreenScale();
|
||||
final float availableAreaWidth = (gui.width - (gui.xSize + gui.width) / 2) * screenScale;
|
||||
final float availableAreaHeight = gui.height * screenScale;
|
||||
final Point mouse = getMousePosition();
|
||||
|
||||
this.scale = Math.round(getZoomAmount(gui) * getPointSize(gui) / SLOT_SIZE);
|
||||
this.yPosition = (availableAreaHeight - this.scale * SLOT_SIZE) / 2;
|
||||
this.xPosition = (availableAreaWidth - this.scale * SLOT_SIZE) / 2;
|
||||
this.availableAreaWidth = (int) (availableAreaWidth / screenScale);
|
||||
|
||||
if (ItemPanels.bookmarkPanel.contains(mouse.x, mouse.y)) {
|
||||
this.xPosition += (gui.guiLeft + gui.xSize) * screenScale;;
|
||||
}
|
||||
|
||||
try {
|
||||
this.displayName = stack.getDisplayName();
|
||||
} catch (Throwable ignored) {
|
||||
this.displayName = "Unnamed";
|
||||
}
|
||||
|
||||
this.stack = StackInfo.loadFromNBT(StackInfo.itemStackToNBT(stack), 0);
|
||||
} else {
|
||||
this.stack = null;
|
||||
this.displayName = "";
|
||||
}
|
||||
}
|
||||
|
||||
private float getPointSize(GuiContainer gui) {
|
||||
final float screenScale = 1.0f / getScreenScale();
|
||||
final float availableAreaWidth = (gui.width - (gui.xSize + gui.width) / 2) * screenScale;
|
||||
return availableAreaWidth / MAX_ZOOM;
|
||||
}
|
||||
|
||||
private float getScreenScale() {
|
||||
return Minecraft.getMinecraft().currentScreen.width * 1f / Minecraft.getMinecraft().displayWidth;
|
||||
}
|
||||
|
||||
private int getZoomAmount(GuiContainer gui) {
|
||||
return Math.max(
|
||||
Math.round(SLOT_SIZE * MIN_SCALE / getPointSize(gui)),
|
||||
NEIClientConfig.getIntSetting("inventory.itemzoom.zoom"));
|
||||
}
|
||||
|
||||
private void increaseZoom(GuiContainer gui) {
|
||||
final float pointSize = getPointSize(gui);
|
||||
final float scale = Math.round(getZoomAmount(gui) * pointSize / SLOT_SIZE);
|
||||
|
||||
NEIClientConfig.setIntSetting(
|
||||
"inventory.itemzoom.zoom",
|
||||
Math.min(MAX_ZOOM, Math.round((scale + 1) / (pointSize / SLOT_SIZE))));
|
||||
}
|
||||
|
||||
private void decreaseZoom(GuiContainer gui) {
|
||||
final float pointSize = getPointSize(gui);
|
||||
final float scale = Math.round(getZoomAmount(gui) * pointSize / SLOT_SIZE);
|
||||
|
||||
NEIClientConfig.setIntSetting(
|
||||
"inventory.itemzoom.zoom",
|
||||
Math.max(MIN_ZOOM, Math.round(Math.max(MIN_SCALE, scale - 1) / (pointSize / SLOT_SIZE))));
|
||||
}
|
||||
|
||||
private ItemStack getStackMouseOver(GuiContainer gui) {
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.neiOnly")) {
|
||||
final Point mouse = getMousePosition();
|
||||
ItemStack stack = ItemPanels.itemPanel.getStackMouseOver(mouse.x, mouse.y);
|
||||
|
||||
if (stack == null) {
|
||||
stack = ItemPanels.bookmarkPanel.getStackMouseOver(mouse.x, mouse.y);
|
||||
}
|
||||
|
||||
if (stack == null) {
|
||||
stack = ItemPanels.itemPanel.historyPanel.getStackMouseOver(mouse.x, mouse.y);
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
return GuiContainerManager.getStackMouseOver(gui);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.itemzoom_toggle")) {
|
||||
NEIClientConfig.getSetting("inventory.itemzoom.enabled")
|
||||
.setBooleanValue(!NEIClientConfig.getBooleanSetting("inventory.itemzoom.enabled"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.stack != null && NEIClientConfig.isKeyHashDown("gui.itemzoom_hold")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.stack != null && NEIClientConfig.isKeyHashDown("gui.itemzoom_zoom_in")) {
|
||||
increaseZoom(gui);
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.stack != null && NEIClientConfig.isKeyHashDown("gui.itemzoom_zoom_out")) {
|
||||
decreaseZoom(gui);
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (previousKeyboardRepeatEnabled != null) {
|
||||
Keyboard.enableRepeatEvents(previousKeyboardRepeatEnabled);
|
||||
previousKeyboardRepeatEnabled = null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {}
|
||||
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class ItemsGrid {
|
||||
}
|
||||
}
|
||||
|
||||
private void afterDrawItems(int mousex, int mousey, @Nullable ItemPanelSlot focused) {
|
||||
protected void afterDrawItems(int mousex, int mousey, @Nullable ItemPanelSlot focused) {
|
||||
final List<Integer> mask = getMask();
|
||||
|
||||
for (int i = 0; i < mask.size(); i++) {
|
||||
@@ -367,8 +367,6 @@ public class ItemsGrid {
|
||||
afterDrawItems(mousex, mousey, focused);
|
||||
}
|
||||
|
||||
public void postDrawTooltips(int mousex, int mousey, List<String> tooltip) {}
|
||||
|
||||
public void setVisible() {
|
||||
if (getItems().isEmpty() && getMessageOnEmpty() != null) {
|
||||
LayoutManager.addWidget(messageLabel);
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
|
||||
public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
protected static int MAX_COLUMNS = 11;
|
||||
protected static int MARGIN_TOP = 2;
|
||||
|
||||
protected String label;
|
||||
protected EnumChatFormatting labelColor = EnumChatFormatting.GRAY;
|
||||
protected List<ItemStack> items;
|
||||
protected Dimension size = new Dimension();
|
||||
protected boolean saveStackSize = false;
|
||||
protected int columns = 0;
|
||||
protected int count = 0;
|
||||
protected int rows = 0;
|
||||
protected int length = 0;
|
||||
|
||||
public ItemsTooltipLineHandler(String label, List<ItemStack> items, boolean saveStackSize) {
|
||||
this(label, items, true, 5);
|
||||
}
|
||||
|
||||
public ItemsTooltipLineHandler(String label, List<ItemStack> items, boolean saveStackSize, int maxRows) {
|
||||
this.label = label;
|
||||
this.items = groupingItemStacks(items);
|
||||
this.saveStackSize = saveStackSize;
|
||||
this.length = this.items.size();
|
||||
|
||||
if (this.length > 0) {
|
||||
this.columns = Math.min(MAX_COLUMNS, this.length);
|
||||
this.rows = Math.min(maxRows, (int) Math.ceil((float) this.length / this.columns));
|
||||
|
||||
this.size.width = Math
|
||||
.max(this.columns * ItemsGrid.SLOT_SIZE, fontRenderer.getStringWidth(this.label) + 15);
|
||||
this.size.height = this.rows * ItemsGrid.SLOT_SIZE + fontRenderer.FONT_HEIGHT + 2 + MARGIN_TOP;
|
||||
|
||||
this.count = Math.min(
|
||||
this.length,
|
||||
Math.min(
|
||||
this.columns * this.rows,
|
||||
this.length > MAX_COLUMNS * maxRows ? (MAX_COLUMNS * maxRows - 1) : Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return this.items.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public void setLabelColor(EnumChatFormatting color) {
|
||||
this.labelColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
if (this.length == 0) return;
|
||||
|
||||
y += MARGIN_TOP;
|
||||
|
||||
fontRenderer.drawStringWithShadow(this.labelColor + this.label + ":", x, y, 0);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
GL11.glScaled(1, 1, 3);
|
||||
GL11.glTranslatef(x, y + fontRenderer.FONT_HEIGHT + 2, 0);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
for (int i = 0; i < this.count; i++) {
|
||||
ItemStack drawStack = this.items.get(i);
|
||||
int col = i % this.columns;
|
||||
int row = i / this.columns;
|
||||
|
||||
String stackSize = !this.saveStackSize || drawStack.stackSize == 0 ? ""
|
||||
: ReadableNumberConverter.INSTANCE.toWideReadableForm(drawStack.stackSize);
|
||||
|
||||
GuiContainerManager
|
||||
.drawItem(col * ItemsGrid.SLOT_SIZE, row * ItemsGrid.SLOT_SIZE, drawStack, true, stackSize);
|
||||
}
|
||||
|
||||
if (this.count < this.items.size()) {
|
||||
fontRenderer.drawStringWithShadow(
|
||||
"+" + (this.items.size() - this.count),
|
||||
(this.columns - 1) * ItemsGrid.SLOT_SIZE,
|
||||
(this.rows - 1) * ItemsGrid.SLOT_SIZE + (ItemsGrid.SLOT_SIZE - fontRenderer.FONT_HEIGHT) / 2 - 1,
|
||||
0xee555555);
|
||||
}
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private List<ItemStack> groupingItemStacks(List<ItemStack> items) {
|
||||
final Map<String, Integer> count = new HashMap<>();
|
||||
final Map<String, NBTTagCompound> unique = new LinkedHashMap<>();
|
||||
final List<ItemStack> result = new ArrayList<>();
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack, true);
|
||||
final String GUID = StackInfo.getItemStackGUID(stack);
|
||||
|
||||
if (!unique.containsKey(GUID)) {
|
||||
count.put(GUID, nbTag.getInteger("Count"));
|
||||
unique.put(GUID, nbTag);
|
||||
} else {
|
||||
count.put(GUID, count.get(GUID) + nbTag.getInteger("Count"));
|
||||
}
|
||||
}
|
||||
|
||||
for (String GUID : unique.keySet()) {
|
||||
ItemStack stack = StackInfo.loadFromNBT(unique.get(GUID), count.get(GUID));
|
||||
|
||||
if (unique.get(GUID).hasKey("gtFluidName")) {
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
|
||||
result.add(stack);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,9 @@ import static codechicken.nei.NEIClientUtils.toggleRaining;
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -40,7 +42,6 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -53,7 +54,6 @@ import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.KeyManager.IKeyStateTracker;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.GuiInfo;
|
||||
import codechicken.nei.api.INEIAutoFocusSearchEnable;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.api.LayoutStyle;
|
||||
@@ -84,13 +84,13 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
*/
|
||||
private static TreeSet<Widget> controlWidgets = new TreeSet<>(new WidgetZOrder(true));
|
||||
|
||||
private static List<IContainerTooltipHandler> tooltipWidgets = new LinkedList<>();
|
||||
|
||||
public static ItemPanel itemPanel;
|
||||
public static BookmarkPanel bookmarkPanel;
|
||||
public static SubsetWidget dropDown;
|
||||
public static SearchField searchField;
|
||||
public static boolean searchInitFocusedCancellable = false;
|
||||
protected static int mousePriorX;
|
||||
protected static int mousePriorY;
|
||||
public static ItemZoom itemZoom;
|
||||
|
||||
public static ButtonCycled options;
|
||||
public static ButtonCycled bookmarksButton;
|
||||
@@ -167,38 +167,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return getSideWidth(gui);
|
||||
}
|
||||
|
||||
protected boolean isAllowedGuiAutoSearchFocus(GuiContainer gui) {
|
||||
if (gui instanceof INEIAutoFocusSearchEnable) {
|
||||
return true;
|
||||
}
|
||||
String guiClassName = gui.getClass().getName();
|
||||
for (String prefix : NEIClientConfig.enableAutoFocusPrefixes) {
|
||||
if (guiClassName.startsWith(prefix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Maybe make this an option to make it easier to figure out what GPU class to add to the configuration?
|
||||
// NEIClientConfig.logger.info("Checking for autofocus on " + guiClassName + " had no match");
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void searchFocusInitCancelCheck() {
|
||||
if (searchInitFocusedCancellable) {
|
||||
if (searchField.isVisible() && NEIClientConfig.searchWidgetAutofocus()
|
||||
&& getInputFocused() == searchField) {
|
||||
searchField.setFocus(false);
|
||||
setInputFocused(null);
|
||||
}
|
||||
searchInitFocusedCancellable = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
if (isHidden()) return;
|
||||
|
||||
searchFocusInitCancelCheck();
|
||||
|
||||
for (Widget widget : controlWidgets) widget.onGuiClick(mousex, mousey);
|
||||
}
|
||||
|
||||
@@ -208,8 +180,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
if (!isEnabled()) return options.contains(mousex, mousey) && options.handleClick(mousex, mousey, button);
|
||||
|
||||
searchFocusInitCancelCheck();
|
||||
|
||||
for (Widget widget : controlWidgets) {
|
||||
widget.onGuiClick(mousex, mousey);
|
||||
if (widget.contains(mousex, mousey) ? widget.handleClick(mousex, mousey, button)
|
||||
@@ -230,14 +200,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
if (isEnabled() && !isHidden()) {
|
||||
if (searchInitFocusedCancellable) {
|
||||
searchInitFocusedCancellable = false;
|
||||
if (NEIClientConfig.isFirstInvCloseClosesInSearch()
|
||||
&& GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindInventory)) {
|
||||
searchField.setFocus(false);
|
||||
setInputFocused(null);
|
||||
}
|
||||
}
|
||||
if (inputFocused != null) return inputFocused.handleKeyPress(keyID, keyChar);
|
||||
|
||||
for (Widget widget : controlWidgets) if (widget.handleKeyPress(keyID, keyChar)) return true;
|
||||
@@ -258,7 +220,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.hide_bookmarks")) {
|
||||
toggleBooleanSetting("inventory.bookmarksEnabled");
|
||||
toggleBooleanSetting("inventory.bookmarks.enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -276,7 +238,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
public void onMouseUp(GuiContainer gui, int mx, int my, int button) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
searchFocusInitCancelCheck();
|
||||
for (Widget widget : controlWidgets) widget.mouseUp(mx, my, button);
|
||||
}
|
||||
}
|
||||
@@ -284,7 +245,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mx, int my, int button, long heldTime) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
searchFocusInitCancelCheck();
|
||||
for (Widget widget : controlWidgets) widget.mouseDragged(mx, my, button, heldTime);
|
||||
}
|
||||
}
|
||||
@@ -303,14 +263,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public void renderObjects(GuiContainer gui, int mousex, int mousey) {
|
||||
if (!isHidden()) {
|
||||
layout(gui);
|
||||
if (mousePriorX == -1) {
|
||||
mousePriorX = mousex;
|
||||
mousePriorY = mousey;
|
||||
} else if (mousePriorX != mousex || mousePriorY != mousey) {
|
||||
searchFocusInitCancelCheck();
|
||||
mousePriorX = mousex;
|
||||
mousePriorY = mousey;
|
||||
}
|
||||
if (isEnabled()) {
|
||||
getLayoutStyle().drawBackground(GuiContainerManager.getManager(gui));
|
||||
for (Widget widget : drawWidgets) widget.draw(mousex, mousey);
|
||||
@@ -342,6 +294,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
||||
for (Widget widget : drawWidgets) currenttip = widget.handleTooltip(mousex, mousey, currenttip);
|
||||
for (IContainerTooltipHandler tip : tooltipWidgets)
|
||||
currenttip = tip.handleTooltip(gui, mousex, mousey, currenttip);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
@@ -359,15 +313,37 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
currenttip.set(0, mainname);
|
||||
}
|
||||
|
||||
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
||||
for (IContainerTooltipHandler tip : tooltipWidgets)
|
||||
currenttip = tip.handleItemDisplayName(gui, stack, currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
|
||||
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
||||
for (IContainerTooltipHandler tip : tooltipWidgets)
|
||||
currenttip = tip.handleItemTooltip(gui, itemstack, mousex, mousey, currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> handleHotkeys(GuiContainer gui, int mousex, int mousey, Map<String, String> hotkeys) {
|
||||
|
||||
if (!isHidden() && isEnabled() && GuiContainerManager.shouldShowTooltip(gui)) {
|
||||
for (IContainerTooltipHandler tip : tooltipWidgets)
|
||||
hotkeys = tip.handleHotkeys(gui, mousex, mousey, hotkeys);
|
||||
}
|
||||
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
public static void layout(GuiContainer gui) {
|
||||
VisiblityData visiblity = new VisiblityData();
|
||||
|
||||
@@ -403,6 +379,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
bookmarkPanel = ItemPanels.bookmarkPanel;
|
||||
bookmarkPanel.init();
|
||||
|
||||
itemZoom = new ItemZoom();
|
||||
|
||||
dropDown = new SubsetWidget();
|
||||
searchField = new SearchField("search");
|
||||
API.addItemFilter(searchField);
|
||||
@@ -470,7 +448,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
NEIClientConfig.toggleBooleanSetting("inventory.bookmarksEnabled");
|
||||
NEIClientConfig.toggleBooleanSetting("inventory.bookmarks.enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -668,15 +646,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
getLayoutStyle().init();
|
||||
layout(gui);
|
||||
mousePriorX = -1;
|
||||
mousePriorY = -1;
|
||||
|
||||
if (searchField.isVisible() && NEIClientConfig.searchWidgetAutofocus()
|
||||
&& isAllowedGuiAutoSearchFocus(gui)) {
|
||||
searchField.setFocus(true);
|
||||
setInputFocused(searchField);
|
||||
searchInitFocusedCancellable = true;
|
||||
}
|
||||
AutoFocusWidget.instance.load(gui);
|
||||
}
|
||||
|
||||
NEIController.load(gui);
|
||||
@@ -703,6 +673,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public static void updateWidgetVisiblities(GuiContainer gui, VisiblityData visiblity) {
|
||||
drawWidgets = new TreeSet<>(new WidgetZOrder(false));
|
||||
controlWidgets = new TreeSet<>(new WidgetZOrder(true));
|
||||
tooltipWidgets.clear();
|
||||
|
||||
if (!visiblity.showNEI) return;
|
||||
|
||||
@@ -735,6 +706,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (canPerformAction("delete")) addWidget(delete);
|
||||
}
|
||||
|
||||
addWidget(itemZoom);
|
||||
|
||||
if (visiblity.showSubsetDropdown) {
|
||||
// Bookmarks or Subset/dropdown
|
||||
addWidget(dropDown);
|
||||
@@ -754,6 +727,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public static void addWidget(Widget widget) {
|
||||
drawWidgets.add(widget);
|
||||
controlWidgets.add(widget);
|
||||
|
||||
if (widget instanceof IContainerTooltipHandler) {
|
||||
tooltipWidgets.add((IContainerTooltipHandler) widget);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -768,7 +745,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
if (isHidden() || !isEnabled()) return false;
|
||||
searchFocusInitCancelCheck();
|
||||
|
||||
for (Widget widget : drawWidgets) if (widget.onMouseWheel(scrolled, mousex, mousey)) return true;
|
||||
|
||||
@@ -876,13 +852,11 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent, boolean slotHighlight) {
|
||||
|
||||
if (slotHighlight) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glTranslatef(0, 0, -150);
|
||||
drawRect(slotX, slotY, 16, 16, isPresent ? 0x8000AA00 : 0x80AA0000);
|
||||
GL11.glTranslatef(0, 0, 150);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glPopAttrib();
|
||||
} else {
|
||||
Image icon = itemPresenceOverlays[isPresent ? 1 : 0];
|
||||
drawIcon(slotX + 16 - icon.width, slotY + 16 - icon.height, icon);
|
||||
|
||||
@@ -9,6 +9,7 @@ import static codechicken.nei.LayoutManager.gamemode;
|
||||
import static codechicken.nei.LayoutManager.heal;
|
||||
import static codechicken.nei.LayoutManager.itemPanel;
|
||||
import static codechicken.nei.LayoutManager.itemPresenceOverlays;
|
||||
import static codechicken.nei.LayoutManager.itemZoom;
|
||||
import static codechicken.nei.LayoutManager.magnet;
|
||||
import static codechicken.nei.LayoutManager.options;
|
||||
import static codechicken.nei.LayoutManager.rain;
|
||||
@@ -104,6 +105,7 @@ public class LayoutStyleMinecraft extends LayoutStyle {
|
||||
|
||||
itemPanel.resize(gui);
|
||||
bookmarkPanel.resize(gui);
|
||||
itemZoom.resize(gui);
|
||||
|
||||
options.x = isEnabled() ? 0 : 6;
|
||||
options.y = isEnabled() ? gui.height - 22 : gui.height - 28;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -101,9 +100,6 @@ public class NEIClientConfig {
|
||||
// Any handler not in the map will be assigned to 0, and negative numbers are fine.
|
||||
public static HashMap<String, Integer> handlerOrdering = new HashMap<>();
|
||||
|
||||
// List of prefixes of classes that should enable the autofocus search widget on open.
|
||||
public static ArrayList<String> enableAutoFocusPrefixes = new ArrayList<>();
|
||||
|
||||
// Function that extracts the handler ID from a handler, with special logic for
|
||||
// TemplateRecipeHandler: prefer using the overlay ID if it exists.
|
||||
public static final Function<IRecipeHandler, String> HANDLER_ID_FUNCTION = handler -> Objects
|
||||
@@ -178,8 +174,8 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.search.widgetAutofocus")
|
||||
.setComment(
|
||||
"Focus Search Widget on Open, blurs/unfocuses on mouse move unless typing has started first")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.search.widgetAutofocus", true));
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.widgetAutofocus", 3, true));
|
||||
|
||||
tag.getTag("inventory.search.patternMode").setComment("Search Mode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.patternMode", 3, true));
|
||||
@@ -242,6 +238,74 @@ public class NEIClientConfig {
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.bookmarks.enabled").setComment("Enable/Disable Bookmark Panel").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.enabled", true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.worldSpecific").setComment("Global or world specific bookmarks")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.worldSpecific", true) {
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
super.onClick(button);
|
||||
initBookmarkFile(worldPath);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.bookmarks.animation").setComment("REI Style Animation in Bookmarks")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.animation", true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.recipeTooltipsMode").setComment("Show recipe tooltips in Bookmarks")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.bookmarks.recipeTooltipsMode", 4, true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.showRecipeMarker").setComment("Show Recipe Marker").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.showRecipeMarker", true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.craftingChainDir").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.bookmarks.craftingChainDir", 2, true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.ignorePotionOverlap").setComment("Ignore overlap with potion effect HUD")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.ignorePotionOverlap", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.jeiStyleTabs").setComment("Enable/disable JEI Style Tabs")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButtonBoubs("inventory.guirecipe.jeiStyleTabs", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.jeiStyleRecipeCatalyst").setComment("Enable/disable JEI Style Recipe Catalysts")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.jeiStyleRecipeCatalyst", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.jeiStyleCycledIngredients").setComment("JEI styled cycled ingredients")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.jeiStyleCycledIngredients", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.cycledIngredientsTooltip").setComment("Show cycled ingredients tooltip")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.cycledIngredientsTooltip", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.creativeTabStyle").setComment("Creative or JEI style tabs")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.creativeTabStyle", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.itemPresenceOverlay").setComment("Item presence overlay on ?-hover")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.guirecipe.itemPresenceOverlay", 3, true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.slotHighlightPresent").setComment("Highlight Present Item")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.slotHighlightPresent", true));
|
||||
|
||||
tag.getTag("inventory.guirecipe.shiftOverlayRecipe")
|
||||
.setComment("Require holding shift to move items when overlaying recipe").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.guirecipe.shiftOverlayRecipe", true));
|
||||
|
||||
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));
|
||||
|
||||
@@ -265,6 +329,9 @@ public class NEIClientConfig {
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.collapsibleItems.customName").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.collapsibleItems.customName", true));
|
||||
|
||||
tag.getTag("inventory.collapsibleItems.expandedColor")
|
||||
.setComment("Color of the collapsible item expanded state").getHexValue(0x335555EE);
|
||||
API.addOption(new OptionIntegerField("inventory.collapsibleItems.expandedColor"));
|
||||
@@ -286,6 +353,31 @@ public class NEIClientConfig {
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.itemzoom.enabled").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.itemzoom.enabled", true));
|
||||
|
||||
tag.getTag("inventory.itemzoom.neiOnly")
|
||||
.setComment("Zoom items only from the JEI ingredient and bookmark list overlays.")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.itemzoom.neiOnly", true));
|
||||
|
||||
tag.getTag("inventory.itemzoom.onlySolid").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.itemzoom.onlySolid", true));
|
||||
|
||||
tag.getTag("inventory.itemzoom.helpText")
|
||||
.setComment("Display name \"Item Zoom\" and the hotkey to toggle this mod below the zoomed item.")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.itemzoom.helpText", true));
|
||||
|
||||
tag.getTag("inventory.itemzoom.zoom").getIntValue(500);
|
||||
API.addOption(new OptionIntegerField("inventory.itemzoom.zoom", ItemZoom.MIN_ZOOM, ItemZoom.MAX_ZOOM));
|
||||
|
||||
tag.getTag("inventory.itemzoom.showName").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.itemzoom.showName", true));
|
||||
|
||||
tag.getTag("inventory.itemzoom.nameColor").getHexValue(0xFFFFFFFF);
|
||||
API.addOption(new OptionIntegerField("inventory.itemzoom.nameColor"));
|
||||
|
||||
tag.getTag("inventory.itemIDs").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.itemIDs", 3, true));
|
||||
|
||||
@@ -308,9 +400,6 @@ public class NEIClientConfig {
|
||||
|
||||
API.addOption(new OptionOpenGui("world.presets", GuiPresetList.class));
|
||||
|
||||
tag.getTag("inventory.profileRecipes").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.profileRecipes", true));
|
||||
|
||||
tag.getTag("inventory.disableMouseScrollTransfer").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.disableMouseScrollTransfer", true));
|
||||
|
||||
@@ -339,18 +428,6 @@ public class NEIClientConfig {
|
||||
tag.getTag("command.heal").setDefaultValue("");
|
||||
API.addOption(new OptionTextField("command.heal"));
|
||||
|
||||
tag.getTag("inventory.worldSpecificBookmarks").setComment("Global or world specific bookmarks")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.worldSpecificBookmarks", true) {
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
super.onClick(button);
|
||||
initBookmarkFile(worldPath);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.worldSpecificPresets").setComment("Global or world specific presets")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.worldSpecificPresets", true) {
|
||||
@@ -363,59 +440,13 @@ public class NEIClientConfig {
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.bookmarksEnabled").setComment("Enable/disable bookmarks").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarksEnabled", true));
|
||||
|
||||
tag.getTag("inventory.bookmarksAnimationEnabled").setComment("REI Style Animation in Bookmarks")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarksAnimationEnabled", true));
|
||||
|
||||
tag.getTag("inventory.recipeTooltipsMode").setComment("Show recipe tooltips in Bookmarks").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.recipeTooltipsMode", 4, true));
|
||||
|
||||
tag.getTag("inventory.showRecipeMarker").setComment("Show Recipe Marker").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.showRecipeMarker", true));
|
||||
|
||||
tag.getTag("inventory.showItemQuantityWidget").setComment("Show Item Quantity Widget").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.showItemQuantityWidget", true));
|
||||
|
||||
tag.getTag("inventory.firstInvCloseClosesInSearch").setComment(
|
||||
"Pressing the open inventory key when the inventory was just opened when the search is focused will close it instead of typing in the search")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.firstInvCloseClosesInSearch", true));
|
||||
|
||||
tag.getTag("inventory.jei_style_tabs").setComment("Enable/disable JEI Style Tabs").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButtonBoubs("inventory.jei_style_tabs", true));
|
||||
|
||||
tag.getTag("inventory.itemPresenceOverlay").setComment("Item presence overlay on ?-hover").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.itemPresenceOverlay", 3, true));
|
||||
|
||||
tag.getTag("inventory.slotHighlightPresent").setComment("Highlight Present Item").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.slotHighlightPresent", true));
|
||||
|
||||
tag.getTag("inventory.jei_style_recipe_catalyst").setComment("Enable/disable JEI Style Recipe Catalysts")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.jei_style_recipe_catalyst", true));
|
||||
|
||||
tag.getTag("inventory.creative_tab_style").setComment("Creative or JEI style tabs").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.creative_tab_style", true));
|
||||
|
||||
tag.getTag("inventory.ignore_potion_overlap").setComment("Ignore overlap with potion effect HUD")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.ignore_potion_overlap", true));
|
||||
|
||||
tag.getTag("inventory.optimize_gui_overlap_computation").setComment("Optimize computation for GUI overlap")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.optimize_gui_overlap_computation", true));
|
||||
|
||||
tag.getTag("inventory.jei_style_cycled_ingredients").setComment("JEI styled cycled ingredients")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.jei_style_cycled_ingredients", true));
|
||||
|
||||
tag.getTag("inventory.shift_overlay_recipe")
|
||||
.setComment("Require holding shift to move items when overlaying recipe").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.shift_overlay_recipe", 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) {
|
||||
@@ -484,6 +515,7 @@ public class NEIClientConfig {
|
||||
API.addHashBind("gui.search", Keyboard.KEY_F);
|
||||
API.addHashBind("gui.bookmark", Keyboard.KEY_A);
|
||||
API.addHashBind("gui.bookmark_recipe", Keyboard.KEY_A + NEIClientUtils.SHIFT_HASH);
|
||||
API.addHashBind("gui.remove_recipe", Keyboard.KEY_A + NEIClientUtils.SHIFT_HASH);
|
||||
API.addHashBind("gui.bookmark_count", Keyboard.KEY_A + NEIClientUtils.CTRL_HASH);
|
||||
API.addHashBind(
|
||||
"gui.bookmark_recipe_count",
|
||||
@@ -498,6 +530,11 @@ public class NEIClientConfig {
|
||||
API.addKeyBind("gui.getnextsearch", Keyboard.KEY_DOWN);
|
||||
API.addHashBind("gui.next_tooltip", Keyboard.KEY_Z);
|
||||
|
||||
API.addHashBind("gui.itemzoom_toggle", Keyboard.KEY_Z + NEIClientUtils.SHIFT_HASH);
|
||||
API.addHashBind("gui.itemzoom_hold", 0);
|
||||
API.addHashBind("gui.itemzoom_zoom_in", 0);
|
||||
API.addHashBind("gui.itemzoom_zoom_out", 0);
|
||||
|
||||
API.addKeyBind("world.chunkoverlay", Keyboard.KEY_F9);
|
||||
API.addKeyBind("world.moboverlay", Keyboard.KEY_F7);
|
||||
API.addKeyBind("world.highlight_tips", Keyboard.KEY_NUMPAD0);
|
||||
@@ -530,9 +567,9 @@ public class NEIClientConfig {
|
||||
specificDir.mkdirs();
|
||||
}
|
||||
|
||||
world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg")));
|
||||
initBookmarkFile(worldPath);
|
||||
initPresetsFile(worldPath);
|
||||
world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg")));
|
||||
onWorldLoad(newWorld);
|
||||
}
|
||||
|
||||
@@ -624,6 +661,7 @@ public class NEIClientConfig {
|
||||
ItemInfo.load(world);
|
||||
GuiInfo.load();
|
||||
RecipeInfo.load();
|
||||
HeldItemHandler.load();
|
||||
LayoutManager.load();
|
||||
NEIController.load();
|
||||
BookmarkContainerInfo.load();
|
||||
@@ -668,7 +706,7 @@ public class NEIClientConfig {
|
||||
|
||||
private static void initBookmarkFile(String worldPath) {
|
||||
|
||||
if (!global.config.getTag("inventory.worldSpecificBookmarks").getBooleanValue()) {
|
||||
if (!global.config.getTag("inventory.bookmarks.worldSpecific").getBooleanValue()) {
|
||||
worldPath = "global";
|
||||
}
|
||||
|
||||
@@ -703,19 +741,19 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static boolean isBookmarkPanelHidden() {
|
||||
return !getBooleanSetting("inventory.bookmarksEnabled");
|
||||
return !getBooleanSetting("inventory.bookmarks.enabled");
|
||||
}
|
||||
|
||||
public static boolean areBookmarksAnimated() {
|
||||
return getBooleanSetting("inventory.bookmarksAnimationEnabled");
|
||||
return getBooleanSetting("inventory.bookmarks.animation");
|
||||
}
|
||||
|
||||
public static int getRecipeTooltipsMode() {
|
||||
return getIntSetting("inventory.recipeTooltipsMode");
|
||||
return getIntSetting("inventory.bookmarks.recipeTooltipsMode");
|
||||
}
|
||||
|
||||
public static boolean showRecipeMarker() {
|
||||
return getBooleanSetting("inventory.showRecipeMarker");
|
||||
return getBooleanSetting("inventory.bookmarks.showRecipeMarker");
|
||||
}
|
||||
|
||||
public static boolean showItemQuantityWidget() {
|
||||
@@ -726,36 +764,36 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.search.widgetPosition");
|
||||
}
|
||||
|
||||
public static boolean searchWidgetAutofocus() {
|
||||
return getBooleanSetting("inventory.search.widgetAutofocus");
|
||||
}
|
||||
|
||||
public static boolean isFirstInvCloseClosesInSearch() {
|
||||
return getBooleanSetting("inventory.firstInvCloseClosesInSearch");
|
||||
public static int searchWidgetAutofocus() {
|
||||
return getIntSetting("inventory.search.widgetAutofocus");
|
||||
}
|
||||
|
||||
public static boolean areJEIStyleTabsVisible() {
|
||||
return getBooleanSetting("inventory.jei_style_tabs");
|
||||
return getBooleanSetting("inventory.guirecipe.jeiStyleTabs");
|
||||
}
|
||||
|
||||
public static int itemPresenceOverlay() {
|
||||
return getIntSetting("inventory.itemPresenceOverlay");
|
||||
return getIntSetting("inventory.guirecipe.itemPresenceOverlay");
|
||||
}
|
||||
|
||||
public static boolean isSlotHighlightPresent() {
|
||||
return getBooleanSetting("inventory.slotHighlightPresent");
|
||||
return getBooleanSetting("inventory.guirecipe.slotHighlightPresent");
|
||||
}
|
||||
|
||||
public static boolean areJEIStyleRecipeCatalystsVisible() {
|
||||
return getBooleanSetting("inventory.jei_style_recipe_catalyst");
|
||||
return getBooleanSetting("inventory.guirecipe.jeiStyleRecipeCatalyst");
|
||||
}
|
||||
|
||||
public static boolean useCreativeTabStyle() {
|
||||
return getBooleanSetting("inventory.creative_tab_style");
|
||||
return getBooleanSetting("inventory.guirecipe.creativeTabStyle");
|
||||
}
|
||||
|
||||
public static boolean ignorePotionOverlap() {
|
||||
return getBooleanSetting("inventory.ignore_potion_overlap");
|
||||
return getBooleanSetting("inventory.bookmarks.ignorePotionOverlap");
|
||||
}
|
||||
|
||||
public static int craftingChainDir() {
|
||||
return getIntSetting("inventory.bookmarks.craftingChainDir");
|
||||
}
|
||||
|
||||
public static boolean optimizeGuiOverlapComputation() {
|
||||
@@ -763,11 +801,15 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static boolean useJEIStyledCycledIngredients() {
|
||||
return getBooleanSetting("inventory.jei_style_cycled_ingredients");
|
||||
return getBooleanSetting("inventory.guirecipe.jeiStyleCycledIngredients");
|
||||
}
|
||||
|
||||
public static boolean showCycledIngredientsTooltip() {
|
||||
return getBooleanSetting("inventory.guirecipe.cycledIngredientsTooltip");
|
||||
}
|
||||
|
||||
public static boolean requireShiftForOverlayRecipe() {
|
||||
return getBooleanSetting("inventory.shift_overlay_recipe");
|
||||
return getBooleanSetting("inventory.guirecipe.shiftOverlayRecipe");
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
@@ -787,7 +829,7 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static boolean isProfileRecipeEnabled() {
|
||||
return NEIClientConfig.getBooleanSetting("inventory.profileRecipes");
|
||||
return NEIClientConfig.getBooleanSetting("inventory.guirecipe.profile");
|
||||
}
|
||||
|
||||
public static void setEnabled(boolean flag) {
|
||||
|
||||
@@ -367,18 +367,23 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
}
|
||||
|
||||
public static String cropText(FontRenderer fontRenderer, String text, int containerWidth) {
|
||||
|
||||
int textWidth = fontRenderer.getStringWidth(text);
|
||||
|
||||
if (textWidth > containerWidth) {
|
||||
textWidth += fontRenderer.getStringWidth("...");
|
||||
int dots = fontRenderer.getStringWidth("...");
|
||||
|
||||
while (textWidth > containerWidth) {
|
||||
textWidth -= fontRenderer.getCharWidth(text.charAt(text.length() - 1));
|
||||
text = text.substring(0, text.length() - 1);
|
||||
if (containerWidth > dots) {
|
||||
textWidth += dots;
|
||||
|
||||
while (textWidth > containerWidth) {
|
||||
textWidth -= fontRenderer.getCharWidth(text.charAt(text.length() - 1));
|
||||
text = text.substring(0, text.length() - 1);
|
||||
}
|
||||
|
||||
return text + "...";
|
||||
}
|
||||
|
||||
return text + "...";
|
||||
return "...";
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
@@ -63,6 +63,7 @@ public class NEIModContainer extends DummyModContainer {
|
||||
public Set<ArtifactVersion> getRequirements() {
|
||||
Set<ArtifactVersion> deps = new HashSet<>();
|
||||
deps.add(VersionParser.parseVersionReference("CodeChickenCore@[" + CodeChickenCorePlugin.version + ",)"));
|
||||
deps.add(VersionParser.parseVersionReference("hodgepodge@[2.5.44,)"));
|
||||
return deps;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,11 +11,12 @@ import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.api.GuiInfo;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
|
||||
public abstract class PanelWidget extends Widget {
|
||||
public abstract class PanelWidget extends Widget implements IContainerTooltipHandler {
|
||||
|
||||
protected static final int PADDING = 2;
|
||||
|
||||
@@ -197,11 +198,6 @@ public abstract class PanelWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postDrawTooltips(int mx, int my, List<String> tooltip) {
|
||||
grid.postDrawTooltips(mx, my, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
|
||||
if (mouseDownSlot >= 0 && draggedStack == null
|
||||
@@ -220,28 +216,8 @@ public abstract class PanelWidget extends Widget {
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button) {
|
||||
|
||||
if (handleClickExt(mousex, mousey, button)) return true;
|
||||
|
||||
if (NEIClientUtils.getHeldItem() != null) {
|
||||
|
||||
if (!grid.contains(mousex, mousey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item")) {
|
||||
if (button == 1) {
|
||||
NEIClientUtils.decreaseSlotStack(-999);
|
||||
} else {
|
||||
NEIClientUtils.deleteHeldItem();
|
||||
}
|
||||
} else {
|
||||
NEIClientUtils.dropHeldItem();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
|
||||
if (hoverSlot != null) {
|
||||
|
||||
@@ -336,7 +312,8 @@ public abstract class PanelWidget extends Widget {
|
||||
if (hoverSlot != null && hoverSlot.slotIndex == mouseDownSlot && draggedStack == null) {
|
||||
ItemStack item = hoverSlot.item.copy();
|
||||
|
||||
if (NEIController.manager.window instanceof GuiRecipe || !NEIClientConfig.canCheatItem(item)) {
|
||||
if (NEIController.manager.window instanceof GuiRecipe || NEIClientUtils.shiftKey()
|
||||
|| !NEIClientConfig.canCheatItem(item)) {
|
||||
|
||||
if (button == 0) {
|
||||
GuiCraftingRecipe.openRecipeGui("item", item);
|
||||
@@ -400,4 +377,21 @@ public abstract class PanelWidget extends Widget {
|
||||
public boolean contains(int px, int py) {
|
||||
return grid.contains(px, py);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,20 +23,26 @@ public class DefaultOverlayRenderer implements IRecipeOverlayRenderer {
|
||||
|
||||
@Override
|
||||
public void renderOverlay(GuiContainerManager gui, Slot slot) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(770, 1);
|
||||
GL11.glColor4d(0.6, 0.6, 0.6, 0.7);
|
||||
|
||||
GuiContainerManager.setColouredItemRender(true);
|
||||
for (PositionedStack stack : ingreds) {
|
||||
if (stack.relx == slot.xDisplayPosition && stack.rely == slot.yDisplayPosition)
|
||||
if (stack.relx == slot.xDisplayPosition && stack.rely == slot.yDisplayPosition && !slot.getHasStack()) {
|
||||
GuiContainerManager.drawItem(stack.relx, stack.rely, stack.item);
|
||||
drawHover(stack.relx, stack.rely);
|
||||
}
|
||||
}
|
||||
GuiContainerManager.setColouredItemRender(false);
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private static void drawHover(int x, int y) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
drawRect(x, y, 16, 16, 0x66555555);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
final IStackPositioner positioner;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
/**
|
||||
* Implement this interface on a GuiContainer to enable the autofocus search in NEI (if the autofocus option is enabled)
|
||||
* without needing to add the classname to the config file .
|
||||
*/
|
||||
public interface INEIAutoFocusSearchEnable {
|
||||
}
|
||||
@@ -1,10 +1,45 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public interface IOverlayHandler {
|
||||
|
||||
void overlayRecipe(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex, boolean shift);
|
||||
|
||||
default List<Boolean> presenceOverlay(GuiContainer firstGui, IRecipeHandler recipe, int recipeIndex) {
|
||||
final List<Boolean> itemPresenceSlots = new ArrayList<>();
|
||||
final List<PositionedStack> ingredients = recipe.getIngredientStacks(recipeIndex);
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<ItemStack> invStacks = ((List<Slot>) firstGui.inventorySlots.inventorySlots).stream()
|
||||
.filter(
|
||||
s -> s != null && s.getStack() != null
|
||||
&& s.getStack().stackSize > 0
|
||||
&& s.isItemValid(s.getStack())
|
||||
&& s.canTakeStack(firstGui.mc.thePlayer))
|
||||
.map(s -> s.getStack().copy()).collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
for (PositionedStack stack : ingredients) {
|
||||
Optional<ItemStack> used = invStacks.stream().filter(is -> is.stackSize > 0 && stack.contains(is))
|
||||
.findFirst();
|
||||
|
||||
itemPresenceSlots.add(used.isPresent());
|
||||
|
||||
if (used.isPresent()) {
|
||||
ItemStack is = used.get();
|
||||
is.stackSize -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return itemPresenceSlots;
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.mitchej123.hodgepodge.config.TweaksConfig;
|
||||
|
||||
import codechicken.core.featurehack.GameDataManipulator;
|
||||
import codechicken.nei.InfiniteStackSizeHandler;
|
||||
@@ -64,6 +65,7 @@ import codechicken.nei.search.ModNameFilter;
|
||||
import codechicken.nei.search.OreDictionaryFilter;
|
||||
import codechicken.nei.search.TooltipFilter;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
@@ -211,7 +213,7 @@ public class ItemInfo {
|
||||
public String[] dump(Block block, int id, String name) {
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
return new String[] { name, Integer.toString(id), Boolean.toString(item != null),
|
||||
ItemInfo.itemOwners.get(block), block.getClass().getCanonicalName(),
|
||||
ItemInfo.itemOwners.get(item), block.getClass().getCanonicalName(),
|
||||
item != null ? EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.itemDisplayNameShort(new ItemStack(item))) : "null" };
|
||||
}
|
||||
@@ -458,8 +460,10 @@ public class ItemInfo {
|
||||
}
|
||||
|
||||
private static void addSpawnEggs() {
|
||||
addEntityEgg(EntitySnowman.class, 0xEEFFFF, 0xffa221);
|
||||
addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc);
|
||||
if (!Loader.isModLoaded("hodgepodge") || !TweaksConfig.addModEntityStats) {
|
||||
addEntityEgg(EntitySnowman.class, 0xEEFFFF, 0xffa221);
|
||||
addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -44,7 +44,7 @@ public abstract class ShortcutInputHandler {
|
||||
return ItemPanels.bookmarkPanel.pullBookmarkItems(ItemPanels.bookmarkPanel.getHoveredGroupId(true), true);
|
||||
}
|
||||
|
||||
if (stackover == null && NEIClientConfig.isKeyHashDown("gui.bookmark_recipe")) {
|
||||
if (stackover == null && NEIClientConfig.isKeyHashDown("gui.remove_recipe")) {
|
||||
final int groupId = ItemPanels.bookmarkPanel.getHoveredGroupId(true);
|
||||
|
||||
if (groupId != -1) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -25,25 +26,33 @@ public class GuiPresetList extends GuiOptionPane {
|
||||
protected final static int SLOT_HEIGHT = 24;
|
||||
protected final static int BUTTON_HEIGHT = 20;
|
||||
protected GuiCCButton createButton;
|
||||
protected GuiCCButton toggleButton;
|
||||
protected int sortingItemIndex = -1;
|
||||
|
||||
public GuiPresetList(Option opt) {
|
||||
this.opt = opt;
|
||||
this.createButton = new GuiCCButton(0, 2, 0, 16, NEIClientUtils.translate("presets.new"))
|
||||
.setActionCommand("create");
|
||||
this.toggleButton = new GuiCCButton(0, 2, 0, 16, NEIClientUtils.translate("presets.toggle"))
|
||||
.setActionCommand("toggle");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.createButton.width = getStringWidth(this.createButton.text) + 15;
|
||||
this.createButton.x = width - this.createButton.width - 15;
|
||||
|
||||
this.toggleButton.width = getStringWidth(this.toggleButton.text) + 15;
|
||||
this.toggleButton.x = width - this.toggleButton.width - 15 - this.createButton.width - 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
add(this.createButton);
|
||||
add(this.toggleButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,11 +62,14 @@ public class GuiPresetList extends GuiOptionPane {
|
||||
if (ident.equals("create")) {
|
||||
cretePreset();
|
||||
}
|
||||
|
||||
if (ident.equals("toggle")) {
|
||||
togglePreset();
|
||||
}
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,6 +150,16 @@ public class GuiPresetList extends GuiOptionPane {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiPresetSettings(this, -1));
|
||||
}
|
||||
|
||||
protected void togglePreset() {
|
||||
boolean enabled = !PresetsList.presets.stream().filter(g -> g.enabled).findAny().isPresent();
|
||||
|
||||
for (Preset preset : PresetsList.presets) {
|
||||
preset.enabled = enabled;
|
||||
}
|
||||
|
||||
PresetsList.savePresets();
|
||||
}
|
||||
|
||||
protected void openPreset(int slot) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiPresetSettings(this, slot));
|
||||
}
|
||||
@@ -186,13 +208,16 @@ public class GuiPresetList extends GuiOptionPane {
|
||||
|
||||
switch (preset.mode) {
|
||||
case HIDE:
|
||||
modeName = NEIClientUtils.translate("presets.mode.hide.char");
|
||||
modeName = EnumChatFormatting.GOLD + NEIClientUtils.translate("presets.mode.hide.char")
|
||||
+ EnumChatFormatting.RESET;
|
||||
break;
|
||||
case REMOVE:
|
||||
modeName = NEIClientUtils.translate("presets.mode.remove.char");
|
||||
modeName = EnumChatFormatting.RED + NEIClientUtils.translate("presets.mode.remove.char")
|
||||
+ EnumChatFormatting.RESET;
|
||||
break;
|
||||
case GROUP:
|
||||
modeName = NEIClientUtils.translate("presets.mode.group.char");
|
||||
modeName = EnumChatFormatting.AQUA + NEIClientUtils.translate("presets.mode.group.char")
|
||||
+ EnumChatFormatting.RESET;
|
||||
break;
|
||||
default:
|
||||
modeName = "?";
|
||||
@@ -215,7 +240,7 @@ public class GuiPresetList extends GuiOptionPane {
|
||||
LayoutManager.drawButtonBackground(option.x, option.y, option.w, option.h, true, optionState);
|
||||
GuiDraw.drawString("⋮⋮", option.x + 4, option.y + 5, optionState == 2 ? 0xFFFFFFA0 : 0xFFE0E0E0);
|
||||
GuiDraw.drawString(
|
||||
NEIClientUtils.cropText(this.fontRendererObj, modeName + ": " + displayName, option.w - 16),
|
||||
NEIClientUtils.cropText(this.fontRendererObj, modeName + " " + displayName, option.w - 16),
|
||||
option.x + 6 + 4,
|
||||
option.y + 6,
|
||||
optionState == 2 ? 0xFFFFFFA0 : 0xFFE0E0E0);
|
||||
|
||||
@@ -4,13 +4,16 @@ import static codechicken.lib.gui.GuiDraw.drawMultilineTip;
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static codechicken.lib.gui.GuiDraw.renderEngine;
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -23,6 +26,9 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -35,6 +41,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
@@ -42,6 +49,14 @@ import codechicken.nei.util.ReadableNumberConverter;
|
||||
|
||||
public class GuiContainerManager {
|
||||
|
||||
private static class ResourcePackReloaded implements IResourceManagerReloadListener {
|
||||
|
||||
@Override
|
||||
public void onResourceManagerReload(IResourceManager p_110549_1_) {
|
||||
renderingErrorItems.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public GuiContainer window;
|
||||
|
||||
public static RenderItem drawItems = new RenderItem();
|
||||
@@ -273,58 +288,64 @@ public class GuiContainerManager {
|
||||
|
||||
private static int modelviewDepth = -1;
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
private static final ItemStackSet renderingErrorItems = new ItemStackSet();
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer, boolean smallAmount,
|
||||
String stackSize) {
|
||||
enable3DRender();
|
||||
// for lighting correction
|
||||
boolean glRescale = GL11.glGetBoolean(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
float zLevel = drawItems.zLevel += 100F;
|
||||
float scale = smallAmount ? 0.5f : 1f;
|
||||
|
||||
try {
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, itemstack, i, j);
|
||||
if (!renderingErrorItems.contains(itemstack)) {
|
||||
float scale = smallAmount ? 0.5f : 1f;
|
||||
|
||||
if (stackSize == null) {
|
||||
if (itemstack.stackSize > 1) {
|
||||
stackSize = ReadableNumberConverter.INSTANCE.toWideReadableForm(itemstack.stackSize);
|
||||
try {
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, itemstack, i, j);
|
||||
|
||||
if (stackSize.length() == 3) {
|
||||
scale = 0.8f;
|
||||
} else if (stackSize.length() == 4) {
|
||||
scale = 0.6f;
|
||||
} else if (stackSize.length() > 4) {
|
||||
scale = 0.5f;
|
||||
if (stackSize == null) {
|
||||
if (itemstack.stackSize > 1) {
|
||||
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 = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (scale != 1f) {
|
||||
|
||||
if (!stackSize.isEmpty()) {
|
||||
drawBigStackSize(i, j, stackSize, scale);
|
||||
}
|
||||
|
||||
// stackSize = "". it needed for correct draw item with alpha and blend
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, i, j, "");
|
||||
} else {
|
||||
stackSize = "";
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, i, j, stackSize);
|
||||
}
|
||||
|
||||
if (!checkMatrixStack()) throw new IllegalStateException("Modelview matrix stack too deep");
|
||||
if (Tessellator.instance.isDrawing) throw new IllegalStateException("Still drawing");
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, itemstack);
|
||||
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), i, j);
|
||||
renderingErrorItems.add(itemstack);
|
||||
}
|
||||
|
||||
if (scale != 1f) {
|
||||
|
||||
if (!stackSize.isEmpty()) {
|
||||
drawBigStackSize(i, j, stackSize, scale);
|
||||
}
|
||||
|
||||
// stackSize = "". it needed for correct draw item with alpha and blend
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, i, j, "");
|
||||
} else {
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, i, j, stackSize);
|
||||
}
|
||||
|
||||
if (!checkMatrixStack()) throw new IllegalStateException("Modelview matrix stack too deep");
|
||||
if (Tessellator.instance.isDrawing) throw new IllegalStateException("Still drawing");
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, itemstack);
|
||||
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
} else {
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), i, j);
|
||||
}
|
||||
|
||||
@@ -354,6 +375,14 @@ public class GuiContainerManager {
|
||||
enable3DRender();
|
||||
}
|
||||
|
||||
public static void registerReloadResourceListener() {
|
||||
if (Minecraft.getMinecraft().getResourceManager() instanceof SimpleReloadableResourceManager) {
|
||||
SimpleReloadableResourceManager manager = (SimpleReloadableResourceManager) Minecraft.getMinecraft()
|
||||
.getResourceManager();
|
||||
manager.registerReloadListener(new ResourcePackReloaded());
|
||||
}
|
||||
}
|
||||
|
||||
public static void enableMatrixStackLogging() {
|
||||
modelviewDepth = GL11.glGetInteger(GL11.GL_MODELVIEW_STACK_DEPTH);
|
||||
}
|
||||
@@ -517,6 +546,7 @@ public class GuiContainerManager {
|
||||
|
||||
public void renderToolTips(int mousex, int mousey) {
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
Map<String, String> hotkeys = new HashMap<>();
|
||||
FontRenderer font = GuiDraw.fontRenderer;
|
||||
|
||||
synchronized (instanceTooltipHandlers) {
|
||||
@@ -540,6 +570,36 @@ public class GuiContainerManager {
|
||||
|
||||
if (tooltip.size() > 0) tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE); // add space after 'title'
|
||||
|
||||
synchronized (instanceTooltipHandlers) {
|
||||
for (IContainerTooltipHandler handler : instanceTooltipHandlers) {
|
||||
hotkeys = handler.handleHotkeys(window, mousex, mousey, hotkeys);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hotkeys.isEmpty()) {
|
||||
|
||||
if (!NEIClientUtils.altKey()) {
|
||||
tooltip.add(
|
||||
1,
|
||||
EnumChatFormatting.GRAY + translate(
|
||||
"showHotkeys",
|
||||
"" + EnumChatFormatting.GOLD + "ALT" + EnumChatFormatting.GRAY));
|
||||
} else {
|
||||
List<String> hotkeystips = new LinkedList<>();
|
||||
|
||||
for (String key : hotkeys.keySet()) {
|
||||
hotkeystips.add(getHotkeyTip(key, hotkeys.get(key)));
|
||||
}
|
||||
|
||||
hotkeystips.sort((a, b) -> Integer.compare(a.indexOf(" - "), b.indexOf(" - ")));
|
||||
hotkeystips.set(
|
||||
hotkeystips.size() - 1,
|
||||
hotkeystips.get(hotkeystips.size() - 1) + GuiDraw.TOOLTIP_LINESPACE);
|
||||
|
||||
tooltip.addAll(1, hotkeystips);
|
||||
}
|
||||
}
|
||||
|
||||
drawPagedTooltip(font, mousex + 12, mousey - 12, tooltip);
|
||||
|
||||
for (IContainerDrawHandler drawHandler : drawHandlers) {
|
||||
@@ -547,6 +607,10 @@ public class GuiContainerManager {
|
||||
}
|
||||
}
|
||||
|
||||
private String getHotkeyTip(String key, String message) {
|
||||
return EnumChatFormatting.GOLD + key + EnumChatFormatting.GRAY + " - " + message + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
private static int tooltipPage;
|
||||
|
||||
public static void drawPagedTooltip(FontRenderer font, int x, int y, List<String> list) {
|
||||
@@ -590,6 +654,7 @@ public class GuiContainerManager {
|
||||
}
|
||||
|
||||
public static boolean shouldShowTooltip(GuiContainer window) {
|
||||
if (window == null) return false;
|
||||
for (IContainerObjectHandler handler : objectHandlers) if (!handler.shouldShowTooltip(window)) return false;
|
||||
|
||||
return window.mc.thePlayer.inventory.getItemStack() == null;
|
||||
@@ -675,25 +740,30 @@ public class GuiContainerManager {
|
||||
boolean glRescale = GL11.glGetBoolean(GL12.GL_RESCALE_NORMAL);
|
||||
float zLevel = drawItems.zLevel += 100F;
|
||||
|
||||
try {
|
||||
if (window instanceof IGuiSlotDraw) {
|
||||
((IGuiSlotDraw) window).drawSlotItem(slot, stack, x, y, quantity);
|
||||
} else {
|
||||
if (!renderingErrorItems.contains(stack)) {
|
||||
try {
|
||||
if (window instanceof IGuiSlotDraw) {
|
||||
((IGuiSlotDraw) window).drawSlotItem(slot, stack, x, y, quantity);
|
||||
} else {
|
||||
|
||||
if (quantity == null) {
|
||||
quantity = stack != null && stack.stackSize > 1 ? String.valueOf(stack.stackSize) : "";
|
||||
if (quantity == null) {
|
||||
quantity = stack != null && stack.stackSize > 1 ? String.valueOf(stack.stackSize) : "";
|
||||
}
|
||||
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, stack, x, y);
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, stack, x, y, quantity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, stack);
|
||||
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, stack, x, y);
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, stack, x, y, quantity);
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), x, y);
|
||||
renderingErrorItems.add(stack);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, stack);
|
||||
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
} else {
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.guihook;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,7 +16,7 @@ public interface IContainerTooltipHandler {
|
||||
* Use this to add tooltips for other objects. If the current tip has lines in it after this call, the item tootip
|
||||
* will not be handled. GuiContainerManager.shouldShowTooltip is not enforced here. It is recommended that you make
|
||||
* this check yourself
|
||||
*
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
* @param mousex The x position of the mouse in pixels from left
|
||||
* @param mousey The y position of the mouse in pixels from top
|
||||
@@ -27,7 +28,7 @@ public interface IContainerTooltipHandler {
|
||||
/**
|
||||
* Use this for modifying the multiline display name of an item which may not necessarily be under the mouse.
|
||||
* GuiContainerManager.shouldShowTooltip is enforced here.
|
||||
*
|
||||
*
|
||||
* @param gui An instance of the currentscreen. If only general information about the item is wanted (Eg.
|
||||
* potion effects) then this may be null.
|
||||
* @param itemstack The ItemStack under the mouse
|
||||
@@ -39,7 +40,7 @@ public interface IContainerTooltipHandler {
|
||||
/**
|
||||
* Use this for modifying the tooltips of items that are under the mouse. GuiContainerManager.shouldShowTooltip is
|
||||
* enforced here.
|
||||
*
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
* @param itemstack The ItemStack under the mouse
|
||||
* @param currenttip A list of strings, representing each line of the current tooltip as modified by other handlers
|
||||
@@ -47,4 +48,16 @@ public interface IContainerTooltipHandler {
|
||||
*/
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip);
|
||||
|
||||
/**
|
||||
* Use this to specify a list of hotkeys that will work when hovering over an element that is under the mouse
|
||||
* pointer.
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
* @param mousex The x position of the mouse in pixels from left
|
||||
* @param mousey The y position of the mouse in pixels from top
|
||||
*/
|
||||
default Map<String, String> handleHotkeys(GuiContainer gui, int mousex, int mousey, Map<String, String> hotkeys) {
|
||||
return hotkeys;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
} else if ("recipeId".equals(outputId)) {
|
||||
recipeId = (BookmarkRecipeId) results[1];
|
||||
} else {
|
||||
recipeId = getCurrentRecipe(mc.currentScreen);
|
||||
recipeId = getCurrentRecipeId(mc.currentScreen);
|
||||
}
|
||||
|
||||
final ArrayList<ICraftingHandler> handlers = getCraftingHandlers(outputId, results);
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.BookmarkPanel.BookmarkRecipe;
|
||||
import codechicken.nei.GuiNEIButton;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.ItemsTooltipLineHandler;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
public class GuiOverlayButton extends GuiNEIButton {
|
||||
|
||||
public static class UpdateOverlayButtonsEvent extends GuiScreenEvent {
|
||||
|
||||
public List<GuiOverlayButton> buttonList;
|
||||
|
||||
public UpdateOverlayButtonsEvent(GuiRecipe<?> gui, List<GuiOverlayButton> buttonList) {
|
||||
super(gui);
|
||||
this.buttonList = new ArrayList<>(buttonList);
|
||||
}
|
||||
|
||||
@Cancelable
|
||||
public static class Pre extends UpdateOverlayButtonsEvent {
|
||||
|
||||
public int xOffset;
|
||||
public int yOffset;
|
||||
public int height;
|
||||
public HandlerInfo handlerInfo;
|
||||
|
||||
public Pre(GuiRecipe<?> gui, int xOffset, int yOffset, int height, HandlerInfo handlerInfo) {
|
||||
super(gui, new ArrayList<>());
|
||||
this.xOffset = xOffset;
|
||||
this.yOffset = yOffset;
|
||||
this.height = height;
|
||||
this.handlerInfo = handlerInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Post extends UpdateOverlayButtonsEvent {
|
||||
|
||||
public Post(GuiRecipe<?> gui, List<GuiOverlayButton> buttonList) {
|
||||
super(gui, buttonList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final static int OVERLAY_BUTTON_ID_START = 4;
|
||||
|
||||
public final GuiContainer firstGui;
|
||||
public final IRecipeHandler handler;
|
||||
public final int recipeIndex;
|
||||
|
||||
protected ItemsTooltipLineHandler missedMaterialsTooltipLineHandler;
|
||||
|
||||
protected final IOverlayHandler overlayHandler;
|
||||
protected final List<Boolean> itemPresenceCache = new ArrayList<>();
|
||||
protected boolean requireShiftForOverlayRecipe = true;
|
||||
protected boolean useOverlayRenderer = false;
|
||||
protected boolean hasOverlay = false;
|
||||
|
||||
public GuiOverlayButton(GuiContainer firstGui, IRecipeHandler handler, int recipeIndex, int x, int y, int width,
|
||||
int height) {
|
||||
super(OVERLAY_BUTTON_ID_START + recipeIndex, x, y, width, height, "+");
|
||||
this.firstGui = firstGui != null && firstGui.inventorySlots != null ? firstGui : null;
|
||||
this.handler = handler;
|
||||
this.recipeIndex = recipeIndex;
|
||||
this.hasOverlay = this.firstGui != null
|
||||
&& handler.hasOverlay(this.firstGui, this.firstGui.inventorySlots, recipeIndex);
|
||||
this.useOverlayRenderer = this.hasOverlay && handler.getOverlayRenderer(firstGui, recipeIndex) != null;
|
||||
this.overlayHandler = this.hasOverlay ? handler.getOverlayHandler(firstGui, recipeIndex) : null;
|
||||
|
||||
setRequireShiftForOverlayRecipe(NEIClientConfig.requireShiftForOverlayRecipe());
|
||||
ingredientsOverlay();
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip) {
|
||||
currenttip.add(translate("recipe.overlay"));
|
||||
|
||||
if (!this.enabled && this.requireShiftForOverlayRecipe && this.overlayHandler == null) {
|
||||
currenttip.set(currenttip.size() - 1, currenttip.get(currenttip.size() - 1) + GuiDraw.TOOLTIP_LINESPACE);
|
||||
currenttip.add(EnumChatFormatting.RED + translate("recipe.overlay.mismatch") + EnumChatFormatting.RESET);
|
||||
} else if (this.missedMaterialsTooltipLineHandler != null) {
|
||||
|
||||
if ((!this.requireShiftForOverlayRecipe || NEIClientUtils.shiftKey()) && this.overlayHandler != null) {
|
||||
this.missedMaterialsTooltipLineHandler.setLabelColor(EnumChatFormatting.RED);
|
||||
} else {
|
||||
this.missedMaterialsTooltipLineHandler.setLabelColor(EnumChatFormatting.GRAY);
|
||||
}
|
||||
|
||||
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(this.missedMaterialsTooltipLineHandler));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public Map<String, String> handleHotkeys(GuiContainer gui, int mousex, int mousey, Map<String, String> hotkeys) {
|
||||
|
||||
if (this.requireShiftForOverlayRecipe) {
|
||||
hotkeys.put(translate("recipe.overlay.fillCraftingGrid.key"), translate("recipe.overlay.fillCraftingGrid"));
|
||||
}
|
||||
|
||||
String keyName = NEIClientConfig.getKeyName(NEIClientConfig.getKeyBinding("gui.bookmark"), true);
|
||||
if (keyName != null) {
|
||||
hotkeys.put(keyName, translate("recipe.overlay.bookmark"));
|
||||
}
|
||||
|
||||
keyName = NEIClientConfig.getKeyName(NEIClientConfig.getKeyBinding("gui.bookmark_recipe"), true);
|
||||
if (keyName != null) {
|
||||
hotkeys.put(keyName, translate("recipe.overlay.bookmarkRecipe"));
|
||||
}
|
||||
|
||||
keyName = NEIClientConfig.getKeyName(NEIClientConfig.getKeyBinding("gui.bookmark_count"), true);
|
||||
if (keyName != null) {
|
||||
hotkeys.put(keyName, translate("recipe.overlay.bookmarkAmount"));
|
||||
}
|
||||
|
||||
keyName = NEIClientConfig.getKeyName(NEIClientConfig.getKeyBinding("gui.bookmark_recipe_count"), true);
|
||||
if (keyName != null) {
|
||||
hotkeys.put(keyName, translate("recipe.overlay.bookmarkRecipeAndAmount"));
|
||||
}
|
||||
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int mouseX, int mouseY) {
|
||||
if (this.firstGui != null) {
|
||||
this.firstGui.mc.displayGuiScreen(this.firstGui);
|
||||
overlayRecipe(NEIClientUtils.shiftKey());
|
||||
}
|
||||
}
|
||||
|
||||
public void drawItemPresenceOverlay() {
|
||||
final int presenceOverlay = NEIClientConfig.itemPresenceOverlay();
|
||||
final boolean highlightPresentItem = NEIClientConfig.isSlotHighlightPresent();
|
||||
final List<PositionedStack> ingredients = this.handler.getIngredientStacks(recipeIndex);
|
||||
final List<Boolean> itemPresenceCache = ingredientsOverlay();
|
||||
|
||||
for (int j = 0; j < ingredients.size(); j++) {
|
||||
PositionedStack stack = ingredients.get(j);
|
||||
Boolean isPresent = j < itemPresenceCache.size() ? itemPresenceCache.get(j) : null;
|
||||
|
||||
if (isPresent != null && (highlightPresentItem || !isPresent)) {
|
||||
LayoutManager.drawItemPresenceOverlay(stack.relx, stack.rely, isPresent, presenceOverlay == 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Boolean> ingredientsOverlay() {
|
||||
List<PositionedStack> ingredients = this.handler.getIngredientStacks(recipeIndex);
|
||||
|
||||
if (this.itemPresenceCache.size() != ingredients.size()) {
|
||||
this.itemPresenceCache.clear();
|
||||
|
||||
if (this.overlayHandler != null) {
|
||||
this.itemPresenceCache
|
||||
.addAll(this.overlayHandler.presenceOverlay(this.firstGui, this.handler, this.recipeIndex));
|
||||
} else if (this.firstGui != null) {
|
||||
this.itemPresenceCache.addAll(presenceOverlay(ingredients));
|
||||
}
|
||||
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < ingredients.size(); j++) {
|
||||
if (j >= this.itemPresenceCache.size() || !this.itemPresenceCache.get(j)) {
|
||||
items.add(ingredients.get(j).item);
|
||||
}
|
||||
}
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
this.missedMaterialsTooltipLineHandler = new ItemsTooltipLineHandler(
|
||||
translate("recipe.overlay.missing"),
|
||||
items,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
} else {
|
||||
this.missedMaterialsTooltipLineHandler = null;
|
||||
}
|
||||
}
|
||||
|
||||
return this.itemPresenceCache;
|
||||
}
|
||||
|
||||
public void setRequireShiftForOverlayRecipe(boolean require) {
|
||||
this.requireShiftForOverlayRecipe = require;
|
||||
this.enabled = this.hasOverlay && (this.requireShiftForOverlayRecipe || this.overlayHandler != null);
|
||||
}
|
||||
|
||||
public void setUseOverlayRenderer(boolean use) {
|
||||
this.useOverlayRenderer = use;
|
||||
}
|
||||
|
||||
public boolean useOverlayRenderer() {
|
||||
return this.useOverlayRenderer;
|
||||
}
|
||||
|
||||
public boolean canFillCraftingGrid() {
|
||||
return this.missedMaterialsTooltipLineHandler == null;
|
||||
}
|
||||
|
||||
public boolean hasOverlay() {
|
||||
return this.hasOverlay;
|
||||
}
|
||||
|
||||
private List<Boolean> presenceOverlay(List<PositionedStack> ingredients) {
|
||||
final List<Boolean> itemPresenceSlots = new ArrayList<>();
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<ItemStack> invStacks = ((List<Slot>) this.firstGui.inventorySlots.inventorySlots).stream()
|
||||
.filter(
|
||||
s -> s != null && s.getStack() != null
|
||||
&& s.getStack().stackSize > 0
|
||||
&& s.isItemValid(s.getStack())
|
||||
&& s.canTakeStack(this.firstGui.mc.thePlayer))
|
||||
.map(s -> s.getStack().copy()).collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
for (PositionedStack stack : ingredients) {
|
||||
Optional<ItemStack> used = invStacks.stream().filter(is -> is.stackSize > 0 && stack.contains(is))
|
||||
.findFirst();
|
||||
|
||||
itemPresenceSlots.add(used.isPresent());
|
||||
|
||||
if (used.isPresent()) {
|
||||
ItemStack is = used.get();
|
||||
is.stackSize -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return itemPresenceSlots;
|
||||
}
|
||||
|
||||
public void overlayRecipe(boolean shift) {
|
||||
if (!this.hasOverlay) return;
|
||||
|
||||
if (!this.useOverlayRenderer || !this.requireShiftForOverlayRecipe || shift) {
|
||||
if (this.overlayHandler != null) {
|
||||
this.overlayHandler.overlayRecipe(
|
||||
this.firstGui,
|
||||
this.handler,
|
||||
this.recipeIndex,
|
||||
!this.requireShiftForOverlayRecipe || shift);
|
||||
}
|
||||
} else {
|
||||
LayoutManager.overlayRenderer = this.handler.getOverlayRenderer(this.firstGui, this.recipeIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void lastKeyTyped(GuiRecipe<?> gui, char keyChar, int keyID) {
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark")) {
|
||||
saveRecipeInBookmark(false, false);
|
||||
} else if (NEIClientConfig.isKeyHashDown("gui.bookmark_recipe")) {
|
||||
saveRecipeInBookmark(true, false);
|
||||
} else if (NEIClientConfig.isKeyHashDown("gui.bookmark_count")) {
|
||||
saveRecipeInBookmark(false, true);
|
||||
} else if (NEIClientConfig.isKeyHashDown("gui.bookmark_recipe_count")) {
|
||||
saveRecipeInBookmark(true, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void saveRecipeInBookmark(boolean saveIngredients, boolean saveStackSize) {
|
||||
final HandlerInfo handlerInfo = GuiRecipeTab.getHandlerInfo(this.handler);
|
||||
final List<PositionedStack> ingredients = this.handler.getIngredientStacks(this.recipeIndex);
|
||||
final BookmarkRecipeId recipeId = new BookmarkRecipeId(handlerInfo.getHandlerName(), ingredients);
|
||||
|
||||
if (!ItemPanels.bookmarkPanel.removeBookmarkRecipeId(recipeId)) {
|
||||
BookmarkRecipe recipe = new BookmarkRecipe();
|
||||
recipe.handlerName = recipeId.handlerName;
|
||||
recipe.recipeId = recipeId;
|
||||
|
||||
if (saveIngredients) {
|
||||
for (PositionedStack stack : ingredients) {
|
||||
recipe.ingredients.add(stack.item);
|
||||
}
|
||||
}
|
||||
|
||||
PositionedStack result = this.handler.getResultStack(this.recipeIndex);
|
||||
|
||||
if (result != null) {
|
||||
recipe.result.add(result.item);
|
||||
} else {
|
||||
for (PositionedStack stack : this.handler.getOtherStacks(this.recipeIndex)) {
|
||||
recipe.result.add(stack.item);
|
||||
}
|
||||
}
|
||||
|
||||
ItemPanels.bookmarkPanel.addRecipe(recipe, saveStackSize);
|
||||
}
|
||||
}
|
||||
|
||||
public int getResultStackSize(ItemStack stackover) {
|
||||
final List<PositionedStack> stacks = this.handler.getOtherStacks(this.recipeIndex);
|
||||
int stackSize = stackover.stackSize;
|
||||
|
||||
for (PositionedStack pStack : stacks) {
|
||||
if (StackInfo.equalItemAndNBT(pStack.item, stackover, true)) {
|
||||
stackSize += pStack.item.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return stackSize;
|
||||
}
|
||||
|
||||
public Rectangle4i bounds() {
|
||||
return new Rectangle4i(this.xPosition, this.yPosition, this.width, this.height);
|
||||
}
|
||||
|
||||
public boolean contains(int mx, int my) {
|
||||
return bounds().contains(mx, my);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
@@ -9,7 +8,7 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -21,6 +20,8 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -28,6 +29,7 @@ import org.lwjgl.opengl.GL11;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.GuiNEIButton;
|
||||
import codechicken.nei.ItemsTooltipLineHandler;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEICPH;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
@@ -51,6 +53,7 @@ import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import codechicken.nei.guihook.IGuiClientSide;
|
||||
import codechicken.nei.guihook.IGuiHandleMouseWheel;
|
||||
import codechicken.nei.recipe.GuiOverlayButton.UpdateOverlayButtonsEvent;
|
||||
|
||||
public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer implements IGuiContainerOverlay,
|
||||
IGuiClientSide, IGuiHandleMouseWheel, IContainerTooltipHandler, INEIGuiHandler {
|
||||
@@ -72,6 +75,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
public static final List<IRecipeFilterProvider> recipeFilterers = new LinkedList<>();
|
||||
|
||||
protected boolean limitToOneRecipe = false;
|
||||
protected PermutationTooltipLineHandler permutationTooltipLineHandler;
|
||||
|
||||
// Background image
|
||||
final DrawableResource bgTop = new DrawableBuilder("nei:textures/gui/recipebg.png", 0, BG_TOP_Y, 176, BG_TOP_HEIGHT)
|
||||
@@ -103,8 +107,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
private GuiButton nexttype;
|
||||
private GuiButton prevtype;
|
||||
|
||||
private final int OVERLAY_BUTTON_ID_START = 4;
|
||||
private GuiButton[] overlayButtons;
|
||||
private GuiOverlayButton[] overlayButtons = new GuiOverlayButton[0];
|
||||
|
||||
private final Rectangle area = new Rectangle();
|
||||
private final GuiRecipeTabs recipeTabs;
|
||||
@@ -114,6 +117,29 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
private int yShift = 0;
|
||||
|
||||
protected static class PermutationTooltipLineHandler extends ItemsTooltipLineHandler {
|
||||
|
||||
protected PositionedStack pStack = null;
|
||||
|
||||
public PermutationTooltipLineHandler(PositionedStack pStack, List<ItemStack> items) {
|
||||
super(NEIClientUtils.translate("recipe.accepts"), items, false, 5);
|
||||
this.pStack = pStack;
|
||||
}
|
||||
|
||||
public static PermutationTooltipLineHandler getInstance(PositionedStack pStack) {
|
||||
final ItemFilter filter = TemplateRecipeHandler.getItemFilter();
|
||||
List<ItemStack> items = Arrays.asList(pStack.items).stream().filter(filter::matches)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
if (items.isEmpty()) {
|
||||
items = Arrays.asList(pStack.items);
|
||||
}
|
||||
|
||||
return new PermutationTooltipLineHandler(pStack, items);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ItemRecipeFilter implements IRecipeFilter {
|
||||
|
||||
public ItemFilter filter;
|
||||
@@ -384,7 +410,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
super.initGui();
|
||||
} else {
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.ySize = this.getHeightAsWidget();
|
||||
this.ySize = this.getWidgetSize().height;
|
||||
this.mc = NEIClientUtils.mc();
|
||||
this.fontRendererObj = mc.fontRenderer;
|
||||
ScaledResolution scaledresolution = new ScaledResolution(
|
||||
@@ -400,7 +426,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
if (handler == null) {
|
||||
setRecipePage(recipetype);
|
||||
} else {
|
||||
initOverlayButtons();
|
||||
updateOverlayButtons();
|
||||
}
|
||||
|
||||
checkYShift();
|
||||
@@ -408,15 +434,40 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
final int rightButtonX = guiLeft + xSize - borderPadding - buttonWidth;
|
||||
final int leftButtonX = guiLeft + borderPadding;
|
||||
|
||||
nexttype = new GuiNEIButton(0, leftButtonX, guiTop + 3, buttonWidth, buttonHeight, "<");
|
||||
prevtype = new GuiNEIButton(1, rightButtonX, guiTop + 3, buttonWidth, buttonHeight, ">");
|
||||
nexttype = new GuiNEIButton(0, leftButtonX, guiTop + 3, buttonWidth, buttonHeight, "<") {
|
||||
|
||||
nextpage = new GuiNEIButton(2, leftButtonX, guiTop + 17, buttonWidth, buttonHeight, "<");
|
||||
prevpage = new GuiNEIButton(3, rightButtonX, guiTop + 17, buttonWidth, buttonHeight, ">");
|
||||
@Override
|
||||
public void mouseReleased(int mouseX, int mouseY) {
|
||||
prevType();
|
||||
}
|
||||
};
|
||||
prevtype = new GuiNEIButton(1, rightButtonX, guiTop + 3, buttonWidth, buttonHeight, ">") {
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int mouseX, int mouseY) {
|
||||
nextType();
|
||||
}
|
||||
};
|
||||
|
||||
nextpage = new GuiNEIButton(2, leftButtonX, guiTop + 17, buttonWidth, buttonHeight, "<") {
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int mouseX, int mouseY) {
|
||||
prevPage();
|
||||
}
|
||||
};
|
||||
prevpage = new GuiNEIButton(3, rightButtonX, guiTop + 17, buttonWidth, buttonHeight, ">") {
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int mouseX, int mouseY) {
|
||||
nextPage();
|
||||
}
|
||||
};
|
||||
|
||||
toggleSearch.icon = new DrawableBuilder("nei:textures/nei_sprites.png", 0, 76, 10, 10).build();
|
||||
|
||||
buttonList.addAll(Arrays.asList(nexttype, prevtype, nextpage, prevpage));
|
||||
this.buttonList.addAll(Arrays.asList(nexttype, prevtype, nextpage, prevpage));
|
||||
this.overlayButtons = new GuiOverlayButton[0];
|
||||
|
||||
if (currenthandlers.size() == 1) {
|
||||
nexttype.visible = false;
|
||||
@@ -428,34 +479,71 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initOverlayButtons() {
|
||||
if (overlayButtons != null) {
|
||||
buttonList.removeIf(Arrays.asList(overlayButtons)::contains);
|
||||
private void updateOverlayButtons() {
|
||||
final List<Integer> indices = getRecipeIndices();
|
||||
|
||||
if (isDirtyOverlayButtons(indices)) {
|
||||
this.buttonList.removeIf(Arrays.asList(this.overlayButtons)::contains);
|
||||
|
||||
final int xOffset = (limitToOneRecipe ? 0 : guiLeft) + xSize - borderPadding;
|
||||
final int yOffset = (limitToOneRecipe ? -buttonHeight : guiTop - 18) + getRecipePosition(0).y;
|
||||
final int height = handlerInfo.getHeight() - yShift;
|
||||
final UpdateOverlayButtonsEvent.Pre preEvent = new UpdateOverlayButtonsEvent.Pre(
|
||||
this,
|
||||
xOffset,
|
||||
yOffset,
|
||||
height,
|
||||
handlerInfo);
|
||||
List<GuiOverlayButton> buttons = new ArrayList<>();
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(preEvent)) {
|
||||
buttons = preEvent.buttonList;
|
||||
} else {
|
||||
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
final int recipeIndex = indices.get(refIndex);
|
||||
|
||||
if (handler.original.getResultStack(recipeIndex) == null
|
||||
&& handler.original.getOtherStacks(recipeIndex).isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
buttons.add(
|
||||
new GuiOverlayButton(
|
||||
firstGui,
|
||||
handler.original,
|
||||
recipeIndex,
|
||||
xOffset - buttonWidth,
|
||||
yOffset + height * (refIndex + 1),
|
||||
buttonWidth,
|
||||
buttonHeight));
|
||||
}
|
||||
|
||||
if (this.equals(this.mc.currentScreen)) {
|
||||
UpdateOverlayButtonsEvent.Post postEvent = new UpdateOverlayButtonsEvent.Post(this, buttons);
|
||||
MinecraftForge.EVENT_BUS.post(postEvent);
|
||||
buttons = postEvent.buttonList;
|
||||
}
|
||||
}
|
||||
|
||||
this.overlayButtons = buttons.toArray(new GuiOverlayButton[buttons.size()]);
|
||||
this.buttonList.addAll(buttons);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDirtyOverlayButtons(List<Integer> indices) {
|
||||
|
||||
if (this.overlayButtons.length == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
overlayButtons = new GuiButton[recipesPerPage];
|
||||
final int xOffset = limitToOneRecipe ? ((xSize / 2) - 2) : (width / 2);
|
||||
final int yOffset = limitToOneRecipe ? 0 : guiTop - 18;
|
||||
final String overlayKeyName = NEIClientConfig
|
||||
.getKeyName(NEIClientConfig.getKeyBinding("gui.overlay_use"), true);
|
||||
for (int i = 0; i < recipesPerPage; i++) {
|
||||
overlayButtons[i] = new GuiNEIButton(
|
||||
OVERLAY_BUTTON_ID_START + i,
|
||||
xOffset + 65,
|
||||
yOffset + getRecipePosition(i).y + handlerInfo.getHeight(),
|
||||
buttonWidth,
|
||||
buttonHeight,
|
||||
"?");
|
||||
if (overlayKeyName != null && limitToOneRecipe) {
|
||||
overlayButtons[i].visible = true;
|
||||
overlayButtons[i].displayString = overlayKeyName;
|
||||
overlayButtons[i].width = fontRenderer.getStringWidth(overlayKeyName) + 6;
|
||||
overlayButtons[i].xPosition = xOffset + 85 - overlayButtons[i].width;
|
||||
for (GuiOverlayButton button : this.overlayButtons) {
|
||||
if (button.handler != handler.original || !indices.contains(button.recipeIndex)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Collections.addAll(buttonList, overlayButtons);
|
||||
itemPresenceCacheRecipe = -1;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IRecipeFilter getRecipeListFilter() {
|
||||
@@ -501,11 +589,10 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
changePage(0);
|
||||
recipeTabs.calcPageNumber();
|
||||
checkYShift();
|
||||
initOverlayButtons();
|
||||
}
|
||||
|
||||
public List<GuiButton> getOverlayButtons() {
|
||||
return Collections.unmodifiableList(Arrays.asList(overlayButtons));
|
||||
return Collections.unmodifiableList(Arrays.asList(this.overlayButtons));
|
||||
}
|
||||
|
||||
public int openTargetRecipe(BookmarkRecipeId recipeId) {
|
||||
@@ -649,6 +736,14 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Point mouse = GuiDraw.getMousePosition();
|
||||
|
||||
for (GuiOverlayButton button : this.overlayButtons) {
|
||||
if (button.contains(mouse.x, mouse.y)) {
|
||||
button.lastKeyTyped(this, c, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (i == mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
@@ -734,44 +829,9 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
super.actionPerformed(guibutton);
|
||||
switch (guibutton.id) {
|
||||
case 0:
|
||||
prevType();
|
||||
return;
|
||||
case 1:
|
||||
nextType();
|
||||
return;
|
||||
case 2:
|
||||
prevPage();
|
||||
return;
|
||||
case 3:
|
||||
nextPage();
|
||||
return;
|
||||
}
|
||||
|
||||
if (overlayButtons != null && guibutton.id >= OVERLAY_BUTTON_ID_START
|
||||
&& guibutton.id < OVERLAY_BUTTON_ID_START + overlayButtons.length) {
|
||||
final List<Integer> indices = getRecipeIndices();
|
||||
final int refIndex = guibutton.id - OVERLAY_BUTTON_ID_START;
|
||||
|
||||
if (refIndex >= 0 && refIndex < indices.size()) {
|
||||
mc.displayGuiScreen(firstGui);
|
||||
overlayRecipe(indices.get(refIndex), NEIClientUtils.shiftKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
updateAsTooltip();
|
||||
}
|
||||
|
||||
/** updateScreen() that's safe to call when this isn't the currently open GUI */
|
||||
public void updateAsTooltip() {
|
||||
handler.original.onUpdate();
|
||||
refreshPage();
|
||||
}
|
||||
@@ -783,6 +843,12 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
currenttip = handler.original.handleTooltip(this, currenttip, recipeIndex);
|
||||
}
|
||||
|
||||
for (GuiOverlayButton button : this.overlayButtons) {
|
||||
if (button.contains(mousex, mousey)) {
|
||||
currenttip = button.handleTooltip(this, currenttip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
recipeTabs.handleTooltip(mousex, mousey, currenttip);
|
||||
@@ -802,18 +868,67 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack stack, int mousex, int mousey,
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
currenttip = handler.original.handleItemTooltip(this, stack, currenttip, recipeIndex);
|
||||
List<Integer> indices = getRecipeIndices();
|
||||
|
||||
for (int recipeIndex : indices) {
|
||||
currenttip = handler.original.handleItemTooltip(this, itemstack, currenttip, recipeIndex);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.showCycledIngredientsTooltip()) {
|
||||
PositionedStack focused = null;
|
||||
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
final int recipeIndex = indices.get(refIndex);
|
||||
|
||||
if (itemstack != null && focused == null) {
|
||||
final List<PositionedStack> stacks = handler.original.getIngredientStacks(recipeIndex);
|
||||
|
||||
for (PositionedStack pStack : stacks) {
|
||||
if (isMouseOver(pStack, refIndex)) {
|
||||
focused = pStack;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (focused == null || focused.items.length <= 1) {
|
||||
this.permutationTooltipLineHandler = null;
|
||||
} else if (this.permutationTooltipLineHandler == null
|
||||
|| this.permutationTooltipLineHandler.pStack != focused) {
|
||||
this.permutationTooltipLineHandler = PermutationTooltipLineHandler.getInstance(focused);
|
||||
}
|
||||
} else if (this.permutationTooltipLineHandler != null) {
|
||||
this.permutationTooltipLineHandler = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.permutationTooltipLineHandler != null) {
|
||||
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(this.permutationTooltipLineHandler));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> handleHotkeys(GuiContainer gui, int mousex, int mousey, Map<String, String> hotkeys) {
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
for (GuiOverlayButton button : this.overlayButtons) {
|
||||
if (button.contains(mousex, mousey)) {
|
||||
hotkeys = button.handleHotkeys(gui, mousex, mousey, hotkeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hotkeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
|
||||
return currenttip;
|
||||
@@ -835,19 +950,20 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
setRecipePage(--recipetype);
|
||||
}
|
||||
|
||||
protected void overlayRecipe(int recipeIndex, final boolean shift) {
|
||||
protected void overlayRecipe(int recipeIndex, boolean shift) {
|
||||
|
||||
if (handler == null || !handler.original.hasOverlay(firstGui, firstGui.inventorySlots, recipeIndex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean moveItems = shift || !NEIClientConfig.requireShiftForOverlayRecipe();
|
||||
final IRecipeOverlayRenderer renderer = handler.original.getOverlayRenderer(firstGui, recipeIndex);
|
||||
final boolean requireShiftForOverlayRecipe = NEIClientConfig.requireShiftForOverlayRecipe();
|
||||
final IOverlayHandler overlayHandler = handler.original.getOverlayHandler(firstGui, recipeIndex);
|
||||
final IRecipeOverlayRenderer renderer = handler.original.getOverlayRenderer(firstGui, recipeIndex);
|
||||
|
||||
if (renderer == null || moveItems) {
|
||||
if (renderer == null || !requireShiftForOverlayRecipe || shift) {
|
||||
if (overlayHandler != null) {
|
||||
overlayHandler.overlayRecipe(firstGui, handler.original, recipeIndex, moveItems);
|
||||
overlayHandler
|
||||
.overlayRecipe(firstGui, handler.original, recipeIndex, !requireShiftForOverlayRecipe || shift);
|
||||
}
|
||||
} else {
|
||||
LayoutManager.overlayRenderer = renderer;
|
||||
@@ -865,7 +981,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
} else {
|
||||
this.page = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void refreshPage() {
|
||||
@@ -895,22 +1010,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
nextpage.enabled = prevpage.enabled = multiplepages;
|
||||
|
||||
if (firstGui == null) {
|
||||
for (GuiButton overlay : overlayButtons) {
|
||||
overlay.visible = false;
|
||||
}
|
||||
} else {
|
||||
final List<Integer> indices = getRecipeIndices();
|
||||
for (int i = 0; i < overlayButtons.length; i++) {
|
||||
if (i >= indices.size()) {
|
||||
overlayButtons[i].visible = false;
|
||||
} else {
|
||||
overlayButtons[i].visible = handler.original
|
||||
.hasOverlay(firstGui, firstGui.inventorySlots, indices.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateOverlayButtons();
|
||||
recipeTabs.refreshPage();
|
||||
}
|
||||
|
||||
@@ -952,39 +1052,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
}
|
||||
|
||||
private int itemPresenceCacheRecipe = -1;
|
||||
private ArrayList<Boolean> itemPresenceCacheSlots;
|
||||
|
||||
private void updateItemPresenceCache(int recipeIndex) {
|
||||
if (itemPresenceCacheSlots == null) {
|
||||
itemPresenceCacheSlots = new ArrayList<>();
|
||||
}
|
||||
itemPresenceCacheRecipe = recipeIndex;
|
||||
itemPresenceCacheSlots.clear();
|
||||
List<PositionedStack> ingredients = handler.original.getIngredientStacks(recipeIndex);
|
||||
ArrayList<ItemStack> invStacks = ((List<Slot>) firstGui.inventorySlots.inventorySlots).stream()
|
||||
.filter(
|
||||
s -> s != null && s.getStack() != null
|
||||
&& s.getStack().stackSize > 0
|
||||
&& s.isItemValid(s.getStack())
|
||||
&& s.canTakeStack(mc.thePlayer))
|
||||
.map(s -> s.getStack().copy()).collect(Collectors.toCollection(ArrayList::new));
|
||||
for (PositionedStack stack : ingredients) {
|
||||
Optional<ItemStack> used = invStacks.stream().filter(is -> is.stackSize > 0 && stack.contains(is))
|
||||
.findFirst();
|
||||
itemPresenceCacheSlots.add(used.isPresent());
|
||||
if (used.isPresent()) {
|
||||
ItemStack is = used.get();
|
||||
is.stackSize -= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
GuiContainerManager.enable2DRender();
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
final int ySkip = limitToOneRecipe ? BG_TOP_HEIGHT + 1 : 32;
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
String s = handler.original.getRecipeName().trim();
|
||||
@@ -1012,37 +1084,31 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
}
|
||||
|
||||
final int presenceOverlay = NEIClientConfig.itemPresenceOverlay();
|
||||
final boolean highlightPresentItem = NEIClientConfig.isSlotHighlightPresent();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(5, 32 - ySkip + yShift, 0);
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
List<Integer> indices = getRecipeIndices();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(5, ySkip + yShift, 0);
|
||||
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
int recipeIndex = indices.get(refIndex);
|
||||
|
||||
handler.original.drawForeground(recipeIndex);
|
||||
|
||||
if (presenceOverlay > 0 && firstGui != null
|
||||
&& firstGui.inventorySlots != null
|
||||
&& (isMouseOverOverlayButton(refIndex) || limitToOneRecipe)) {
|
||||
if (limitToOneRecipe) {
|
||||
GuiOverlayButton overlayButton = Arrays.asList(this.overlayButtons).stream()
|
||||
.filter(b -> b.recipeIndex == recipeIndex).findAny().orElse(null);
|
||||
|
||||
List<PositionedStack> ingredients = handler.original.getIngredientStacks(recipeIndex);
|
||||
if (overlayButton != null && overlayButton.enabled) {
|
||||
final String overlayKeyName = NEIClientConfig
|
||||
.getKeyName(NEIClientConfig.getKeyBinding("gui.overlay_use"), true);
|
||||
|
||||
if (itemPresenceCacheRecipe != recipeIndex || itemPresenceCacheSlots == null
|
||||
|| itemPresenceCacheSlots.size() != ingredients.size()) {
|
||||
updateItemPresenceCache(recipeIndex);
|
||||
}
|
||||
|
||||
for (int j = 0; j < ingredients.size(); j++) {
|
||||
PositionedStack stack = ingredients.get(j);
|
||||
boolean isPresent = itemPresenceCacheSlots.get(j);
|
||||
|
||||
if (highlightPresentItem || !isPresent) {
|
||||
LayoutManager
|
||||
.drawItemPresenceOverlay(stack.relx, stack.rely, isPresent, presenceOverlay == 2);
|
||||
if (overlayKeyName != null) {
|
||||
fontRendererObj.drawStringWithShadow(
|
||||
EnumChatFormatting.ITALIC + overlayKeyName,
|
||||
xSize - borderPadding - fontRendererObj.getStringWidth(overlayKeyName) - 10,
|
||||
handlerInfo.getHeight() - fontRendererObj.FONT_HEIGHT,
|
||||
0xffffff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1050,14 +1116,29 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
GL11.glTranslatef(0, handlerInfo.getHeight(), 0);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(5, ySkip + yShift, 0);
|
||||
|
||||
if (!limitToOneRecipe && NEIClientConfig.itemPresenceOverlay() > 0) {
|
||||
for (GuiOverlayButton button : this.overlayButtons) {
|
||||
if (button.contains(mouseX, mouseY)) {
|
||||
GL11.glTranslatef(0, handlerInfo.getHeight() * indices.indexOf(button.recipeIndex), 0);
|
||||
button.drawItemPresenceOverlay();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
final int ySkip = limitToOneRecipe ? BG_TOP_HEIGHT + 1 : 32;
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
drawBackgroundTiled(guiLeft, guiTop);
|
||||
@@ -1086,7 +1167,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(guiLeft + 5, guiTop - ySkip + 32 + yShift, 0);
|
||||
GL11.glTranslatef(guiLeft + 5, guiTop + ySkip + yShift, 0);
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
@@ -1099,13 +1180,13 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
private void drawBackgroundTiled(int j, int k) {
|
||||
final int handlerHeight = getWidgetSize().height;
|
||||
|
||||
// Draw the top
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
final int handlerHeight = limitToOneRecipe ? getHeightAsWidget() : ySize;
|
||||
bgTop.draw(j, k + BG_TOP_Y);
|
||||
|
||||
// Maybe Tile the middle
|
||||
final int tiledHeight = handlerHeight - ySkip - BG_TOP_HEIGHT - BG_BOTTOM_HEIGHT;
|
||||
final int tiledHeight = handlerHeight - BG_TOP_HEIGHT - BG_BOTTOM_HEIGHT;
|
||||
|
||||
if (tiledHeight > 0) {
|
||||
final int yTileCount = tiledHeight / BG_MIDDLE_HEIGHT;
|
||||
@@ -1122,11 +1203,18 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
// Draw the bottom
|
||||
bgBottom.draw(j, k + handlerHeight - ySkip - BG_BOTTOM_HEIGHT);
|
||||
bgBottom.draw(j, k + handlerHeight - BG_BOTTOM_HEIGHT);
|
||||
}
|
||||
|
||||
public int getHeightAsWidget() {
|
||||
return (handlerInfo == null) ? ySize : (handlerInfo.getHeight() + 56);
|
||||
public Dimension getWidgetSize() {
|
||||
|
||||
if (handlerInfo == null) {
|
||||
return new Dimension(xSize, ySize);
|
||||
}
|
||||
|
||||
final int handlerHeight = limitToOneRecipe ? handlerInfo.getHeight() + yShift + BG_TOP_HEIGHT + BG_BOTTOM_HEIGHT
|
||||
: ySize;
|
||||
return new Dimension(xSize, handlerHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1148,19 +1236,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
return stackSlot == mouseoverSlot;
|
||||
}
|
||||
|
||||
private boolean isMouseOverOverlayButton(int buttonId) {
|
||||
if (buttonId >= 0 && buttonId < overlayButtons.length) {
|
||||
GuiButton button = overlayButtons[buttonId];
|
||||
Point mousePos = GuiDraw.getMousePosition();
|
||||
return button.visible && mousePos.x >= button.xPosition
|
||||
&& mousePos.y >= button.yPosition
|
||||
&& mousePos.x < button.xPosition + button.width
|
||||
&& mousePos.y < button.yPosition + button.height;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private int getRecipesPerPage() {
|
||||
return limitToOneRecipe ? 1 : getRecipesPerPage(handlerInfo);
|
||||
}
|
||||
@@ -1223,7 +1298,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
return area.intersects(x, y, w, h);
|
||||
}
|
||||
|
||||
protected static BookmarkRecipeId getCurrentRecipe(GuiScreen gui) {
|
||||
protected static BookmarkRecipeId getCurrentRecipeId(GuiScreen gui) {
|
||||
|
||||
if (gui instanceof GuiRecipe && ((GuiRecipe<?>) gui).handler.numRecipes() > 0) {
|
||||
final GuiRecipe<?> gRecipe = (GuiRecipe<?>) gui;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
|
||||
if (!handlers.isEmpty()) {
|
||||
final Minecraft mc = NEIClientUtils.mc();
|
||||
final BookmarkRecipeId recipeId = getCurrentRecipe(mc.currentScreen);
|
||||
final BookmarkRecipeId recipeId = getCurrentRecipeId(mc.currentScreen);
|
||||
final GuiUsageRecipe gui = new GuiUsageRecipe(handlers);
|
||||
|
||||
mc.displayGuiScreen(gui);
|
||||
|
||||
@@ -430,7 +430,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
|
||||
}
|
||||
|
||||
protected static ItemFilter getItemFilter() {
|
||||
public static ItemFilter getItemFilter() {
|
||||
return new AllMultiItemFilter(
|
||||
item -> !ItemInfo.hiddenItems.contains(item),
|
||||
PresetsList.getItemFilter(),
|
||||
@@ -767,20 +767,31 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
private void shiftPermutationToRender(PositionedStack pStack, ItemStack stack, int scroll, ItemFilter filter) {
|
||||
if (!pStack.containsWithNBT(stack)) return;
|
||||
|
||||
for (int index = 0; index < pStack.items.length; index++) {
|
||||
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(pStack.items[index], stack)) {
|
||||
ArrayList<Integer> filtered = getFilteredIngredientAlternatives(pStack, filter);
|
||||
final List<Integer> filtered = getFilteredIngredientAlternatives(pStack, filter);
|
||||
int index = 0;
|
||||
|
||||
if (filtered.isEmpty()) {
|
||||
pStack.setPermutationToRender((int) ((pStack.items.length + scroll + index) % pStack.items.length));
|
||||
} else {
|
||||
pStack.setPermutationToRender(
|
||||
filtered.get((int) ((filtered.size() + scroll + index) % filtered.size())));
|
||||
if (filtered.isEmpty()) {
|
||||
|
||||
for (int i = 0; i < pStack.items.length; i++) {
|
||||
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(pStack.items[i], stack)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
pStack.setPermutationToRender((int) ((pStack.items.length - scroll + index) % pStack.items.length));
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < filtered.size(); i++) {
|
||||
if (NEIServerUtils.areStacksSameTypeCraftingWithNBT(pStack.items[filtered.get(i)], stack)) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
pStack.setPermutationToRender(filtered.get((int) ((filtered.size() - scroll + index) % filtered.size())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -88,9 +88,9 @@ nei.options.inventory.widgetsenabled.false=NEI zakázáno
|
||||
nei.options.inventory.cheatmode.0=Mód receptů
|
||||
nei.options.inventory.cheatmode.1=Užitný mód
|
||||
nei.options.inventory.cheatmode.2=Cheatovací mód
|
||||
nei.options.inventory.profileRecipes=Profilové recepty
|
||||
nei.options.inventory.profileRecipes.true=Povoleny
|
||||
nei.options.inventory.profileRecipes.false=Nepovoleny
|
||||
nei.options.inventory.guirecipe.profile=Profilové recepty
|
||||
nei.options.inventory.guirecipe.profile.true=Povoleny
|
||||
nei.options.inventory.guirecipe.profile.false=Nepovoleny
|
||||
nei.options.inventory.itemsort=Řazení panelu předmětů
|
||||
nei.options.inventory.itemIDs=IDčka předmětů
|
||||
nei.options.inventory.itemIDs.0=Skryté
|
||||
|
||||
@@ -92,9 +92,9 @@ nei.options.inventory.widgetsenabled.false=NEI Deaktiviert
|
||||
nei.options.inventory.cheatmode.0=Rezeptmodus
|
||||
nei.options.inventory.cheatmode.1=Mehrzweckmodus
|
||||
nei.options.inventory.cheatmode.2=Cheat-Modus
|
||||
nei.options.inventory.profileRecipes=Profil-Rezepte
|
||||
nei.options.inventory.profileRecipes.true=Wahr
|
||||
nei.options.inventory.profileRecipes.false=Falsch
|
||||
nei.options.inventory.guirecipe.profile=Profil-Rezepte
|
||||
nei.options.inventory.guirecipe.profile.true=Wahr
|
||||
nei.options.inventory.guirecipe.profile.false=Falsch
|
||||
nei.options.inventory.itemsort=Item-Panel-Sortierung
|
||||
nei.options.inventory.itemIDs=Item-IDs
|
||||
nei.options.inventory.itemIDs.0=Versteckt
|
||||
|
||||
@@ -5,15 +5,35 @@ nei.save=Save
|
||||
nei.key.ctrl=CTRL
|
||||
# Mac Command Key
|
||||
nei.key.ctrl.mac=CMD
|
||||
nei.showHotkeys=Hold %s for hotkeys
|
||||
|
||||
nei.bookmark.toggle=Bookmarks
|
||||
nei.bookmark.toggle.tip=Toggle visibility of the Bookmark Panel
|
||||
nei.bookmark.viewmode.toggle.tip=Toggle Bookmark View Mode
|
||||
nei.bookmark.pullBookmarkedItems.tip=Pull all bookmarked items from storage to inventory
|
||||
|
||||
nei.bookmark.group=Bookmarks Group
|
||||
nei.bookmark.group.include_group=Create/Include Group
|
||||
nei.bookmark.group.include_group.key=LMB + Drag
|
||||
nei.bookmark.group.exclude_group=Remove/Exclude Group
|
||||
nei.bookmark.group.exclude_group.key=RMB + Drag
|
||||
nei.bookmark.group.toggle_mode=Toggle Group Mode
|
||||
nei.bookmark.group.toggle_mode.key=Left Click
|
||||
nei.bookmark.group.toggle_crafting_chain=Toggle Crafting Chain
|
||||
nei.bookmark.group.toggle_crafting_chain.key=Right Click
|
||||
nei.bookmark.group.sorting=Sorting
|
||||
nei.bookmark.group.sorting.key=SHIFT + LMB + Drag
|
||||
nei.bookmark.group.remove_recipe=Remove Group
|
||||
nei.bookmark.group.pull_items=Pull all Items
|
||||
nei.bookmark.group.pull_items_ingredients=Pull all Ingredients
|
||||
nei.bookmark.crafting_chain=Crafting Chain
|
||||
nei.bookmark.crafting_chain.input=Ingredients
|
||||
nei.bookmark.crafting_chain.output=Results
|
||||
nei.bookmark.crafting_chain.remainder=Remainders
|
||||
|
||||
nei.itempanel.quantity.default=One stack
|
||||
nei.itempanel.loading=Loading Item List...
|
||||
nei.itempanel.collapsed.button.tip=Toggle Groups
|
||||
nei.itempanel.deleteItem=Delete Item
|
||||
nei.itempanel.collapsed.button.tip=Collapse/Expand All Collapsible Items
|
||||
nei.itempanel.collapsed.hint.expand=Alt-Click to expand (%d items)
|
||||
nei.itempanel.collapsed.hint.collapse=Alt-Click to collapse (%d items)
|
||||
|
||||
@@ -113,6 +133,7 @@ nei.options.keys.gui.next_machine=Next Machine
|
||||
nei.options.keys.gui.prev_machine=Prev Machine
|
||||
nei.options.keys.gui.search=Focus Search Bar
|
||||
nei.options.keys.gui.bookmark=Add Bookmark
|
||||
nei.options.keys.gui.remove_recipe=Remove Group from Bookmarks
|
||||
nei.options.keys.gui.bookmark_recipe=Add Bookmark with Recipe
|
||||
nei.options.keys.gui.bookmark_count=Add Bookmark with Count
|
||||
nei.options.keys.gui.bookmark_pull_items=Pull all Bookmarked Items
|
||||
@@ -127,6 +148,10 @@ 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.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
|
||||
nei.options.keys.gui.itemzoom_zoom_in=Item Zoom In
|
||||
nei.options.keys.gui.itemzoom_zoom_out=Item Zoom Out
|
||||
nei.options.keys.world=World
|
||||
nei.options.keys.world.chunkoverlay=Chunk Boundary Overlay
|
||||
nei.options.keys.world.moboverlay=Mob Spawn Overlay
|
||||
@@ -141,42 +166,50 @@ nei.options.keys.world.creative=Gamemode
|
||||
nei.options.keys.world.creative.tip=Cycle Gamemode
|
||||
|
||||
nei.options.inventory=Inventory
|
||||
nei.options.inventory.worldSpecificBookmarks=World Specific Bookmarks
|
||||
nei.options.inventory.worldSpecificBookmarks.true=Yes
|
||||
nei.options.inventory.worldSpecificBookmarks.false=No
|
||||
nei.options.inventory.bookmarks=Bookmarks Panel
|
||||
nei.options.inventory.bookmarks.enabled=Bookmarks Panel Visibility
|
||||
nei.options.inventory.bookmarks.enabled.true=Visible
|
||||
nei.options.inventory.bookmarks.enabled.false=Hidden
|
||||
nei.options.inventory.bookmarks.animation=REI Style Animation in Bookmarks
|
||||
nei.options.inventory.bookmarks.animation.true=Yes
|
||||
nei.options.inventory.bookmarks.animation.false=No
|
||||
nei.options.inventory.bookmarks.craftingChainDir=Crafting Chain Info Direction
|
||||
nei.options.inventory.bookmarks.craftingChainDir.0=Input First
|
||||
nei.options.inventory.bookmarks.craftingChainDir.1=Output First
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode=Show recipe tooltips in Bookmarks
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.0=None
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.1=In Horizontal View
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.2=In Vertical View
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.3=Always
|
||||
nei.options.inventory.bookmarks.showRecipeMarker=Show Recipe Marker
|
||||
nei.options.inventory.bookmarks.showRecipeMarker.true=Yes
|
||||
nei.options.inventory.bookmarks.showRecipeMarker.false=No
|
||||
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 Bookmarks
|
||||
nei.options.inventory.bookmarks.worldSpecific.true=Yes
|
||||
nei.options.inventory.bookmarks.worldSpecific.false=No
|
||||
nei.options.inventory.worldSpecificPresets=World Specific Presets
|
||||
nei.options.inventory.worldSpecificPresets.true=Yes
|
||||
nei.options.inventory.worldSpecificPresets.false=No
|
||||
nei.options.inventory.bookmarksEnabled=Bookmarks Panel Visibility
|
||||
nei.options.inventory.bookmarksEnabled.true=Visible
|
||||
nei.options.inventory.bookmarksEnabled.false=Hidden
|
||||
nei.options.inventory.jei_style_tabs=JEI Style Tabs
|
||||
nei.options.inventory.jei_style_tabs.true=Yes
|
||||
nei.options.inventory.jei_style_tabs.false=No [Weirdo]
|
||||
nei.options.inventory.itemPresenceOverlay=Item Overlay on ?-Hover
|
||||
nei.options.inventory.itemPresenceOverlay.0=None
|
||||
nei.options.inventory.itemPresenceOverlay.1=Icon
|
||||
nei.options.inventory.itemPresenceOverlay.2=Background
|
||||
nei.options.inventory.slotHighlightPresent=Highlight Present Item
|
||||
nei.options.inventory.slotHighlightPresent.true=Yes
|
||||
nei.options.inventory.slotHighlightPresent.false=No
|
||||
nei.options.inventory.jei_style_recipe_catalyst=JEI Style Recipe Catalysts
|
||||
nei.options.inventory.jei_style_recipe_catalyst.true=Yes
|
||||
nei.options.inventory.jei_style_recipe_catalyst.false=No
|
||||
nei.options.inventory.saveCurrentRecipeInBookmarksEnabled=Save Current Recipe in Bookmarks
|
||||
nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.true=Enabled
|
||||
nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.false=Disabled
|
||||
nei.options.inventory.recipeTooltipsMode=Show recipe tooltips in Bookmarks
|
||||
nei.options.inventory.recipeTooltipsMode.0=None
|
||||
nei.options.inventory.recipeTooltipsMode.1=In Horizontal View
|
||||
nei.options.inventory.recipeTooltipsMode.2=In Vertical View
|
||||
nei.options.inventory.recipeTooltipsMode.3=Always
|
||||
nei.options.inventory.bookmarksAnimationEnabled=REI Style Animation in Bookmarks
|
||||
nei.options.inventory.bookmarksAnimationEnabled.true=Yes
|
||||
nei.options.inventory.bookmarksAnimationEnabled.false=No
|
||||
nei.options.inventory.showRecipeMarker=Show Recipe Marker
|
||||
nei.options.inventory.showRecipeMarker.true=Yes
|
||||
nei.options.inventory.showRecipeMarker.false=No
|
||||
nei.options.inventory.guirecipe=Recipes GUI
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs=JEI Style Tabs
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.true=Yes
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.false=No [Weirdo]
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay=Item Overlay on ?-Hover
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay.0=None
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay.1=Icon
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay.2=Background
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent=Highlight Present Item
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent.true=Yes
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent.false=No
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst=JEI Style Recipe Catalysts
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.true=Yes
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.false=No
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip=Cycled Ingredients Tooltip
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.true=Show
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.false=Nide
|
||||
nei.options.inventory.showItemQuantityWidget=Show Item Quantity Widget
|
||||
nei.options.inventory.showItemQuantityWidget.true=Yes
|
||||
nei.options.inventory.showItemQuantityWidget.false=No
|
||||
@@ -185,8 +218,9 @@ nei.options.inventory.search.widgetPosition=Widget Position
|
||||
nei.options.inventory.search.widgetPosition.true=Center
|
||||
nei.options.inventory.search.widgetPosition.false=Right
|
||||
nei.options.inventory.search.widgetAutofocus=Autofocus
|
||||
nei.options.inventory.search.widgetAutofocus.true=Yes
|
||||
nei.options.inventory.search.widgetAutofocus.false=No
|
||||
nei.options.inventory.search.widgetAutofocus.0=No
|
||||
nei.options.inventory.search.widgetAutofocus.1=Yes
|
||||
nei.options.inventory.search.widgetAutofocus.2=Extended
|
||||
nei.options.inventory.search.patternMode=Search Mode
|
||||
nei.options.inventory.search.patternMode.0=Plain
|
||||
nei.options.inventory.search.patternMode.1=Extended
|
||||
@@ -214,32 +248,26 @@ nei.options.inventory.search.subsetsSearchMode=Item Subsets Search
|
||||
nei.options.inventory.search.subsetsSearchMode.0=Always
|
||||
nei.options.inventory.search.subsetsSearchMode.1=Prefix: %s
|
||||
nei.options.inventory.search.subsetsSearchMode.2=Never
|
||||
nei.options.inventory.firstInvCloseClosesInSearch=First Inventory Close Closes in Search
|
||||
nei.options.inventory.firstInvCloseClosesInSearch.true=Yes
|
||||
nei.options.inventory.firstInvCloseClosesInSearch.false=No
|
||||
nei.options.inventory.creative_tab_style=Creative or JEI tab style
|
||||
nei.options.inventory.creative_tab_style.true=Creative
|
||||
nei.options.inventory.creative_tab_style.false=JEI
|
||||
nei.options.inventory.ignore_potion_overlap=Ignore overlap with potion effect HUD
|
||||
nei.options.inventory.ignore_potion_overlap.true=Yes
|
||||
nei.options.inventory.ignore_potion_overlap.false=No
|
||||
nei.options.inventory.guirecipe.creativeTabStyle=Creative or JEI tab style
|
||||
nei.options.inventory.guirecipe.creativeTabStyle.true=Creative
|
||||
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.jei_style_cycled_ingredients=JEI styled cycled ingredients
|
||||
nei.options.inventory.jei_style_cycled_ingredients.true=Yes
|
||||
nei.options.inventory.jei_style_cycled_ingredients.false=No
|
||||
nei.options.inventory.shift_overlay_recipe=Require holding shift to move items when overlaying recipe
|
||||
nei.options.inventory.shift_overlay_recipe.true=Yes
|
||||
nei.options.inventory.shift_overlay_recipe.false=No
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients=JEI styled cycled ingredients
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.true=Yes
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.false=No
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe=Require holding shift to move items when overlaying recipe
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.true=Yes
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.false=No
|
||||
nei.options.inventory.widgetsenabled.true=NEI Enabled
|
||||
nei.options.inventory.widgetsenabled.false=NEI Disabled
|
||||
nei.options.inventory.cheatmode.0=Recipe Mode
|
||||
nei.options.inventory.cheatmode.1=Utility Mode
|
||||
nei.options.inventory.cheatmode.2=Cheat Mode
|
||||
nei.options.inventory.profileRecipes=Profile Recipes
|
||||
nei.options.inventory.profileRecipes.true=True
|
||||
nei.options.inventory.profileRecipes.false=False
|
||||
nei.options.inventory.guirecipe.profile=Profile Recipes
|
||||
nei.options.inventory.guirecipe.profile.true=True
|
||||
nei.options.inventory.guirecipe.profile.false=False
|
||||
nei.options.inventory.itemsort=Item Panel Sorting
|
||||
nei.options.inventory.itemIDs=Item IDs
|
||||
nei.options.inventory.itemIDs.0=Hidden
|
||||
@@ -274,6 +302,9 @@ nei.options.inventory.collapsibleItems=Collapsible Items
|
||||
nei.options.inventory.collapsibleItems.enabled=Collapsible Items
|
||||
nei.options.inventory.collapsibleItems.enabled.true=Enabled
|
||||
nei.options.inventory.collapsibleItems.enabled.false=Disabled
|
||||
nei.options.inventory.collapsibleItems.customName=Show Custom Group Name
|
||||
nei.options.inventory.collapsibleItems.customName.true=Yes
|
||||
nei.options.inventory.collapsibleItems.customName.false=No
|
||||
nei.options.inventory.collapsibleItems.expandedColor=Expanded Color
|
||||
nei.options.inventory.collapsibleItems.collapsedColor=Collapsed Color
|
||||
nei.options.inventory.collapsibleItems.reloadLabel=Reload
|
||||
@@ -287,6 +318,27 @@ nei.options.inventory.history.useRows=Rows
|
||||
nei.options.inventory.history.splittingMode=Splitting Mode
|
||||
nei.options.inventory.history.splittingMode.0=Background
|
||||
nei.options.inventory.history.splittingMode.1=Dotted Line
|
||||
nei.options.inventory.itemzoom=Item Zoom Panel
|
||||
nei.options.inventory.itemzoom.enabled=Item Zoom Panel Visibility
|
||||
nei.options.inventory.itemzoom.enabled.true=Enabled
|
||||
nei.options.inventory.itemzoom.enabled.false=Disabled
|
||||
nei.options.inventory.itemzoom.neiOnly=NEI Overlays Only
|
||||
nei.options.inventory.itemzoom.neiOnly.true=Enabled
|
||||
nei.options.inventory.itemzoom.neiOnly.false=Disabled
|
||||
nei.options.inventory.itemzoom.neiOnly.tip=Zoom items only from the JEI ingredient and bookmark list overlays.
|
||||
nei.options.inventory.itemzoom.onlySolid=Show Only Solid Items
|
||||
nei.options.inventory.itemzoom.onlySolid.true=Enabled
|
||||
nei.options.inventory.itemzoom.onlySolid.false=Disabled
|
||||
nei.options.inventory.itemzoom.helpText=Display Help Text
|
||||
nei.options.inventory.itemzoom.helpText.true=Enabled
|
||||
nei.options.inventory.itemzoom.helpText.false=Disabled
|
||||
nei.options.inventory.itemzoom.helpText.tip=Display name "Item Zoom" and the hotkey to toggle this mod below the zoomed item.
|
||||
nei.options.inventory.itemzoom.zoom=Zoom Amount
|
||||
nei.options.inventory.itemzoom.zoom.tip=Set lower amount to make the item zoom less.
|
||||
nei.options.inventory.itemzoom.showName=Display Name
|
||||
nei.options.inventory.itemzoom.showName.true=Show
|
||||
nei.options.inventory.itemzoom.showName.false=Hide
|
||||
nei.options.inventory.itemzoom.nameColor=Display Name Color
|
||||
|
||||
nei.options.command=Commands
|
||||
nei.options.command.creative=Gamemode
|
||||
@@ -366,6 +418,17 @@ nei.recipe.profiler.crafting=Crafting Profiling
|
||||
nei.recipe.profiler.usage=Usage Profiling
|
||||
nei.recipe.concurrent.usage=Concurrent Usage - Total
|
||||
nei.recipe.concurrent.crafting=Concurrent Crafting - Total
|
||||
nei.recipe.accepts=Accepts following
|
||||
|
||||
nei.recipe.overlay=Recipe Overlay
|
||||
nei.recipe.overlay.missing=Missing following
|
||||
nei.recipe.overlay.mismatch=Mismatch Crafting Grid
|
||||
nei.recipe.overlay.fillCraftingGrid=Fill Crafting Grid
|
||||
nei.recipe.overlay.fillCraftingGrid.key=SHIFT + Click
|
||||
nei.recipe.overlay.bookmark=Save to Bookmark
|
||||
nei.recipe.overlay.bookmarkRecipe=Save with Recipe
|
||||
nei.recipe.overlay.bookmarkAmount=Save with Amount
|
||||
nei.recipe.overlay.bookmarkRecipeAndAmount=Save with Recipe & Amount
|
||||
|
||||
nei.itemsort.minecraft=Minecraft
|
||||
nei.itemsort.minecraft.tip=Sorts items from vanilla minecraft first
|
||||
@@ -405,6 +468,7 @@ nei.subsets.Items.Weapons.Swords=Swords
|
||||
nei.subsets.Mod=Mod
|
||||
|
||||
nei.presets.new=New Preset
|
||||
nei.presets.toggle=Toggle Presets
|
||||
nei.presets.create=Create Preset
|
||||
nei.presets.update=Update Preset
|
||||
nei.presets.enabled=Enabled
|
||||
@@ -421,3 +485,5 @@ nei.presets.mode.remove.char=R
|
||||
nei.presets.mode.group=Group
|
||||
nei.presets.mode.group.tip=Create custom collapsible items group
|
||||
nei.presets.mode.group.char=G
|
||||
|
||||
nei.itemzoom.toggle=Use %s to toggle Item Zoom
|
||||
@@ -91,9 +91,9 @@ nei.options.inventory.widgetsenabled.false=NEI keelatud
|
||||
nei.options.inventory.cheatmode.0=Retsepti mood
|
||||
nei.options.inventory.cheatmode.1=Utiliidi mood
|
||||
nei.options.inventory.cheatmode.2=Petmis mood
|
||||
nei.options.inventory.profileRecipes=Profileeri retsepte
|
||||
nei.options.inventory.profileRecipes.true=Tõene
|
||||
nei.options.inventory.profileRecipes.false=Väär
|
||||
nei.options.inventory.guirecipe.profile=Profileeri retsepte
|
||||
nei.options.inventory.guirecipe.profile.true=Tõene
|
||||
nei.options.inventory.guirecipe.profile.false=Väär
|
||||
nei.options.inventory.itemsort=Item Panel Sorting
|
||||
nei.options.inventory.itemIDs=Asja ID-d
|
||||
nei.options.inventory.itemIDs.0=Peidetud
|
||||
|
||||
@@ -89,9 +89,9 @@ nei.options.inventory.widgetsenabled.false=NEI désactivé
|
||||
nei.options.inventory.cheatmode.0=Mode recette
|
||||
nei.options.inventory.cheatmode.1=Mode utilitaire
|
||||
nei.options.inventory.cheatmode.2=Mode triche
|
||||
nei.options.inventory.profileRecipes=Profil Recettes
|
||||
nei.options.inventory.profileRecipes.true=Vrai
|
||||
nei.options.inventory.profileRecipes.false=Faux
|
||||
nei.options.inventory.guirecipe.profile=Profil Recettes
|
||||
nei.options.inventory.guirecipe.profile.true=Vrai
|
||||
nei.options.inventory.guirecipe.profile.false=Faux
|
||||
nei.options.inventory.itemsort=Tri du panneau d'élément
|
||||
nei.options.inventory.itemIDs=Objet IDs
|
||||
nei.options.inventory.itemIDs.0=Cachés
|
||||
|
||||
@@ -92,9 +92,9 @@ nei.options.inventory.widgetsenabled.false=NEI Disattivato
|
||||
nei.options.inventory.cheatmode.0=Modalità ricette
|
||||
nei.options.inventory.cheatmode.1=Modalità utilità
|
||||
nei.options.inventory.cheatmode.2=Modalità cheat
|
||||
nei.options.inventory.profileRecipes=Ricerca profilo
|
||||
nei.options.inventory.profileRecipes.true=Vero
|
||||
nei.options.inventory.profileRecipes.false=Falso
|
||||
nei.options.inventory.guirecipe.profile=Ricerca profilo
|
||||
nei.options.inventory.guirecipe.profile.true=Vero
|
||||
nei.options.inventory.guirecipe.profile.false=Falso
|
||||
nei.options.inventory.itemsort=Pannello ordine degli oggetti
|
||||
nei.options.inventory.itemIDs=ID degli oggetti
|
||||
nei.options.inventory.itemIDs.0=Nascosti
|
||||
|
||||
@@ -87,9 +87,9 @@ nei.options.inventory.widgetsenabled.false=NEI 비활성화
|
||||
nei.options.inventory.cheatmode.0=레시피모드
|
||||
nei.options.inventory.cheatmode.1=유틸리티모드
|
||||
nei.options.inventory.cheatmode.2=치트모드
|
||||
nei.options.inventory.profileRecipes=프로파일 레시피
|
||||
nei.options.inventory.profileRecipes.true=설정
|
||||
nei.options.inventory.profileRecipes.false=비설정
|
||||
nei.options.inventory.guirecipe.profile=프로파일 레시피
|
||||
nei.options.inventory.guirecipe.profile.true=설정
|
||||
nei.options.inventory.guirecipe.profile.false=비설정
|
||||
nei.options.inventory.itemsort=아이템 정렬
|
||||
nei.options.inventory.itemIDs=아이템 ID
|
||||
nei.options.inventory.itemIDs.0= 숨기기
|
||||
|
||||
@@ -89,9 +89,9 @@ nei.options.inventory.cheatmode.0=Tryb recept
|
||||
nei.options.inventory.cheatmode.1=Tryb użytku
|
||||
nei.options.inventory.cheatmode.2=Tryb oszukiwania
|
||||
|
||||
nei.options.inventory.profileRecipes=Profiluj recepty
|
||||
nei.options.inventory.profileRecipes.true=Tak
|
||||
nei.options.inventory.profileRecipes.false=Nie
|
||||
nei.options.inventory.guirecipe.profile=Profiluj recepty
|
||||
nei.options.inventory.guirecipe.profile.true=Tak
|
||||
nei.options.inventory.guirecipe.profile.false=Nie
|
||||
nei.options.inventory.itemsort=Sortowanie paelu przedmiotów
|
||||
nei.options.inventory.itemIDs=ID przedmiotów
|
||||
nei.options.inventory.itemIDs.0=Ukryte
|
||||
|
||||
@@ -90,8 +90,8 @@ nei.options.inventory.cheatmode.1=Modo Utilidade
|
||||
nei.options.inventory.cheatmode.2=Modo Cheat
|
||||
|
||||
nei.options.inventory.profileRecAtivaripes=Perfilar Receitas
|
||||
nei.options.inventory.profileRecipes.true=Verdadeiro
|
||||
nei.options.inventory.profileRecipes.false=Falso
|
||||
nei.options.inventory.guirecipe.profile.true=Verdadeiro
|
||||
nei.options.inventory.guirecipe.profile.false=Falso
|
||||
nei.options.inventory.itemsort=Ordenamento do Painel de Itens
|
||||
nei.options.inventory.itemIDs=IDs de Itens
|
||||
nei.options.inventory.itemIDs.0=Escondido
|
||||
|
||||
@@ -89,9 +89,9 @@ nei.options.inventory.cheatmode.0=Mód Receptov
|
||||
nei.options.inventory.cheatmode.1=Úžitkový mód
|
||||
nei.options.inventory.cheatmode.2=Čítovací mód
|
||||
|
||||
nei.options.inventory.profileRecipes=Profilovanie receptov
|
||||
nei.options.inventory.profileRecipes.true=Áno
|
||||
nei.options.inventory.profileRecipes.false=Nie
|
||||
nei.options.inventory.guirecipe.profile=Profilovanie receptov
|
||||
nei.options.inventory.guirecipe.profile.true=Áno
|
||||
nei.options.inventory.guirecipe.profile.false=Nie
|
||||
nei.options.inventory.itemsort=Zoradenie itemov
|
||||
nei.options.inventory.itemIDs=ID itemov
|
||||
nei.options.inventory.itemIDs.0=Skryté
|
||||
|
||||
@@ -89,9 +89,9 @@ nei.options.inventory.cheatmode.0=Tarif modu
|
||||
nei.options.inventory.cheatmode.1=Yardımcı mod
|
||||
nei.options.inventory.cheatmode.2=Hileli mod
|
||||
|
||||
nei.options.inventory.profileRecipes=Profil tarifleri
|
||||
nei.options.inventory.profileRecipes.true=Yazı
|
||||
nei.options.inventory.profileRecipes.false=Şekil
|
||||
nei.options.inventory.guirecipe.profile=Profil tarifleri
|
||||
nei.options.inventory.guirecipe.profile.true=Yazı
|
||||
nei.options.inventory.guirecipe.profile.false=Şekil
|
||||
nei.options.inventory.itemsort=Item Panel Sıralaması
|
||||
nei.options.inventory.itemIDs=Item IDleri
|
||||
nei.options.inventory.itemIDs.0=Gizli
|
||||
|
||||
@@ -128,47 +128,44 @@ nei.options.keys.world.creative=游戏模式
|
||||
nei.options.keys.world.creative.tip=循环游戏模式
|
||||
|
||||
nei.options.inventory=物品栏
|
||||
nei.options.inventory.worldSpecificBookmarks=书签存储位置
|
||||
nei.options.inventory.worldSpecificBookmarks.true=存档内
|
||||
nei.options.inventory.worldSpecificBookmarks.false=全局
|
||||
nei.options.inventory.bookmarks.worldSpecific=书签存储位置
|
||||
nei.options.inventory.bookmarks.worldSpecific.true=存档内
|
||||
nei.options.inventory.bookmarks.worldSpecific.false=全局
|
||||
nei.options.inventory.worldSpecificPresets=预设存储位置
|
||||
nei.options.inventory.worldSpecificPresets.true=存档内
|
||||
nei.options.inventory.worldSpecificPresets.false=全局
|
||||
nei.options.inventory.bookmarksEnabled=显示/隐藏书签页
|
||||
nei.options.inventory.bookmarksEnabled.true=显示
|
||||
nei.options.inventory.bookmarksEnabled.false=隐藏
|
||||
nei.options.inventory.jei_style_tabs=JEI标签页
|
||||
nei.options.inventory.jei_style_tabs.true=是
|
||||
nei.options.inventory.jei_style_tabs.false=否 [不会吧]
|
||||
nei.options.inventory.jei_style_recipe_catalyst=JEI风格可执行合成表机器显示[测试中]
|
||||
nei.options.inventory.jei_style_recipe_catalyst.true=是
|
||||
nei.options.inventory.jei_style_recipe_catalyst.false=否
|
||||
nei.options.inventory.saveCurrentRecipeInBookmarksEnabled=保存书签中的当前合成表
|
||||
nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.true=启用
|
||||
nei.options.inventory.saveCurrentRecipeInBookmarksEnabled.false=禁用
|
||||
nei.options.inventory.bookmarksAnimationEnabled=REI风格书签动画
|
||||
nei.options.inventory.bookmarksAnimationEnabled.true=是
|
||||
nei.options.inventory.bookmarksAnimationEnabled.false=否
|
||||
nei.options.inventory.showRecipeMarker=在书签栏显示合成产物标记
|
||||
nei.options.inventory.showRecipeMarker.true=是
|
||||
nei.options.inventory.showRecipeMarker.false=否
|
||||
nei.options.inventory.bookmarks.enabled=显示/隐藏书签页
|
||||
nei.options.inventory.bookmarks.enabled.true=显示
|
||||
nei.options.inventory.bookmarks.enabled.false=隐藏
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs=JEI标签页
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.true=是
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.false=否 [不会吧]
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst=JEI风格可执行合成表机器显示[测试中]
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.true=是
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.false=否
|
||||
nei.options.inventory.bookmarks.animation=REI风格书签动画
|
||||
nei.options.inventory.bookmarks.animation.true=是
|
||||
nei.options.inventory.bookmarks.animation.false=否
|
||||
nei.options.inventory.bookmarks.showRecipeMarker=在书签栏显示合成产物标记
|
||||
nei.options.inventory.bookmarks.showRecipeMarker.true=是
|
||||
nei.options.inventory.bookmarks.showRecipeMarker.false=否
|
||||
nei.options.inventory.showItemQuantityWidget=显示物品数量栏(右下角)
|
||||
nei.options.inventory.showItemQuantityWidget.true=是
|
||||
nei.options.inventory.showItemQuantityWidget.false=否
|
||||
nei.options.inventory.creative_tab_style=创造模式/JEI标签页
|
||||
nei.options.inventory.creative_tab_style.true=创造模式
|
||||
nei.options.inventory.creative_tab_style.false=JEI
|
||||
nei.options.inventory.ignore_potion_overlap=忽略书签与药水效果重叠
|
||||
nei.options.inventory.ignore_potion_overlap.true=忽略
|
||||
nei.options.inventory.ignore_potion_overlap.false=规避
|
||||
nei.options.inventory.guirecipe.creativeTabStyle=创造模式/JEI标签页
|
||||
nei.options.inventory.guirecipe.creativeTabStyle.true=创造模式
|
||||
nei.options.inventory.guirecipe.creativeTabStyle.false=JEI
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap=忽略书签与药水效果重叠
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap.true=忽略
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap.false=规避
|
||||
nei.options.inventory.widgetsenabled.true=激活NEI
|
||||
nei.options.inventory.widgetsenabled.false=禁用NEI
|
||||
nei.options.inventory.cheatmode.0=合成模式
|
||||
nei.options.inventory.cheatmode.1=实用模式
|
||||
nei.options.inventory.cheatmode.2=作弊模式
|
||||
nei.options.inventory.profileRecipes=合成查阅性能分析
|
||||
nei.options.inventory.profileRecipes.true=开启
|
||||
nei.options.inventory.profileRecipes.false=关闭
|
||||
nei.options.inventory.guirecipe.profile=合成查阅性能分析
|
||||
nei.options.inventory.guirecipe.profile.true=开启
|
||||
nei.options.inventory.guirecipe.profile.false=关闭
|
||||
nei.options.inventory.itemsort=物品面板排序方式
|
||||
nei.options.inventory.itemIDs=物品ID
|
||||
nei.options.inventory.itemIDs.0=隐藏
|
||||
|
||||
@@ -88,9 +88,9 @@ nei.options.inventory.cheatmode.0=合成模式
|
||||
nei.options.inventory.cheatmode.1=實用模式
|
||||
nei.options.inventory.cheatmode.2=作弊模式
|
||||
|
||||
nei.options.inventory.profileRecipes=合成查詢
|
||||
nei.options.inventory.profileRecipes.true=開啟
|
||||
nei.options.inventory.profileRecipes.false=關閉
|
||||
nei.options.inventory.guirecipe.profile=合成查詢
|
||||
nei.options.inventory.guirecipe.profile.true=開啟
|
||||
nei.options.inventory.guirecipe.profile.false=關閉
|
||||
nei.options.inventory.itemsort=物品面板排序方式
|
||||
nei.options.inventory.itemIDs=物品ID
|
||||
nei.options.inventory.itemIDs.0=隱藏
|
||||
|
||||
Reference in new issue
Block a user