Created
April 22, 2015 20:05
-
-
Save marchermans/001137436b0073f6f7b9 to your computer and use it in GitHub Desktop.
NEI Gui Handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.Orion.Armory.Client.GUI.Plugins.NEI; | |
import codechicken.nei.api.API; | |
import codechicken.nei.api.IConfigureNEI; | |
import com.Orion.Armory.Armory; | |
import com.Orion.Armory.Common.Registry.GeneralRegistry; | |
import com.Orion.Armory.Util.References; | |
/** | |
* Created by Orion | |
* Created on 22.04.2015 | |
* 21:41 | |
* <p/> | |
* Copyrighted according to Project specific license | |
*/ | |
public class NEIConfigHandler implements IConfigureNEI { | |
@Override | |
public void loadConfig() { | |
GeneralRegistry.iLogger.info("Initializing NEI Compatibility."); | |
API.registerNEIGuiHandler(new NEIGuiTabHandler()); | |
} | |
@Override | |
public String getName() { | |
return References.General.MOD_ID + " NEI - GUI Handler"; | |
} | |
@Override | |
public String getVersion() { | |
return References.General.MC_VERSION + "-" + References.General.VERSION; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.Orion.Armory.Client.GUI.Plugins.NEI; | |
import codechicken.lib.vec.Rectangle4i; | |
import codechicken.nei.api.INEIGuiAdapter; | |
import codechicken.nei.api.INEIGuiHandler; | |
import com.Orion.Armory.Client.GUI.ArmoryBaseGui; | |
import net.minecraft.client.gui.inventory.GuiContainer; | |
import org.lwjgl.Sys; | |
/** | |
* Created by Orion | |
* Created on 22.04.2015 | |
* 21:42 | |
* <p/> | |
* Copyrighted according to Project specific license | |
*/ | |
public class NEIGuiTabHandler extends INEIGuiAdapter | |
{ | |
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) { | |
Rectangle4i rect; | |
if ((gui instanceof ArmoryBaseGui)) { | |
ArmoryBaseGui abg = (ArmoryBaseGui) gui; | |
rect = new Rectangle4i(x, y, w, h); | |
for (ArmoryBaseGui.Ledger Ledger : abg.Ledgers().getLeftLedgers()) { | |
Rectangle4i bounds = new Rectangle4i(Ledger.iLastXOrigin + Ledger.getOriginOffSet(), Ledger.iLastYOrigin, Ledger.getWidth(), Ledger.getHeight()); | |
if (bounds.intersects(rect)) { | |
return true; | |
} | |
} | |
for (ArmoryBaseGui.Ledger Ledger : abg.Ledgers().getRightLedgers()) { | |
Rectangle4i bounds = new Rectangle4i(Ledger.iLastXOrigin + Ledger.getOriginOffSet(), Ledger.iLastYOrigin, Ledger.getWidth(), Ledger.getHeight()); | |
if (bounds.intersects(rect)) { | |
return true; | |
} | |
} | |
Rectangle4i bounds = new Rectangle4i(abg.guiLeft, gui.guiTop, ((ArmoryBaseGui) gui).width, ((ArmoryBaseGui) gui).height); | |
if (bounds.intersects(rect)) { | |
return true; | |
} | |
} | |
System.out.println("Not intersecting"); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment