Files
CustomNPC-Plus/src/main/java/noppes/npcs/client/gui/util/GuiNPCInterface2.java
T

69 lines
1.8 KiB
Java
Raw Normal View History

2018-09-13 12:03:28 -04:00
package noppes.npcs.client.gui.util;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.entity.EntityNPCInterface;
import org.lwjgl.opengl.GL11;
2025-03-13 17:14:45 -04:00
public abstract class GuiNPCInterface2 extends GuiNPCInterface {
private ResourceLocation background = new ResourceLocation("customnpcs:textures/gui/menubg.png");
private GuiNpcMenu menu;
2024-03-12 17:19:54 -04:00
2025-03-13 17:14:45 -04:00
public GuiNPCInterface2(EntityNPCInterface npc) {
this(npc, -1);
2018-09-13 12:03:28 -04:00
}
2025-03-13 17:14:45 -04:00
public GuiNPCInterface2(EntityNPCInterface npc, int activeMenu) {
super(npc);
xSize = 420;
ySize = 200;
menu = new GuiNpcMenu(this, activeMenu, npc);
2025-11-05 17:25:14 -05:00
closeOnEsc = true;
2018-09-13 12:03:28 -04:00
}
2025-03-13 17:14:45 -04:00
2018-09-13 12:03:28 -04:00
@Override
2025-03-13 17:14:45 -04:00
public void initGui() {
super.initGui();
2018-09-13 12:03:28 -04:00
menu.initGui(guiLeft, guiTop, xSize);
}
2024-03-12 17:19:54 -04:00
2018-09-13 12:03:28 -04:00
@Override
2025-03-13 17:14:45 -04:00
public void mouseClicked(int i, int j, int k) {
if (!hasSubGui())
menu.mouseClicked(i, j, k);
2024-03-12 17:19:54 -04:00
super.mouseClicked(i, j, k);
}
2025-03-13 17:14:45 -04:00
public void delete() {
npc.delete();
2018-09-13 12:03:28 -04:00
displayGuiScreen(null);
mc.setIngameFocus();
}
2025-03-13 17:14:45 -04:00
2018-09-13 12:03:28 -04:00
public abstract void save();
2024-03-12 17:19:54 -04:00
2018-09-13 12:03:28 -04:00
@Override
2025-03-13 17:14:45 -04:00
public void drawScreen(int i, int j, float f) {
if (drawDefaultBackground)
drawDefaultBackground(); //drawDefaultBackground
drawBackground();
2018-09-13 12:03:28 -04:00
menu.drawElements(getFontRenderer(), i, j, mc, f);
2024-03-12 17:19:54 -04:00
2018-09-13 12:03:28 -04:00
boolean bo = drawDefaultBackground;
drawDefaultBackground = false;
super.drawScreen(i, j, f);
drawDefaultBackground = bo;
}
@Override
protected void drawBackground() {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(background);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 200, 220);
2025-03-13 17:14:45 -04:00
drawTexturedModalRect(guiLeft + xSize - 230, guiTop, 26, 0, 230, 220);
}
2023-11-08 22:38:45 -05:00
2025-03-13 17:14:45 -04:00
protected GuiNpcMenu getMenu() {
2023-11-08 22:38:45 -05:00
return this.menu;
}
2018-09-13 12:03:28 -04:00
}