Files
NotEnoughItems/src/main/java/codechicken/nei/GuiExtendedCreativeInv.java
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
2.3 KiB
Java
Raw Normal View History

2014-04-29 10:54:20 +10:00
package codechicken.nei;
2023-09-25 00:35:24 +02:00
import java.util.Collections;
import java.util.List;
2014-04-29 10:54:20 +10:00
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Container;
2022-05-06 22:41:45 +03:00
import net.minecraft.inventory.Slot;
2014-04-29 10:54:20 +10:00
import net.minecraft.item.ItemStack;
2023-09-25 00:35:24 +02:00
2014-04-29 10:54:20 +10:00
import org.lwjgl.opengl.GL11;
2023-09-25 00:35:24 +02:00
import codechicken.lib.render.CCRenderState;
import codechicken.lib.vec.Rectangle4i;
2024-08-17 23:24:27 +03:00
import codechicken.nei.AutoFocusWidget.INEIAutoFocusSearchEnable;
2023-09-25 00:35:24 +02:00
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandler, INEIAutoFocusSearchEnable {
2014-04-29 10:54:20 +10:00
public GuiExtendedCreativeInv(Container par1Container) {
super(par1Container);
ySize = 198;
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
GL11.glColor4f(1, 1, 1, 1);
CCRenderState.changeTexture("nei:textures/gui/inv.png");
int x = guiLeft;
int y = guiTop - 4;
drawTexturedModalRect(x - 23, y, 0, 0, 199, 204);
}
@Override
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
return currentVisibility;
}
@Override
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
return NEIServerUtils.getRange(0, 54);
}
@Override
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
2019-12-30 20:19:16 -08:00
return Collections.singletonList(new TaggedInventoryArea("ExtendedCreativeInv", 0, 54, inventorySlots));
2014-04-29 10:54:20 +10:00
}
@Override
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
return false;
}
@Override
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
2022-05-06 22:41:45 +03:00
return (new Rectangle4i(guiLeft - 15, guiTop + 18, 18, 18 * 4 + 4)).intersects(new Rectangle4i(x, y, w, h));
2014-04-29 10:54:20 +10:00
}
2022-05-06 22:41:45 +03:00
@Override
2024-08-29 20:07:14 +02:00
protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType) {
2022-05-06 22:41:45 +03:00
// Hack for armor slots, because they are outside the container
2024-08-29 20:07:14 +02:00
if (slotIn != null && clickType == 4 && slotIn.xDisplayPosition < 0) {
clickType = 0;
2022-05-06 22:41:45 +03:00
}
2024-08-29 20:07:14 +02:00
super.handleMouseClick(slotIn, slotId, clickedButton, clickType);
2022-05-06 22:41:45 +03:00
}
2014-04-29 10:54:20 +10:00
}