Create Guide button.

This commit is contained in:
somehussar committed 2026-07-08 22:42:49 +02:00
1 parent 32839206d3
commit 160f3ae628
3 files changed
+71

No files matched your search

@@ -254,6 +254,7 @@ import noppes.npcs.items.ItemNpcTool;
import noppes.npcs.items.ItemScripted;
import noppes.npcs.scripted.item.ScriptCustomItem;
import org.lwjgl.input.Keyboard;
import somehussar.gui.guides.GuideController;
import tconstruct.client.tabs.InventoryTabCustomNpc;
import tconstruct.client.tabs.InventoryTabVanilla;
import tconstruct.client.tabs.TabRegistry;
@@ -390,6 +391,7 @@ public class ClientProxy extends CommonProxy {
if (TabRegistry.getTabList().isEmpty()) {
TabRegistry.registerTab(new InventoryTabVanilla());
}
GuideController.forceGuideButtonToBeFirst();
TabRegistry.registerTab(new InventoryTabCustomNpc());
}
}
@@ -0,0 +1,23 @@
package somehussar.gui.guides;
import tconstruct.client.tabs.InventoryTabGuides;
import tconstruct.client.tabs.TabRegistry;
// TODO: THIS IS JUST THE CLIENT SIDE CONTROLLER
// NEED SERVER SIDE
public class GuideController {
private static boolean isGuideLoaded = true;
public static boolean isGuideLoaded() {
return isGuideLoaded;
}
public static void setGuideLoaded(boolean isGuideLoaded) {
GuideController.isGuideLoaded = isGuideLoaded;
}
public static void forceGuideButtonToBeFirst() {
TabRegistry.getTabList().add(0, new InventoryTabGuides());
}
}
@@ -0,0 +1,46 @@
package tconstruct.client.tabs;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import somehussar.gui.guides.GuideController;
public class InventoryTabGuides extends AbstractTab {
private static final ResourceLocation HELP_TEXTURE = new ResourceLocation("customnpcs", "textures/marks/question.png");
public InventoryTabGuides() {
super(0, 0, 0, null);
}
@Override
public void onTabClicked() {
}
@Override
public boolean shouldAddToList() {
return GuideController.isGuideLoaded();
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int yTexPos = this.enabled ? 3 : 32;
int ySize = this.enabled ? 25 : 32;
int xOffset = this.id == 2 ? 0 : 1;
int yPos = this.yPosition + (this.enabled ? 3 : 0);
mc.renderEngine.bindTexture(super.texture);
this.drawTexturedModalRect(this.xPosition, yPos, xOffset * 28,
yTexPos, 28, ySize);
this.zLevel = 100.0F;
mc.renderEngine.bindTexture(HELP_TEXTURE);
func_146110_a(xPosition + 6, yPosition + 8, 0, 0, 16, 16, 16, 16);
this.zLevel = 0.0F;
}
}
}