Skip to content

Commit

Permalink
Reformat the whole project
Browse files Browse the repository at this point in the history
Also optimizes imports
  • Loading branch information
FlorianMichael committed Jan 2, 2025
1 parent fbd5b31 commit 79fdfad
Show file tree
Hide file tree
Showing 138 changed files with 501 additions and 384 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github: FlorianMichael
custom: ["https://florianmichael.de/donate"]
custom: [ "https://florianmichael.de/donate" ]
ko_fi: rk_01
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug Report
description: Report a bug in ViaFabricPlus
labels: [bug]
labels: [ bug ]

body:
- type: markdown
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build
on: [pull_request, push, workflow_dispatch]
on: [ pull_request, push, workflow_dispatch ]

jobs:
build:
Expand Down
27 changes: 20 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,58 @@
# Contributing guidelines for the project

## Setting up a Workspace
ViaFabricPlus uses Gradle, to make sure that it is installed properly you can check [Gradle's website](https://gradle.org/install/).

ViaFabricPlus uses Gradle, to make sure that it is installed properly you can
check [Gradle's website](https://gradle.org/install/).

1. Clone the repository using `git clone https://github.com/ViaVersion/ViaFabricPlus`.
2. CD into the local repository.
3. Run `./gradlew genSources`.
4. Open the folder as a Gradle project in your preferred IDE.
5. Run the mod.

## Update translation files
Translation files are located in `src/main/resources/assets/viafabricplus/lang/`. To update them, you need to do the following:
1. Copy the `en_us.json` file and rename it to the language code of the language you want to update (e.g. `de_de.json` for German)

Translation files are located in `src/main/resources/assets/viafabricplus/lang/`. To update them, you need to do the
following:

1. Copy the `en_us.json` file and rename it to the language code of the language you want to update (e.g. `de_de.json`
for German)
2. Translate all values in the file to the language you want to update
3. Do not change the keys of the values, only the values themselves
4. Do not change the formatting of the file (e.g. the spaces between the keys and values or the order of the keys)
5. Try to be consistent with Minecraft language files.
6. Take a look at UN's guidelines for Gender-inclusive language: https://www.un.org/en/gender-inclusive-language/guidelines.shtml
6. Take a look at UN's guidelines for Gender-inclusive
language: https://www.un.org/en/gender-inclusive-language/guidelines.shtml
7. Create a pull request and wait for it to be reviewed and merged.
8. You're done, congrats!

## Add a new feature or fix a bug

1. Create a new branch for your feature/bugfix (e.g. `feature/fix-xyz` or `fix/fix-xyz`)
2. Implement your feature/bugfix and make sure it works correctly
3. Clean your code and make sure it is readable and understandable (e.g. use proper variable names)
4. Use the Google java code style (https://google.github.io/styleguide/javaguide.html) and format your code accordingly
5. If you're changing API, make sure to update the documentation in the `docs` folder, add javadocs to your code and don't break backwards compatibility if not necessary
5. If you're changing API, make sure to update the documentation in the `docs` folder, add javadocs to your code and
don't break backwards compatibility if not necessary
6. Create a pull request and wait for it to be reviewed and merged.
7. You're done, congrats!

## Adding protocol new fixes - which are important and which aren't?

Protocol fixes are the core functionality of ViaFabricPlus, they make ViaFabricPlus stand out from all other existing
protocol translation platforms, and so it's even more important to keep them working.

When adding new fixes, you should always check if the fix is relevant for the current version of the game. If you're unsure,
When adding new fixes, you should always check if the fix is relevant for the current version of the game. If you're
unsure,
ask in the ViaVersion discord.

In general, you should only implement changes which could be detected by the server or are relevant for the gameplay.
In general, you should only implement changes which could be detected by the server or are relevant for the gameplay.

From experience, most changes are related to either movement or networking. If you contribute new fixes, please proof
your changes by showing that they are relevant and also by providing a game source diff. **It's important that fixes
are changing the actual change happend in the game and not just visual changes.**

## Maintaining the mod

See [MAINTAINING.md](docs/MAINTAINING.md) for more information on how to maintain the mod.
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@
<a href="https://github.com/ViaVersion/ViaFabricPlus/actions/workflows/build.yml"><img src="https://github.com/ViaVersion/ViaFabricPlus/actions/workflows/build.yml/badge.svg?branch=main"></a>

#### Fabric mod to connect to EVERY Minecraft server version (Release, Beta, Alpha, Classic, Snapshots, Bedrock) with QoL fixes to the gameplay

</div>

# Why another protocol translator?
ViaFabricPlus implements the [ViaVersion projects](https://github.com/ViaVersion) into Fabric and provides tons of fixes to the existing protocol translation which can't be implemented in the original ViaVersion project.

ViaFabricPlus implements the [ViaVersion projects](https://github.com/ViaVersion) into Fabric and provides tons of fixes
to the existing protocol translation which can't be implemented in the original ViaVersion project.
These fixes consist of movement changes, block/entity collisions, rendering changes, and many more.

At the time of writing, ViaFabricPlus is the only mod that supports joining all Minecraft server versions down to the first multiplayer version while implementing
At the time of writing, ViaFabricPlus is the only mod that supports joining all Minecraft server versions down to the
first multiplayer version while implementing
legacy combat mechanics, movement, and rendering changes to make the gameplay feel more like the old days.

**On the other hand, ViaFabricPlus supports only the latest Minecraft client version, and only Fabric.**
If you need ViaFabricPlus for older versions of the game, you can use [ViaFabric](https://viaversion.com/fabric)

## Supported Server versions

- Release (1.0.0 - 1.21.4)
- Beta (b1.0 - b1.8.1)
- Alpha (a1.0.15 - a1.2.6)
Expand All @@ -31,28 +36,36 @@ If you need ViaFabricPlus for older versions of the game, you can use [ViaFabric
- Bedrock Edition 1.21.50 ([Some features are missing](https://github.com/RaphiMC/ViaBedrock#features))

## How to (Users)

- [A detailed guide on how to install and use the mod](docs/USAGE.md)
- If you encounter any issues, please report them on either:
- [the issue tracker](https://github.com/ViaVersion/ViaFabricPlus/issues)
- [the ViaVersion Discord](https://discord.gg/viaversion)
- [the issue tracker](https://github.com/ViaVersion/ViaFabricPlus/issues)
- [the ViaVersion Discord](https://discord.gg/viaversion)

## How to (Developers)

- [Detailed guidelines for contributions as well as setting up a dev environment](CONTRIBUTING.md)
- [API and integration examples for developers](docs/DEVELOPER_API.md)

## ViaFabric
[ViaFabric](https://github.com/ViaVersion/ViaFabric) can be used for server-side purposes or when using older versions of the game.

[ViaFabric](https://github.com/ViaVersion/ViaFabric) can be used for server-side purposes or when using older versions
of the game.

### Does it work with ViaFabricPlus:

- No, ViaFabricPlus cannot be used with ViaFabric.

### Differences with ViaFabric:

https://github.com/ViaVersion/ViaFabric?tab=readme-ov-file#differences-with-viafabricplus

## Credits

Special thanks to all our [Contributors](https://github.com/ViaVersion/ViaFabricPllus/graphs/contributors).

## Disclaimer
It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat plugins.\

It cannot be guaranteed that this mod is allowed on specific servers as it can possibly cause problems with anti-cheat
plugins.\
***(USE ONLY WITH CAUTION!)***
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public AbstractSetting(final SettingGroup parent, final MutableText name, final
}

public abstract void write(final JsonObject object);

public abstract void read(final JsonObject object);

public void onValueChanged() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ public MutableText displayValue() {
}

@Override
public void write(JsonObject object) {}
public void write(JsonObject object) {
}

@Override
public void read(JsonObject object) {}
public void read(JsonObject object) {
}

}
4 changes: 2 additions & 2 deletions build-logic/src/main/groovy/vfp.base-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ dependencies {
vvDependencies "com.viaversion:viaversion-common:5.2.1"
vvDependencies "com.viaversion:viabackwards-common:5.2.1"
vvDependencies "com.viaversion:viaaprilfools-common:4.0.0"
vvDependencies ("com.viaversion:vialoader:4.0.0") {
vvDependencies("com.viaversion:vialoader:4.0.0") {
exclude group: "com.google.guava", module: "guava"
exclude group: "org.slf4j", module: "slf4j-api"
}
vvDependencies "net.raphimc:ViaLegacy:3.0.7-SNAPSHOT"
vvDependencies ("net.raphimc:ViaBedrock:0.0.14-SNAPSHOT") {
vvDependencies("net.raphimc:ViaBedrock:0.0.14-SNAPSHOT") {
exclude group: "io.jsonwebtoken"
exclude group: "com.mojang", module: "brigadier"
}
Expand Down
162 changes: 81 additions & 81 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,112 +1,112 @@
plugins {
id "vfp.base-conventions"
id "vfp.base-conventions"
}

base {
archivesName = "ViaFabricPlus"
archivesName = "ViaFabricPlus"
}

loom {
accessWidenerPath = file("src/main/resources/viafabricplus.accesswidener")
accessWidenerPath = file("src/main/resources/viafabricplus.accesswidener")
}

configurations {
jij // jar in jar configuration
modJij // jar in jar configuration for mods
jij // jar in jar configuration
modJij // jar in jar configuration for mods

include.extendsFrom modJij
modImplementation.extendsFrom modJij
modCompileOnlyApi.extendsFrom modJij
include.extendsFrom modJij
modImplementation.extendsFrom modJij
modCompileOnlyApi.extendsFrom modJij

// Include VV dependencies as jij
jij.extendsFrom vvDependencies
// Include VV dependencies as jij
jij.extendsFrom vvDependencies
}

dependencies {
// Fabric API
modJij fabricApi.module("fabric-api-base", project.fabric_api_version)
modJij fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version)
modJij fabricApi.module("fabric-networking-api-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-command-api-v2", project.fabric_api_version)
modJij fabricApi.module("fabric-lifecycle-events-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-particles-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-registry-sync-v0", project.fabric_api_version)

// Sub projects, since they are Fabric mods as well (mainly to access the game code) we have to first
// implement the namedElements (raw output) to compile against, then include the mappedElements into the output jar
implementation compileOnlyApi(project(path: ":viafabricplus-api", configuration: "namedElements"))
implementation compileOnlyApi(project(path: ":viafabricplus-api-legacy", configuration: "namedElements"))
implementation compileOnlyApi(project(path: ":viafabricplus-visuals", configuration: "namedElements"))

include project(":viafabricplus-api")
include project(":viafabricplus-api-legacy")
include project(":viafabricplus-visuals")

// Dependencies exclusively to the root mod
jij ("net.raphimc:MinecraftAuth:4.1.1") {
exclude group: "com.google.code.gson", module: "gson"
exclude group: "org.slf4j", module: "slf4j-api"
}
jij "net.lenni0451:Reflect:1.4.0"
jij("net.lenni0451:MCPing:1.4.2") {
exclude group: "com.google.code.gson", module: "gson"
}
jij("org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR3-SNAPSHOT") {
exclude group: "io.netty"
}
jij "de.florianmichael:Classic4J:2.1.1-SNAPSHOT"

// Only to compile against for the ModMenu integration
modCompileOnly "com.terraformersmc:modmenu:12.0.0"

// Fabric's jar in jar system doesn't support transitive dependencies, so we have to manually add them
afterEvaluate {
configurations.jij.incoming.resolutionResult.allDependencies.each {
dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(it.requested.toString()) {
transitive = false
}))
}
}
// Fabric API
modJij fabricApi.module("fabric-api-base", project.fabric_api_version)
modJij fabricApi.module("fabric-resource-loader-v0", project.fabric_api_version)
modJij fabricApi.module("fabric-networking-api-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-command-api-v2", project.fabric_api_version)
modJij fabricApi.module("fabric-lifecycle-events-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-particles-v1", project.fabric_api_version)
modJij fabricApi.module("fabric-registry-sync-v0", project.fabric_api_version)

// Sub projects, since they are Fabric mods as well (mainly to access the game code) we have to first
// implement the namedElements (raw output) to compile against, then include the mappedElements into the output jar
implementation compileOnlyApi(project(path: ":viafabricplus-api", configuration: "namedElements"))
implementation compileOnlyApi(project(path: ":viafabricplus-api-legacy", configuration: "namedElements"))
implementation compileOnlyApi(project(path: ":viafabricplus-visuals", configuration: "namedElements"))

include project(":viafabricplus-api")
include project(":viafabricplus-api-legacy")
include project(":viafabricplus-visuals")

// Dependencies exclusively to the root mod
jij("net.raphimc:MinecraftAuth:4.1.1") {
exclude group: "com.google.code.gson", module: "gson"
exclude group: "org.slf4j", module: "slf4j-api"
}
jij "net.lenni0451:Reflect:1.4.0"
jij("net.lenni0451:MCPing:1.4.2") {
exclude group: "com.google.code.gson", module: "gson"
}
jij("org.cloudburstmc.netty:netty-transport-raknet:1.0.0.CR3-SNAPSHOT") {
exclude group: "io.netty"
}
jij "de.florianmichael:Classic4J:2.1.1-SNAPSHOT"

// Only to compile against for the ModMenu integration
modCompileOnly "com.terraformersmc:modmenu:12.0.0"

// Fabric's jar in jar system doesn't support transitive dependencies, so we have to manually add them
afterEvaluate {
configurations.jij.incoming.resolutionResult.allDependencies.each {
dependencies.include(dependencies.implementation(dependencies.compileOnlyApi(it.requested.toString()) {
transitive = false
}))
}
}
}

processResources {
filesMatching("fabric.mod.json") {
expand(
"version": project.version,
"description": project.description,
"implVersion": "git-${project.name}-${project.version}:${latestCommitHash().get()}",
"mcVersion": mcVersion()
)
}
filesMatching("fabric.mod.json") {
expand(
"version": project.version,
"description": project.description,
"implVersion": "git-${project.name}-${project.version}:${latestCommitHash().get()}",
"mcVersion": mcVersion()
)
}
}

String mcVersion() {
if (project.supported_versions.isEmpty()) {
return project.minecraft_version
} else {
return project.supported_versions
}
if (project.supported_versions.isEmpty()) {
return project.minecraft_version
} else {
return project.supported_versions
}
}

Provider<String> latestCommitHash() {
return providers.exec {
commandLine = ["git", "rev-parse", "--short", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
return providers.exec {
commandLine = ["git", "rev-parse", "--short", "HEAD"]
}.standardOutput.getAsText().map(String::trim)
}

jar {
// Rename the project's license file to LICENSE_<project_name> to avoid conflicts
from("LICENSE") {
rename {
"${it}_${project.archivesBaseName}"
}
}
// Rename the project's license file to LICENSE_<project_name> to avoid conflicts
from("LICENSE") {
rename {
"${it}_${project.archivesBaseName}"
}
}
}

idea {
module {
["run"].each {
excludeDirs << file("$it")
}
}
module {
["run"].each {
excludeDirs << file("$it")
}
}
}
Loading

0 comments on commit 79fdfad

Please sign in to comment.