Remove Faction Inventory Tab for Sub Inventory Tab

This commit is contained in:
Kam committed 2024-01-11 03:50:10 -05:00
1 parent 2ef38dfdf4
commit 42f16d6ce1
8 files changed
+120 -122

No files matched your search

@@ -53,7 +53,6 @@ import noppes.npcs.client.renderer.blocks.*;
import noppes.npcs.client.renderer.customitem.CustomItemRenderer;
import noppes.npcs.config.ConfigClient;
import noppes.npcs.config.ConfigMain;
import noppes.npcs.config.ConfigScript;
import noppes.npcs.config.StringCache;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.containers.*;
@@ -63,8 +62,7 @@ import noppes.npcs.entity.data.ModelData;
import noppes.npcs.entity.data.ModelPartData;
import noppes.npcs.items.ItemScripted;
import org.lwjgl.input.Keyboard;
import tconstruct.client.tabs.InventoryTabFactions;
import tconstruct.client.tabs.InventoryTabQuests;
import tconstruct.client.tabs.InventoryTabCustomNpc;
import tconstruct.client.tabs.InventoryTabVanilla;
import tconstruct.client.tabs.TabRegistry;
@@ -152,8 +150,7 @@ public class ClientProxy extends CommonProxy {
if (TabRegistry.getTabList().size() < 2){
TabRegistry.registerTab(new InventoryTabVanilla());
}
TabRegistry.registerTab(new InventoryTabFactions());
TabRegistry.registerTab(new InventoryTabQuests());
TabRegistry.registerTab(new InventoryTabCustomNpc());
}
}
@@ -3,18 +3,16 @@ package noppes.npcs.client;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.world.World;
import noppes.npcs.CustomNpcs;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.client.controllers.MusicController;
import noppes.npcs.client.controllers.ScriptSoundController;
import noppes.npcs.client.gui.player.GuiQuestLog;
import noppes.npcs.client.gui.player.inventory.GuiQuestLog;
import noppes.npcs.client.renderer.RenderNPCInterface;
import noppes.npcs.constants.EnumPlayerPacket;
import org.lwjgl.input.Keyboard;
@@ -0,0 +1,52 @@
package noppes.npcs.client.gui.player.inventory;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomItems;
import noppes.npcs.client.gui.util.GuiMenuSideButton;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import tconstruct.client.tabs.InventoryTabCustomNpc;
import tconstruct.client.tabs.TabRegistry;
public class GuiCNPCInventory extends GuiNPCInterface {
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
protected static int activeTab = 0;
private Minecraft mc = Minecraft.getMinecraft();
public GuiCNPCInventory() {
super();
xSize = 280;
ySize = 180;
drawDefaultBackground = false;
}
public void initGui(){
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;
questsButton.renderStack = new ItemStack(CustomItems.letter);
addButton(questsButton);
GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + 3 + 21, 22, 22, "");
partyButton.rightSided = true;
partyButton.active = activeTab == 1;
partyButton.renderStack = new ItemStack(CustomItems.bag);
addButton(partyButton);
GuiMenuSideButton factionButton = new GuiMenuSideButton(102, guiLeft + xSize + 37, this.guiTop + 3 + 21*2, 22, 22, "");
factionButton.rightSided = true;
factionButton.active = activeTab == 2;
factionButton.renderStack = new ItemStack(CustomItems.wallBanner);
addButton(factionButton);
}
@Override
public void save() {}
}
@@ -1,5 +1,6 @@
package noppes.npcs.client.gui.player;
package noppes.npcs.client.gui.player.inventory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -8,54 +9,46 @@ import net.minecraft.util.StatCollector;
import noppes.npcs.NoppesUtilPlayer;
import noppes.npcs.client.CustomNpcResourceListener;
import noppes.npcs.client.gui.util.GuiButtonNextPage;
import noppes.npcs.client.gui.util.GuiNPCInterface;
import noppes.npcs.client.gui.util.IGuiData;
import noppes.npcs.constants.EnumPlayerPacket;
import noppes.npcs.controllers.data.Faction;
import noppes.npcs.controllers.data.PlayerFactionData;
import org.lwjgl.opengl.GL11;
import tconstruct.client.tabs.InventoryTabFactions;
import tconstruct.client.tabs.InventoryTabCustomNpc;
import tconstruct.client.tabs.TabRegistry;
import java.util.ArrayList;
public class GuiFaction extends GuiNPCInterface implements IGuiData{
public class GuiFaction extends GuiCNPCInventory implements IGuiData{
private int xSize;
private int ySize;
private int guiLeft;
private int guiTop;
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
private ArrayList<Faction> playerFactions = new ArrayList<Faction>();
private Minecraft mc = Minecraft.getMinecraft();
private int page = 0;
private int pages = 1;
private GuiButtonNextPage buttonNextPage;
private GuiButtonNextPage buttonPreviousPage;
private ResourceLocation indicator;
public GuiFaction() {
super();
xSize = 200;
ySize = 195;
xSize = 280;
ySize = 180;
this.drawDefaultBackground = false;
title = "";
activeTab = 2;
NoppesUtilPlayer.sendData(EnumPlayerPacket.FactionsGet);
indicator = getResource("standardbg.png");
}
@Override
public void initGui()
{
super.initGui();
guiLeft = (width - xSize) / 2;
guiTop = (height - ySize) / 2 + 12;
TabRegistry.updateTabValues(guiLeft, guiTop + 8, InventoryTabFactions.class);
super.initGui();
TabRegistry.addTabsToList(buttonList);
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
this.buttonList.add(buttonNextPage = new GuiButtonNextPage(1, guiLeft + xSize - 43, guiTop + 180, true));
this.buttonList.add(buttonPreviousPage = new GuiButtonNextPage(2, guiLeft + 20, guiTop + 180, false));
updateButtons();
@@ -66,9 +59,9 @@ public class GuiFaction extends GuiNPCInterface implements IGuiData{
{
drawDefaultBackground();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(indicator);
drawTexturedModalRect(guiLeft, guiTop + 8, 0, 0, xSize, ySize);
drawTexturedModalRect(guiLeft + 4, guiTop + 8, 56, 0, 200, ySize);
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");
@@ -124,6 +117,21 @@ public class GuiFaction extends GuiNPCInterface implements IGuiData{
@Override
protected void actionPerformed(GuiButton guibutton){
if (guibutton.id >= 100) {
if (guibutton.id == 100 && activeTab != 0) {
activeTab = 0;
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
}
if (guibutton.id == 101 && activeTab != 1) {
activeTab = 1;
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
}
if (guibutton.id == 102 && activeTab != 2) {
activeTab = 2;
mc.displayGuiScreen(new GuiFaction());
}
}
if(!(guibutton instanceof GuiButtonNextPage))
return;
int id = guibutton.id;
@@ -1,13 +1,11 @@
package noppes.npcs.client.gui.player;
package noppes.npcs.client.gui.player.inventory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
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.client.Client;
import noppes.npcs.client.ClientCacheHandler;
import noppes.npcs.client.CustomNpcResourceListener;
@@ -15,14 +13,15 @@ import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
import noppes.npcs.controllers.data.Party;
import org.lwjgl.opengl.GL11;
import tconstruct.client.tabs.InventoryTabQuests;
import tconstruct.client.tabs.InventoryTabCustomNpc;
import tconstruct.client.tabs.TabRegistry;
import java.util.UUID;
public class GuiParty extends GuiNPCInterface implements ITextfieldListener, ITopButtonListener,ICustomScrollListener, IGuiData {
public class GuiParty extends GuiCNPCInventory implements ITextfieldListener, ITopButtonListener,ICustomScrollListener, IGuiData {
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
private final EntityPlayer player;
private Minecraft mc = Minecraft.getMinecraft();
private boolean receivedData;
private long renderTicks;
@@ -33,29 +32,15 @@ public class GuiParty extends GuiNPCInterface implements ITextfieldListener, ITo
xSize = 280;
ySize = 180;
drawDefaultBackground = false;
activeTab = 1;
Client.sendData(EnumPacketServer.GetPartyData);
}
public void initGui(){
Party party = ClientCacheHandler.party;
super.initGui();
guiTop +=10;
Party party = ClientCacheHandler.party;
TabRegistry.addTabsToList(buttonList);
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabQuests.class);
GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + 3, 22, 22, "");
questsButton.rightSided = true;
questsButton.renderStack = new ItemStack(CustomItems.letter);
addButton(questsButton);
GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + 3 + 21, 22, 22, "");
partyButton.rightSided = true;
partyButton.active = true;
partyButton.renderStack = new ItemStack(CustomItems.bag);
addButton(partyButton);
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
if (receivedData) {
if (party == null) {
@@ -142,13 +127,19 @@ public class GuiParty extends GuiNPCInterface implements ITextfieldListener, ITo
receivedData = false;
break;
}
initGui();
if (guibutton.id == 100) {
Minecraft mc = Minecraft.getMinecraft();
if (guibutton.id == 100 && activeTab != 0) {
activeTab = 0;
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
}
if (guibutton.id == 101 && activeTab != 1) {
activeTab = 1;
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
}
if (guibutton.id == 102 && activeTab != 2) {
activeTab = 2;
mc.displayGuiScreen(new GuiFaction());
}
}
@Override
@@ -1,15 +1,11 @@
package noppes.npcs.client.gui.player;
package noppes.npcs.client.gui.player.inventory;
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;
@@ -21,15 +17,13 @@ import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumPacketServer;
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.InventoryTabCustomNpc;
import tconstruct.client.tabs.TabRegistry;
import java.util.*;
public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,ICustomScrollListener, IGuiData{
public class GuiQuestLog extends GuiCNPCInventory implements ITopButtonListener,ICustomScrollListener, IGuiData{
private final ResourceLocation resource = new ResourceLocation("customnpcs","textures/gui/standardbg.png");
@@ -56,28 +50,16 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
ySize = 180;
NoppesUtilPlayer.sendData(EnumPlayerPacket.QuestLog);
drawDefaultBackground = false;
activeTab = 0;
}
public void initGui(){
super.initGui();
sideButtons.clear();
guiTop +=10;
TabRegistry.addTabsToList(buttonList);
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabQuests.class);
TabRegistry.updateTabValues(guiLeft, guiTop, InventoryTabCustomNpc.class);
noQuests = false;
GuiMenuSideButton questsButton = new GuiMenuSideButton(100, guiLeft + xSize + 37, this.guiTop + 3, 22, 22, "");
questsButton.rightSided = true;
questsButton.active = true;
questsButton.renderStack = new ItemStack(CustomItems.letter);
addButton(questsButton);
GuiMenuSideButton partyButton = new GuiMenuSideButton(101, guiLeft + xSize + 37, this.guiTop + 3 + 21, 22, 22, "");
partyButton.rightSided = true;
partyButton.renderStack = new ItemStack(CustomItems.bag);
addButton(partyButton);
if(data.categories.isEmpty()){
noQuests = true;
return;
@@ -140,11 +122,18 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
data.toggleQuestAlerts();
}
initGui();
if (guibutton.id == 101) {
Minecraft mc = Minecraft.getMinecraft();
if (guibutton.id == 100 && activeTab != 0) {
activeTab = 0;
mc.displayGuiScreen(new GuiQuestLog(mc.thePlayer));
}
if (guibutton.id == 101 && activeTab != 1) {
activeTab = 1;
mc.displayGuiScreen(new GuiParty(mc.thePlayer));
}
if (guibutton.id == 102 && activeTab != 2) {
activeTab = 2;
mc.displayGuiScreen(new GuiFaction());
}
}
@Override
public void drawScreen(int i, int j, float f){
@@ -4,10 +4,10 @@ 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.GuiQuestLog;
import noppes.npcs.client.gui.player.inventory.GuiQuestLog;
public class InventoryTabQuests extends AbstractTab {
public InventoryTabQuests() {
public class InventoryTabCustomNpc extends AbstractTab {
public InventoryTabCustomNpc() {
super(0, 0, 0, new ItemStack(CustomItems.letter));
if(CustomItems.letter == null)
@@ -1,37 +0,0 @@
package tconstruct.client.tabs;
import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import noppes.npcs.CustomItems;
import noppes.npcs.client.gui.player.GuiFaction;
public class InventoryTabFactions extends AbstractTab {
public InventoryTabFactions() {
super(0, 0, 0, new ItemStack(CustomItems.wallBanner, 1, 1));
if(CustomItems.wallBanner == null)
renderStack = new ItemStack(Blocks.tnt);
}
@Override
public void onTabClicked() {
Thread t = new Thread(){
@Override
public void run(){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
Minecraft mc = Minecraft.getMinecraft();
mc.displayGuiScreen(new GuiFaction());
}
};
t.start();
}
@Override
public boolean shouldAddToList() {
return true;
}
}