9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

prepare hard fork environment

This commit is contained in:
NONPLAYT
2025-01-05 16:22:31 +03:00
parent f3abe2a72d
commit 8b3914edc6
11 changed files with 202 additions and 184 deletions

7
.gitattributes vendored Normal file
View File

@@ -0,0 +1,7 @@
* text=auto eol=lf
*.sh text eol=lf
gradlew text eol=lf
*.bat text eol=crlf
*.jar binary

17
.gitignore vendored
View File

@@ -1,13 +1,16 @@
# DivineMC-API and DivineMC-Server changes + paper-api-generator
DivineMC-API
DivineMC-Server
paper-api-generator/*
# IDE and Gradle things # IDE and Gradle things
build build
.gradle .gradle
run run
.idea .idea
# Other files and folders # Server things
build-data /divinemc-server/build.gradle.kts
/divinemc-server/src/minecraft
/paper-server
/purpur-server
/divinemc-api/build.gradle.kts
/paper-api
/paper-api-generator
/purpur-api
*.jar

View File

@@ -8,3 +8,7 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
# To import minecraft data files, like the default chat type, use `mc_data` as the prefix:
# mc_data chat_type/chat.json
# mc_data dimension_type/overworld.json
#

2
build-data/divinemc.at Normal file
View File

@@ -0,0 +1,2 @@
# This file is auto generated, any changes may be overridden!
# See CONTRIBUTING.md on how to add access transformers.

View File

@@ -1,43 +1,65 @@
import io.papermc.paperweight.util.constants.PAPERCLIP_CONFIG import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins { plugins {
java java
`maven-publish` id("io.papermc.paperweight.patcher") version "2.0.0-beta.11"
id("io.papermc.paperweight.patcher") version "1.7.7"
} }
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
repositories { paperweight {
mavenCentral() upstreams.register("purpur") {
maven("https://papermc.io/repo/repository/maven-public/") { repo = github("PurpurMC", "Purpur")
content { ref = providers.gradleProperty("purpurRef")
onlyForConfigurations(PAPERCLIP_CONFIG)
patchFile {
path = "purpur-server/build.gradle.kts"
outputFile = file("divinemc-server/build.gradle.kts")
patchFile = file("divinemc-server/build.gradle.kts.patch")
} }
} patchFile {
} path = "purpur-api/build.gradle.kts"
outputFile = file("divinemc-api/build.gradle.kts")
dependencies { patchFile = file("divinemc-api/build.gradle.kts.patch")
remapper("net.fabricmc:tiny-remapper:0.10.3:fat") }
decompiler("org.vineflower:vineflower:1.10.1") patchRepo("paperApi") {
paperclip("io.papermc:paperclip:3.0.3") upstreamPath = "paper-api"
} patchesDir = file("divinemc-api/paper-patches")
outputDir = file("paper-api")
allprojects { }
apply(plugin = "java") patchRepo("paperApiGenerator") {
apply(plugin = "maven-publish") upstreamPath = "paper-api-generator"
patchesDir = file("divinemc-api-generator/paper-patches")
java { outputDir = file("paper-api-generator")
toolchain { }
languageVersion = JavaLanguageVersion.of(21) patchDir("purpurApi") {
upstreamPath = "purpur-api"
excludes = listOf("build.gradle.kts", "build.gradle.kts.patch", "paper-patches")
patchesDir = file("divinemc-api/purpur-patches")
outputDir = file("purpur-api")
} }
} }
} }
subprojects { subprojects {
apply(plugin = "java-library")
apply(plugin = "maven-publish")
extensions.configure<JavaPluginExtension> {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
dependencies {
"testRuntimeOnly"("org.junit.platform:junit-platform-launcher")
}
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(21) options.release = 21
options.isFork = true
} }
tasks.withType<Javadoc> { tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
@@ -45,64 +67,29 @@ subprojects {
tasks.withType<ProcessResources> { tasks.withType<ProcessResources> {
filteringCharset = Charsets.UTF_8.name() filteringCharset = Charsets.UTF_8.name()
} }
tasks.withType<Test> {
testLogging {
showStackTraces = true
exceptionFormat = TestExceptionFormat.FULL
events(TestLogEvent.STANDARD_OUT)
}
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
repositories { repositories {
mavenCentral() mavenCentral()
maven(paperMavenPublicUrl) maven(paperMavenPublicUrl)
maven("https://oss.sonatype.org/content/groups/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") maven("https://jitpack.io")
} }
}
paperweight { extensions.configure<PublishingExtension> {
serverProject.set(project(":divinemc-server")) repositories {
maven("https://repo.bx-team.space/snapshots") {
remapRepo.set("https://maven.fabricmc.net/") name = "divinemc"
decompileRepo.set(paperMavenPublicUrl) credentials(PasswordCredentials::class)
useStandardUpstream("purpur") {
url.set(github("PurpurMC", "Purpur"))
ref.set(providers.gradleProperty("purpurRef"))
withStandardPatcher {
apiSourceDirPath.set("Purpur-API")
serverSourceDirPath.set("Purpur-Server")
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
apiOutputDir.set(layout.projectDirectory.dir("DivineMC-API"))
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
serverOutputDir.set(layout.projectDirectory.dir("DivineMC-Server"))
}
patchTasks.register("generatedApi") {
isBareDirectory = true
upstreamDirPath = "paper-api-generator/generated"
patchDir = layout.projectDirectory.dir("patches/generated-api")
outputDir = layout.projectDirectory.dir("paper-api-generator/generated")
}
}
}
tasks.generateDevelopmentBundle {
apiCoordinates = "space.bxteam.divinemc:divinemc-api"
libraryRepositories.set(
listOf(
"https://repo.maven.apache.org/maven2/",
paperMavenPublicUrl
)
)
}
publishing {
if (project.providers.gradleProperty("publishDevBundle").isPresent) {
publications.create<MavenPublication>("devBundle") {
artifact(tasks.generateDevelopmentBundle) {
artifactId = "dev-bundle"
} }
} }
} }

View File

@@ -0,0 +1,11 @@
--- a/purpur-server/build.gradle.kts
+++ b/purpur-server/build.gradle.kts
@@ -146,7 +_,7 @@
// Paper end - configure mockito agent that is needed in newer java versions
dependencies {
- implementation(project(":purpur-api"))
+ implementation(project(":divinemc-api")) // DivineMC
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
// Paper start
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+

View File

@@ -2,8 +2,9 @@ group = space.bxteam.divinemc
mcVersion = 1.21.4 mcVersion = 1.21.4
version = 1.21.4-R0.1-SNAPSHOT version = 1.21.4-R0.1-SNAPSHOT
purpurRef = 4bf1b988c3e2cc1277ed912e0107e2f34ab36a43 purpurRef = e11f9642928cdce00437b6a11cf3fb1881939d9a
org.gradle.configuration-cache=true
org.gradle.caching = true org.gradle.caching = true
org.gradle.parallel = true org.gradle.parallel = true
org.gradle.vfs.watch = false org.gradle.vfs.watch = false

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

3
gradlew vendored
View File

@@ -86,8 +86,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum

188
gradlew.bat vendored
View File

@@ -1,94 +1,94 @@
@rem @rem
@rem Copyright 2015 the original author or authors. @rem Copyright 2015 the original author or authors.
@rem @rem
@rem Licensed under the Apache License, Version 2.0 (the "License"); @rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License. @rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at @rem You may obtain a copy of the License at
@rem @rem
@rem https://www.apache.org/licenses/LICENSE-2.0 @rem https://www.apache.org/licenses/LICENSE-2.0
@rem @rem
@rem Unless required by applicable law or agreed to in writing, software @rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS, @rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0 @rem SPDX-License-Identifier: Apache-2.0
@rem @rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables with windows NT shell @rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused @rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter. @rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2 echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2 echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2 echo location of your Java installation. 1>&2
goto fail goto fail
:findJavaFromJavaHome :findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. 1>&2 echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2 echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2 echo location of your Java installation. 1>&2
goto fail goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL% set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE% exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal
:omega :omega

View File

@@ -2,15 +2,19 @@ import java.util.Locale
pluginManagement { pluginManagement {
repositories { repositories {
mavenLocal()
gradlePluginPortal() gradlePluginPortal()
maven("https://papermc.io/repo/repository/maven-public/") mavenLocal()
maven("https://repo.papermc.io/repository/maven-public/")
} }
} }
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
}
rootProject.name = "DivineMC" rootProject.name = "DivineMC"
for (name in listOf("DivineMC-API", "DivineMC-Server", "paper-api-generator")) { for (name in listOf("divinemc-api", "divinemc-server", "divinemc-api-generator")) {
val projName = name.lowercase(Locale.ENGLISH) val projName = name.lowercase(Locale.ENGLISH)
include(projName) include(projName)
findProject(":$projName")!!.projectDir = file(name) findProject(":$projName")!!.projectDir = file(name)