Better Hud System CNPC+

This commit is contained in:
Kam committed 2025-02-23 04:58:41 -05:00
1 parent c023071ff0
commit fe9bb02aea
11 files changed
+575 -401

No files matched your search

@@ -0,0 +1,55 @@
package noppes.npcs.client.gui.hud;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.client.gui.GuiButton;
import java.util.List;
public abstract class HudComponent {
// Stored as percentages (0-100) of the current screen resolution.
protected int posX = 50, posY = 50, scale = 100, textAlign = 0;
public boolean enabled = true;
public boolean hasData = false;
public boolean isEditting = false;
protected final int overlayWidth = 200, overlayHeight = 120;
/**
* Loads custom HUD data from an NBT compound.
*/
public abstract void loadData(NBTTagCompound compound);
/**
* Loads HUD settings from the config.
*/
public abstract void load();
/**
* Saves HUD settings to the config.
*/
public abstract void save();
/**
* Renders the HUD as it appears during normal gameplay.
*/
public abstract void renderOnScreen(float partialTicks);
/**
* Renders the HUD in edit mode (with handles, borders, dummy data, etc.).
*/
public abstract void renderEditing();
/**
* Allows the component to add its own editor buttons.
*/
public void addEditorButtons(List<GuiButton> buttonList) {
// Default: do nothing.
}
/**
* Handles editor button actions specific to this HUD component.
*/
public void onEditorButtonPressed(GuiButton button) {
// Default: do nothing.
}
}