Se rendre au contenu

TetraLibs Forge

En solo TetraLibs vous ajoute automatiquement la permission BCK mais en multijoueur non et donc pour s'ajouter la permission vous devrez le faire depuis la console pour aux moins ajouter la permission BCK à un joueur qui pourras ensuite exécuté la commande /tetralibs permissions <player>  add bck.Config TetraPage

BCKClass

Classe représentant une classe Java pour la documentation. Cette classe est utilisée pour encapsuler les informations d'une classe Java, y compris son nom, sa description (généralement récupérée depuis le Javadoc), et ses méthodes associées.

Méthodes Disponibles

Méthode Description Paramètre Retour
BCKClass Constructeur de la classe BCKClass. Initialise le nom de la classe. nom (String) void
getName Permet de récupérer le nom de la classe. Aucun String
setName Permet de définir le nom de la classe. nom (String) void
getDescription Permet de récupérer la description de la classe. Aucun String
setDescription Permet de définir la description de la classe. description (String) void
getMethods Permet de récupérer la liste des méthodes de la classe. Aucun List<BCKMethod>
setMethods Permet de définir la liste des méthodes de la classe. méthodes (List<BCKMethod>) void

Exemple d'Utilisation

// Exemple d'utilisation pour BCKClass :
        
// Exemple de code ici...

Class representing a Java class for documentation. This class is used to encapsulate the information of a Java class, including its name, its description (usually retrieved from the Javadoc), and its associated methods.

Available Methods

Method Description Parameter Return
BCKClass Constructor of the BCKClass. Initializes the name of the class. name (String) void
getName Getter to retrieve the class name. None String
setName Setter to set the class name. name (String) void
getDescription Getter to retrieve the class description. None String
setDescription Setter to set the class description. description (String) void
getMethods Getter to retrieve the list of methods of the class. None List<BCKMethod>
setMethods Setter to define the list of methods of the class. methods (List<BCKMethod>) void

Example of Use

// Usage example for BCKClass:
        
// Example code here...

BCKMethod

Classe représentant une méthode d'une classe Java. Elle contient des informations sur le nom de la méthode, le type de retour, les paramètres de la méthode et une description de la méthode, qui peuvent être utilisés pour générer de la documentation ou pour d'autres analyses.

Méthodes Disponibles

Méthode Description Paramètre Retour
BCKMethod Constructeur de la classe BCKMethod. Initialise une nouvelle méthode avec son nom, son type de retour, sa liste de paramètres et sa description. name (String)
returnType (String)
parameters (List<BCKParameter>)
description (String)
annotation (String)
void
getParameters Permet d'obtenir la liste des paramètres de la méthode. Aucun List<BCKParameter>
getReturnType Permet d'obtenir le type de retour de la méthode. Aucun String
getDescription Permet d'obtenir la description de la méthode. Aucun String
getName Permet d'obtenir le nom de la méthode. Aucun String
getAnnotation Permet d'obtenir l'annotation de la méthode. Aucun String

Exemple d'Utilisation

// Exemple d'utilisation pour BCKMethod :
BCKMethod method = new BCKMethod(
    "calculateSum",
    "int",
    List.of(new BCKParameter("a", "int"), new BCKParameter("b", "int")),
    "Adds two integers and returns the result.",
    "@Override"
);
SuperLog.info("MyMod", method.getName());

Class representing a method of a Java class. It contains information about the method name, return type, parameters, and a description of the method, which can be used for documentation or other analyses.

Available Methods

Method Description Parameter Return
BCKMethod Constructor of the BCKMethod class. Initializes a new method with its name, return type, parameters, and description. name (String)
returnType (String)
parameters (List<BCKParameter>)
description (String)
annotation (String)
void
getParameters Retrieves the list of method parameters. None List<BCKParameter>
getReturnType Retrieves the return type of the method. None String
getDescription Retrieves the description of the method. None String
getName Retrieves the name of the method. None String
getAnnotation Retrieves the method annotation. None String

Example of Use

// Usage example for BCKMethod:
BCKMethod method = new BCKMethod(
    "calculateSum",
    "int",
    List.of(new BCKParameter("a", "int"), new BCKParameter("b", "int")),
    "Adds two integers and returns the result.",
    "@Override"
);
SuperLog.info("MyMod", method.getName());

BCKParameter

Classe représentant un paramètre d'une méthode Java pour la documentation. Cette classe est utilisée pour stocker les informations relatives à un paramètre, telles que son type et son nom, dans le cadre de la documentation des méthodes.

Méthodes Disponibles

Méthode Description Paramètre Retour
BCKParameter Constructeur de la classe BCKParameter.
Initialise un objet représentant un paramètre avec son type et son nom.
type (String)
name (String)
Aucun
getType Getter pour le type du paramètre.
Permet de récupérer le type du paramètre.
Aucun String
getName Getter pour le nom du paramètre.
Permet de récupérer le nom du paramètre.
Aucun String

Exemple d'Utilisation

// Exemple d'utilisation pour BCKParameter :
BCKParameter param = new BCKParameter("String", "name");
SuperLog.info("MyMod", "Paramètre créé : " + param.getType() + " " + param.getName());

Class representing a parameter of a Java method for documentation purposes. This class is used to store information related to a parameter, such as its type and name, in the context of method documentation.

Available Methods

Method Description Parameter Return
BCKParameter Constructor of the BCKParameter class.
Initializes an object representing a parameter with its type and name.
type (String)
name (String)
None
getType Getter for the parameter type.
Allows retrieving the type of the parameter.
None String
getName Getter for the parameter name.
Allows retrieving the name of the parameter.
None String

Usage Example

// Usage example for BCKParameter:
BCKParameter param = new BCKParameter("String", "name");
SuperLog.info("MyMod", "Parameter created: " + param.getType() + " " + param.getName());

BCKPermissions

Classe gérant les permissions des joueurs et du serveur. Elle permet d'ajouter, de supprimer et de vérifier des permissions pour les joueurs et le serveur.

Méthodes Disponibles

Méthode Description Paramètre Retour
defaultPermissions Ajoute les permissions par défaut à un joueur si elles ne sont pas déjà attribuées.
entity (Entity)
callback (int)
void
Variante sans argument callback.
Paramètre : entity (Entity).
Retourne void.
getFormattedServerPermissions Formate les permissions du serveur selon un modèle spécifié.
pattern (String)
replaceable (String)
String
Variante sans argument replaceable.
Paramètre : pattern (String).
Retourne String.
getFormattedPlayerPermissions Formate les permissions d'un joueur selon un modèle spécifié.
entity (Entity)
pattern (String)
replaceable (String)
String
Variante sans argument replaceable.
Paramètres : entity (Entity), pattern (String).
Retourne String.
addPermission Ajoute une permission à un joueur.
entity (Entity)
permission (String)
callback (boolean)
boolean
Variante sans argument callback.
Paramètres : entity (Entity), permission (String).
Retourne boolean.
removePermission Supprime une permission d'un joueur.
entity (Entity)
permission (String)
callback (boolean)
boolean
Variante sans argument callback.
Paramètres : entity (Entity), permission (String).
Retourne boolean.
getPermissionsArray Récupère les permissions d'un joueur sous forme de tableau. entity (Entity) String[]
hasPermission Vérifie si un joueur possède une permission. entity (Entity)
permission (String)
boolean
getEntityPermissions Récupère les permissions d'une entité. entity (Entity) String[]
setPlayerPermissions Définit les permissions d'un joueur dans les données utilisateurs. entity (Entity)
permissions (String[])
void
getServerPermissions Récupère les permissions du serveur sous forme de tableau. Aucun String[]
addServerPermission Ajoute une permission au serveur si elle n'existe pas déjà.
permission (String)
callback (boolean)
boolean
Variante sans argument callback.
Paramètre : permission (String).
Retourne boolean.
removeServerPermission Supprime une permission du serveur si elle existe.
permission (String)
callback (boolean)
boolean
Variante sans argument callback.
Paramètre : permission (String).
Retourne boolean.
getPermissionsArray Récupère les permissions d'un joueur sous forme de tableau. entity (Entity) String[]
hasPermission Vérifie si un joueur possède une permission. entity (Entity)
permission (String)
boolean
getEntityPermissions Récupère les permissions d'une entité. entity (Entity) String[]
setPlayerPermissions Définit les permissions d'un joueur dans les données utilisateurs. entity (Entity)
permissions (String[])
void

Exemple d'Utilisation

// Exemple d'utilisation pour BCKPermissions :
      Entity player = ...; // Obtenez une entité joueur
      BCKPermissions.defaultPermissions(player, 1);
      SuperLog.info("MyMod", "Permissions par défaut attribuées au joueur : " + player.getName().getString());
    

Class managing player and server permissions. It allows adding, removing, and verifying permissions for players and the server.

Available Methods

Method Description Parameter Return
defaultPermissions Adds default permissions to a player if they are not already assigned.
entity (Entity)
callback (int)
void
Variant without callback argument.
Parameter: entity (Entity).
Returns void.
getFormattedServerPermissions Formats server permissions based on a specified pattern.
pattern (String)
replaceable (String)
String
Variant without replaceable argument.
Parameter: pattern (String).
Returns String.
getFormattedPlayerPermissions Formats a player's permissions according to a specified pattern.
entity (Entity)
pattern (String)
replaceable (String)
String
Variant without the replaceable argument.
Parameters: entity (Entity), pattern (String).
Returns String.
addPermission Adds a permission to a player.
entity (Entity)
permission (String)
callback (boolean)
boolean
Variant without the callback argument.
Parameters: entity (Entity), permission (String).
Returns boolean.
removePermission Removes a permission from a player.
entity (Entity)
permission (String)
callback (boolean)
boolean
Variant without the callback argument.
Parameters: entity (Entity), permission (String).
Returns boolean.
getPermissionsArray Retrieves a player's permissions as an array. entity (Entity) String[]
hasPermission Checks if a player has a specific permission. entity (Entity)
permission (String)
boolean
getEntityPermissions Retrieves the permissions of an entity. entity (Entity) String[]
setPlayerPermissions Sets the permissions of a player in the user data. entity (Entity)
permissions (String[])
void
getServerPermissions Retrieves the server's permissions as an array. None String[]
addServerPermission Adds a permission to the server if it does not already exist.
permission (String)
callback (boolean)
boolean
Variant without the callback argument.
Parameter: permission (String).
Returns boolean.
removeServerPermission Removes a permission from the server if it exists.
permission (String)
callback (boolean)
boolean
Variant without the callback argument.
Parameter: permission (String).
Returns boolean.
getPermissionsArray Retrieves a player's permissions as an array. entity (Entity) String[]
hasPermission Checks if a player has a specific permission. entity (Entity)
permission (String)
boolean
getEntityPermissions Retrieves all permissions assigned to an entity. entity (Entity) String[]
setPlayerPermissions Defines a set of permissions for a player within the user data. entity (Entity)
permissions (String[])
void

Example of Use

// Usage example for BCKPermissions:
      Entity player = ...; // Obtain a player entity
      BCKPermissions.defaultPermissions(player, 1);
      SuperLog.info("MyMod", "Default permissions assigned to player: " + player.getName().getString());
    

BCKSuggestionProvider

Classe fournissant des méthodes pour générer des suggestions de commandes pour les permissions. Ces suggestions sont utilisées dans un contexte de commande Minecraft via Brigadier.

Méthodes Disponibles

Méthode Description Paramètre Retour
suggestions Génère des suggestions de permissions basées sur le type et l'entité du joueur. context (CommandContext<CommandSourceStack>)
builder (SuggestionsBuilder)
type (String)
player (Entity, nullable)
CompletableFuture<Suggestions>
listSuggestions Génère des suggestions basées sur une liste donnée. context (CommandContext<CommandSourceStack>)
builder (SuggestionsBuilder)
list (String[])
CompletableFuture<Suggestions>
createSuggestionProvider Crée un fournisseur de suggestions basé sur un type de permissions et un joueur. type (String)
player (Entity, nullable)
SuggestionProvider<CommandSourceStack>
createSuggestionProviderFromList Crée un fournisseur de suggestions basé sur une liste spécifique de données. list (String[]) SuggestionProvider<CommandSourceStack>
suggest Crée un fournisseur de suggestions à partir d'un tableau de suggestions. suggestions (String[]) SuggestionProvider<CommandSourceStack>

Exemple d'Utilisation

// Exemple d'utilisation pour BCKSuggestionProvider :
SuggestionProvider provider =
    BCKSuggestionProvider.createSuggestionProvider("player_permissions", player);
SuperLog.info("MyMod", "SuggestionProvider créé avec succès.");

Class providing methods for generating command suggestions for permissions. These suggestions are used in a Minecraft command context via Brigadier.

Available Methods

Method Description Parameter Return
suggestions Generates suggestions for permissions based on type and player entity. context (CommandContext<CommandSourceStack>)
builder (SuggestionsBuilder)
type (String)
player (Entity, nullable)
CompletableFuture<Suggestions>
listSuggestions Generates suggestions based on a provided list. context (CommandContext<CommandSourceStack>)
builder (SuggestionsBuilder)
list (String[])
CompletableFuture<Suggestions>
createSuggestionProvider Creates a suggestion provider based on permission type and player entity. type (String)
player (Entity, nullable)
SuggestionProvider<CommandSourceStack>
createSuggestionProviderFromList Creates a suggestion provider based on a specific list of data. list (String[]) SuggestionProvider<CommandSourceStack>
suggest Creates a suggestion provider from an array of suggestions. suggestions (String[]) SuggestionProvider<CommandSourceStack>

Example of Use

// Usage example for BCKSuggestionProvider:
SuggestionProvider provider =
    BCKSuggestionProvider.createSuggestionProvider("player_permissions", player);
SuperLog.info("MyMod", "SuggestionProvider created successfully.");

BlockEventBreak

Classe qui gère l'événement de destruction de blocs dans le jeu. Cette classe est enregistrée pour écouter les événements de type BlockEvent.BreakEvent. Lorsqu'un joueur casse un bloc, un message est loggé avec des informations sur l'événement.

Méthodes Disponibles

Méthode Description Annotations Paramètre Retour
onBlockBreak Méthode appelée lors de l'événement de rupture d'un bloc. Elle enregistre un message avec les informations sur le bloc cassé, le joueur et le monde dans lequel cela se produit. @SubscribeEvent event (BlockEvent.BreakEvent) void

Exemple d'Utilisation

// Exemple d'utilisation pour BlockEventBreak :
BlockEvent.BreakEvent event = ...; // Obtenez un événement de rupture de bloc
BlockEventBreak.onBlockBreak(event);
SuperLog.info("MyMod", "Bloc cassé par un joueur, log enregistré.");

Class that handles block break events in the game. This class is registered to listen to events of type BlockEvent.BreakEvent. When a player breaks a block, a message is logged with information about the event.

Available Methods

Method Description Annotations Parameter Return
onBlockBreak Method called when a block break event occurs. It logs a message with information about the broken block, the player, and the world where it happens. @SubscribeEvent event (BlockEvent.BreakEvent) void

Example of Use

// Usage example for BlockEventBreak:
BlockEvent.BreakEvent event = ...; // Obtain a block break event
BlockEventBreak.onBlockBreak(event);
SuperLog.info("MyMod", "Block broken by a player, log recorded.");

BlockEventPlace

Classe qui gère l'événement de placement de blocs dans le jeu. Cette classe est enregistrée pour écouter les événements de type BlockEvent.EntityPlaceEvent. Lorsqu'un joueur place un bloc, un message est loggé avec des informations sur l'événement.

Méthodes Disponibles

Méthode Description Annotations Paramètre Retour
onBlockBreak Méthode appelée lors de l'événement de placement d'un bloc. Elle enregistre un message avec les informations sur le bloc placé, le joueur (entité) et le monde dans lequel cela se produit. @SubscribeEvent event ( BlockEvent.EntityPlaceEvent) void

Exemple d'Utilisation

// Exemple d'utilisation pour BlockEventPlace :
BlockEvent.EntityPlaceEvent event = ...; // Obtenez un événement de placement de bloc
BlockEventPlace.onBlockBreak(event);
SuperLog.info("MyMod", "Bloc placé par une entité, log enregistré.");

Class that handles block placement events in the game. This class is registered to listen to events of type BlockEvent.EntityPlaceEvent. When a player places a block, a message is logged with information about the event.

Available Methods

Method Description Annotations Parameter Return
onBlockBreak Method called during a block placement event. It logs a message with information about the placed block, the player (entity), and the world where it happens. @SubscribeEvent event ( BlockEvent.EntityPlaceEvent) void

Example of Use

// Usage example for BlockEventPlace:
BlockEvent.EntityPlaceEvent event = ...; // Obtain a block placement event
BlockEventPlace.onBlockBreak(event);
SuperLog.info("MyMod", "Block placed by an entity, log recorded.");

BorderManager

Classe qui gère les bordures personnalisées pour les objets dans le jeu. Elle permet d'ajouter et de récupérer des bordures spécifiques associées à chaque objet.

Méthodes Disponibles

Méthode Description Paramètre Retour
addCustomBorder Méthode pour ajouter une bordure personnalisée à un objet. itemStack (ItemStack)
borderStyle ( BorderStyle)
void
getBorderStyle Méthode pour récupérer la bordure personnalisée d'un objet. itemStack (ItemStack) BorderStyle (nullable)

Exemple d'Utilisation

// Exemple d'utilisation pour BorderManager :
ItemStack itemStack = ...; // Obtenez un objet ItemStack
BorderStyle borderStyle = ...; // Définissez un style de bordure

// Ajout d'une bordure personnalisée
BorderManager.addCustomBorder(itemStack, borderStyle);
SuperLog.info("MyMod", "Bordure ajoutée avec succès.");

// Récupération de la bordure personnalisée
BorderStyle retrievedStyle = BorderManager.getBorderStyle(itemStack);
if (retrievedStyle != null) {
    SuperLog.info("MyMod", "Bordure récupérée : " + retrievedStyle.toString());
} else {
    SuperLog.info("MyMod", "Aucune bordure définie pour cet objet.");
}

Class that manages custom borders for items in the game. It allows adding and retrieving specific borders associated with each item.

Available Methods

Method Description Parameter Return
addCustomBorder Method to add a custom border to an item. itemStack (ItemStack)
borderStyle ( BorderStyle)
void
getBorderStyle Method to retrieve the custom border of an item. itemStack (ItemStack) BorderStyle (nullable)

Example of Use

// Usage example for BorderManager:
ItemStack itemStack = ...; // Obtain an ItemStack object
BorderStyle borderStyle = ...; // Define a border style

// Adding a custom border
BorderManager.addCustomBorder(itemStack, borderStyle);
SuperLog.info("MyMod", "Border successfully added.");

// Retrieving the custom border
BorderStyle retrievedStyle = BorderManager.getBorderStyle(itemStack);
if (retrievedStyle != null) {
    SuperLog.info("MyMod", "Border retrieved: " + retrievedStyle.toString());
} else {
    SuperLog.info("MyMod", "No border defined for this item.");
}

BorderStyle

Enumération représentant différents styles de bordures pour les objets. Chaque style de bordure est associé à une couleur (ou un code hexadécimal).

Constantes Disponibles

  • DEFAULT : Bordure par défaut (aucune couleur spécifique).
  • GREEN_BORDER : Bordure verte (#4dff76).
  • BLUE_BORDER : Bordure bleue (#00d5ff).
  • PURPLE_BORDER : Bordure violette (#9a4dff).
  • YELLOW_BORDER : Bordure jaune (#e5ff00).
  • CUSTOM_BORDER : Bordure personnalisée (sans couleur définie par défaut).

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
toString Méthode qui retourne la représentation sous forme de chaîne de caractère du style de bordure. Aucun String @Override

Exemple d'Utilisation

// Exemple d'utilisation pour BorderStyle :
BorderStyle style = BorderStyle.GREEN_BORDER;
SuperLog.info("MyMod", "Le style de bordure sélectionné est : " + style.toString());

Enumeration representing different border styles for objects. Each border style is associated with a color (or a hexadecimal code).

Available Constants

  • DEFAULT: Default border (no specific color).
  • GREEN_BORDER: Green border (#4dff76).
  • BLUE_BORDER: Blue border (#00d5ff).
  • PURPLE_BORDER: Purple border (#9a4dff).
  • YELLOW_BORDER: Yellow border (#e5ff00).
  • CUSTOM_BORDER: Custom border (no default color defined).

Available Methods

Method Description Parameter Return Annotations
toString Method that returns the string representation of the border style. None String @Override

Example of Use

// Usage example for BorderStyle:
BorderStyle style = BorderStyle.GREEN_BORDER;
SuperLog.info("MyMod", "The selected border style is: " + style.toString());

ChestEventOpen

Classe qui gère l'événement d'ouverture d'un coffre par un joueur dans le jeu. Cette classe écoute les événements de type PlayerInteractEvent.RightClickBlock, et enregistre un message de log quand un joueur ouvre un coffre.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onRightClickBlock Méthode appelée lors d'un clic droit sur un bloc. Cette méthode vérifie si le joueur a interagi avec un coffre et enregistre un message de log avec les détails de l'événement. event (PlayerInteractEvent.RightClickBlock) void @SubscribeEvent

Exemple d'Utilisation

// Exemple d'utilisation pour ChestEventOpen :
PlayerInteractEvent.RightClickBlock event = ...; // Simuler un événement
ChestEventOpen.onRightClickBlock(event);
SuperLog.info("MyMod", "Un joueur a ouvert un coffre !");

Class that handles the event of a player opening a chest in the game. This class listens to PlayerInteractEvent.RightClickBlock events and logs a message when a player opens a chest.

Available Methods

Method Description Parameter Return Annotations
onRightClickBlock Method called when a block is right-clicked. This method checks if the player interacted with a chest and logs a message with the event details. event (PlayerInteractEvent.RightClickBlock) void @SubscribeEvent

Example of Use

// Usage example for ChestEventOpen:
PlayerInteractEvent.RightClickBlock event = ...; // Simulate an event
ChestEventOpen.onRightClickBlock(event);
SuperLog.info("MyMod", "A player has opened a chest!");

CommandEventHandler

Classe qui gère l'événement lié à l'exécution des commandes dans le jeu. Elle écoute les événements de commande et enregistre des informations dans les logs chaque fois qu'une commande est exécutée, avec des détails sur le joueur qui a envoyé la commande et la commande elle-même.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onCommandEvent Méthode appelée chaque fois qu'une commande est exécutée dans le jeu. Elle enregistre un message de log contenant des informations sur la commande exécutée et sur le joueur qui a envoyé la commande. event (CommandEvent) void @SubscribeEvent

Exemple d'Utilisation

// Exemple d'utilisation pour CommandEventHandler :
CommandEvent event = ...; // Simuler un événement de commande
CommandEventHandler.onCommandEvent(event);
SuperLog.info("MyMod", "Une commande a été exécutée.");

Class that handles events related to the execution of commands in the game. It listens to command events and logs information every time a command is executed, including details about the player who issued the command and the command itself.

Available Methods

Method Description Parameter Return Annotations
onCommandEvent Method called whenever a command is executed in the game. It logs a message containing information about the executed command and the player who issued it. event (CommandEvent) void @SubscribeEvent

Example of Use

// Usage example for CommandEventHandler:
CommandEvent event = ...; // Simulate a command event
CommandEventHandler.onCommandEvent(event);
SuperLog.info("MyMod", "A command has been executed.");

Config

Classe qui gère la configuration de l'application TetraLibs. Cette classe permet de charger, modifier et supprimer des configurations à partir d'un fichier JSON, de gérer les configurations temporaires et d'effectuer des vérifications sur les paramètres.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
getTemporaryConfigurations Récupère les configurations temporaires sous forme de carte. Aucun Map<string, boolean> Aucune
getTemporaryConfigurationsAsTetraConfig Récupère les configurations temporaires sous forme d'un objet TetraConfig. Aucun TetraConfig Aucune
clearTemporaryConfigurations Efface toutes les configurations temporaires. Si le paramètre callback est true, un message de confirmation est enregistré dans les logs.
callback (boolean) void Aucune
Variante sans argument callback.
Retourne void.
setTemporaryConfigurations Charge les configurations temporaires depuis un fichier JSON. Les configurations sont lues et stockées dans la carte temporaryConfigurations. Aucun void Aucune
initializeConfigurations Initialise les configurations de base du module TetraLibs. Cette méthode ajoute les configurations par défaut et les configurations supplémentaires définies par l'utilisateur. Aucun void @Override
addConfiguration Ajoute une nouvelle configuration avec un nom et une valeur. name (String)
value (boolean)
void @Override
removeConfiguration Supprime une configuration par son nom. name (String) void @Override
getConfiguration Récupère la valeur d'une configuration par son nom. name (String) boolean @Override
isConfigurationEnabled Vérifie si une configuration est activée (retourne true). name (String) boolean @Override
transferConfig Transfère toutes les configurations d'un autre objet Config vers celui-ci. config (Config) void Aucune
getAdditionalConfigurations Récupère les configurations supplémentaires. Aucun Map<string, boolean> Aucune

Exemple d'Utilisation

// Exemple d'utilisation pour Config :
  Config config = new Config();
  config.addConfiguration("new_feature", true);
  SuperLog.info("MyMod", "Nouvelle configuration ajoutée !");

Class that manages the configuration of the TetraLibs application. This class allows loading, modifying, and deleting configurations from a JSON file, managing temporary configurations, and performing parameter validations.

Available Methods

Method Description Parameter Return Annotations
Method Description Parameter Return Annotations
getTemporaryConfigurations Retrieves temporary configurations as a map. None Map<string, boolean> None
getTemporaryConfigurationsAsTetraConfig Retrieves temporary configurations as a TetraConfig object. None TetraConfig None
clearTemporaryConfigurations Clears all temporary configurations. If the callback parameter is true, a confirmation message is logged.
callback (boolean) void None
Variant without the callback argument.
Returns void.
setTemporaryConfigurations Loads temporary configurations from a JSON file. Configurations are read and stored in the `temporaryConfigurations` map. None void None
initializeConfigurations Initializes the basic configurations of the TetraLibs module. This method adds default configurations and additional user-defined configurations. None void @Override
addConfiguration Adds a new configuration with a name and a value. name (String)
value (boolean)
void @Override
removeConfiguration Removes a configuration by its name. name (String) void @Override
getConfiguration Retrieves the value of a configuration by its name. name (String) boolean @Override
isConfigurationEnabled Checks if a configuration is enabled (returns true). name (String) boolean @Override
transferConfig Transfers all configurations from another Config object to this one. config (Config) void None
getAdditionalConfigurations Retrieves additional configurations. None Map<string, boolean> None

Example of Use

// Usage example for Config:
  Config config = new Config();
  config.addConfiguration("new_feature", true);
  SuperLog.info("MyMod", "New configuration added!");

ConfigManager

Classe responsable de la gestion des fichiers de configuration dans TetraLibs. Elle permet de charger, sauvegarder et copier des fichiers de configuration pour le serveur Minecraft.

Méthodes Disponibles

Méthode Description Paramètre Retour
initializeConfig Charge et stocke les configurations au démarrage du monde.
reloaded (boolean)
Optionnel
void
Variante sans le paramètre reloaded.
Paramètre : Aucun.
Retourne : void.
getLoadedConfig Récupère la configuration chargée. Lève une exception si la configuration n'a pas été initialisée. Aucun TetraConfig
loadConfig Charge la configuration depuis un fichier.
callback (boolean)
reloaded (boolean)
Optionnel
TetraConfig
Variantes supplémentaires :
1. Avec uniquement callback comme paramètre.
Paramètre : callback (boolean).
Retourne : TetraConfig.

2. Sans aucun paramètre.
Paramètre : Aucun.
Retourne : TetraConfig.
saveConfig Sauvegarde la configuration dans un fichier au format JSON. config (TetraConfig) void
copyFile Copie un fichier vers le répertoire de configuration. Si le fichier existe déjà, il est remplacé. file (File) void

Exemple d'Utilisation

// Exemple d'utilisation pour ConfigManager :
ConfigManager.initializeConfig(true);
TetraConfig config = ConfigManager.getLoadedConfig();
SuperLog.info("MyMod", "Configuration chargée avec succès !");

Class responsible for managing configuration files in TetraLibs. This class allows loading, saving, and copying configuration files for the Minecraft server.

Available Methods

Method Description Parameter Return
initializeConfig Loads and stores configurations during world initialization.
reloaded (boolean)
Optional
void
Variant without the reloaded parameter.
Parameter : None.
Returns : void.
getLoadedConfig Retrieves the loaded configuration. Throws an exception if the configuration has not been initialized. None TetraConfig
loadConfig Loads the configuration from a file.
callback (boolean)
reloaded (boolean)
Optional
TetraConfig
Additional variants:
1. With only callback as a parameter.
Parameter : callback (boolean).
Returns : TetraConfig.

2. Without any parameters.
Parameter : None.
Returns : TetraConfig.
saveConfig Saves the configuration to a file in JSON format. config (TetraConfig) void
copyFile Copies a file to the configuration directory. If the file already exists, it is replaced. file (File) void

Example of Use

// Usage example for ConfigManager:
ConfigManager.initializeConfig(true);
TetraConfig config = ConfigManager.getLoadedConfig();
SuperLog.info("MyMod", "Configuration loaded successfully!");

ConsoleColors

Enumération qui contient les codes de couleur ANSI pour la coloration du texte dans la console. Ces couleurs peuvent être utilisées pour modifier l'apparence du texte dans un terminal compatible.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
toString Retourne le code ANSI de la couleur sous forme de chaîne de caractères. Aucun String @Override

Exemple d'Utilisation

// Exemple d'utilisation pour ConsoleColors :
System.out.println(ConsoleColors.GREEN + "Texte vert" + ConsoleColors.RESET);
System.out.println(ConsoleColors.RED_BOLD + "Texte rouge en gras" + ConsoleColors.RESET);

Enumeration that contains ANSI color codes for text coloring in the console. These colors can be used to modify the appearance of text in a compatible terminal.

Available Methods

Method Description Parameter Return Annotations
toString Returns the ANSI color code as a string. None String @Override

Example of Use

// Usage example for ConsoleColors:
System.out.println(ConsoleColors.GREEN + "Green text" + ConsoleColors.RESET);
System.out.println(ConsoleColors.RED_BOLD + "Bold red text" + ConsoleColors.RESET);

CreativeChecker

Classe permettant de vérifier si un joueur est en mode créatif et d'exécuter des actions spécifiques en fonction de cette vérification.

Méthodes Disponibles

Méthode Description Paramètre Retour
CreativeChecker Constructeur de la classe CreativeChecker. player (Player) Aucun
isNotInCreativeMode Vérifie si le joueur n'est pas en mode créatif.
Retourne true si le joueur est en mode autre que créatif (par exemple : survie), et false si le joueur est en mode créatif.
Aucun boolean
setNonCreativeEvent Permet de définir un événement personnalisé à exécuter si le joueur n'est pas en mode créatif. event (Consumer<Player>) void
action Exécute l'événement personnalisé si le joueur n'est pas en mode créatif.
Si le joueur est en mode créatif, aucun événement n'est exécuté.
Aucun void

Exemple d'Utilisation

// Exemple d'utilisation pour CreativeChecker :
Player player = ...; // Obtenez un joueur
CreativeChecker checker = new CreativeChecker(player);
checker.setNonCreativeEvent(p -> {
    SuperLog.info("MyMod", "Le joueur " + p.getName().getString() + " n'est pas en mode créatif.");
});
checker.action();

Class to check if a player is in creative mode and perform specific actions based on this verification.

Available Methods

Method Description Parameter Return
CreativeChecker Constructor for the CreativeChecker class. player (Player) None
isNotInCreativeMode Checks if the player is not in creative mode.
Returns true if the player is in a mode other than creative (e.g., survival), and false if the player is in creative mode.
None boolean
setNonCreativeEvent Allows defining a custom event to execute if the player is not in creative mode. event (Consumer<Player>) void
action Executes the custom event if the player is not in creative mode.
If the player is in creative mode, no event is executed.
None void

Example of Use

// Usage example for CreativeChecker:
Player player = ...; // Obtain a player
CreativeChecker checker = new CreativeChecker(player);
checker.setNonCreativeEvent(p -> {
    SuperLog.info("MyMod", "Player " + p.getName().getString() + " is not in creative mode.");
});
checker.action();

DocumentationGenerator

Classe permettant de générer une documentation au format JSON à partir du code source Java d'un projet. La documentation inclut les classes, leurs descriptions, et leurs méthodes avec les paramètres et types de retour.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
main Méthode principale pour générer la documentation de toutes les classes Java dans le dossier spécifié.
Parcourt tous les fichiers Java, génère la documentation et la sauvegarde dans un fichier JSON.
Aucun void Aucun
generateDocumentation Génère la documentation d'une classe à partir de son fichier source.
Retourne un objet représentant la classe, ou null si une erreur survient.
file (File) BCKClass Aucun
getClassDescription Extrait la description Javadoc de la classe à partir de son contenu source. fileContent (String) String Aucun
getMethods Extrait les méthodes et leurs descriptions Javadoc à partir du contenu source. fileContent (String) List<BCKMethod> Aucun
generateJsonDocumentation Génère la documentation JSON à partir d'une liste de classes et de méthodes. classes (List<BCKClass>) JsonObject Aucun
saveDocumentationToFile Sauvegarde la documentation JSON dans un fichier. jsonDoc (JsonObject) void Aucun

Exemple d'Utilisation

// Exemple d'utilisation pour DocumentationGenerator :
  DocumentationGenerator.main();

Class for generating JSON documentation from the Java source code of a project. The documentation includes classes, their descriptions, and their methods with parameters and return types.

Available Methods

Method Description Parameter Return Annotations
main Main method to generate documentation for all Java classes in the specified folder.
Scans all Java files, generates the documentation, and saves it to a JSON file.
None void None
generateDocumentation Generates the documentation for a class from its source file.
Returns an object representing the class, or null if an error occurs.
file (File) BCKClass None
getClassDescription Extracts the Javadoc description of the class from its source content. fileContent (String) String None
getMethods Extracts methods and their Javadoc descriptions from the source content. fileContent (String) List<BCKMethod> None
generateJsonDocumentation Generates JSON documentation from a list of classes and methods. classes (List<BCKClass>) JsonObject None
saveDocumentationToFile Saves the JSON documentation to a file. jsonDoc (JsonObject) void None

Example of Use

// Usage example for DocumentationGenerator:
  DocumentationGenerator.main();

EconomyManager

Classe permettant de gérer les interactions économiques d'un joueur dans le jeu, incluant l'argent en poche et en banque. Fournit des méthodes pour manipuler, transférer et sauvegarder les soldes d'argent.

Méthodes Disponibles

Méthode Description Paramètre Retour
saveBalances Sauvegarde les soldes d'un joueur (argent en poche et en banque) dans la base de données.
player (Player)
callback (boolean)
void
Variante sans argument callback.
Paramètre : player (Player).
Retourne void.
loadBalances Charge les soldes d'un joueur (argent en poche et en banque) depuis la base de données.
player (Player)
callback (boolean)
void
Variante sans argument callback.
Paramètre : player (Player).
Retourne void.
addMoney Ajoute une somme d'argent au solde en poche du joueur.
player (Player)
amount (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
player (Player)
amount (double).
Retourne void.
removeMoney Retire une somme d'argent au solde en poche du joueur.
player (Player)
amount (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
player (Player)
amount (double).
Retourne void.
setMoney Définit un montant précis pour l'argent en poche du joueur.
player (Player)
amount (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
player (Player)
amount (double).
Retourne void.
getMoney Récupère le solde actuel d'argent du joueur en poche. player (Player) double
hasMoney Vérifie si un joueur a un solde suffisant en poche. player (Player)
amount (double)
boolean
addBank Ajoute une somme d'argent au compte bancaire du joueur.
player (Player)
amount (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
player (Player)
amount (double).
Retourne void.
removeBank Retire une somme d'argent du compte bancaire du joueur.
player (Player)
amount (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
player (Player)
amount (double).
Retourne void.
setBank Définit un montant précis pour le solde bancaire du joueur.
player (Player)
amount (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
player (Player)
amount (double).
Retourne void.
getBank Récupère le solde actuel du compte bancaire du joueur. player (Player) double
hasBank Vérifie si un joueur a un solde bancaire suffisant. player (Player)
amount (double)
boolean
transferBank Transfère une somme d'argent du compte bancaire d'un joueur à celui d'un autre.
sender (Player)
receiver (Player)
amount (double)
callback (boolean)
boolean
Comportement : Si le joueur expéditeur (sender) n'a pas un solde bancaire suffisant, le transfert échoue et retourne false. Sinon, le transfert réussit et retourne true.
Paramètres :
sender (Player) - Le joueur expéditeur.
receiver (Player) - Le joueur destinataire.
amount (double) - La somme à transférer.
callback (boolean) - Indique si un message doit être affiché en cas de succès.

Exemple d'Utilisation

// Exemple d'utilisation pour EconomyManager :
Player player1 = ...; // Obtenez un joueur
EconomyManager.saveBalances(player1, true);
EconomyManager.addMoney(player1, 500.0);

Class for managing a player's economic interactions in the game, including wallet and bank balances. Provides methods to manipulate, transfer, and save balances.

Available Methods

Method Description Parameter Return
saveBalances Saves a player's balances (wallet and bank) to the database.
player (Player)
callback (boolean)
void
Variant without callback argument.
Parameter: player (Player).
Returns void.
loadBalances Loads a player's balances (wallet and bank) from the database.
player (Player)
callback (boolean)
void
Variant without callback argument.
Parameter: player (Player).
Returns void.
addMoney Adds an amount to the player's wallet balance.
player (Player)
amount (double)
callback (boolean)
void
Variant without callback argument.
Parameters:
player (Player)
amount (double).
Returns void.
removeBank Removes a specified amount from the player's bank account.
player (Player)
amount (double)
callback (boolean)
void
Variant without callback argument.
Parameters:
player (Player)
amount (double).
Returns void.
setBank Sets a specific amount for the player's bank account balance.
player (Player)
amount (double)
callback (boolean)
void
Variant without callback argument.
Parameters:
player (Player)
amount (double).
Returns void.
getBank Retrieves the player's current bank account balance. player (Player) double
hasBank Checks if the player has sufficient funds in their bank account. player (Player)
amount (double)
boolean
transferBank Transfers an amount from the sender's bank account to the receiver's account.
sender (Player)
receiver (Player)
amount (double)
callback (boolean)
boolean
Behavior: If the sender does not have sufficient bank balance, the transfer fails and returns false. Otherwise, the transfer succeeds and returns true.
Parameters:
sender (Player) - The sender player.
receiver (Player) - The receiver player.
amount (double) - The amount to transfer.
callback (boolean) - Whether a message should be displayed upon success.

Example of Use

// Usage example for EconomyManager:
Player player1 = ...; // Obtain a player
EconomyManager.saveBalances(player1, true);
EconomyManager.addMoney(player1, 500.0);

GameModeHandler

Classe fournissant des méthodes utilitaires pour vérifier le mode de jeu (solo ou multijoueur) et exécuter du code spécifiquement côté client ou serveur.

Méthodes Disponibles

Méthode Description Paramètre Retour
isSinglePlayer Vérifie si le joueur est en mode solo (jeu en solo).
Cette méthode utilise l'instance de Minecraft pour déterminer si le jeu est en mode solo.
Aucun boolean
isMultiPlayerServer Vérifie si le joueur est sur un serveur multijoueur.
Cette méthode utilise l'instance de MinecraftServer pour vérifier si le joueur est connecté à un serveur multijoueur.
Aucun boolean
executeClientOnlyCode Exécute du code côté client uniquement.
Cette méthode permet d'exécuter une action spécifique au client.
action (Runnable) void
executeServerOnlyCode Exécute du code côté serveur uniquement.
Cette méthode permet d'exécuter une action spécifique au serveur.
action (Runnable) void

Exemple d'Utilisation

// Exemple d'utilisation pour GameModeHandler :
if (GameModeHandler.isSinglePlayer()) {
    SuperLog.info("TetraLibs/GameModeHandler", "Le joueur est en mode solo.");
} else {
    SuperLog.info("TetraLibs/GameModeHandler", "Le joueur est sur un serveur multijoueur.");
}

GameModeHandler.executeClientOnlyCode(() -> {
    SuperLog.info("TetraLibs/GameModeHandler", "Code côté client exécuté.");
});

GameModeHandler.executeServerOnlyCode(() -> {
    SuperLog.info("TetraLibs/GameModeHandler", "Code côté serveur exécuté.");
});

Class providing utility methods to check the game mode (single-player or multiplayer) and execute code specifically on the client or server side.

Available Methods

Method Description Parameter Return
isSinglePlayer Checks if the player is in single-player mode.
This method uses the Minecraft instance to determine if the game is in single-player mode.
None boolean
isMultiPlayerServer Checks if the player is on a multiplayer server.
This method uses the MinecraftServer instance to check if the player is connected to a multiplayer server.
None boolean
executeClientOnlyCode Executes client-only code.
This method allows running an action specific to the client.
action (Runnable) void
executeServerOnlyCode Executes server-only code.
This method allows running an action specific to the server.
action (Runnable) void

Example of Use

// Example usage for GameModeHandler:
if (GameModeHandler.isSinglePlayer()) {
    SuperLog.info("TetraLibs/GameModeHandler", "Player is in single-player mode.");
} else {
    SuperLog.info("TetraLibs/GameModeHandler", "Player is on a multiplayer server.");
}

GameModeHandler.executeClientOnlyCode(() -> {
    SuperLog.info("TetraLibs/GameModeHandler", "Client-side code executed.");
});

GameModeHandler.executeServerOnlyCode(() -> {
    SuperLog.info("TetraLibs/GameModeHandler", "Server-side code executed.");
});

Init

Cette classe gère l'initialisation du mod TetraLibs. Elle s'exécute lors du cycle de vie de Forge et effectue des configurations générales, comme l'affichage de messages dans les logs ou l'appel à des méthodes importantes comme la génération de documentation.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
init Méthode appelée automatiquement par Forge lors de l'événement FMLCommonSetupEvent.
Agit comme un point d'entrée pour l'initialisation des fonctionnalités générales du mod.
Aucun void @SubscribeEvent
executeInit Méthode publique d'initialisation principale.
Permet d'appeler l'initialisation sans paramètre d'événement.
Aucun void Aucune
executeInit Méthode privée d'initialisation détaillée.
Effectue les principales actions d'initialisation, comme l'affichage de messages dans les logs et l'appel au générateur de documentation.
event (Event) (Optionnel) void Aucune

Exemple d'Utilisation

// Exemple d'utilisation pour Init :
Init.executeInit(); // Exécute l'initialisation principale sans événement.

This class handles the initialization of the TetraLibs mod. It runs during the Forge lifecycle and performs general configuration, such as logging messages and calling important methods like generating documentation.

Available Methods

Method Description Parameter Return Annotations
init Method automatically called by Forge during the FMLCommonSetupEvent.
Acts as an entry point for initializing the mod's general features.
None void @SubscribeEvent
executeInit Main public initialization method.
Allows calling the initialization without an event parameter.
None void None
executeInit Private detailed initialization method.
Performs the main initialization actions, such as logging messages and calling the documentation generator.
event (Event) (Optional) void None

Example of Use

// Example usage for Init:
Init.executeInit(); // Executes the main initialization without an event.

InventoryManager

Cette classe offre des méthodes utilitaires pour gérer l'inventaire des joueurs dans Minecraft. Elle fournit des fonctionnalités comme l'ajout, la suppression, la vérification et le comptage des objets dans l'inventaire d'un joueur.

Méthodes Disponibles

Méthode Description Paramètre Retour
clearInventory Vide l'intégralité de l'inventaire d'un joueur. player (Player) void
addItem Ajoute un objet spécifique à l'inventaire d'un joueur. player (Player)
item (ItemStack)
void
removeItem Supprime un objet spécifique de l'inventaire d'un joueur. player (Player)
item (ItemStack)
void
getPlayerItems Récupère tous les objets présents dans l'inventaire d'un joueur. player (Player) NonNullList<ItemStack>
hasItem Vérifie si un joueur possède un objet spécifique dans son inventaire. player (Player)
item (ItemStack)
boolean
countItems Compte le nombre d'instances d'un objet spécifique dans l'inventaire d'un joueur. player (Player)
item (ItemStack)
int

Exemple d'Utilisation

// Exemple d'utilisation pour InventoryManager :
Player player = ...; // Obtenez un joueur
ItemStack item = ...; // Créez un objet à ajouter
InventoryManager.addItem(player, item);
SuperLog.info("TetraLibs/InventoryManager", "Objet ajouté à l'inventaire du joueur.");

This class provides utility methods to manage a player's inventory in Minecraft. It offers features like adding, removing, checking, and counting items in a player's inventory.

Available Methods

Method Description Parameter Return
clearInventory Clears the entire inventory of a player. player (Player) void
addItem Adds a specific item to a player's inventory. player (Player)
item (ItemStack)
void
removeItem Removes a specific item from a player's inventory. player (Player)
item (ItemStack)
void
getPlayerItems Retrieves all the items present in a player's inventory. player (Player) NonNullList<ItemStack>
hasItem Checks if a player has a specific item in their inventory. player (Player)
item (ItemStack)
boolean
countItems Counts the number of instances of a specific item in a player's inventory. player (Player)
item (ItemStack)
int

Example of Use

// Example usage for InventoryManager:
Player player = ...; // Obtain a player
ItemStack item = ...; // Create an item to add
InventoryManager.addItem(player, item);
SuperLog.info("TetraLibs/InventoryManager", "Item added to player's inventory.");

ItemEventDrop

Cette classe gère les événements liés au largage d'objets par les joueurs. Elle est inscrite en tant qu'abonné aux événements Forge, ce qui permet de déclencher des actions spécifiques lorsque des événements ciblés surviennent.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onGemDropped Gestionnaire de l'événement de largage d'objet.
Cette méthode est appelée lorsque le joueur largue un objet dans le monde.
event (ItemTossEvent) void @SubscribeEvent

Exemple d'Utilisation

// Exemple d'utilisation pour ItemEventDrop :
ItemEventDrop.onGemDropped(event); // Appelle l'événement de largage d'objet
SuperLog.info("TetraLibs/ItemEventDrop", "L'objet a été largué avec succès.");

This class handles events related to item drops by players. It is subscribed to Forge events, allowing specific actions to be triggered when targeted events occur.

Available Methods

Method Description Parameter Return Annotations
onGemDropped Handles the item drop event.
This method is called when the player drops an item in the world.
event (ItemTossEvent) void @SubscribeEvent

Example of Use

// Example usage for ItemEventDrop:
ItemEventDrop.onGemDropped(event); // Calls the item drop event
SuperLog.info("TetraLibs/ItemEventDrop", "The item has been dropped successfully.");

ItemEventExpire

Gère les événements liés à l'expiration d'un objet dans le monde. Cette classe est enregistrée pour écouter les événements Forge, notamment les événements d'expiration des objets (ItemExpireEvent).

Méthodes Disponibles

Méthode Description Paramètre Retour
onGemDropped Gestionnaire de l'événement d'expiration d'objet.
Cette méthode est appelée lorsque qu'un objet dans le monde expire (disparaît).
event (ItemExpireEvent) void

Exemple d'Utilisation

// Exemple d'utilisation pour ItemEventExpire :
ItemEventExpire.onGemDropped(event); // Appelle l'événement d'expiration d'objet
SuperLog.info("TetraLibs/ItemEventExpire", "L'objet a expiré avec succès.");

Handles events related to the expiration of an item in the world. This class is registered to listen to Forge events, including item expiration events (ItemExpireEvent).

Available Methods

Method Description Parameter Return
onGemDropped Handles the item expiration event.
This method is called when an item in the world expires (disappears).
event (ItemExpireEvent) void

Example of Use

// Example usage for ItemEventExpire:
ItemEventExpire.onGemDropped(event); // Calls the item expiration event
SuperLog.info("TetraLibs/ItemEventExpire", "The item has expired successfully.");

ItemEventPickup

Gère les événements liés à la récupération d'objets par un joueur. Cette classe est enregistrée comme gestionnaire d'événements Forge pour écouter les événements de type EntityItemPickupEvent.

Méthodes Disponibles

Méthode Description Paramètre Retour
onGemDropped Gestionnaire de l'événement de ramassage d'objet.
Cette méthode est déclenchée lorsque qu'un joueur ramasse un objet dans le monde.
event (EntityItemPickupEvent) void

Exemple d'Utilisation

// Exemple d'utilisation pour ItemEventPickup :
ItemEventPickup.onGemDropped(event); // Appelle l'événement de ramassage d'objet
SuperLog.info("TetraLibs/ItemEventPickup", "L'objet a été ramassé avec succès.");

This class handles events related to item pickups by players. It is registered as a Forge event handler to listen to events like EntityItemPickupEvent.

Available Methods

Method Description Parameter Return
onGemDropped Handles the item pickup event.
This method is triggered when a player picks up an item in the world.
event (EntityItemPickupEvent) void

Example of Use

// Example usage for ItemEventPickup:
ItemEventPickup.onGemDropped(event); // Calls the item pickup event
SuperLog.info("TetraLibs/ItemEventPickup", "The item has been picked up successfully.");

ItemInfoTooltip

Classe qui gère l'affichage d'informations supplémentaires dans les infobulles des objets. Elle est associée à l'abonnement aux événements liés à l'affichage des infobulles des objets. Utilise un événement Forge pour modifier les infobulles des objets en fonction de leur clé.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onTooltipRender Événement qui est déclenché lorsque l'infobulle d'un objet est affichée.
Ajoute des informations supplémentaires si l'objet est dans la liste itemsWithAdditionalInfo et si la touche Shift est enfoncée.
event (ItemTooltipEvent) void @SubscribeEvent
getAdditionalInfo Récupère les informations supplémentaires d'un objet en utilisant sa clé.
La clé de l'objet est utilisée pour générer une clé de traduction pour l'infobulle.
stack (ItemStack) Component Aucune
addItemWithAdditionalInfo Ajoute un objet à la liste des objets ayant des informations supplémentaires dans l'infobulle. item (String) void Aucune
removeItemWithAdditionalInfo Supprime un objet de la liste des objets ayant des informations supplémentaires dans l'infobulle. item (String) void Aucune

Exemple d'Utilisation

// Exemple d'utilisation pour ItemInfoTooltip :
ItemInfoTooltip.addItemWithAdditionalInfo("mod:item_name"); // Ajoute un objet avec des infos supplémentaires
ItemInfoTooltip.removeItemWithAdditionalInfo("mod:item_name"); // Supprime un objet
SuperLog.info("TetraLibs/ItemInfoTooltip", "Infobulle mise à jour.");

Class that manages the display of additional information in item tooltips. It subscribes to events related to displaying item tooltips using a Forge event to modify the tooltips based on the item key.

Available Methods

Method Description Parameter Return Annotations
onTooltipRender Event triggered when an item tooltip is displayed.
Adds additional information if the item is in the itemsWithAdditionalInfo list and the Shift key is pressed.
event (ItemTooltipEvent) void @SubscribeEvent
getAdditionalInfo Retrieves additional information for an item using its key.
The item key is used to generate a translation key for the tooltip.
stack (ItemStack) Component None
addItemWithAdditionalInfo Adds an item to the list of items with additional information in the tooltip. item (String) void None
removeItemWithAdditionalInfo Removes an item from the list of items with additional information in the tooltip. item (String) void None

Example of Use

// Example usage for ItemInfoTooltip:
ItemInfoTooltip.addItemWithAdditionalInfo("mod:item_name"); // Adds an item with additional info
ItemInfoTooltip.removeItemWithAdditionalInfo("mod:item_name"); // Removes an item
SuperLog.info("TetraLibs/ItemInfoTooltip", "Tooltip updated.");

JsonKeyExtractor

Cette classe extrait toutes les clés imbriquées d'un fichier JSON dans le répertoire de configuration du mod, y compris les objets vides. Elle récupère les clés au format de chemin complet (par exemple, block.id, block.properties.hardness).

Méthodes Disponibles

Méthode Description Paramètre Retour
extractFullyQualifiedKeys Extrait toutes les clés imbriquées avec des chemins complets à partir d'un fichier JSON dans le répertoire de configuration du mod, y compris les objets vides. fileName (String)
path (String)
Set<String>
extractKeysRecursive Extrait de manière récursive uniquement les clés complètes à partir d'un élément JSON, en s'assurant que les objets vides sont inclus. element (JsonElement)
parentPath (String)
keys (Set)
void

Exemple d'Utilisation

// Exemple d'utilisation pour JsonKeyExtractor :
Set keys = JsonKeyExtractor.extractFullyQualifiedKeys("example.json", "/config/path/");
SuperLog.info("TetraLibs/JsonKeyExtractor", "Clés extraites : " + keys);

This class extracts all nested keys from a JSON file in the mod's config directory, including empty objects. It retrieves the keys in the full path format (e.g., block.id, block.properties.hardness).

Available Methods

Method Description Parameter Return
extractFullyQualifiedKeys Extracts all nested keys with full paths from a JSON file in the mod's config directory, including empty objects. fileName (String)
path (String)
Set<String>
extractKeysRecursive Recursively extracts only fully qualified keys from a JSON element, ensuring empty objects are included. element (JsonElement)
parentPath (String)
keys (Set)
void

Example of Use

// Example usage for JsonKeyExtractor:
Set keys = JsonKeyExtractor.extractFullyQualifiedKeys("example.json", "/config/path/");
SuperLog.info("TetraLibs/JsonKeyExtractor", "Extracted keys: " + keys);

Load

Cette classe est responsable de la gestion de l'événement lorsque le joueur se connecte au serveur. Lors de la connexion, elle effectue diverses initialisations et envoie des informations spécifiques au joueur concernant les fonctionnalités du mod.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onPlayerLoggedIn Événement déclenché lors de la connexion d'un joueur. Lors de la connexion, l'exécution de diverses initialisations et configurations spécifiques est effectuée. event (PlayerEvent.PlayerLoggedInEvent) void @SubscribeEvent
execute Méthode de surcharges permettant d'exécuter des actions lorsque le joueur se connecte, mais sans avoir à utiliser directement l'événement. Permet de spécifier les coordonnées et l'entité dans différents contextes. world (LevelAccessor)
x (double)
y (double)
z (double)
entity (Entity)
void Aucune
execute (avec Event) Exécute toutes les actions nécessaires au moment de la connexion du joueur, comme l'affichage de pages d'aide et le chargement des variables du joueur. event (Event)
world (LevelAccessor)
x (double)
y (double)
z (double)
entity (Entity)
void Aucune

Exemple d'Utilisation

// Exemple d'utilisation pour Load :
Load.onPlayerLoggedIn(event);

This class is responsible for managing the event when a player logs into the server. Upon login, it performs various initializations and sends specific information to the player regarding the mod's features.

Available Methods

Method Description Parameter Return Annotations
onPlayerLoggedIn Event triggered when a player logs in. During login, various initializations and specific configurations are executed. event (PlayerEvent.PlayerLoggedInEvent) void @SubscribeEvent
execute Overloaded method that executes actions when a player logs in, but without directly using the event. It allows specifying coordinates and the entity in different contexts. world (LevelAccessor)
x (double)
y (double)
z (double)
entity (Entity)
void None
execute (with Event) Executes all necessary actions at the moment of player login, such as displaying help pages and loading player variables. event (Event)
world (LevelAccessor)
x (double)
y (double)
z (double)
entity (Entity)
void None

Example of Use

// Example usage for Load:
Load.onPlayerLoggedIn(event);

LogLevel

Cette classe gère le niveau de journalisation (log level) pour les joueurs d'un serveur Minecraft. Elle permet d'afficher des messages dans le chat des joueurs en fonction de leur niveau de log, ainsi que de configurer les niveaux de log des joueurs.

Méthodes Disponibles

Méthode Description Paramètre Retour
tetraLog Envoie un message de log à tous les joueurs connectés, en fonction de leur niveau de log. Le message peut être envoyé uniquement à certains niveaux spécifiques, ou à tous les joueurs.
title (String)
text (String)
level (double)
only (boolean)
void
1. Variante sans argument only.
Paramètres :
title (String)
text (String)
level (double)
Retourne void.

2. Variante sans argument titre.
Paramètres :
text (String)
level (double)
only (boolean)
Retourne void.

3. Variante sans argument titre et only.
Paramètres :
text (String)
level (double)
Retourne void.
get Récupère le niveau de log d'un joueur. entity (Entity) double
set Définit le niveau de log d'un joueur.
entity (Entity)
num (double)
callback (boolean)
void
Variante sans argument callback.
Paramètres :
entity (Entity)
num (double)
callback (boolean)

Exemple d'Utilisation

// Exemple d'utilisation pour LogLevel :

// Exemple avec un titre
LogLevel.tetraLog("MyMod", "Ceci est un texte", 4);

// Exemple avec un titre & avec only
LogLevel.tetraLog("MyMod", "Ceci est un texte", 2, true);

This class manages the log level for players on a Minecraft server. It allows you to display messages in player chat based on their log level, as well as configure player log levels.

Available Methods

Method Description Parameter Return
tetraLog Sends a log message to all connected players, based on their log level. The message can be sent only to specific levels, or to all players.
title (String)
text (String)
level (double)
only (boolean)
void
1. Variant without argument only.
Parameters :
title (String)
text (String)
level (double)
Return void.

2. Variant without argument title.
Parameters :
text (String)
level (double)
only (boolean)
Return void.

3. Variant without argument title and only.
Parameters :
text (String)
level (double)
Return void.
get Retrieves a player's log level. entity (Entity) double
set Defines a player's log level.
entity (Entity)
num (double)
callback (boolean)
void
Variant without callback argument.
Parameters :
entity (Entity)
num (double)
callback (boolean)

Example of Use

// Example of use for LogLevel :

// Example with a title
LogLevel.tetraLog("MyMod", "This is a text", 4);

// Example with a title & with only
LogLevel.tetraLog("MyMod", "This is a text", 2, true);

MobUtil

Cette classe utilitaire permet de manipuler les attributs des entités vivantes dans Minecraft. Elle permet de définir et de récupérer des valeurs de base pour divers attributs comme les dégâts, la vitesse, la santé, etc.

Méthodes Disponibles

Méthode Description Paramètre Retour
setBaseDamage Définit les dégâts de base d'une entité vivante. entity (Entity)
newDamage (double)
void
setBaseAttackSpeed Définit la vitesse d'attaque de base d'une entité vivante. entity (Entity)
newSpeed (double)
void
setBaseSpeed Définit la vitesse de déplacement de base d'une entité vivante. entity (Entity)
newSpeed (double)
void
setBaseMaxHealth Définit la santé maximale de base d'une entité vivante. entity (Entity)
newHealth (double)
void
setBaseJumpStrength Définit la force de saut de base d'une entité vivante. entity (Entity)
newJumpStrength (double)
void
setBaseArmor Définit l'armure de base d'une entité vivante. entity (Entity)
newArmor (double)
void
setBaseArmorToughness Définit la robustesse de l'armure de base d'une entité vivante. entity (Entity)
newArmorToughness (double)
void
setBaseAttackKnockback Définit le recul d'attaque de base d'une entité vivante. entity (Entity)
newAttackKnockback (double)
void
setBaseKnockbackResistance Définit la résistance au recul de base d'une entité vivante. entity (Entity)
newKnockbackResistance (double)
void
setBaseLuck Définit la chance de base d'une entité vivante. entity (Entity)
newLuck (double)
void
getBaseDamage Récupère la valeur des dégâts de base d'une entité vivante. entity (Entity) double
getDamage Récupère la valeur des dégâts actuels d'une entité vivante. entity (Entity) double
getBaseArmorToughness Récupère la valeur de la robustesse de l'armure de base d'une entité vivante. entity (Entity) double
getBaseJumpStrength Récupère la valeur de la force de saut de base d'une entité vivante. entity (Entity) double
getBaseArmorKnockback Récupère la valeur du recul d'attaque de base d'une entité vivante. entity (Entity) double
getBaseKnockbackResistance Récupère la valeur de la résistance au recul de base d'une entité vivante. entity (Entity) double
getBaseLuck Récupère la valeur de la chance de base d'une entité vivante. entity (Entity) double

Exemple d'Utilisation

// Exemple d'utilisation pour MobUtil :

// Définir les dégâts de base d'une entité
MobUtil.setBaseDamage(entity, 10.0);

// Définir la vitesse d'attaque
MobUtil.setBaseAttackSpeed(entity, 1.5);

// Récupérer les dégâts actuels
double damage = MobUtil.getDamage(entity);

This utility class manages the attributes of living entities in Minecraft. It allows you to define and retrieve base values for various attributes such as damage, speed, health, etc.

Available Methods

Method Description Parameter Return
setBaseDamage Sets the base damage of a living entity. entity (Entity)
newDamage (double)
void
setBaseAttackSpeed Sets the base attack speed of a living entity. entity (Entity)
newSpeed (double)
void
setBaseSpeed Sets the base movement speed of a living entity. entity (Entity)
newSpeed (double)
void
setBaseMaxHealth Sets the base max health of a living entity. entity (Entity)
newHealth (double)
void
setBaseJumpStrength Sets the base jump strength of a living entity. entity (Entity)
newJumpStrength (double)
void
setBaseArmor Sets the base armor value of a living entity. entity (Entity)
newArmor (double)
void
setBaseArmorToughness Sets the base armor toughness of a living entity. entity (Entity)
newArmorToughness (double)
void
setBaseAttackKnockback Sets the base attack knockback value of a living entity. entity (Entity)
newAttackKnockback (double)
void
setBaseKnockbackResistance Sets the base knockback resistance of a living entity. entity (Entity)
newKnockbackResistance (double)
void
setBaseLuck Sets the base luck value of a living entity. entity (Entity)
newLuck (double)
void
getBaseDamage Retrieves the base damage value of a living entity. entity (Entity) double
getDamage Retrieves the current damage value of a living entity. entity (Entity) double
getBaseArmorToughness Retrieves the base armor toughness value of a living entity. entity (Entity) double
getBaseJumpStrength Retrieves the base jump strength value of a living entity. entity (Entity) double
getBaseArmorKnockback Retrieves the base attack knockback value of a living entity. entity (Entity) double
getBaseKnockbackResistance Retrieves the base knockback resistance value of a living entity. entity (Entity) double
getBaseLuck Retrieves the base luck value of a living entity. entity (Entity) double

Example of Use

// Example of use for MobUtil :

// Set base damage for an entity
MobUtil.setBaseDamage(entity, 10.0);

// Set attack speed
MobUtil.setBaseAttackSpeed(entity, 1.5);

// Retrieve the current damage
double damage = MobUtil.getDamage(entity);

ModsUsingAPI

Cette classe gère les événements liés à l'utilisation de l'API TetraLibs par d'autres mods. Elle permet d'afficher la liste des mods qui utilisent l'API de TetraLibs lors de l'initialisation du mod.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
init Méthode d'initialisation appelée lors de l'événement FMLCommonSetupEvent. Elle vérifie quels mods utilisent l'API TetraLibs et affiche un message dans les logs. event (FMLCommonSetupEvent) void @SubscribeEvent

Exemple d'Utilisation

// Exemple d'utilisation pour ModsUsingAPI :
// Lors de l'initialisation, cette méthode vérifiera quels mods utilisent l'API TetraLibs
ModsUsingAPI.init(event);

This class handles events related to the use of the TetraLibs API by other mods. It allows displaying a list of mods that use the TetraLibs API during the mod's initialization.

Available Methods

Method Description Parameter Return Annotations
init Initialization method called during the FMLCommonSetupEvent. It checks which mods are using the TetraLibs API and logs a message. event (FMLCommonSetupEvent) void @SubscribeEvent

Example of Use

// Example of use for ModsUsingAPI :
// During initialization, this method will check which mods are using the TetraLibs API
ModsUsingAPI.init(event);

NumberConverter

Cette classe contient des méthodes pour convertir un nombre en une chaîne de caractères, avec un format approprié en fonction de la taille du nombre (ex. : milliers, millions, milliards, trillions).

Méthodes Disponibles

Méthode Description Paramètre Retour
convertNumberToString Convertit un nombre en une chaîne de caractères avec un format adapté à la taille du nombre, en arrondissant à un certain nombre de décimales.
number (double)
decimalDigits (int)
String
Variante sans argument `decimalDigits`.
Paramètres :
number (double)
Retourne String.
convertNumberToString Convertit un nombre en une chaîne de caractères avec un format adapté, en arrondissant à 1 chiffre après la virgule.
number (double) String

Exemple d'Utilisation

// Exemple d'utilisation pour NumberConverter :

// Exemple avec un nombre et des décimales
String formattedNumber = NumberConverter.convertNumberToString(1234567.89, 2);

// Exemple avec un nombre sans spécifier de décimales
String formattedNumberDefault = NumberConverter.convertNumberToString(1234567.89);

This class contains methods for converting a number into a string, with a format appropriate to the size of the number (e.g., thousands, millions, billions, trillions).

Available Methods

Method Description Parameter Return
convertNumberToString Converts a number into a string with an appropriate format depending on the size of the number, rounding to a specific number of decimal places.
number (double)
decimalDigits (int)
String
Variant without `decimalDigits` argument.
Parameters :
number (double)
Returns String.
convertNumberToString Converts a number into a string with an appropriate format, rounding to 1 decimal place.
number (double) String

Example of Use

// Example of use for NumberConverter :

// Example with a number and decimals
String formattedNumber = NumberConverter.convertNumberToString(1234567.89, 2);

// Example with a number without specifying decimals
String formattedNumberDefault = NumberConverter.convertNumberToString(1234567.89);

RandomBlock

Cette classe contient des méthodes pour obtenir un bloc aléatoire de Minecraft, soit sous forme de `BlockState` (l'état du bloc) soit sous forme d'un objet `Block`.

Méthodes Disponibles

Méthode Description Paramètre Retour
blockstate Retourne un BlockState aléatoire. Un BlockState définit l'état d'un bloc particulier dans le monde Minecraft, incluant des informations comme la texture et d'autres propriétés. Cette méthode choisit aléatoirement un bloc parmi tous les blocs disponibles dans le jeu. Aucun BlockState
block Retourne un bloc aléatoire sous forme d'objet Block. Un Block est l'objet qui représente un bloc dans le monde du jeu, et contient des informations sur ses propriétés et son comportement. Aucun Block

Exemple d'Utilisation

// Exemple d'utilisation pour RandomBlock :
// Exemple pour obtenir un BlockState aléatoire
BlockState randomBlockState = RandomBlock.blockstate();

// Exemple pour obtenir un Block aléatoire
Block randomBlock = RandomBlock.block();

This class contains methods to obtain a random block in Minecraft, either as a `BlockState` (the block state) or as a `Block` object.

Available Methods

Method Description Parameter Return
blockstate Returns a random BlockState. A BlockState defines the state of a block in Minecraft, including information such as texture and other properties. This method randomly selects a block from all available blocks in the game. None BlockState
block Returns a random Block object. A Block is the object that represents a block in the game world and contains information about its properties and behavior. None Block

Example of Use

// Example of use for RandomBlock :
// Example to get a random BlockState
BlockState randomBlockState = RandomBlock.blockstate();

// Example to get a random Block
Block randomBlock = RandomBlock.block();

RandomEffect

Cette classe fournit une méthode permettant d'appliquer un effet aléatoire à une entité vivante dans le jeu.

Méthodes Disponibles

Méthode Description Paramètre Retour
apply Applique un effet aléatoire à une entité vivante. Cette méthode choisit aléatoirement un effet parmi ceux enregistrés dans le jeu. Si le paramètre `blacklist` est activé, certains effets spécifiques (comme la guérison ou le malus) seront exclus du tirage. victim (Entity)
duration (int)
blacklist (boolean)
void

Exemple d'Utilisation

// Exemple d'utilisation pour RandomEffect :
// Applique un effet aléatoire à un joueur avec une durée de 100 ticks (5 secondes),
// sans exclure les effets de guérison ou de malus.
RandomEffect.apply(player, 100, false);

// Applique un effet aléatoire à un joueur avec une durée de 100 ticks (5 secondes),
// en excluant les effets de guérison et de malus.
RandomEffect.apply(player, 100, true);

This class provides a method to apply a random effect to a living entity in the game.

Available Methods

Method Description Parameter Return
apply Applies a random effect to a living entity. This method randomly selects an effect from the registered effects in the game. If the `blacklist` parameter is set to true, certain effects (such as healing or harm) will be excluded from the selection. victim (Entity)
duration (int)
blacklist (boolean)
void

Example of Use

// Example of use for RandomEffect :
// Apply a random effect to a player with a duration of 100 ticks (5 seconds),
// without excluding healing or harm effects.
RandomEffect.apply(player, 100, false);

// Apply a random effect to a player with a duration of 100 ticks (5 seconds),
// excluding healing and harm effects.
RandomEffect.apply(player, 100, true);

RandomEnchantment

Cette classe permet d'appliquer un enchantement aléatoire sur un objet (ItemStack).

Méthodes Disponibles

Méthode Description Paramètre Retour
apply Applique un enchantement aléatoire à un objet (ItemStack). Cette méthode choisit un enchantement aléatoire parmi tous les enchantements disponibles dans le jeu et lui attribue un niveau d'enchantement aléatoire, en respectant les limites minimales et maximales de niveau de l'enchantement choisi. item (ItemStack)
verif (boolean)
ItemStack

Exemple d'Utilisation

// Exemple d'utilisation pour RandomEnchantment :
// Exemple avec vérification avant d'appliquer l'enchantement
RandomEnchantment.apply(itemStack, true);

// Exemple sans vérification
RandomEnchantment.apply(itemStack, false);

This class applies a random enchantment to an item (ItemStack).

Available Methods

Method Description Parameter Return
apply Applies a random enchantment to an item (ItemStack). This method selects a random enchantment from the available enchantments in the game and assigns a random enchantment level, respecting the enchantment's minimum and maximum level limits. item (ItemStack)
verif (boolean)
ItemStack

Example of Use

// Example of use for RandomEnchantment :
// Example with verification before applying enchantment
RandomEnchantment.apply(itemStack, true);

// Example without verification
RandomEnchantment.apply(itemStack, false);

RandomItem

Cette classe permet de sélectionner un objet aléatoire parmi tous les objets disponibles dans le registre Forge.

Méthodes Disponibles

Méthode Description Paramètre Retour
execute Crée et retourne un ItemStack contenant un objet aléatoire. Aucun ItemStack
getItem Retourne un objet aléatoire sous forme d'instance de Item. Aucun Item
getRandomItem Sélectionne un objet aléatoire parmi tous les objets du jeu. Aucun Item

Exemple d'Utilisation


// Exemple d'utilisation pour RandomItem
ItemStack randomStack = RandomItem.execute();
Item randomItem = RandomItem.getItem();

This class allows selecting a random item from all items available in the Forge registry.

Available Methods

Method Description Parameter Return
execute Creates and returns an ItemStack containing a random item. None ItemStack
getItem Returns a random item as an Item instance. None Item
getRandomItem Selects a random item from all items in the game. None Item

Example of Use


// Example of use for RandomItem
ItemStack randomStack = RandomItem.execute();
Item randomItem = RandomItem.getItem();

Save

Cette classe est responsable de la gestion de la sauvegarde des données liées à un joueur, telles que les données utilisateur et les balances économiques, lors de la déconnexion du joueur.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotation
onPlayerLoggedOut Méthode appelée lorsqu'un joueur se déconnecte. Elle sauvegarde les données du joueur et de l'économie en fonction de la configuration du mod. event (PlayerEvent.PlayerLoggedOutEvent) void @SubscribeEvent
execute Méthode qui permet de sauvegarder les données d'un joueur dans le monde donné à des coordonnées spécifiques. Cette méthode est une version simplifiée sans événement. world (LevelAccessor)
x (double)
y (double)
z (double)
entity (Entity)
void Aucune

This class is responsible for managing the saving of data related to a player, such as user data and economic balances, when the player disconnects.

Available Methods

Method Description Parameter Return Annotation
onPlayerLoggedOut Method called when a player disconnects. It saves the player's data and economy based on the mod's configuration. event (PlayerEvent.PlayerLoggedOutEvent) void @SubscribeEvent
execute Method that saves the player's data in the given world at specific coordinates. This is a simplified version without an event. world (LevelAccessor)
x (double)
y (double)
z (double)
entity (Entity)
void None

ServerPermissionsInit

Cette classe gère l'initialisation des permissions des serveurs lors du démarrage. Elle permet d'ajouter des permissions par défaut pour divers aspects du serveur ainsi que pour toutes les commandes disponibles.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotation
onServerStarting Méthode appelée lors du démarrage du serveur. Elle initialise les permissions par défaut pour différentes actions sur le serveur et attribue des permissions pour chaque commande disponible. event (ServerStartingEvent) void @SubscribeEvent

This class manages the initialization of server permissions during startup. It allows adding default permissions for various server aspects and assigning permissions for all available commands.

Available Methods

Method Description Parameter Return Annotation
onServerStarting Method called during server startup. It initializes default permissions for various server actions and assigns permissions for each available command. event (ServerStartingEvent) void @SubscribeEvent

Serverdata

Classe responsable de la gestion des données du serveur dans un fichier JSON unique. Permet de charger, sauvegarder, initialiser et manipuler les données globales du serveur.

Méthodes Disponibles

Méthode Description Paramètre Retour
load Charge les données du serveur à partir du fichier JSON. Si le fichier n'existe pas, il est créé avec des valeurs par défaut. Aucun void
save Sauvegarde les données du serveur dans le fichier JSON. Aucun void
init Initialise les données d'un joueur dans un fichier JSON si ce dernier n'existe pas. Aucun void
data Gère l'extraction ou la mise à jour des données dans un système de stockage global. Cette méthode permet d'extraire des données ou de mettre à jour les données dans le fichier JSON du serveur.
key (String)
mode (String)
value (Object)
Object
Variante sans l'argument mode et value. Mode de base l'extraction.
Paramètres :
key (String)
Retourne Object.
get Récupère une valeur imbriquée à partir d'un fichier JSON. key (String) Object
set Définit une valeur dans un fichier JSON en suivant un chemin imbriqué. Si un niveau intermédiaire est manquant, il est créé automatiquement. Les modifications sont persistées dans le fichier JSON. filePath (String)
keyPath (String)
value (Object)
void
has Vérifie si une clé existe dans les données du serveur. key (String) boolean

Exemple d'Utilisation

// Exemple d'utilisation pour Serverdata :

// Obtenir une valeur
Serverdata.data("test.data");

// Définir une valeur
Serverdata.data("test.data", "set", 0);

Class responsible for managing server data into a single JSON file. Allows you to load, save, initialize and manipulate global server data.

Available Methods

Method Description Parameter Return
load Loads server data from JSON file. If the file does not exist, it is created with default values. None void
save Saves server data to JSON file. None void
init Initializes a player's data in a JSON file if it does not exist. None void
data Manages the retrieval or updating of data in a global storage system. This method extracts data or updates data in the server's JSON file.
key (String)
mode (String)
value (Object)
Object
Variant without the mode and value arguments. Basic extraction mode.
Paramètres :
key (String)
Return Object.
get Retrieves a nested value from a JSON file. key (String) Object
set Sets a value in a JSON file following a nested path. If a middle level is missing, it is created automatically. Changes are persisted to the JSON file. filePath (String)
keyPath (String)
value (Object)
void
has Checks if a key exists in the server data. key (String) boolean

Example of Use

// Example of use for Serverdata :

// Get a value
Serverdata.data("test.data");

// Set a value
Serverdata.data("test.data", "set", 0);

SuperLog

Cette classe fournit des méthodes utilitaires pour enregistrer des messages dans les logs de l'application. Elle offre plusieurs niveaux de log (info, debug, warn, error, fatal) ainsi qu'une méthode pour écrire dans un fichier de log.

Méthodes Disponibles

Méthode Description Paramètre Retour
info Enregistre un message au niveau INFO dans la console. name (String)
message (String)
void
debug Enregistre un message au niveau DEBUG dans la console. name (String)
message (String)
void
warn Enregistre un message au niveau WARN dans la console. name (String)
message (String)
void
error Enregistre un message au niveau ERROR dans la console. name (String)
message (String)
void
fatal Enregistre un message au niveau FATAL dans la console. name (String)
message (String)
void
throwable Crée et enregistre une exception avec un message donné dans la console. name (String)
message (String)
Throwable
write Enregistre un texte dans un fichier de log à un emplacement spécifié. Le texte peut être ajouté à la fin du fichier ou écrit sur une nouvelle ligne. text (String)
inline (Boolean)
path (String)
fileName (String)
void

Exemple d'Utilisation

// Exemple d'utilisation pour SuperLog :

Superlog.info("MyMod", "Texte d'information");

Superlog.debug("MyMod", "Texte de débug");

Superlog.warn("MyMod", "Texte d'avertissement");

Superlog.error("MyMod", "Texte d'erreur");

Superlog.fatal("MyMod", "Texte fatal");

try {
  // Une situation où une exception pourrait se produire
  int result = 10 / 0;  // Cela va générer une exception ArithmeticException
  
} catch (Exception e) {
  // Enregistrer l'exception avec un message personnalisé dans le journal
  Throwable exception = SuperLog.throwable("MyMod", "Une erreur est survenue dans myMethod : " + e.getMessage());
  
  // Vous pouvez également gérer l'exception, la relancer, etc.
  // Par exemple, ici on la relance après l'avoir loggée
  throw exception;
}

This class provides utility methods for logging messages to application logs. It offers several log levels (info, debug, warn, error, fatal) as well as a method for writing to a log file.

Available Methods

Method Description Parameter Return
info Logs a message at INFO level in the console. name (String)
message (String)
void
debug Logs a message at DEBUG level to the console. name (String)
message (String)
void
warn Logs a message at the WARN level in the console. name (String)
message (String)
void
error Logs a message at ERROR level in the console. name (String)
message (String)
void
fatal Logs a message at FATAL level to the console. name (String)
message (String)
void
throwable Creates and logs an exception with a given message in the console. name (String)
message (String)
Throwable
write Saves text to a log file at a specified location. The text can be appended to the end of the file or written on a new line. text (String)
inline (Boolean)
path (String)
fileName (String)
void

Exemple of Use

// Exemple of use for SuperLog :

Superlog.info("MyMod", "Info text");

Superlog.debug("MyMod", "Debug text");

Superlog.warn("MyMod", "Warn text");

Superlog.error("MyMod", "Error text");

Superlog.fatal("MyMod", "Fatal text");

try {
  // A situation where an exception could occur
  int result = 10 / 0;  // This will throw an ArithmeticException
  
} catch (Exception e) {
  // Log the exception with a custom message in the log
  Throwable exception = SuperLog.throwable("MyMod", "An error occurred in myMethod : " + e.getMessage());
  
  // You can also handle the exception, rethrow it, etc.
  // For example, here we restart it after having logged it
  throw exception;
}

TeamUtil

Utilitaire pour la gestion des équipes dans le jeu Minecraft. Contient des méthodes pour récupérer des informations sur les équipes, modifier leurs propriétés, et effectuer diverses opérations liées à l'équipe.

Méthodes Disponibles

Méthode Description Paramètre Retour
getTeam Récupère une équipe par son nom. world (LevelAccessor)
teamName (String)
Team
getPlayersNumber Récupère le nombre de joueurs dans une équipe. world (LevelAccessor)
teamName (String)
double
getTeamsNumber Récupère le nombre total d'équipes. world (LevelAccessor) double
getTeamExists Vérifie si une équipe existe dans le monde. world (LevelAccessor)
teamName (String)
boolean
getTeamName Récupère le nom de l'équipe d'un joueur. world (LevelAccessor)
entity (Entity)
String
setCollisionRules Modifie les règles de collision d'une équipe.
world (LevelAccessor)
teamName (String)
rule (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
rule (String) Retourne void.
setColor Modifie la couleur d'une équipe.
world (LevelAccessor)
teamName (String)
color (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
color (String) Retourne void.
setDeathMessageVisibility Modifie la visibilité du message de décès d'une équipe.
world (LevelAccessor)
teamName (String)
visibility (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
visibility (String) Retourne void.
setDisplayName Définit le nom affiché pour une équipe donnée.
world (LevelAccessor)
teamName (String)
name (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
name (String) Retourne void.
setFriendlyFire Définit si les membres de l'équipe peuvent se causer des dégâts entre eux (FriendlyFire).
world (LevelAccessor)
teamName (String)
fire (boolean)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
fire (boolean) Retourne void.
setNametagVisibility Définit la visibilité des étiquettes de nom pour les membres d'une équipe.
world (LevelAccessor)
teamName (String)
visibility (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
visibility (String) Retourne void.
sePrefix Définit le préfixe des joueurs dans une équipe.
world (LevelAccessor)
teamName (String)
prefix (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
prefix (String) Retourne void.
setSeeFriendlyInvisibles Définit si les membres de l'équipe peuvent voir les invisibles alliés.
world (LevelAccessor)
teamName (String)
see (boolean)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
see (boolean) Retourne void.
setSuffix Définit si les membres de l'équipe peuvent voir les invisibles alliés.
world (LevelAccessor)
teamName (String)
suffix (String)
callback (boolean)
void
Variante sans l'argument callback.
Paramètres :
world (LevelAccessor)
teamName (String)
suffix (String) Retourne void.
getRawCollisionRules Récupère la règle de collision brute pour une équipe donnée. world (LevelAccessor)
teamName (String)
Team.CollisionRule
getStringCollisionRules Récupère la règle de collision sous forme de chaîne pour une équipe donnée. world (LevelAccessor)
teamName (String)
String
getRawColor Récupère la couleur brute de l'équipe. world (LevelAccessor)
teamName (String)
Team.CollisionRule
getStringColor Récupère la couleur de l'équipe sous forme de chaîne. world (LevelAccessor)
teamName (String)
lowercase (String)
String
getRawDeathMessageVisibility Récupère la visibilité des messages de mort pour une équipe. world (LevelAccessor)
teamName (String)
Team.Visibility
getStringDeathMessageVisibility Récupère la visibilité des messages de mort sous forme de chaîne. world (LevelAccessor)
teamName (String)
lowercase (String)
String
getDisplayName Récupère le nom affiché pour une équipe. world (LevelAccessor)
teamName (String)
String
getRawNametagVisibility Récupère la visibilité des étiquettes de nom pour une équipe. world (LevelAccessor)
teamName (String)
Team.Visibility
getStringNametagVisibility Récupère la visibilité des étiquettes de nom sous forme de chaîne. world (LevelAccessor)
teamName (String)
lowercase (String)
String
getPrefix Récupère le préfixe d'une équipe. world (LevelAccessor)
teamName (String)
String
getSuffix Récupère le suffixe d'une équipe world (LevelAccessor)
teamName (String)
String
colisionRulesFromString Convertit une chaîne en une règle de collision pour une équipe. str (String) Team.CollisionRule
colisionRulesFromString Convertit une règle de collision en une chaîne. str (Team.CollisionRule) String
colorFromString Convertit une chaîne en une couleur de texte Minecraft. str (String) ChatFormatting
teamVisibilityFromString Convertit une chaîne en une visibilité de l'équipe. str (String) Team.Visibility

Exemple d'Utilisation

// Exemple d'utilisation pour TeamUtil :
 
// Exemple pour getTeam
Team team = TeamUtil.getTeam(world, "MyTeam");

// Exemple pour getPlayersNumber
double playersNumber = TeamUtil.getPlayersNumber(world, "MyTeam");

// Exemple pour getTeamsNumber
double teamsNumber = TeamUtil.getTeamsNumber(world);

// Exemple pour getTeamExists
boolean teamExists = TeamUtil.getTeamExists(world, "MyTeam");

// Exemple pour getTeamName
String teamName = TeamUtil.getTeamName(world, entity);

// Exemple pour setCollisionRules
TeamUtil.setCollisionRules(world, "MyTeam", "newRule", true);

// Exemple pour setColor
TeamUtil.setColor(world, "MyTeam", "red", true);

// Exemple pour setDeathMessageVisibility
TeamUtil.setDeathMessageVisibility(world, "MyTeam", "visible", true);

// Exemple pour setDisplayName
TeamUtil.setDisplayName(world, "MyTeam", "AwesomeTeam", true);

// Exemple pour setFriendlyFire
TeamUtil.setFriendlyFire(world, "MyTeam", true, true);

// Exemple pour setNametagVisibility
TeamUtil.setNametagVisibility(world, "MyTeam", "visible", true);

// Exemple pour setPrefix
TeamUtil.setPrefix(world, "MyTeam", "[Team1]", true);

// Exemple pour setSeeFriendlyInvisibles
TeamUtil.setSeeFriendlyInvisibles(world, "MyTeam", true, true);

// Exemple pour setSuffix
TeamUtil.setSuffix(world, "MyTeam", "_VIP", true);

// Exemple pour getRawCollisionRules
Team.CollisionRule collisionRule = TeamUtil.getRawCollisionRules(world, "MyTeam");

// Exemple pour getStringCollisionRules
String collisionRuleStr = TeamUtil.getStringCollisionRules(world, "MyTeam");

// Exemple pour getRawColor
Team.CollisionRule color = TeamUtil.getRawColor(world, "MyTeam");

// Exemple pour getStringColor
String colorStr = TeamUtil.getStringColor(world, "MyTeam", "true");

// Exemple pour getRawDeathMessageVisibility
Team.Visibility deathMessageVisibility = TeamUtil.getRawDeathMessageVisibility(world, "MyTeam");

// Exemple pour getStringDeathMessageVisibility
String deathMessageVisibilityStr = TeamUtil.getStringDeathMessageVisibility(world, "MyTeam", "true");

// Exemple pour getDisplayName
String displayName = TeamUtil.getDisplayName(world, "MyTeam");

// Exemple pour getRawNametagVisibility
Team.Visibility nametagVisibility = TeamUtil.getRawNametagVisibility(world, "MyTeam");

// Exemple pour getStringNametagVisibility
String nametagVisibilityStr = TeamUtil.getStringNametagVisibility(world, "MyTeam", "true");

// Exemple pour getPrefix
String prefix = TeamUtil.getPrefix(world, "MyTeam");

// Exemple pour getSuffix
String suffix = TeamUtil.getSuffix(world, "MyTeam");

// Exemple pour colisionRulesFromString
Team.CollisionRule rule = TeamUtil.colisionRulesFromString("newRule");

// Exemple pour colisionRulesToString
String ruleStr = TeamUtil.colisionRulesToString(Team.CollisionRule.ALWAYS);

// Exemple pour colorFromString
ChatFormatting color = TeamUtil.colorFromString("red");

// Exemple pour teamVisibilityFromString
Team.Visibility visibility = TeamUtil.teamVisibilityFromString("visible");

Utility for managing teams in the Minecraft game. Contains methods for retrieving information about teams, modifying their properties, and performing various team-related operations.

Available Methods

Method Description Parameter Return
getTeam Retrieves a team by its name. world (LevelAccessor)
teamName (String)
Team
getPlayersNumber Retrieves the number of players in a team. world (LevelAccessor)
teamName (String)
double
getTeamsNumber Retrieves the total number of teams. world (LevelAccessor) double
getTeamExists Checks if a team exists in the world. world (LevelAccessor)
teamName (String)
boolean
getTeamName Retrieves the team name of a player. world (LevelAccessor)
entity (Entity)
String
setCollisionRules Modifies the collision rules of a team.
world (LevelAccessor)
teamName (String)
rule (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
rule (String) Returns void.
setColor Modifies the color of a team.
world (LevelAccessor)
teamName (String)
color (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
color (String) Returns void.
setDeathMessageVisibility Modifies the visibility of the death message for a team.
world (LevelAccessor)
teamName (String)
visibility (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
visibility (String) Returns void.
setDisplayName Sets the display name for a given team.
world (LevelAccessor)
teamName (String)
name (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
name (String) Returns void.
setFriendlyFire Defines whether team members can damage each other (FriendlyFire).
world (LevelAccessor)
teamName (String)
fire (boolean)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
fire (boolean) Returns void.
setNametagVisibility Sets the visibility of name tags for team members.
world (LevelAccessor)
teamName (String)
visibility (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
visibility (String) Returns void.
setPrefix Sets the prefix for players in a team.
world (LevelAccessor)
teamName (String)
prefix (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
prefix (String) Returns void.
setSeeFriendlyInvisibles Sets whether team members can see invisible allies.
world (LevelAccessor)
teamName (String)
see (boolean)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
see (boolean) Returns void.
setSuffix Sets the suffix for a team.
world (LevelAccessor)
teamName (String)
suffix (String)
callback (boolean)
void
Variant without the callback argument.
Parameters:
world (LevelAccessor)
teamName (String)
suffix (String) Returns void.
getRawCollisionRules Retrieves the raw collision rule for a given team. world (LevelAccessor)
teamName (String)
Team.CollisionRule
getStringCollisionRules Retrieves the collision rule as a string for a given team. world (LevelAccessor)
teamName (String)
String
getRawColor Retrieves the raw color of a team. world (LevelAccessor)
teamName (String)
Team.CollisionRule
getStringColor Retrieves the team's color as a string. world (LevelAccessor)
teamName (String)
lowercase (String)
String
getRawDeathMessageVisibility Retrieves the death message visibility for a team. world (LevelAccessor)
teamName (String)
Team.Visibility
getStringDeathMessageVisibility Retrieves the death message visibility as a string. world (LevelAccessor)
teamName (String)
lowercase (String)
String
getDisplayName Retrieves the display name for a team. world (LevelAccessor)
teamName (String)
String
getRawNametagVisibility Retrieves the visibility of name tags for a team. world (LevelAccessor)
teamName (String)
Team.Visibility
getStringNametagVisibility Retrieves the visibility of name tags as a string. world (LevelAccessor)
teamName (String)
lowercase (String)
String
getPrefix Retrieves the prefix for a team. world (LevelAccessor)
teamName (String)
String
getSuffix Retrieves the suffix for a team. world (LevelAccessor)
teamName (String)
String
colisionRulesFromString Converts a string into a collision rule for a team. str (String) Team.CollisionRule
colisionRulesToString Converts a collision rule into a string. str (Team.CollisionRule) String
colorFromString Converts a string into a Minecraft text color. str (String) ChatFormatting
teamVisibilityFromString Converts a string into a team visibility. str (String) Team.Visibility

Exemple of Use

// Exemple of use for TeamUtil :
 
// Example for getTeam
Team team = TeamUtil.getTeam(world, "MyTeam");

// Example for getPlayersNumber
double playersNumber = TeamUtil.getPlayersNumber(world, "MyTeam");

// Example for getTeamsNumber
double teamsNumber = TeamUtil.getTeamsNumber(world);

// Example for getTeamExists
boolean teamExists = TeamUtil.getTeamExists(world, "MyTeam");

// Example for getTeamName
String teamName = TeamUtil.getTeamName(world, entity);

// Example for setCollisionRules
TeamUtil.setCollisionRules(world, "MyTeam", "newRule", true);

// Example for setColor
TeamUtil.setColor(world, "MyTeam", "red", true);

// Example for setDeathMessageVisibility
TeamUtil.setDeathMessageVisibility(world, "MyTeam", "visible", true);

// Example for setDisplayName
TeamUtil.setDisplayName(world, "MyTeam", "AwesomeTeam", true);

// Example for setFriendlyFire
TeamUtil.setFriendlyFire(world, "MyTeam", true, true);

// Example for setNametagVisibility
TeamUtil.setNametagVisibility(world, "MyTeam", "visible", true);

// Example for setPrefix
TeamUtil.setPrefix(world, "MyTeam", "[Team1]", true);

// Example for setSeeFriendlyInvisibles
TeamUtil.setSeeFriendlyInvisibles(world, "MyTeam", true, true);

// Example for setSuffix
TeamUtil.setSuffix(world, "MyTeam", "_VIP", true);

// Example for getRawCollisionRules
Team.CollisionRule collisionRule = TeamUtil.getRawCollisionRules(world, "MyTeam");

// Example for getStringCollisionRules
String collisionRuleStr = TeamUtil.getStringCollisionRules(world, "MyTeam");

// Example for getRawColor
Team.CollisionRule color = TeamUtil.getRawColor(world, "MyTeam");

// Example for getStringColor
String colorStr = TeamUtil.getStringColor(world, "MyTeam", "true");

// Example for getRawDeathMessageVisibility
Team.Visibility deathMessageVisibility = TeamUtil.getRawDeathMessageVisibility(world, "MyTeam");

// Example for getStringDeathMessageVisibility
String deathMessageVisibilityStr = TeamUtil.getStringDeathMessageVisibility(world, "MyTeam", "true");

// Example for getDisplayName
String displayName = TeamUtil.getDisplayName(world, "MyTeam");

// Example for getRawNametagVisibility
Team.Visibility nametagVisibility = TeamUtil.getRawNametagVisibility(world, "MyTeam");

// Example for getStringNametagVisibility
String nametagVisibilityStr = TeamUtil.getStringNametagVisibility(world, "MyTeam", "true");

// Example for getPrefix
String prefix = TeamUtil.getPrefix(world, "MyTeam");

// Example for getSuffix
String suffix = TeamUtil.getSuffix(world, "MyTeam");

// Example for colisionRulesFromString
Team.CollisionRule rule = TeamUtil.colisionRulesFromString("newRule");

// Example for colisionRulesToString
String ruleStr = TeamUtil.colisionRulesToString(Team.CollisionRule.ALWAYS);

// Example for colorFromString
ChatFormatting color = TeamUtil.colorFromString("red");

// Example for teamVisibilityFromString
Team.Visibility visibility = TeamUtil.teamVisibilityFromString("visible");

TetraConfig

Interface représentant une configuration de type Tetra. Cette interface définit les méthodes permettant de gérer les configurations sous forme de paires nom-valeur.

Méthodes Disponibles

Méthode Description Paramètre Retour
initializeConfigurations Initialise les configurations de manière spécifique. Cette méthode permet de préparer les configurations en chargeant les paramètres nécessaires. Aucun void
addConfiguration Ajoute une nouvelle configuration avec un nom et une valeur booléenne. name (String)
value (boolean)
void
removeConfiguration Supprime une configuration existante par son nom. name (String) void
getConfiguration Récupère la valeur booléenne d'une configuration en fonction de son nom. name (String) boolean
isConfigurationEnabled Vérifie si une configuration est activée. name (String) boolean

Exemple d'Utilisation

// Exemple d'utilisation pour TetraConfig :
 
// Exemple pour initializeConfigurations
TetraConfig.initializeConfigurations();

// Exemple pour addConfiguration
TetraConfig.addConfiguration("myConfig", true);

// Exemple pour removeConfiguration
TetraConfig.removeConfiguration("myConfig");

// Exemple pour getConfiguration
boolean configValue = TetraConfig.getConfiguration("myConfig");

// Exemple pour isConfigurationEnabled
boolean isEnabled = TetraConfig.isConfigurationEnabled("myConfig");

Interface representing a Tetra type configuration. This interface defines methods for handling configurations as name-value pairs.

Available Methods

Method Description Parameter Return
initializeConfigurations Initializes the configurations in a specific way. This method prepares the configurations by loading the necessary parameters. None void
addConfiguration Adds a new configuration with a name and a boolean value. name (String)
value (boolean)
void
removeConfiguration Removes an existing configuration by its name. name (String) void
getConfiguration Retrieves the boolean value of a configuration based on its name. name (String) boolean
isConfigurationEnabled Checks if a configuration is enabled. name (String) boolean

Exemple of Use

// Exemple of use for TetraConfig :
 
// Example of use for TetraConfig :

// Example for initializeConfigurations
TetraConfig.initializeConfigurations();

// Example for addConfiguration
TetraConfig.addConfiguration("myConfig", true);

// Example for removeConfiguration
TetraConfig.removeConfiguration("myConfig");

// Example for getConfiguration
boolean configValue = TetraConfig.getConfiguration("myConfig");

// Example for isConfigurationEnabled
boolean isEnabled = TetraConfig.isConfigurationEnabled("myConfig");

TetraLibsOptions

Classe responsable de gérer l'ajout d'options supplémentaires dans l'écran des paramètres du jeu. Elle permet d'ajouter un bouton personnalisé à l'écran des paramètres qui ouvre un autre écran spécifique à TetraLibs.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onGuiScreenInit Méthode qui est appelée après l'initialisation de l'écran de paramètres pour ajouter un bouton personnalisé. Le bouton ouvre un écran spécifique à TetraLibs quand il est cliqué. event (ScreenEvent.Init.Post) void @SubscribeEvent

Exemple d'Utilisation

// Exemple d'utilisation pour TetraLibsOptions :

// ScreenEvent.Init.Post
TetraLibsOptions.onGuiScreenInit(event)

Class responsible for handling the addition of additional options in the game settings screen. Allows you to add a custom button to the settings screen that opens another TetraLibs specific screen.

Available Methods

Method Description Parameter Return Annotations
onGuiScreenInit Method that is called after initializing the settings screen to add a custom button. The button opens a TetraLibs specific screen when clicked. event (ScreenEvent.Init.Post) void @SubscribeEvent

Exemple of Use

// Exemple of use for TetraLibsOptions :
 
// ScreenEvent.Init.Post
TetraLibsOptions.onGuiScreenInit(event)

TetraLibsOptionsScreen

Classe représentant l'écran des options personnalisées de TetraLibs dans le jeu. Cet écran permet de configurer certaines options spécifiques à TetraLibs et de revenir à l'écran des paramètres.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
TetraLibsOptionsScreen Constructeur de la classe TetraLibsOptionsScreen. Ce constructeur prend l'écran parent en paramètre pour pouvoir y revenir si nécessaire. parent (Screen) Aucun Aucune
render Rendu graphique de l'écran, y compris l'arrière-plan et le texte du titre. guiGraphics (guiGraphics)
mouseX (int)
mouseY (int)
partialTicks (float)
void @Override
shouldCloseOnEsc Indique si cet écran peut être fermé avec la touche ESC. Retourne true pour permettre la fermeture. guiGraphics (guiGraphics)
mouseX (int)
mouseY (int)
partialTicks (float)
boolean Aucune

Exemple d'Utilisation

// Exemple d'utilisation pour TetraLibsOptionsScreen :

// Event déclenché après l'initialisation de l'écran
TetraLibsOptions.onGuiScreenInit(event);

Class representing the TetraLibs custom options screen in the game. This screen allows you to configure some TetraLibs-specific options and return to the settings screen.

Available Methods

Method Description Parameter Return Annotations
TetraLibsOptionsScreen Constructor for the TetraLibsOptionsScreen class. This constructor takes the parent screen as a parameter so that it can return to it if necessary. parent (Screen) None None
render The graphical rendering of the screen, including the background and title text. guiGraphics (guiGraphics)
mouseX (int)
mouseY (int)
partialTicks (float)
void @Override
shouldCloseOnEsc Indicates if this screen can be closed with the ESC key. Returns true to allow closing. guiGraphics (guiGraphics)
mouseX (int)
mouseY (int)
partialTicks (float)
boolean None

Exemple of Use

// Exemple of use for TetraLibsOptionsScreen :
 
// ScreenEvent.Init.Post event triggered after the screen initialization
TetraLibsOptions.onGuiScreenInit(event);

TetraLibsWorldOptions

Classe qui gère les congiurations personnalisées de TetraLibs(Config, ConfigManager) lors de la création d'un monde et la gestion des fichiers associés. Cette classe permet d'ajouter des boutons à l'interface de création de monde, ainsi que de gérer des fichiers de configuration temporaires.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
onGuiScreenInit Méthode déclenchée lors de l'initialisation des écrans dans le jeu. Elle ajoute un bouton d'options pour TetraLibs dans l'écran de création de monde. event (ScreenEvent.Init.Post) void @SubscribeEvent
onWorldCreate Méthode déclenchée lors de la création d'un monde dans le jeu. Elle gère la création de fichiers temporaires pour les configurations spécifiques à TetraLibs. event (LevelEvent.CreateSpawnPosition) void @SubscribeEvent

Exemple d'Utilisation

// Exemple d'utilisation pour TetraLibsOptionsScreen :

// Event déclenché après l'initialisation de l'écran
TetraLibsOptions.onGuiScreenInit(event);

// Exemple pour onWorldCreate
// Lors de la création d'un monde, cette méthode gère la création des fichiers temporaires.
TetraLibsOptions.onWorldCreate(event);

Class that manages TetraLibs Configs(Config, ConfigManager) when creating a world and managing associated files. This class allows you to add buttons to the world creation interface, as well as manage temporary configuration files.

Available Methods

Method Description Parameter Return Annotations
onGuiScreenInit Method triggered during the screen initialization in the game. It adds a TetraLibs options button to the world creation screen. event (ScreenEvent.Init.Post) void @SubscribeEvent
onWorldCreate Method triggered when creating a world in the game. It handles the creation of temporary files for TetraLibs-specific configurations. event (LevelEvent.CreateSpawnPosition) void @SubscribeEvent

Exemple of Use

// Exemple of use for TetraLibsOptionsScreen :
 
// ScreenEvent.Init.Post event triggered after the screen initialization
TetraLibsOptions.onGuiScreenInit(event);

// Example for onWorldCreate
// When creating a world, this method handles the creation of temporary files.
TetraLibsOptions.onWorldCreate(event);

TetraLibsWorldOptionsScreen

Écran de configuration des configurations personnalisées de TetraLibs(Config, ConfigManager) pour le monde en cours. Cette classe permet de gérer l'affichage et la modification des options de configuration d'un monde, et de sauvegarder ces options dans un fichier JSON.

Méthodes Disponibles

Méthode Description Paramètre Retour Annotations
TetraLibsWorldOptionsScreen Constructeur de l'écran des options de TetraLibs pour le monde. Charge les options de configuration et initialise l'écran. parent (Screen) Aucun Aucune
addButton Ajoute une nouvelle option de configuration à la liste des options disponibles. name (String)
value (Boolean)
void Aucune
onClose Méthode appelée lorsque l'écran est fermé, pour sauvegarder les options avant de quitter. Aucun void @Override
render Méthode de rendu pour dessiner l'écran, y compris le titre et l'arrière-plan personnalisé. guiGraphics (guiGraphics)
mouseX (int)
mouseY (int)
partialTicks (float)
void @Override
shouldCloseOnEsc Indique si l'écran doit se fermer lorsqu'on appuie sur ESC. Aucun boolean @Override

Exemple d'Utilisation

// Exemple d'utilisation pour TetraLibsOptionsScreen :

// Exemple pour TetraLibsWorldOptionsScreen
// Création de l'écran des options du monde avec un écran parent
TetraLibsWorldOptionsScreen worldOptionsScreen = new TetraLibsWorldOptionsScreen(parent);

// Exemple pour addButton
// Ajouter une nouvelle option de configuration pour le monde
worldOptionsScreen.addButton("Option1", true);

// Exemple pour onClose
// Sauvegarde des options lorsque l'écran est fermé
worldOptionsScreen.onClose();

// Exemple pour render
// Dessiner l'écran, y compris le titre et l'arrière-plan
worldOptionsScreen.render(guiGraphics, mouseX, mouseY, partialTicks);

// Exemple pour shouldCloseOnEsc
// Vérifie si l'écran doit se fermer lorsqu'on appuie sur ESC
boolean shouldClose = worldOptionsScreen.shouldCloseOnEsc();

TetraLibs custom configs(Config, ConfigManager) configuration screen for the current world. This class allows you to manage the display and modification of the configuration options of a world, and save these options in a JSON file.

Available Methods

Method Description Parameter Return Annotations
TetraLibsWorldOptionsScreen Constructor for the TetraLibs world options screen. Loads configuration options and initializes the screen. parent (Screen) None None
addButton Adds a new configuration option to the list of available options. name (String)
value (Boolean)
void None
onClose Method called when the screen is closed, to save the options before exiting. None void @Override
render Render method for drawing the screen, including the title and custom background. guiGraphics (guiGraphics)
mouseX (int)
mouseY (int)
partialTicks (float)
void @Override
shouldCloseOnEsc Indicates if the screen should close when pressing ESC. None boolean @Override

Exemple of Use

// Exemple of use for TetraLibsOptionsScreen :
 
// Example for TetraLibsWorldOptionsScreen
// Create the world options screen with a parent screen
TetraLibsWorldOptionsScreen worldOptionsScreen = new TetraLibsWorldOptionsScreen(parent);

// Example for addButton
// Add a new configuration option for the world
worldOptionsScreen.addButton("Option1", true);

// Example for onClose
// Save the options when the screen is closed
worldOptionsScreen.onClose();

// Example for render
// Render the screen, including the title and custom background
worldOptionsScreen.render(guiGraphics, mouseX, mouseY, partialTicks);

// Example for shouldCloseOnEsc
// Check if the screen should close when pressing ESC
boolean shouldClose = worldOptionsScreen.shouldCloseOnEsc();

TetraPage

Cette classe gère la pagination et l'affichage du texte à travers des pages pour le mod TetraLibs. Elle permet d'ajouter des pages, de les naviguer et de personnaliser les actions sur chaque texte affiché.

Méthodes Disponibles

Méthode Description Paramètre Retour
pagesCount Nombre total de pages dans la liste pages. Cette variable statique est initialisée avec la taille actuelle de la collection pages, ce qui représente le nombre d'éléments (pages) stockés. Elle est mise à jour dynamiquement chaque fois que la collection pages est modifiée, assurant ainsi une valeur correcte du nombre total de pages. Aucun int
addPage Ajoute une page à la liste des pages standards. content (List<Component>) void
addCustomPage Ajoute une page à la liste des pages personnalisées. content (List<Component>) void
navigMenu Crée un composant représentant un menu de navigation avec les boutons pour la page précédente et la suivante. entity (Entity) Component
display Affiche la page actuelle pour un joueur. source (CommandSourceStack)
entity (Entity)
void
pagesList Affiche la liste des pages disponibles au joueur. source (CommandSourceStack) void
createText Crée un composant de texte avec des événements de survol et de clic configurés.
text (String)
hoverText (String)
clickAction (String)
clickValue (String)
entity (Entity)
Component
Variante sans l'argument entity.
Paramètres :
text (String)
hoverText (String)
clickAction (String)
clickValue (String)
Retourne Component.
modifyText Modifie un composant de texte existant en lui ajoutant des actions de survol et de clic. component (Component)
text (String)
hoverText (String)
clickAction (String)
clickValue (String)
entity (Entity)
Component
logAllList Enregistre les actions et les événements de survol pour des logs. Aucun void
logPagesCount Enregistre le nombre de pages et la distinction entre pages standards et personnalisées.
edited (boolean) void
Variante sans l'argument edited.
Retourne void.
setPlayerPage Met à jour la page du joueur. entity (Entity)
num (double)
void
getPlayerPage Récupère la page actuelle du joueur. entity (Entity)
num (double)
double

Exemple d'Utilisation

// Exemple d'utilisation pour TetraPage :
 
// Exemple d'utilisation pour la méthode pagesCount
int totalPages = yourClass.pagesCount;

// Exemple d'utilisation pour la méthode addPage
List pageContent = new ArrayList<>();
pageContent.add(new TextComponent("Page 1 Content"));
yourClass.addPage(pageContent);

// Exemple d'utilisation pour la méthode addCustomPage
List customPageContent = new ArrayList<>();
customPageContent.add(new TextComponent("Custom Page Content"));
yourClass.addCustomPage(customPageContent);

// Exemple d'utilisation pour la méthode navigMenu
Entity playerEntity = Minecraft.getInstance().player;
Component navMenu = yourClass.navigMenu(playerEntity);

// Exemple d'utilisation pour la méthode display
CommandSourceStack source = /* obtenir le source */;
Entity player = Minecraft.getInstance().player;
yourClass.display(source, player);

// Exemple d'utilisation pour la méthode pagesList
yourClass.pagesList(source);

// Exemple d'utilisation pour la méthode createText
Component textComponent = yourClass.createText("Click me!", "Hover Text", "openPage", "page1", player);

// Exemple d'utilisation pour la méthode modifyText
Component existingText = /* obtenir le composant existant */;
Component updatedText = yourClass.modifyText(existingText, "New Text", "New Hover Text", "openPage", "page2", player);

// Exemple d'utilisation pour la méthode logAllList
yourClass.logAllList();

// Exemple d'utilisation pour la méthode logPagesCount
yourClass.logPagesCount(true);

// Exemple d'utilisation pour la méthode setPlayerPage
Entity playerEntity = Minecraft.getInstance().player;
yourClass.setPlayerPage(playerEntity, 2);

// Exemple d'utilisation pour la méthode getPlayerPage
double currentPage = yourClass.getPlayerPage(playerEntity, 1);

This class handles pagination and displaying text across pages for the TetraLibs mod. It allows you to add pages, navigate them and personalize the actions on each displayed text.

Available Methods

Method Description Parameter Return
pagesCount Total number of pages in the pages list. This static variable is initialized with the current size of the pages collection, representing the number of elements (pages) stored. It is dynamically updated each time the pages collection is modified, ensuring the correct value for the total number of pages. None int
addPage Adds a page to the standard pages list. content (List<Component>) void
addCustomPage Adds a page to the custom pages list. content (List<Component>) void
navigMenu Creates a component representing a navigation menu with buttons for the previous and next page. entity (Entity) Component
display Displays the current page to a player. source (CommandSourceStack)
entity (Entity)
void
pagesList Displays the list of available pages to the player. source (CommandSourceStack) void
createText Creates a text component with hover and click events configured.
text (String)
hoverText (String)
clickAction (String)
clickValue (String)
entity (Entity)
Component
Variant without the entity argument.
Parameters:
text (String)
hoverText (String)
clickAction (String)
clickValue (String)
Returns Component.
modifyText Modifies an existing text component by adding hover and click actions. component (Component)
text (String)
hoverText (String)
clickAction (String)
clickValue (String)
entity (Entity)
Component
logAllList Logs the actions and hover events for logs. None void
logPagesCount Logs the number of pages and distinguishes between standard and custom pages.
edited (boolean) void
Variant without the edited argument.
Returns void.
setPlayerPage Updates the player's page. entity (Entity)
num (double)
void
getPlayerPage Retrieves the current page of the player. entity (Entity)
num (double)
double

Exemple of Use

// Exemple of use for TetraPage :
 
// Example usage for pagesCount method
int totalPages = yourClass.pagesCount;

// Example usage for addPage method
List pageContent = new ArrayList<>();
pageContent.add(new TextComponent("Page 1 Content"));
yourClass.addPage(pageContent);

// Example usage for addCustomPage method
List customPageContent = new ArrayList<>();
customPageContent.add(new TextComponent("Custom Page Content"));
yourClass.addCustomPage(customPageContent);

// Example usage for navigMenu method
Entity playerEntity = Minecraft.getInstance().player;
Component navMenu = yourClass.navigMenu(playerEntity);

// Example usage for display method
CommandSourceStack source = /* get the source */;
Entity player = Minecraft.getInstance().player;
yourClass.display(source, player);

// Example usage for pagesList method
yourClass.pagesList(source);

// Example usage for createText method
Component textComponent = yourClass.createText("Click me!", "Hover Text", "openPage", "page1", player);

// Example usage for modifyText method
Component existingText = /* get existing component */;
Component updatedText = yourClass.modifyText(existingText, "New Text", "New Hover Text", "openPage", "page2", player);

// Example usage for logAllList method
yourClass.logAllList();

// Example usage for logPagesCount method
yourClass.logPagesCount(true);

// Example usage for setPlayerPage method
Entity playerEntity = Minecraft.getInstance().player;
yourClass.setPlayerPage(playerEntity, 2);

// Example usage for getPlayerPage method
double currentPage = yourClass.getPlayerPage(playerEntity, 1);

Userdata

Util

WorldLoad