mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-27 15:33:19 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
f1dea5460a
commit
f106b5e766
172 files changed
+2552
-2088
No files matched your search
@@ -3,6 +3,7 @@ package codechicken.nei.config;
|
||||
import java.util.LinkedList;
|
||||
|
||||
public abstract class ArrayDumper<T> extends DataDumper {
|
||||
|
||||
public ArrayDumper(String name) {
|
||||
super(name);
|
||||
}
|
||||
@@ -14,7 +15,7 @@ public abstract class ArrayDumper<T> extends DataDumper {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
T obj = array[i];
|
||||
if (obj == null) {
|
||||
if (mode == 1 || mode == 2) list.add(new String[] {Integer.toString(i), null, null, null, null});
|
||||
if (mode == 1 || mode == 2) list.add(new String[] { Integer.toString(i), null, null, null, null });
|
||||
} else {
|
||||
if (mode == 0 || mode == 2) list.add(dump(obj, i));
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import codechicken.lib.config.ConfigTagParent;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import java.io.File;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class ConfigSet {
|
||||
|
||||
private final File nbtFile;
|
||||
public NBTTagCompound nbt;
|
||||
public final ConfigTagParent config;
|
||||
|
||||
@@ -3,19 +3,23 @@ package codechicken.nei.config;
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public abstract class DataDumper extends Option {
|
||||
|
||||
public DataDumper(String name) {
|
||||
super(name);
|
||||
}
|
||||
@@ -52,7 +56,9 @@ public abstract class DataDumper extends Option {
|
||||
|
||||
public IChatComponent dumpMessage(File file) {
|
||||
return new ChatComponentTranslation(
|
||||
"nei.options.tools.dump.dumped", translateN(name), "dumps/" + file.getName());
|
||||
"nei.options.tools.dump.dumped",
|
||||
translateN(name),
|
||||
"dumps/" + file.getName());
|
||||
}
|
||||
|
||||
public void dumpTo(File file) throws IOException {
|
||||
|
||||
@@ -4,22 +4,26 @@ import static codechicken.lib.gui.GuiDraw.displaySize;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
import codechicken.lib.math.MathHelper;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.HUDRenderer;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class GuiHighlightTips extends GuiScreenWidget {
|
||||
|
||||
private final String name;
|
||||
private GuiCCButton toggleButton;
|
||||
private final Option opt;
|
||||
@@ -71,20 +75,18 @@ public class GuiHighlightTips extends GuiScreenWidget {
|
||||
super.drawScreen(mousex, mousey, f);
|
||||
if (show()) {
|
||||
ItemStack stack = new ItemStack(Blocks.redstone_block);
|
||||
List<String> tip = Arrays.asList(
|
||||
stack.getDisplayName(), EnumChatFormatting.RED + translate("options." + name + ".sample"));
|
||||
List<String> tip = Arrays
|
||||
.asList(stack.getDisplayName(), EnumChatFormatting.RED + translate("options." + name + ".sample"));
|
||||
HUDRenderer.renderOverlay(stack, tip, renderPos());
|
||||
}
|
||||
}
|
||||
|
||||
public Point getPos() {
|
||||
return new Point(
|
||||
opt.renderTag(name + ".x").getIntValue(),
|
||||
opt.renderTag(name + ".y").getIntValue());
|
||||
return new Point(opt.renderTag(name + ".x").getIntValue(), opt.renderTag(name + ".y").getIntValue());
|
||||
}
|
||||
|
||||
public Dimension sampleSize() // copied from HUDManager when running with the sample for this gui
|
||||
{
|
||||
{
|
||||
return new Dimension(101, 30);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
@@ -13,7 +7,9 @@ import java.io.IOException;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
@@ -24,16 +20,23 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class GuiItemIconDumper extends GuiScreen {
|
||||
static final int[] illegalChars = {
|
||||
34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
|
||||
26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47
|
||||
};
|
||||
|
||||
static final int[] illegalChars = { 34, 60, 62, 124, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
|
||||
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 58, 42, 63, 92, 47 };
|
||||
|
||||
static {
|
||||
Arrays.sort(illegalChars);
|
||||
@@ -123,7 +126,9 @@ public class GuiItemIconDumper extends GuiScreen {
|
||||
int x = i % cols * boxSize;
|
||||
int y = i / cols * boxSize;
|
||||
exportImage(
|
||||
dir, img.getSubimage(x + borderSize, y + borderSize, iconSize, iconSize), items.get(parseIndex));
|
||||
dir,
|
||||
img.getSubimage(x + borderSize, y + borderSize, iconSize, iconSize),
|
||||
items.get(parseIndex));
|
||||
}
|
||||
|
||||
if (parseIndex >= items.size()) {
|
||||
@@ -175,7 +180,13 @@ public class GuiItemIconDumper extends GuiScreen {
|
||||
GL11.glGetTexImage(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
|
||||
} else {
|
||||
GL11.glReadPixels(
|
||||
0, 0, texSize.width, texSize.height, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer);
|
||||
0,
|
||||
0,
|
||||
texSize.width,
|
||||
texSize.height,
|
||||
GL12.GL_BGRA,
|
||||
GL12.GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
pixelBuffer);
|
||||
}
|
||||
|
||||
pixelBuffer.get(pixelValues);
|
||||
|
||||
@@ -3,18 +3,23 @@ package codechicken.nei.config;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemSorter.SortEntry;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiItemSorter extends GuiOptionPane {
|
||||
|
||||
public class SortItem {
|
||||
|
||||
public double ya;
|
||||
public double y;
|
||||
public final SortEntry e;
|
||||
|
||||
@@ -6,11 +6,6 @@ import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static net.minecraft.util.StatCollector.translateToLocal;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
import codechicken.core.gui.GuiScrollSlot;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
@@ -18,13 +13,23 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
import codechicken.core.gui.GuiScrollSlot;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
|
||||
public class GuiOptionList extends GuiScreenWidget {
|
||||
|
||||
public class OptionScrollSlot extends GuiScrollSlot {
|
||||
|
||||
public final ArrayList<Option> options = new ArrayList<>();
|
||||
|
||||
public OptionScrollSlot() {
|
||||
@@ -238,8 +243,7 @@ public class GuiOptionList extends GuiScreenWidget {
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
Point mouse = getMousePosition();
|
||||
if (worldButton.pointInside(mouse.x, mouse.y))
|
||||
tooltip.addAll(Arrays.asList(translateToLocal("nei.options.global.tip." + (world ? "1" : "0"))
|
||||
.split(":")));
|
||||
tooltip.addAll(Arrays.asList(translateToLocal("nei.options.global.tip." + (world ? "1" : "0")).split(":")));
|
||||
|
||||
tooltip = slot.handleTooltip(mouse.x, mouse.y, tooltip);
|
||||
drawMultilineTip(mouse.x + 12, mouse.y - 12, tooltip);
|
||||
|
||||
@@ -5,18 +5,23 @@ import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static net.minecraft.util.StatCollector.translateToLocal;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
|
||||
public abstract class GuiOptionPane extends GuiScreenWidget {
|
||||
|
||||
public class ScrollPane extends OptionScrollPane {
|
||||
|
||||
@Override
|
||||
public int contentHeight() {
|
||||
return GuiOptionPane.this.contentHeight();
|
||||
|
||||
@@ -2,28 +2,33 @@ package codechicken.nei.config;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.ItemsGrid;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import java.awt.Point;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class GuiPanelSettings extends GuiScreenWidget {
|
||||
|
||||
private final Option opt;
|
||||
|
||||
private PanelPlaceholder bookmarksPanel;
|
||||
private PanelPlaceholder itemsPanel;
|
||||
|
||||
protected static class PanelResizeButton {
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
private int w;
|
||||
@@ -45,6 +50,7 @@ public class GuiPanelSettings extends GuiScreenWidget {
|
||||
}
|
||||
|
||||
protected static class PanelPlaceholder {
|
||||
|
||||
protected static int PANEL_SIZE = 16;
|
||||
|
||||
private final Option opt;
|
||||
@@ -111,31 +117,27 @@ public class GuiPanelSettings extends GuiScreenWidget {
|
||||
final int minWidth = 5 * ItemsGrid.SLOT_SIZE;
|
||||
final int minHeight = 9 * ItemsGrid.SLOT_SIZE;
|
||||
|
||||
int paddingLeft =
|
||||
(int) Math.ceil(margin.w * opt.renderTag(name + ".left").getIntValue() / 100000.0);
|
||||
int paddingTop =
|
||||
(int) Math.ceil(margin.h * opt.renderTag(name + ".top").getIntValue() / 100000.0);
|
||||
int paddingRight =
|
||||
(int) Math.ceil(margin.w * opt.renderTag(name + ".right").getIntValue() / 100000.0);
|
||||
int paddingBottom =
|
||||
(int) Math.ceil(margin.h * opt.renderTag(name + ".bottom").getIntValue() / 100000.0);
|
||||
int paddingLeft = (int) Math.ceil(margin.w * opt.renderTag(name + ".left").getIntValue() / 100000.0);
|
||||
int paddingTop = (int) Math.ceil(margin.h * opt.renderTag(name + ".top").getIntValue() / 100000.0);
|
||||
int paddingRight = (int) Math.ceil(margin.w * opt.renderTag(name + ".right").getIntValue() / 100000.0);
|
||||
int paddingBottom = (int) Math.ceil(margin.h * opt.renderTag(name + ".bottom").getIntValue() / 100000.0);
|
||||
|
||||
if (dragDir != null) {
|
||||
final Point mouse = getMousePosition();
|
||||
Point drag = new Point(mouse.x - dragDown.x, mouse.y - dragDown.y);
|
||||
|
||||
if (dragDir == "left") {
|
||||
paddingLeft = Math.min(
|
||||
Math.max(0, margin.w - paddingRight - minWidth), Math.max(0, paddingLeft + drag.x));
|
||||
paddingLeft = Math
|
||||
.min(Math.max(0, margin.w - paddingRight - minWidth), Math.max(0, paddingLeft + drag.x));
|
||||
} else if (dragDir == "right") {
|
||||
paddingRight = Math.min(
|
||||
Math.max(0, margin.w - paddingLeft - minWidth), Math.max(0, paddingRight - drag.x));
|
||||
paddingRight = Math
|
||||
.min(Math.max(0, margin.w - paddingLeft - minWidth), Math.max(0, paddingRight - drag.x));
|
||||
} else if (dragDir == "top") {
|
||||
paddingTop = Math.min(
|
||||
Math.max(0, margin.h - paddingBottom - minHeight), Math.max(0, paddingTop + drag.y));
|
||||
paddingTop = Math
|
||||
.min(Math.max(0, margin.h - paddingBottom - minHeight), Math.max(0, paddingTop + drag.y));
|
||||
} else if (dragDir == "bottom") {
|
||||
paddingBottom = Math.min(
|
||||
Math.max(0, margin.h - paddingTop - minHeight), Math.max(0, paddingBottom - drag.y));
|
||||
paddingBottom = Math
|
||||
.min(Math.max(0, margin.h - paddingTop - minHeight), Math.max(0, paddingBottom - drag.y));
|
||||
} else if (dragDir == "move") {
|
||||
int width = margin.w - paddingRight - paddingLeft;
|
||||
int height = margin.h - paddingTop - paddingBottom;
|
||||
@@ -155,7 +157,7 @@ public class GuiPanelSettings extends GuiScreenWidget {
|
||||
paddingTop = Math.min(margin.h - minHeight, Math.max(0, paddingTop + deltaHeight));
|
||||
paddingBottom = Math.min(margin.h - paddingTop - minHeight, Math.max(0, paddingBottom - deltaHeight));
|
||||
|
||||
return new int[] {paddingLeft, paddingTop, paddingRight, paddingBottom};
|
||||
return new int[] { paddingLeft, paddingTop, paddingRight, paddingBottom };
|
||||
}
|
||||
|
||||
protected void drawItems() {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
@@ -7,25 +17,19 @@ import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import codechicken.nei.util.NBTJson;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
public class HandlerDumper extends DataDumper {
|
||||
|
||||
public HandlerDumper(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] header() {
|
||||
return new String[] {
|
||||
"Handler Recipe Name", "Handler Class", "Overlay Identifier", "Mod DisplayName", "ItemStack"
|
||||
};
|
||||
return new String[] { "Handler Recipe Name", "Handler Class", "Overlay Identifier", "Mod DisplayName",
|
||||
"ItemStack" };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -34,21 +38,15 @@ public class HandlerDumper extends DataDumper {
|
||||
for (IRecipeHandler handler : GuiUsageRecipe.usagehandlers) {
|
||||
final String handlerName = handler.getHandlerId();
|
||||
final String handlerId = Objects.firstNonNull(
|
||||
handler instanceof TemplateRecipeHandler
|
||||
? ((TemplateRecipeHandler) handler).getOverlayIdentifier()
|
||||
handler instanceof TemplateRecipeHandler ? ((TemplateRecipeHandler) handler).getOverlayIdentifier()
|
||||
: null,
|
||||
"null");
|
||||
HandlerInfo info = GuiRecipeTab.getHandlerInfo(handlerName, handlerId);
|
||||
|
||||
list.add(new String[] {
|
||||
handler.getRecipeName(),
|
||||
handlerName,
|
||||
handlerId,
|
||||
info != null ? info.getModName() : "Unknown",
|
||||
info != null && info.getItemStack() != null
|
||||
? info.getItemStack().toString()
|
||||
: "Unknown"
|
||||
});
|
||||
list.add(
|
||||
new String[] { handler.getRecipeName(), handlerName, handlerId,
|
||||
info != null ? info.getModName() : "Unknown",
|
||||
info != null && info.getItemStack() != null ? info.getItemStack().toString() : "Unknown" });
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
@@ -11,15 +20,9 @@ import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class IMCHandler {
|
||||
|
||||
private static final Set<String> processedCatalystSenders = new HashSet<>();
|
||||
|
||||
private IMCHandler() {}
|
||||
@@ -89,12 +92,11 @@ public class IMCHandler {
|
||||
info.setYShift(yShift);
|
||||
|
||||
try {
|
||||
final int imageHeight =
|
||||
tag.hasKey("handlerHeight") ? tag.getInteger("handlerHeight") : HandlerInfo.DEFAULT_HEIGHT;
|
||||
final int imageWidth =
|
||||
tag.hasKey("handlerWidth") ? tag.getInteger("handlerWidth") : HandlerInfo.DEFAULT_WIDTH;
|
||||
final int maxRecipesPerPage = tag.hasKey("maxRecipesPerPage")
|
||||
? tag.getInteger("maxRecipesPerPage")
|
||||
final int imageHeight = tag.hasKey("handlerHeight") ? tag.getInteger("handlerHeight")
|
||||
: HandlerInfo.DEFAULT_HEIGHT;
|
||||
final int imageWidth = tag.hasKey("handlerWidth") ? tag.getInteger("handlerWidth")
|
||||
: HandlerInfo.DEFAULT_WIDTH;
|
||||
final int maxRecipesPerPage = tag.hasKey("maxRecipesPerPage") ? tag.getInteger("maxRecipesPerPage")
|
||||
: HandlerInfo.DEFAULT_MAX_PER_PAGE;
|
||||
info.setHandlerDimensions(imageHeight, imageWidth, maxRecipesPerPage);
|
||||
} catch (NumberFormatException ignored) {
|
||||
@@ -146,10 +148,10 @@ public class IMCHandler {
|
||||
}
|
||||
final int priority = tag.getInteger("priority");
|
||||
|
||||
RecipeCatalysts.addOrPut(
|
||||
RecipeCatalysts.catalystsAdderFromIMC, handlerID, new CatalystInfo(itemStack, priority));
|
||||
NEIClientConfig.logger.info(
|
||||
String.format("Added catalyst `%s` to handler %s", itemStack.getDisplayName(), handlerID));
|
||||
RecipeCatalysts
|
||||
.addOrPut(RecipeCatalysts.catalystsAdderFromIMC, handlerID, new CatalystInfo(itemStack, priority));
|
||||
NEIClientConfig.logger
|
||||
.info(String.format("Added catalyst `%s` to handler %s", itemStack.getDisplayName(), handlerID));
|
||||
}
|
||||
|
||||
private static void handleRemoveCatalystInfo(IMCMessage message) {
|
||||
@@ -180,15 +182,19 @@ public class IMCHandler {
|
||||
if (RecipeCatalysts.catalystsRemoverFromIMC.containsKey(handlerID)) {
|
||||
RecipeCatalysts.catalystsRemoverFromIMC.get(handlerID).add(itemStack);
|
||||
} else {
|
||||
RecipeCatalysts.catalystsRemoverFromIMC.put(
|
||||
handlerID, new ArrayList<>(Collections.singletonList(itemStack)));
|
||||
RecipeCatalysts.catalystsRemoverFromIMC
|
||||
.put(handlerID, new ArrayList<>(Collections.singletonList(itemStack)));
|
||||
}
|
||||
NEIClientConfig.logger.info(
|
||||
String.format("Removed catalyst `%s` from handler %s", itemStack.getDisplayName(), handlerID));
|
||||
NEIClientConfig.logger
|
||||
.info(String.format("Removed catalyst `%s` from handler %s", itemStack.getDisplayName(), handlerID));
|
||||
}
|
||||
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message, String type) {
|
||||
FMLLog.bigWarning(String.format(
|
||||
"Received invalid IMC '%s' from %s. Not a %s Message.", message.key, message.getSender(), type));
|
||||
FMLLog.bigWarning(
|
||||
String.format(
|
||||
"Received invalid IMC '%s' from %s. Not a %s Message.",
|
||||
message.key,
|
||||
message.getSender(),
|
||||
type));
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -19,8 +15,15 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.lib.inventory.InventoryUtils;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class ItemPanelDumper extends DataDumper {
|
||||
private static final int[] resolutions = new int[] {16, 32, 48, 64, 128, 256};
|
||||
|
||||
private static final int[] resolutions = new int[] { 16, 32, 48, 64, 128, 256 };
|
||||
|
||||
public ItemPanelDumper(String name) {
|
||||
super(name);
|
||||
@@ -28,20 +31,18 @@ public class ItemPanelDumper extends DataDumper {
|
||||
|
||||
@Override
|
||||
public String[] header() {
|
||||
return new String[] {"Item Name", "Item ID", "Item meta", "Has NBT", "Display Name"};
|
||||
return new String[] { "Item Name", "Item ID", "Item meta", "Has NBT", "Display Name" };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
for (ItemStack stack : ItemPanels.itemPanel.getItems())
|
||||
list.add(new String[] {
|
||||
Item.itemRegistry.getNameForObject(stack.getItem()),
|
||||
Integer.toString(Item.getIdFromItem(stack.getItem())),
|
||||
Integer.toString(InventoryUtils.actualDamage(stack)),
|
||||
stack.stackTagCompound == null ? "false" : "true",
|
||||
EnumChatFormatting.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack))
|
||||
});
|
||||
for (ItemStack stack : ItemPanels.itemPanel.getItems()) list.add(
|
||||
new String[] { Item.itemRegistry.getNameForObject(stack.getItem()),
|
||||
Integer.toString(Item.getIdFromItem(stack.getItem())),
|
||||
Integer.toString(InventoryUtils.actualDamage(stack)),
|
||||
stack.stackTagCompound == null ? "false" : "true", EnumChatFormatting
|
||||
.getTextWithoutFormattingCodes(GuiContainerManager.itemDisplayNameShort(stack)) });
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.config.ConfigTag;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import codechicken.lib.config.ConfigTag;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
|
||||
public abstract class Option {
|
||||
|
||||
public static void playClickSound() {
|
||||
Minecraft.getMinecraft()
|
||||
.getSoundHandler()
|
||||
Minecraft.getMinecraft().getSoundHandler()
|
||||
.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
}
|
||||
|
||||
@@ -46,9 +48,9 @@ public abstract class Option {
|
||||
}
|
||||
|
||||
private <T> T assertParentOverride(T elem) {
|
||||
if (elem == null)
|
||||
throw new IllegalStateException("Option " + fullName()
|
||||
+ " does not have a defined parent list. Use OptionList.setOptionList to insert a parent");
|
||||
if (elem == null) throw new IllegalStateException(
|
||||
"Option " + fullName()
|
||||
+ " does not have a defined parent list. Use OptionList.setOptionList to insert a parent");
|
||||
return elem;
|
||||
}
|
||||
|
||||
@@ -164,7 +166,8 @@ public abstract class Option {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when world specific is activated for this option. Should copy the global value into a world specific override
|
||||
* Called when world specific is activated for this option. Should copy the global value into a world specific
|
||||
* override
|
||||
*/
|
||||
public void copyGlobals() {
|
||||
copyGlobal(configName(), true);
|
||||
|
||||
@@ -5,15 +5,19 @@ import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
|
||||
public abstract class OptionButton extends Option {
|
||||
|
||||
protected static final ResourceLocation guiTex = new ResourceLocation("textures/gui/widgets.png");
|
||||
|
||||
public final String prefix;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
public class OptionCycled extends OptionButton {
|
||||
|
||||
public final int count;
|
||||
public final boolean prefixed;
|
||||
|
||||
@@ -35,8 +36,7 @@ public class OptionCycled extends OptionButton {
|
||||
|
||||
public boolean cycle() {
|
||||
int next = value();
|
||||
do next = (next + 1) % count;
|
||||
while (!optionValid(next));
|
||||
do next = (next + 1) % count; while (!optionValid(next));
|
||||
|
||||
if (next == value()) return false;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import codechicken.nei.Image;
|
||||
import codechicken.nei.LayoutManager;
|
||||
|
||||
public class OptionGamemodes extends OptionStringSet {
|
||||
|
||||
public OptionGamemodes(String name) {
|
||||
super(name);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
public class OptionIntegerField extends OptionTextField {
|
||||
|
||||
public final int min;
|
||||
public final int max;
|
||||
|
||||
|
||||
@@ -3,12 +3,15 @@ package codechicken.nei.config;
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
|
||||
public class OptionKeyBind extends OptionButton {
|
||||
|
||||
private boolean editing = false;
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
|
||||
public class OptionList extends OptionButton {
|
||||
|
||||
public static final OptionList root = new RootOptionList();
|
||||
|
||||
private static class RootOptionList extends OptionList {
|
||||
|
||||
public RootOptionList() {
|
||||
super(null);
|
||||
}
|
||||
@@ -111,9 +115,10 @@ public class OptionList extends OptionButton {
|
||||
|
||||
/**
|
||||
* Create an instance of a GuiOptionList subclass for the given parameter list
|
||||
*
|
||||
* @param parent The parent screen for the back button
|
||||
* @param list The option list to be displayed in the gui
|
||||
* @param world true if in world config mode, false for global
|
||||
* @param list The option list to be displayed in the gui
|
||||
* @param world true if in world config mode, false for global
|
||||
*/
|
||||
public GuiOptionList getGui(GuiScreen parent, OptionList list, boolean world) {
|
||||
return this.parent.getGui(parent, list, world);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
|
||||
public class OptionOpenGui extends OptionButton {
|
||||
|
||||
public final Class<? extends GuiScreen> guiClass;
|
||||
|
||||
public OptionOpenGui(String name, Class<? extends GuiScreen> guiClass) {
|
||||
@@ -15,11 +17,10 @@ public class OptionOpenGui extends OptionButton {
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
try {
|
||||
Minecraft.getMinecraft()
|
||||
.displayGuiScreen(guiClass.getConstructor(Option.class).newInstance(this));
|
||||
Minecraft.getMinecraft().displayGuiScreen(guiClass.getConstructor(Option.class).newInstance(this));
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error(
|
||||
"Unable to open gui class: " + guiClass.getName() + " from option " + fullName(), e);
|
||||
NEIClientConfig.logger
|
||||
.error("Unable to open gui class: " + guiClass.getName() + " from option " + fullName(), e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.gui.GuiScrollPane;
|
||||
import java.awt.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.core.gui.GuiScrollPane;
|
||||
|
||||
public abstract class OptionScrollPane extends GuiScrollPane {
|
||||
|
||||
public OptionScrollPane() {
|
||||
super(0, 0, 0, 0);
|
||||
setMargins(24, 4, 20, 4);
|
||||
|
||||
@@ -2,17 +2,20 @@ package codechicken.nei.config;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
public abstract class OptionStringSet extends Option {
|
||||
|
||||
public final LinkedList<String> options = new LinkedList<>();
|
||||
public final Multimap<String, String> dependants = ArrayListMultimap.create();
|
||||
public final Map<String, String> dependancies = new HashMap<>();
|
||||
|
||||
@@ -3,19 +3,25 @@ package codechicken.nei.config;
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.TextField;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
import java.util.List;
|
||||
|
||||
public class OptionTextField extends Option {
|
||||
|
||||
private boolean focused = false;
|
||||
private TextField textField = new TextField("test") {
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if (focused() && isValidValue(text()))
|
||||
if (!defaulting()
|
||||
|| !text().equals(getTag().getValue())) // don't override global if text hasn't changed
|
||||
if (focused() && isValidValue(text())) if (!defaulting() || !text().equals(getTag().getValue())) // don't
|
||||
// override
|
||||
// global
|
||||
// if text
|
||||
// hasn't
|
||||
// changed
|
||||
getTag().setValue(text());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
public class OptionToggleButton extends OptionButton {
|
||||
|
||||
public final boolean prefixed;
|
||||
|
||||
public OptionToggleButton(String name, boolean prefixed) {
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import codechicken.nei.Image;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
public class OptionToggleButtonBoubs extends OptionButton {
|
||||
private static final DrawableResource coolBoubs =
|
||||
new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 48, 16, 22, 22).build();
|
||||
private static final DrawableResource angryBoubs =
|
||||
new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 70, 16, 22, 22).build();
|
||||
|
||||
private static final DrawableResource coolBoubs = new DrawableBuilder(
|
||||
"nei:textures/nei_tabbed_sprites.png",
|
||||
48,
|
||||
16,
|
||||
22,
|
||||
22).build();
|
||||
private static final DrawableResource angryBoubs = new DrawableBuilder(
|
||||
"nei:textures/nei_tabbed_sprites.png",
|
||||
70,
|
||||
16,
|
||||
22,
|
||||
22).build();
|
||||
|
||||
public final boolean prefixed;
|
||||
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.nei.Image;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.nei.Image;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class OptionUtilities extends OptionStringSet {
|
||||
|
||||
public OptionUtilities(String name) {
|
||||
super(name);
|
||||
options.add("time");
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.util.RegistryNamespaced;
|
||||
|
||||
public abstract class RegistryDumper<T> extends DataDumper {
|
||||
|
||||
public RegistryDumper(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user