|
| 1 | +> ## Documentation for basically using CoreAPI. |
| 2 | +
|
| 3 | +## 1. For playing and running minecraft: |
| 4 | + |
| 5 | +#### 1.1 Download Core API mod module. |
| 6 | + |
| 7 | +Visit **Core API** repository on github, visit **releases** tab and download `.jar` files of latest _pre-release_ / release (**recommended**) |
| 8 | + |
| 9 | +Releases page: https://github.com/ProjectEssentials/ProjectEssentials-Core/releases |
| 10 | + |
| 11 | +#### 1.2 Install Core API modification. |
| 12 | + |
| 13 | +The minecraft forge folder structure below will help you understand what is written below. |
| 14 | + |
| 15 | +``` |
| 16 | +. |
| 17 | +├── assets |
| 18 | +├── config |
| 19 | +├── libraries |
| 20 | +├── mods (that's how it should be) |
| 21 | +│ └── Project Essentials Core-1.14.4-1.X.X.X.jar |
| 22 | +└── ... |
| 23 | +``` |
| 24 | + |
| 25 | +Place your mods and Core API mods according to the structure above. |
| 26 | + |
| 27 | +#### 1.3 Verifying mod on the correct installation. |
| 28 | + |
| 29 | +Run the game, check the number of mods, if the list of mods contains `Project Essentials Core` mod, then the mod has successfully passed the initialization of the modification. |
| 30 | + |
| 31 | +## 2. For developing and developers: |
| 32 | + |
| 33 | +### 2.1 Getting started with installing. |
| 34 | + |
| 35 | +To get the Core API source for development and interactions with the rights of players, you need to get the dependencies and get the documentation to view it in your IDE. |
| 36 | + |
| 37 | +Installation documentation is located in the readme file or just follow the link: https://github.com/ProjectEssentials/ProjectEssentials-Core#-install-using-gradle |
| 38 | + |
| 39 | +### 2.2 API usage. |
| 40 | + |
| 41 | +I could not write this damn documentation at all and spend time on it, because it is so fucking understandable. But just in case, I will nevertheless sign here some trifles. |
| 42 | + |
| 43 | +Let's start small? |
| 44 | + |
| 45 | +#### 2.2.1 Functions. |
| 46 | + |
| 47 | +``` |
| 48 | +EssBase.logBaseInfo |
| 49 | +
|
| 50 | +- description: Print base modification information to log. |
| 51 | +``` |
| 52 | + |
| 53 | +``` |
| 54 | +EssBase.validateForgeVersion |
| 55 | +
|
| 56 | +- description: Validate forge version on compatibility with loaded mod. If validation failed, then you will be notified with messages in logger with level WARN. |
| 57 | +``` |
| 58 | + |
| 59 | +#### 2.2.2 Extensions. |
| 60 | + |
| 61 | +``` |
| 62 | +CommandContext<CommandSource>.isPlayerSender |
| 63 | +
|
| 64 | +- return: true if command sender is player. (boolean value) |
| 65 | +``` |
| 66 | + |
| 67 | +``` |
| 68 | +CommandEvent.commandName |
| 69 | +
|
| 70 | +- example: player execute command `/heal MairwunNx`, then you get `heal` as string. |
| 71 | +
|
| 72 | +- return: command name as string. (string value) |
| 73 | +``` |
| 74 | + |
| 75 | +``` |
| 76 | +CommandEvent.executedCommand |
| 77 | +
|
| 78 | +- example: player execute command `/heal MairwunNx`, then you get `/heal MairwunNx` as string. |
| 79 | +
|
| 80 | +- return: fully executed command as string. (string value) |
| 81 | +``` |
| 82 | + |
| 83 | +``` |
| 84 | +CommandEvent.player |
| 85 | +
|
| 86 | +- return: `ServerPlayerEntity` class instance from `CommandEvent` class instance. (ServerPlayerEntity class instance) |
| 87 | +``` |
| 88 | + |
| 89 | +``` |
| 90 | +CommandEvent.source |
| 91 | +
|
| 92 | +- return: Return command `source` from `CommandEvent` class instance. (CommandSource class instance) |
| 93 | +``` |
| 94 | + |
| 95 | +``` |
| 96 | +CommandSourceExtensions.sendMsg |
| 97 | +
|
| 98 | +- description: Send localized message to player without logging. |
| 99 | +
|
| 100 | +- accepts: |
| 101 | + - moduleName - mod module name. (string) |
| 102 | + - commandSource - command source instance. (CommandSource class instance) |
| 103 | + - l10nString - localized string without `project_essentials_`. (string) |
| 104 | + - args - additional arguments for localized string `(%s literals)`. (string arguments) |
| 105 | +``` |
| 106 | + |
| 107 | +``` |
| 108 | +String.capitalizeWords |
| 109 | +
|
| 110 | +- return: capitalized each word string. (string) |
| 111 | +``` |
| 112 | + |
| 113 | +``` |
| 114 | +String.Companion.empty |
| 115 | +
|
| 116 | +- return: empty string. (string) |
| 117 | +``` |
| 118 | + |
| 119 | +#### 2.2.3 Helpers. |
| 120 | + |
| 121 | +``` |
| 122 | +ForgePathHelper.getRootPath |
| 123 | +
|
| 124 | +- accepts: |
| 125 | + - pathType - enum class with CLIENT and SERVER enums. (ForgeRootPaths enum class) |
| 126 | +
|
| 127 | +- return: absolutely path to configuration root dir. (string) |
| 128 | +``` |
| 129 | + |
| 130 | +``` |
| 131 | +ModErrorsHelper.<ERROR_ID> |
| 132 | +
|
| 133 | +- see: https://github.com/MairwunNx/ProjectEssentials-Core/blob/c7e9c318efc78daeba68650f24036f379859f2a0/src/main/kotlin/com/mairwunnx/projectessentialscore/helpers/ModErrorsHelper.kt |
| 134 | +
|
| 135 | +- return: error description and just error reason. (string) |
| 136 | +``` |
| 137 | + |
| 138 | +``` |
| 139 | +ModPathHelper.CONFIG_FOLDER |
| 140 | +
|
| 141 | +- description: Minecraft config folder absolutely path. |
| 142 | +``` |
| 143 | + |
| 144 | +``` |
| 145 | +ModPathHelper.MOD_CONFIG_FOLDER |
| 146 | +
|
| 147 | +- description: Project Essentials mod config folder. |
| 148 | +``` |
| 149 | + |
| 150 | +## These are all API methods, I think you understand that everything is very simple. |
| 151 | + |
| 152 | +### For all questions, be sure to write issues! |
0 commit comments