mirror of
https://github.com/KAMKEEL/CustomNPC-Plus-API.git
synced 2026-11-16 15:24:47 +00:00
GUI Api
This commit is contained in:
1 parent
8c2c226d34
commit
a876b4d191
9 files changed
+933
-193
No files matched your search
@@ -1,33 +1,119 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
/**
|
||||
* Represents a clickable button component in a custom GUI.
|
||||
* Provides methods to control size, label, texture, and state.
|
||||
*/
|
||||
public interface IButton extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the button's width.
|
||||
*
|
||||
* @return the width in pixels.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Returns the button's height.
|
||||
*
|
||||
* @return the height in pixels.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Sets the size of the button.
|
||||
*
|
||||
* @param width the new width in pixels.
|
||||
* @param height the new height in pixels.
|
||||
* @return this button instance.
|
||||
*/
|
||||
IButton setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Returns the button's label text.
|
||||
*
|
||||
* @return the label.
|
||||
*/
|
||||
String getLabel();
|
||||
|
||||
/**
|
||||
* Sets the button's label text.
|
||||
*
|
||||
* @param text the new label.
|
||||
* @return this button instance.
|
||||
*/
|
||||
IButton setLabel(String text);
|
||||
|
||||
/**
|
||||
* Returns the texture resource location for this button.
|
||||
*
|
||||
* @return the texture location as a string.
|
||||
*/
|
||||
String getTexture();
|
||||
|
||||
/**
|
||||
* Checks if the button has an assigned texture.
|
||||
*
|
||||
* @return true if a texture is set; false otherwise.
|
||||
*/
|
||||
boolean hasTexture();
|
||||
|
||||
/**
|
||||
* Sets the texture resource location for this button.
|
||||
*
|
||||
* @param texture the texture resource location.
|
||||
* @return this button instance.
|
||||
*/
|
||||
IButton setTexture(String texture);
|
||||
|
||||
/**
|
||||
* Returns the X offset within the texture.
|
||||
*
|
||||
* @return the texture X offset.
|
||||
*/
|
||||
int getTextureX();
|
||||
|
||||
/**
|
||||
* Returns the Y offset within the texture.
|
||||
*
|
||||
* @return the texture Y offset.
|
||||
*/
|
||||
int getTextureY();
|
||||
|
||||
/**
|
||||
* Sets the texture offset (X and Y) for this button.
|
||||
*
|
||||
* @param textureX the new X offset.
|
||||
* @param textureY the new Y offset.
|
||||
* @return this button instance.
|
||||
*/
|
||||
IButton setTextureOffset(int textureX, int textureY);
|
||||
|
||||
/**
|
||||
* Sets the scale factor of the button.
|
||||
*
|
||||
* @param scale the scale factor.
|
||||
*/
|
||||
void setScale(float scale);
|
||||
|
||||
/**
|
||||
* Returns the scale factor of the button.
|
||||
*
|
||||
* @return the scale.
|
||||
*/
|
||||
float getScale();
|
||||
|
||||
/**
|
||||
* Enables or disables the button.
|
||||
*
|
||||
* @param enabled true to enable; false to disable.
|
||||
*/
|
||||
void setEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Checks if the button is enabled.
|
||||
*
|
||||
* @return true if enabled; false otherwise.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
}
|
||||
@@ -1,85 +1,349 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICustomGui {
|
||||
int getID();
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
List<ICustomGuiComponent> getComponents();
|
||||
|
||||
void clear();
|
||||
|
||||
List<IItemSlot> getSlots();
|
||||
|
||||
void setSize(int width, int height);
|
||||
|
||||
void setDoesPauseGame(boolean pauseGame);
|
||||
|
||||
boolean doesPauseGame();
|
||||
|
||||
void setBackgroundTexture(String resourceLocation);
|
||||
|
||||
String getBackgroundTexture();
|
||||
|
||||
IButton addButton(int id, String text, int x, int y);
|
||||
|
||||
IButton addButton(int id, String text, int x, int y, int width, int height);
|
||||
|
||||
IButton addTexturedButton(int id, String text, int x, int y, int width, int height, String texture);
|
||||
|
||||
IButton addTexturedButton(int id, String text, int x, int y, int width, int height, String texture, int textureX, int textureY);
|
||||
|
||||
ILabel addLabel(int id, String text, int x, int y, int width, int height);
|
||||
|
||||
ILabel addLabel(int id, String text, int x, int y, int width, int height, int color);
|
||||
|
||||
ITextField addTextField(int id, int x, int y, int width, int height);
|
||||
|
||||
ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height);
|
||||
|
||||
ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY);
|
||||
|
||||
IScroll addScroll(int id, int x, int y, int width, int height, String[] list);
|
||||
|
||||
ILine addLine(int id, int x1, int y1, int x2, int y2, int color, int thickness);
|
||||
|
||||
ILine addLine(int id, int x1, int y1, int x2, int y2);
|
||||
|
||||
IItemSlot addItemSlot(int id, int x, int y);
|
||||
|
||||
IItemSlot addItemSlot(int id, int x, int y, IItemStack itemStack);
|
||||
|
||||
@Deprecated
|
||||
IItemSlot addItemSlot(int x, int y);
|
||||
|
||||
@Deprecated
|
||||
IItemSlot addItemSlot(int x, int y, IItemStack itemStack);
|
||||
|
||||
void showPlayerInventory(int x, int y);
|
||||
|
||||
ICustomGuiComponent getComponent(int id);
|
||||
|
||||
void removeComponent(int id);
|
||||
|
||||
void updateComponent(ICustomGuiComponent component);
|
||||
|
||||
void update(IPlayer player);
|
||||
|
||||
boolean getShowPlayerInv();
|
||||
|
||||
int getPlayerInvX();
|
||||
|
||||
int getPlayerInvY();
|
||||
|
||||
ICustomGui fromNBT(NBTTagCompound tag);
|
||||
|
||||
NBTTagCompound toNBT();
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a custom graphical user interface (GUI) that can contain various components
|
||||
* such as buttons, labels, text fields, item slots, etc.
|
||||
*/
|
||||
public interface ICustomGui {
|
||||
|
||||
/**
|
||||
* Returns the unique ID of the GUI.
|
||||
*
|
||||
* @return the GUI ID.
|
||||
*/
|
||||
int getID();
|
||||
|
||||
/**
|
||||
* Returns the width of the GUI.
|
||||
*
|
||||
* @return the width in pixels.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Returns the height of the GUI.
|
||||
*
|
||||
* @return the height in pixels.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Returns a list of all components contained in this GUI.
|
||||
*
|
||||
* @return the list of components.
|
||||
*/
|
||||
List<ICustomGuiComponent> getComponents();
|
||||
|
||||
/**
|
||||
* Clears all components from the GUI.
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* Returns a list of item slot components in this GUI.
|
||||
*
|
||||
* @return the list of item slots.
|
||||
*/
|
||||
List<IItemSlot> getSlots();
|
||||
|
||||
/**
|
||||
* Sets the size of the GUI.
|
||||
*
|
||||
* @param width the new width.
|
||||
* @param height the new height.
|
||||
*/
|
||||
void setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Specifies whether the GUI pauses the game.
|
||||
*
|
||||
* @param pauseGame true to pause the game.
|
||||
*/
|
||||
void setDoesPauseGame(boolean pauseGame);
|
||||
|
||||
/**
|
||||
* Checks if the GUI pauses the game.
|
||||
*
|
||||
* @return true if it pauses the game; false otherwise.
|
||||
*/
|
||||
boolean doesPauseGame();
|
||||
|
||||
/**
|
||||
* Sets the background texture resource location for the GUI.
|
||||
*
|
||||
* @param resourceLocation the texture resource location.
|
||||
*/
|
||||
void setBackgroundTexture(String resourceLocation);
|
||||
|
||||
/**
|
||||
* Returns the background texture resource location.
|
||||
*
|
||||
* @return the texture as a string.
|
||||
*/
|
||||
String getBackgroundTexture();
|
||||
|
||||
/**
|
||||
* Adds a button to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param text the button label.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @return the created button.
|
||||
*/
|
||||
IButton addButton(int id, String text, int x, int y);
|
||||
|
||||
/**
|
||||
* Adds a button to the GUI with a specified size.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param text the button label.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the button width.
|
||||
* @param height the button height.
|
||||
* @return the created button.
|
||||
*/
|
||||
IButton addButton(int id, String text, int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* Adds a textured button to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param text the button label.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the button width.
|
||||
* @param height the button height.
|
||||
* @param texture the texture resource location.
|
||||
* @return the created button.
|
||||
*/
|
||||
IButton addTexturedButton(int id, String text, int x, int y, int width, int height, String texture);
|
||||
|
||||
/**
|
||||
* Adds a textured button with texture offset.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param text the button label.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the button width.
|
||||
* @param height the button height.
|
||||
* @param texture the texture resource location.
|
||||
* @param textureX the x offset in the texture.
|
||||
* @param textureY the y offset in the texture.
|
||||
* @return the created button.
|
||||
*/
|
||||
IButton addTexturedButton(int id, String text, int x, int y, int width, int height, String texture, int textureX, int textureY);
|
||||
|
||||
/**
|
||||
* Adds a label component to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param text the label text.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the width.
|
||||
* @param height the height.
|
||||
* @return the created label.
|
||||
*/
|
||||
ILabel addLabel(int id, String text, int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* Adds a label component with a specified text color.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param text the label text.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the width.
|
||||
* @param height the height.
|
||||
* @param color the text color.
|
||||
* @return the created label.
|
||||
*/
|
||||
ILabel addLabel(int id, String text, int x, int y, int width, int height, int color);
|
||||
|
||||
/**
|
||||
* Adds a text field component to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the width.
|
||||
* @param height the height.
|
||||
* @return the created text field.
|
||||
*/
|
||||
ITextField addTextField(int id, int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* Adds a textured rectangle component to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param texture the texture resource location.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the width.
|
||||
* @param height the height.
|
||||
* @return the created textured rectangle.
|
||||
*/
|
||||
ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height);
|
||||
|
||||
/**
|
||||
* Adds a textured rectangle component with texture offset.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param texture the texture resource location.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the width.
|
||||
* @param height the height.
|
||||
* @param textureX the x offset within the texture.
|
||||
* @param textureY the y offset within the texture.
|
||||
* @return the created textured rectangle.
|
||||
*/
|
||||
ITexturedRect addTexturedRect(int id, String texture, int x, int y, int width, int height, int textureX, int textureY);
|
||||
|
||||
/**
|
||||
* Adds an item slot component to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @return the created item slot.
|
||||
*/
|
||||
IItemSlot addItemSlot(int id, int x, int y);
|
||||
|
||||
/**
|
||||
* Adds an item slot component with an initial item stack.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param itemStack the initial item.
|
||||
* @return the created item slot.
|
||||
*/
|
||||
IItemSlot addItemSlot(int id, int x, int y, IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* @deprecated Use addItemSlot(int, int, IItemStack) with an ID instead.
|
||||
*/
|
||||
@Deprecated
|
||||
IItemSlot addItemSlot(int x, int y);
|
||||
|
||||
/**
|
||||
* @deprecated Use addItemSlot(int, int, IItemStack) with an ID instead.
|
||||
*/
|
||||
@Deprecated
|
||||
IItemSlot addItemSlot(int x, int y, IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Adds a scroll component to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
* @param width the width.
|
||||
* @param height the height.
|
||||
* @param list the list of strings to display.
|
||||
* @return the created scroll component.
|
||||
*/
|
||||
IScroll addScroll(int id, int x, int y, int width, int height, String[] list);
|
||||
|
||||
/**
|
||||
* Adds a line component to the GUI.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param x1 the start x position.
|
||||
* @param y1 the start y position.
|
||||
* @param x2 the end x position.
|
||||
* @param y2 the end y position.
|
||||
* @param color the line color.
|
||||
* @param thickness the line thickness.
|
||||
* @return the created line component.
|
||||
*/
|
||||
ILine addLine(int id, int x1, int y1, int x2, int y2, int color, int thickness);
|
||||
|
||||
/**
|
||||
* Adds a line component with default thickness.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @param x1 the start x position.
|
||||
* @param y1 the start y position.
|
||||
* @param x2 the end x position.
|
||||
* @param y2 the end y position.
|
||||
* @return the created line component.
|
||||
*/
|
||||
ILine addLine(int id, int x1, int y1, int x2, int y2);
|
||||
|
||||
/**
|
||||
* Displays the player's inventory at the specified position.
|
||||
*
|
||||
* @param x the x position.
|
||||
* @param y the y position.
|
||||
*/
|
||||
void showPlayerInventory(int x, int y);
|
||||
|
||||
/**
|
||||
* Retrieves the GUI component with the given ID.
|
||||
*
|
||||
* @param id the component ID.
|
||||
* @return the component.
|
||||
*/
|
||||
ICustomGuiComponent getComponent(int id);
|
||||
|
||||
/**
|
||||
* Removes the GUI component with the specified ID.
|
||||
*
|
||||
* @param id the component ID.
|
||||
*/
|
||||
void removeComponent(int id);
|
||||
|
||||
/**
|
||||
* Updates the specified GUI component.
|
||||
*
|
||||
* @param component the component to update.
|
||||
*/
|
||||
void updateComponent(ICustomGuiComponent component);
|
||||
|
||||
/**
|
||||
* Sends an update of the GUI to the given player.
|
||||
*
|
||||
* @param player the player to update.
|
||||
*/
|
||||
void update(IPlayer player);
|
||||
|
||||
/**
|
||||
* @return true if the player inventory is shown.
|
||||
*/
|
||||
boolean getShowPlayerInv();
|
||||
|
||||
/**
|
||||
* @return the x position where the player inventory is displayed.
|
||||
*/
|
||||
int getPlayerInvX();
|
||||
|
||||
/**
|
||||
* @return the y position where the player inventory is displayed.
|
||||
*/
|
||||
int getPlayerInvY();
|
||||
|
||||
/**
|
||||
* Recreates the GUI from NBT data.
|
||||
*
|
||||
* @param tag the NBT tag.
|
||||
* @return this GUI.
|
||||
*/
|
||||
ICustomGui fromNBT(NBTTagCompound tag);
|
||||
|
||||
/**
|
||||
* Serializes the GUI to an NBT tag.
|
||||
*
|
||||
* @return the NBT data.
|
||||
*/
|
||||
NBTTagCompound toNBT();
|
||||
}
|
||||
@@ -2,38 +2,136 @@ package noppes.npcs.api.gui;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Base interface for all custom GUI components.
|
||||
* Defines common methods for position, appearance, and NBT serialization.
|
||||
*/
|
||||
public interface ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the unique ID of this component.
|
||||
*
|
||||
* @return the component ID.
|
||||
*/
|
||||
int getID();
|
||||
|
||||
/**
|
||||
* Sets the unique ID for this component.
|
||||
*
|
||||
* @param id the new ID.
|
||||
* @return this component instance.
|
||||
*/
|
||||
ICustomGuiComponent setID(int id);
|
||||
|
||||
/**
|
||||
* Returns the x position of this component.
|
||||
*
|
||||
* @return the x position.
|
||||
*/
|
||||
int getPosX();
|
||||
|
||||
/**
|
||||
* Returns the y position of this component.
|
||||
*
|
||||
* @return the y position.
|
||||
*/
|
||||
int getPosY();
|
||||
|
||||
/**
|
||||
* Sets the position of the component.
|
||||
*
|
||||
* @param x the new x position.
|
||||
* @param y the new y position.
|
||||
* @return this component instance.
|
||||
*/
|
||||
ICustomGuiComponent setPos(int x, int y);
|
||||
|
||||
/**
|
||||
* Checks if the component has hover text.
|
||||
*
|
||||
* @return true if hover text is set.
|
||||
*/
|
||||
boolean hasHoverText();
|
||||
|
||||
/**
|
||||
* Returns the hover text as an array of strings.
|
||||
*
|
||||
* @return the hover text.
|
||||
*/
|
||||
String[] getHoverText();
|
||||
|
||||
/**
|
||||
* Sets the hover text with a single line.
|
||||
*
|
||||
* @param hoverText the hover text.
|
||||
* @return this component instance.
|
||||
*/
|
||||
ICustomGuiComponent setHoverText(String hoverText);
|
||||
|
||||
/**
|
||||
* Sets the hover text with multiple lines.
|
||||
*
|
||||
* @param hoverTextLines the hover text lines.
|
||||
* @return this component instance.
|
||||
*/
|
||||
ICustomGuiComponent setHoverText(String[] hoverTextLines);
|
||||
|
||||
/**
|
||||
* Returns the text color.
|
||||
*
|
||||
* @return the color as an integer.
|
||||
*/
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* Sets the text color.
|
||||
*
|
||||
* @param color the color.
|
||||
* @return this component instance.
|
||||
*/
|
||||
ICustomGuiComponent setColor(int color);
|
||||
|
||||
float getAlpha();
|
||||
/**
|
||||
* Returns the component's transparency (alpha).
|
||||
*
|
||||
* @return the alpha value.
|
||||
*/
|
||||
float getAlpha();
|
||||
|
||||
/**
|
||||
* Sets the component's transparency (alpha).
|
||||
*
|
||||
* @param alpha the alpha value.
|
||||
*/
|
||||
void setAlpha(float alpha);
|
||||
|
||||
/**
|
||||
* Returns the component's rotation.
|
||||
*
|
||||
* @return the rotation angle.
|
||||
*/
|
||||
float getRotation();
|
||||
|
||||
/**
|
||||
* Sets the component's rotation.
|
||||
*
|
||||
* @param rotation the rotation angle.
|
||||
*/
|
||||
void setRotation(float rotation);
|
||||
|
||||
/**
|
||||
* Serializes the component to an NBT compound.
|
||||
*
|
||||
* @param nbt the NBT compound to populate.
|
||||
* @return the NBT compound.
|
||||
*/
|
||||
NBTTagCompound toNBT(NBTTagCompound nbt);
|
||||
|
||||
/**
|
||||
* Deserializes the component from an NBT compound.
|
||||
*
|
||||
* @param nbt the NBT compound.
|
||||
* @return this component instance.
|
||||
*/
|
||||
ICustomGuiComponent fromNBT(NBTTagCompound nbt);
|
||||
}
|
||||
@@ -1,14 +1,40 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
public interface IItemSlot extends ICustomGuiComponent {
|
||||
boolean hasStack();
|
||||
|
||||
IItemStack getStack();
|
||||
|
||||
IItemSlot setStack(IItemStack itemStack);
|
||||
|
||||
Slot getMCSlot();
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
import net.minecraft.inventory.Slot;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
|
||||
/**
|
||||
* Represents an item slot component in a custom GUI.
|
||||
* Provides methods to get or set the contained item.
|
||||
*/
|
||||
public interface IItemSlot extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Checks if the slot currently contains an item stack.
|
||||
*
|
||||
* @return true if a stack exists; false otherwise.
|
||||
*/
|
||||
boolean hasStack();
|
||||
|
||||
/**
|
||||
* Returns the item stack contained in this slot.
|
||||
*
|
||||
* @return the item stack.
|
||||
*/
|
||||
IItemStack getStack();
|
||||
|
||||
/**
|
||||
* Sets the item stack for this slot.
|
||||
*
|
||||
* @param itemStack the item stack to set.
|
||||
* @return this item slot instance.
|
||||
*/
|
||||
IItemSlot setStack(IItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Returns the underlying Minecraft slot object.
|
||||
*
|
||||
* @return the Minecraft Slot.
|
||||
*/
|
||||
Slot getMCSlot();
|
||||
}
|
||||
@@ -1,21 +1,75 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
public interface ILabel extends ICustomGuiComponent {
|
||||
String getText();
|
||||
|
||||
ILabel setText(String text);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ILabel setSize(int width, int height);
|
||||
|
||||
float getScale();
|
||||
|
||||
ILabel setScale(float scale);
|
||||
|
||||
boolean getShadow();
|
||||
|
||||
void setShadow(boolean shadow);
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
/**
|
||||
* Represents a text label component in a custom GUI.
|
||||
* Provides methods to get or set text, size, scale, and shadow properties.
|
||||
*/
|
||||
public interface ILabel extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the text of the label.
|
||||
*
|
||||
* @return the label text.
|
||||
*/
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* Sets the label text.
|
||||
*
|
||||
* @param text the new text.
|
||||
* @return this label instance.
|
||||
*/
|
||||
ILabel setText(String text);
|
||||
|
||||
/**
|
||||
* Returns the label's width.
|
||||
*
|
||||
* @return the width in pixels.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Returns the label's height.
|
||||
*
|
||||
* @return the height in pixels.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Sets the size of the label.
|
||||
*
|
||||
* @param width the new width.
|
||||
* @param height the new height.
|
||||
* @return this label instance.
|
||||
*/
|
||||
ILabel setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Returns the scale factor of the label.
|
||||
*
|
||||
* @return the scale.
|
||||
*/
|
||||
float getScale();
|
||||
|
||||
/**
|
||||
* Sets the scale factor of the label.
|
||||
*
|
||||
* @param scale the new scale.
|
||||
* @return this label instance.
|
||||
*/
|
||||
ILabel setScale(float scale);
|
||||
|
||||
/**
|
||||
* Returns whether the label text is rendered with a shadow.
|
||||
*
|
||||
* @return true if shadow is enabled; false otherwise.
|
||||
*/
|
||||
boolean getShadow();
|
||||
|
||||
/**
|
||||
* Sets whether the label text should be rendered with a shadow.
|
||||
*
|
||||
* @param shadow true to enable shadow.
|
||||
*/
|
||||
void setShadow(boolean shadow);
|
||||
}
|
||||
@@ -1,15 +1,78 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
public interface ILine extends ICustomGuiComponent {
|
||||
int getX1();
|
||||
int getY1();
|
||||
int getX2();
|
||||
int getY2();
|
||||
int getThickness();
|
||||
|
||||
void setX1(int x1);
|
||||
void setY1(int y1);
|
||||
void setX2(int x2);
|
||||
void setY2(int y2);
|
||||
void setThickness(int thickness);
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
/**
|
||||
* Represents a line component in a custom GUI.
|
||||
* Provides methods to get or set endpoints and thickness.
|
||||
*/
|
||||
public interface ILine extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the starting x coordinate of the line.
|
||||
*
|
||||
* @return the x1 value.
|
||||
*/
|
||||
int getX1();
|
||||
|
||||
/**
|
||||
* Returns the starting y coordinate of the line.
|
||||
*
|
||||
* @return the y1 value.
|
||||
*/
|
||||
int getY1();
|
||||
|
||||
/**
|
||||
* Returns the ending x coordinate of the line.
|
||||
*
|
||||
* @return the x2 value.
|
||||
*/
|
||||
int getX2();
|
||||
|
||||
/**
|
||||
* Returns the ending y coordinate of the line.
|
||||
*
|
||||
* @return the y2 value.
|
||||
*/
|
||||
int getY2();
|
||||
|
||||
/**
|
||||
* Returns the thickness of the line.
|
||||
*
|
||||
* @return the thickness in pixels.
|
||||
*/
|
||||
int getThickness();
|
||||
|
||||
/**
|
||||
* Sets the starting x coordinate of the line.
|
||||
*
|
||||
* @param x1 the new x1 value.
|
||||
*/
|
||||
void setX1(int x1);
|
||||
|
||||
/**
|
||||
* Sets the starting y coordinate of the line.
|
||||
*
|
||||
* @param y1 the new y1 value.
|
||||
*/
|
||||
void setY1(int y1);
|
||||
|
||||
/**
|
||||
* Sets the ending x coordinate of the line.
|
||||
*
|
||||
* @param x2 the new x2 value.
|
||||
*/
|
||||
void setX2(int x2);
|
||||
|
||||
/**
|
||||
* Sets the ending y coordinate of the line.
|
||||
*
|
||||
* @param y2 the new y2 value.
|
||||
*/
|
||||
void setY2(int y2);
|
||||
|
||||
/**
|
||||
* Sets the thickness of the line.
|
||||
*
|
||||
* @param thickness the new thickness.
|
||||
*/
|
||||
void setThickness(int thickness);
|
||||
}
|
||||
@@ -1,21 +1,76 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
public interface IScroll extends ICustomGuiComponent {
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
IScroll setSize(int width, int height);
|
||||
|
||||
String[] getList();
|
||||
|
||||
IScroll setList(String[] textList);
|
||||
|
||||
int getDefaultSelection();
|
||||
|
||||
IScroll setDefaultSelection(int defaultSelection);
|
||||
|
||||
boolean isMultiSelect();
|
||||
|
||||
IScroll setMultiSelect(boolean selectMultiple);
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
/**
|
||||
* Represents a scrollable list component in a custom GUI.
|
||||
* Provides methods to control size, selection, and the displayed list.
|
||||
*/
|
||||
public interface IScroll extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the width of the scroll component.
|
||||
*
|
||||
* @return the width in pixels.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Returns the height of the scroll component.
|
||||
*
|
||||
* @return the height in pixels.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Sets the size of the scroll component.
|
||||
*
|
||||
* @param width the new width.
|
||||
* @param height the new height.
|
||||
* @return this scroll instance.
|
||||
*/
|
||||
IScroll setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Returns the list of text entries displayed in the scroll.
|
||||
*
|
||||
* @return an array of strings.
|
||||
*/
|
||||
String[] getList();
|
||||
|
||||
/**
|
||||
* Sets the list of text entries to display.
|
||||
*
|
||||
* @param textList an array of strings.
|
||||
* @return this scroll instance.
|
||||
*/
|
||||
IScroll setList(String[] textList);
|
||||
|
||||
/**
|
||||
* Returns the default selection index.
|
||||
*
|
||||
* @return the default selection.
|
||||
*/
|
||||
int getDefaultSelection();
|
||||
|
||||
/**
|
||||
* Sets the default selection index.
|
||||
*
|
||||
* @param defaultSelection the selection index.
|
||||
* @return this scroll instance.
|
||||
*/
|
||||
IScroll setDefaultSelection(int defaultSelection);
|
||||
|
||||
/**
|
||||
* Checks whether multiple selections are allowed.
|
||||
*
|
||||
* @return true if multi-select is enabled.
|
||||
*/
|
||||
boolean isMultiSelect();
|
||||
|
||||
/**
|
||||
* Sets whether multiple selections are allowed.
|
||||
*
|
||||
* @param selectMultiple true to allow multi-select.
|
||||
* @return this scroll instance.
|
||||
*/
|
||||
IScroll setMultiSelect(boolean selectMultiple);
|
||||
}
|
||||
@@ -1,13 +1,46 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
public interface ITextField extends ICustomGuiComponent {
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ITextField setSize(int width, int height);
|
||||
|
||||
String getText();
|
||||
|
||||
ITextField setText(String text);
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
/**
|
||||
* Represents a text field component in a custom GUI.
|
||||
* Provides methods to get or set its size and text content.
|
||||
*/
|
||||
public interface ITextField extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the width of the text field.
|
||||
*
|
||||
* @return the width in pixels.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Returns the height of the text field.
|
||||
*
|
||||
* @return the height in pixels.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Sets the size of the text field.
|
||||
*
|
||||
* @param width the new width.
|
||||
* @param height the new height.
|
||||
* @return this text field instance.
|
||||
*/
|
||||
ITextField setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Returns the current text content of the text field.
|
||||
*
|
||||
* @return the text.
|
||||
*/
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* Sets the text content of the text field.
|
||||
*
|
||||
* @param text the new text.
|
||||
* @return this text field instance.
|
||||
*/
|
||||
ITextField setText(String text);
|
||||
}
|
||||
@@ -1,23 +1,84 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
public interface ITexturedRect extends ICustomGuiComponent {
|
||||
String getTexture();
|
||||
|
||||
ITexturedRect setTexture(String texture);
|
||||
|
||||
int getWidth();
|
||||
|
||||
int getHeight();
|
||||
|
||||
ITexturedRect setSize(int width, int height);
|
||||
|
||||
float getScale();
|
||||
|
||||
ITexturedRect setScale(float scale);
|
||||
|
||||
int getTextureX();
|
||||
|
||||
int getTextureY();
|
||||
|
||||
ITexturedRect setTextureOffset(int textureX, int textureY);
|
||||
}
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
/**
|
||||
* Represents a textured rectangle component in a custom GUI.
|
||||
* Allows configuration of texture resource, size, scale, and texture offset.
|
||||
*/
|
||||
public interface ITexturedRect extends ICustomGuiComponent {
|
||||
|
||||
/**
|
||||
* Returns the texture resource location.
|
||||
*
|
||||
* @return the texture as a string.
|
||||
*/
|
||||
String getTexture();
|
||||
|
||||
/**
|
||||
* Sets the texture resource location.
|
||||
*
|
||||
* @param texture the texture resource location.
|
||||
* @return this textured rectangle instance.
|
||||
*/
|
||||
ITexturedRect setTexture(String texture);
|
||||
|
||||
/**
|
||||
* Returns the width of the rectangle.
|
||||
*
|
||||
* @return the width in pixels.
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Returns the height of the rectangle.
|
||||
*
|
||||
* @return the height in pixels.
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Sets the size of the rectangle.
|
||||
*
|
||||
* @param width the new width.
|
||||
* @param height the new height.
|
||||
* @return this textured rectangle instance.
|
||||
*/
|
||||
ITexturedRect setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Returns the scale factor of the rectangle.
|
||||
*
|
||||
* @return the scale.
|
||||
*/
|
||||
float getScale();
|
||||
|
||||
/**
|
||||
* Sets the scale factor of the rectangle.
|
||||
*
|
||||
* @param scale the new scale.
|
||||
* @return this textured rectangle instance.
|
||||
*/
|
||||
ITexturedRect setScale(float scale);
|
||||
|
||||
/**
|
||||
* Returns the texture's x offset.
|
||||
*
|
||||
* @return the x offset.
|
||||
*/
|
||||
int getTextureX();
|
||||
|
||||
/**
|
||||
* Returns the texture's y offset.
|
||||
*
|
||||
* @return the y offset.
|
||||
*/
|
||||
int getTextureY();
|
||||
|
||||
/**
|
||||
* Sets the texture offset.
|
||||
*
|
||||
* @param textureX the new x offset.
|
||||
* @param textureY the new y offset.
|
||||
* @return this textured rectangle instance.
|
||||
*/
|
||||
ITexturedRect setTextureOffset(int textureX, int textureY);
|
||||
}
|
||||
Reference in new issue
Block a user