mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 19:15:13 +00:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c0292c3e7 | ||
|
|
3c5e180f9a | ||
|
|
88d6937d11 | ||
|
|
bc1aa9e97e | ||
|
|
e84ce8b9f4 | ||
|
|
64ad0f826e | ||
|
|
7e4eec1410 | ||
|
|
935a82d079 | ||
|
|
f40272fe43 | ||
|
|
8364eaef6f |
No files matched your search
@@ -2,4 +2,4 @@ mc_version=1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
ccl_version=1.1.3.138
|
||||
ccc_version=1.0.7.+
|
||||
mod_version=2.0.0-pre-9-GTNH
|
||||
mod_version=2.0.0-beta-2-GTNH
|
||||
@@ -66,10 +66,14 @@ nei.options.keys.gui.recipe=Recipe
|
||||
nei.options.keys.gui.usage=Usage
|
||||
nei.options.keys.gui.enchant=Enchantments
|
||||
nei.options.keys.gui.potion=Potions
|
||||
nei.options.keys.gui.back=Prev Recipe
|
||||
nei.options.keys.gui.prev=Prev Page
|
||||
nei.options.keys.gui.next=Next Page
|
||||
nei.options.keys.gui.back=Back to last Recipe
|
||||
nei.options.keys.gui.prev=Prev Item Panel Page
|
||||
nei.options.keys.gui.next=Next Item Panel Page
|
||||
nei.options.keys.gui.hide=Toggle NEI Visibility
|
||||
nei.options.keys.gui.next_recipe=Next Recipe
|
||||
nei.options.keys.gui.prev_recipe=Prev Recipe
|
||||
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.world=World
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTException;
|
||||
@@ -24,8 +26,13 @@ public class BookmarkPanel extends ItemPanel {
|
||||
super.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setItems() {
|
||||
realItems = _items;
|
||||
}
|
||||
|
||||
public String getLabelText() {
|
||||
return super.getLabelText() + " [" + items.size() + "]";
|
||||
return super.getLabelText() + " [" + realItems.size() + "]";
|
||||
}
|
||||
|
||||
public void addOrRemoveItem(ItemStack item) {
|
||||
@@ -36,10 +43,35 @@ public class BookmarkPanel extends ItemPanel {
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
public static NBTTagCompound itemStackToNBT(ItemStack stack, NBTTagCompound nbTag)
|
||||
{
|
||||
String strId = Item.itemRegistry.getNameForObject(stack.getItem());
|
||||
nbTag.setString("strId", strId);
|
||||
nbTag.setByte("Count", (byte)stack.stackSize);
|
||||
nbTag.setShort("Damage", (short)stack.getItemDamage());
|
||||
|
||||
if (stack.stackTagCompound != null)
|
||||
{
|
||||
nbTag.setTag("tag", stack.stackTagCompound);
|
||||
}
|
||||
|
||||
return nbTag;
|
||||
}
|
||||
|
||||
public static ItemStack loadFromNBT(NBTTagCompound nbtTag)
|
||||
{
|
||||
if (!nbtTag.hasKey("id")) {
|
||||
final short id = (short)GameData.getItemRegistry().getId(nbtTag.getString("strId"));
|
||||
nbtTag.setShort("id", id);
|
||||
}
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(nbtTag);
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void saveBookmarks() {
|
||||
List<String> strings = new ArrayList<>();
|
||||
for (ItemStack item:_items) {
|
||||
strings.add(item.writeToNBT(new NBTTagCompound()).toString());
|
||||
strings.add(itemStackToNBT(item, new NBTTagCompound()).toString());
|
||||
}
|
||||
File file = NEIClientConfig.bookmarkFile;
|
||||
if(file != null) {
|
||||
@@ -68,7 +100,7 @@ public class BookmarkPanel extends ItemPanel {
|
||||
for (String itemStr: itemStrings) {
|
||||
try {
|
||||
NBTTagCompound itemStackNBT = (NBTTagCompound)JsonToNBT.func_150315_a(itemStr);
|
||||
ItemStack itemStack = ItemStack.loadItemStackFromNBT(itemStackNBT);
|
||||
ItemStack itemStack = loadFromNBT(itemStackNBT);
|
||||
if (itemStack != null) {
|
||||
_items.add(itemStack);
|
||||
} else {
|
||||
|
||||
@@ -182,6 +182,7 @@ public class ItemList
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Item Loading");
|
||||
ThreadOperationTimer timer = getTimer(500);
|
||||
|
||||
LinkedList<ItemStack> items = new LinkedList<>();
|
||||
@@ -243,6 +244,7 @@ public class ItemList
|
||||
{
|
||||
@Override
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Item Filtering");
|
||||
ArrayList<ItemStack> filtered = new ArrayList<>();
|
||||
ItemFilter filter = getItemListFilter();
|
||||
|
||||
|
||||
@@ -17,17 +17,22 @@ import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
import static codechicken.nei.NEIClientConfig.canPerformAction;
|
||||
|
||||
public class ItemPanel extends Widget {
|
||||
/**
|
||||
* Backwards compat :-/
|
||||
*/
|
||||
public static ArrayList<ItemStack> items = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Should not be externally modified, use updateItemList
|
||||
*/
|
||||
public ArrayList<ItemStack> items = new ArrayList<>();
|
||||
public ArrayList<ItemStack> realItems = new ArrayList<>();
|
||||
/**
|
||||
* Swapped into visible items on update
|
||||
*/
|
||||
protected ArrayList<ItemStack> _items = items;
|
||||
protected ArrayList<ItemStack> _items = realItems;
|
||||
|
||||
public ArrayList<ItemStack> getItems() {
|
||||
return items;
|
||||
return realItems;
|
||||
}
|
||||
|
||||
public static void updateItemList(ArrayList<ItemStack> newItems) {
|
||||
@@ -40,7 +45,7 @@ public class ItemPanel extends Widget {
|
||||
public int slotIndex;
|
||||
|
||||
public ItemPanelSlot(int index) {
|
||||
item = items.get(index);
|
||||
item = realItems.get(index);
|
||||
slotIndex = index;
|
||||
}
|
||||
}
|
||||
@@ -145,8 +150,15 @@ public class ItemPanel extends Widget {
|
||||
return pageLabel.text = "(" + getPage() + "/" + getNumPages() + ")";
|
||||
}
|
||||
|
||||
protected void setItems() {
|
||||
realItems = _items;
|
||||
|
||||
// Backwards compat
|
||||
ItemPanels.itemPanel._items = _items;
|
||||
}
|
||||
|
||||
public void resize(GuiContainer gui) {
|
||||
items = _items;
|
||||
setItems();
|
||||
final int buttonHeight = 16;
|
||||
final int buttonWidth = 16;
|
||||
|
||||
@@ -185,9 +197,9 @@ public class ItemPanel extends Widget {
|
||||
if (itemsPerPage == 0)
|
||||
numPages = 0;
|
||||
else
|
||||
numPages = (int) Math.ceil((float) items.size() / (float) itemsPerPage);
|
||||
numPages = (int) Math.ceil((float) realItems.size() / (float) itemsPerPage);
|
||||
|
||||
if (firstIndex >= items.size())
|
||||
if (firstIndex >= realItems.size())
|
||||
firstIndex = 0;
|
||||
|
||||
if (numPages == 0)
|
||||
@@ -236,13 +248,13 @@ public class ItemPanel extends Widget {
|
||||
|
||||
GuiContainerManager.enableMatrixStackLogging();
|
||||
int index = firstIndex;
|
||||
for (int i = 0; i < rows * columns && index < items.size(); i++) {
|
||||
for (int i = 0; i < rows * columns && index < realItems.size(); i++) {
|
||||
if (validSlotMap[i]) {
|
||||
Rectangle4i rect = getSlotRect(i);
|
||||
if (rect.contains(mousex, mousey))
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);//highlight
|
||||
|
||||
GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, items.get(index));
|
||||
GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, realItems.get(index));
|
||||
|
||||
index++;
|
||||
}
|
||||
@@ -416,7 +428,7 @@ public class ItemPanel extends Widget {
|
||||
|
||||
public ItemPanelSlot getSlotMouseOver(int mousex, int mousey) {
|
||||
int index = firstIndex;
|
||||
for (int i = 0; i < rows * columns && index < items.size(); i++)
|
||||
for (int i = 0; i < rows * columns && index < realItems.size(); i++)
|
||||
if (validSlotMap[i]) {
|
||||
if (getSlotRect(i).contains(mousex, mousey))
|
||||
return new ItemPanelSlot(index);
|
||||
@@ -430,13 +442,13 @@ public class ItemPanel extends Widget {
|
||||
if (itemsPerPage != 0) {
|
||||
int oldIndex = firstIndex;
|
||||
firstIndex += i * itemsPerPage;
|
||||
if (firstIndex >= items.size())
|
||||
if (firstIndex >= realItems.size())
|
||||
firstIndex = 0;
|
||||
if (firstIndex < 0)
|
||||
if (oldIndex > 0)
|
||||
firstIndex = 0;
|
||||
else
|
||||
firstIndex = (items.size() - 1) / itemsPerPage * itemsPerPage;
|
||||
firstIndex = (realItems.size() - 1) / itemsPerPage * itemsPerPage;
|
||||
|
||||
calculatePage();
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<>();
|
||||
|
||||
public static boolean ftbUtilsLoaded = false;
|
||||
public static boolean itemsLoaded = false;
|
||||
|
||||
public static void load() {
|
||||
ftbUtilsLoaded = Loader.isModLoaded("FTBU");
|
||||
@@ -559,7 +560,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (isEnabled()) {
|
||||
setInputFocused(null);
|
||||
|
||||
ItemList.loadItems.restart();
|
||||
if(!itemsLoaded) {
|
||||
ItemList.loadItems.restart();
|
||||
itemsLoaded = true;
|
||||
}
|
||||
overlayRenderer = null;
|
||||
|
||||
getLayoutStyle().init();
|
||||
|
||||
@@ -160,6 +160,10 @@ public class NEIClientConfig
|
||||
API.addKeyBind("gui.potion", Keyboard.KEY_P);
|
||||
API.addKeyBind("gui.prev", Keyboard.KEY_PRIOR);
|
||||
API.addKeyBind("gui.next", Keyboard.KEY_NEXT);
|
||||
API.addKeyBind("gui.prev_machine", Keyboard.KEY_UP);
|
||||
API.addKeyBind("gui.next_machine", Keyboard.KEY_DOWN);
|
||||
API.addKeyBind("gui.prev_recipe", Keyboard.KEY_LEFT);
|
||||
API.addKeyBind("gui.next_recipe", Keyboard.KEY_RIGHT);
|
||||
API.addKeyBind("gui.hide", Keyboard.KEY_O);
|
||||
API.addKeyBind("gui.search", Keyboard.KEY_F);
|
||||
API.addKeyBind("gui.bookmark", Keyboard.KEY_A);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
|
||||
@Override
|
||||
public int getTextColour() {
|
||||
if(ItemPanels.itemPanel.items.size() == 0) {
|
||||
if(ItemPanels.itemPanel.realItems.size() == 0) {
|
||||
return focused() ? 0xFFcc3300 : 0xFF993300;
|
||||
} else {
|
||||
return focused() ? 0xFFE0E0E0 : 0xFF909090;
|
||||
@@ -101,7 +101,7 @@ public class SearchField extends TextField implements ItemFilterProvider
|
||||
public void onTextChange(String oldText) {
|
||||
final String newText = text();
|
||||
if( newText.length() > 0)
|
||||
NEIClientConfig.logger.info("Searching for " + text());
|
||||
NEIClientConfig.logger.debug("Searching for " + text());
|
||||
|
||||
NEIClientConfig.setSearchExpression(newText);
|
||||
ItemList.updateFilter.restart();
|
||||
|
||||
@@ -388,7 +388,6 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
updateState.stop();
|
||||
synchronized (root) {
|
||||
root.addTag(tag);
|
||||
NEIClientConfig.logger.info("Adding Tag {}", tag.displayName());
|
||||
updateState.reallocate();
|
||||
}
|
||||
}
|
||||
@@ -519,12 +518,15 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
}
|
||||
|
||||
public synchronized void reallocate() {
|
||||
// System.out.println("NEI Subset - Reallocate");
|
||||
// Thread.dumpStack();
|
||||
reallocate = true;
|
||||
restart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Subset Item Allocation");
|
||||
HashMap<String, SubsetState> state = new HashMap<>();
|
||||
List<SubsetTag> tags = new LinkedList<>();
|
||||
synchronized (root) {
|
||||
|
||||
@@ -28,7 +28,11 @@ public class VisiblityData
|
||||
*/
|
||||
public boolean showNEI = true;
|
||||
public boolean enableDeleteMode = true;
|
||||
|
||||
|
||||
// Deprecated -- left in for campatability with other mods that mess with this
|
||||
public boolean showStateButtons = false;
|
||||
|
||||
public void translateDependancies()
|
||||
{
|
||||
if(!showNEI)
|
||||
|
||||
@@ -100,10 +100,10 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
for(int i = 0; drawIndex < ItemPanels.itemPanel.items.size() && i < fit; drawIndex++, i++) {
|
||||
for(int i = 0; drawIndex < ItemPanels.itemPanel.realItems.size() && i < fit; drawIndex++, i++) {
|
||||
int x = i%cols * 18;
|
||||
int y = i/cols * 18;
|
||||
GuiContainerManager.drawItem(x+1, y+1, ItemPanels.itemPanel.items.get(drawIndex));
|
||||
GuiContainerManager.drawItem(x+1, y+1, ItemPanels.itemPanel.realItems.get(drawIndex));
|
||||
}
|
||||
|
||||
GL11.glFlush();
|
||||
@@ -114,13 +114,13 @@ public class GuiItemIconDumper extends GuiScreen
|
||||
int rows = img.getHeight() / boxSize;
|
||||
int cols = img.getWidth() / boxSize;
|
||||
int fit = rows*cols;
|
||||
for(int i = 0; parseIndex < ItemPanels.itemPanel.items.size() && i < fit; parseIndex++, i++) {
|
||||
for(int i = 0; parseIndex < ItemPanels.itemPanel.realItems.size() && i < fit; parseIndex++, i++) {
|
||||
int x = i%cols * boxSize;
|
||||
int y = i/cols * boxSize;
|
||||
exportImage(dir, img.getSubimage(x+borderSize, y+borderSize, iconSize, iconSize), ItemPanels.itemPanel.items.get(parseIndex));
|
||||
exportImage(dir, img.getSubimage(x+borderSize, y+borderSize, iconSize, iconSize), ItemPanels.itemPanel.realItems.get(parseIndex));
|
||||
}
|
||||
|
||||
if(parseIndex >= ItemPanels.itemPanel.items.size())
|
||||
if(parseIndex >= ItemPanels.itemPanel.realItems.size())
|
||||
returnScreen(new ChatComponentTranslation(opt.fullName()+".icon.dumped", "dumps/itempanel_icons"));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ItemPanelDumper extends DataDumper
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
for (ItemStack stack : ItemPanels.itemPanel.items)
|
||||
for (ItemStack stack : ItemPanels.itemPanel.realItems)
|
||||
list.add(new String[]{
|
||||
Item.itemRegistry.getNameForObject(stack.getItem()),
|
||||
Integer.toString(Item.getIdFromItem(stack.getItem())),
|
||||
@@ -123,7 +123,7 @@ public class ItemPanelDumper extends DataDumper
|
||||
|
||||
public void dumpNBT(File file) throws IOException {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (ItemStack stack : ItemPanels.itemPanel.items)
|
||||
for (ItemStack stack : ItemPanels.itemPanel.realItems)
|
||||
list.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
@@ -134,7 +134,7 @@ public class ItemPanelDumper extends DataDumper
|
||||
|
||||
public void dumpJson(File file) throws IOException {
|
||||
PrintWriter p = new PrintWriter(file);
|
||||
for (ItemStack stack : ItemPanels.itemPanel.items) {
|
||||
for (ItemStack stack : ItemPanels.itemPanel.realItems) {
|
||||
NBTTagCompound tag = stack.writeToNBT(new NBTTagCompound());
|
||||
tag.removeTag("Count");
|
||||
p.println(tag);
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.Point;
|
||||
@@ -76,7 +77,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
if (i == 1)//esc
|
||||
if (i == Keyboard.KEY_ESCAPE) //esc
|
||||
{
|
||||
mc.displayGuiScreen(firstGui);
|
||||
return;
|
||||
@@ -93,6 +94,14 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
mc.displayGuiScreen(firstGui);
|
||||
else if (i == NEIClientConfig.getKeyBinding("gui.back"))
|
||||
mc.displayGuiScreen(prevGui);
|
||||
else if (i == NEIClientConfig.getKeyBinding("gui.prev_machine"))
|
||||
prevType();
|
||||
else if (i == NEIClientConfig.getKeyBinding("gui.next_machine"))
|
||||
nextType();
|
||||
else if (i == NEIClientConfig.getKeyBinding("gui.prev_recipe"))
|
||||
prevPage();
|
||||
else if (i == NEIClientConfig.getKeyBinding("gui.next_recipe"))
|
||||
nextPage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user