Skip to content

Commit 55c4a2a

Browse files
committed
Initial commit
0 parents  commit 55c4a2a

File tree

13 files changed

+3444
-0
lines changed

13 files changed

+3444
-0
lines changed

.github/workflows/gradle.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Java CI with Gradle
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v1
16+
- name: Set up JDK 1.8
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: 1.8
20+
- name: Build with Gradle
21+
run: chmod +x gradlew && ./gradlew buildFinalJar
22+
- name: Upload VeloxServer artifact
23+
uses: actions/upload-artifact@v2
24+
with:
25+
name: VeloxServer-
26+
path: build/libs/*.jar

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.gradle
2+
build/
3+
4+
# contains minecraft source code
5+
src/main/java/
6+
7+
#Run files
8+
runclient
9+
10+
# Ignore Gradle GUI config
11+
gradle-app.setting
12+
13+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
14+
!gradle-wrapper.jar
15+
16+
#IDE files
17+
.idea
18+
*.iml
19+
run/
20+
21+
out/

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
![Velox Server](https://github.com/mikex86/jarvis/blob/master/images/velox_logo.svg)
2+
3+
# Velox Minecraft Server
4+
![Java CI with Gradle](https://github.com/mikex86/VeloxServer/workflows/Java%20CI%20with%20Gradle/badge.svg)
5+
## About
6+
7+
Velox primary goal is to improve performance of the Vanilla server.
8+
Minor behaviour changes are not specifically aimed to be avoided.
9+
Compatibility with the Bukkit API is intentionally dropped to avoid running
10+
into limitations introduced by an API that was designed around the singled threaded architecture
11+
of Minecraft.
12+
13+
Velox may implement its own plugin/modding API in the future, but the primary focus right now
14+
is to maximize server performance.
15+
16+
The project is in early development phase, but feel free to test the potentially unstable
17+
builds.
18+
19+
20+
## Multithreading
21+
Velox implements region based entity ticking. This means chunks that do not have
22+
a loaded trail of chunks between them, will be ticked concurrently.
23+
This is not a full async tick, heavily performance demanding regions may still impact
24+
server performance for other players.
25+
26+
### Is this safe?
27+
Yesn't...<br>
28+
The region model makes the assumption, that entities in different regions do not interact with one
29+
another. In vanilla minecraft this should never happen. If you are aware of any edge case
30+
where this might occur, please do not hesitate to create an issue.
31+
32+
## Why drop support for the Bukkit API?
33+
34+
As the Bukkit API was not created with this kind of ticking model in mind,
35+
it is likely that plugins might perform unsafe interactions, leaving no other option but to "hope for the best".
36+
Perhaps an even greater problem would be the thread safety measures for the plugin themselves.
37+
Events like PlayerMoveEvent, which are invoked many times per second, might cause the server
38+
to synchronize for long enough to eliminate the gains of concurrency.
39+
40+
41+
## How to build
42+
Clone the repository and execute the command
43+
44+
```./gradlew buildFinalJar```
45+
46+
The resulting jar file will be placed under build/libs

build.gradle

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
maven { url = 'http://files.minecraftforge.net/maven' }
5+
jcenter()
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath 'net.minecraftforge.gradle:ForgeGradle:3.0.+'
10+
}
11+
}
12+
13+
apply plugin: 'eclipse'
14+
apply plugin: 'net.minecraftforge.gradle.forgedev.patcher'
15+
16+
configurations {
17+
shade
18+
compile.extendsFrom shade
19+
}
20+
21+
group = 'me.mikex86'
22+
version = '1.0.0-alpha'
23+
24+
ext {
25+
minecraft_version = '1.16.5'
26+
mcp_version = '20210115.111550'
27+
mappings_channel = 'snapshot'
28+
mappings_version = '20201028-1.16.3'
29+
}
30+
31+
repositories {
32+
mavenCentral()
33+
}
34+
35+
dependencies {
36+
shade 'net.minecraftforge:forgespi:3.0.+'
37+
}
38+
39+
project(':mcp') {
40+
apply plugin: 'net.minecraftforge.gradle.forgedev.mcp'
41+
mcp {
42+
config = minecraft_version + '-' + mcp_version
43+
pipeline = 'joined'
44+
}
45+
}
46+
47+
evaluationDependsOn(':mcp')
48+
49+
patcher {
50+
parent = project(':mcp')
51+
patchedSrc = file('src/main/java')
52+
mappings channel: mappings_channel, version: mappings_version
53+
mcVersion = minecraft_version
54+
}
55+
56+
jar {
57+
manifest {
58+
attributes(
59+
'Main-Class': 'net.minecraft.server.Main',
60+
'Multi-Release': 'true'
61+
)
62+
}
63+
from { configurations.runtimeClasspath.collect { file -> file.isDirectory() ? file : zipTree(file) } } {
64+
exclude 'META-INF/MOJANG*'
65+
exclude '*.dll*', '*.so*', '*.dylib*', '*.csv', '*.jnilib'
66+
exclude '**/Log4j2Plugins.dat'
67+
exclude 'org/lwjgl/**'
68+
exclude 'assets/**'
69+
// Exclude all log4j configuration from libraries, the log4j configuration in resource will remain
70+
exclude 'log4j2.xml'
71+
}
72+
}
73+
74+
task runclient(type: JavaExec) {
75+
group = "MCP"
76+
description = "Runs the client"
77+
classpath sourceSets.main.runtimeClasspath
78+
if (System.getProperty("os.name").toLowerCase().contains("mac")) {
79+
jvmArgs '-XstartOnFirstThread'
80+
}
81+
args '--gameDir', '.'
82+
args '--version', minecraft_version
83+
args '--assetsDir', downloadAssets.output
84+
args '--assetIndex', "1.16"
85+
args '--accessToken', '0'
86+
main 'net.minecraft.client.main.Main'
87+
workingDir 'run'
88+
}
89+
90+
task createDiffs() {
91+
doFirst {
92+
mkdir 'diffs'
93+
def process = Runtime.getRuntime().exec("git diff --no-index build/mcp_diff_src/ src/main/java/ --output diffs/velox_source.diff")
94+
process.waitFor()
95+
}
96+
}
97+
98+
task applyDiffs() {
99+
doFirst {
100+
copy {
101+
from 'build/mcp_diff_src'
102+
into 'build/mcp_diff_clean_src'
103+
}
104+
def diffs = file("diffs").listFiles()
105+
diffs.each { diff ->
106+
def process = Runtime.getRuntime().exec("git apply \"${diff.path}\"")
107+
process.waitFor()
108+
}
109+
delete 'build/mcp_diff_src'
110+
copy {
111+
from 'build/mcp_diff_clean_src'
112+
into 'build/mcp_diff_src'
113+
}
114+
delete 'build/mcp_diff_clean_src'
115+
}
116+
}
117+
118+
119+
task setup() {
120+
group = "MCP"
121+
description = "Setups the dev workspace"
122+
dependsOn ':extractMapped'
123+
doLast {
124+
mkdir 'run/assets'
125+
copy {
126+
from downloadAssets.output.path
127+
into 'run/assets'
128+
}
129+
mkdir 'build/mcp_diff_src'
130+
copy {
131+
from 'src/main/java'
132+
into 'build/mcp_diff_src'
133+
}
134+
}
135+
}
136+
137+
task copyAssets {
138+
group = "MCP"
139+
description = "Download and place the assets into the run folder"
140+
dependsOn ':downloadAssets'
141+
mkdir 'run/assets'
142+
copy {
143+
from downloadAssets.output.path
144+
into 'run/assets'
145+
}
146+
}
147+
148+
task buildFinalJar {
149+
dependsOn ordered(':setup', ':applyDiffs', ':build')
150+
}
151+
152+
def ordered(String... dependencyPaths) {
153+
def dependencies = dependencyPaths.collect { tasks.getByPath(it) }
154+
for (int i = 0; i < dependencies.size() - 1; i++) {
155+
dependencies[i + 1].mustRunAfter(dependencies[i])
156+
}
157+
return dependencies
158+
}

0 commit comments

Comments
 (0)