mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-18 11:29:35 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c36d0625e | ||
|
|
5bfcc73459 | ||
|
|
bc1dd44c41 | ||
|
|
d2de8af64c | ||
|
|
af50881c6e | ||
|
|
c971199bd1 | ||
|
|
146e882229 | ||
|
|
baa0a8962b | ||
|
|
400f38d919 | ||
|
|
07ec5f67c5 | ||
|
|
79b5da1d1a | ||
|
|
aa13ba7781 |
No files matched your search
+1
-1
@@ -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.1.0-GTNH-beta
|
||||
mod_version=2.1.0-GTNH-beta4
|
||||
@@ -114,6 +114,9 @@ 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.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.widgetsenabled.true=NEI Enabled
|
||||
nei.options.inventory.widgetsenabled.false=NEI Disabled
|
||||
nei.options.inventory.cheatmode.0=Recipe Mode
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
@@ -150,7 +150,7 @@ public class BookmarkPanel extends ItemPanel {
|
||||
|
||||
@Override
|
||||
public int getNextX(GuiContainer gui) {
|
||||
return gui.width - prev.w - 2 - ((gui.xSize + gui.width) /2 + 2);
|
||||
return gui.width - prev.w - 2 - ((gui.xSize + gui.width) /2 + 2) - 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,7 +160,7 @@ public class BookmarkPanel extends ItemPanel {
|
||||
|
||||
@Override
|
||||
public int getPageX(GuiContainer gui) {
|
||||
return gui.guiLeft * 3 / 2 + gui.xSize + 1 - ((gui.xSize + gui.width) /2 + 2);
|
||||
return gui.guiLeft * 3 / 2 + gui.xSize + 1 - ((gui.xSize + gui.width) / 2 + 2) - 16;
|
||||
}
|
||||
|
||||
public int getHightAdjustment() {
|
||||
@@ -168,8 +168,7 @@ public class BookmarkPanel extends ItemPanel {
|
||||
}
|
||||
|
||||
public int getWidth(GuiContainer gui) {
|
||||
return LayoutManager.getLeftSize(gui) - ( (gui.xSize + gui.width) / 2 + 3 );
|
||||
|
||||
return LayoutManager.getLeftSize(gui) - ( (gui.xSize + gui.width) / 2 + 3 ) - 16;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ public abstract class ButtonCycled extends Button
|
||||
|
||||
public ButtonCycled(int num) {
|
||||
icons = new Image[num];
|
||||
init();
|
||||
}
|
||||
@Override
|
||||
public Image getRenderIcon()
|
||||
@@ -13,6 +14,7 @@ public abstract class ButtonCycled extends Button
|
||||
return icons[index];
|
||||
}
|
||||
|
||||
public void init() {}
|
||||
public int index;
|
||||
public Image[] icons;
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.api.LayoutStyle;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerDrawHandler;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
@@ -103,12 +105,9 @@ 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");
|
||||
|
||||
API.addLayoutStyle(0, new LayoutStyleMinecraft());
|
||||
|
||||
instance = new LayoutManager();
|
||||
@@ -140,7 +139,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return gui.width - 3;
|
||||
}
|
||||
public static int getLeftSize(GuiContainer gui) {
|
||||
return getSideWidth(gui) - ((ftbUtilsLoaded || getGamemode() == 2) ? 18 : 0);
|
||||
return getSideWidth(gui);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -258,7 +257,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postRenderObjects(GuiContainer gui, int mousex, int mousey) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
@@ -335,6 +334,13 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
options = new ButtonCycled(3)
|
||||
{
|
||||
@Override
|
||||
public void init() {
|
||||
this.icons[0] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 32, 0, 16, 16).build();
|
||||
this.icons[1] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 48, 0, 16, 16).build();
|
||||
this.icons[2] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 64, 0, 16, 16).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) {
|
||||
@@ -371,9 +377,15 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
bookmarksButton = new ButtonCycled(2)
|
||||
{
|
||||
@Override
|
||||
public void init() {
|
||||
this.icons[0] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 0, 0, 16, 16).build();
|
||||
this.icons[1] = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 16, 0, 16, 16).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
NEIClientConfig.toggleBooleanSetting("bookmarksEnabled");
|
||||
NEIClientConfig.toggleBooleanSetting("inventory.bookmarksEnabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -768,11 +780,18 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
}
|
||||
|
||||
public static void drawIcon(int x, int y, Image image) {
|
||||
changeTexture("nei:textures/nei_sprites.png");
|
||||
final boolean isDrawableResource = image instanceof DrawableResource;
|
||||
|
||||
if (!isDrawableResource)
|
||||
changeTexture("nei:textures/nei_sprites.png");
|
||||
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
drawTexturedModalRect(x, y, image.x, image.y, image.width, image.height);
|
||||
if(!isDrawableResource)
|
||||
drawTexturedModalRect(x, y, image.x, image.y, image.width, image.height);
|
||||
else
|
||||
((DrawableResource)image).draw(x, y);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,11 +49,6 @@ public class LayoutStyleMinecraft extends LayoutStyle
|
||||
timeButtons[2].icon = new Image(144, 24, 12, 12);
|
||||
timeButtons[3].icon = new Image(156, 24, 12, 12);
|
||||
heal.icon = new Image(168, 24, 12, 12);
|
||||
bookmarksButton.icons[0] = new Image(0, 36, 16, 16);
|
||||
bookmarksButton.icons[1] = new Image(16, 36, 16, 16);
|
||||
options.icons[0] = new Image(32, 36, 16, 16);
|
||||
options.icons[1] = new Image(48, 36, 16, 16);
|
||||
options.icons[2] = new Image(64, 36, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,6 +184,7 @@ public class LayoutStyleMinecraft extends LayoutStyle
|
||||
|
||||
final int iconX = b.x + (b.w - icon.width) / 2;
|
||||
final int iconY = b.y + (b.h - icon.height) / 2;
|
||||
|
||||
LayoutManager.drawIcon(iconX, iconY, icon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class NEIClientConfig
|
||||
|
||||
tag.getTag("inventory.widgetsenabled").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.widgetsenabled"));
|
||||
|
||||
|
||||
tag.getTag("inventory.hidden").getBooleanValue(false);
|
||||
tag.getTag("inventory.cheatmode").getIntValue(2);
|
||||
tag.getTag("inventory.lockmode").setComment("For those who can't help themselves.\nSet this to a mode and you will be unable to change it ingame").getIntValue(-1);
|
||||
@@ -130,6 +130,9 @@ public class NEIClientConfig
|
||||
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.creative_tab_style").setComment("Creative or JEI style tabs").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.creative_tab_style", true));
|
||||
|
||||
setDefaultKeyBindings();
|
||||
}
|
||||
|
||||
@@ -294,6 +297,9 @@ public class NEIClientConfig
|
||||
public static boolean areJEIStyleTabsVisible() {
|
||||
return getBooleanSetting("inventory.jei_style_tabs");
|
||||
}
|
||||
public static boolean useCreativeTabStyle() {
|
||||
return getBooleanSetting("inventory.creative_tab_style");
|
||||
}
|
||||
public static boolean isEnabled() {
|
||||
return enabledOverride && getBooleanSetting("inventory.widgetsenabled");
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.nei.Image;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.changeTexture;
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
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();
|
||||
|
||||
public class OptionToggleButtonBoubs extends OptionButton
|
||||
{
|
||||
public final boolean prefixed;
|
||||
|
||||
public OptionToggleButtonBoubs(String name, boolean prefixed) {
|
||||
@@ -32,19 +31,8 @@ public class OptionToggleButtonBoubs extends OptionButton
|
||||
public void drawButton(int mx, int my) {
|
||||
Rectangle b = buttonSize();
|
||||
LayoutManager.drawButtonBackground(b.x, b.y, b.width, b.height, true, getButtonTex(mx, my));
|
||||
if(state()) {
|
||||
changeTexture("nei:textures/nei_sprites.png");
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Image image = new Image(48, 52, 24, 24);
|
||||
// drawTexturedModalRect(x, y, image.x, image.y, image.width, image.height);
|
||||
drawTexturedModalRect(b.x + (b.width/2) - (image.width/2), b.y, image.x, image.y, image.width, image.height);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
}else {
|
||||
drawStringC(getButtonText(), b.x, b.y, b.width, b.height, getTextColour(mx, my));
|
||||
}
|
||||
final Image image = state() ? coolBoubs : angryBoubs;
|
||||
LayoutManager.drawIcon(b.x + (b.width/2) - (coolBoubs.getWidth()/2), b.y, image);
|
||||
}
|
||||
|
||||
public String getButtonText() {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package codechicken.nei.drawable;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class DrawableBuilder {
|
||||
private final ResourceLocation resourceLocation;
|
||||
private int u;
|
||||
private int v;
|
||||
private int width;
|
||||
private int height;
|
||||
private int textureWidth = 256;
|
||||
private int textureHeight = 256;
|
||||
private int paddingTop = 0;
|
||||
private int paddingBottom = 0;
|
||||
private int paddingLeft = 0;
|
||||
private int paddingRight = 0;
|
||||
|
||||
public DrawableBuilder(String resourceLocation, int u, int v, int width, int height) {
|
||||
this.u = u;
|
||||
this.v = v;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.resourceLocation = new ResourceLocation(resourceLocation);
|
||||
}
|
||||
|
||||
public DrawableBuilder setTextureSize(int width, int height) {
|
||||
this.textureWidth = width;
|
||||
this.textureHeight = height;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DrawableBuilder addPadding(int paddingTop, int paddingBottom, int paddingLeft, int paddingRight) {
|
||||
this.paddingTop = paddingTop;
|
||||
this.paddingBottom = paddingBottom;
|
||||
this.paddingLeft = paddingLeft;
|
||||
this.paddingRight = paddingRight;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DrawableBuilder trim(int trimTop, int trimBottom, int trimLeft, int trimRight) {
|
||||
this.u += trimLeft;
|
||||
this.v += trimTop;
|
||||
this.width -= trimLeft + trimRight;
|
||||
this.height -= trimTop + trimBottom;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DrawableResource build() {
|
||||
return new DrawableResource(resourceLocation, u, v, width, height, paddingTop, paddingBottom, paddingLeft, paddingRight, textureWidth, textureHeight);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package codechicken.nei.drawable;
|
||||
|
||||
import codechicken.nei.Image;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class DrawableResource extends Image {
|
||||
|
||||
private final ResourceLocation resourceLocation;
|
||||
private final int textureWidth;
|
||||
private final int textureHeight;
|
||||
|
||||
private final int paddingTop;
|
||||
private final int paddingBottom;
|
||||
private final int paddingLeft;
|
||||
private final int paddingRight;
|
||||
|
||||
public DrawableResource(ResourceLocation resourceLocation, int u, int v, int width, int height, int paddingTop, int paddingBottom, int paddingLeft, int paddingRight, int textureWidth, int textureHeight) {
|
||||
super(u, v, width, height);
|
||||
this.resourceLocation = resourceLocation;
|
||||
this.textureWidth = textureWidth;
|
||||
this.textureHeight = textureHeight;
|
||||
|
||||
this.paddingTop = paddingTop;
|
||||
this.paddingBottom = paddingBottom;
|
||||
this.paddingLeft = paddingLeft;
|
||||
this.paddingRight = paddingRight;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width + paddingLeft + paddingRight;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height + paddingTop + paddingBottom;
|
||||
}
|
||||
|
||||
public void draw(int xOffset, int yOffset) {
|
||||
draw(xOffset, yOffset, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void draw(int xOffset, int yOffset, int maskTop, int maskBottom, int maskLeft, int maskRight) {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(this.resourceLocation);
|
||||
|
||||
int x = xOffset + this.paddingLeft + maskLeft;
|
||||
int y = yOffset + this.paddingTop + maskTop;
|
||||
int u = this.x + maskLeft;
|
||||
int v = this.y + maskTop;
|
||||
int width = this.width - maskRight - maskLeft;
|
||||
int height = this.height - maskBottom - maskTop;
|
||||
// drawModalRectWithCustomSizedTexture
|
||||
Gui.func_146110_a(x, y, u, v, width, height, textureWidth, textureHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@ public class DefaultOverlayHandler implements IOverlayHandler
|
||||
{
|
||||
for(IngredientDistribution distrib : assignedIngredients)
|
||||
{
|
||||
if(distrib.slots.length == 0) continue;
|
||||
|
||||
ItemStack pstack = distrib.permutation;
|
||||
int transferCap = quantity*pstack.stackSize;
|
||||
int transferred = 0;
|
||||
|
||||
@@ -36,7 +36,20 @@ import java.util.List;
|
||||
|
||||
public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOverlay, IGuiClientSide, IGuiHandleMouseWheel, IContainerTooltipHandler, INEIGuiHandler
|
||||
{
|
||||
private static final int borderPadding = 6;
|
||||
private static final int buttonWidth = 13;
|
||||
private static final int buttonHeight = 12;
|
||||
|
||||
public ArrayList<? extends IRecipeHandler> currenthandlers = new ArrayList<>();
|
||||
private static Class gregtechHandler;
|
||||
|
||||
static {
|
||||
try {
|
||||
gregtechHandler = Class.forName("gregtech.nei.GT_NEI_DefaultHandler");
|
||||
} catch (ClassNotFoundException e) {
|
||||
gregtechHandler = null;
|
||||
}
|
||||
}
|
||||
|
||||
public int page;
|
||||
public int recipetype;
|
||||
@@ -47,8 +60,12 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
public GuiButton prevpage;
|
||||
public GuiButton overlay1;
|
||||
public GuiButton overlay2;
|
||||
private GuiButton nexttype;
|
||||
private GuiButton prevtype;
|
||||
private final Rectangle area = new Rectangle();
|
||||
private final GuiRecipeTabs recipeTabs;
|
||||
|
||||
private int yShift = 0;
|
||||
|
||||
protected GuiRecipe(GuiScreen prevgui) {
|
||||
super(new ContainerRecipe());
|
||||
@@ -70,12 +87,17 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
super.initGui();
|
||||
|
||||
currenthandlers = getCurrentRecipeHandlers(); // Probably don't comment me out
|
||||
GuiButton nexttype = new GuiNEIButton(0, width / 2 - 70, (height - ySize) / 2 + 3, 13, 12, "<");
|
||||
GuiButton prevtype = new GuiNEIButton(1, width / 2 + 57, (height - ySize) / 2 + 3, 13, 12, ">");
|
||||
nextpage = new GuiNEIButton(2, width / 2 - 70, (height + ySize) / 2 - 18, 13, 12, "<");
|
||||
prevpage = new GuiNEIButton(3, width / 2 + 57, (height + ySize) / 2 - 18, 13, 12, ">");
|
||||
overlay1 = new GuiNEIButton(4, width / 2 + 65, (height - ySize) / 2 + 63, 13, 12, "?");
|
||||
overlay2 = new GuiNEIButton(5, width / 2 + 65, (height - ySize) / 2 + 128, 13, 12, "?");
|
||||
final int rightButtonX = guiLeft + xSize - borderPadding - buttonWidth;
|
||||
final int leftButtonX = guiLeft + borderPadding;
|
||||
|
||||
nexttype = new GuiNEIButton(0, leftButtonX, (height - ySize) / 2 + 3, buttonWidth, buttonHeight, "<");
|
||||
prevtype = new GuiNEIButton(1, rightButtonX, (height - ySize) / 2 + 3, buttonWidth, buttonHeight, ">");
|
||||
|
||||
nextpage = new GuiNEIButton(2, leftButtonX, (height - ySize) / 2 + 17, buttonWidth, buttonHeight, "<");
|
||||
prevpage = new GuiNEIButton(3, rightButtonX, (height - ySize) / 2 + 17, buttonWidth, buttonHeight, ">");
|
||||
|
||||
overlay1 = new GuiNEIButton(4, width / 2 + 65, (height - ySize) / 2 + 63, buttonWidth, buttonHeight, "?");
|
||||
overlay2 = new GuiNEIButton(5, width / 2 + 65, (height - ySize) / 2 + 128, buttonWidth, buttonHeight, "?");
|
||||
|
||||
buttonList.addAll(Arrays.asList(nexttype, prevtype, nextpage, prevpage, overlay1, overlay2));
|
||||
|
||||
@@ -83,9 +105,19 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
nexttype.visible = false;
|
||||
prevtype.visible = false;
|
||||
}
|
||||
checkGregTech();
|
||||
recipeTabs.initLayout();
|
||||
refreshPage();
|
||||
}
|
||||
private void checkGregTech() {
|
||||
IRecipeHandler handler = currenthandlers.get(recipetype);
|
||||
if (gregtechHandler != null && gregtechHandler.isInstance(handler)) {
|
||||
// Gregtech decided to shift their handler by -8 and draw over shit...
|
||||
yShift = 6;
|
||||
} else {
|
||||
yShift = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
@@ -196,19 +228,22 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
}
|
||||
|
||||
private void nextType() {
|
||||
recipetype++;
|
||||
if (recipetype >= currenthandlers.size())
|
||||
recipetype = 0;
|
||||
page = 0;
|
||||
recipeTabs.calcPageNumber();
|
||||
setRecipePage(++recipetype);
|
||||
}
|
||||
|
||||
private void prevType() {
|
||||
recipetype--;
|
||||
setRecipePage(--recipetype);
|
||||
}
|
||||
|
||||
public void setRecipePage(int idx) {
|
||||
recipetype = idx;
|
||||
if (recipetype < 0)
|
||||
recipetype = currenthandlers.size() - 1;
|
||||
else if (recipetype >= currenthandlers.size())
|
||||
recipetype = 0;
|
||||
page = 0;
|
||||
recipeTabs.calcPageNumber();
|
||||
checkGregTech();
|
||||
}
|
||||
|
||||
private void overlayRecipe(int recipe) {
|
||||
@@ -233,19 +268,14 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
area.x = guiLeft - 2;
|
||||
area.y = guiTop - 4;
|
||||
|
||||
final boolean avarita = handler.getClass().toString().contains("fox.spiteful.avaritia.compat.nei.");
|
||||
if (avarita) {
|
||||
area.width = 256;
|
||||
area.height = 208;
|
||||
}
|
||||
|
||||
calcArea(handler);
|
||||
checkGregTech();
|
||||
|
||||
boolean multiplepages = handler.numRecipes() > handler.recipiesPerPage();
|
||||
nextpage.visible = multiplepages;
|
||||
prevpage.visible = multiplepages;
|
||||
nextpage.enabled = prevpage.enabled = multiplepages;
|
||||
|
||||
if(firstGui != null) {
|
||||
overlay1.yPosition = (height - ySize) / 2 + (handler.recipiesPerPage() == 2 ? 63 : 128);
|
||||
overlay1.yPosition = (height - ySize) / 2 + 17 + (handler.recipiesPerPage() == 2 ? 63 : 128);
|
||||
overlay1.visible = handler.hasOverlay(firstGui, firstGui.inventorySlots, page * handler.recipiesPerPage());
|
||||
overlay2.visible = handler.recipiesPerPage() == 2 && page * handler.recipiesPerPage() + 1 < handler.numRecipes() &&
|
||||
handler.hasOverlay(firstGui, firstGui.inventorySlots, page * handler.recipiesPerPage() + 1);
|
||||
@@ -256,6 +286,14 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
recipeTabs.refreshPage();
|
||||
}
|
||||
|
||||
private void calcArea(IRecipeHandler handler) {
|
||||
if ( handler.getClass().toString().contains("fox.spiteful.avaritia.compat.nei.")) {
|
||||
// Handle avarita's oversized handler area
|
||||
area.width = 256;
|
||||
area.height = 208;
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshSlots() {
|
||||
slotcontainer.inventorySlots.clear();
|
||||
IRecipeHandler recipehandler = currenthandlers.get(recipetype);
|
||||
@@ -282,12 +320,12 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
|
||||
IRecipeHandler recipehandler = currenthandlers.get(recipetype);
|
||||
String s = recipehandler.getRecipeName();
|
||||
fontRendererObj.drawString(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 5, 0x404040);
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 5, 0xffffff);
|
||||
s = NEIClientUtils.translate("recipe.page", page + 1, (currenthandlers.get(recipetype).numRecipes() - 1) / recipehandler.recipiesPerPage() + 1);
|
||||
fontRendererObj.drawString(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, ySize - 16, 0x404040);
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 19, 0xffffff);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(5, 16, 0);
|
||||
GL11.glTranslatef(5, 32 + yShift, 0);
|
||||
for (int i = page * recipehandler.recipiesPerPage(); i < recipehandler.numRecipes() && i < (page + 1) * recipehandler.recipiesPerPage(); i++) {
|
||||
recipehandler.drawForeground(i);
|
||||
GL11.glTranslatef(0, 65, 0);
|
||||
@@ -303,6 +341,19 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
int k = (height - ySize) / 2;
|
||||
drawTexturedModalRect(j, k, 0, 0, xSize, ySize);
|
||||
|
||||
drawRect(guiLeft + borderPadding + buttonWidth - 1,
|
||||
nexttype.yPosition,
|
||||
guiLeft + xSize - borderPadding - buttonWidth,
|
||||
nexttype.yPosition + buttonHeight,
|
||||
0x30000000);
|
||||
drawRect(guiLeft + borderPadding + buttonWidth - 1,
|
||||
nextpage.yPosition,
|
||||
guiLeft + xSize - borderPadding - buttonWidth,
|
||||
nextpage.yPosition + buttonHeight,
|
||||
0x30000000);
|
||||
|
||||
|
||||
|
||||
if (NEIClientConfig.areJEIStyleTabsVisible()) {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
@@ -311,7 +362,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(j + 5, k + 16, 0);
|
||||
GL11.glTranslatef(j + 5, k + 32 + yShift, 0);
|
||||
IRecipeHandler recipehandler = currenthandlers.get(recipetype);
|
||||
for (int i = page * recipehandler.recipiesPerPage(); i < recipehandler.numRecipes() && i < (page + 1) * recipehandler.recipiesPerPage(); i++) {
|
||||
recipehandler.drawBackground(i);
|
||||
@@ -334,7 +385,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
}
|
||||
|
||||
public Point getRecipePosition(int recipe) {
|
||||
return new Point(5, 16 + (recipe % currenthandlers.get(recipetype).recipiesPerPage()) * 65);
|
||||
return new Point(5, 32 + yShift + (recipe % currenthandlers.get(recipetype).recipiesPerPage()) * 65);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,9 +2,10 @@ package codechicken.nei.recipe;
|
||||
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.Image;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -18,29 +19,37 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiRecipeTab extends Button {
|
||||
public static HashMap<String, ImmutablePair<String, Image>> iconMap = new HashMap<>();
|
||||
public abstract class GuiRecipeTab extends Widget {
|
||||
public static HashMap<String, ImmutablePair<String, DrawableResource>> imageMap = new HashMap<>();
|
||||
public static HashMap<String, ImmutablePair<String, ItemStack>> stackMap = new HashMap<>();
|
||||
|
||||
public static final int TAB_WIDTH = 24;
|
||||
public static final int TAB_HEIGHT = 24;
|
||||
private static final Image selectedIcon = new Image(0, 52, 24, 24);
|
||||
private static final Image unselectedIcon = new Image(24, 52, 24, 24);
|
||||
|
||||
private final GuiRecipe guiRecipe;
|
||||
private final IRecipeHandler handler;
|
||||
private final String handlerName;
|
||||
private final String handlerID;
|
||||
|
||||
private boolean selected;
|
||||
|
||||
public abstract int getWidth();
|
||||
public abstract int getHeight();
|
||||
|
||||
public abstract DrawableResource getSelectedTabImage();
|
||||
public abstract DrawableResource getUnselectedTabImage();
|
||||
|
||||
protected abstract int getForegroundIconX();
|
||||
protected abstract int getForegroundIconY();
|
||||
|
||||
|
||||
public GuiRecipeTab(GuiRecipe guiRecipe, IRecipeHandler handler, int x, int y) {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.w = TAB_WIDTH;
|
||||
this.h = TAB_HEIGHT;
|
||||
this.w = getWidth();
|
||||
this.h = getHeight();
|
||||
this.handler = handler;
|
||||
this.handlerName = handler.toString().split("@")[0];
|
||||
this.guiRecipe = guiRecipe;
|
||||
this.selected = false;
|
||||
|
||||
if(handler instanceof TemplateRecipeHandler) {
|
||||
handlerID = (((TemplateRecipeHandler)handler).getOverlayIdentifier());
|
||||
@@ -48,37 +57,37 @@ public class GuiRecipeTab extends Button {
|
||||
handlerID = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(boolean selected, int mouseX, int mouseY) {
|
||||
drawTab(selected, mouseX, mouseY);
|
||||
drawTabIcon(selected, mouseX, mouseY);
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY) {
|
||||
drawBackground(mouseX, mouseY);
|
||||
drawForeground(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void drawTab(boolean selected, int mouseX, int mouseY) {
|
||||
|
||||
public void drawBackground(int mouseX, int mouseY) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
|
||||
if (selected) icon = selectedIcon;
|
||||
else icon = unselectedIcon;
|
||||
|
||||
final int iconX = x + (w - icon.width) / 2;
|
||||
final int iconY = y + (h - icon.height) / 2;
|
||||
LayoutManager.drawIcon(iconX, iconY, icon);
|
||||
|
||||
final DrawableResource image;
|
||||
if (selected) image = getSelectedTabImage();
|
||||
else image = getUnselectedTabImage();
|
||||
|
||||
final int iconX = x + (w - image.getWidth()) / 2;
|
||||
final int iconY = y + (h - image.getHeight()) / 2;
|
||||
image.draw(iconX, iconY);
|
||||
}
|
||||
|
||||
public void drawTabIcon(boolean selected, int mouseX, int mouseY) {
|
||||
final int iconX = x + 4;
|
||||
final int iconY = y + 4;
|
||||
public void drawForeground(int mouseX, int mouseY) {
|
||||
final int iconX = getForegroundIconX();
|
||||
final int iconY = getForegroundIconY();
|
||||
|
||||
final FontRenderer fontRenderer = GuiDraw.fontRenderer;
|
||||
final Image icon = getIcon(handlerName);
|
||||
final DrawableResource icon = getImage(handlerName);
|
||||
|
||||
final ItemStack itemStack = getItemStack(handlerName, handlerID);
|
||||
|
||||
|
||||
|
||||
if (icon != null) {
|
||||
LayoutManager.drawIcon(iconX + 1, iconY + 1, icon);
|
||||
icon.draw(iconX + 1, iconY + 1);
|
||||
} else if (itemStack != null) {
|
||||
GuiContainerManager.drawItems.zLevel += 100;
|
||||
GuiContainerManager.drawItem(iconX, iconY, itemStack);
|
||||
@@ -86,15 +95,14 @@ public class GuiRecipeTab extends Button {
|
||||
} else {
|
||||
// Text fallback
|
||||
String text = handler.getRecipeName().substring(0, 2);
|
||||
int textCenterX = x + (int) (TAB_WIDTH / 2f);
|
||||
int textCenterY = y + (int) (TAB_HEIGHT / 2f) - 3;
|
||||
int color = selected ? 16777120 : 14737632;
|
||||
int textCenterX = x + (int) (getWidth() / 2f);
|
||||
int textCenterY = y + (int) (getHeight() / 2f) - 3;
|
||||
int color = selected ? 0xffffa0 : 0xe0e0e0;
|
||||
fontRenderer.drawStringWithShadow(text, textCenterX - (int) (fontRenderer.getStringWidth(text) / 2f), textCenterY, color);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltips(List<String> tooltip) {
|
||||
tooltip.add(handler.getRecipeName().trim());
|
||||
|
||||
@@ -109,18 +117,17 @@ public class GuiRecipeTab extends Button {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
int newIdx = guiRecipe.currenthandlers.indexOf(handler);
|
||||
if (newIdx == -1)
|
||||
return false;
|
||||
|
||||
guiRecipe.recipetype = newIdx;
|
||||
|
||||
guiRecipe.setRecipePage(newIdx);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isSelected(IRecipeHandler current) {
|
||||
return handler == current;
|
||||
public void setSelected(IRecipeHandler current) {
|
||||
selected = handler == current;
|
||||
}
|
||||
|
||||
public static Pair<String, ItemStack> lookupStackMap(String name, String name2) {
|
||||
@@ -136,7 +143,7 @@ public class GuiRecipeTab extends Button {
|
||||
if (stackRes != null)
|
||||
return stackRes.getLeft();
|
||||
|
||||
Pair<String, Image> iconRes = iconMap.get(name);
|
||||
Pair<String, DrawableResource> iconRes = imageMap.get(name);
|
||||
if (iconRes != null)
|
||||
return iconRes.getLeft();
|
||||
|
||||
@@ -150,8 +157,8 @@ public class GuiRecipeTab extends Button {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Image getIcon(String id) {
|
||||
Pair<String, Image> res = iconMap.get(id);
|
||||
public static DrawableResource getImage(String id) {
|
||||
Pair<String, DrawableResource> res = imageMap.get(id);
|
||||
if (res != null)
|
||||
return res.getRight();
|
||||
return null;
|
||||
@@ -165,8 +172,9 @@ public class GuiRecipeTab extends Button {
|
||||
addToStackMap("codechicken.nei.recipe.FurnaceRecipeHandler", "minecraft", "minecraft:furnace");
|
||||
addToStackMap("codechicken.nei.recipe.ShapedRecipeHandler", "minecraft", "minecraft:crafting_table");
|
||||
addToStackMap("codechicken.nei.recipe.ShapelessRecipeHandler", "minecraft", "minecraft:crafting_table");
|
||||
addToIconMap("codechicken.nei.recipe.FuelRecipeHandler", "minecraft", new Image(80, 36, 14, 14));
|
||||
|
||||
addToIconMap("codechicken.nei.recipe.FuelRecipeHandler", "minecraft",
|
||||
new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 80, 0, 14, 14).build());
|
||||
|
||||
// IC2
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
addToStackMap("ic2.neiIntegration.core.recipehandler.AdvRecipeHandler", "IC2", "IC2:blockreactorvessel");
|
||||
@@ -186,6 +194,10 @@ public class GuiRecipeTab extends Button {
|
||||
addToStackMap("ic2.neiIntegration.core.recipehandler.ScrapboxRecipeHandler", "IC2", "IC2:itemScrapbox");
|
||||
addToStackMap("ic2.neiIntegration.core.recipehandler.SolidCannerRecipeHandler", "IC2", "IC2:blockMachine2:9");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("Ic2Nei")) {
|
||||
addToStackMap("speiger.src.crops.prediction.NEIPlugin", "IC2CropsNEI", "IC2:blockCrop");
|
||||
}
|
||||
|
||||
// Gregtech 5u
|
||||
if (!Loader.isModLoaded("gregapi_post") && Loader.isModLoaded("gregtech")) {
|
||||
@@ -261,32 +273,46 @@ public class GuiRecipeTab extends Button {
|
||||
addToStackMap("gt.recipe.vacuumfreezer", "gregtech", "gregtech:gt.blockmachines:1002"); // gt.blockmachines.multimachine.vacuumfreezer
|
||||
addToStackMap("gt.recipe.wiremill", "gregtech", "gregtech:gt.blockmachines:351"); // gt.blockmachines.basicmachine.wiremill.tier.01
|
||||
addToStackMap("ic.recipe.recycler", "gregtech", "gregtech:gt.blockmachines:331"); // gt.blockmachines.basicmachine.recycler.tier.01
|
||||
|
||||
// // Maybe acid generator
|
||||
// //tabItemIcon.put("null", stackDB("gt.blockmachines.acidgeneratormv"));
|
||||
//
|
||||
// // Maybe not release
|
||||
// tabItemIcon.put("gt.recipe.largenaquadahreactor", stackDB("gt.blockmachines.1nr.controller.single"));
|
||||
// tabItemIcon.put("gt.recipe.fluidnaquadahreactor", stackDB("gt.blockmachines.1nr.controller.single"));
|
||||
// tabItemIcon.put("gt.recipe.hugenaquadahreactor", stackDB("gt.blockmachines.1nr.controller.single"));
|
||||
// tabItemIcon.put("gt.recipe.extrahugenaquadahreactor", stackDB("gt.blockmachines.1nr.controller.single"));
|
||||
addToStackMap("gt.recipe.byproductlist", "gregtech", "gregtech:gt.metaitem.01:2019");
|
||||
addToStackMap("gt.recipe.cncmachine", "gregtech", "gregtech:gt.metaitem.01:23305");
|
||||
addToStackMap("gt.recipe.uuamplifier", "gregtech", "gregtech:gt.metaitem.02:32512");
|
||||
|
||||
addToStackMap("gt.recipe.extremedieselgeneratorfuel", "gregtech", "gregtech:gt.blockmachines:1171");
|
||||
addToStackMap("gt.recipe.largenaquadahreactor", "gregtech", "gregtech:gt.blockmachines:97");
|
||||
addToStackMap("gt.recipe.fluidnaquadahreactor", "gregtech", "gregtech:gt.blockmachines:97");
|
||||
addToStackMap("gt.recipe.hugenaquadahreactor", "gregtech", "gregtech:gt.blockmachines:97");
|
||||
addToStackMap("gt.recipe.extrahugenaquadahreactor", "gregtech", "gregtech:gt.blockmachines:97");
|
||||
addToStackMap("gt.recipe.rocketenginefuel", "gregtech", "GalaxySpace:item.Tier8Rocket");
|
||||
addToStackMap("gt.recipe.RTGgenerators", "gregtech", "IC2:itemRTGPellet");
|
||||
addToStackMap("gt.recipe.componentassembler", "gregtech", "gregtech:gt.blockmachines:211");
|
||||
addToStackMap("bw.fuels.acidgens", "gregtech", "gregtech:gt.blockmachines:12726");
|
||||
addToStackMap("bw.recipe.cal", "gregtech", "gregtech:gt.blockmachines:12735");
|
||||
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("appliedenergistics2")) {
|
||||
|
||||
addToStackMap("appeng.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler", "AppliedEnergistics2","appliedenergistics2:item.ItemMultiPart:380");
|
||||
addToStackMap("appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler","AppliedEnergistics2", "appliedenergistics2:item.ItemMultiPart:380");
|
||||
addToStackMap("appeng.integration.modules.NEIHelpers.NEIFacadeRecipeHandler", "AppliedEnergistics2", "appliedenergistics2:item.ItemFacade:192");
|
||||
addToStackMap("appeng.integration.modules.NEIHelpers.NEIGrinderRecipeHandler", "AppliedEnergistics2","appliedenergistics2:item.ItemMultiMaterial:8");
|
||||
addToStackMap("appeng.integration.modules.NEIHelpers.NEIInscriberRecipeHandler", "AppliedEnergistics2", "appliedenergistics2:tile.BlockInscriber");
|
||||
addToStackMap("appeng.integration.modules.NEIHelpers.NEIWorldCraftingHandler", "AppliedEnergistics2", "appliedenergistics2:item.ItemMultiMaterial:9");
|
||||
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
addToStackMap("li.cil.oc.integration.nei.ManualUsageHandler", "OpenComputers", "OpenComputers:item:98");
|
||||
addToStackMap("li.cil.oc.integration.nei.CallbackDocHandler", "OpenComputers", "OpenComputers:item:98");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("AdvancedSolarPanel")) {
|
||||
addToStackMap("advsolar.client.nei.MTRecipeHandler", "AdvancedSolarPanel", "AdvancedSolarPanel:BlockMolecularTransformer");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("AromaBackup")) {
|
||||
addToStackMap("aroma1997.core.recipes.nei.ShapedAromicRecipeHandler", "AromaBackup", "minecraft:crafting_table");
|
||||
addToStackMap("aroma1997.core.recipes.nei.ShapelessAromicRecipeHandler", "AromaBackup", "minecraft:crafting_table");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("WitcheryExtras")) {
|
||||
addToStackMap("alkalus.main.nei.NEI_Handler_Cauldron", "witchery", "witchery:cauldron");
|
||||
addToStackMap("alkalus.main.nei.NEI_Handler_Distillery", "witchery", "witchery:distilleryidle");
|
||||
@@ -304,6 +330,7 @@ public class GuiRecipeTab extends Button {
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("Thaumcraft")) {
|
||||
addToStackMap("com.djgiannuzz.thaumcraftneiplugin.nei.recipehandler.ArcaneShapedRecipeHandler", "Thaumcraft", "Thaumcraft:blockTable:15");
|
||||
addToStackMap("com.djgiannuzz.thaumcraftneiplugin.nei.recipehandler.ArcaneShapelessRecipeHandler", "Thaumcraft", "Thaumcraft:blockTable:15");
|
||||
addToStackMap("com.djgiannuzz.thaumcraftneiplugin.nei.recipehandler.CrucibleRecipeHandler", "Thaumcraft", "Thaumcraft:blockMetalDevice");
|
||||
addToStackMap("com.djgiannuzz.thaumcraftneiplugin.nei.recipehandler.InfusionRecipeHandler", "Thaumcraft", "Thaumcraft:blockStoneDevice:2");
|
||||
@@ -469,7 +496,7 @@ public class GuiRecipeTab extends Button {
|
||||
addToStackMap("tconstruct.plugins.nei.RecipeHandlerCastingTable", "Tinker's Construct", "TConstruct:SearedBlock");
|
||||
addToStackMap("tconstruct.plugins.nei.RecipeHandlerDryingRack", "Tinker's Construct", "TConstruct:Armor.DryingRack");
|
||||
addToStackMap("tconstruct.plugins.nei.RecipeHandlerMelting", "Tinker's Construct", "TConstruct:LavaTank:2");
|
||||
addToStackMap("tconstruct.plugins.nei.RecipeHandlerToolMaterials", "Tinker's Construct", "TConstruct:pickaxe");
|
||||
addToStackMap("tconstruct.plugins.nei.RecipeHandlerToolMaterials", "Tinker's Construct", "TConstruct:ToolStationBlock");
|
||||
}
|
||||
if (Loader.isModLoaded("chisel")) {
|
||||
addToStackMap("team.chisel.compat.nei.RecipeHandlerChisel", "Chisel", "chisel:chisel");
|
||||
@@ -487,7 +514,7 @@ public class GuiRecipeTab extends Button {
|
||||
addToStackMap("tonius.neiintegration.mods.mcforge.RecipeHandlerOreDictionary", "Minecraft", "minecraft:iron_ore");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("GalacticraftCoRailcraftre")) {
|
||||
if (Loader.isModLoaded("Railcraft")) {
|
||||
addToStackMap("tonius.neiintegration.mods.railcraft.RecipeHandlerBlastFurnace", "Railcraft", "Railcraft:machine.alpha:12");
|
||||
addToStackMap("tonius.neiintegration.mods.railcraft.RecipeHandlerCokeOven", "Railcraft", "Railcraft:machine.alpha:7");
|
||||
addToStackMap("tonius.neiintegration.mods.railcraft.RecipeHandlerRockCrusher", "Railcraft", "Railcraft:machine.alpha:15");
|
||||
@@ -508,7 +535,7 @@ public class GuiRecipeTab extends Button {
|
||||
addToStackMap("witchinggadgets.client.nei.NEISpinningWheelHandler", "WitchingGadgets", "WitchingGadgets:WG_WoodenDevice");
|
||||
}
|
||||
/* Witchery */
|
||||
{
|
||||
if (Loader.isModLoaded("witchery")) {
|
||||
addToStackMap("com.emoniph.witchery.integration.NEICauldronRecipeHandler", "witchery", "witchery:cauldron");
|
||||
addToStackMap("com.emoniph.witchery.integration.NEISpinningWheelRecipeHandler", "witchery", "witchery:spinningwheel");
|
||||
addToStackMap("com.emoniph.witchery.integration.NEIWitchesOvenRecipeHandler", "witchery", "witchery:witchesovenidle");
|
||||
@@ -531,7 +558,8 @@ public class GuiRecipeTab extends Button {
|
||||
final ItemStack itemStack;
|
||||
int meta = -1;
|
||||
if (!item_id.contains(":")) {
|
||||
throw new IllegalArgumentException("Item ID missing colon");
|
||||
NEIClientConfig.logger.info("Item ID missing colon for handler " + handler + " - " + modname);
|
||||
return;
|
||||
}
|
||||
final String[] split = item_id.split(":");
|
||||
item_id = split[0] + ":" + split[1];
|
||||
@@ -555,9 +583,9 @@ public class GuiRecipeTab extends Button {
|
||||
if (itemStack != null)
|
||||
stackMap.put(handler, new ImmutablePair<>(modname, itemStack));
|
||||
else
|
||||
System.out.println("Couldn't find " + modname + " - " + item_id);
|
||||
NEIClientConfig.logger.info("Couldn't find " + modname + " - " + item_id);
|
||||
}
|
||||
private static void addToIconMap(String handler, String modid, Image image) {
|
||||
iconMap.put(handler, new ImmutablePair<>(modid, image));
|
||||
private static void addToIconMap(String handler, String modname, DrawableResource image) {
|
||||
imageMap.put(handler, new ImmutablePair<>(modname, image));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
|
||||
public class GuiRecipeTabCreative extends GuiRecipeTab {
|
||||
public static final int TAB_WIDTH = 28;
|
||||
public static final int TAB_HEIGHT = 31;
|
||||
private static final DrawableResource selectedTabImage = new DrawableBuilder("minecraft:textures/gui/container/creative_inventory/tabs.png", 28, 32, 28, 32).build();
|
||||
private static final DrawableResource unselectedTabImage = new DrawableBuilder("minecraft:textures/gui/container/creative_inventory/tabs.png", 28, 0, 28, 30).build();
|
||||
|
||||
public GuiRecipeTabCreative(GuiRecipe guiRecipe, IRecipeHandler handler, int x, int y) {
|
||||
super(guiRecipe, handler, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return TAB_WIDTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return TAB_HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getForegroundIconX() {
|
||||
return x + (w - 16) / 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getForegroundIconY() {
|
||||
return y + h - 22;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawableResource getSelectedTabImage() {
|
||||
return selectedTabImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawableResource getUnselectedTabImage() {
|
||||
return unselectedTabImage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
|
||||
public class GuiRecipeTabJEI extends GuiRecipeTab {
|
||||
public static final int TAB_WIDTH = 24;
|
||||
public static final int TAB_HEIGHT = 24;
|
||||
private static final DrawableResource selectedTabImage = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 0, 16, 24, 24).build();
|
||||
private static final DrawableResource unselectedTabImage = new DrawableBuilder("nei:textures/nei_tabbed_sprites.png", 24, 16, 24, 24).build();
|
||||
|
||||
public GuiRecipeTabJEI(GuiRecipe guiRecipe, IRecipeHandler handler, int x, int y) {
|
||||
super(guiRecipe, handler, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return TAB_WIDTH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return TAB_HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getForegroundIconX() {
|
||||
return x + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getForegroundIconY() {
|
||||
return y + 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawableResource getSelectedTabImage() {
|
||||
return selectedTabImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DrawableResource getUnselectedTabImage() {
|
||||
return unselectedTabImage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,9 @@ package codechicken.nei.recipe;
|
||||
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,23 +14,37 @@ public class GuiRecipeTabs {
|
||||
private final List<Button> buttons = new ArrayList<>();
|
||||
|
||||
private final Rectangle area = new Rectangle();
|
||||
private boolean creative_tab_style;
|
||||
|
||||
private int pageCount = 1;
|
||||
private int pageNumber = 0;
|
||||
private int categoriesPerPage = 1;
|
||||
private int numHandlers = 1;
|
||||
private int tabWidth;
|
||||
private int tabHeight;
|
||||
|
||||
public GuiRecipeTabs(GuiRecipe guiRecipe) {
|
||||
this.guiRecipe = guiRecipe;
|
||||
}
|
||||
|
||||
public void initLayout() {
|
||||
creative_tab_style = NEIClientConfig.useCreativeTabStyle();
|
||||
if(creative_tab_style) {
|
||||
tabWidth = GuiRecipeTabCreative.TAB_WIDTH;
|
||||
tabHeight = GuiRecipeTabCreative.TAB_HEIGHT;
|
||||
} else {
|
||||
tabWidth = GuiRecipeTabJEI.TAB_WIDTH;
|
||||
tabHeight = GuiRecipeTabJEI.TAB_HEIGHT;
|
||||
|
||||
}
|
||||
|
||||
int totalWidth = 0;
|
||||
categoriesPerPage = 0;
|
||||
numHandlers = guiRecipe.currenthandlers.size();
|
||||
|
||||
for (IRecipeHandler handler : guiRecipe.currenthandlers) {
|
||||
if (totalWidth + GuiRecipeTab.TAB_WIDTH < (guiRecipe.xSize - 4)) {
|
||||
totalWidth += GuiRecipeTab.TAB_WIDTH;
|
||||
if (totalWidth + tabWidth < (guiRecipe.xSize - 4)) {
|
||||
totalWidth += tabWidth;
|
||||
categoriesPerPage++;
|
||||
} else {
|
||||
break;
|
||||
@@ -37,9 +52,9 @@ public class GuiRecipeTabs {
|
||||
}
|
||||
|
||||
area.width = totalWidth;
|
||||
area.height = GuiRecipeTab.TAB_HEIGHT;
|
||||
area.x = guiRecipe.guiLeft + 2;
|
||||
area.y = guiRecipe.guiTop - GuiRecipeTab.TAB_HEIGHT + 3;
|
||||
area.height = tabHeight;
|
||||
area.x = guiRecipe.guiLeft + 4;
|
||||
area.y = guiRecipe.guiTop - tabHeight + 3;
|
||||
|
||||
pageCount = (int) Math.ceil((float) numHandlers / categoriesPerPage);
|
||||
calcPageNumber();
|
||||
@@ -56,51 +71,58 @@ public class GuiRecipeTabs {
|
||||
tabs.clear();
|
||||
buttons.clear();
|
||||
|
||||
int tabX = area.x;
|
||||
|
||||
final int startIndex = pageNumber * categoriesPerPage;
|
||||
for (int i = 0 ; i < categoriesPerPage ; i++) {
|
||||
final int index = i + startIndex;
|
||||
if (index >= numHandlers) break;
|
||||
IRecipeHandler handler = guiRecipe.currenthandlers.get(index);
|
||||
tabs.add(new GuiRecipeTab(guiRecipe, handler, tabX, area.y));
|
||||
tabX += GuiRecipeTab.TAB_WIDTH;
|
||||
int tabX = area.x + (i * tabWidth);
|
||||
|
||||
if(NEIClientConfig.useCreativeTabStyle())
|
||||
tabs.add(new GuiRecipeTabCreative(guiRecipe, handler, tabX, area.y));
|
||||
else
|
||||
tabs.add(new GuiRecipeTabJEI(guiRecipe, handler, tabX, area.y));
|
||||
}
|
||||
|
||||
// Maybe add buttons
|
||||
if (numHandlers > categoriesPerPage) {
|
||||
Button prevTab = new Button("prevTab") {
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) return previousPage();
|
||||
else return false;
|
||||
public boolean onButtonPress(boolean rightClick) {
|
||||
if (!rightClick) {
|
||||
NEIClientUtils.playClickSound();
|
||||
return previousPage();
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public String getRenderLabel() {
|
||||
return "<";
|
||||
}
|
||||
};
|
||||
prevTab.x = area.x - 7;
|
||||
prevTab.y = area.y + 2;
|
||||
prevTab.h = 20;
|
||||
prevTab.w = 8;
|
||||
prevTab.h = tabHeight - 4;
|
||||
prevTab.x = area.x - prevTab.w + 1;
|
||||
prevTab.y = area.y + 2;
|
||||
buttons.add(prevTab);
|
||||
|
||||
Button nextTab = new Button("nextTab") {
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if(!rightclick) return nextPage();
|
||||
else return false;
|
||||
if (!rightclick) {
|
||||
NEIClientUtils.playClickSound();
|
||||
return nextPage();
|
||||
} else return false;
|
||||
}
|
||||
@Override
|
||||
public String getRenderLabel() {
|
||||
return ">";
|
||||
}
|
||||
};
|
||||
nextTab.x = area.x + area.width;
|
||||
nextTab.y = area.y + 2;
|
||||
nextTab.h = 20;
|
||||
nextTab.w = 8;
|
||||
nextTab.w = prevTab.w;
|
||||
nextTab.h = prevTab.h;
|
||||
nextTab.x = area.x + area.width - 1;
|
||||
nextTab.y = prevTab.y;
|
||||
buttons.add(nextTab);
|
||||
}
|
||||
}
|
||||
@@ -133,8 +155,8 @@ public class GuiRecipeTabs {
|
||||
public void draw(int mouseX, int mouseY) {
|
||||
IRecipeHandler current = guiRecipe.currenthandlers.get(guiRecipe.recipetype);
|
||||
for (GuiRecipeTab tab : tabs) {
|
||||
boolean selected = tab.isSelected(current);
|
||||
tab.draw(selected, mouseX, mouseY);
|
||||
tab.setSelected(current);
|
||||
tab.draw(mouseX, mouseY);
|
||||
}
|
||||
for (Button button : buttons) {
|
||||
button.draw(mouseX, mouseY);
|
||||
|
||||
Reference in new issue
Block a user