mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-20 20:22:17 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c36d0625e | ||
|
|
5bfcc73459 | ||
|
|
bc1dd44c41 | ||
|
|
d2de8af64c |
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-beta2
|
||||
mod_version=2.1.0-GTNH-beta4
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,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();
|
||||
@@ -142,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
|
||||
|
||||
@@ -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) {
|
||||
@@ -211,6 +243,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
recipetype = 0;
|
||||
page = 0;
|
||||
recipeTabs.calcPageNumber();
|
||||
checkGregTech();
|
||||
}
|
||||
|
||||
private void overlayRecipe(int recipe) {
|
||||
@@ -235,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);
|
||||
@@ -258,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);
|
||||
@@ -284,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);
|
||||
@@ -305,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);
|
||||
@@ -313,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);
|
||||
@@ -336,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,6 +2,7 @@ package codechicken.nei.recipe;
|
||||
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.drawable.DrawableBuilder;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
@@ -272,9 +273,9 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
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
|
||||
addToStackMap("gt.recipe.byproductlist", "gregtech", "");
|
||||
addToStackMap("gt.recipe.cncmachine", "gregtech", "");
|
||||
addToStackMap("gt.recipe.uuamplifier", "gregtech", "");
|
||||
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");
|
||||
@@ -300,7 +301,7 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
addToStackMap("li.cil.oc.integration.nei.ManualUsageHandler", "OpenComputers", "OpenComputers:item:98");
|
||||
addToStackMap("li.cil.oc.integration.nei.CallbackDocHandler", "OpenComputers", "");
|
||||
addToStackMap("li.cil.oc.integration.nei.CallbackDocHandler", "OpenComputers", "OpenComputers:item:98");
|
||||
}
|
||||
|
||||
if (Loader.isModLoaded("AdvancedSolarPanel")) {
|
||||
@@ -534,7 +535,7 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
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");
|
||||
@@ -557,7 +558,8 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
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];
|
||||
@@ -581,7 +583,7 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
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 modname, DrawableResource image) {
|
||||
imageMap.put(handler, new ImmutablePair<>(modname, image));
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GuiRecipeTabs {
|
||||
};
|
||||
prevTab.w = 8;
|
||||
prevTab.h = tabHeight - 4;
|
||||
prevTab.x = area.x - prevTab.w;
|
||||
prevTab.x = area.x - prevTab.w + 1;
|
||||
prevTab.y = area.y + 2;
|
||||
buttons.add(prevTab);
|
||||
|
||||
@@ -121,7 +121,7 @@ public class GuiRecipeTabs {
|
||||
};
|
||||
nextTab.w = prevTab.w;
|
||||
nextTab.h = prevTab.h;
|
||||
nextTab.x = area.x + area.width;
|
||||
nextTab.x = area.x + area.width - 1;
|
||||
nextTab.y = prevTab.y;
|
||||
buttons.add(nextTab);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user