mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 05:02:25 +00:00
hide NEI items under EIO GUI tabs
This commit is contained in:
1 parent
10af591cee
commit
8bd0310e96
3 files changed
+79
-5
No files matched your search
@@ -8,6 +8,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -27,6 +28,8 @@ import crazypants.enderio.gui.IconEIO;
|
||||
import crazypants.gui.GuiContainerBase;
|
||||
import crazypants.render.RenderUtil;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
public class GuiExternalConnection extends GuiContainerBase {
|
||||
|
||||
private static final int TAB_HEIGHT = 24;
|
||||
@@ -69,9 +72,9 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
ySize = 166 + 29;
|
||||
xSize = 206;
|
||||
|
||||
getContainer().setInputSlotsVisible(false);
|
||||
getContainer().setOutputSlotsVisible(false);
|
||||
getContainer().setInventorySlotsVisible(false);
|
||||
container.setInputSlotsVisible(false);
|
||||
container.setOutputSlotsVisible(false);
|
||||
container.setInventorySlotsVisible(false);
|
||||
|
||||
List<IConduit> cons = new ArrayList<IConduit>(bundle.getConduits());
|
||||
Collections.sort(cons, new Comparator<IConduit>() {
|
||||
@@ -94,6 +97,7 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
|
||||
for (IConduit con : cons) {
|
||||
if(con.containsExternalConnection(dir) || con.canConnectToExternal(dir, true)) {
|
||||
@SuppressWarnings("LeakingThisInConstructor")
|
||||
ITabPanel tab = TabFactory.instance.createPanelForConduit(this, con);
|
||||
if(tab != null) {
|
||||
conduits.add(con);
|
||||
@@ -205,4 +209,18 @@ public class GuiExternalConnection extends GuiContainerBase {
|
||||
return container;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public boolean hideItemPanelSlot(GuiContainer gc, int x, int y, int w, int h) {
|
||||
if(tabs.size() > 0) {
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
int tabX = sx + xSize - 3;
|
||||
int tabY = sy + tabYOffset;
|
||||
|
||||
return (x+w) >= tabX && x < (tabX + 14) && (y+h) >= tabY && y < (tabY + tabs.size()*TAB_HEIGHT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,11 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IGuiOverlay;
|
||||
import crazypants.enderio.gui.ITabPanel;
|
||||
@@ -24,7 +27,7 @@ public class GuiTransceiver extends GuiPoweredMachineBase<TileTransceiver> {
|
||||
|
||||
private int activeTab = 0;
|
||||
private final List<ITabPanel> tabs = new ArrayList<ITabPanel>();
|
||||
private int tabYOffset = 4;
|
||||
private final int tabYOffset = 4;
|
||||
GeneralTab generalTab;
|
||||
|
||||
public GuiTransceiver(InventoryPlayer par1InventoryPlayer, TileTransceiver te) {
|
||||
@@ -233,4 +236,18 @@ public class GuiTransceiver extends GuiPoweredMachineBase<TileTransceiver> {
|
||||
public ContainerTransceiver getContainer() {
|
||||
return (ContainerTransceiver) inventorySlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public boolean hideItemPanelSlot(GuiContainer gc, int x, int y, int w, int h) {
|
||||
if(tabs.size() > 0) {
|
||||
int sx = (width - xSize) / 2;
|
||||
int sy = (height - ySize) / 2;
|
||||
int tabX = sx + xSize - 3;
|
||||
int tabY = sy + tabYOffset;
|
||||
|
||||
return (x+w) >= tabX && x < (tabX + 14) && (y+h) >= tabY && y < (tabY + tabs.size()*TAB_HEIGHT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package crazypants.gui;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,12 +19,21 @@ import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.gui.IGuiOverlay;
|
||||
import crazypants.gui.ToolTipManager.ToolTipRenderer;
|
||||
|
||||
public abstract class GuiContainerBase extends GuiContainer implements ToolTipRenderer, IGuiScreen {
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
|
||||
})
|
||||
public abstract class GuiContainerBase extends GuiContainer implements ToolTipRenderer, IGuiScreen, INEIGuiHandler {
|
||||
|
||||
protected ToolTipManager ttMan = new ToolTipManager();
|
||||
protected List<IGuiOverlay> overlays = new ArrayList<IGuiOverlay>();
|
||||
@@ -330,4 +340,33 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
|
||||
actionPerformed(guiButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public VisiblityData modifyVisiblity(GuiContainer gc, VisiblityData vd) {
|
||||
return vd;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gc, ItemStack is) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gc) {
|
||||
return Collections.<TaggedInventoryArea>emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public boolean handleDragNDrop(GuiContainer gc, int i, int i1, ItemStack is, int i2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "NotEnoughItems")
|
||||
public boolean hideItemPanelSlot(GuiContainer gc, int x, int y, int w, int h) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user