mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 12:39:05 +00:00
Better Inventory Handling
This commit is contained in:
1 parent
b0c299ebb2
commit
8e0e56dbfd
5 files changed
+29
-24
No files matched your search
@@ -26,9 +26,6 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
super.initGui();
|
||||
guiTop +=10;
|
||||
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + 3, 22, 22, "");
|
||||
questsButton.rightSided = true;
|
||||
questsButton.active = activeTab == 0;
|
||||
@@ -40,7 +37,7 @@ public class GuiCNPCInventory extends GuiNPCInterface {
|
||||
partyButton.active = activeTab == 1;
|
||||
partyButton.renderStack = new ItemStack(CustomItems.bag);
|
||||
addButton(partyButton);
|
||||
|
||||
|
||||
if(ConfigClient.enableFactionTab){
|
||||
GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + 3 + 21*2, 22, 22, "");
|
||||
factionButton.rightSided = true;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.ArrayList;
|
||||
public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
|
||||
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
|
||||
|
||||
|
||||
private ArrayList<Faction> playerFactions = new ArrayList<Faction>();
|
||||
private Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
@@ -46,8 +46,8 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
this.buttonList.add(buttonNextPage = new GuiButtonNextPage(1, (guiLeft + (xSize + 35) / 2) + 25, guiTop + 170, true));
|
||||
this.buttonList.add(buttonPreviousPage = new GuiButtonNextPage(2, (guiLeft + (xSize + 35) / 2) - 40, guiTop + 170, false));
|
||||
@@ -62,16 +62,16 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
mc.renderEngine.bindTexture(resource);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 252, 195);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, 188, 0, 67, 195);
|
||||
|
||||
|
||||
if(playerFactions.isEmpty()){
|
||||
String noFaction = StatCollector.translateToLocal("faction.nostanding");
|
||||
fontRendererObj.drawString(noFaction,guiLeft + (xSize - fontRendererObj.getStringWidth(noFaction)) / 2,guiTop + 80, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
else
|
||||
renderScreen();
|
||||
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void renderScreen(){
|
||||
@@ -131,21 +131,21 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
fontRendererObj.drawString(s, guiLeft + (xSize + 45 - fontRendererObj.getStringWidth(s)) / 2, guiTop + 175, CustomNpcResourceListener.DefaultTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
if (guibutton.id >= 100) {
|
||||
if (guibutton.id == 100 && activeTab != 0) {
|
||||
activeTab = 0;
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 101 && activeTab != 1) {
|
||||
activeTab = 1;
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
|
||||
}
|
||||
if (guibutton.id == 102 && activeTab != 2) {
|
||||
activeTab = 2;
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
mc.displayGuiScreen(new GuiFaction());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
}
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i)
|
||||
{
|
||||
@@ -199,13 +199,13 @@ public class GuiFaction extends GuiCNPCInventory implements IGuiData{
|
||||
faction.defaultPoints = points;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pages = (playerFactions.size() - 1) / 10 ;
|
||||
pages++;
|
||||
|
||||
|
||||
page = 1;
|
||||
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -55,11 +55,12 @@ public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, IT
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
this.selectedInvite = this.selectedPlayer = null;
|
||||
Party party = ClientCacheHandler.party;
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
this.selectedInvite = this.selectedPlayer = null;
|
||||
Party party = ClientCacheHandler.party;
|
||||
|
||||
if (receivedData) {
|
||||
if (party == null) {
|
||||
//
|
||||
|
||||
@@ -53,8 +53,9 @@ public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
sideButtons.clear();
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
TabRegistry.addTabsToList(buttonList);
|
||||
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
|
||||
|
||||
noQuests = false;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiCNPCInventory;
|
||||
import noppes.npcs.client.gui.player.inventory.GuiQuestLog;
|
||||
|
||||
public class InventoryTabCustomNpc extends AbstractTab {
|
||||
@@ -16,6 +17,8 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
|
||||
@Override
|
||||
public void onTabClicked() {
|
||||
|
||||
|
||||
Thread t = new Thread(){
|
||||
@Override
|
||||
public void run(){
|
||||
@@ -25,6 +28,9 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(mc.currentScreen instanceof GuiCNPCInventory)
|
||||
return;
|
||||
|
||||
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
|
||||
}
|
||||
};
|
||||
@@ -35,4 +41,4 @@ public class InventoryTabCustomNpc extends AbstractTab {
|
||||
public boolean shouldAddToList() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user