Skip to content

Commit 6c5925f

Browse files
Add paper source
Seems to work. Still broken: publishing (maven, modrinth), github actions, just lots of commented out stuff in the build files.
1 parent cd639ac commit 6c5925f

File tree

8 files changed

+175
-2
lines changed

8 files changed

+175
-2
lines changed

fabric/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ dependencies {
7676

7777
processResources {
7878
final Map properties = Map<String, String>.of(
79-
"modVersion", project.mod_version,
80-
"supportedMinecraftVersions", project.supported_minecraft_versions
79+
"modVersion", rootProject.mod_version,
80+
"supportedMinecraftVersions", rootProject.supported_minecraft_versions
8181
)
8282

8383
inputs.properties(properties)

paper/build.gradle

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
plugins {
2+
id 'com.gradleup.shadow' version '9.0.0-beta4'
3+
id 'io.papermc.paperweight.userdev' version '2.0.0-beta.8'
4+
id 'xyz.jpenilla.run-paper' version '2.3.1'
5+
id 'maven-publish'
6+
}
7+
8+
version = "${rootProject.mod_version}"
9+
10+
repositories {
11+
mavenCentral()
12+
maven {
13+
name = 'papermc'
14+
url = 'https://repo.papermc.io/repository/maven-public/'
15+
}
16+
}
17+
18+
configurations {
19+
common {
20+
canBeResolved = true
21+
canBeConsumed = false
22+
}
23+
api.extendsFrom common
24+
}
25+
26+
dependencies {
27+
// Paper
28+
compileOnly "io.papermc.paper:paper-api:${project.paper_version}"
29+
30+
// Userdev
31+
paperweight.paperDevBundle(project.paper_version)
32+
33+
// Common
34+
common project(path: ":common", configuration: "shadow")
35+
}
36+
37+
processResources {
38+
final Map properties = Map<String, String>.of(
39+
"modVersion", rootProject.mod_version,
40+
)
41+
42+
inputs.properties(properties)
43+
44+
filesMatching("plugin.yml") {
45+
expand(properties)
46+
}
47+
}
48+
49+
tasks.assemble {
50+
dependsOn(tasks.reobfJar)
51+
}
52+
53+
tasks.runServer {
54+
minecraftVersion("1.21.4")
55+
jvmArgs "-DmeshEnableExamples=true"
56+
}
57+
58+
//processResources {
59+
// final Map properties = Map<String, String>.of(
60+
// "modVersion", project.mod_version,
61+
// "supportedMinecraftVersions", project.supported_minecraft_versions
62+
// )
63+
//
64+
// inputs.properties(properties)
65+
//
66+
// filesMatching("fabric.mod.json") {
67+
// expand(properties)
68+
// }
69+
//
70+
// exclude ".cache/**"
71+
//}
72+
73+
//modrinth {
74+
// token = System.getenv("MODRINTH_TOKEN")
75+
// projectId = "mesh-lib"
76+
// def customVersionName = System.getenv("VERSION_NAME")
77+
// if (customVersionName != null) versionName = customVersionName
78+
// versionNumber = "${project.version}"
79+
// versionType = "alpha"
80+
// def isPreRelease = System.getenv("VERSION_IS_PRERELEASE")
81+
// versionType = !"false".equals(isPreRelease) ? "beta" : "release"
82+
// uploadFile = remapJar.archiveFile
83+
// //additionalFiles = [sourcesJar.archiveFile, javadocJar.archiveFile]
84+
// additionalFiles = [sourcesJar.archiveFile]
85+
// gameVersions = outlet.mcVersions()
86+
// syncBodyFrom = rootProject.file("README.md").text
87+
// def changelogEnv = System.getenv("VERSION_CHANGELOG")
88+
// if (changelogEnv != null) changelog = changelogEnv
89+
//}
90+
//
91+
//tasks.modrinth.dependsOn(tasks.modrinthSyncBody)
92+
//
93+
//publishing {
94+
// repositories {
95+
// maven {
96+
// name = "OffsetMonkey538"
97+
// url = "https://maven.offsetmonkey538.top/releases"
98+
// credentials {
99+
// username = providers.gradleProperty("OffsetMonkey538Username").getOrElse(System.getenv("MAVEN_USERNAME"))
100+
// password = providers.gradleProperty("OffsetMonkey538Password").getOrElse(System.getenv("MAVEN_PASSWORD"))
101+
// }
102+
// authentication {
103+
// basic(BasicAuthentication)
104+
// }
105+
// }
106+
// }
107+
// publications {
108+
// maven(MavenPublication) {
109+
// artifactId = "mesh-lib"
110+
//
111+
// from(components["java"])
112+
// }
113+
// }
114+
//}

paper/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Netty, only used for netty-codec-http. Hopefully this version won't conflict with other versions of Netty
2+
netty_version = 4.1.82.Final
3+
4+
## no idea where to get this
5+
paper_version = 1.21.4-R0.1-SNAPSHOT
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package top.offsetmonkey538.meshlib;
2+
3+
import io.papermc.paper.network.ChannelInitializeListenerHolder;
4+
import net.kyori.adventure.key.Key;
5+
import org.bukkit.plugin.java.JavaPlugin;
6+
import top.offsetmonkey538.meshlib.example.ExampleMain;
7+
import top.offsetmonkey538.meshlib.impl.ProtocolHandler;
8+
9+
public class MeshLibPlugin extends JavaPlugin {
10+
11+
@Override
12+
public void onEnable() {
13+
ChannelInitializeListenerHolder.addListener(Key.key("meshlib", "meshlib"), channel -> {
14+
channel.pipeline().addFirst(MESHLib.MOD_ID, new ProtocolHandler());
15+
});
16+
17+
new ExampleMain().onInitializeServer();
18+
}
19+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package top.offsetmonkey538.meshlib.example;
2+
3+
import top.offsetmonkey538.meshlib.api.HttpHandlerRegistry;
4+
5+
import static top.offsetmonkey538.meshlib.MESHLib.LOGGER;
6+
7+
/**
8+
* Mod initializer for the example handlers
9+
*/
10+
public class ExampleMain {
11+
12+
/**
13+
* Initializer for example handlers
14+
* <br>
15+
* Checks if {@code meshEnableExamples} is enabled and registers the example handlers if so
16+
*/
17+
public void onInitializeServer() {
18+
// Ignore if "meshEnableExamples" isn't set
19+
if (System.getProperty("meshEnableExamples", "").isEmpty()) return;
20+
21+
22+
LOGGER.warn("MESH examples enabled!");
23+
24+
// Register
25+
HttpHandlerRegistry.INSTANCE.register("simple-server", new SimpleHttpHandler());
26+
}
27+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* This contains examples for how to implement {@link top.offsetmonkey538.meshlib.api.HttpHandler HttpHandler}s
3+
*/
4+
package top.offsetmonkey538.meshlib.example;

paper/src/main/resources/plugin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name: MESH-Lib
2+
main: top.offsetmonkey538.meshlib.MeshLibPlugin
3+
version: ${modVersion}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ rootProject.name = "mesh-lib"
1515
include "common"
1616

1717
include "fabric"
18+
include "paper"

0 commit comments

Comments
 (0)