Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6aca679

Browse files
committedMay 15, 2021
README and LICENSE
1 parent 7ab95e4 commit 6aca679

File tree

3 files changed

+125
-15
lines changed

3 files changed

+125
-15
lines changed
 

‎LICENSE.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5+
6+
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7+
8+
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
9+
10+
0. Additional Definitions.
11+
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
12+
13+
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
14+
15+
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
16+
17+
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
18+
19+
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
20+
21+
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
22+
23+
1. Exception to Section 3 of the GNU GPL.
24+
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
25+
26+
2. Conveying Modified Versions.
27+
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
28+
29+
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
30+
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
31+
3. Object Code Incorporating Material from Library Header Files.
32+
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
33+
34+
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
35+
b) Accompany the object code with a copy of the GNU GPL and this license document.
36+
4. Combined Works.
37+
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
38+
39+
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
40+
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
41+
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
42+
d) Do one of the following:
43+
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
44+
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
45+
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
46+
5. Combined Libraries.
47+
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
48+
49+
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
50+
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
51+
6. Revised Versions of the GNU Lesser General Public License.
52+
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
53+
54+
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
55+
56+
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.

‎README.md

+68-13
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,84 @@
11
# Lambda Plugin SDK
22

3-
This project in an example to show how a proper plugin is set up.
3+
This project in an example to show how a proper plugin for [Lambda Client](https://github.com/lambda-client/lambda) is set up.
4+
The advantage of plugins for a utility mod is that they allow the user to decide what features their personalized client will have. Plugins work in plug and play manner, and can be downloaded and activated inside the ingame menu without reloading the client as long as no mixins are used for the plugin.
5+
If you are scared about the Kotlin in this project be aware that Kotlin is a wrapper language for Java. That means that plugins can also be natively written in Java.
46

57
## Setup
68

7-
Follow these steps to build your own plugin for lambda.
9+
To achieve coding building and publishing your own plugin most of the following steps are required.
810

9-
### 1. Clone Repository
11+
### Fork
12+
This is a template repository and can be used as a base to create a custom plugin. Press the `Use as template` button on GitHub to automatically create a linked fork to this repository.
1013

11-
### 2. Setup IDE
14+
### Clone Repository
1215

13-
### 3. Configure Gradle
16+
Clone the repository to your local machine. Use the link of either your fork or the main repository.
17+
```
18+
git clone https://github.com/lambda-client/plugin-sdk
19+
```
1420

15-
### 4. Plugin
21+
### Setup IDE
1622

17-
### 6. PluginModule
23+
In this guide we will use [IntelliJ IDEA](https://www.jetbrains.com/idea/) as IDE.
24+
1. Open the project from `File > Open...`
25+
2. Let the IDE collect dependencies and index the code.
1826

19-
### 7. ClientCommand
27+
### Configure Gradle
2028

21-
### 8. PluginLabelHud
29+
Test if the environment is set up correctly by building the plugin jar using the Gradle tab on the left side of the IDE.
30+
1. Go to `PluginExample > Tasks > build > jar` in the Gradle tab and run the script
31+
2. IntelliJ will create a new directory called `build` the final built jar will be in `build/libs`
2232

23-
### 9. Background Jobs
33+
### Config
2434

25-
### 10. Config
35+
Configure the meta data of your plugin in `plugin_info.json` and `mcmod.info`
36+
The flag `main_class` must contain the target main class `Plugin` in this case it the `PluginExample.kt`
2637

27-
### 11. Build
38+
### Plugin
2839

29-
### 12. Publish
40+
The plugin main class will act as a register for the functions a plugin can provide.
41+
For example when a new module class is created you have to add this to the `onLoad()` function of the plugin class.
42+
```
43+
modules.add(ModuleExample)
44+
```
45+
Every service is required to be added to the main class in order to index the contents.
46+
47+
### PluginModule
48+
49+
A module represents a utility module inside the game.
50+
The `PluginModule` class acts as a wrapper for `Module` class. For many examples on how a module can work check out the [native modules](https://github.com/lambda-client/lambda/tree/master/src/main/kotlin/com/lambda/client/module/modules) of lambda, or the given example in this project.
51+
The difference to the native `Module` class is that a referral to the main plugin class is given in the object data.
52+
```
53+
pluginMain = PluginExample
54+
```
55+
56+
### ClientCommand
57+
58+
Plugins use the same class as the native client for registering commands. Feel free to check out the [commands of Lambda Client](https://github.com/lambda-client/lambda/tree/master/src/main/kotlin/com/lambda/client/command/commands) as reference.
59+
60+
### PluginLabelHud
61+
62+
A LabelHud is used to display information in the player GUI.
63+
The `PluginLabelHud` class acts as a wrapper for `LabelHud` class. For many examples on how a hud can work check out the [native hud elements](https://github.com/lambda-client/lambda/tree/master/src/main/kotlin/com/lambda/client/gui/hudgui/elements) of lambda, or the given example in this project.
64+
The difference to the native `LabelHud` class is that a referral to the main plugin class is given in the object data.
65+
```
66+
pluginMain = PluginExample
67+
```
68+
69+
### Background Jobs
70+
71+
If coroutines are needed background jobs can be registered using
72+
```
73+
bgJobs.add(BackgroundJob)
74+
```
75+
76+
### Build
77+
78+
1. Go to `PluginExample > Tasks > build > jar` in the Gradle tab and run the script
79+
2. IntelliJ will create a new directory called `build` the final built jar will be in `build/libs`
80+
3. Put the `ExamplePlugin-1.0.jar` into your `./minecraft/lambda/plugins` folder and run the game.
81+
82+
### Publish (coming soon)
83+
84+
Insert the link of your created fork into the plugin manager to load the plugin.

‎build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
version project.modVersion
22
group project.modGroup
33

4-
wrapper { gradleVersion = '6.8.3' }
5-
64
buildscript {
75
repositories {
86
maven { url = 'https://files.minecraftforge.net/maven' }
@@ -25,6 +23,7 @@ compileKotlin {
2523
kotlinOptions {
2624
jvmTarget = "1.8"
2725
useIR = true
26+
freeCompilerArgs += '-Xlambdas=indy'
2827
}
2928
}
3029

0 commit comments

Comments
 (0)
Please sign in to comment.