Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
CadenCCC committed Dec 12, 2024
0 parents commit 0d9cd13
Show file tree
Hide file tree
Showing 35 changed files with 3,146 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024-2025 OmniMC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
101 changes: 101 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Lumina

Welcome to Lumina, a Java-based framework designed to simplify how you handle mappings, serialization, and
deserialization.
Whether you’re working with full mappings, compressed mappings, or something in between,
Lumina makes it easy, efficient, and reliable. It’s built with flexibility in mind, so you can integrate it into your
projects seamlessly.

## **What does Lumina do?**

This project is the mapping handler for [OmniMC](https://omnimc.org). We use this to control the mappings.

- **Extensible Design**:
- Works with custom serializers like `LineSerializer` and `CompressedLineSerializer` for greater flexibility.

- **Robust Error Handling**:
- The `FailedState` system handles errors gracefully and gives you all the info you need to debug.

- **Centralized Failure Consumers**:
- Simplifies error management with classes like `AcceptConsumer` for reusable and streamlined handling.

## **Getting Started**

Here’s how to get Lumina up and running:

1. **Check your setup**: Make sure you’re using Java 21 or higher.
2. **Add Lumina to your project**:
- Clone the repository:
```shell
git clone https://github.com/<your-repo>/lumina.git
```
Or, include it as a dependency in your build system:

- **Maven**:
```xml
<dependency>
<groupId>org.omnimc</groupId>
<artifactId>lumina</artifactId>
<version>1.0.0</version>
</dependency>
```

- **Gradle**
```groovy
implementation 'org.omnimc:lumina:1.0.0'
```

## **How to Use**
### **Deserializing Mappings**
Lumina gives you specialized tools for deserialization, so you can adapt it to whatever kind of mapping format you’re working with.

#### Full Deserialization:
For handling complete mappings like classes, fields, and methods, use `FullDeserializer`:
```java
FullDeserializer deserializer = new FullDeserializer();
Mappings mappings = ...; // Your Mappings instance
File mappingsDir = new File("mappings/");
if (deserializer.deserializeToFile(mappings, mappingsDir)) {
System.out.println("Full mappings deserialized successfully!");
}
```
### **Understanding Mapping Types**
`MappingType` indicates what kind of mapping you're working with. Each type is tied to a specific serializer:
- `FULL`: For uncompressed mappings.
- `COMPRESSED`: Uses the `CompressedLineSerializer` for compressed data.
- `PARAMETERS`: Specifically for parameter mappings.
- `UNKNOWN`: For scenarios where the mapping type isn’t defined.
#### Example usage
```java
MappingType type = MappingType.FULL;
LineSerializer serializer = type.getLineSerializer();
System.out.println("Serializer for FULL: "+serializer);
```
### **Error Handling That Works for You**
If something goes wrong, Lumina has you covered with `FailedState`. You can create meaningful error states and handle them however you see fit:
```java
FailedState error = FailedState.of("Failed to deserialize", ParameterDeserializer.class);
System.err.println(error);
```
And if you want to automate failure handling, you can set up custom consumers with `AcceptConsumer`:
```java
AcceptConsumer consumer = new AcceptConsumer();
consumer.setConsumer(failedState -> {
System.err.println("Error occurred: " + failedState);
});
```
## **Contributing**
We love contributions! Here’s how you can help grow Lumina:
1. Fork the repo.
2. Create a new branch for your feature or fix.
3. Submit a pull request with a clear explanation of your changes.
Every contribution is appreciated, no matter how big or small.
## **License**
This project is licensed under the [MIT License](LICENSE). That means you can use, modify, and distribute it freely, as long as you give credit where it’s due.
39 changes: 39 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# **Security Policy**

Thank you for helping to improve Lumina’s security! We take security vulnerabilities seriously and appreciate your
contributions to keeping this project safe for everyone.

## **Supported Versions**

We make every effort to backport security fixes to recent versions of Lumina. The following versions are currently
supported with security updates:

| Version | Supported |
|---------|-------------------|
| 1.0.0 | ✅ Fully supported |

Older versions may not receive security fixes. We strongly recommend updating to the latest version whenever possible.

## **Reporting a Vulnerability**

If you believe you’ve found a security issue related to Lumina, please **DO NOT** post it in public forums or as an
issue on the repository. Instead, help us responsibly disclose the vulnerability by emailing us at:
**<a href="mailto:security@omnimc.org" target="_blank">security@omnimc.org</a>**
When reporting a vulnerability, please include the following information:

- A detailed description of the vulnerability.
- Steps to reproduce the issue (if applicable).
- Information about potential impact or severity.
- Any relevant logs or screenshots.

Our security team will review your report, respond within a reasonable timeframe, and work on a fix as quickly as
possible.

## **Security Fix Process**

- Once a vulnerability has been verified, we will:
1. Develop and test a patch.
2. Coordinate a private disclosure with impacted parties (if applicable).
3. Release a public update, including a formal acknowledgment of the reporter (with their consent).

Thank you for helping us keep Lumina secure and reliable!
21 changes: 21 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id 'java'
}

group = 'org.omnimc'
version = '0.0.1'

repositories {
mavenCentral()
}

dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'

implementation 'org.jetbrains:annotations:26.0.1'
}

test {
useJUnitPlatform()
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 6 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Mon Nov 04 04:18:59 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0d9cd13

Please sign in to comment.