Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion to Multi Loader for Fabric Support #47

Merged
merged 65 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
0eb3a83
Updated Workflow
MeAlam1 Sep 4, 2024
92a9cd1
Create PullRequest.md
MeAlam1 Sep 4, 2024
69c49ef
Update PULL_REQUEST_TEMPLATE.md
MeAlam1 Sep 4, 2024
9dcdcbf
Merge branch '1.21' of https://github.com/Repo-Fork-Alam/BlueLib-Fork…
MeAlam1 Sep 4, 2024
f4b5466
Ported Forge from 1.20 to 1.21
MeAlam1 Sep 4, 2024
32e45fc
Fixed Forge 1.21
MeAlam1 Sep 4, 2024
2038712
Added Logo
MeAlam1 Sep 5, 2024
dea8f1c
Succesfully Ported to 1.21 NeoForge
MeAlam1 Sep 5, 2024
f4fc518
Fixed Forge not building properly
MeAlam1 Sep 5, 2024
8ef0586
Merge branch 'MeAlam1:1.21' into 1.21
MeAlam1 Sep 5, 2024
17645f9
Merge branch 'MeAlam1:1.21' into 1.21
MeAlam1 Sep 9, 2024
8b11d0a
Added all Math Utils that anyone can ever think of that improve Math …
MeAlam1 Sep 12, 2024
97b8c67
Forgot Miles to Kilometers
MeAlam1 Sep 12, 2024
2048a25
Moved some code around
MeAlam1 Sep 12, 2024
f708b04
Cleaned up
MeAlam1 Sep 12, 2024
36c00f8
Finished ChunkUtils
MeAlam1 Sep 12, 2024
29eb663
Added Custom Logging and Exceptions
MeAlam1 Sep 18, 2024
ef775ac
Variant Loader doesnt need 2 paths anymore but 1 folder it loops thru
MeAlam1 Sep 18, 2024
c2fcc23
Removed Useless Parameter
MeAlam1 Sep 18, 2024
eec27f3
Added the Last Util and Updated the Logging
MeAlam1 Sep 18, 2024
9be323e
Update CONTRIBUTING.md
MeAlam1 Sep 18, 2024
67a4ac9
Update All Comments
MeAlam1 Sep 18, 2024
424ca4e
Moved Math Conversion
MeAlam1 Sep 19, 2024
2ed1205
Update ParameterBase.java
MeAlam1 Sep 19, 2024
6f5fc5f
Finished Proofreading Variantloader
MeAlam1 Sep 19, 2024
8003e54
Refactored all Logging
MeAlam1 Sep 26, 2024
f123d99
Created a Mixin
MeAlam1 Sep 27, 2024
4f2b164
Fixed all Comments
MeAlam1 Sep 30, 2024
db02629
Updated Logging!
MeAlam1 Oct 3, 2024
9eff5e2
Updated Comments + Added More Cases
MeAlam1 Oct 3, 2024
db425c6
Update ParameterBase.java
MeAlam1 Oct 6, 2024
dad3a9e
Update VariantLoader.java
MeAlam1 Oct 6, 2024
57d6a66
Cleaned some Comments
MeAlam1 Oct 6, 2024
1796720
Update LivingEntityMixin.java
MeAlam1 Oct 6, 2024
3d9117d
Refactored Entire Codebase to MultiLoader
MeAlam1 Oct 6, 2024
b6f1f5e
Added Fabric to the Workflow
MeAlam1 Oct 6, 2024
3f06c90
Update .gitignore
MeAlam1 Oct 7, 2024
0cf5f48
Fixed Code
MeAlam1 Oct 7, 2024
e8c8617
Updated CI
MeAlam1 Oct 7, 2024
d76537c
Fixed the Welcome Message
MeAlam1 Oct 7, 2024
22d2aec
Cleaned up all Conventions
MeAlam1 Oct 7, 2024
b53b3e3
Removed co-author/ fixed some close comments
MeAlam1 Oct 7, 2024
718deaf
Fixed all Comments
MeAlam1 Oct 7, 2024
3eb4429
removed github workflow error
MeAlam1 Oct 7, 2024
051b331
Updated Gradle
MeAlam1 Oct 7, 2024
6d6fd43
Added setVariantParameter
MeAlam1 Oct 7, 2024
fe801ca
Created an EnableLogging Annotation
MeAlam1 Oct 7, 2024
5a693d1
Create EnhancementTemplate.yml
MeAlam1 Oct 7, 2024
63e595e
Removed Debugger
MeAlam1 Oct 7, 2024
9199435
Update CONTRIBUTING.md
MeAlam1 Oct 8, 2024
c0cec0d
Fixed some errors in the Contributing, Enhancemements and logger
MeAlam1 Oct 8, 2024
ca14490
Added Geckolib as Optional Dependancy for NeoForge
MeAlam1 Oct 8, 2024
acb2cbb
Update Gradle 8.8 to 8.10.2
MeAlam1 Oct 8, 2024
117104a
Update BaseLogger.java
MeAlam1 Oct 8, 2024
71fdba3
Fixed Logging + Added Example Package
MeAlam1 Oct 9, 2024
78f9886
Check Previous Commit
MeAlam1 Oct 9, 2024
cc5cc25
Moved some Constants
MeAlam1 Oct 9, 2024
5620d08
Commented all Example Code
MeAlam1 Oct 9, 2024
f4c7386
Added Private Constructors to remove Build Warning
MeAlam1 Oct 9, 2024
5feddfd
Fixed Fabric not loading
MeAlam1 Oct 9, 2024
f3ffe9d
Removed an old tag
MeAlam1 Oct 9, 2024
bb9a0cf
Added Checks to the Rendering
MeAlam1 Oct 9, 2024
f877d14
Fixed some comments
MeAlam1 Oct 9, 2024
30430a9
Updated README.md
MeAlam1 Oct 24, 2024
6a3ad56
Added Fabric to ReadMe
MeAlam1 Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/EnhancementTemplate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Enhancement Template
description: Create a Enhancement!
title: "[Enhancement]: "
labels: ["Enhancement"]
body:
- type: markdown
attributes:
value: |
Thank you for making a Suggestion!
- type: textarea
id: what-should-we-add
attributes:
label: What do you want to have added?
description: |
Please tell us as detailed as possible what you want to have added to the library!
Feel free to also add Examples if they exist!
validations:
required: true
- type: dropdown
id: inspiration
attributes:
label: Inspiration
description: Is this idea used in other Mods/Games?
options:
- "Yes"
- "No"
validations:
required: true
- type: input
id: inspiration-where
attributes:
label: Where did you get the inspiration from?
description: If this idea is used in a different Mod/Game, please provide a list of the Games/Mods
24 changes: 19 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
build:
runs-on: ubuntu-latest

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true

steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -22,6 +25,11 @@ jobs:
distribution: 'temurin'
java-version: '21'

- name: Set up Node.js 20
uses: actions/setup-node@v3
with:
node-version: '20'

- name: Cache Gradle packages
uses: actions/cache@v3
with:
Expand All @@ -32,14 +40,20 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

- name: Grant execute permission for Gradle wrappers
- name: Generate Gradle wrapper if not present
run: |
chmod +x NeoForge/gradlew
chmod +x Forge/gradlew
if [ ! -f "./gradlew" ]; then
gradle wrapper
fi

- name: Grant execute permission for Gradle wrapper
run: chmod +x ./gradlew

- name: Build for NeoForge
run: cd NeoForge && ./gradlew build
run: ./gradlew build -p neoforge

- name: Build for Forge
run: cd Forge && ./gradlew build
run: ./gradlew build -p forge

- name: Build for Fabric
run: ./gradlew build -p fabric
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,31 @@ replay_pid*

# Default ignored files
.idea/*
.gradle/*

# BuildSrc
buildSrc/build/*
buildSrc/.gradle/*

# Common
common/build/*
common/.gradle/*
common/out/*

# Fabric
fabric/build/*
fabric/.gradle/*
fabric/runs/*
fabric/run/*

# Forge
forge/build/*
forge/.gradle/*
forge/runs/*
forge/run/*

# Neoforge
neoforge/build/*
neoforge/.gradle/*
neoforge/runs/*
neoforge/run/*
174 changes: 100 additions & 74 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,78 +17,113 @@

- **Structure**:
- **Class Descriptions**:
- **Start with:** Start the Comment with A(n) {@code privacy/static/final} {@code/link Class/MethodType} [Description of the Class/Method].
- **Key Methods:** List key methods provided by the class, using bullet points for easy readability.
- **Author:** If you have contributed to a Method/Class, put yourself as Co-author, if you have created an Method/Class, put yourself as Author.
- **Since Version:** Use the `@since` tag to indicate the version since which the class has been available.
- **Author:** If you have contributed to a Method/Class, feel free to add yourself to the author tag.
- **Since Version:** Use the `@since` tag to indicate the version since which the Method/Class has been available.
- **Version:** Use the `@version` tag to indicate the version since when the class has last been updated.
**Example:**
```java
/**
* A {@code JSONLoader} class responsible for loading and parsing JSON data from resources
* defined by {@link ResourceLocation} within a Minecraft mod environment.
* <p>
* Key Methods:
* <ul>
* <li>{@link #loadJson(ResourceLocation, ResourceManager)} - Loads a JSON resource.</li>
* </ul>
* @author MeAlam
* @Co-author Dan
* @since 1.0.0
*/
public class JSONLoader {
}
```
- **Method Descriptions**: Begin each comment with a brief description that typically starts with `A ...`, where the `...` represents a link to the relevant class or object using `{@link ClassName}`. If the method is `void`, use `{@code}` to refer to the method name instead.
- **Example for a Method**:
```java
/**
* A {@link String} that retrieves the value of a custom parameter for a specific variant.
*
* @param pVariantName {@link String} - The variant name you want to see the custom parameter of.
* @param pParameterKey {@link String} - The parameter you want to see.
* @return The value of the custom parameter identified by {@code pParameterKey}
* for the variant specified by {@code pVariantName}.
* @author MeAlam
* @Co-author Dan
* @since 1.0.0
* A {@code public abstract base class} for managing a collection of {@link #parameters}.
* <p>
* This {@code class} provides methods to add, retrieve, remove, and manipulate {@link #parameters} stored as key-value pairs.
* </p>
* Key Methods:
* <ul>
* <li>{@link #addParameter(String, Object)} - Adds a parameter to {@link #parameters}.</li>
* <li>{@link #getParameter(String)} - Retrieves a parameter from {@link #parameters}.</li>
* <li>{@link #removeParameter(String)} - Removes a parameter from {@link #parameters}.</li>
* <li>{@link #getAllParameters()} - Returns all parameters in {@link #parameters}.</li>
* <li>{@link #containsParameter(String)} - Checks if a parameter exists by its key from {@link #parameters}.</li>
* <li>{@link #isEmpty()} - Checks if {@link #parameters} is empty.</li>
* <li>{@link #clearParameters()} - Clears all parameters from {@link #parameters}.</li>
* <li>{@link #getParameterCount()} - Returns the number of parameters in {@link #parameters}.</li>
* <li>{@link #getParameterKeys()} - Returns a set of all parameter keys from {@link #parameters}.</li>
* <li>{@link #getParameterValues()} - Returns a collection of all parameter values from {@link #parameters}.</li>
* <li>{@link #updateParameter(String, Object)} - Updates the value of an existing parameter in {@link #parameters}.</li>
* </ul>
*
* @author MeAlam
* @since 1.0.0
* @version 1.0.0
*/
```
- **Start with:** Start the Comment with A(n) {@code privacy/static/final} {@code/link Class/MethodType} [Description of the Class/Method].
- **Example for a Method**:
```java
/**
* A {@code protected static void} that registers entity variants from specified locations.
* <p>
* This method attempts to load variants from both mod and datapack locations. It logs status information and
* handles exceptions that occur during the loading process.
* </p>
* <p>
* Parameters:
* <ul>
* <li>{@code pFolderPath} {@link String} - The folder path location within the mod or datapack where variants are stored.</li>
* <li>{@code pServer} {@link MinecraftServer} - The server instance of the current world.</li>
* <li>{@code pModID} {@link String} - The mod ID used to locate the entity variant resources. (Use your Mod's ID)</li>
* <li>{@code pEntityName} {@link String} - The entity name to load.</li>
* </ul>
*
* Exception Handling:
* <ul>
* <li>{@link JsonParseException} - Thrown when there is an error parsing the JSON files.</li>
* <li>{@link RuntimeException} - Thrown for unexpected errors during the registration process.</li>
* </ul>
*
* @param pFolderPath {@link String} - The folder path location within the mod or datapack where variants are stored.
* @param pServer {@link MinecraftServer} - The server instance of the current world.
* @param pModID {@link String} - The mod ID used to locate the entity variant resources. (Use your Mod's ID)
* @param pEntityName {@link String} - The entity name to load.
* @throws JsonParseException if there is an error parsing the JSON files.
* @throws RuntimeException if an unexpected error occurs during the registration process.
* @author MeAlam
* @see MinecraftServer
* @see ResourceLocation
* @see VariantLoader
* @since 1.0.0
*/
protected static void registerEntityVariants(String pFolderPath, MinecraftServer pServer, String pModID, String pEntityName) {
}
```

- **Parameters**: Start each parameter description with `{@link TypeOfParameter} - [Comment]`. If the parameter is referenced within the comment, enclose it in a code block using `{@code}`.
- **Example for Parameters**:
```java
/**
* A {@link String} that retrieves the value of a custom parameter for a specific variant.
*
* @param pVariantName {@link String} - The variant name you want to see the custom parameter of.
* @param pParameterKey {@link String} - The parameter you want to see.
* @return The value of the custom parameter identified by {@code pParameterKey}
* for the variant specified by {@code pVariantName}.
* @author MeAlam
* @since 1.0.0
*/
public String getCustomParameter(String pVariantName, String pParameterKey) {
// Method implementation
}
```

- **Parameters**: Start each parameter description with `{@link TypeOfParameter} - [Comment]`. If the parameter is referenced within the comment, enclose it in a code block using `{@code}`.
- **Example for Parameters**:
```java
/**
* A {@link String} that retrieves the value of a custom parameter for a specific variant.
*
* @param pVariantName {@link String} - The variant name you want to see the custom parameter of.
* @param pParameterKey {@link String} - The parameter you want to see.
* @return The value of the custom parameter identified by {@code pParameterKey}
* for the variant specified by {@code pVariantName}.
* @author MeAlam
* @Co-author Dan
* @since 1.0.0
*/
public String getCustomParameter(String pVariantName, String pParameterKey) {
// Method implementation
}
```
public String getCustomParameter(String pVariantName, String pParameterKey) {
// Method implementation
}
```

- **General Guidelines**:
- Always ensure that comments are clear, concise, and provide sufficient information to understand the code.
- When referencing variables or constants, use `{@code}` to wrap them within the comment.
- Use `{@link}` to refer to classes, methods, or any other Java elements where appropriate.
- Key Methods: In class-level comments, list out key methods provided by the class, which can help users quickly understand the main functionalities.
- Versioning: Include the `@since` tag in both class-level and method-level comments to indicate the version since which the class or method has been available.
- If you update a Class/Method, please add/update the `@version` to indicate it has been changed.
- If you update a Class, please add/update the `@version` to indicate it has been changed.
- Copyright: Each file should start with `// Copyright (c) BlueLib. Licensed under the MIT License.`
- Tags: Use `@see` to link to the correct Wiki Documentation page if it exists.
- Logging: Log every step using `BaseLogger.log`, Always remove the `@EnableLogging` annotation/disable the logging before committing.
- Error Handling: Always ensure that errors and warnings are logged using appropriate logging levels. Critical steps must be logged at least with `BaseLogger.log(BaseLogLevel.Error)` to keep a trail of execution.

### Deprecation

- If you optimize a method, variable, or class and determine that it is no longer necessary for the library, mark it as `@Deprecated` instead of removing it. This only applies to elements that have been included in previous released versions of the library.

- Include a **strong TODO comment** explaining why it is deprecated and any further action required, such as testing or eventual removal.
- Include an **`@see`** that links to the New Method
- **Example**:
```java
/**
Expand All @@ -97,8 +132,8 @@
* <strong>TODO: Testing with Multiple Entities and Datapacks required before Deletion/Refactoring.</strong><br>
* @return A map containing the parameters added to this builder.
* @author MeAlam
* @Co-author Dan
* @since 1.0.0
* @see #newMethod()
*/
@Deprecated
public Map<String, String> build() {
Expand Down Expand Up @@ -134,41 +169,32 @@
- Visual Studio Code (VSC)
- Eclipse (Recommended)

5. **Publish to Local Maven Repository**
- Run the following command from the library folder (e.g., `NeoForge`, `Forge`, `Fabric`) to publish the library to your local Maven repository.
- **Example**:
```bash
./gradlew publishToMavenLocal
```
- This allows you to test the library locally.

6. **Modify the Library**
5. **Modify the Library**
- Make the necessary changes to the respective library folder you are working on. Ensure you adhere to the coding conventions described above.

7. **Test Your Changes**
- Before committing, test your changes by running the game using the appropriate test mod loader folder:
- `TestMods/TestNeoForge`
- `TestMods/TestForge`
- `TestMods/TestFabric`
6. **Test Your Changes**
- Before committing, test your changes by running the game using the appropriate test mod loader folder.
- Use the `example` package to test your changes.
- If no code is available to test, create new test code in the `example` package.
- Ensure that your changes do not introduce any issues or regressions.

8. **Commit Your Changes**
- Once you are satisfied with your changes, commit them from the root folder (`BlueLib`).
7. **Commit Your Changes**
- Once you are satisfied with your changes, commit them to your branch.
- Write clear and concise commit messages explaining the changes made.
- **Example**:
```bash
git commit -am "Improved logging functionality and deprecated old log method"
```

9. **Push to Your Fork**
8. **Push to Your Fork**
- Push your branch to your fork on GitHub.
- **Example**:
```bash
git push origin feature/improve-logging
```

10. **Create a Pull Request (PR)**
- Navigate to your fork on GitHub and create a Pull Request to the main repository. Provide a detailed description of the changes made and why they are necessary.
9. **Create a Pull Request (PR)**
- Navigate to your fork on GitHub and create a Pull Request to the main repository. Provide a detailed description of the changes made and why they are necessary.

## Contributor License Agreement (CLA)

Expand Down
5 changes: 0 additions & 5 deletions Forge/.gitattributes

This file was deleted.

25 changes: 0 additions & 25 deletions Forge/.gitignore

This file was deleted.

Loading
Loading