mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 16:09:05 +00:00
Added right-hand side buttons and item images to side buttons.
Added rhs side buttons to the quest gui. used to go into the party menu
This commit is contained in:
1 parent
eaf146c61f
commit
ba30c6e094
4 files changed
+138
-7
No files matched your search
@@ -0,0 +1,78 @@
|
||||
package noppes.npcs.client.gui.player;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.client.tabs.InventoryTabQuests;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
|
||||
public class GuiParty extends GuiNPCInterface implements IGuiData {
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
private final EntityPlayer player;
|
||||
|
||||
public GuiParty(EntityPlayer player) {
|
||||
super();
|
||||
this.player = player;
|
||||
xSize = 280;
|
||||
ySize = 180;
|
||||
drawDefaultBackground = false;
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabQuests.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f){
|
||||
drawDefaultBackground();
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
if (i == 1 || i == mc.gameSettings.keyBindInventory.getKeyCode()) // inventory key
|
||||
{
|
||||
mc.displayGuiScreen(null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
this.save();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,10 +2,14 @@ package noppes.npcs.client.gui.player;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.QuestLogData;
|
||||
@@ -19,6 +23,7 @@ import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
import tconstruct.client.tabs.InventoryTabQuests;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
|
||||
@@ -36,6 +41,9 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
|
||||
private boolean noQuests = false;
|
||||
private boolean questDetails = true;
|
||||
|
||||
private GuiMenuSideButton questsButton;
|
||||
private GuiMenuSideButton partyButton;
|
||||
|
||||
private HashMap<String,String> questAlertsOnOpen;
|
||||
private String trackedQuestKeyOnOpen;
|
||||
|
||||
@@ -79,6 +87,17 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
|
||||
}
|
||||
sideButtons.get(categories.indexOf(data.selectedCategory)).active = true;
|
||||
|
||||
this.questsButton = new GuiMenuSideButton(100,guiLeft + xSize + 37, this.guiTop + 3, 22, 22, "");
|
||||
this.questsButton.rightSided = true;
|
||||
this.questsButton.active = true;
|
||||
this.questsButton.renderStack = new ItemStack(CustomItems.letter);
|
||||
addButton(this.questsButton);
|
||||
|
||||
this.partyButton = new GuiMenuSideButton(101,guiLeft + xSize + 37, this.guiTop + 3 + 21, 22, 22, "");
|
||||
this.partyButton.rightSided = true;
|
||||
this.partyButton.renderStack = new ItemStack(CustomItems.bag);
|
||||
addButton(this.partyButton);
|
||||
|
||||
if(scroll == null)
|
||||
scroll = new GuiCustomScroll(this,0);
|
||||
|
||||
|
||||
@@ -2,20 +2,27 @@ package noppes.npcs.client.gui.util;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
public class GuiMenuSideButton extends GuiNpcButton{
|
||||
public static final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/menusidebutton.png");
|
||||
public static final ResourceLocation resource2 = new ResourceLocation("customnpcs","textures/gui/menusidebutton2.png");
|
||||
|
||||
public boolean active;
|
||||
public boolean rightSided;
|
||||
public ItemStack renderStack;
|
||||
|
||||
public GuiMenuSideButton(int i, int j, int k, String s){
|
||||
this(i, j, k, 200, 20, s);
|
||||
public GuiMenuSideButton(int id, int x, int y, String s){
|
||||
this(id, x, y, 200, 20, s);
|
||||
}
|
||||
|
||||
public GuiMenuSideButton(int i, int j, int k, int l, int i1, String s){
|
||||
super(i, j, k, l, i1, s);
|
||||
public GuiMenuSideButton(int id, int x, int y, int width, int height, String s){
|
||||
super(id, x, y, width, height, s);
|
||||
active = false;
|
||||
}
|
||||
|
||||
@@ -23,7 +30,7 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
public int getHoverState(boolean flag){
|
||||
if (active)
|
||||
return 0;
|
||||
return 1;
|
||||
return super.getHoverState(flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -32,13 +39,38 @@ public class GuiMenuSideButton extends GuiNpcButton{
|
||||
return;
|
||||
}
|
||||
FontRenderer fontrenderer = minecraft.fontRenderer;
|
||||
minecraft.renderEngine.bindTexture(resource);
|
||||
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
int width = this.width + (active?2:0);
|
||||
field_146123_n = i >= xPosition && j >= yPosition && i < xPosition + width && j < yPosition + height;
|
||||
int k = getHoverState(field_146123_n);
|
||||
drawTexturedModalRect(xPosition, yPosition, 0, k * 22, width, height);
|
||||
|
||||
if (this.rightSided) {
|
||||
minecraft.renderEngine.bindTexture(resource2);
|
||||
drawTexturedModalRect(xPosition, yPosition, 197 - width, k * 22, width, height);
|
||||
} else {
|
||||
minecraft.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(xPosition, yPosition, 0, k * 22, width, height);
|
||||
}
|
||||
mouseDragged(minecraft, i, j);
|
||||
|
||||
if (this.renderStack != null) {
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
this.zLevel = 100.0F;
|
||||
RenderItem itemRenderer = RenderItem.getInstance();
|
||||
itemRenderer.zLevel = 100.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
itemRenderer.renderItemAndEffectIntoGUI(minecraft.fontRenderer,
|
||||
minecraft.renderEngine, this.renderStack, xPosition + 2, yPosition + height/2 - 8);
|
||||
itemRenderer.renderItemOverlayIntoGUI(minecraft.fontRenderer,
|
||||
minecraft.renderEngine, this.renderStack, xPosition + 2, yPosition + height/2 - 8);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
itemRenderer.zLevel = 0.0F;
|
||||
this.zLevel = 0.0F;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
}
|
||||
|
||||
String text = "";
|
||||
float maxWidth = width * 0.75f;
|
||||
|
||||
@@ -95,6 +95,8 @@ public enum EnumPacketServer {
|
||||
|
||||
CustomGuiButton,CustomGuiScrollClick,CustomGuiClose,CustomGuiUnfocused,
|
||||
|
||||
CreateParty,
|
||||
|
||||
ServerUpdateSkinOverlays;
|
||||
|
||||
public CustomNpcsPermissions.Permission permission = null;
|
||||
|
||||
Reference in new issue
Block a user