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

1.17 #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
MyAirplaneFork-API
MyAirplaneFork-Server

last-airplane
build/
.gradle/

launcher-*.jar
mcdevimports.json
*.jar
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion Airplane
Submodule Airplane deleted from 4144b2
59 changes: 19 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ Fork this repository to your own repo, then clone it locally. Once you've cloned
```bash
cd MyAirplaneFork
./gradlew applyPatches
# or on windows (STRONGLY DISCOURAGED - see below)
gradlew.bat applyPatches
# or on windows
gradlew applyPatches
```

This will set up the entire project, as once it's done everything will be ready to go!

### Windows
Using Windows? Click [here](#step-by-step-guide-for-windows-using-wsl) to view the Windows Guide.
Using Windows? Click [here](#step-by-step-guide-for-windows-using-wsl) to view the Windows Guide to install WSL (not required).

## Working on the fork

Expand All @@ -42,28 +42,23 @@ So if you want to create a new patch, just add a commit to either the API or Ser
```bash
./gradlew rebuildPatches
# or on windows
gradlew.bat rebuildPatches
gradlew rebuildPatches
```

This command takes your commits, and turns them back into the actual patch files that you push.
You should make sure that your fork never has the API and Server folders pushed, and just the `patches/api` and `patches/server` pushed.

## How do I update the upstream?

This step is fairly easy, assuming there's no merge errors. To update the upstream (Airplane), all you have to do is run:

```bash
./gradlew updateUpstream
# or on windows
gradlew.bat updateUpstream
This step is fairly easy, assuming there's no merge errors. To update the upstream (Airplane), all you have to do is change the `AirplaneCommit` in `gradle.properties`
```

Then to rebuild the API & Server folders with your patches, just reapply them:

```bash
./gradlew applyPatches
# or on windows
gradlew.bat applyPatches
gradlew applyPatches
```

You may at times run into an merge conflict when applying patches, this happens when 2 patches modify similar areas of code, and the system can't figure out how to make them work together.
Expand All @@ -81,7 +76,7 @@ Once all your patches apply successfully, all you have to do is make sure you're
```bash
./gradlew rebuildPatches
# or on windows
gradlew.bat rebuildPatches
gradlew rebuildPatches
```

Finally, you have two options for making the commit:
Expand All @@ -91,16 +86,6 @@ git add --all
git commit -m 'Description of my changes'
```

Or if you want a fancy commit message that lists the upstream changes, you can just run

```bash
git add --all

./gradlew upstreamCommit
# or on windows
gradlew.bat upstreamCommit
```

With that, you've successfully updated your fork!

## Building the fork
Expand All @@ -110,20 +95,20 @@ If you're just building the fork to test, you can run:
```bash
./gradlew build
# or on windows
gradlew.bat build
gradlew build
```

Which will output your final JAR at `MyAirplaneFork-Server/build/libs/myairplanefork-server-1.16.5-R0.1-SNAPSHOT.jar`.
Which will output your final JAR at `MyAirplaneFork-Server/build/libs/MyAirplaneFork-Server-reobf.jar`.
However, you should not distribute this JAR outside testing because it contains Mojang's copyrighted Minecraft code.
Instead, you can use the following command to generate a JAR that downloads Mojang's server when it's ran, and applies your changes on top:

```bash
./gradlew paperclip
./gradlew paperclipJar
# or on windows
gradle.bat paperclip
gradlew paperclipJar
```

This will output your distributable JAR at `launcher-myairplanefork.jar`, right in your main directory!
This will output your distributable JAR at `myairplanefork-paperclip.jar`, right in your main directory!

# Step-by-Step Guide for Windows using WSL
This is a step-by-step guide on how to fork Airplane on Windows with WSL. You should still read the above information to get to grips with how to patch the plugin, however.
Expand All @@ -149,6 +134,7 @@ $ apt install -y curl git default-jdk
### Configure Git
If you use GitHub/GitLab you should make your user.email the primary email of that account.
```bash
$ git config --global core.longpaths true (only if youre using windows without wsl)
$ git config --global user.name "YOUR NAME"
$ git config --global user.email [email protected]
```
Expand All @@ -172,6 +158,8 @@ This is quite an intensive operation, and can take several minutes (up to 30 in

```bash
$ ./gradlew applyPatches
# or on windows
gradlew applyPatches
```

## 4. Done!
Expand All @@ -187,23 +175,14 @@ IntelliJ IDEA 2021.1 added support natively for WSL projects - without this vers

If you need help with any of this or run into issues, feel free to ask questions in the Airplane Discord located here: https://discord.gg/3gtc45q


## Additional Info

### Using an IDE

I personally recommend IntelliJ as my IDE of choice, but there's one thing you have to make sure not to do.
Our build system is [Toothpick](https://github.com/jpenilla/Toothpick), put together by the amazing [Purpur](https://github.com/pl3xgaming/Purpur) team.
Unlike other forks, this system uses Gradle instead of Maven.
Inside the Server folder however, you will still find a `pom.xml` that IntelliJ may try to import. If it does, make sure to unlink the Maven project and doublecheck that the Gradle project is imported

### Changing Branding

This won't be a comprehensive guide, but if you need to change branding you should go to these places:

- build.gradle.kts (forkName, groupId, forkUrl, paperclipName)
- settings.gradle.kts (forkName)
- MyAirplaneFork-Server/pom.xml (API dependency)
- build.gradle.kts (archiveFileName.set, apiOutputDir.set, serverOutputDir.set, serverProject.set)
- settings.gradle.kts (rootProject.name , include)
- gradle.properties (group)
- MyAirplaneFork-Server/build.gradle.kts (API dependency)
- PaperVersionFinder.java (change GitHub repo)
- MinecraftServer.java (getServerModName)
- CraftServer.java (serverName)
Expand Down
12 changes: 12 additions & 0 deletions build-data/dev-imports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# You can use this file to import files from vanilla into the project
# both fully qualified and a file based syntax are accepted here:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
#
# You can use this file to import files from minecraft libraries into the project
# format:
# <artifactId> <fileName>
# both fully qualified and a file based syntax are accepted for <fileName>:
# authlib com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java
# datafixerupper com.mojang.datafixers.DataFixerBuilder
# datafixerupper com/mojang/datafixers/util/Either.java
95 changes: 62 additions & 33 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,47 +1,76 @@
import io.papermc.paperweight.util.Constants

plugins {
`java-library`
id("xyz.jpenilla.toothpick")
java
id("com.github.johnrengelman.shadow") version "7.0.0" apply false
id("io.papermc.paperweight.patcher") version "1.1.6"
}

toothpick {
forkName = "MyAirplaneFork"
groupId = "com.mygroupid"
val versionTag = System.getenv("BUILD_NUMBER")
?: "\"${commitHash() ?: error("Could not obtain git hash")}\""
forkVersion = "git-$forkName-$versionTag"
forkUrl = "https://github.com/MyName/MyAirplaneFork"

minecraftVersion = "1.16.5"
nmsPackage = "1_16_R3"
nmsRevision = "R0.1-SNAPSHOT"

upstream = "Airplane"
upstreamBranch = "origin/master"

paperclipName = "launcher-myairplanefork"

server {
project = project(":$forkNameLowercase-server")
patchesDir = file("patches/server")
repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/") {
content { onlyForConfigurations(Constants.PAPERCLIP_CONFIG) }
}
api {
project = project(":$forkNameLowercase-api")
patchesDir = file("patches/api")
maven("https://maven.quiltmc.org/repository/release/") {
content { onlyForConfigurations(Constants.REMAPPER_CONFIG) }
}
}

subprojects {
dependencies {
remapper("org.quiltmc:tiny-remapper:0.4.1")
paperclip("io.papermc:paperclip:2.0.1")
}

allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")

java { toolchain { languageVersion.set(JavaLanguageVersion.of(16)) } }

tasks.withType<JavaCompile> { options.isFork = true; options.isIncremental = true; options.encoding = Charsets.UTF_8.name(); options.release.set(16) }

tasks.withType<Javadoc> { options.encoding = Charsets.UTF_8.name() }

tasks.withType<ProcessResources> { filteringCharset = Charsets.UTF_8.name() }

repositories {
mavenCentral()
maven("https://repo.aikar.co/content/groups/aikar/")
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/")
maven("https://libraries.minecraft.net")
maven("https://libraries.minecraft.net/")
maven("https://repo.codemc.io/repository/maven-public/")
maven("https://oss.sonatype.org/content/groups/public/")
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
maven("https://repo.aikar.co/content/groups/aikar")
maven("https://repo.md-5.net/content/repositories/releases/")
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
maven("https://jitpack.io")
mavenLocal()
}
configure<PublishingExtension> {
repositories.maven {
name = "maven"
url = uri("https://my_mvn_repo.org/repository/maven-snapshots/")
credentials(PasswordCredentials::class)
}
}
}

paperweight {
serverProject.set(project(":MyAirplaneFork-Server"))

java {
sourceCompatibility = JavaVersion.toVersion(8)
targetCompatibility = JavaVersion.toVersion(8)
useStandardUpstream("Airplane") {
url.set(github("TECHNOVE", "Airplane"))
ref.set(providers.gradleProperty("AirplaneCommit"))

withStandardPatcher {
baseName("Airplane")

apiOutputDir.set(layout.projectDirectory.dir("MyAirplaneFork-API"))
serverOutputDir.set(layout.projectDirectory.dir("MyAirplaneFork-Server"))
}
}
}

tasks.paperclipJar {
destinationDirectory.set(rootProject.layout.projectDirectory)
archiveFileName.set("myairplanefork-paperclip.jar")
}
12 changes: 11 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
group = com.myairplanefork
version = 1.17-R0.1-SNAPSHOT

AirplaneCommit = 61758c077303194cb59aea19b111eb48d25d8a11

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2G
org.gradle.jvmargs=-Xms1G -Xmx4G
org.gradle.parallel=true
kotlin.parallel.tasks.in.project=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.vfs.watch=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Empty file removed patches/api/.gitkeep
Empty file.
Empty file removed patches/server/.gitkeep
Empty file.
Loading