Compare commits
42 Commits
old/1.21.1
...
old/1.21.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd642eb8d6 | ||
|
|
22bcf63585 | ||
|
|
86b9aa41cc | ||
|
|
e55f818ab2 | ||
|
|
e54f3fcf11 | ||
|
|
3f15d7a684 | ||
|
|
851cab54e0 | ||
|
|
f63645c2fb | ||
|
|
8062ccb4ed | ||
|
|
c0d36db38d | ||
|
|
62f90e3fba | ||
|
|
2986abeee1 | ||
|
|
fc38239b61 | ||
|
|
cfe2db6181 | ||
|
|
8975d5676b | ||
|
|
3e1399c421 | ||
|
|
d110f25a23 | ||
|
|
7543f3adbd | ||
|
|
6a16940e2b | ||
|
|
5596d998c1 | ||
|
|
75fad4cd35 | ||
|
|
f476809251 | ||
|
|
269cbb507b | ||
|
|
54dfd7163a | ||
|
|
d975acec6b | ||
|
|
72565bec8e | ||
|
|
05215498c3 | ||
|
|
ae94d43098 | ||
|
|
8889a877d6 | ||
|
|
e915eadfad | ||
|
|
28ce30ec48 | ||
|
|
dd8042f88a | ||
|
|
54bc879a9e | ||
|
|
33701c1eca | ||
|
|
2028e19bf8 | ||
|
|
7a7a88a7bb | ||
|
|
8860cedaf7 | ||
|
|
527b6c7eaf | ||
|
|
e37f05bd87 | ||
|
|
dfb64f50db | ||
|
|
69d4f4bf86 | ||
|
|
64802e7e50 |
@@ -9,7 +9,7 @@ ij_any_block_comment_at_first_column = false
|
|||||||
ij_any_line_comment_at_first_column = false
|
ij_any_line_comment_at_first_column = false
|
||||||
ij_any_line_comment_add_space = true
|
ij_any_line_comment_add_space = true
|
||||||
max_line_length = 120
|
max_line_length = 120
|
||||||
ij_visual_guides = 80
|
ij_visual_guides = 16, 80
|
||||||
|
|
||||||
[*.tiny]
|
[*.tiny]
|
||||||
indent_style=tab
|
indent_style=tab
|
||||||
@@ -19,6 +19,7 @@ end_of_line=crlf
|
|||||||
|
|
||||||
[*.yml]
|
[*.yml]
|
||||||
indent_size=2
|
indent_size=2
|
||||||
|
ij_visual_guides = 8, 80
|
||||||
|
|
||||||
[*.patch]
|
[*.patch]
|
||||||
trim_trailing_whitespace=false
|
trim_trailing_whitespace=false
|
||||||
|
|||||||
6
.github/workflows/gradle.yml
vendored
6
.github/workflows/gradle.yml
vendored
@@ -23,13 +23,13 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout action
|
- name: Checkout action
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Validate Gradle Wrapper
|
- name: Validate Gradle Wrapper
|
||||||
uses: gradle/wrapper-validation-action@v1
|
uses: gradle/actions/wrapper-validation@v4
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }}
|
- name: Set up JDK ${{ matrix.java }} ${{ matrix.jdk }}
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.java }}
|
distribution: ${{ matrix.java }}
|
||||||
java-version: ${{ matrix.jdk }}
|
java-version: ${{ matrix.jdk }}
|
||||||
|
|||||||
12
.github/workflows/release.yaml
vendored
Normal file
12
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
name: Release Plazma
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "ver/*", "dev/*", "feat/**/*" ]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Release Plazma (${{ github.ref_name }})
|
||||||
|
uses: PlazmaMC/PlazmaBukkit/.github/workflows/global.yaml@main
|
||||||
|
secrets: inherit
|
||||||
146
.github/workflows/release.yml
vendored
146
.github/workflows/release.yml
vendored
@@ -1,146 +0,0 @@
|
|||||||
name: Release Plazma (1.21.3)
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "ver/*", "dev/*", "feat/**/*" ]
|
|
||||||
paths:
|
|
||||||
- "patches/server/**.patch"
|
|
||||||
- "patches/api/**.patch"
|
|
||||||
- "gradle.properties"
|
|
||||||
- "release.yml"
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
ORG_NAME: PlazmaMC
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
name: Release Plazma
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
base_jdk: [21]
|
|
||||||
os: [ubuntu-22.04]
|
|
||||||
|
|
||||||
if: "!startsWith(github.event.commits[0].message, '[CI-Skip]')"
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- name: Setup Variables
|
|
||||||
id: setup
|
|
||||||
env:
|
|
||||||
BRANCH: ${{ github.ref_name }}
|
|
||||||
run: echo "VERSION=${BRANCH##*/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Checkout javadocs
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
continue-on-error: true
|
|
||||||
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
|
|
||||||
with:
|
|
||||||
repository: PlazmaMC/Javadocs
|
|
||||||
ref: ${{ env.VERSION }}
|
|
||||||
token: ${{ secrets.GH_PAT }}
|
|
||||||
path: javadoc
|
|
||||||
|
|
||||||
- name: Checkout javadocs
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
|
|
||||||
with:
|
|
||||||
repository: PlazmaMC/Javadocs
|
|
||||||
token: ${{ secrets.GH_PAT }}
|
|
||||||
path: jdmain
|
|
||||||
|
|
||||||
- name: Validate Gradle Wrapper
|
|
||||||
uses: gradle/wrapper-validation-action@v1
|
|
||||||
|
|
||||||
- name: Set up GraalVM ${{ matrix.base_jdk }}
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
java-version: ${{ matrix.base_jdk }}
|
|
||||||
version: latest
|
|
||||||
cache: 'gradle'
|
|
||||||
|
|
||||||
- name: Configure Git
|
|
||||||
run: git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"
|
|
||||||
|
|
||||||
- name: Get Release Number
|
|
||||||
if: startsWith(github.ref_name, 'ver/')
|
|
||||||
run: echo "BUILD_NUMBER=$(git ls-remote --tags origin | grep "build/${{ env.VERSION }}" | wc -l)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Apply Patches
|
|
||||||
run: ./gradlew applyPatches --stacktrace
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: ./gradlew build --stacktrace
|
|
||||||
|
|
||||||
- name: Create Reobf Jar
|
|
||||||
run: ./gradlew createReobfPaperclipJar --stacktrace
|
|
||||||
|
|
||||||
- name: Create Mojmap Jar
|
|
||||||
run: ./gradlew createMojmapPaperclipJar --stacktrace
|
|
||||||
|
|
||||||
- name: Update Javadoc
|
|
||||||
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
|
|
||||||
continue-on-error: true
|
|
||||||
run: |
|
|
||||||
if [ ! -d "javadoc" ]; then
|
|
||||||
SUBMODULE_ADD=true
|
|
||||||
mkdir javadoc && cd javadoc
|
|
||||||
git init && git branch -m ${{ env.VERSION }}
|
|
||||||
git remote add origin https://github.com/PlazmaMC/Javadocs
|
|
||||||
fi
|
|
||||||
|
|
||||||
cp -rf Plazma-API/build/docs/javadoc/* javadoc/
|
|
||||||
cd javadoc
|
|
||||||
git add . && git commit -m "Update Javadocs"
|
|
||||||
git push -f origin ${{ env.VERSION }}
|
|
||||||
|
|
||||||
cd ../jdmain
|
|
||||||
if [ $SUBMODULE_ADD = true ]; then
|
|
||||||
git submodule add -b ${{ env.VERSION }} https://github.com/PlazmaMC/Javadocs ${{ env.VERSION }}
|
|
||||||
fi
|
|
||||||
git submodule update
|
|
||||||
git add . && git commit -m "Update Javadocs"
|
|
||||||
git push
|
|
||||||
|
|
||||||
- name: Publish Packages
|
|
||||||
if: startsWith(github.ref_name, 'ver/') || startsWith(github.ref_name, 'dev/')
|
|
||||||
run: |
|
|
||||||
export GITHUB_USERNAME=${{ env.ORG_NAME }}
|
|
||||||
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
|
||||||
./gradlew publish --stacktrace
|
|
||||||
|
|
||||||
- name: Release Artifacts
|
|
||||||
if: startsWith(github.ref_name, 'ver/')
|
|
||||||
uses: softprops/action-gh-release@v0.1.15
|
|
||||||
with:
|
|
||||||
name: "Build #${{ env.BUILD_NUMBER }} for ${{ env.VERSION }}"
|
|
||||||
tag_name: "build/${{ env.VERSION }}/${{ env.BUILD_NUMBER }}"
|
|
||||||
target_commitish: ${{ github.ref_name }}
|
|
||||||
generate_release_notes: true
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
files: build/libs/*.jar
|
|
||||||
|
|
||||||
- name: Release Artifacts (Latest/Stable)
|
|
||||||
if: startsWith(github.ref_name, 'ver/')
|
|
||||||
uses: softprops/action-gh-release@v0.1.15
|
|
||||||
with:
|
|
||||||
name: "Build #${{ env.BUILD_NUMBER }} for ${{ env.VERSION }}"
|
|
||||||
tag_name: "build/${{ github.ref_name }}/latest"
|
|
||||||
target_commitish: ${{ github.ref_name }}
|
|
||||||
generate_release_notes: true
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
files: build/libs/*.jar
|
|
||||||
|
|
||||||
- name: Release Artifacts (Latest/Development)
|
|
||||||
if: startsWith(github.ref_name, 'dev/')
|
|
||||||
uses: softprops/action-gh-release@v0.1.15
|
|
||||||
with:
|
|
||||||
name: "Development Build for ${{ env.VERSION }}"
|
|
||||||
tag_name: build/${{ env.VERSION }}/latest
|
|
||||||
target_commitish: ${{ github.ref_name }}
|
|
||||||
generate_release_notes: true
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
files: build/libs/*.jar
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -18,6 +18,9 @@ out/
|
|||||||
nbproject/
|
nbproject/
|
||||||
nbactions.xml
|
nbactions.xml
|
||||||
|
|
||||||
|
# vscode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
# Gradle
|
# Gradle
|
||||||
!gradle-wrapper.jar
|
!gradle-wrapper.jar
|
||||||
.gradle/
|
.gradle/
|
||||||
@@ -58,3 +61,4 @@ paper-api-generator
|
|||||||
compare.txt
|
compare.txt
|
||||||
*.patch
|
*.patch
|
||||||
!patches/**/*
|
!patches/**/*
|
||||||
|
upstream
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
[](https://plazmamc.org/discord)
|
[](https://plazmamc.org/discord)
|
||||||
[](LICENSE.md)
|
[](LICENSE.md)
|
||||||
[](https://plazmamc.org/downloads)
|
[](https://plazmamc.org/downloads)
|
||||||
|
|
||||||
[](https://plazmamc.org/downloads)
|
[](https://plazmamc.org/downloads)
|
||||||
[](https://github.com/PlazmaMC/Plazma/stargazers)
|
[](https://github.com/PlazmaMC/Plazma/stargazers)
|
||||||
[](https://github.com/PlazmaMC/Plazma/forks)
|
[](https://github.com/PlazmaMC/Plazma/forks)
|
||||||
[](https://github.com/PlazmaMC/Plazma/watchers)
|
[](https://github.com/PlazmaMC/Plazma/watchers)
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
[main]: https://github.com/PlazmaMC/Plazma
|
[main]: https://github.com/PlazmaMC/PlazmaBukkit/blob/main/README.md
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
This is the branch for Plazma 1.21.2/3. If you want to know more about Plazma, please check the **[main branch][main]**.<br>
|
This is the branch for Plazma 1.21.2/3. If you want to know more about Plazma, please check the **[main branch][main]**.<br>
|
||||||
|
|||||||
169
build.gradle.kts
169
build.gradle.kts
@@ -3,32 +3,88 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`maven-publish`
|
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
|
`maven-publish`
|
||||||
`always-up-to-date`
|
`always-up-to-date`
|
||||||
alias(libs.plugins.shadow) apply false
|
alias(libs.plugins.shadow) apply false
|
||||||
alias(libs.plugins.paperweight)
|
alias(libs.plugins.paperweight)
|
||||||
}
|
}
|
||||||
|
|
||||||
val jdkVersion = property("jdkVersion").toString().toInt()
|
val jdkVersion = property("jdkVersion").toString().toInt()
|
||||||
val providerRepo = property("providerRepo").toString()
|
|
||||||
val brandName = property("brandName").toString()
|
|
||||||
|
|
||||||
kotlin.jvmToolchain(jdkVersion)
|
kotlin.jvmToolchain(jdkVersion)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://repo.papermc.io/repository/maven-public/") {
|
maven("https://repo.papermc.io/repository/maven-public/") { name = "papermc"
|
||||||
content { onlyForConfigurations(configurations.paperclip.name) }
|
content { onlyForConfigurations(configurations.paperclip.name) }
|
||||||
}
|
}
|
||||||
|
maven("https://repo.codemc.io/repository/maven-public/") { name = "codemc" }
|
||||||
|
maven("https://jitpack.io") { name = "jitpack" }
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
remapper(libs.remapper)
|
remapper(libs.remapper)
|
||||||
decompiler(libs.decompiler)
|
|
||||||
paperclip(libs.paperclip)
|
paperclip(libs.paperclip)
|
||||||
|
decompiler(libs.decompiler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val brandName: String by project
|
||||||
|
val providerRepo: String by project
|
||||||
|
paperweight {
|
||||||
|
serverProject = project(":${brandName.lowercase()}-server")
|
||||||
|
|
||||||
|
remapRepo = "https://repo.papermc.io/repository/maven-public/"
|
||||||
|
decompileRepo = "https://repo.papermc.io/repository/maven-public/"
|
||||||
|
|
||||||
|
useStandardUpstream("paper") {
|
||||||
|
url = github("PaperMC", "Paper-archive")
|
||||||
|
ref = providers.gradleProperty("paperCommit")
|
||||||
|
|
||||||
|
withStandardPatcher {
|
||||||
|
baseName("Paper")
|
||||||
|
|
||||||
|
apiPatchDir.set(projectDir.resolve("patches/api"))
|
||||||
|
apiOutputDir.set(projectDir.resolve("$brandName-API"))
|
||||||
|
|
||||||
|
serverPatchDir.set(projectDir.resolve("patches/server"))
|
||||||
|
serverOutputDir.set(projectDir.resolve("$brandName-Server"))
|
||||||
|
}
|
||||||
|
|
||||||
|
patchTasks.register("generatedApi") {
|
||||||
|
isBareDirectory = true
|
||||||
|
upstreamDirPath = "paper-api-generator/generated"
|
||||||
|
patchDir = projectDir.resolve("patches/generated-api")
|
||||||
|
outputDir = projectDir.resolve("paper-api-generator/generated")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks {
|
||||||
|
applyPatches {
|
||||||
|
dependsOn("applyGeneratedApiPatches")
|
||||||
|
}
|
||||||
|
|
||||||
|
rebuildPatches {
|
||||||
|
dependsOn("rebuildGeneratedApiPatches")
|
||||||
|
}
|
||||||
|
|
||||||
|
generateDevelopmentBundle {
|
||||||
|
apiCoordinates.set("${project.group}:${brandName.lowercase()}-api")
|
||||||
|
libraryRepositories.addAll(
|
||||||
|
"https://repo1.maven.org/maven2/",
|
||||||
|
"https://papermc.io/repo/repository/maven-public/",
|
||||||
|
"https://repo.codemc.io/repository/maven-public/",
|
||||||
|
"https://jitpack.io",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing.publications.create<MavenPublication>("devBundle") {
|
||||||
|
artifact(tasks.generateDevelopmentBundle) { artifactId = "dev-bundle" }
|
||||||
|
}
|
||||||
|
|
||||||
|
val mavenUsername: String? by project
|
||||||
|
val mavenPassword: String? by project
|
||||||
allprojects {
|
allprojects {
|
||||||
apply(plugin = "java")
|
apply(plugin = "java")
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
@@ -36,25 +92,36 @@ allprojects {
|
|||||||
java.toolchain.languageVersion.set(JavaLanguageVersion.of(jdkVersion))
|
java.toolchain.languageVersion.set(JavaLanguageVersion.of(jdkVersion))
|
||||||
|
|
||||||
publishing.repositories.maven("https://maven.pkg.github.com/$providerRepo") {
|
publishing.repositories.maven("https://maven.pkg.github.com/$providerRepo") {
|
||||||
name = "githubPackage"
|
name = "github"
|
||||||
url = uri("https://maven.pkg.github.com/$providerRepo")
|
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = System.getenv("GITHUB_USERNAME")
|
username = mavenUsername ?: System.getenv("GRADLE_PROPERTY_MAVEN_USERNAME") ?: System.getenv("MAVEN_USERNAME")
|
||||||
password = System.getenv("GITHUB_TOKEN")
|
password = mavenPassword ?: System.getenv("GRADLE_PROPERTY_MAVEN_PASSWORD") ?: System.getenv("MAVEN_PASSWORD")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing.repositories.maven("https://repo.codemc.io/repository/maven-snapshots/") {
|
||||||
|
name = "codemc"
|
||||||
|
|
||||||
|
credentials {
|
||||||
|
username = mavenUsername ?: System.getenv("GRADLE_PROPERTY_MAVEN_USERNAME") ?: System.getenv("MAVEN_USERNAME")
|
||||||
|
password = mavenPassword ?: System.getenv("GRADLE_PROPERTY_MAVEN_PASSWORD") ?: System.getenv("MAVEN_PASSWORD")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
maven("https://repo.papermc.io/repository/maven-public/") { name = "papermc" }
|
||||||
|
maven("https://repo.codemc.io/repository/maven-public/") { name = "codeme" }
|
||||||
|
maven("https://jitpack.io") { name = "jitpack" }
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
withType<JavaCompile>().configureEach {
|
withType<JavaCompile>().configureEach {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
options.release = jdkVersion
|
options.release = jdkVersion
|
||||||
options.compilerArgs.addAll(listOf(
|
|
||||||
"--add-modules=jdk.incubator.vector",
|
|
||||||
"-Xmaxwarns", "1"
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<Javadoc> {
|
withType<Javadoc> {
|
||||||
@@ -73,36 +140,6 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven("https://jitpack.io")
|
|
||||||
maven("https://papermc.io/repo/repository/maven-public/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
paperweight {
|
|
||||||
serverProject = project(":${brandName.lowercase()}-server")
|
|
||||||
|
|
||||||
remapRepo = "https://repo.papermc.io/repository/maven-public/"
|
|
||||||
decompileRepo = "https://repo.papermc.io/repository/maven-public/"
|
|
||||||
|
|
||||||
usePaperUpstream(providers.gradleProperty("paperCommit")) {
|
|
||||||
withPaperPatcher {
|
|
||||||
apiPatchDir.set(projectDir.resolve("patches/api"))
|
|
||||||
apiOutputDir.set(projectDir.resolve("$brandName-API"))
|
|
||||||
|
|
||||||
serverPatchDir.set(projectDir.resolve("patches/server"))
|
|
||||||
serverOutputDir.set(projectDir.resolve("$brandName-Server"))
|
|
||||||
}
|
|
||||||
|
|
||||||
patchTasks.register("generatedApi") {
|
|
||||||
isBareDirectory = true
|
|
||||||
upstreamDirPath = "paper-api-generator/generated"
|
|
||||||
patchDir = projectDir.resolve("patches/generated-api")
|
|
||||||
outputDir = projectDir.resolve("paper-api-generator/generated")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val paperRepoVal = property("paperRepo").toString()
|
val paperRepoVal = property("paperRepo").toString()
|
||||||
@@ -112,7 +149,6 @@ val purpurBranch = property("purpurBranch").toString()
|
|||||||
val pufferfishRepoVal = property("pufferfishRepo").toString()
|
val pufferfishRepoVal = property("pufferfishRepo").toString()
|
||||||
val pufferfishBranch = property("pufferfishBranch").toString()
|
val pufferfishBranch = property("pufferfishBranch").toString()
|
||||||
val isUsePufferfish = property("usePufferfish").toString().toBoolean()
|
val isUsePufferfish = property("usePufferfish").toString().toBoolean()
|
||||||
|
|
||||||
alwaysUpToDate {
|
alwaysUpToDate {
|
||||||
|
|
||||||
paperRepo.set(paperRepoVal)
|
paperRepo.set(paperRepoVal)
|
||||||
@@ -128,46 +164,3 @@ alwaysUpToDate {
|
|||||||
usePufferfish.set(isUsePufferfish)
|
usePufferfish.set(isUsePufferfish)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
|
||||||
applyPatches {
|
|
||||||
dependsOn("applyGeneratedApiPatches")
|
|
||||||
}
|
|
||||||
|
|
||||||
rebuildPatches {
|
|
||||||
dependsOn("rebuildGeneratedApiPatches")
|
|
||||||
}
|
|
||||||
|
|
||||||
generateDevelopmentBundle {
|
|
||||||
apiCoordinates.set("${project.group}:${brandName.lowercase()}-api")
|
|
||||||
libraryRepositories.addAll(
|
|
||||||
"https://repo.maven.apache.org/maven2/",
|
|
||||||
"https://maven.pkg.github.com/$providerRepo",
|
|
||||||
"https://papermc.io/repo/repository/maven-public/"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
clean {
|
|
||||||
doLast {
|
|
||||||
listOf(
|
|
||||||
".gradle/caches",
|
|
||||||
"$brandName-API",
|
|
||||||
"$brandName-Server",
|
|
||||||
"paper-api-generator",
|
|
||||||
"run",
|
|
||||||
|
|
||||||
// remove dev environment files
|
|
||||||
"0001-fixup.patch",
|
|
||||||
"compare.txt"
|
|
||||||
).forEach {
|
|
||||||
projectDir.resolve(it).deleteRecursively()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications.create<MavenPublication>("devBundle") {
|
|
||||||
artifact(tasks.generateDevelopmentBundle) { artifactId = "dev-bundle" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
id("com.gradleup.shadow") version "8.3.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin.jvmToolchain(21)
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven("https://papermc.io/repo/repository/maven-public/")
|
maven("https://papermc.io/repo/repository/maven-public/")
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin.jvmToolchain {
|
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
shadow("io.papermc.paperweight:paperweight-patcher:1.6.2-SNAPSHOT")
|
shadow("io.papermc.paperweight:paperweight-patcher:1.6.2-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ abstract class PurpurUpdateTask : Task() {
|
|||||||
|
|
||||||
fun checkout(
|
fun checkout(
|
||||||
name: String, repo: Provider<String>, ref: Provider<String>, regex: String, block: CheckoutRepo.() -> Unit
|
name: String, repo: Provider<String>, ref: Provider<String>, regex: String, block: CheckoutRepo.() -> Unit
|
||||||
): Pair<TaskProvider<out Task>, Directory> {
|
): Pair<TaskProvider<CheckoutRepo>, Directory> {
|
||||||
val updatePaper = configureTask<SimpleUpstreamUpdateTask>("update${name}Paper", "Update $name's Paper") {
|
val updatePaper = configureTask<SimpleUpstreamUpdateTask>("update${name}Paper", "Update $name's Paper") {
|
||||||
this.repo.convention(extension.paperRepo)
|
this.repo.convention(extension.paperRepo)
|
||||||
this.ref.convention(extension.paperRef)
|
this.ref.convention(extension.paperRef)
|
||||||
@@ -113,10 +113,10 @@ abstract class PurpurUpdateTask : Task() {
|
|||||||
this.workDir.set(wd)
|
this.workDir.set(wd)
|
||||||
|
|
||||||
this.block()
|
this.block()
|
||||||
this.finalizedBy(updatePaper)
|
// this.finalizedBy(updatePaper)
|
||||||
}
|
}
|
||||||
|
|
||||||
return updatePaper to checkout.flatMap { it.outputDir }.get()
|
return checkout to checkout.flatMap { it.outputDir }.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
val (checkoutPufferfish, pufferfish) =
|
val (checkoutPufferfish, pufferfish) =
|
||||||
@@ -124,9 +124,7 @@ abstract class PurpurUpdateTask : Task() {
|
|||||||
onlyIf { extension { usePufferfish } }
|
onlyIf { extension { usePufferfish } }
|
||||||
}
|
}
|
||||||
val (checkoutPurpur, purpur) =
|
val (checkoutPurpur, purpur) =
|
||||||
checkout("Purpur", extension.purpurRepo, extension.purpurRef, "paperCommit = ") {
|
checkout("Purpur", extension.purpurRepo, extension.purpurRef, "paperCommit = ") {}
|
||||||
dependsOn(checkoutPufferfish)
|
|
||||||
}
|
|
||||||
|
|
||||||
pufferfishDir.set(pufferfish)
|
pufferfishDir.set(pufferfish)
|
||||||
purpurDir.set(purpur)
|
purpurDir.set(purpur)
|
||||||
@@ -245,7 +243,7 @@ abstract class PurpurUpdateTask : Task() {
|
|||||||
|
|
||||||
@OptIn(ExperimentalPathApi::class)
|
@OptIn(ExperimentalPathApi::class)
|
||||||
private fun Path.copyPatch(to: Path, vararg name: String) = walk().sorted()
|
private fun Path.copyPatch(to: Path, vararg name: String) = walk().sorted()
|
||||||
.filter { entry -> name.any { entry.name.endsWith("$it.patch") } }.map(Path::toFile)
|
.filter { entry -> name.filter { it != "" }.any { entry.name.endsWith("$it.patch") } }.map(Path::toFile)
|
||||||
.forEachIndexed { count, patch ->
|
.forEachIndexed { count, patch ->
|
||||||
patch.copyTo(
|
patch.copyTo(
|
||||||
to.resolve("${count + 1}".padStart(4, '0') + "-" + name.first { patch.name.substring(5) == "$it.patch" } + ".patch").toFile(),
|
to.resolve("${count + 1}".padStart(4, '0') + "-" + name.first { patch.name.substring(5) == "$it.patch" } + ".patch").toFile(),
|
||||||
|
|||||||
@@ -13,17 +13,17 @@ brandName = Plazma
|
|||||||
providerName = PlazmaMC
|
providerName = PlazmaMC
|
||||||
providerRepo = PlazmaMC/PlazmaBukkit
|
providerRepo = PlazmaMC/PlazmaBukkit
|
||||||
|
|
||||||
version = 1.21.1-R0.1-SNAPSHOT
|
version = 1.21.3-R0.1-SNAPSHOT
|
||||||
mcVersion = 1.21.1
|
mcVersion = 1.21.3
|
||||||
jdkVersion = 21
|
jdkVersion = 21
|
||||||
|
|
||||||
paperRepo = https://github.com/PaperMC/Paper
|
paperRepo = https://github.com/PaperMC/Paper-archive
|
||||||
paperBranch = master
|
paperBranch = ver/1.21.3
|
||||||
purpurRepo = https://github.com/PurpurMC/Purpur
|
purpurRepo = https://github.com/PurpurMC/Purpur
|
||||||
purpurBranch = ver/1.21.1
|
purpurBranch = ver/1.21.3
|
||||||
pufferfishRepo = https://github.com/pufferfish-gg/Pufferfish
|
pufferfishRepo = https://github.com/pufferfish-gg/Pufferfish
|
||||||
pufferfishBranch = ver/1.21
|
pufferfishBranch = ver/1.21
|
||||||
usePufferfish = true
|
usePufferfish = false
|
||||||
|
|
||||||
paperCommit = d348cb88a9fe8d19e46102c8b9febe18f746d46b
|
paperCommit = da7138233f6392e791d790d1c3407414c855f9c2
|
||||||
purpurCommit = 4b57bed513aaadb0a1ecebae3796a5e93b7561ea
|
purpurCommit = 16ce24aa7eb08232030e4570e027f7baefa5f3f9
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
[versions]
|
[versions]
|
||||||
shadow = "8.1.1"
|
shadow = "8.3.5"
|
||||||
paperweight = "1.7.4"
|
|
||||||
paperclip = "3.0.3"
|
|
||||||
decompiler = "1.10.1"
|
|
||||||
remapper = "0.10.3"
|
remapper = "0.10.3"
|
||||||
|
paperclip = "3.0.3"
|
||||||
|
paperweight = "1.7.4"
|
||||||
|
decompiler = "1.10.1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
paperclip = { group = "io.papermc", name = "paperclip", version.ref = "paperclip" }
|
||||||
remapper = { group = "net.fabricmc", name = "tiny-remapper", version.ref="remapper" }
|
remapper = { group = "net.fabricmc", name = "tiny-remapper", version.ref="remapper" }
|
||||||
decompiler = { group = "org.vineflower", name = "vineflower", version.ref = "decompiler" }
|
decompiler = { group = "org.vineflower", name = "vineflower", version.ref = "decompiler" }
|
||||||
paperclip = { group = "io.papermc", name = "paperclip", version.ref = "paperclip" }
|
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
|
||||||
paperweight = { id = "io.papermc.paperweight.patcher", version.ref = "paperweight" }
|
paperweight = { id = "io.papermc.paperweight.patcher", version.ref = "paperweight" }
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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.8-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
2
gradlew
vendored
2
gradlew
vendored
@@ -55,7 +55,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
|||||||
149
initDev
149
initDev
@@ -3,63 +3,134 @@
|
|||||||
# run below command in your terminal:
|
# run below command in your terminal:
|
||||||
# source ./initDev
|
# source ./initDev
|
||||||
|
|
||||||
export PROJECT_DIR=$(pwd)
|
PROJECT_DIR=$(pwd)
|
||||||
|
|
||||||
alias api="cd $PROJECT_DIR/*-API"
|
alias cl="clear;"
|
||||||
alias srv="cd $PROJECT_DIR/*-Server"
|
|
||||||
|
|
||||||
alias c="clear;"
|
alias src="cd $PROJECT_DIR;"
|
||||||
alias ap="./gradlew --no-rebuild applyPatches"
|
alias ca="cd $PROJECT_DIR/*-API || exit 1; vs;"
|
||||||
alias aap="./gradlew --no-rebuild applyAPIPatches"
|
alias cg="cd $PROJECT_DIR/paper-api-generator/generated || exit 1; vs;"
|
||||||
alias agp="./gradlew --no-rebuild applyGeneratedAPIPatches"
|
alias cs="cd $PROJECT_DIR/*-Server || exit 1; vs;"
|
||||||
alias asp="./gradlew --no-rebuild applyServerPatches"
|
|
||||||
|
|
||||||
alias rp="./gradlew --no-rebuild rebuildPatches"
|
alias fa="ca __generate_fixup_patch"
|
||||||
alias rap="./gradlew --no-rebuild rebuildAPIPatches"
|
alias fg="cg __generate_fixup_patch"
|
||||||
alias rgp="./gradlew --no-rebuild rebuildGeneratedAPIPatches"
|
alias fs="cs __generate_fixup_patch"
|
||||||
alias rsp="./gradlew --no-rebuild rebuildServerPatches"
|
|
||||||
|
|
||||||
alias lg="git log --oneline base..HEAD"
|
alias gradle="./gradlew" # TODO: Paperweight will not work with Gradle 8.10.2
|
||||||
alias rc="git rebase --autosquash -i base"
|
alias gr="cd $PROJECT_DIR; gradle"
|
||||||
alias rcc="git rebase --continue"
|
alias grc="gr --no-rebuild"
|
||||||
|
|
||||||
# generate Fixup patches for Server
|
alias ap="grc applyPatches"
|
||||||
function fs() {
|
alias aap="grc applyAPIPatches"
|
||||||
cd ./*-Server || exit 1
|
alias agp="grc applyGeneratedAPIPatches"
|
||||||
|
alias asp="grc applyServerPatches"
|
||||||
|
|
||||||
|
alias aap!="rm -rf $PROJECT_DIR/*-API; aap"
|
||||||
|
alias agp!="rm -rf $PROJECT_DIR/paper-api-generator/generated; agp"
|
||||||
|
alias asp!="rm -rf $PROJECT_DIR/*-Server; asp"
|
||||||
|
|
||||||
|
alias aapa="ca vpa"
|
||||||
|
alias aapc="ca vpc"
|
||||||
|
alias aapc="ca vps"
|
||||||
|
alias agpa="cg vpa"
|
||||||
|
alias agpc="cg vpc"
|
||||||
|
alias agpc="cg vps"
|
||||||
|
alias aspa="cs vpa"
|
||||||
|
alias aspc="cs vpc"
|
||||||
|
alias aspc="cs vps"
|
||||||
|
|
||||||
|
alias rp="grc rebuildPatches"
|
||||||
|
alias rap="grc rebuildAPIPatches"
|
||||||
|
alias rgp="grc rebuildGeneratedAPIPatches"
|
||||||
|
alias rsp="grc rebuildServerPatches"
|
||||||
|
|
||||||
|
alias mk="gr build"
|
||||||
|
alias mko="gr createReobfPaperclipJar"
|
||||||
|
alias mkm="gr createMojmapPaperclipJar"
|
||||||
|
|
||||||
|
|
||||||
|
alias va="git add"
|
||||||
|
alias va.="git add ."
|
||||||
|
|
||||||
|
alias vl="git log --oneline base..HEAD"
|
||||||
|
|
||||||
|
alias vr="git rebase --autosquash base"
|
||||||
|
alias vra="git rebase --abort"
|
||||||
|
alias vrc="va.; git rebase --continue"
|
||||||
|
alias vrs="git rebase --skip"
|
||||||
|
|
||||||
|
alias vp="git am --show-current-patch"
|
||||||
|
alias vpa="git am --abort"
|
||||||
|
alias vpc="git am --continue"
|
||||||
|
alias vps="git am --skip"
|
||||||
|
|
||||||
|
alias vm="git commit --fixup"
|
||||||
|
alias vs="git status"
|
||||||
|
|
||||||
|
alias vc="git commit --verbose --no-interactive"
|
||||||
|
alias vcn="vc --no-message"
|
||||||
|
alias vcm="vc --message"
|
||||||
|
|
||||||
|
alias vca="git commit --verbose --no-interactive --all"
|
||||||
|
alias vcan="git commit --verbose --no-interactive --all --no-message"
|
||||||
|
alias vcam="git commit --verbose --no-interactive --all --message"
|
||||||
|
|
||||||
|
alias ve="git commit --verbose --no-interactive --amend"
|
||||||
|
alias ven="ve --no-message"
|
||||||
|
alias vem="ve --message"
|
||||||
|
|
||||||
|
alias vea="git commit --verbose --no-interactive --all --amend"
|
||||||
|
alias vean="vea --no-message"
|
||||||
|
alias veam="vea --message"
|
||||||
|
|
||||||
|
alias as="ca src"
|
||||||
|
alias al="ca vl"
|
||||||
|
alias ac="ca va.; vcm"
|
||||||
|
alias am="ca vm"
|
||||||
|
alias ae="ca ve"
|
||||||
|
alias aea="ca vea"
|
||||||
|
alias aean="ca vean"
|
||||||
|
alias aeam="ca veam"
|
||||||
|
|
||||||
|
alias gs="cg src"
|
||||||
|
alias gl="cg vl"
|
||||||
|
alias gc="cg va.; vcm"
|
||||||
|
alias gm="cg vm"
|
||||||
|
alias ge="cg ve"
|
||||||
|
alias gea="cg vea"
|
||||||
|
alias gean="cg vean"
|
||||||
|
alias geam="cg veam"
|
||||||
|
|
||||||
|
alias ss="cs src"
|
||||||
|
alias sl="cs vl"
|
||||||
|
alias sc="cs va.; vcm"
|
||||||
|
alias sm="cs vm"
|
||||||
|
alias se="cs ve"
|
||||||
|
alias sea="cs vea"
|
||||||
|
alias sean="cs vean"
|
||||||
|
alias seam="cs veam"
|
||||||
|
|
||||||
|
function __generate_fixup_patch() {
|
||||||
garg="."
|
garg="."
|
||||||
[[ "$1" == "-x" ]] && garg="--amend"
|
[[ "$1" == "-x" ]] && garg="--amend"
|
||||||
|
|
||||||
git add .
|
git add .
|
||||||
git commit "$garg" -m "fixup"
|
git commit "$garg" -m "fixup"
|
||||||
git format-patch -1
|
git format-patch -1
|
||||||
mv 0001-fixup.patch ../
|
mv 0001-fixup.patch ../ -f
|
||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
}
|
}
|
||||||
|
|
||||||
# generate Fixup patches for API
|
|
||||||
function fa() {
|
|
||||||
cd ./*-API || exit 1
|
|
||||||
garg="."
|
|
||||||
[[ "$1" == "-x" ]] && garg="--amend"
|
|
||||||
|
|
||||||
git add .
|
|
||||||
git commit "$garg" -m "fixup"
|
|
||||||
git format-patch -1
|
|
||||||
mv 0001-fixup.patch ../
|
|
||||||
|
|
||||||
cd ../
|
|
||||||
}
|
|
||||||
|
|
||||||
# ReApply Server Patches
|
|
||||||
function rasp() {
|
|
||||||
rm -rf ./*-Server
|
|
||||||
./gradlew applyServerPatches
|
|
||||||
}
|
|
||||||
|
|
||||||
# Commit Updated Upstream
|
# Commit Updated Upstream
|
||||||
function cuu() {
|
function cuu() {
|
||||||
# shellcheck disable=SC2059
|
# shellcheck disable=SC2059
|
||||||
printf "Updated Upstream ($1)$(/bin/cat compare.txt)" | git commit -F -
|
printf "Updated Upstream ($1)$(/bin/cat compare.txt)" | git commit -F -
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git update-index --assume-unchanged ./build-data/dev-imports.txt
|
||||||
|
|
||||||
|
if [ ! -L "$PROJECT_DIR/upstream" ]; then
|
||||||
|
grc applyPatches
|
||||||
|
ln -dsf "$PROJECT_DIR/.gradle/caches/paperweight/upstreams/paper" "$PROJECT_DIR/upstream"
|
||||||
|
fi
|
||||||
|
|||||||
@@ -1,33 +1,47 @@
|
|||||||
[versions]
|
[versions]
|
||||||
gson = "2.10.1"
|
|
||||||
joml = "1.10.5"
|
|
||||||
guava = "32.1.2-jre"
|
|
||||||
sentry = "5.4.0"
|
|
||||||
jspecify = "1.0.0"
|
|
||||||
fastutil = "8.5.6"
|
|
||||||
findbugs = "1.3.9"
|
|
||||||
slf4j-api = "2.0.9"
|
|
||||||
brigadier = "1.2.9"
|
brigadier = "1.2.9"
|
||||||
bungeechat = "1.20-R0.2"
|
|
||||||
|
guava = "33.3.1-jre"
|
||||||
|
gson = "2.11.0"
|
||||||
|
bungeechat = "1.20-R0.2-deprecated+build.19"
|
||||||
|
|
||||||
|
# snakeyaml
|
||||||
|
joml = "1.10.8"
|
||||||
json-simple = "1.1.1"
|
json-simple = "1.1.1"
|
||||||
annotations = "24.0.1"
|
|
||||||
|
fastutil = "8.5.6"
|
||||||
|
# adventure
|
||||||
|
# log4j
|
||||||
|
slf4j-api = "2.0.9"
|
||||||
|
sentry = "5.4.0"
|
||||||
|
|
||||||
|
# asm
|
||||||
|
# mvn
|
||||||
|
|
||||||
|
annotations = "24.1.0"
|
||||||
checkerqual = "3.21.0"
|
checkerqual = "3.21.0"
|
||||||
|
jspecify = "1.0.0"
|
||||||
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
joml = { group = "org.joml", name = "joml", version.ref = "joml" }
|
|
||||||
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
|
||||||
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
|
||||||
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
|
|
||||||
jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" }
|
|
||||||
fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" }
|
|
||||||
findbugs = { group = "com.google.code.findbugs", name = "jsr305", version.ref = "findbugs" }
|
|
||||||
brigadier = { group = "com.mojang", name = "brigadier", version.ref = "brigadier" }
|
brigadier = { group = "com.mojang", name = "brigadier", version.ref = "brigadier" }
|
||||||
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
|
|
||||||
|
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
|
||||||
|
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
||||||
bungeechat = { group = "net.md-5", name = "bungeecord-chat", version.ref = "bungeechat" }
|
bungeechat = { group = "net.md-5", name = "bungeecord-chat", version.ref = "bungeechat" }
|
||||||
|
|
||||||
|
joml = { group = "org.joml", name = "joml", version.ref = "joml" }
|
||||||
jsonsimple = { group = "com.googlecode.json-simple", name = "json-simple", version.ref = "json-simple" }
|
jsonsimple = { group = "com.googlecode.json-simple", name = "json-simple", version.ref = "json-simple" }
|
||||||
|
|
||||||
|
fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" }
|
||||||
|
slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j-api" }
|
||||||
|
sentry = { group = "io.sentry", name = "sentry", version.ref = "sentry" }
|
||||||
|
|
||||||
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
|
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }
|
||||||
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" }
|
checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" }
|
||||||
|
jspecify = { group = "org.jspecify", name = "jspecify", version.ref = "jspecify" }
|
||||||
|
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
api = [ "jspecify", "guava", "gson", "joml", "fastutil", "slf4j-api", "sentry", "brigadier" ]
|
api = [ "brigadier", "guava", "gson", "joml", "fastutil", "slf4j", "sentry", "jspecify" ]
|
||||||
annotations = [ "annotations", "checkerqual" ]
|
annotations = [ "annotations", "checkerqual" ]
|
||||||
|
|||||||
@@ -1,47 +1,73 @@
|
|||||||
[versions]
|
[versions]
|
||||||
asm = "9.7.1"
|
|
||||||
log4j = "2.19.0"
|
|
||||||
junit = "1.10.0"
|
|
||||||
mockito = "5.14.1"
|
|
||||||
jupiter = "5.10.0"
|
|
||||||
hamcrest = "2.2"
|
|
||||||
snakeyaml = "2.2"
|
|
||||||
adventure = "4.17.0"
|
adventure = "4.17.0"
|
||||||
|
log4j = "2.19.0"
|
||||||
|
asm = "9.7.1"
|
||||||
|
|
||||||
|
mvn = "3.9.6"
|
||||||
|
mvn-resolver = "1.9.18"
|
||||||
|
|
||||||
commons-lang2 = "2.6"
|
commons-lang2 = "2.6"
|
||||||
commons-lang3 = "3.12.0"
|
commons-lang3 = "3.12.0"
|
||||||
maven-provider = "3.9.6"
|
|
||||||
maven-resolver = "1.9.18"
|
snakeyaml = "2.2"
|
||||||
|
|
||||||
|
junit = "1.10.0"
|
||||||
|
junit-jupiter = "5.10.0"
|
||||||
|
junit-pioneer = "2.2.0"
|
||||||
|
|
||||||
|
hamcrest = "2.2"
|
||||||
|
mockito = "5.14.1"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
junit = { group = "org.junit.platform", name = "junit-platform-suite-engine", version.ref = "junit" }
|
|
||||||
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
|
||||||
jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "jupiter" }
|
|
||||||
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
|
|
||||||
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
|
|
||||||
|
|
||||||
asm-head = { group = "org.ow2.asm", name = "asm", version.ref = "asm" }
|
|
||||||
asm-tree = { group = "org.ow2.asm", name = "asm-tree", version.ref = "asm" }
|
|
||||||
asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" }
|
|
||||||
log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
|
|
||||||
log4j-core = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" }
|
|
||||||
log4j-iostreams = { group = "org.apache.logging.log4j", name = "log4j-iostreams", version.ref = "log4j" }
|
|
||||||
maven-provider = { group = "org.apache.maven", name = "maven-resolver-provider", version.ref = "maven-provider" }
|
|
||||||
maven-connector = { group = "org.apache.maven.resolver", name = "maven-resolver-connector-basic", version.ref = "maven-resolver" }
|
|
||||||
maven-transport = { group = "org.apache.maven.resolver", name = "maven-resolver-transport-http", version.ref = "maven-resolver" }
|
|
||||||
commons-lang2 = { group = "commons-lang", name = "commons-lang", version.ref = "commons-lang2" }
|
|
||||||
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commons-lang3" }
|
|
||||||
|
|
||||||
adventure-bom = { group = "net.kyori", name = "adventure-bom", version.ref = "adventure" }
|
adventure-bom = { group = "net.kyori", name = "adventure-bom", version.ref = "adventure" }
|
||||||
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
adventure-api = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" }
|
||||||
adventure-slf4j = { group = "net.kyori", name = "adventure-text-logger-slf4j", version.ref = "adventure" }
|
|
||||||
adventure-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
|
adventure-minimessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" }
|
||||||
|
adventure-logger-slf4j = { group = "net.kyori", name = "adventure-text-logger-slf4j", version.ref = "adventure" }
|
||||||
adventure-serializer-gson = { group = "net.kyori", name = "adventure-text-serializer-gson", version.ref = "adventure" }
|
adventure-serializer-gson = { group = "net.kyori", name = "adventure-text-serializer-gson", version.ref = "adventure" }
|
||||||
adventure-serializer-ansi = { group = "net.kyori", name = "adventure-text-serializer-ansi", version.ref = "adventure" }
|
adventure-serializer-ansi = { group = "net.kyori", name = "adventure-text-serializer-ansi", version.ref = "adventure" }
|
||||||
adventure-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
|
adventure-serializer-plain = { group = "net.kyori", name = "adventure-text-serializer-plain", version.ref = "adventure" }
|
||||||
adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
|
adventure-serializer-legacy = { group = "net.kyori", name = "adventure-text-serializer-legacy", version.ref = "adventure" }
|
||||||
|
|
||||||
|
log4j = { group = "org.apache.logging.log4j", name = "log4j-core", version.ref = "log4j" }
|
||||||
|
log4j-api = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" }
|
||||||
|
log4j-stream = { group = "org.apache.logging.log4j", name = "log4j-iostreams", version.ref = "log4j" }
|
||||||
|
|
||||||
|
asm = { group = "org.ow2.asm", name = "asm", version.ref = "asm" }
|
||||||
|
asm-tree = { group = "org.ow2.asm", name = "asm-tree", version.ref = "asm" }
|
||||||
|
asm-commons = { group = "org.ow2.asm", name = "asm-commons", version.ref = "asm" }
|
||||||
|
|
||||||
|
mvn = { group = "org.apache.maven", name = "maven-resolver-provider", version.ref = "mvn" }
|
||||||
|
mvn-connector = { group = "org.apache.maven.resolver", name = "maven-resolver-connector-basic", version.ref = "mvn-resolver" }
|
||||||
|
mvn-transport = { group = "org.apache.maven.resolver", name = "maven-resolver-transport-http", version.ref = "mvn-resolver" }
|
||||||
|
|
||||||
|
commons-lang2 = { group = "commons-lang", name = "commons-lang", version.ref = "commons-lang2" }
|
||||||
|
commons-lang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commons-lang3" }
|
||||||
|
|
||||||
|
snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" }
|
||||||
|
|
||||||
|
junit = { group = "org.junit.platform", name = "junit-platform-suite-engine", version.ref = "junit" }
|
||||||
|
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit-jupiter" }
|
||||||
|
junit-pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "junit-pioneer" }
|
||||||
|
|
||||||
|
hamcrest = { group = "org.hamcrest", name = "hamcrest", version.ref = "hamcrest" }
|
||||||
|
mockito = { group = "org.mockito", name = "mockito-core", version.ref = "mockito" }
|
||||||
|
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
asm = [ "asm-head", "asm-commons" ]
|
asm = [ "asm", "asm-commons" ]
|
||||||
test = [ "jupiter", "hamcrest", "mockito", "asm-tree", "junit" ]
|
mvn = [ "mvn-connector", "mvn-transport" ]
|
||||||
maven = [ "maven-connector", "maven-transport" ]
|
|
||||||
adventure = [ "adventure-api", "adventure-slf4j", "adventure-minimessage", "adventure-serializer-gson", "adventure-serializer-plain", "adventure-serializer-legacy" ]
|
test = [
|
||||||
|
"junit-jupiter",
|
||||||
|
"hamcrest",
|
||||||
|
"mockito",
|
||||||
|
"asm-tree"
|
||||||
|
]
|
||||||
|
adventure = [
|
||||||
|
"adventure-api",
|
||||||
|
"adventure-minimessage",
|
||||||
|
"adventure-logger-slf4j",
|
||||||
|
"adventure-serializer-gson",
|
||||||
|
"adventure-serializer-plain",
|
||||||
|
"adventure-serializer-legacy"
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,56 +1,89 @@
|
|||||||
[versions]
|
[versions]
|
||||||
art = "2.0.3"
|
jline = "3.27.1"
|
||||||
tca = "1.3.0"
|
tca = "1.3.0"
|
||||||
upnp = "1.0"
|
# adventure
|
||||||
ansi = "1.0.3"
|
# log4j
|
||||||
jansi = "3.21.0"
|
netty = "4.1.97.Final"
|
||||||
rhino = "1.7.14"
|
# asm
|
||||||
mysql = "8.4.0"
|
|
||||||
flare = "34637f3f87"
|
|
||||||
sqlite = "3.46.0.0"
|
|
||||||
pioneer = "2.2.0"
|
|
||||||
haproxy = "4.1.97.Final"
|
|
||||||
rewriter = "0.0.3"
|
|
||||||
srgutils = "1.0.9"
|
|
||||||
sparkapi = "0.1-20240720.200737-2"
|
|
||||||
sparknt = "1.10.105-SNAPSHOT"
|
|
||||||
velocity = "3.3.0-SNAPSHOT"
|
|
||||||
disruptor = "3.4.4"
|
|
||||||
simpleyaml = "1.8.4"
|
|
||||||
classgraph = "4.8.47"
|
|
||||||
mapping-io = "0.5.0"
|
|
||||||
configurate = "4.2.0-SNAPSHOT"
|
configurate = "4.2.0-SNAPSHOT"
|
||||||
|
# commons2
|
||||||
|
sqlite = "3.46.1.3"
|
||||||
|
mysql = "9.1.0"
|
||||||
|
disruptor = "3.4.4"
|
||||||
|
velocity = "3.3.0-SNAPSHOT"
|
||||||
|
|
||||||
|
# mvn
|
||||||
|
|
||||||
|
# snakeyaml
|
||||||
|
simpleyaml = "1.8.4"
|
||||||
|
|
||||||
|
rhino = "1.7.14"
|
||||||
|
upnp = "1.0"
|
||||||
|
|
||||||
|
classgraph = "4.8.47"
|
||||||
|
# test (junit, hamcrest, mockito, asm-tree)
|
||||||
|
srgutils = "1.0.9"
|
||||||
|
art = "2.0.3"
|
||||||
|
|
||||||
|
rewriter = "0.0.3"
|
||||||
|
spark-api = "0.1-20240720.200737-2"
|
||||||
|
spark = "1.10.119-SNAPSHOT"
|
||||||
|
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" }
|
jline-ffm = { group = "org.jline", name = "jline-terminal-ffm", version.ref = "jline" }
|
||||||
|
jline-jni = { group = "org.jline", name = "jline-terminal-jni", version.ref = "jline" }
|
||||||
tca = { group = "net.minecrell", name = "terminalconsoleappender", version.ref="tca" }
|
tca = { group = "net.minecrell", name = "terminalconsoleappender", version.ref="tca" }
|
||||||
ansi = { group = "net.kyori", name = "ansi", version.ref = "ansi" }
|
# adventure
|
||||||
upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" }
|
# log4j
|
||||||
mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" }
|
netty-haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "netty" }
|
||||||
jansi = { group = "org.jline", name = "jline-terminal-jansi", version.ref = "jansi" }
|
# asm
|
||||||
flare = { group = "com.github.technove", name = "flare", version.ref = "flare" }
|
configurate-yaml = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" }
|
||||||
|
# commons2
|
||||||
sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" }
|
sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" }
|
||||||
pioneer = { group = "org.junit-pioneer", name = "junit-pioneer", version.ref = "pioneer" }
|
mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysql" }
|
||||||
haproxy = { group = "io.netty", name = "netty-codec-haproxy", version.ref = "haproxy" }
|
|
||||||
srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" }
|
|
||||||
velocity = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" }
|
|
||||||
disruptor = { group = "com.lmax", name = "disruptor", version.ref = "disruptor" }
|
disruptor = { group = "com.lmax", name = "disruptor", version.ref = "disruptor" }
|
||||||
mappingio = { group = "net.fabricmc", name = "mapping-io", version.ref = "mapping-io" }
|
velocity-native = { group = "com.velocitypowered", name = "velocity-native", version.ref = "velocity" }
|
||||||
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
|
||||||
|
# snakeyaml
|
||||||
simpleyaml = { group = "com.github.carleslc.Simple-YAML", name = "Simple-Yaml", version.ref = "simpleyaml" }
|
simpleyaml = { group = "com.github.carleslc.Simple-YAML", name = "Simple-Yaml", version.ref = "simpleyaml" }
|
||||||
configurate = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" }
|
|
||||||
|
|
||||||
spark-api = { group = "me.lucko", name = "spark-api", version.ref = "sparkapi" }
|
|
||||||
spark-paper = { group = "me.lucko", name = "spark-paper", version.ref = "sparknt" }
|
|
||||||
|
|
||||||
rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" }
|
|
||||||
rhino-runtime = { group = "org.mozilla", name = "rhino-runtime", version.ref = "rhino" }
|
rhino-runtime = { group = "org.mozilla", name = "rhino-runtime", version.ref = "rhino" }
|
||||||
|
rhino-engine = { group = "org.mozilla", name = "rhino-engine", version.ref = "rhino" }
|
||||||
|
upnp = { group = "dev.omega24", name = "upnp4j", version.ref = "upnp" }
|
||||||
|
|
||||||
|
classgraph = { group = "io.github.classgraph", name = "classgraph", version.ref = "classgraph" }
|
||||||
|
# test (junit, hamcrest, mockito, asm-tree)
|
||||||
|
srgutils = { group = "net.neoforged", name = "srgutils", version.ref = "srgutils" }
|
||||||
|
art = { group = "net.neoforged", name = "AutoRenamingTool", version.ref = "art" }
|
||||||
|
|
||||||
rewriter = { group = "io.papermc", name = "reflection-rewriter", version.ref = "rewriter" }
|
rewriter = { group = "io.papermc", name = "reflection-rewriter", version.ref = "rewriter" }
|
||||||
rewriter-runtime = { group = "io.papermc", name = "reflection-rewriter-runtime", version.ref = "rewriter" }
|
rewriter-runtime = { group = "io.papermc", name = "reflection-rewriter-runtime", version.ref = "rewriter" }
|
||||||
rewriter-generator = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" }
|
rewriter-proxy = { group = "io.papermc", name = "reflection-rewriter-proxy-generator", version.ref = "rewriter" }
|
||||||
|
|
||||||
|
spark-api = { group = "me.lucko", name = "spark-api", version.ref = "spark-api" }
|
||||||
|
spark = { group = "me.lucko", name = "spark-paper", version.ref = "spark" }
|
||||||
|
|
||||||
|
|
||||||
[bundles]
|
[bundles]
|
||||||
runtime = [ "sqlite", "mysql", "disruptor" ]
|
runtime = [ "sqlite", "mysql", "disruptor" ]
|
||||||
implementation = [ "spark-api", "spark-paper", "jansi", "tca", "ansi", "upnp", "haproxy", "configurate", "mappingio", "rhino-engine", "rhino-runtime", "srgutils", "art", "rewriter", "rewriter-runtime", "rewriter-generator", "flare" ]
|
test = [ "classgraph" ]
|
||||||
test = [ "classgraph", "pioneer" ]
|
|
||||||
|
implementation = [
|
||||||
|
"jline-ffm",
|
||||||
|
"jline-jni",
|
||||||
|
"tca",
|
||||||
|
"netty-haproxy",
|
||||||
|
"configurate-yaml",
|
||||||
|
"velocity-native",
|
||||||
|
"rhino-runtime",
|
||||||
|
"rhino-engine",
|
||||||
|
"upnp",
|
||||||
|
"srgutils",
|
||||||
|
"art",
|
||||||
|
"rewriter",
|
||||||
|
"rewriter-runtime",
|
||||||
|
"rewriter-proxy",
|
||||||
|
"spark-api",
|
||||||
|
"spark"
|
||||||
|
]
|
||||||
|
|||||||
@@ -1,527 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Kevin Raneri <kevin.raneri@gmail.com>
|
|
||||||
Date: Tue, 22 Oct 2024 07:31:43 +0900
|
|
||||||
Subject: [PATCH] Pufferfish API Changes
|
|
||||||
|
|
||||||
Pufferfish
|
|
||||||
Copyright (C) 2024 Pufferfish Studios LLC
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
||||||
index e7c96be769fde8375b9a1b128cc7ce474144d16d..f9b44a03fe8d9a2fea2d968f4e944a6663c6f9c9 100644
|
|
||||||
--- a/build.gradle.kts
|
|
||||||
+++ b/build.gradle.kts
|
|
||||||
@@ -52,6 +52,7 @@ dependencies {
|
|
||||||
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
|
||||||
api("org.apache.logging.log4j:log4j-api:$log4jVersion")
|
|
||||||
api("org.slf4j:slf4j-api:$slf4jVersion")
|
|
||||||
+ api("io.sentry:sentry:5.4.0") // Pufferfish
|
|
||||||
|
|
||||||
implementation("org.ow2.asm:asm:9.7.1")
|
|
||||||
implementation("org.ow2.asm:asm-commons:9.7.1")
|
|
||||||
@@ -131,6 +132,13 @@ val generateApiVersioningFile by tasks.registering {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+// Pufferfish Start
|
|
||||||
+tasks.withType<JavaCompile> {
|
|
||||||
+ val compilerArgs = options.compilerArgs
|
|
||||||
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
|
|
||||||
+}
|
|
||||||
+// Pufferfish End
|
|
||||||
+
|
|
||||||
tasks.jar {
|
|
||||||
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
|
|
||||||
into("META-INF/maven/${project.group}/${project.name}")
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
|
|
||||||
@@ -0,0 +1,161 @@
|
|
||||||
+package gg.pufferfish.pufferfish.sentry;
|
|
||||||
+
|
|
||||||
+import com.google.gson.Gson;
|
|
||||||
+import java.lang.reflect.Field;
|
|
||||||
+import java.lang.reflect.Modifier;
|
|
||||||
+import java.util.Map;
|
|
||||||
+import java.util.TreeMap;
|
|
||||||
+import org.apache.logging.log4j.ThreadContext;
|
|
||||||
+import org.bukkit.command.Command;
|
|
||||||
+import org.bukkit.command.CommandSender;
|
|
||||||
+import org.bukkit.entity.Player;
|
|
||||||
+import org.bukkit.event.Event;
|
|
||||||
+import org.bukkit.event.player.PlayerEvent;
|
|
||||||
+import org.bukkit.plugin.Plugin;
|
|
||||||
+import org.bukkit.plugin.RegisteredListener;
|
|
||||||
+import org.jetbrains.annotations.Nullable;
|
|
||||||
+
|
|
||||||
+public class SentryContext {
|
|
||||||
+
|
|
||||||
+ private static final Gson GSON = new Gson();
|
|
||||||
+
|
|
||||||
+ public static void setPluginContext(@Nullable Plugin plugin) {
|
|
||||||
+ if (plugin != null) {
|
|
||||||
+ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName());
|
|
||||||
+ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void removePluginContext() {
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_pluginname");
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_pluginversion");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void setSenderContext(@Nullable CommandSender sender) {
|
|
||||||
+ if (sender != null) {
|
|
||||||
+ ThreadContext.put("pufferfishsentry_playername", sender.getName());
|
|
||||||
+ if (sender instanceof Player player) {
|
|
||||||
+ ThreadContext.put("pufferfishsentry_playerid", player.getUniqueId().toString());
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void removeSenderContext() {
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_playername");
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_playerid");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void setEventContext(Event event, RegisteredListener registration) {
|
|
||||||
+ setPluginContext(registration.getPlugin());
|
|
||||||
+
|
|
||||||
+ try {
|
|
||||||
+ // Find the player that was involved with this event
|
|
||||||
+ Player player = null;
|
|
||||||
+ if (event instanceof PlayerEvent) {
|
|
||||||
+ player = ((PlayerEvent) event).getPlayer();
|
|
||||||
+ } else {
|
|
||||||
+ Class<? extends Event> eventClass = event.getClass();
|
|
||||||
+
|
|
||||||
+ Field playerField = null;
|
|
||||||
+
|
|
||||||
+ for (Field field : eventClass.getDeclaredFields()) {
|
|
||||||
+ if (field.getType().equals(Player.class)) {
|
|
||||||
+ playerField = field;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (playerField != null) {
|
|
||||||
+ playerField.setAccessible(true);
|
|
||||||
+ player = (Player) playerField.get(event);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (player != null) {
|
|
||||||
+ setSenderContext(player);
|
|
||||||
+ }
|
|
||||||
+ } catch (Exception e) {} // We can't really safely log exceptions.
|
|
||||||
+
|
|
||||||
+ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event)));
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void removeEventContext() {
|
|
||||||
+ removePluginContext();
|
|
||||||
+ removeSenderContext();
|
|
||||||
+ ThreadContext.remove("pufferfishsentry_eventdata");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private static Map<String, String> serializeFields(Object object) {
|
|
||||||
+ Map<String, String> fields = new TreeMap<>();
|
|
||||||
+ fields.put("_class", object.getClass().getName());
|
|
||||||
+ for (Field declaredField : object.getClass().getDeclaredFields()) {
|
|
||||||
+ try {
|
|
||||||
+ if (Modifier.isStatic(declaredField.getModifiers())) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ String fieldName = declaredField.getName();
|
|
||||||
+ if (fieldName.equals("handlers")) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ declaredField.setAccessible(true);
|
|
||||||
+ Object value = declaredField.get(object);
|
|
||||||
+ if (value != null) {
|
|
||||||
+ fields.put(fieldName, value.toString());
|
|
||||||
+ } else {
|
|
||||||
+ fields.put(fieldName, "<null>");
|
|
||||||
+ }
|
|
||||||
+ } catch (Exception e) {} // We can't really safely log exceptions.
|
|
||||||
+ }
|
|
||||||
+ return fields;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static class State {
|
|
||||||
+
|
|
||||||
+ private Plugin plugin;
|
|
||||||
+ private Command command;
|
|
||||||
+ private String commandLine;
|
|
||||||
+ private Event event;
|
|
||||||
+ private RegisteredListener registeredListener;
|
|
||||||
+
|
|
||||||
+ public Plugin getPlugin() {
|
|
||||||
+ return plugin;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setPlugin(Plugin plugin) {
|
|
||||||
+ this.plugin = plugin;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public Command getCommand() {
|
|
||||||
+ return command;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setCommand(Command command) {
|
|
||||||
+ this.command = command;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public String getCommandLine() {
|
|
||||||
+ return commandLine;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setCommandLine(String commandLine) {
|
|
||||||
+ this.commandLine = commandLine;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public Event getEvent() {
|
|
||||||
+ return event;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setEvent(Event event) {
|
|
||||||
+ this.event = event;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public RegisteredListener getRegisteredListener() {
|
|
||||||
+ return registeredListener;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public void setRegisteredListener(RegisteredListener registeredListener) {
|
|
||||||
+ this.registeredListener = registeredListener;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..3441cdad70da1bd523c5933b1a914688718c2657
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
|
||||||
@@ -0,0 +1,40 @@
|
|
||||||
+package gg.pufferfish.pufferfish.simd;
|
|
||||||
+
|
|
||||||
+import java.util.logging.Level;
|
|
||||||
+import java.util.logging.Logger;
|
|
||||||
+import jdk.incubator.vector.FloatVector;
|
|
||||||
+import jdk.incubator.vector.IntVector;
|
|
||||||
+import jdk.incubator.vector.VectorSpecies;
|
|
||||||
+
|
|
||||||
+/**
|
|
||||||
+ * Basically, java is annoying and we have to push this out to its own class.
|
|
||||||
+ */
|
|
||||||
+@Deprecated
|
|
||||||
+public class SIMDChecker {
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static boolean canEnable(Logger logger) {
|
|
||||||
+ try {
|
|
||||||
+ if (SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21) {
|
|
||||||
+ return false;
|
|
||||||
+ } else {
|
|
||||||
+ SIMDDetection.testRun = true;
|
|
||||||
+
|
|
||||||
+ VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
|
|
||||||
+ VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
|
|
||||||
+
|
|
||||||
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)");
|
|
||||||
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)");
|
|
||||||
+
|
|
||||||
+ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
|
|
||||||
+ logger.log(Level.WARNING, "SIMD is not properly supported on this system!");
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return true;
|
|
||||||
+ }
|
|
||||||
+ } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
|
||||||
@@ -0,0 +1,35 @@
|
|
||||||
+package gg.pufferfish.pufferfish.simd;
|
|
||||||
+
|
|
||||||
+import java.util.logging.Logger;
|
|
||||||
+
|
|
||||||
+@Deprecated
|
|
||||||
+public class SIMDDetection {
|
|
||||||
+
|
|
||||||
+ public static boolean isEnabled = false;
|
|
||||||
+ public static boolean versionLimited = false;
|
|
||||||
+ public static boolean testRun = false;
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static boolean canEnable(Logger logger) {
|
|
||||||
+ try {
|
|
||||||
+ return SIMDChecker.canEnable(logger);
|
|
||||||
+ } catch (NoClassDefFoundError | Exception ignored) {
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static int getJavaVersion() {
|
|
||||||
+ // https://stackoverflow.com/a/2591122
|
|
||||||
+ String version = System.getProperty("java.version");
|
|
||||||
+ if(version.startsWith("1.")) {
|
|
||||||
+ version = version.substring(2, 3);
|
|
||||||
+ } else {
|
|
||||||
+ int dot = version.indexOf(".");
|
|
||||||
+ if(dot != -1) { version = version.substring(0, dot); }
|
|
||||||
+ }
|
|
||||||
+ version = version.split("-")[0]; // Azul is stupid
|
|
||||||
+ return Integer.parseInt(version);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
|
||||||
@@ -0,0 +1,83 @@
|
|
||||||
+package gg.pufferfish.pufferfish.simd;
|
|
||||||
+
|
|
||||||
+import java.awt.Color;
|
|
||||||
+import jdk.incubator.vector.FloatVector;
|
|
||||||
+import jdk.incubator.vector.IntVector;
|
|
||||||
+import jdk.incubator.vector.VectorMask;
|
|
||||||
+import jdk.incubator.vector.VectorSpecies;
|
|
||||||
+import org.bukkit.map.MapPalette;
|
|
||||||
+
|
|
||||||
+@Deprecated
|
|
||||||
+public class VectorMapPalette {
|
|
||||||
+
|
|
||||||
+ private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED;
|
|
||||||
+ private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED;
|
|
||||||
+
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static void matchColorVectorized(int[] in, byte[] out) {
|
|
||||||
+ int speciesLength = I_SPEC.length();
|
|
||||||
+ int i;
|
|
||||||
+ for (i = 0; i < in.length - speciesLength; i += speciesLength) {
|
|
||||||
+ float[] redsArr = new float[speciesLength];
|
|
||||||
+ float[] bluesArr = new float[speciesLength];
|
|
||||||
+ float[] greensArr = new float[speciesLength];
|
|
||||||
+ int[] alphasArr = new int[speciesLength];
|
|
||||||
+
|
|
||||||
+ for (int j = 0; j < speciesLength; j++) {
|
|
||||||
+ alphasArr[j] = (in[i + j] >> 24) & 0xFF;
|
|
||||||
+ redsArr[j] = (in[i + j] >> 16) & 0xFF;
|
|
||||||
+ greensArr[j] = (in[i + j] >> 8) & 0xFF;
|
|
||||||
+ bluesArr[j] = (in[i + j] >> 0) & 0xFF;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0);
|
|
||||||
+ FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0);
|
|
||||||
+ FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0);
|
|
||||||
+ FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0);
|
|
||||||
+ IntVector resultIndex = IntVector.zero(I_SPEC);
|
|
||||||
+ VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff);
|
|
||||||
+
|
|
||||||
+ modificationMask = modificationMask.and(alphas.lt(128).not());
|
|
||||||
+ FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE);
|
|
||||||
+
|
|
||||||
+ for (int c = 4; c < MapPalette.colors.length; c++) {
|
|
||||||
+ // We're using 32-bit floats here because it's 2x faster and nobody will know the difference.
|
|
||||||
+ // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary.
|
|
||||||
+ FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed());
|
|
||||||
+ FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen());
|
|
||||||
+ FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue());
|
|
||||||
+
|
|
||||||
+ FloatVector rMean = reds.add(compReds).div(2.0f);
|
|
||||||
+ FloatVector rDiff = reds.sub(compReds);
|
|
||||||
+ FloatVector gDiff = greens.sub(compGreens);
|
|
||||||
+ FloatVector bDiff = blues.sub(compBlues);
|
|
||||||
+
|
|
||||||
+ FloatVector weightR = rMean.div(256.0f).add(2);
|
|
||||||
+ FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f);
|
|
||||||
+ FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f);
|
|
||||||
+
|
|
||||||
+ FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff));
|
|
||||||
+
|
|
||||||
+ // Now we compare to the best distance we've found.
|
|
||||||
+ // This mask contains a "1" if better, and a "0" otherwise.
|
|
||||||
+ VectorMask<Float> bestDistanceMask = distance.lt(bestDistances);
|
|
||||||
+ bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances
|
|
||||||
+
|
|
||||||
+ // Update the result array
|
|
||||||
+ // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough.
|
|
||||||
+ resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ for (int j = 0; j < speciesLength; j++) {
|
|
||||||
+ int index = resultIndex.lane(j);
|
|
||||||
+ out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // For the final ones, fall back to the regular method
|
|
||||||
+ for (; i < in.length; i++) {
|
|
||||||
+ out[i] = MapPalette.matchColor(new Color(in[i], true));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
|
|
||||||
index c80faa079eca1564847070f0338fc98024639829..e632d51d3487eb4807243b6705999ad124466bf5 100644
|
|
||||||
--- a/src/main/java/org/bukkit/map/MapPalette.java
|
|
||||||
+++ b/src/main/java/org/bukkit/map/MapPalette.java
|
|
||||||
@@ -1,6 +1,7 @@
|
|
||||||
package org.bukkit.map;
|
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
+import gg.pufferfish.pufferfish.simd.SIMDDetection; // Pufferfish
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Image;
|
|
||||||
@@ -40,7 +41,7 @@ public final class MapPalette {
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
- static final Color[] colors = {
|
|
||||||
+ public static final Color[] colors = { // Pufferfish - public access
|
|
||||||
c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0),
|
|
||||||
c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29),
|
|
||||||
c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86),
|
|
||||||
@@ -211,9 +212,15 @@ public final class MapPalette {
|
|
||||||
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
|
|
||||||
|
|
||||||
byte[] result = new byte[temp.getWidth() * temp.getHeight()];
|
|
||||||
+ // Pufferfish start
|
|
||||||
+ if (!SIMDDetection.isEnabled) {
|
|
||||||
for (int i = 0; i < pixels.length; i++) {
|
|
||||||
result[i] = matchColor(new Color(pixels[i], true));
|
|
||||||
}
|
|
||||||
+ } else {
|
|
||||||
+ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result);
|
|
||||||
+ }
|
|
||||||
+ // Pufferfish end
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
||||||
index 003bece642b682985625db93cad93026352bfc66..e8ba4f1108f2548a487877027e37d81fc150e042 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
|
||||||
@@ -597,7 +597,9 @@ public final class SimplePluginManager implements PluginManager {
|
|
||||||
|
|
||||||
// Paper start
|
|
||||||
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
|
||||||
server.getLogger().log(Level.SEVERE, msg, ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
|
||||||
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
|
||||||
}
|
|
||||||
// Paper end
|
|
||||||
@@ -667,9 +669,11 @@ public final class SimplePluginManager implements PluginManager {
|
|
||||||
));
|
|
||||||
}
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
|
|
||||||
// Paper start - error reporting
|
|
||||||
String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
|
||||||
server.getLogger().log(Level.SEVERE, msg, ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish
|
|
||||||
if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
|
||||||
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
||||||
index eaefbb00e9993d54906cc8cf35cf753c0d6c7707..301e82369603f3dd6e6c1bd380da4bacacd7ef6c 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
|
||||||
@@ -336,7 +336,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
|
||||||
try {
|
|
||||||
jPlugin.setEnabled(true);
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
|
||||||
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
|
||||||
+ // Paper start - Disable plugins that fail to load
|
|
||||||
+ this.server.getPluginManager().disablePlugin(jPlugin);
|
|
||||||
+ return;
|
|
||||||
+ // Paper end
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perhaps abort here, rather than continue going, but as it stands,
|
|
||||||
@@ -361,7 +367,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
|
||||||
try {
|
|
||||||
jPlugin.setEnabled(false);
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
|
||||||
server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
|
||||||
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cloader instanceof PluginClassLoader) {
|
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
index 7e4f7cb2afbc145e532285c793573ad107bc3033..12449e18180d604e9cbbc744da74a8b222a18e1f 100644
|
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
|
||||||
@@ -50,6 +50,8 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|
||||||
private io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup classLoaderGroup; // Paper
|
|
||||||
public io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext; // Paper
|
|
||||||
|
|
||||||
+ private boolean closed = false; // Pufferfish
|
|
||||||
+
|
|
||||||
static {
|
|
||||||
ClassLoader.registerAsParallelCapable();
|
|
||||||
}
|
|
||||||
@@ -197,6 +199,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|
||||||
throw new ClassNotFoundException(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public boolean _airplane_hasClass(@NotNull String name) { return this.classes.containsKey(name); } // Pufferfish
|
|
||||||
@Override
|
|
||||||
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
|
||||||
if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
|
|
||||||
@@ -204,7 +207,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|
||||||
}
|
|
||||||
Class<?> result = classes.get(name);
|
|
||||||
|
|
||||||
- if (result == null) {
|
|
||||||
+ if (result == null && !this.closed) { // Pufferfish
|
|
||||||
String path = name.replace('.', '/').concat(".class");
|
|
||||||
JarEntry entry = jar.getJarEntry(path);
|
|
||||||
|
|
||||||
@@ -251,6 +254,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|
||||||
this.setClass(name, result); // Paper
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (result == null) throw new ClassNotFoundException(name); // Pufferfish
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -265,6 +269,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
|
||||||
// Paper end
|
|
||||||
super.close();
|
|
||||||
} finally {
|
|
||||||
+ this.closed = true; // Pufferfish
|
|
||||||
jar.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: granny <contact@granny.dev>
|
From: granny <contact@granny.dev>
|
||||||
Date: Tue, 22 Oct 2024 07:33:42 +0900
|
Date: Fri, 13 Dec 2024 07:03:22 +0900
|
||||||
Subject: [PATCH] Purpur API Changes
|
Subject: [PATCH] Purpur API Changes
|
||||||
|
|
||||||
PurpurMC
|
PurpurMC
|
||||||
@@ -25,10 +25,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index f9b44a03fe8d9a2fea2d968f4e944a6663c6f9c9..f536f8f42b99e4b7dc2e25785617837fbc405b5b 100644
|
index e29e5024fa693baae469d47fe77b57118f14627c..b0fd6c1804844f09428051952e3ac4e58f8c859c 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -151,6 +151,8 @@ tasks.jar {
|
@@ -64,6 +64,7 @@ dependencies {
|
||||||
|
apiAndDocs("net.kyori:adventure-text-logger-slf4j")
|
||||||
|
api("org.apache.logging.log4j:log4j-api:$log4jVersion")
|
||||||
|
api("org.slf4j:slf4j-api:$slf4jVersion")
|
||||||
|
+ api("io.sentry:sentry:5.4.0") // Pufferfish
|
||||||
|
|
||||||
|
implementation("org.ow2.asm:asm:9.7.1")
|
||||||
|
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
|
@@ -148,6 +149,13 @@ val generateApiVersioningFile by tasks.registering {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+// Pufferfish Start
|
||||||
|
+tasks.withType<JavaCompile> {
|
||||||
|
+ val compilerArgs = options.compilerArgs
|
||||||
|
+ compilerArgs.add("--add-modules=jdk.incubator.vector")
|
||||||
|
+}
|
||||||
|
+// Pufferfish End
|
||||||
|
+
|
||||||
|
tasks.jar {
|
||||||
|
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
|
||||||
|
into("META-INF/maven/${project.group}/${project.name}")
|
||||||
|
@@ -160,6 +168,8 @@ tasks.jar {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Javadoc> {
|
tasks.withType<Javadoc> {
|
||||||
@@ -104,7 +126,7 @@ index 4195efcfe044618052bb03dea34a4fb2ca7c44f0..8709c955bac34bc546a8e022cfac808b
|
|||||||
void close();
|
void close();
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||||
index e81d0bc309de877ed2b5da6122f55c162e9b5f10..3d663104c8e3089abdb9dc4d7309f873ac182e98 100644
|
index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..27a02f0c3261067d8e4ee6169c62cecbbfe50d42 100644
|
||||||
--- a/src/main/java/co/aikar/timings/Timings.java
|
--- a/src/main/java/co/aikar/timings/Timings.java
|
||||||
+++ b/src/main/java/co/aikar/timings/Timings.java
|
+++ b/src/main/java/co/aikar/timings/Timings.java
|
||||||
@@ -124,7 +124,7 @@ public final class Timings {
|
@@ -124,7 +124,7 @@ public final class Timings {
|
||||||
@@ -116,23 +138,17 @@ index e81d0bc309de877ed2b5da6122f55c162e9b5f10..3d663104c8e3089abdb9dc4d7309f873
|
|||||||
return timing;
|
return timing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,9 +145,11 @@ public final class Timings {
|
@@ -146,7 +146,7 @@ public final class Timings {
|
||||||
* @param enabled Should timings be reported
|
|
||||||
*/
|
*/
|
||||||
public static void setTimingsEnabled(boolean enabled) {
|
public static void setTimingsEnabled(boolean enabled) {
|
||||||
- timingsEnabled = enabled;
|
if (enabled && !warnedAboutDeprecationOnEnable) {
|
||||||
- warnAboutDeprecationOnEnable();
|
- Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||||
- reset();
|
+ //Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||||
+ // Purpur start - we don't do that here...
|
warnedAboutDeprecationOnEnable = true;
|
||||||
+ timingsEnabled = false;
|
}
|
||||||
+ //warnAboutDeprecationOnEnable();
|
|
||||||
+ //reset();
|
|
||||||
+ // Purpur end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void warnAboutDeprecationOnEnable() {
|
|
||||||
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||||
index 95d87c9dbf2b237787294dfbe7fed87a36e6dedf..9e165525c4c4c07c783ae2899e07c37ae49ec2de 100644
|
index b83e5ff7ada8771fdf27ba9807c77ba6a4ce12da..f28eec202237461cb489a2b13289d813381a25bc 100644
|
||||||
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
|
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||||
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
+++ b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||||
@@ -47,7 +47,7 @@ public class TimingsCommand extends BukkitCommand {
|
@@ -47,7 +47,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||||
@@ -144,24 +160,19 @@ index 95d87c9dbf2b237787294dfbe7fed87a36e6dedf..9e165525c4c4c07c783ae2899e07c37a
|
|||||||
this.setPermission("bukkit.command.timings");
|
this.setPermission("bukkit.command.timings");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +56,14 @@ public class TimingsCommand extends BukkitCommand {
|
@@ -57,7 +57,10 @@ public class TimingsCommand extends BukkitCommand {
|
||||||
if (!testPermission(sender)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
- if (false) {
|
if (true) {
|
||||||
- sender.sendMessage(Timings.deprecationMessage());
|
- sender.sendMessage(Timings.deprecationMessage());
|
||||||
+ // Purpur start
|
|
||||||
+ if (true) {
|
|
||||||
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
|
+ net.kyori.adventure.text.minimessage.MiniMessage mm = net.kyori.adventure.text.minimessage.MiniMessage.miniMessage();
|
||||||
+ sender.sendMessage(mm.deserialize("<gold>Purpur has removed timings to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
|
+ sender.sendMessage(mm.deserialize("<gold>Purpur has removed timings to save your performance. Please use <click:suggest_command:'/spark'><grey>/spark</grey></click> instead"));
|
||||||
+ sender.sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
|
+ sender.sendMessage(mm.deserialize("<gold>For more information, view its documentation at"));
|
||||||
+ sender.sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>"));
|
+ sender.sendMessage(mm.deserialize("<gold><click:open_url:'https://spark.lucko.me/docs/Command-Usage'>https://spark.lucko.me/docs/Command-Usage</click>")); // Purpur
|
||||||
+ return true;
|
return true;
|
||||||
+ // Purpur end
|
|
||||||
}
|
}
|
||||||
if (args.length < 1) {
|
if (args.length < 1) {
|
||||||
sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
|
@@ -118,7 +121,7 @@ public class TimingsCommand extends BukkitCommand {
|
||||||
@@ -117,7 +123,7 @@ public class TimingsCommand extends BukkitCommand {
|
|
||||||
Preconditions.checkNotNull(args, "Arguments cannot be null");
|
Preconditions.checkNotNull(args, "Arguments cannot be null");
|
||||||
Preconditions.checkNotNull(alias, "Alias cannot be null");
|
Preconditions.checkNotNull(alias, "Alias cannot be null");
|
||||||
|
|
||||||
@@ -187,6 +198,349 @@ index 023cc52a9e28e1238c7452c0f3f577f2850fd861..00b3f46ddd26ae08744d3dba211f9262
|
|||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
class DummyVersionFetcher implements VersionFetcher {
|
class DummyVersionFetcher implements VersionFetcher {
|
||||||
|
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..10310fdd53de28efb8a8250f6d3b0c8eb08fb68a
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/sentry/SentryContext.java
|
||||||
|
@@ -0,0 +1,161 @@
|
||||||
|
+package gg.pufferfish.pufferfish.sentry;
|
||||||
|
+
|
||||||
|
+import com.google.gson.Gson;
|
||||||
|
+import java.lang.reflect.Field;
|
||||||
|
+import java.lang.reflect.Modifier;
|
||||||
|
+import java.util.Map;
|
||||||
|
+import java.util.TreeMap;
|
||||||
|
+import org.apache.logging.log4j.ThreadContext;
|
||||||
|
+import org.bukkit.command.Command;
|
||||||
|
+import org.bukkit.command.CommandSender;
|
||||||
|
+import org.bukkit.entity.Player;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.player.PlayerEvent;
|
||||||
|
+import org.bukkit.plugin.Plugin;
|
||||||
|
+import org.bukkit.plugin.RegisteredListener;
|
||||||
|
+import org.jetbrains.annotations.Nullable;
|
||||||
|
+
|
||||||
|
+public class SentryContext {
|
||||||
|
+
|
||||||
|
+ private static final Gson GSON = new Gson();
|
||||||
|
+
|
||||||
|
+ public static void setPluginContext(@Nullable Plugin plugin) {
|
||||||
|
+ if (plugin != null) {
|
||||||
|
+ ThreadContext.put("pufferfishsentry_pluginname", plugin.getName());
|
||||||
|
+ ThreadContext.put("pufferfishsentry_pluginversion", plugin.getDescription().getVersion());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void removePluginContext() {
|
||||||
|
+ ThreadContext.remove("pufferfishsentry_pluginname");
|
||||||
|
+ ThreadContext.remove("pufferfishsentry_pluginversion");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void setSenderContext(@Nullable CommandSender sender) {
|
||||||
|
+ if (sender != null) {
|
||||||
|
+ ThreadContext.put("pufferfishsentry_playername", sender.getName());
|
||||||
|
+ if (sender instanceof Player player) {
|
||||||
|
+ ThreadContext.put("pufferfishsentry_playerid", player.getUniqueId().toString());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void removeSenderContext() {
|
||||||
|
+ ThreadContext.remove("pufferfishsentry_playername");
|
||||||
|
+ ThreadContext.remove("pufferfishsentry_playerid");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void setEventContext(Event event, RegisteredListener registration) {
|
||||||
|
+ setPluginContext(registration.getPlugin());
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ // Find the player that was involved with this event
|
||||||
|
+ Player player = null;
|
||||||
|
+ if (event instanceof PlayerEvent) {
|
||||||
|
+ player = ((PlayerEvent) event).getPlayer();
|
||||||
|
+ } else {
|
||||||
|
+ Class<? extends Event> eventClass = event.getClass();
|
||||||
|
+
|
||||||
|
+ Field playerField = null;
|
||||||
|
+
|
||||||
|
+ for (Field field : eventClass.getDeclaredFields()) {
|
||||||
|
+ if (field.getType().equals(Player.class)) {
|
||||||
|
+ playerField = field;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (playerField != null) {
|
||||||
|
+ playerField.setAccessible(true);
|
||||||
|
+ player = (Player) playerField.get(event);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (player != null) {
|
||||||
|
+ setSenderContext(player);
|
||||||
|
+ }
|
||||||
|
+ } catch (Exception e) {} // We can't really safely log exceptions.
|
||||||
|
+
|
||||||
|
+ ThreadContext.put("pufferfishsentry_eventdata", GSON.toJson(serializeFields(event)));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void removeEventContext() {
|
||||||
|
+ removePluginContext();
|
||||||
|
+ removeSenderContext();
|
||||||
|
+ ThreadContext.remove("pufferfishsentry_eventdata");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static Map<String, String> serializeFields(Object object) {
|
||||||
|
+ Map<String, String> fields = new TreeMap<>();
|
||||||
|
+ fields.put("_class", object.getClass().getName());
|
||||||
|
+ for (Field declaredField : object.getClass().getDeclaredFields()) {
|
||||||
|
+ try {
|
||||||
|
+ if (Modifier.isStatic(declaredField.getModifiers())) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ String fieldName = declaredField.getName();
|
||||||
|
+ if (fieldName.equals("handlers")) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ declaredField.setAccessible(true);
|
||||||
|
+ Object value = declaredField.get(object);
|
||||||
|
+ if (value != null) {
|
||||||
|
+ fields.put(fieldName, value.toString());
|
||||||
|
+ } else {
|
||||||
|
+ fields.put(fieldName, "<null>");
|
||||||
|
+ }
|
||||||
|
+ } catch (Exception e) {} // We can't really safely log exceptions.
|
||||||
|
+ }
|
||||||
|
+ return fields;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static class State {
|
||||||
|
+
|
||||||
|
+ private Plugin plugin;
|
||||||
|
+ private Command command;
|
||||||
|
+ private String commandLine;
|
||||||
|
+ private Event event;
|
||||||
|
+ private RegisteredListener registeredListener;
|
||||||
|
+
|
||||||
|
+ public Plugin getPlugin() {
|
||||||
|
+ return plugin;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setPlugin(Plugin plugin) {
|
||||||
|
+ this.plugin = plugin;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Command getCommand() {
|
||||||
|
+ return command;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setCommand(Command command) {
|
||||||
|
+ this.command = command;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public String getCommandLine() {
|
||||||
|
+ return commandLine;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setCommandLine(String commandLine) {
|
||||||
|
+ this.commandLine = commandLine;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Event getEvent() {
|
||||||
|
+ return event;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setEvent(Event event) {
|
||||||
|
+ this.event = event;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public RegisteredListener getRegisteredListener() {
|
||||||
|
+ return registeredListener;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setRegisteredListener(RegisteredListener registeredListener) {
|
||||||
|
+ this.registeredListener = registeredListener;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..3441cdad70da1bd523c5933b1a914688718c2657
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDChecker.java
|
||||||
|
@@ -0,0 +1,40 @@
|
||||||
|
+package gg.pufferfish.pufferfish.simd;
|
||||||
|
+
|
||||||
|
+import java.util.logging.Level;
|
||||||
|
+import java.util.logging.Logger;
|
||||||
|
+import jdk.incubator.vector.FloatVector;
|
||||||
|
+import jdk.incubator.vector.IntVector;
|
||||||
|
+import jdk.incubator.vector.VectorSpecies;
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * Basically, java is annoying and we have to push this out to its own class.
|
||||||
|
+ */
|
||||||
|
+@Deprecated
|
||||||
|
+public class SIMDChecker {
|
||||||
|
+
|
||||||
|
+ @Deprecated
|
||||||
|
+ public static boolean canEnable(Logger logger) {
|
||||||
|
+ try {
|
||||||
|
+ if (SIMDDetection.getJavaVersion() < 17 || SIMDDetection.getJavaVersion() > 21) {
|
||||||
|
+ return false;
|
||||||
|
+ } else {
|
||||||
|
+ SIMDDetection.testRun = true;
|
||||||
|
+
|
||||||
|
+ VectorSpecies<Integer> ISPEC = IntVector.SPECIES_PREFERRED;
|
||||||
|
+ VectorSpecies<Float> FSPEC = FloatVector.SPECIES_PREFERRED;
|
||||||
|
+
|
||||||
|
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + ISPEC.vectorBitSize() + " bits (int)");
|
||||||
|
+ logger.log(Level.INFO, "Max SIMD vector size on this system is " + FSPEC.vectorBitSize() + " bits (float)");
|
||||||
|
+
|
||||||
|
+ if (ISPEC.elementSize() < 2 || FSPEC.elementSize() < 2) {
|
||||||
|
+ logger.log(Level.WARNING, "SIMD is not properly supported on this system!");
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+ } catch (NoClassDefFoundError | Exception ignored) {} // Basically, we don't do anything. This lets us detect if it's not functional and disable it.
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..a84889d3e9cfc4d7ab5f867820a6484c6070711b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/SIMDDetection.java
|
||||||
|
@@ -0,0 +1,35 @@
|
||||||
|
+package gg.pufferfish.pufferfish.simd;
|
||||||
|
+
|
||||||
|
+import java.util.logging.Logger;
|
||||||
|
+
|
||||||
|
+@Deprecated
|
||||||
|
+public class SIMDDetection {
|
||||||
|
+
|
||||||
|
+ public static boolean isEnabled = false;
|
||||||
|
+ public static boolean versionLimited = false;
|
||||||
|
+ public static boolean testRun = false;
|
||||||
|
+
|
||||||
|
+ @Deprecated
|
||||||
|
+ public static boolean canEnable(Logger logger) {
|
||||||
|
+ try {
|
||||||
|
+ return SIMDChecker.canEnable(logger);
|
||||||
|
+ } catch (NoClassDefFoundError | Exception ignored) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Deprecated
|
||||||
|
+ public static int getJavaVersion() {
|
||||||
|
+ // https://stackoverflow.com/a/2591122
|
||||||
|
+ String version = System.getProperty("java.version");
|
||||||
|
+ if(version.startsWith("1.")) {
|
||||||
|
+ version = version.substring(2, 3);
|
||||||
|
+ } else {
|
||||||
|
+ int dot = version.indexOf(".");
|
||||||
|
+ if(dot != -1) { version = version.substring(0, dot); }
|
||||||
|
+ }
|
||||||
|
+ version = version.split("-")[0]; // Azul is stupid
|
||||||
|
+ return Integer.parseInt(version);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..ae2464920c9412ac90b819a540ee58be0741465f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/gg/pufferfish/pufferfish/simd/VectorMapPalette.java
|
||||||
|
@@ -0,0 +1,83 @@
|
||||||
|
+package gg.pufferfish.pufferfish.simd;
|
||||||
|
+
|
||||||
|
+import java.awt.Color;
|
||||||
|
+import jdk.incubator.vector.FloatVector;
|
||||||
|
+import jdk.incubator.vector.IntVector;
|
||||||
|
+import jdk.incubator.vector.VectorMask;
|
||||||
|
+import jdk.incubator.vector.VectorSpecies;
|
||||||
|
+import org.bukkit.map.MapPalette;
|
||||||
|
+
|
||||||
|
+@Deprecated
|
||||||
|
+public class VectorMapPalette {
|
||||||
|
+
|
||||||
|
+ private static final VectorSpecies<Integer> I_SPEC = IntVector.SPECIES_PREFERRED;
|
||||||
|
+ private static final VectorSpecies<Float> F_SPEC = FloatVector.SPECIES_PREFERRED;
|
||||||
|
+
|
||||||
|
+ @Deprecated
|
||||||
|
+ public static void matchColorVectorized(int[] in, byte[] out) {
|
||||||
|
+ int speciesLength = I_SPEC.length();
|
||||||
|
+ int i;
|
||||||
|
+ for (i = 0; i < in.length - speciesLength; i += speciesLength) {
|
||||||
|
+ float[] redsArr = new float[speciesLength];
|
||||||
|
+ float[] bluesArr = new float[speciesLength];
|
||||||
|
+ float[] greensArr = new float[speciesLength];
|
||||||
|
+ int[] alphasArr = new int[speciesLength];
|
||||||
|
+
|
||||||
|
+ for (int j = 0; j < speciesLength; j++) {
|
||||||
|
+ alphasArr[j] = (in[i + j] >> 24) & 0xFF;
|
||||||
|
+ redsArr[j] = (in[i + j] >> 16) & 0xFF;
|
||||||
|
+ greensArr[j] = (in[i + j] >> 8) & 0xFF;
|
||||||
|
+ bluesArr[j] = (in[i + j] >> 0) & 0xFF;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ IntVector alphas = IntVector.fromArray(I_SPEC, alphasArr, 0);
|
||||||
|
+ FloatVector reds = FloatVector.fromArray(F_SPEC, redsArr, 0);
|
||||||
|
+ FloatVector greens = FloatVector.fromArray(F_SPEC, greensArr, 0);
|
||||||
|
+ FloatVector blues = FloatVector.fromArray(F_SPEC, bluesArr, 0);
|
||||||
|
+ IntVector resultIndex = IntVector.zero(I_SPEC);
|
||||||
|
+ VectorMask<Integer> modificationMask = VectorMask.fromLong(I_SPEC, 0xffffffff);
|
||||||
|
+
|
||||||
|
+ modificationMask = modificationMask.and(alphas.lt(128).not());
|
||||||
|
+ FloatVector bestDistances = FloatVector.broadcast(F_SPEC, Float.MAX_VALUE);
|
||||||
|
+
|
||||||
|
+ for (int c = 4; c < MapPalette.colors.length; c++) {
|
||||||
|
+ // We're using 32-bit floats here because it's 2x faster and nobody will know the difference.
|
||||||
|
+ // For correctness, the original algorithm uses 64-bit floats instead. Completely unnecessary.
|
||||||
|
+ FloatVector compReds = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getRed());
|
||||||
|
+ FloatVector compGreens = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getGreen());
|
||||||
|
+ FloatVector compBlues = FloatVector.broadcast(F_SPEC, MapPalette.colors[c].getBlue());
|
||||||
|
+
|
||||||
|
+ FloatVector rMean = reds.add(compReds).div(2.0f);
|
||||||
|
+ FloatVector rDiff = reds.sub(compReds);
|
||||||
|
+ FloatVector gDiff = greens.sub(compGreens);
|
||||||
|
+ FloatVector bDiff = blues.sub(compBlues);
|
||||||
|
+
|
||||||
|
+ FloatVector weightR = rMean.div(256.0f).add(2);
|
||||||
|
+ FloatVector weightG = FloatVector.broadcast(F_SPEC, 4.0f);
|
||||||
|
+ FloatVector weightB = FloatVector.broadcast(F_SPEC, 255.0f).sub(rMean).div(256.0f).add(2.0f);
|
||||||
|
+
|
||||||
|
+ FloatVector distance = weightR.mul(rDiff).mul(rDiff).add(weightG.mul(gDiff).mul(gDiff)).add(weightB.mul(bDiff).mul(bDiff));
|
||||||
|
+
|
||||||
|
+ // Now we compare to the best distance we've found.
|
||||||
|
+ // This mask contains a "1" if better, and a "0" otherwise.
|
||||||
|
+ VectorMask<Float> bestDistanceMask = distance.lt(bestDistances);
|
||||||
|
+ bestDistances = bestDistances.blend(distance, bestDistanceMask); // Update the best distances
|
||||||
|
+
|
||||||
|
+ // Update the result array
|
||||||
|
+ // We also AND with the modification mask because we don't want to interfere if the alpha value isn't large enough.
|
||||||
|
+ resultIndex = resultIndex.blend(c, bestDistanceMask.cast(I_SPEC).and(modificationMask)); // Update the results
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (int j = 0; j < speciesLength; j++) {
|
||||||
|
+ int index = resultIndex.lane(j);
|
||||||
|
+ out[i + j] = (byte) (index < 128 ? index : -129 + (index - 127));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // For the final ones, fall back to the regular method
|
||||||
|
+ for (; i < in.length; i++) {
|
||||||
|
+ out[i] = MapPalette.matchColor(new Color(in[i], true));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfo.java b/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||||
index 652ff54e7c50412503725d628bfe72ed03059790..7196594e07af19a14c320d77df893978525fe386 100644
|
index 652ff54e7c50412503725d628bfe72ed03059790..7196594e07af19a14c320d77df893978525fe386 100644
|
||||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
--- a/src/main/java/io/papermc/paper/ServerBuildInfo.java
|
||||||
@@ -213,10 +567,10 @@ index 652ff54e7c50412503725d628bfe72ed03059790..7196594e07af19a14c320d77df893978
|
|||||||
* Gets the {@code ServerBuildInfo}.
|
* Gets the {@code ServerBuildInfo}.
|
||||||
*
|
*
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||||
index e20e4239a5a1f952e1c70e899549989d5e42f73c..3a71f8fe73a2309f57cb06dedf204d3e37b46b03 100644
|
index 8ab94f8189ebd9d4158231871abdebec399deb2c..db453d04efb00baaeabb904a7bd1b99dd0a50735 100644
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -2921,4 +2921,127 @@ public final class Bukkit {
|
@@ -2968,4 +2968,127 @@ public final class Bukkit {
|
||||||
public static Server.Spigot spigot() {
|
public static Server.Spigot spigot() {
|
||||||
return server.spigot();
|
return server.spigot();
|
||||||
}
|
}
|
||||||
@@ -427,13 +781,13 @@ index 918a045165cdcde264bc24082b7afebb407271de..e98d6321c5f2cdde91b54f8a74cbcc04
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
|
||||||
index 77a15a99e441bd81650806142581bd5b24f30e10..3ec2154956087a370799f0fa485f3b6cae894c69 100644
|
index 028ac35df6c4d044d07b3869751736d418c1eb0e..95c1f331f364c5fafa100860f3c9674f18888714 100644
|
||||||
--- a/src/main/java/org/bukkit/Material.java
|
--- a/src/main/java/org/bukkit/Material.java
|
||||||
+++ b/src/main/java/org/bukkit/Material.java
|
+++ b/src/main/java/org/bukkit/Material.java
|
||||||
@@ -5636,4 +5636,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
@@ -5840,4 +5840,40 @@ public enum Material implements Keyed, Translatable, net.kyori.adventure.transla
|
||||||
public BlockType asBlockType() {
|
return this.asItemType().getDefaultDataTypes();
|
||||||
return blockType.get();
|
|
||||||
}
|
}
|
||||||
|
// Paper end - data component API
|
||||||
+
|
+
|
||||||
+ // Purpur start
|
+ // Purpur start
|
||||||
+ public boolean isArmor() {
|
+ public boolean isArmor() {
|
||||||
@@ -472,7 +826,7 @@ index 77a15a99e441bd81650806142581bd5b24f30e10..3ec2154956087a370799f0fa485f3b6c
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||||
index a028f2fe541491729856051780b33dba07832fb6..fc64902368a068481f16d5db99c94386caf6b60b 100644
|
index 5622fe3165baad8138c22cfc016ed6c3834cf702..6d31b561d915180fcd473b317721064feed28f37 100644
|
||||||
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
--- a/src/main/java/org/bukkit/OfflinePlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
|
||||||
@@ -573,4 +573,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
@@ -573,4 +573,106 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
|
||||||
@@ -583,10 +937,10 @@ index a028f2fe541491729856051780b33dba07832fb6..fc64902368a068481f16d5db99c94386
|
|||||||
+ // Purpur end - OfflinePlayer API
|
+ // Purpur end - OfflinePlayer API
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index 6246251caf2c6f025c824b8e7a944b8d48751fa1..eb29794f6ca2efc9cde4dd1685822f9a3a73f3b9 100644
|
index ad816538b30079c62d5e1eb98c6f4b61e12e8d47..fcfad39173ecf2573a1ba77236bce8d9f73e02bb 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2265,6 +2265,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -2283,6 +2283,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
@@ -605,10 +959,10 @@ index 6246251caf2c6f025c824b8e7a944b8d48751fa1..eb29794f6ca2efc9cde4dd1685822f9a
|
|||||||
/**
|
/**
|
||||||
* Sends the component to the player
|
* Sends the component to the player
|
||||||
*
|
*
|
||||||
@@ -2554,4 +2566,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -2607,4 +2619,105 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
*/
|
*/
|
||||||
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
|
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||||
// Paper end - Folia region threading API
|
// Paper end - API to check if the server is sleeping
|
||||||
+
|
+
|
||||||
+ // Purpur start
|
+ // Purpur start
|
||||||
+ /**
|
+ /**
|
||||||
@@ -712,10 +1066,10 @@ index 6246251caf2c6f025c824b8e7a944b8d48751fa1..eb29794f6ca2efc9cde4dd1685822f9a
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||||
index ef32a937e6faf1e8a5d6b1207986715bae5a246c..36cf567973900d1e472616748926aecb9afcb42f 100644
|
index bef54a6c8290e09cbaac20b03dde8dfb902c96b0..5f7de23e419175e55459df760c7190639ea39f18 100644
|
||||||
--- a/src/main/java/org/bukkit/World.java
|
--- a/src/main/java/org/bukkit/World.java
|
||||||
+++ b/src/main/java/org/bukkit/World.java
|
+++ b/src/main/java/org/bukkit/World.java
|
||||||
@@ -4209,6 +4209,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
@@ -4246,6 +4246,86 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||||
@Nullable
|
@Nullable
|
||||||
public DragonBattle getEnderDragonBattle();
|
public DragonBattle getEnderDragonBattle();
|
||||||
|
|
||||||
@@ -898,7 +1252,7 @@ index e64bb57f74e6d6f78927be228825b3e0bdf41f48..c880d0010849ab733ad13bbd18fab3c8
|
|||||||
);
|
);
|
||||||
this.versionMessage = Component.text()
|
this.versionMessage = Component.text()
|
||||||
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
||||||
index 455ff52d90565838fe7640c3f045b27082a6c2f1..45f5493eebfecf56b7c0ef4659c078dfc62c0612 100644
|
index 6fcc15d588239481136876d117ab346a8deac1dd..13b903e785a9ef5e513cb9d6483482133cc5f25b 100644
|
||||||
--- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
--- a/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
||||||
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
+++ b/src/main/java/org/bukkit/enchantments/EnchantmentTarget.java
|
||||||
@@ -227,6 +227,28 @@ public enum EnchantmentTarget {
|
@@ -227,6 +227,28 @@ public enum EnchantmentTarget {
|
||||||
@@ -931,7 +1285,7 @@ index 455ff52d90565838fe7640c3f045b27082a6c2f1..45f5493eebfecf56b7c0ef4659c078df
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
diff --git a/src/main/java/org/bukkit/entity/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java
|
diff --git a/src/main/java/org/bukkit/entity/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java
|
||||||
index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c6f2883d1 100644
|
index 7b379fb21e800a766ad022705a12dff6d42279ab..10a8d64ad2da0be2c14f34c3e7d1957c6f2883d1 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Endermite.java
|
--- a/src/main/java/org/bukkit/entity/Endermite.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/Endermite.java
|
+++ b/src/main/java/org/bukkit/entity/Endermite.java
|
||||||
@@ -3,25 +3,21 @@ package org.bukkit.entity;
|
@@ -3,25 +3,21 @@ package org.bukkit.entity;
|
||||||
@@ -947,7 +1301,7 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c
|
|||||||
* @return player spawned status
|
* @return player spawned status
|
||||||
- * @deprecated this functionality no longer exists
|
- * @deprecated this functionality no longer exists
|
||||||
*/
|
*/
|
||||||
- @Deprecated
|
- @Deprecated(since = "1.17")
|
||||||
boolean isPlayerSpawned();
|
boolean isPlayerSpawned();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -960,12 +1314,12 @@ index 138d2530de2410f4a9424dabd3e5ce0cd1c1dcd2..10a8d64ad2da0be2c14f34c3e7d1957c
|
|||||||
* @param playerSpawned player spawned status
|
* @param playerSpawned player spawned status
|
||||||
- * @deprecated this functionality no longer exists
|
- * @deprecated this functionality no longer exists
|
||||||
*/
|
*/
|
||||||
- @Deprecated
|
- @Deprecated(since = "1.17")
|
||||||
void setPlayerSpawned(boolean playerSpawned);
|
void setPlayerSpawned(boolean playerSpawned);
|
||||||
// Paper start
|
// Paper start
|
||||||
/**
|
/**
|
||||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||||
index d0ae8a94db20281d3664d74718c65234eb2e5f83..b7d53973ac4e829a03821d59e0b3a28d6f6a4373 100644
|
index 19272cff8d6d040e95b2644d70acdac606e06c16..076fe310d500ebb52e705a3a69e895061702f470 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||||
@@ -1172,4 +1172,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
@@ -1172,4 +1172,55 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||||
@@ -1117,7 +1471,7 @@ index bcc6ba95bd21c7972865838c636a03f50b6c1f1a..c3fcd8dd7dbb1e1a18e17c014c1e6411
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
index 68c08e7a212bc3e3885f9b5a4d9aef85fcb3b029..a22909446b7193b1de121bdd6d7b6fbf81dc3be4 100644
|
index d21a228bbec0302e75c4db5aa1db54f321143587..a4acc3578e935cd1174474bd1f6ff14db4294fe7 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
@@ -1468,4 +1468,20 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
@@ -1468,4 +1468,20 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||||
@@ -1167,10 +1521,10 @@ index bc84b892cae5fe7019a3ad481e9da79956efa1fe..48eb5b00c460cccde29d327cef1d63fc
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||||
index 8086acceacbceb2c5a7228fff005e41a86d37008..65260b33a13858309356d573dfa2989b92e7437c 100644
|
index fac4aec289e07231d80a9890653432f688355afa..6f7f1fc3db0237021fa1bd0f11fe56b2d6d4f84a 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||||
@@ -3871,4 +3871,123 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
@@ -3911,4 +3911,123 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||||
*/
|
*/
|
||||||
void sendEntityEffect(org.bukkit.@NotNull EntityEffect effect, @NotNull Entity target);
|
void sendEntityEffect(org.bukkit.@NotNull EntityEffect effect, @NotNull Entity target);
|
||||||
// Paper end - entity effect API
|
// Paper end - entity effect API
|
||||||
@@ -1389,10 +1743,10 @@ index c73489f4b745bc84501ce94f0227b034d9768eae..a97129e71f16ec691759add664bdfd35
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||||
index ef5b2a0f18c1c126db0b0c4a4d2a57483680665a..e6c8ffc2583af754eaedc55160ef45c61c22e213 100644
|
index d1a5424ff3b289f1c82449ef6d88eb52665df41b..f23b0c250f88926c147af0314b5c4d23c5f8dbae 100644
|
||||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||||
@@ -307,7 +307,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
@@ -308,7 +308,8 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||||
WORLD_BORDER,
|
WORLD_BORDER,
|
||||||
/**
|
/**
|
||||||
* Damage caused when an entity contacts a block such as a Cactus,
|
* Damage caused when an entity contacts a block such as a Cactus,
|
||||||
@@ -1420,7 +1774,7 @@ index 8fdfcbc7d20fe0af6b220ab94516247093637621..f6a8928408e11a5ae723366e4ea1280d
|
|||||||
* When a player gets bad omen after killing a patrol captain.
|
* When a player gets bad omen after killing a patrol captain.
|
||||||
*
|
*
|
||||||
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||||
index 7184f80899206bedeac387e9f8a35482801efd4b..e4197c89c04b91732ce96981f8df0a0bdaee24ce 100644
|
index 81118a91c2e22e02a1f774d1cc4d3e97064087ce..3ac1e4a821a5b48d3936222cbfddadd3b803deef 100644
|
||||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
--- a/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
+++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java
|
||||||
@@ -164,7 +164,7 @@ public enum InventoryType {
|
@@ -164,7 +164,7 @@ public enum InventoryType {
|
||||||
@@ -1480,7 +1834,7 @@ index f1f97a85ec713c05c882d7588f4a3e4a017f4795..813f6cd253322538bdf96eb323dd23a7
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..4414381ac942c040480d53b03565b160eb85c444 100644
|
index 8c9654cd19af8b28fa276a55c5060eb389e60c1c..875124b06d87cd4163f0ab1d4dd75f939622f8aa 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
@@ -19,6 +19,13 @@ import org.bukkit.inventory.meta.ItemMeta;
|
@@ -19,6 +19,13 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||||
@@ -1497,10 +1851,10 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..4414381ac942c040480d53b03565b160
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a stack of items.
|
* Represents a stack of items.
|
||||||
@@ -1137,4 +1144,482 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
@@ -1318,4 +1325,482 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
||||||
return Bukkit.getUnsafe().computeTooltipLines(this, tooltipContext, player);
|
return this.craftDelegate.matchesWithoutData(item, excludeTypes, ignoreCount);
|
||||||
}
|
}
|
||||||
// Paper end - expose itemstack tooltip lines
|
// Paper end - data component API
|
||||||
+
|
+
|
||||||
+ // Purpur start
|
+ // Purpur start
|
||||||
+ /**
|
+ /**
|
||||||
@@ -1981,7 +2335,7 @@ index b59222b8c262545d100a9fd28b3bf1d2a4cf4eb0..4414381ac942c040480d53b03565b160
|
|||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
||||||
index f1aa67997f904953742e8895e49341c2f73d44a2..993cf7995514fb0ef3c4388bb3ce49c3187ab251 100644
|
index 922bb69b5f218e489a6dd5e0f207743c1f1d3d35..9b3e292be334d21eb978373f434bf3811ec4af2b 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
--- a/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
||||||
+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
+++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java
|
||||||
@@ -191,6 +191,7 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
@@ -191,6 +191,7 @@ public interface RecipeChoice extends Predicate<ItemStack>, Cloneable {
|
||||||
@@ -2057,6 +2411,43 @@ index 3c1aa1e036bee08304c1cdca59f6a5bc0ba306c0..709fb2d1c7e3253034a651a9f68c0036
|
|||||||
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
|
+ void setDoUnsafeEnchants(boolean canDoUnsafeEnchants);
|
||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/map/MapPalette.java b/src/main/java/org/bukkit/map/MapPalette.java
|
||||||
|
index 6995f9cc08d162e3adcd3a28f6bfa6d329661999..b9edb96fc5bac8793477657dbb45ccf98ab17f27 100644
|
||||||
|
--- a/src/main/java/org/bukkit/map/MapPalette.java
|
||||||
|
+++ b/src/main/java/org/bukkit/map/MapPalette.java
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
package org.bukkit.map;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
+import gg.pufferfish.pufferfish.simd.SIMDDetection; // Pufferfish
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Image;
|
||||||
|
@@ -45,7 +46,7 @@ public final class MapPalette {
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
- static final Color[] colors = {
|
||||||
|
+ public static final Color[] colors = { // Pufferfish - public access
|
||||||
|
c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0), c(0, 0, 0, 0),
|
||||||
|
c(89, 125, 39), c(109, 153, 48), c(127, 178, 56), c(67, 94, 29),
|
||||||
|
c(174, 164, 115), c(213, 201, 140), c(247, 233, 163), c(130, 123, 86),
|
||||||
|
@@ -216,9 +217,15 @@ public final class MapPalette {
|
||||||
|
temp.getRGB(0, 0, temp.getWidth(), temp.getHeight(), pixels, 0, temp.getWidth());
|
||||||
|
|
||||||
|
byte[] result = new byte[temp.getWidth() * temp.getHeight()];
|
||||||
|
+ // Pufferfish start
|
||||||
|
+ if (!SIMDDetection.isEnabled) {
|
||||||
|
for (int i = 0; i < pixels.length; i++) {
|
||||||
|
result[i] = matchColor(new Color(pixels[i], true));
|
||||||
|
}
|
||||||
|
+ } else {
|
||||||
|
+ gg.pufferfish.pufferfish.simd.VectorMapPalette.matchColorVectorized(pixels, result);
|
||||||
|
+ }
|
||||||
|
+ // Pufferfish end
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/map/MapRenderer.java b/src/main/java/org/bukkit/map/MapRenderer.java
|
diff --git a/src/main/java/org/bukkit/map/MapRenderer.java b/src/main/java/org/bukkit/map/MapRenderer.java
|
||||||
index cb7040876a99a5a7e49b81684ef0f3b79584c376..22d8f31b1b8a5dbb5ab3275068642937c097abfe 100644
|
index cb7040876a99a5a7e49b81684ef0f3b79584c376..22d8f31b1b8a5dbb5ab3275068642937c097abfe 100644
|
||||||
--- a/src/main/java/org/bukkit/map/MapRenderer.java
|
--- a/src/main/java/org/bukkit/map/MapRenderer.java
|
||||||
@@ -2096,8 +2487,34 @@ index 75b77cc4fe189b4b6baa1af3663dc492e992a266..30b98d1645c571ba5c18e5cc93b0bec3
|
|||||||
String lname = name.toLowerCase(Locale.ROOT);
|
String lname = name.toLowerCase(Locale.ROOT);
|
||||||
|
|
||||||
permissions.put(lname, new PermissionAttachmentInfo(parent, lname, attachment, value));
|
permissions.put(lname, new PermissionAttachmentInfo(parent, lname, attachment, value));
|
||||||
|
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
|
index 001465eedafa51ac027a4db51cba6223edfe1171..2e6d62c4f3687e299c34e876c503b400e13be05a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
|
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
|
@@ -597,7 +597,9 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
private void handlePluginException(String msg, Throwable ex, Plugin plugin) {
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
||||||
|
server.getLogger().log(Level.SEVERE, msg, ex);
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
||||||
|
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerPluginEnableDisableException(msg, ex, plugin)));
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
@@ -667,9 +669,11 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.setEventContext(event, registration); // Pufferfish
|
||||||
|
// Paper start - error reporting
|
||||||
|
String msg = "Could not pass event " + event.getEventName() + " to " + registration.getPlugin().getDescription().getFullName();
|
||||||
|
server.getLogger().log(Level.SEVERE, msg, ex);
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.removeEventContext(); // Pufferfish
|
||||||
|
if (!(event instanceof com.destroystokyo.paper.event.server.ServerExceptionEvent)) { // We don't want to cause an endless event loop
|
||||||
|
callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerEventException(msg, ex, registration.getPlugin(), registration.getListener(), event)));
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||||
index 301e82369603f3dd6e6c1bd380da4bacacd7ef6c..0c6ca7588fb3d6b6497ddf032fe75e5c6c9719e5 100644
|
index b412aaf08901d169ac9fc89b36f9d6ccb95c53d3..e2b631fc160f13ea6e27b69f835bbdf83d6d3dec 100644
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||||
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
+++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java
|
||||||
@@ -55,6 +55,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
@@ -55,6 +55,7 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
@@ -2108,6 +2525,30 @@ index 301e82369603f3dd6e6c1bd380da4bacacd7ef6c..0c6ca7588fb3d6b6497ddf032fe75e5c
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This class was not meant to be constructed explicitly
|
* This class was not meant to be constructed explicitly
|
||||||
|
@@ -336,7 +337,13 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
|
try {
|
||||||
|
jPlugin.setEnabled(true);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
||||||
|
server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
||||||
|
+ // Paper start - Disable plugins that fail to load
|
||||||
|
+ this.server.getPluginManager().disablePlugin(jPlugin);
|
||||||
|
+ return;
|
||||||
|
+ // Paper end
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perhaps abort here, rather than continue going, but as it stands,
|
||||||
|
@@ -361,7 +368,9 @@ public final class JavaPluginLoader implements PluginLoader {
|
||||||
|
try {
|
||||||
|
jPlugin.setEnabled(false);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.setPluginContext(plugin); // Pufferfish
|
||||||
|
server.getLogger().log(Level.SEVERE, "Error occurred while disabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex);
|
||||||
|
+ gg.pufferfish.pufferfish.sentry.SentryContext.removePluginContext(); // Pufferfish
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cloader instanceof PluginClassLoader) {
|
||||||
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
diff --git a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java b/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||||
index c66252802c51174bc26f266cb5cdecdd856ff220..97f580fccd06a8db5f592a53c8b95a7a6159adac 100644
|
index c66252802c51174bc26f266cb5cdecdd856ff220..97f580fccd06a8db5f592a53c8b95a7a6159adac 100644
|
||||||
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
--- a/src/main/java/org/bukkit/plugin/java/LibraryLoader.java
|
||||||
@@ -2136,6 +2577,52 @@ index c66252802c51174bc26f266cb5cdecdd856ff220..97f580fccd06a8db5f592a53c8b95a7a
|
|||||||
logger.log( Level.INFO, "[{0}] Loaded library {1}", new Object[]
|
logger.log( Level.INFO, "[{0}] Loaded library {1}", new Object[]
|
||||||
{
|
{
|
||||||
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix
|
java.util.Objects.requireNonNullElseGet(desc.getPrefix(), desc::getName), file // Paper - use configured log prefix
|
||||||
|
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||||
|
index 7e4f7cb2afbc145e532285c793573ad107bc3033..12449e18180d604e9cbbc744da74a8b222a18e1f 100644
|
||||||
|
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||||
|
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
|
||||||
|
@@ -50,6 +50,8 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||||
|
private io.papermc.paper.plugin.provider.classloader.PluginClassLoaderGroup classLoaderGroup; // Paper
|
||||||
|
public io.papermc.paper.plugin.provider.entrypoint.DependencyContext dependencyContext; // Paper
|
||||||
|
|
||||||
|
+ private boolean closed = false; // Pufferfish
|
||||||
|
+
|
||||||
|
static {
|
||||||
|
ClassLoader.registerAsParallelCapable();
|
||||||
|
}
|
||||||
|
@@ -197,6 +199,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||||
|
throw new ClassNotFoundException(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public boolean _airplane_hasClass(@NotNull String name) { return this.classes.containsKey(name); } // Pufferfish
|
||||||
|
@Override
|
||||||
|
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||||
|
if (name.startsWith("org.bukkit.") || name.startsWith("net.minecraft.")) {
|
||||||
|
@@ -204,7 +207,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||||
|
}
|
||||||
|
Class<?> result = classes.get(name);
|
||||||
|
|
||||||
|
- if (result == null) {
|
||||||
|
+ if (result == null && !this.closed) { // Pufferfish
|
||||||
|
String path = name.replace('.', '/').concat(".class");
|
||||||
|
JarEntry entry = jar.getJarEntry(path);
|
||||||
|
|
||||||
|
@@ -251,6 +254,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||||
|
this.setClass(name, result); // Paper
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (result == null) throw new ClassNotFoundException(name); // Pufferfish
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -265,6 +269,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
|
||||||
|
// Paper end
|
||||||
|
super.close();
|
||||||
|
} finally {
|
||||||
|
+ this.closed = true; // Pufferfish
|
||||||
|
jar.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
|
diff --git a/src/main/java/org/bukkit/util/permissions/CommandPermissions.java b/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
|
||||||
index 7763d6101ac61900db1e2310966b99584539fd0e..d5a42707d365ffd72532bbb1a59a1ca7145f9918 100644
|
index 7763d6101ac61900db1e2310966b99584539fd0e..d5a42707d365ffd72532bbb1a59a1ca7145f9918 100644
|
||||||
--- a/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
|
--- a/src/main/java/org/bukkit/util/permissions/CommandPermissions.java
|
||||||
@@ -5,25 +5,25 @@ Subject: [PATCH] Use Gradle Version Catalogs
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index f536f8f42b99e4b7dc2e25785617837fbc405b5b..51ef37146672e17ac140d260fbc229bcbd4ad049 100644
|
index b0fd6c1804844f09428051952e3ac4e58f8c859c..2b668f8a5c245d024e03c94b7d8872448f1929cf 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -9,11 +9,13 @@ java {
|
@@ -9,11 +9,13 @@ java {
|
||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
+/* // Plazma - Use Gradle Versuib Catalogs
|
+/* // Plazma - Use Gradle Version Catalogs
|
||||||
val annotationsVersion = "24.1.0"
|
val annotationsVersion = "24.1.0"
|
||||||
val bungeeCordChatVersion = "1.20-R0.2"
|
val bungeeCordChatVersion = "1.20-R0.2"
|
||||||
val adventureVersion = "4.17.0"
|
val adventureVersion = "4.17.0"
|
||||||
val slf4jVersion = "2.0.9"
|
val slf4jVersion = "2.0.9"
|
||||||
val log4jVersion = "2.17.1"
|
val log4jVersion = "2.17.1"
|
||||||
+ */
|
+ */ // Plazma - Use Gradle Version Catalogs
|
||||||
val apiAndDocs: Configuration by configurations.creating {
|
val apiAndDocs: Configuration by configurations.creating {
|
||||||
attributes {
|
attributes {
|
||||||
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
|
||||||
@@ -27,57 +29,29 @@ configurations.api {
|
@@ -39,58 +41,30 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||||
}
|
// Paper end - configure mockito agent that is needed in newer java versions
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
- api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api
|
- api("com.mojang:brigadier:1.2.9") // Paper - Brigadier command api
|
||||||
@@ -77,33 +77,35 @@ index f536f8f42b99e4b7dc2e25785617837fbc405b5b..51ef37146672e17ac140d260fbc229bc
|
|||||||
- testImplementation("org.hamcrest:hamcrest:2.2")
|
- testImplementation("org.hamcrest:hamcrest:2.2")
|
||||||
- testImplementation("org.mockito:mockito-core:5.14.1")
|
- testImplementation("org.mockito:mockito-core:5.14.1")
|
||||||
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
|
- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions
|
||||||
+ // Plazma start - Use Gradle Version Catalogs
|
+ // Plazma start - Use Gradle Version Catalogs
|
||||||
+ implementation(common.bundles.asm)
|
|
||||||
+
|
|
||||||
+ api(api.bundles.api)
|
+ api(api.bundles.api)
|
||||||
+ api(common.snakeyaml)
|
|
||||||
+ api(common.log4j.api)
|
|
||||||
+ api(common.maven.provider)
|
|
||||||
+ api(api.jsonsimple) { isTransitive = false }
|
|
||||||
+ api(api.bungeechat) { exclude("com.google.guava", "guava") }
|
+ api(api.bungeechat) { exclude("com.google.guava", "guava") }
|
||||||
|
+ api(common.snakeyaml)
|
||||||
|
+ api(api.jsonsimple) { isTransitive = false }
|
||||||
+ apiAndDocs(platform(common.adventure.bom))
|
+ apiAndDocs(platform(common.adventure.bom))
|
||||||
+ apiAndDocs(common.bundles.adventure)
|
+ apiAndDocs(common.bundles.adventure)
|
||||||
|
+ api(common.log4j.api)
|
||||||
|
+
|
||||||
|
+ implementation(common.bundles.asm)
|
||||||
|
+
|
||||||
|
+ api(common.mvn)
|
||||||
|
+ compileOnly(common.bundles.mvn)
|
||||||
+
|
+
|
||||||
+ compileOnly(common.bundles.maven)
|
|
||||||
+ compileOnly(api.annotations)
|
+ compileOnly(api.annotations)
|
||||||
+ compileOnlyApi(api.checkerqual)
|
+ testCompileOnly(api.annotations)
|
||||||
|
+
|
||||||
|
+ compileOnlyApi(api.checkerqual)
|
||||||
|
+ testCompileOnly(api.checkerqual)
|
||||||
+
|
+
|
||||||
+ testImplementation(common.asm.tree)
|
|
||||||
+ testImplementation(common.commons.lang3)
|
+ testImplementation(common.commons.lang3)
|
||||||
+ testImplementation(common.bundles.test)
|
+ testImplementation(common.bundles.test)
|
||||||
+
|
+ mockitoAgent(common.mockito) { isTransitive = false }
|
||||||
+ testCompileOnly(api.annotations)
|
|
||||||
+ testCompileOnly(api.checkerqual)
|
|
||||||
+ // Plazma end
|
+ // Plazma end
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
@@ -158,27 +132,24 @@ tasks.withType<Javadoc> {
|
@@ -175,27 +149,25 @@ tasks.withType<Javadoc> {
|
||||||
options.use()
|
options.use()
|
||||||
options.isDocFilesSubDirs = true
|
options.isDocFilesSubDirs = true
|
||||||
options.links(
|
options.links(
|
||||||
@@ -114,7 +116,7 @@ index f536f8f42b99e4b7dc2e25785617837fbc405b5b..51ef37146672e17ac140d260fbc229bc
|
|||||||
- // Paper start - add missing javadoc links
|
- // Paper start - add missing javadoc links
|
||||||
- "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
|
- "https://javadoc.io/doc/org.joml/joml/1.10.5/index.html",
|
||||||
- "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
|
- "https://www.javadoc.io/doc/com.google.code.gson/gson/2.10.1",
|
||||||
"https://jspecify.dev/docs/api/",
|
- "https://jspecify.dev/docs/api/",
|
||||||
- // Paper end
|
- // Paper end
|
||||||
- // Paper start
|
- // Paper start
|
||||||
- "https://jd.advntr.dev/api/$adventureVersion/",
|
- "https://jd.advntr.dev/api/$adventureVersion/",
|
||||||
@@ -129,6 +131,12 @@ index f536f8f42b99e4b7dc2e25785617837fbc405b5b..51ef37146672e17ac140d260fbc229bc
|
|||||||
- // Paper end
|
- // Paper end
|
||||||
- "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper
|
- "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/1.7.3", // Paper
|
||||||
+ // Plazma start - Use Gradle Version Catalogs
|
+ // Plazma start - Use Gradle Version Catalogs
|
||||||
|
+ "https://guava.dev/releases/${api.guava.orNull?.version}/api/docs/",
|
||||||
|
+ "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/",
|
||||||
|
+ "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/",
|
||||||
|
+ "https://javadoc.io/doc/org.joml/joml/${api.joml.orNull?.version}/index.html",
|
||||||
|
+ "https://www.javadoc.io/doc/com.google.code.gson/gson/${api.gson.orNull?.version}",
|
||||||
|
+ "https://jspecify.dev/docs/api/", //diff on change
|
||||||
+ "https://jd.advntr.dev/api/${common.adventure.api.orNull?.version}/",
|
+ "https://jd.advntr.dev/api/${common.adventure.api.orNull?.version}/",
|
||||||
+ "https://jd.advntr.dev/key/${common.adventure.api.orNull?.version}/",
|
+ "https://jd.advntr.dev/key/${common.adventure.api.orNull?.version}/",
|
||||||
+ "https://jd.advntr.dev/text-minimessage/${common.adventure.api.orNull?.version}/",
|
+ "https://jd.advntr.dev/text-minimessage/${common.adventure.api.orNull?.version}/",
|
||||||
@@ -136,14 +144,10 @@ index f536f8f42b99e4b7dc2e25785617837fbc405b5b..51ef37146672e17ac140d260fbc229bc
|
|||||||
+ "https://jd.advntr.dev/text-serializer-legacy/${common.adventure.api.orNull?.version}/",
|
+ "https://jd.advntr.dev/text-serializer-legacy/${common.adventure.api.orNull?.version}/",
|
||||||
+ "https://jd.advntr.dev/text-serializer-plain/${common.adventure.api.orNull?.version}/",
|
+ "https://jd.advntr.dev/text-serializer-plain/${common.adventure.api.orNull?.version}/",
|
||||||
+ "https://jd.advntr.dev/text-logger-slf4j/${common.adventure.api.orNull?.version}/",
|
+ "https://jd.advntr.dev/text-logger-slf4j/${common.adventure.api.orNull?.version}/",
|
||||||
+ "https://guava.dev/releases/${api.guava.orNull?.version}/api/docs/",
|
|
||||||
+ "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/",
|
+ "https://javadoc.io/doc/org.yaml/snakeyaml/${common.snakeyaml.orNull?.version}/",
|
||||||
+ "https://javadoc.io/doc/org.jetbrains/annotations/${api.annotations.orNull?.version}/",
|
+ "https://javadoc.io/doc/org.slf4j/slf4j-api/${api.slf4j.orNull?.version}/",
|
||||||
+ "https://javadoc.io/doc/org.joml/joml/${api.joml.orNull?.version}/index.html",
|
|
||||||
+ "https://www.javadoc.io/doc/com.google.code.gson/gson/${api.gson.orNull?.version}",
|
|
||||||
+ "https://javadoc.io/doc/org.slf4j/slf4j-api/${api.slf4j.api.orNull?.version}/",
|
|
||||||
+ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/${common.log4j.api.orNull?.version}/",
|
+ "https://javadoc.io/doc/org.apache.logging.log4j/log4j-api/${common.log4j.api.orNull?.version}/",
|
||||||
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/${common.maven.connector.orNull?.version}",
|
+ "https://javadoc.io/doc/org.apache.maven.resolver/maven-resolver-api/${common.mvn.connector.orNull?.version}",
|
||||||
+ // Plazma end
|
+ // Plazma end
|
||||||
)
|
)
|
||||||
options.tags("apiNote:a:API Note:")
|
options.tags("apiNote:a:API Note:")
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Plazma Configurations
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||||
index eb29794f6ca2efc9cde4dd1685822f9a3a73f3b9..d84c788fe1183833c86cde0ba8e174418cede950 100644
|
index ddb1ff894910761a78b91a343f32e129f03a03c4..bebe4116e50f0b0f64f6bdbd3f05f0b998225435 100644
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2277,6 +2277,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
@@ -2295,6 +2295,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||||
}
|
}
|
||||||
// Purpur end
|
// Purpur end
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Various API Tweaks
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||||
index be212b4fbeabab32a4dab6ae554768c368efaa88..2c08e2000fc1c2cfaae9b82c57c0f2a5079311f1 100644
|
index 41eaa8159f8c028faa118300e95f6a0fb9cfe989..76a5381a959ae4e153dba291a362f3d58aeceac9 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
--- a/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
|
||||||
@@ -584,6 +584,15 @@ public class MaterialTags {
|
@@ -584,6 +584,15 @@ public class MaterialTags {
|
||||||
File diff suppressed because it is too large
Load Diff
342
patches/api/0007-Reduce-allocations.patch
Normal file
342
patches/api/0007-Reduce-allocations.patch
Normal file
@@ -0,0 +1,342 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Mon, 4 Nov 2024 16:04:55 +0900
|
||||||
|
Subject: [PATCH] Reduce allocations
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java
|
||||||
|
index c89d6c4c38e2390cb11ffba182f8741d3726cfd1..2451f466ae6f953b01ad2cbaeac7d163f09f1c5c 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/command/brigadier/BasicCommand.java
|
||||||
|
@@ -16,6 +16,17 @@ import org.jspecify.annotations.Nullable;
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface BasicCommand {
|
||||||
|
|
||||||
|
+ // Plazma start - Reduce allocations
|
||||||
|
+ /**
|
||||||
|
+ * Executes the command with the given {@link CommandSourceStack} and arguments.
|
||||||
|
+ *
|
||||||
|
+ * @param commandSourceStack the commandSourceStack of the command
|
||||||
|
+ */
|
||||||
|
+ default void execute(CommandSourceStack commandSourceStack) {
|
||||||
|
+ this.execute(commandSourceStack, org.plazmamc.plazma.constants.Null.STRING);
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Reduce allocations
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Executes the command with the given {@link CommandSourceStack} and arguments.
|
||||||
|
*
|
||||||
|
diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java
|
||||||
|
index a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df..5bbecd907e222f9adcf726bccab63c9ef59f5c14 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Fluid.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Fluid.java
|
||||||
|
@@ -10,6 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
|
* Represents a fluid type.
|
||||||
|
*/
|
||||||
|
public interface Fluid extends OldEnum<Fluid>, Keyed {
|
||||||
|
+ Fluid[] EMPTY_ARRAY = new Fluid[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No fluid.
|
||||||
|
@@ -57,6 +58,6 @@ public interface Fluid extends OldEnum<Fluid>, Keyed {
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Fluid[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.FLUID).toArray(new Fluid[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.FLUID).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java
|
||||||
|
index 521f035409ee61a9ad73d39bec938f2938892570..6e53135579426cb677bf34a0813db8268d550428 100644
|
||||||
|
--- a/src/main/java/org/bukkit/attribute/Attribute.java
|
||||||
|
+++ b/src/main/java/org/bukkit/attribute/Attribute.java
|
||||||
|
@@ -15,6 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
|
* Types of attributes which may be present on an {@link Attributable}.
|
||||||
|
*/
|
||||||
|
public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||||
|
+ Attribute[] EMPTY_ARRAY = new Attribute[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum health of an Entity.
|
||||||
|
@@ -170,6 +171,6 @@ public interface Attribute extends OldEnum<Attribute>, Keyed, Translatable, net.
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Attribute[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.ATTRIBUTE).toArray(new Attribute[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.ATTRIBUTE).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java
|
||||||
|
index 464f8f81ba907a61588e4ab869e4f8269830195a..6d50664e76e6e7ed98ca7b311fdb368886ab65a8 100644
|
||||||
|
--- a/src/main/java/org/bukkit/block/Biome.java
|
||||||
|
+++ b/src/main/java/org/bukkit/block/Biome.java
|
||||||
|
@@ -23,6 +23,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
|
* which can be accessed via {@link Registry#BIOME}.
|
||||||
|
*/
|
||||||
|
public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||||
|
+ Biome[] EMPTY_ARRAY = new Biome[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
Biome OCEAN = getBiome("ocean");
|
||||||
|
Biome PLAINS = getBiome("plains");
|
||||||
|
@@ -129,7 +130,7 @@ public interface Biome extends OldEnum<Biome>, Keyed, net.kyori.adventure.transl
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Biome[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.BIOME).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||||
|
index 24b58ed80f3dd7c6b35bb18071000af845d18ba4..13ad0ba6320acd054a665d1749871a14cfd1a520 100644
|
||||||
|
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||||
|
@@ -12,6 +12,8 @@ import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public interface PatternType extends OldEnum<PatternType>, Keyed {
|
||||||
|
+ PatternType[] EMPTY_ARRAY = new PatternType[0]; // Plazma - Reduce allocations
|
||||||
|
+
|
||||||
|
PatternType BASE = getType("base");
|
||||||
|
PatternType SQUARE_BOTTOM_LEFT = getType("square_bottom_left");
|
||||||
|
PatternType SQUARE_BOTTOM_RIGHT = getType("square_bottom_right");
|
||||||
|
@@ -140,6 +142,6 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static PatternType[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.BANNER_PATTERN).toArray(new PatternType[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.BANNER_PATTERN).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java
|
||||||
|
index 74384a56eebbce41d431db2507c55eddbcf50a41..ef3afe91312de1d0fb38d985e0421ceae59d7e57 100644
|
||||||
|
--- a/src/main/java/org/bukkit/command/Command.java
|
||||||
|
+++ b/src/main/java/org/bukkit/command/Command.java
|
||||||
|
@@ -58,6 +58,19 @@ public abstract class Command {
|
||||||
|
this.activeAliases = new ArrayList<String>(aliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Plazma start - Reduce allocations
|
||||||
|
+ /**
|
||||||
|
+ * Executes the command, returning its success
|
||||||
|
+ *
|
||||||
|
+ * @param sender Source object which is executing this command
|
||||||
|
+ * @param commandLabel The alias of the command used
|
||||||
|
+ * @return true if the command was successful, otherwise false
|
||||||
|
+ */
|
||||||
|
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel) {
|
||||||
|
+ return this.execute(sender, commandLabel, org.plazmamc.plazma.constants.Null.STRING);
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Reduce allocations
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Executes the command, returning its success
|
||||||
|
*
|
||||||
|
diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||||
|
index a824ac90e78d3d7f90b01397270e54422d88e8b9..95df10ad8a53942de435cec7db57c1bb496097dc 100644
|
||||||
|
--- a/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||||
|
+++ b/src/main/java/org/bukkit/enchantments/Enchantment.java
|
||||||
|
@@ -15,6 +15,8 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
* The various type of enchantments that may be added to armour or weapons
|
||||||
|
*/
|
||||||
|
public abstract class Enchantment implements Keyed, Translatable, net.kyori.adventure.translation.Translatable { // Paper - Adventure translations
|
||||||
|
+ private static final Enchantment[] EMPTY_ARRAY = new Enchantment[0]; // Plazma - Reduce allocations
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* Provides protection against environmental damage
|
||||||
|
*/
|
||||||
|
@@ -536,6 +538,6 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.20.3")
|
||||||
|
public static Enchantment[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.ENCHANTMENT).toArray(new Enchantment[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.ENCHANTMENT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
|
||||||
|
index fca4671c6976aee9e981ef344244f9322651d0c9..7dc1744fba576683155e7970832794c05ceff768 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/Cat.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/Cat.java
|
||||||
|
@@ -51,6 +51,7 @@ public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarC
|
||||||
|
* Represents the various different cat types there are.
|
||||||
|
*/
|
||||||
|
interface Type extends OldEnum<Type>, Keyed {
|
||||||
|
+ Type[] EMPTY_ARRAY = new Type[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
Type TABBY = getType("tabby");
|
||||||
|
Type BLACK = getType("black");
|
||||||
|
@@ -89,7 +90,7 @@ public interface Cat extends Tameable, Sittable, io.papermc.paper.entity.CollarC
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Type[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.CAT_VARIANT).toArray(new Type[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.CAT_VARIANT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/Frog.java b/src/main/java/org/bukkit/entity/Frog.java
|
||||||
|
index f661a6b4797dd814a197e9245bcb2ddf2fca773f..58bf414cd753299abc54c45b3036d3fdbf9170dc 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/Frog.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/Frog.java
|
||||||
|
@@ -49,6 +49,7 @@ public interface Frog extends Animals {
|
||||||
|
* Represents the variant of a frog - ie its color.
|
||||||
|
*/
|
||||||
|
interface Variant extends OldEnum<Variant>, Keyed {
|
||||||
|
+ Variant[] EMPTY_ARRAY = new Variant[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temperate (brown-orange) frog.
|
||||||
|
@@ -88,7 +89,7 @@ public interface Frog extends Animals {
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Variant[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.FROG_VARIANT).toArray(new Variant[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.FROG_VARIANT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/Villager.java b/src/main/java/org/bukkit/entity/Villager.java
|
||||||
|
index 9c722a762c88a88bb5ef18c3b9eab8b371360dac..127bc2aab7fb36df206d53f3e6042bb6c920878e 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/Villager.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/Villager.java
|
||||||
|
@@ -170,6 +170,7 @@ public interface Villager extends AbstractVillager {
|
||||||
|
* in.
|
||||||
|
*/
|
||||||
|
interface Type extends OldEnum<Type>, Keyed {
|
||||||
|
+ Type[] EMPTY_ARRAY = new Type[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
Type DESERT = getType("desert");
|
||||||
|
Type JUNGLE = getType("jungle");
|
||||||
|
@@ -204,7 +205,7 @@ public interface Villager extends AbstractVillager {
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Type[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.VILLAGER_TYPE).toArray(new Type[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.VILLAGER_TYPE).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -213,6 +214,7 @@ public interface Villager extends AbstractVillager {
|
||||||
|
* Villagers have different trading options depending on their profession,
|
||||||
|
*/
|
||||||
|
interface Profession extends OldEnum<Profession>, Keyed, net.kyori.adventure.translation.Translatable {
|
||||||
|
+ Profession[] EMPTY_ARRAY = new Profession[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
Profession NONE = getProfession("none");
|
||||||
|
/**
|
||||||
|
@@ -311,7 +313,7 @@ public interface Villager extends AbstractVillager {
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Profession[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(new Profession[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.VILLAGER_PROFESSION).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
diff --git a/src/main/java/org/bukkit/map/MapCursor.java b/src/main/java/org/bukkit/map/MapCursor.java
|
||||||
|
index 7f5682c80ff25142e7c8fa14e03b4a62fc5c01d3..5fbcdf637b1e0162276e668d9ebe4a8648a29b8a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/map/MapCursor.java
|
||||||
|
+++ b/src/main/java/org/bukkit/map/MapCursor.java
|
||||||
|
@@ -286,6 +286,7 @@ public final class MapCursor {
|
||||||
|
* resource pack.
|
||||||
|
*/
|
||||||
|
public interface Type extends OldEnum<Type>, Keyed {
|
||||||
|
+ Type[] EMPTY_ARRAY = new Type[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
Type PLAYER = getType("player");
|
||||||
|
Type FRAME = getType("frame");
|
||||||
|
@@ -387,7 +388,7 @@ public final class MapCursor {
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.21", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Type[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.MAP_DECORATION_TYPE).toArray(new Type[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.MAP_DECORATION_TYPE).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
|
index 2f8d3b7a5b25e323f892d2ec5eb7c3412a816ea4..22e358f7a83d84745c32ff9f04d79d51d8d92131 100644
|
||||||
|
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
|
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||||
|
@@ -47,6 +47,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
@Deprecated(forRemoval = true) // Paper - This implementation may be replaced in a future version of Paper.
|
||||||
|
// Plugins may still reflect into this class to modify permission logic for the time being.
|
||||||
|
public final class SimplePluginManager implements PluginManager {
|
||||||
|
+ public static final Plugin[] EMPTY_PLUGIN = new Plugin[0]; // Plazma - Reduce allocations
|
||||||
|
private final Server server;
|
||||||
|
private final Map<Pattern, PluginLoader> fileAssociations = new HashMap<Pattern, PluginLoader>();
|
||||||
|
private final List<Plugin> plugins = new ArrayList<Plugin>();
|
||||||
|
@@ -133,7 +134,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||||
|
this.server.getLogger().log(Level.SEVERE, "Plugin loading error!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- return pluginList.toArray(new Plugin[0]);
|
||||||
|
+ return pluginList.toArray(EMPTY_PLUGIN); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
Preconditions.checkArgument(directory != null, "Directory cannot be null");
|
||||||
|
Preconditions.checkArgument(directory.isDirectory(), "Directory must be a directory");
|
||||||
|
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||||
|
index e4cfdc80c9e49fc7992183022bdf2f36aae0d95a..0cd7987e935e2b7ede759af3db9af04366930e19 100644
|
||||||
|
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||||
|
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
|
||||||
|
@@ -19,6 +19,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
*/
|
||||||
|
public abstract class PotionEffectType implements Keyed, Translatable, net.kyori.adventure.translation.Translatable, io.papermc.paper.world.flag.FeatureDependant { // Paper - implement Translatable & feature flag API
|
||||||
|
private static final BiMap<Integer, PotionEffectType> ID_MAP = HashBiMap.create();
|
||||||
|
+ private static final PotionEffectType[] EMPTY_ARRAY = new PotionEffectType[0]; // Plazma - Reduce allocations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increases movement speed.
|
||||||
|
@@ -358,7 +359,7 @@ public abstract class PotionEffectType implements Keyed, Translatable, net.kyori
|
||||||
|
@NotNull
|
||||||
|
@Deprecated(since = "1.20.3")
|
||||||
|
public static PotionEffectType[] values() {
|
||||||
|
- return Lists.newArrayList(Registry.EFFECT).toArray(new PotionEffectType[0]);
|
||||||
|
+ return Lists.newArrayList(Registry.EFFECT).toArray(EMPTY_ARRAY); // Plazma - Reduce allocations
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/Constants.java b/src/main/java/org/plazmamc/plazma/Constants.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..137f4f511998828476c2ac408a9a76289a44d071
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/Constants.java
|
||||||
|
@@ -0,0 +1,7 @@
|
||||||
|
+package org.plazmamc.plazma;
|
||||||
|
+
|
||||||
|
+public interface Constants {
|
||||||
|
+
|
||||||
|
+ int[] ZERO_INT_ARRAY = new int[]{0};
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/constants/Null.java b/src/main/java/org/plazmamc/plazma/constants/Null.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..6018a9230d0d92e23f09cc5b5cc042446bed9962
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/constants/Null.java
|
||||||
|
@@ -0,0 +1,25 @@
|
||||||
|
+package org.plazmamc.plazma.constants;
|
||||||
|
+
|
||||||
|
+import net.md_5.bungee.api.chat.BaseComponent;
|
||||||
|
+import java.net.URL;
|
||||||
|
+import java.util.concurrent.CompletableFuture;
|
||||||
|
+import java.util.regex.Pattern;
|
||||||
|
+
|
||||||
|
+public interface Null {
|
||||||
|
+
|
||||||
|
+ byte[] BYTE = new byte[0];
|
||||||
|
+ short[] SHORT = new short[0];
|
||||||
|
+ int[] INT = new int[0];
|
||||||
|
+ long[] LONG = new long[0];
|
||||||
|
+
|
||||||
|
+ Object[] OBJECT = new Object[0];
|
||||||
|
+ String[] STRING = new String[0];
|
||||||
|
+ URL[] URL = new URL[0];
|
||||||
|
+ Pattern[] REGEX = new Pattern[0];
|
||||||
|
+
|
||||||
|
+ BaseComponent[] COMPONENT = new BaseComponent[0];
|
||||||
|
+
|
||||||
|
+ @SuppressWarnings("rawtypes")
|
||||||
|
+ CompletableFuture[] FUTURE = new CompletableFuture[0];
|
||||||
|
+
|
||||||
|
+}
|
||||||
24
patches/api/0008-Add-option-to-shoot-fireball.patch
Normal file
24
patches/api/0008-Add-option-to-shoot-fireball.patch
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Sat, 14 Dec 2024 12:25:43 +0900
|
||||||
|
Subject: [PATCH] Add option to shoot fireball
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||||
|
index 361db256296d776c27e601c923b2cdc61967122b..8a740bdd99b683255fdd7ebf81f28ceca8b030f8 100644
|
||||||
|
--- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||||
|
+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||||
|
@@ -224,6 +224,12 @@ public class CreatureSpawnEvent extends EntitySpawnEvent {
|
||||||
|
/**
|
||||||
|
* When an entity is missing a SpawnReason
|
||||||
|
*/
|
||||||
|
- DEFAULT
|
||||||
|
+ DEFAULT,
|
||||||
|
+ // Plazma start - Option to shoot fireballs
|
||||||
|
+ /*
|
||||||
|
+ * When a player shoots a fire charge
|
||||||
|
+ */
|
||||||
|
+ FIRE_CHARGE,
|
||||||
|
+ // Plazma end - Option to shoot fireballs
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,10 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||||
index 02411466bdcf4ff731f01ccebb2c99942e0db878..2718c0e5061838b01881bb231c53f4da348adce3 100644
|
index 35dfd25f21ca67b7f4d69326500980f4a021ef49..a9816fbfa466b3fe3f82c19aeeeb564c660e4b6a 100644
|
||||||
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
--- a/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||||
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
+++ b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||||
@@ -436,6 +436,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
@@ -441,6 +441,18 @@ public interface VanillaGoal<T extends Mob> extends Goal<T> {
|
||||||
|
|
||||||
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
|
GoalKey<Zombie> ZOMBIE_ATTACK_TURTLE_EGG = create("zombie_attack_turtle_egg", Zombie.class);
|
||||||
|
|
||||||
@@ -44,6 +44,6 @@ index 02411466bdcf4ff731f01ccebb2c99942e0db878..2718c0e5061838b01881bb231c53f4da
|
|||||||
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
|
+ GoalKey<IronGolem> RECEIVE_FLOWER = GoalKey.of(IronGolem.class, NamespacedKey.minecraft("receive_flower"));
|
||||||
+ // Purpur end
|
+ // Purpur end
|
||||||
+
|
+
|
||||||
private static <T extends Mob> @NonNull GoalKey<T> create(final @NonNull String key,
|
private static <T extends Mob> GoalKey<T> create(final String key, final Class<T> type) {
|
||||||
final @NonNull Class<T> type) {
|
|
||||||
return GoalKey.of(type, NamespacedKey.minecraft(key));
|
return GoalKey.of(type, NamespacedKey.minecraft(key));
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
71
patches/server/0002-mc-dev-fixes.patch
Normal file
71
patches/server/0002-mc-dev-fixes.patch
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Sat, 2 Nov 2024 15:26:27 +0900
|
||||||
|
Subject: [PATCH] mc dev fixes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/commands/DebugCommand.java b/src/main/java/net/minecraft/server/commands/DebugCommand.java
|
||||||
|
index 06568cc308e06b16f43ec7facd5e2c4e36f3fee9..f8cdd6911fe9d6402455b7368d0e98c25e9511ca 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/commands/DebugCommand.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/commands/DebugCommand.java
|
||||||
|
@@ -271,5 +271,12 @@ public class DebugCommand {
|
||||||
|
public void close() {
|
||||||
|
IOUtils.closeQuietly((Writer)this.output);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Plazma start - Decompile fixes
|
||||||
|
+ @Override
|
||||||
|
+ public CommandSender getBukkitSender(final CommandSourceStack wrapper) {
|
||||||
|
+ return wrapper.getBukkitSender();
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Decompile fixes
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/commands/ReturnCommand.java b/src/main/java/net/minecraft/server/commands/ReturnCommand.java
|
||||||
|
index 9f82ca1fee2a319d52a4106c3581f5e9a9554a9e..f5c7748117342dedd9d600881143c206e429fe5b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/commands/ReturnCommand.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/commands/ReturnCommand.java
|
||||||
|
@@ -16,18 +16,18 @@ import net.minecraft.commands.execution.tasks.BuildContexts;
|
||||||
|
import net.minecraft.commands.execution.tasks.FallthroughTask;
|
||||||
|
|
||||||
|
public class ReturnCommand {
|
||||||
|
- public static <T extends ExecutionCommandSource<T>> void register(CommandDispatcher<T> dispatcher) {
|
||||||
|
- dispatcher.register(
|
||||||
|
- (LiteralArgumentBuilder<T>)LiteralArgumentBuilder.<ExecutionCommandSource>literal("return")
|
||||||
|
- .requires(source -> source.hasPermission(2))
|
||||||
|
- .then(
|
||||||
|
- RequiredArgumentBuilder.<T, Integer>argument("value", IntegerArgumentType.integer())
|
||||||
|
- .executes(new ReturnCommand.ReturnValueCustomExecutor<>())
|
||||||
|
- )
|
||||||
|
- .then(LiteralArgumentBuilder.<T>literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>()))
|
||||||
|
- .then(LiteralArgumentBuilder.<T>literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false))
|
||||||
|
+
|
||||||
|
+ // Plazma start - Decompile fixes
|
||||||
|
+ public static void register(CommandDispatcher<net.minecraft.commands.CommandSourceStack> dispatcher) {
|
||||||
|
+ dispatcher.register(net.minecraft.commands.Commands.literal("return")
|
||||||
|
+ .requires(source -> source.hasPermission(2))
|
||||||
|
+ .then(net.minecraft.commands.Commands.argument("value", IntegerArgumentType.integer())
|
||||||
|
+ .executes(new ReturnCommand.ReturnValueCustomExecutor<>()))
|
||||||
|
+ .then(net.minecraft.commands.Commands.literal("fail").executes(new ReturnCommand.ReturnFailCustomExecutor<>()))
|
||||||
|
+ .then(net.minecraft.commands.Commands.literal("run").forward(dispatcher.getRoot(), new ReturnCommand.ReturnFromCommandCustomModifier<>(), false))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
+ // Plazma end - Decompile fixes
|
||||||
|
|
||||||
|
static class ReturnFailCustomExecutor<T extends ExecutionCommandSource<T>> implements CustomCommandExecutor.CommandAdapter<T> {
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
|
||||||
|
index 3fc1ec01e1a77a169ec762a23f15b97f040ce5f8..b5464708c1fa949e7df8aed71126ccad72d66ee3 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/AllayAi.java
|
||||||
|
@@ -62,8 +62,8 @@ public class AllayAi {
|
||||||
|
Activity.CORE,
|
||||||
|
0,
|
||||||
|
ImmutableList.of(
|
||||||
|
- new Swim<>(0.8F),
|
||||||
|
- new AnimalPanic(2.5F),
|
||||||
|
+ new Swim<Allay>(0.8F), // Plazma - mc dev fixes
|
||||||
|
+ new AnimalPanic<Allay>(2.5F), // Plazma - mc dev fixes
|
||||||
|
new LookAtTargetSink(45, 90),
|
||||||
|
new MoveToTargetSink(),
|
||||||
|
new CountDownCooldownTicks(MemoryModuleType.LIKED_NOTEBLOCK_COOLDOWN_TICKS),
|
||||||
19
patches/server/0003-Minor-code-optimizations.patch
Normal file
19
patches/server/0003-Minor-code-optimizations.patch
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 13:54:22 +0900
|
||||||
|
Subject: [PATCH] Minor code optimizations
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
index 34e8eb828be517d9ee3973597c74c5cac3d75c99..f8575f94a389d87d8043ae838720dbe2247235c4 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
@@ -1697,7 +1697,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
|
@Override
|
||||||
|
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
|
||||||
|
Profiler.get().incrementCounter("getEntities");
|
||||||
|
- List<Entity> list = Lists.newArrayList();
|
||||||
|
+ //List<Entity> list = Lists.newArrayList(); // Plazma - minor optimizations
|
||||||
|
|
||||||
|
// Paper start - rewrite chunk system
|
||||||
|
final List<Entity> ret = new java.util.ArrayList<>();
|
||||||
@@ -5,16 +5,16 @@ Subject: [PATCH] Build System Changes
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 535b0c6a750cc77fb9340d6e080932f3eb3bde17..3bb91f4d0447fc283c56ffab24cb8e203925ebad 100644
|
index 77602e4445b1b45a17e5552ac6a769e0ed46ebc7..f021047331c7eb3dac7f0d56af73a9056ffe826b 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -13,70 +13,29 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
@@ -26,71 +26,34 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||||
val alsoShade: Configuration by configurations.creating
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
- implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur
|
implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur
|
||||||
- // Paper start
|
- // Paper start
|
||||||
- implementation("org.jline:jline-terminal-jansi:3.21.0")
|
- implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||||
|
- implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||||
- implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
- implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||||
- implementation("net.kyori:adventure-text-serializer-ansi:4.17.0") // Keep in sync with adventureVersion from Paper-API build file
|
- implementation("net.kyori:adventure-text-serializer-ansi:4.17.0") // Keep in sync with adventureVersion from Paper-API build file
|
||||||
- /*
|
- /*
|
||||||
@@ -33,8 +33,8 @@ index 535b0c6a750cc77fb9340d6e080932f3eb3bde17..3bb91f4d0447fc283c56ffab24cb8e20
|
|||||||
- implementation("org.ow2.asm:asm-commons:9.7.1")
|
- implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||||
- implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
- implementation("org.spongepowered:configurate-yaml:4.2.0-SNAPSHOT") // Paper - config files
|
||||||
- implementation("commons-lang:commons-lang:2.6")
|
- implementation("commons-lang:commons-lang:2.6")
|
||||||
- runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
|
- runtimeOnly("org.xerial:sqlite-jdbc:3.46.1.3")
|
||||||
- runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
|
- runtimeOnly("com.mysql:mysql-connector-j:9.1.0")
|
||||||
- runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
|
- runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
|
||||||
- // Paper start - Use Velocity cipher
|
- // Paper start - Use Velocity cipher
|
||||||
- implementation("com.velocitypowered:velocity-native:3.3.0-SNAPSHOT") {
|
- implementation("com.velocitypowered:velocity-native:3.3.0-SNAPSHOT") {
|
||||||
@@ -62,6 +62,7 @@ index 535b0c6a750cc77fb9340d6e080932f3eb3bde17..3bb91f4d0447fc283c56ffab24cb8e20
|
|||||||
- testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0")
|
- testImplementation("org.junit.platform:junit-platform-suite-engine:1.10.0")
|
||||||
- testImplementation("org.hamcrest:hamcrest:2.2")
|
- testImplementation("org.hamcrest:hamcrest:2.2")
|
||||||
- testImplementation("org.mockito:mockito-core:5.14.1")
|
- testImplementation("org.mockito:mockito-core:5.14.1")
|
||||||
|
- mockitoAgent("org.mockito:mockito-core:5.14.1") { isTransitive = false } // Paper - configure mockito agent that is needed in newer java versions
|
||||||
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
- testImplementation("org.ow2.asm:asm-tree:9.7.1")
|
||||||
- testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
- testImplementation("org.junit-pioneer:junit-pioneer:2.2.0") // Paper - CartesianTest
|
||||||
- implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
- implementation("net.neoforged:srgutils:1.0.9") // Paper - mappings handling
|
||||||
@@ -74,35 +75,40 @@ index 535b0c6a750cc77fb9340d6e080932f3eb3bde17..3bb91f4d0447fc283c56ffab24cb8e20
|
|||||||
- // Paper end - Remap reflection
|
- // Paper end - Remap reflection
|
||||||
- // Paper start - spark
|
- // Paper start - spark
|
||||||
- implementation("me.lucko:spark-api:0.1-20240720.200737-2")
|
- implementation("me.lucko:spark-api:0.1-20240720.200737-2")
|
||||||
- implementation("me.lucko:spark-paper:1.10.105-SNAPSHOT")
|
- implementation("me.lucko:spark-paper:1.10.119-SNAPSHOT")
|
||||||
- // Paper end - spark
|
- // Paper end - spark
|
||||||
+ // Plazma start - Build System Changes
|
+ // Plazma start - Use Gradle Version Catalogs
|
||||||
+ implementation(project(":${rootProject.providers.gradleProperty("brandName").get().lowercase()}-api"))
|
|
||||||
+ implementation(common.snakeyaml)
|
|
||||||
+ implementation(common.asm.commons)
|
|
||||||
+ implementation(common.log4j.core)
|
|
||||||
+ implementation(common.log4j.iostreams)
|
|
||||||
+ implementation(common.commons.lang2)
|
|
||||||
+ implementation(common.adventure.serializer.ansi)
|
|
||||||
+ implementation(server.velocity) { isTransitive = false }
|
|
||||||
+ implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") }
|
|
||||||
+ implementation(server.bundles.implementation)
|
+ implementation(server.bundles.implementation)
|
||||||
|
+ implementation(common.adventure.serializer.ansi)
|
||||||
|
+ implementation(common.log4j.stream)
|
||||||
+
|
+
|
||||||
+ log4jPlugins.annotationProcessorConfigurationName(common.log4j.core)
|
+ implementation(common.log4j)
|
||||||
+ alsoShade(log4jPlugins.output) // Plazma - Diff on patch
|
+ log4jPlugins.annotationProcessorConfigurationName(common.log4j)
|
||||||
+ runtimeOnly(log4jPlugins.output) // Plazma - Diff on patch
|
+ runtimeOnly(log4jPlugins.output) // diff on change
|
||||||
|
+ alsoShade(log4jPlugins.output) // diff on change
|
||||||
+
|
+
|
||||||
+ runtimeOnly(common.maven.provider)
|
|
||||||
+ runtimeOnly(common.bundles.maven)
|
|
||||||
+ runtimeOnly(server.bundles.runtime)
|
+ runtimeOnly(server.bundles.runtime)
|
||||||
+
|
+
|
||||||
|
+ implementation(common.bundles.asm)
|
||||||
|
+ implementation(common.commons.lang2)
|
||||||
|
+ implementation(server.velocity.native) { isTransitive = false }
|
||||||
|
+
|
||||||
|
+ runtimeOnly(common.mvn)
|
||||||
|
+ runtimeOnly(common.bundles.mvn)
|
||||||
|
+
|
||||||
|
+ implementation(common.snakeyaml)
|
||||||
|
+ implementation(server.simpleyaml) { exclude(group="org.yaml", module="snakeyaml") }
|
||||||
|
+
|
||||||
|
+ testImplementation(server.classgraph)
|
||||||
+ testImplementation(common.bundles.test)
|
+ testImplementation(common.bundles.test)
|
||||||
+ testImplementation(server.bundles.test)
|
+ testImplementation(common.junit)
|
||||||
+ // Plazma end - Build System Changes
|
+ mockitoAgent(common.mockito) { isTransitive = false }
|
||||||
|
+ testImplementation(common.junit.pioneer)
|
||||||
|
+ // Plazma end - Use Gradle Version Catalogs
|
||||||
}
|
}
|
||||||
|
|
||||||
paperweight {
|
paperweight {
|
||||||
@@ -104,14 +63,14 @@ tasks.jar {
|
@@ -118,14 +81,14 @@ tasks.jar {
|
||||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||||
attributes(
|
attributes(
|
||||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||||
@@ -4,6 +4,19 @@ Date: Wed, 21 Dec 2022 19:31:24 +0900
|
|||||||
Subject: [PATCH] Fork-friendly Rebranding
|
Subject: [PATCH] Fork-friendly Rebranding
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
|
index f021047331c7eb3dac7f0d56af73a9056ffe826b..41005f58fdd526907972185e728bbe1fa97171e9 100644
|
||||||
|
--- a/build.gradle.kts
|
||||||
|
+++ b/build.gradle.kts
|
||||||
|
@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||||
|
// Paper end - configure mockito agent that is needed in newer java versions
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
- implementation(project(":purpur-api")) // Pufferfish // Paper // Purpur
|
||||||
|
+ implementation(project(":plazma-api")) // Pufferfish // Paper // Purpur // Plazma
|
||||||
|
// Plazma start - Use Gradle Version Catalogs
|
||||||
|
implementation(server.bundles.implementation)
|
||||||
|
implementation(common.adventure.serializer.ansi)
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f 100644
|
index 8cde30544e14f8fc2dac32966ae3c21f8cf3a551..8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
@@ -163,20 +176,18 @@ index 3099c21ee589acf6edff5903a23673adf489024f..a337e2c9576fb70a8ee9082e9b69719c
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||||
index 87e5f614ba988547a827486740db217e28585773..f5aac6cde46ca08a4d4792e38f514bb3d8188ae8 100644
|
index 8cf720f08514e8e4f62f4ad196f1277bd761c6b2..cda2ca940e30506807a5d12b84dbf69529051e26 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||||
@@ -113,9 +113,7 @@ public abstract class Configurations<G, W> {
|
@@ -112,7 +112,7 @@ public abstract class Configurations<G, W> {
|
||||||
try {
|
|
||||||
loader.save(node);
|
loader.save(node);
|
||||||
} catch (ConfigurateException ex) {
|
} catch (ConfigurateException ex) {
|
||||||
- if (ex.getCause() instanceof AccessDeniedException) {
|
if (ex.getCause() instanceof AccessDeniedException) {
|
||||||
- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
|
- LOGGER.warn("Could not save {}: Paper could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at https://docs.papermc.io/paper/configuration for more details.", filename, ex);
|
||||||
- } else throw ex;
|
+ LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); // Plazma - Fork-friendly Rebranding
|
||||||
+ if (ex.getCause() instanceof AccessDeniedException) LOGGER.warn("Could not save {}: {} could not persist the full set of configuration settings in the configuration file. Any setting missing from the configuration file will be set with its default value in memory. Admins should make sure to review the configuration documentation at {} for more details.", filename, io.papermc.paper.ServerBrandConstants.BRAND_NAME, io.papermc.paper.ServerBrandConstants.CONFIG_REFERENCE, ex); else throw ex; // Plazma - Fork-friendly Rebranding
|
} else throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
||||||
index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04ec23cc18 100644
|
index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04ec23cc18 100644
|
||||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
--- a/src/main/java/net/minecraft/CrashReport.java
|
||||||
@@ -198,7 +209,7 @@ index 710477ae27ebc5afdf0012ef0867d05efd293c24..3a5e7546c5cc1fcec880cece3f0d0b04
|
|||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index aad2cdf4c2237caf2c99695d0cbb01f56c0074e2..e9842bf7e43a4fdfc4a23d6ee13d56a8cf4fb77a 100644
|
index ecaec3c7b5768771b00c4c33d48a76ba22653a79..8f77566bef4b992013e3b65068cabe7ee1921951 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -108,6 +108,11 @@ public class Main {
|
@@ -108,6 +108,11 @@ public class Main {
|
||||||
@@ -214,10 +225,10 @@ index aad2cdf4c2237caf2c99695d0cbb01f56c0074e2..e9842bf7e43a4fdfc4a23d6ee13d56a8
|
|||||||
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index d78cb68c3a53b277aa26186062efc716c8f80f36..e36b9964569c8476ca25386c783fb8323f637476 100644
|
index 23505b0f80d643d9ef569b49192f44e0373dfb5f..20f79bcd7613e426b6b1020f586773819f1ac9d0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1259,7 +1259,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1280,7 +1280,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
LOGGER.info("*************************************************************************************");
|
LOGGER.info("*************************************************************************************");
|
||||||
LOGGER.info("This is the first time you're starting this server.");
|
LOGGER.info("This is the first time you're starting this server.");
|
||||||
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
|
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
|
||||||
@@ -227,10 +238,10 @@ index d78cb68c3a53b277aa26186062efc716c8f80f36..e36b9964569c8476ca25386c783fb832
|
|||||||
}
|
}
|
||||||
// Paper end - Add onboarding message for initial server start
|
// Paper end - Add onboarding message for initial server start
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index 6e6f4dffceb0032153c5be119303c5809629cfcc..dae03900ee8b73448e216891fa8e9a7b5c41ddc2 100644
|
index 7a442fb4cf78bcb1268359ee41a6de138edb76b6..193c62ed303d25558d78f1e8dfb655919335fdf6 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -801,7 +801,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -779,7 +779,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
|
org.bukkit.plugin.Plugin[] plugins = this.server.getPluginManager().getPlugins();
|
||||||
|
|
||||||
result.append(this.server.getName());
|
result.append(this.server.getName());
|
||||||
@@ -240,17 +251,15 @@ index 6e6f4dffceb0032153c5be119303c5809629cfcc..dae03900ee8b73448e216891fa8e9a7b
|
|||||||
|
|
||||||
if (plugins.length > 0 && this.server.getQueryPlugins()) {
|
if (plugins.length > 0 && this.server.getQueryPlugins()) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
index 9ebe1f1797b5be562bc4f6d92b9a4d6022ca2151..e0a09827db002b87e738091d820f05a9a97f3edb 100644
|
index 05e16103af3fd276f0196ddf1a2e5b729b025c34..8f7e922ceca286b1a590181c301fbe9bff55c024 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
@@ -56,12 +56,12 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
@@ -56,10 +56,10 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
public final boolean onlineMode = this.get("online-mode", true);
|
public final boolean onlineMode = this.get("online-mode", true);
|
||||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||||
public final String serverIp = this.get("server-ip", "");
|
public final String serverIp = this.get("server-ip", "");
|
||||||
- public final String serverName = this.get("server-name", "Unknown Server"); // Purpur
|
- public final String serverName = this.get("server-name", "Unknown Server"); // Purpur
|
||||||
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
|
+ public final String serverName = this.get("server-name", "A " + io.papermc.paper.ServerBrandConstants.BRAND_NAME + " Server"); // Purpur // Plazma - Fork-friendly Rebranding
|
||||||
public final boolean spawnAnimals = this.get("spawn-animals", true);
|
|
||||||
public final boolean spawnNpcs = this.get("spawn-npcs", true);
|
|
||||||
public final boolean pvp = this.get("pvp", true);
|
public final boolean pvp = this.get("pvp", true);
|
||||||
public final boolean allowFlight = this.get("allow-flight", false);
|
public final boolean allowFlight = this.get("allow-flight", false);
|
||||||
- public final String motd = this.get("motd", "A Minecraft Server");
|
- public final String motd = this.get("motd", "A Minecraft Server");
|
||||||
@@ -312,10 +321,10 @@ index 4a96d914f8aa6f0c5f13fc85369a311f25835ac2..5b4285d6b37346bcea3bf072c6f00bd5
|
|||||||
DamageSource damageSource = this.cloneInstance();
|
DamageSource damageSource = this.cloneInstance();
|
||||||
damageSource.customEventDamager = entity;
|
damageSource.customEventDamager = entity;
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
index 4c178b234bc1118a577d0e016f4b986e9197e99d..f1dab663eebbbdf67c5b8e8f05bf60ce7d6f1650 100644
|
index cf0f3a14584b9280211f88808cb1ddfb10105ec5..fffe0091008339d438961f0d9f6f62ad6d31859f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -177,7 +177,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -289,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
private static void printOversizedLog(String msg, Path file, int x, int z) {
|
private static void printOversizedLog(String msg, Path file, int x, int z) {
|
||||||
@@ -325,7 +334,7 @@ index 4c178b234bc1118a577d0e016f4b986e9197e99d..f1dab663eebbbdf67c5b8e8f05bf60ce
|
|||||||
|
|
||||||
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 068aa459b4d1dfbbbd80dc0ae5c43b8202474477..8d67bf7aaed07a3438f29347bd3b1fd6c9efac2e 100644
|
index 430407b0cf06ba337c59cd576c7e40a8e5fe8229..75a062e1105c2f7cc631a6b8b201b0e08621e3c5 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -143,7 +143,7 @@ public class Main {
|
@@ -143,7 +143,7 @@ public class Main {
|
||||||
@@ -347,13 +356,13 @@ index 068aa459b4d1dfbbbd80dc0ae5c43b8202474477..8d67bf7aaed07a3438f29347bd3b1fd6
|
|||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||||
index 48999a860a3b9ed691691c355beaf3e0674acb95..8a34f8481031db9cd5f05944f37ee5284c99c6fe 100644
|
index 5e7b833fc9f37bc370c76e5c43e6c9919d6d20af..ddbda1491e5873be1b54f0a555cc5c675f4597d4 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||||
@@ -492,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler {
|
@@ -491,7 +491,7 @@ public class CraftScheduler implements BukkitScheduler {
|
||||||
this.parsePending();
|
this.parsePending();
|
||||||
} else {
|
} else {
|
||||||
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
|
// this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(this.currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper
|
||||||
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur
|
- task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to Purpur"); // Paper // Purpur
|
||||||
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
+ task.getOwner().getLogger().log(Level.SEVERE, "Unexpected Async Task in the Sync Scheduler. Report this to " + io.papermc.paper.ServerBrandConstants.BRAND_NAME); // Paper // Purpur // Plazma - Fork-friendly Rebranding
|
||||||
// We don't need to parse pending
|
// We don't need to parse pending
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Plazma Configurations
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||||
index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06beff65045 100644
|
index cda2ca940e30506807a5d12b84dbf69529051e26..150556ba594eae2214e4d1f0243ee97a7beb1e99 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||||
@@ -39,27 +39,94 @@ public abstract class Configurations<G, W> {
|
@@ -37,27 +37,94 @@ public abstract class Configurations<G, W> {
|
||||||
public static final String WORLD_DEFAULTS = "__world_defaults__";
|
public static final String WORLD_DEFAULTS = "__world_defaults__";
|
||||||
public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS);
|
public static final ResourceLocation WORLD_DEFAULTS_KEY = ResourceLocation.fromNamespaceAndPath("configurations", WORLD_DEFAULTS);
|
||||||
protected final Path globalFolder;
|
protected final Path globalFolder;
|
||||||
@@ -123,7 +123,7 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b
|
|||||||
|
|
||||||
protected ObjectMapper.Factory.Builder createObjectMapper() {
|
protected ObjectMapper.Factory.Builder createObjectMapper() {
|
||||||
return ObjectMapper.factoryBuilder()
|
return ObjectMapper.factoryBuilder()
|
||||||
@@ -68,17 +135,21 @@ public abstract class Configurations<G, W> {
|
@@ -66,17 +133,21 @@ public abstract class Configurations<G, W> {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
|
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
|
||||||
@@ -148,7 +148,7 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b
|
|||||||
}
|
}
|
||||||
|
|
||||||
@MustBeInvokedByOverriders
|
@MustBeInvokedByOverriders
|
||||||
@@ -96,7 +167,7 @@ public abstract class Configurations<G, W> {
|
@@ -94,7 +165,7 @@ public abstract class Configurations<G, W> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b
|
|||||||
return node -> {
|
return node -> {
|
||||||
ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type));
|
ObjectMapper.Factory factory = (ObjectMapper.Factory) Objects.requireNonNull(node.options().serializers().get(type));
|
||||||
ObjectMapper.Mutable<T> mutable = (ObjectMapper.Mutable<T>) factory.get(type);
|
ObjectMapper.Mutable<T> mutable = (ObjectMapper.Mutable<T>) factory.get(type);
|
||||||
@@ -106,7 +177,7 @@ public abstract class Configurations<G, W> {
|
@@ -104,7 +175,7 @@ public abstract class Configurations<G, W> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public G initializeGlobalConfiguration(final RegistryAccess registryAccess) throws ConfigurateException {
|
public G initializeGlobalConfiguration(final RegistryAccess registryAccess) throws ConfigurateException {
|
||||||
@@ -295,10 +295,10 @@ index f5aac6cde46ca08a4d4792e38f514bb3d8188ae8..4ab13053dec8f05f84981b1bbb6ed06b
|
|||||||
|
|
||||||
public static class ContextMap {
|
public static class ContextMap {
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d1f26aa4a 100644
|
index 47a2cba0db36b11548d06ec21f7c7d7c9a962d6e..3f99ca451099d2c7baf12b7b603d8b30f520734c 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||||
@@ -135,6 +135,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -137,6 +137,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
See https://docs.papermc.io/paper/configuration for more information.
|
See https://docs.papermc.io/paper/configuration for more information.
|
||||||
""";
|
""";
|
||||||
|
|
||||||
@@ -306,7 +306,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) {
|
public static final Supplier<SpigotWorldConfig> SPIGOT_WORLD_DEFAULTS = Suppliers.memoize(() -> new SpigotWorldConfig(RandomStringUtils.randomAlphabetic(255)) {
|
||||||
@Override // override to ensure "verbose" is false
|
@Override // override to ensure "verbose" is false
|
||||||
@@ -143,11 +144,68 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -145,11 +146,68 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
public static final ContextKey<Supplier<SpigotWorldConfig>> SPIGOT_WORLD_CONFIG_CONTEXT_KEY = new ContextKey<>(new TypeToken<Supplier<SpigotWorldConfig>>() {}, "spigot world config");
|
public static final ContextKey<Supplier<SpigotWorldConfig>> SPIGOT_WORLD_CONFIG_CONTEXT_KEY = new ContextKey<>(new TypeToken<Supplier<SpigotWorldConfig>>() {}, "spigot world config");
|
||||||
@@ -377,7 +377,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int globalConfigVersion() {
|
protected int globalConfigVersion() {
|
||||||
@@ -162,14 +220,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -164,14 +222,11 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
@Override
|
@Override
|
||||||
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
|
protected YamlConfigurationLoader.Builder createLoaderBuilder() {
|
||||||
return super.createLoaderBuilder()
|
return super.createLoaderBuilder()
|
||||||
@@ -394,7 +394,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
.register(IntOr.Default.SERIALIZER)
|
.register(IntOr.Default.SERIALIZER)
|
||||||
.register(IntOr.Disabled.SERIALIZER)
|
.register(IntOr.Disabled.SERIALIZER)
|
||||||
.register(DoubleOr.Default.SERIALIZER)
|
.register(DoubleOr.Default.SERIALIZER)
|
||||||
@@ -181,6 +236,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -183,6 +238,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
@Override
|
@Override
|
||||||
protected ObjectMapper.Factory.Builder createGlobalObjectMapperFactoryBuilder() {
|
protected ObjectMapper.Factory.Builder createGlobalObjectMapperFactoryBuilder() {
|
||||||
return defaultGlobalFactoryBuilder(super.createGlobalObjectMapperFactoryBuilder());
|
return defaultGlobalFactoryBuilder(super.createGlobalObjectMapperFactoryBuilder());
|
||||||
@@ -189,6 +245,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -191,6 +247,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
private static ObjectMapper.Factory.Builder defaultGlobalFactoryBuilder(ObjectMapper.Factory.Builder builder) {
|
private static ObjectMapper.Factory.Builder defaultGlobalFactoryBuilder(ObjectMapper.Factory.Builder builder) {
|
||||||
return builder.addDiscoverer(InnerClassFieldDiscoverer.globalConfig());
|
return builder.addDiscoverer(InnerClassFieldDiscoverer.globalConfig());
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected YamlConfigurationLoader.Builder createGlobalLoaderBuilder() {
|
protected YamlConfigurationLoader.Builder createGlobalLoaderBuilder() {
|
||||||
@@ -211,6 +268,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -213,6 +270,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
return configuration;
|
return configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +418,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
@Override
|
@Override
|
||||||
protected ContextMap.Builder createDefaultContextMap(final RegistryAccess registryAccess) {
|
protected ContextMap.Builder createDefaultContextMap(final RegistryAccess registryAccess) {
|
||||||
return super.createDefaultContextMap(registryAccess)
|
return super.createDefaultContextMap(registryAccess)
|
||||||
@@ -224,8 +282,9 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -226,8 +284,9 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
.addNodeResolver(new NestedSetting.Factory())
|
.addNodeResolver(new NestedSetting.Factory())
|
||||||
.addDiscoverer(InnerClassFieldDiscoverer.worldConfig(createWorldConfigInstance(contextMap)));
|
.addDiscoverer(InnerClassFieldDiscoverer.worldConfig(createWorldConfigInstance(contextMap)));
|
||||||
}
|
}
|
||||||
@@ -429,7 +429,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
return new WorldConfiguration(
|
return new WorldConfiguration(
|
||||||
contextMap.require(PaperConfigurations.SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(),
|
contextMap.require(PaperConfigurations.SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(),
|
||||||
contextMap.require(Configurations.WORLD_KEY)
|
contextMap.require(Configurations.WORLD_KEY)
|
||||||
@@ -237,7 +296,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -239,7 +298,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
final RegistryAccess access = contextMap.require(REGISTRY_ACCESS);
|
final RegistryAccess access = contextMap.require(REGISTRY_ACCESS);
|
||||||
return super.createWorldConfigLoaderBuilder(contextMap)
|
return super.createWorldConfigLoaderBuilder(contextMap)
|
||||||
.defaultOptions(options -> options
|
.defaultOptions(options -> options
|
||||||
@@ -438,7 +438,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
.serializers(serializers -> serializers
|
.serializers(serializers -> serializers
|
||||||
.register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
.register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
|
||||||
.register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
.register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
|
||||||
@@ -256,12 +315,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -259,12 +318,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
|
protected void applyWorldConfigTransformations(final ContextMap contextMap, final ConfigurationNode node, final @Nullable ConfigurationNode defaultsNode) throws ConfigurateException {
|
||||||
@@ -452,7 +452,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
|
|
||||||
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
||||||
V29_ZeroWorldHeight.apply(versionedBuilder);
|
V29_ZeroWorldHeight.apply(versionedBuilder);
|
||||||
@@ -273,11 +327,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -276,11 +330,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyGlobalConfigTransformations(ConfigurationNode node) throws ConfigurateException {
|
protected void applyGlobalConfigTransformations(ConfigurationNode node) throws ConfigurateException {
|
||||||
@@ -465,7 +465,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
|
|
||||||
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
final ConfigurationTransformation.VersionedBuilder versionedBuilder = Transformations.versionedBuilder();
|
||||||
V29_LogIPs.apply(versionedBuilder);
|
V29_LogIPs.apply(versionedBuilder);
|
||||||
@@ -297,6 +347,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -300,6 +350,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
builder.build().apply(worldNode);
|
builder.build().apply(worldNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -473,7 +473,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
@Override
|
@Override
|
||||||
public WorldConfiguration createWorldConfig(final ContextMap contextMap) {
|
public WorldConfiguration createWorldConfig(final ContextMap contextMap) {
|
||||||
final String levelName = contextMap.require(WORLD_NAME);
|
final String levelName = contextMap.require(WORLD_NAME);
|
||||||
@@ -338,6 +389,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -341,6 +392,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
.put(GAME_RULES, gameRules)
|
.put(GAME_RULES, gameRules)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
@@ -481,7 +481,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
|
|
||||||
public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
public static PaperConfigurations setup(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
||||||
final Path legacy = Files.isSymbolicLink(legacyConfig) ? Files.readSymbolicLink(legacyConfig) : legacyConfig;
|
final Path legacy = Files.isSymbolicLink(legacyConfig) ? Files.readSymbolicLink(legacyConfig) : legacyConfig;
|
||||||
@@ -371,12 +423,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -374,12 +426,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
throw new RuntimeException("Could not convert '" + legacyFileName + "' to the new configuration format", ex);
|
throw new RuntimeException("Could not convert '" + legacyFileName + "' to the new configuration format", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,7 +495,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void convert(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
private static void convert(final Path legacyConfig, final Path configDir, final Path worldFolder, final File spigotConfig) throws Exception {
|
||||||
@@ -427,6 +474,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -430,6 +477,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
return Files.exists(legacyConfig) && Files.isRegularFile(legacyConfig);
|
return Files.exists(legacyConfig) && Files.isRegularFile(legacyConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,7 +503,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public YamlConfiguration createLegacyObject(final MinecraftServer server) {
|
public YamlConfiguration createLegacyObject(final MinecraftServer server) {
|
||||||
YamlConfiguration global = YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.globalConfigFileName).toFile());
|
YamlConfiguration global = YamlConfiguration.loadConfiguration(this.globalFolder.resolve(this.globalConfigFileName).toFile());
|
||||||
@@ -437,6 +485,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -440,6 +488,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
}
|
}
|
||||||
return global;
|
return global;
|
||||||
}
|
}
|
||||||
@@ -511,7 +511,7 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static YamlConfiguration loadLegacyConfigFile(File configFile) throws Exception {
|
public static YamlConfiguration loadLegacyConfigFile(File configFile) throws Exception {
|
||||||
@@ -459,10 +508,13 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
@@ -462,10 +511,13 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||||
return BasicConfigurationNode.root(options);
|
return BasicConfigurationNode.root(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,10 +526,10 @@ index ee0d1df78838e05450ad1a06ce70eab2d5e5d3b8..acfd2e0b6bb20af237bffb2540a9b45d
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index e36b9964569c8476ca25386c783fb8323f637476..ccfeda1ba3f89112eccf29f382b5526934db1d91 100644
|
index 20f79bcd7613e426b6b1020f586773819f1ac9d0..20266ef8f0974f47581e71175de4b01ea1a27bf0 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -318,6 +318,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -328,6 +328,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
public final double[] recentTps = new double[ 4 ]; // Purpur
|
public final double[] recentTps = new double[ 4 ]; // Purpur
|
||||||
// Spigot end
|
// Spigot end
|
||||||
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
||||||
@@ -537,7 +537,7 @@ index e36b9964569c8476ca25386c783fb8323f637476..ccfeda1ba3f89112eccf29f382b55269
|
|||||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||||
public boolean lagging = false; // Purpur
|
public boolean lagging = false; // Purpur
|
||||||
protected boolean upnp = false; // Purpur
|
protected boolean upnp = false; // Purpur
|
||||||
@@ -500,6 +501,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -515,6 +516,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
||||||
@@ -605,10 +605,10 @@ index 33e3815a0c979609d4c7ab83ad91e87ac07a556d..4f1071c48fec78036d6759cdff179df3
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index dae03900ee8b73448e216891fa8e9a7b5c41ddc2..65594336920c8999c2e2847ebcc80577381de6f3 100644
|
index 193c62ed303d25558d78f1e8dfb655919335fdf6..d4a9b187b01c63342d9b05b5c29bb1d199deed6c 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -235,6 +235,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -232,6 +232,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
// Paper start - initialize global and world-defaults configuration
|
// Paper start - initialize global and world-defaults configuration
|
||||||
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
|
||||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
||||||
@@ -617,7 +617,7 @@ index dae03900ee8b73448e216891fa8e9a7b5c41ddc2..65594336920c8999c2e2847ebcc80577
|
|||||||
// Paper end - initialize global and world-defaults configuration
|
// Paper end - initialize global and world-defaults configuration
|
||||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||||
@@ -246,6 +248,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -243,6 +245,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
|
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); // Paper - start watchdog thread
|
||||||
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
|
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
|
||||||
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||||||
@@ -626,21 +626,20 @@ index dae03900ee8b73448e216891fa8e9a7b5c41ddc2..65594336920c8999c2e2847ebcc80577
|
|||||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 067b10134b087626e05596225744b905211e8b63..dfcd3989ffbd4aa5dc9368a34b95c1c2748c23a2 100644
|
index 6a359f1ed07aa7b9c78e470fb00661ea03eaec03..a4421517b8136bb974e197eaa6dd0d83c2fdd0de 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -506,7 +506,25 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -600,7 +600,24 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
|
||||||
|
|
||||||
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||||
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
|
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||||
|
- super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env, spigotConfig -> minecraftserver.paperConfigurations.createWorldConfig(io.papermc.paper.configuration.PaperConfigurations.createWorldContextMap(convertable_conversionsession.levelDirectory.path(), iworlddataserver.getLevelName(), resourcekey.location(), spigotConfig, minecraftserver.registryAccess(), iworlddataserver.getGameRules())), executor); // Paper - create paper world configs; Async-Anti-Xray: Pass executor
|
||||||
+ // Plazma start - Configurable Plazma
|
+ // Plazma start - Configurable Plazma
|
||||||
+ super(
|
+ super(
|
||||||
+ iworlddataserver,
|
+ iworlddataserver,
|
||||||
+ resourcekey,
|
+ resourcekey,
|
||||||
+ minecraftserver.registryAccess(),
|
+ minecraftserver.registryAccess(),
|
||||||
+ worlddimension.type(),
|
+ worlddimension.type(),
|
||||||
+ minecraftserver::getProfiler,
|
|
||||||
+ false,
|
+ false,
|
||||||
+ flag,
|
+ flag,
|
||||||
+ i,
|
+ i,
|
||||||
@@ -657,34 +656,34 @@ index 067b10134b087626e05596225744b905211e8b63..dfcd3989ffbd4aa5dc9368a34b95c1c2
|
|||||||
this.convertable = convertable_conversionsession;
|
this.convertable = convertable_conversionsession;
|
||||||
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
index 5057d9d433ba002a22d22adfaf7323b2cfaee9af..253d47418b4e9cbce74584c2461d12e17effd7bb 100644
|
index f8575f94a389d87d8043ae838720dbe2247235c4..0da2014933fe441c4d3dc27c5fe10afa92ca1ec7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
@@ -171,6 +171,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
@@ -172,7 +172,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
return this.paperConfig;
|
return this.paperConfig;
|
||||||
}
|
}
|
||||||
// Paper end - add paper world config
|
// Paper end - add paper world config
|
||||||
|
-
|
||||||
+ // Plazma start - Configurable Plazma
|
+ // Plazma start - Configurable Plazma
|
||||||
+ private final org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig;
|
+ private final org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig;
|
||||||
+ public org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig() {
|
+ public org.plazmamc.plazma.configurations.WorldConfigurations plazmaConfig() {
|
||||||
+ return this.plazmaConfig;
|
+ return this.plazmaConfig;
|
||||||
+ }
|
+ }
|
||||||
+ // Plazma end - Configurable Plazma
|
+ // Plazma end - Configurable Plazma
|
||||||
|
|
||||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||||
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
public final org.purpurmc.purpur.PurpurWorldConfig purpurConfig; // Purpur
|
||||||
@@ -728,9 +734,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
public static BlockPos lastPhysicsProblem; // Spigot
|
||||||
|
@@ -874,7 +879,24 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
}
|
}
|
||||||
// Paper end - optimise random ticking
|
// Paper end - optimise random ticking
|
||||||
|
|
||||||
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray
|
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray
|
||||||
+ // Plazma start - Configurable Plazma
|
+ // Plazma start - Configurable Plazma
|
||||||
+ protected Level(
|
+ protected Level(
|
||||||
+ WritableLevelData worlddatamutable,
|
+ WritableLevelData worlddatamutable,
|
||||||
+ ResourceKey<Level> resourcekey,
|
+ ResourceKey<Level> resourcekey,
|
||||||
+ RegistryAccess iregistrycustom,
|
+ RegistryAccess iregistrycustom,
|
||||||
+ Holder<DimensionType> holder,
|
+ Holder<DimensionType> holder,
|
||||||
+ Supplier<ProfilerFiller> supplier,
|
|
||||||
+ boolean flag,
|
+ boolean flag,
|
||||||
+ boolean flag1,
|
+ boolean flag1,
|
||||||
+ long i,
|
+ long i,
|
||||||
@@ -697,6 +696,11 @@ index 5057d9d433ba002a22d22adfaf7323b2cfaee9af..253d47418b4e9cbce74584c2461d12e1
|
|||||||
+ java.util.concurrent.Executor executor
|
+ java.util.concurrent.Executor executor
|
||||||
+ ) {
|
+ ) {
|
||||||
+ // Plazma end - Configurable Plazma
|
+ // Plazma end - Configurable Plazma
|
||||||
|
// Paper start - getblock optimisations - cache world height/sections
|
||||||
|
final DimensionType dimType = holder.value();
|
||||||
|
this.minY = dimType.minY();
|
||||||
|
@@ -886,6 +908,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
|
// Paper end - getblock optimisations - cache world height/sections
|
||||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||||
+ this.plazmaConfig = plazmaWorldConfigurationCreator.apply(this.spigotConfig); // Plazma - Configurable Plazma
|
+ this.plazmaConfig = plazmaWorldConfigurationCreator.apply(this.spigotConfig); // Plazma - Configurable Plazma
|
||||||
@@ -704,10 +708,10 @@ index 5057d9d433ba002a22d22adfaf7323b2cfaee9af..253d47418b4e9cbce74584c2461d12e1
|
|||||||
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
|
this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur
|
||||||
this.generator = gen;
|
this.generator = gen;
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 8854e3adca98214697fdfa7f1296e2d66b5afa48..0bd9f4dc28bb67def4af402f88b05a257262c0a4 100644
|
index 81922bf93f8a96e6cf05944ca98a82cc5945a6c6..655463a7d588ed88778d137b6fe5ac18951ff172 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1086,6 +1086,7 @@ public final class CraftServer implements Server {
|
@@ -1100,6 +1100,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||||
@@ -715,7 +719,7 @@ index 8854e3adca98214697fdfa7f1296e2d66b5afa48..0bd9f4dc28bb67def4af402f88b05a25
|
|||||||
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
org.purpurmc.purpur.PurpurConfig.init((File) console.options.valueOf("purpur-settings")); // Purpur
|
||||||
for (ServerLevel world : this.console.getAllLevels()) {
|
for (ServerLevel world : this.console.getAllLevels()) {
|
||||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||||
@@ -3068,6 +3069,13 @@ public final class CraftServer implements Server {
|
@@ -3112,6 +3113,13 @@ public final class CraftServer implements Server {
|
||||||
}
|
}
|
||||||
// Purpur end
|
// Purpur end
|
||||||
|
|
||||||
@@ -730,7 +734,7 @@ index 8854e3adca98214697fdfa7f1296e2d66b5afa48..0bd9f4dc28bb67def4af402f88b05a25
|
|||||||
public void restart() {
|
public void restart() {
|
||||||
org.spigotmc.RestartCommand.restart();
|
org.spigotmc.RestartCommand.restart();
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
index 8d67bf7aaed07a3438f29347bd3b1fd6c9efac2e..f12a0a44c31de3983f207678bbd7fe232e13e14c 100644
|
index 75a062e1105c2f7cc631a6b8b201b0e08621e3c5..b75e2a9273e9562a3d07f68af927ad085c428589 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||||
@@ -197,6 +197,14 @@ public class Main {
|
@@ -197,6 +197,14 @@ public class Main {
|
||||||
@@ -1013,16 +1017,20 @@ index 0000000000000000000000000000000000000000..b6664ba0fce55f5cfa0c8d3051dc8c2b
|
|||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..d8006ae086c18a4ef43906d516eba0d5fd397f5f
|
index 0000000000000000000000000000000000000000..b638690d5cd2360444e6c525f97f634d8e1dc60e
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -0,0 +1,26 @@
|
@@ -0,0 +1,30 @@
|
||||||
+package org.plazmamc.plazma.configurations;
|
+package org.plazmamc.plazma.configurations;
|
||||||
+
|
+
|
||||||
+import io.papermc.paper.configuration.Configuration;
|
+import io.papermc.paper.configuration.Configuration;
|
||||||
+import io.papermc.paper.configuration.ConfigurationPart;
|
+import io.papermc.paper.configuration.ConfigurationPart;
|
||||||
|
+import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
||||||
|
+import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
|
||||||
|
+import net.minecraft.Util;
|
||||||
+import org.jetbrains.annotations.NotNull;
|
+import org.jetbrains.annotations.NotNull;
|
||||||
+import org.spongepowered.configurate.objectmapping.meta.Setting;
|
+import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||||
|
+import java.util.List;
|
||||||
+
|
+
|
||||||
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "InnerClassMayBeStatic"})
|
+@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "InnerClassMayBeStatic"})
|
||||||
+public class GlobalConfiguration extends ConfigurationPart {
|
+public class GlobalConfiguration extends ConfigurationPart {
|
||||||
@@ -1315,8 +1323,35 @@ index 0000000000000000000000000000000000000000..f2d3d51cb4b8fc7a5fd6db1a63289fff
|
|||||||
+ int version = VERSION;
|
+ int version = VERSION;
|
||||||
+
|
+
|
||||||
+}
|
+}
|
||||||
|
diff --git a/src/main/java/plazma/Config.java b/src/main/java/plazma/Config.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..dbba467f668600ef3dcc653d9bfe1f712c69e245
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/plazma/Config.java
|
||||||
|
@@ -0,0 +1,21 @@
|
||||||
|
+package plazma;
|
||||||
|
+
|
||||||
|
+import org.jetbrains.annotations.Contract;
|
||||||
|
+import org.jspecify.annotations.NonNull;
|
||||||
|
+import org.plazmamc.plazma.configurations.GlobalConfiguration;
|
||||||
|
+import org.plazmamc.plazma.configurations.PlazmaConfigurations;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
|
+public interface Config {
|
||||||
|
+
|
||||||
|
+ @Contract(pure = true)
|
||||||
|
+ static boolean optimize() {
|
||||||
|
+ return PlazmaConfigurations.optimize();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Contract(pure = true)
|
||||||
|
+ static @NonNull GlobalConfiguration get() {
|
||||||
|
+ return GlobalConfiguration.get();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
diff --git a/src/test/java/org/bukkit/support/DummyServerHelper.java b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
index cb2b39c562f609375b9e5b20cb5899780995373d..272ccfb9bbbf526b596dcc367397e52e84223daf 100644
|
index 309d371247adcddf0a1b370cc5faff3e6e01cb0f..285a90ff5cdc8cb28fafd4ea3dae306ae5b899c9 100644
|
||||||
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
--- a/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
+++ b/src/test/java/org/bukkit/support/DummyServerHelper.java
|
||||||
@@ -92,6 +92,7 @@ public final class DummyServerHelper {
|
@@ -92,6 +92,7 @@ public final class DummyServerHelper {
|
||||||
@@ -5,21 +5,27 @@ Subject: [PATCH] Setup basic configuration sections
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index d8006ae086c18a4ef43906d516eba0d5fd397f5f..57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb 100644
|
index b638690d5cd2360444e6c525f97f634d8e1dc60e..35d5bd2f7dba1aa74547b6ae994bc84a56911bf2 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -3,6 +3,7 @@ package org.plazmamc.plazma.configurations;
|
@@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
|
||||||
import io.papermc.paper.configuration.Configuration;
|
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
|
||||||
import io.papermc.paper.configuration.ConfigurationPart;
|
import net.minecraft.Util;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
+import org.spongepowered.configurate.objectmapping.meta.PostProcess;
|
+import org.spongepowered.configurate.objectmapping.meta.PostProcess;
|
||||||
import org.spongepowered.configurate.objectmapping.meta.Setting;
|
import org.spongepowered.configurate.objectmapping.meta.Setting;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "InnerClassMayBeStatic"})
|
@@ -27,4 +28,55 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
@@ -23,4 +24,43 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
||||||
@Setting(Configuration.VERSION_FIELD)
|
@Setting(Configuration.VERSION_FIELD)
|
||||||
int version = VERSION;
|
int version = VERSION;
|
||||||
|
|
||||||
|
+ public Command command;
|
||||||
|
+ public class Command extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ public Player player;
|
+ public Player player;
|
||||||
+ public class Player extends ConfigurationPart {
|
+ public class Player extends ConfigurationPart {
|
||||||
+
|
+
|
||||||
@@ -53,6 +59,12 @@ index d8006ae086c18a4ef43906d516eba0d5fd397f5f..57d29f8f3bc89529db9ee8f6dc3fffdb
|
|||||||
+
|
+
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ public Structure structure;
|
||||||
|
+ public class Structure extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ public Miscellaneous misc;
|
+ public Miscellaneous misc;
|
||||||
+ public class Miscellaneous extends ConfigurationPart {
|
+ public class Miscellaneous extends ConfigurationPart {
|
||||||
+
|
+
|
||||||
@@ -60,11 +72,28 @@ index d8006ae086c18a4ef43906d516eba0d5fd397f5f..57d29f8f3bc89529db9ee8f6dc3fffdb
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
|
||||||
|
index 25c0f5d28107b45677aa7b19bc0d5238512d9826..ac0f038de0ce5cf6df0b730af69d3229c3119eff 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
|
||||||
|
@@ -2,9 +2,12 @@ package org.plazmamc.plazma.configurations;
|
||||||
|
|
||||||
|
import org.spongepowered.configurate.NodePath;
|
||||||
|
|
||||||
|
+import static org.spongepowered.configurate.NodePath.path;
|
||||||
|
+
|
||||||
|
interface RemovedConfigurations {
|
||||||
|
|
||||||
|
NodePath[] WORLD_PATHS = {
|
||||||
|
+ path("structure", "nether-portal")
|
||||||
|
};
|
||||||
|
|
||||||
|
NodePath[] GLOBAL_PATHS = {
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..8dce68cf7769fcd5ea03be32621ccb6bab174697 100644
|
index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..c222d58520b655b54b8975ec226a4ba948691cd4 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -19,4 +19,38 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -19,4 +19,44 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
@Setting(Configuration.VERSION_FIELD)
|
@Setting(Configuration.VERSION_FIELD)
|
||||||
int version = VERSION;
|
int version = VERSION;
|
||||||
|
|
||||||
@@ -101,5 +130,11 @@ index f2d3d51cb4b8fc7a5fd6db1a63289fff6d32a1ea..8dce68cf7769fcd5ea03be32621ccb6b
|
|||||||
+
|
+
|
||||||
+
|
+
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
+ public Item item;
|
||||||
|
+ public class Item extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Warn on startup
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index e9842bf7e43a4fdfc4a23d6ee13d56a8cf4fb77a..5aea9b3cc84bcfba940e13e8f680899f5df67856 100644
|
index 8f77566bef4b992013e3b65068cabe7ee1921951..65fd553887ed9eb9c26e036c8009179a7baf5380 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -113,6 +113,18 @@ public class Main {
|
@@ -113,6 +113,18 @@ public class Main {
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Always agree EULA on development mode
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 3bb91f4d0447fc283c56ffab24cb8e203925ebad..95df5b7c437f95849b193345640e6001aed71a3d 100644
|
index 41005f58fdd526907972185e728bbe1fa97171e9..746ad8087192931400256c8a1ef71e966eaf6b1a 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -141,7 +141,7 @@ fun TaskContainer.registerRunTask(
|
@@ -164,7 +164,7 @@ fun TaskContainer.registerRunTask(
|
||||||
languageVersion.set(JavaLanguageVersion.of(21))
|
languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||||
})
|
})
|
||||||
@@ -18,25 +18,14 @@ index 3bb91f4d0447fc283c56ffab24cb8e203925ebad..95df5b7c437f95849b193345640e6001
|
|||||||
if (rootProject.childProjects["test-plugin"] != null) {
|
if (rootProject.childProjects["test-plugin"] != null) {
|
||||||
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
|
val testPluginJar = rootProject.project(":test-plugin").tasks.jar.flatMap { it.archiveFile }
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index 5aea9b3cc84bcfba940e13e8f680899f5df67856..2807a67ad42b35045ef9f607062403c376e0c4ef 100644
|
index 65fd553887ed9eb9c26e036c8009179a7baf5380..694b126df2c3d1d6fa40ee9731c28886caf1a4fc 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -179,6 +179,7 @@ public class Main {
|
@@ -179,6 +179,7 @@ public class Main {
|
||||||
|
|
||||||
// Spigot Start
|
// Spigot Start
|
||||||
boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
|
boolean eulaAgreed = Boolean.getBoolean( "com.mojang.eula.agree" );
|
||||||
+ eulaAgreed = eulaAgreed || org.plazmamc.plazma.Options.DEVELOPMENT; // Plazma - Always agree EULA on development mode
|
+ eulaAgreed = eulaAgreed || Boolean.getBoolean("Paper.pushPaperAssetsRoot"); // Plazma - Always agree EULA on development mode
|
||||||
if ( eulaAgreed )
|
if ( eulaAgreed )
|
||||||
{
|
{
|
||||||
System.err.println( "You have used the Spigot command line EULA agreement flag." );
|
System.err.println( "You have used the Spigot command line EULA agreement flag." );
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
|
||||||
index 5d41bd4d4b86ca0c7c03d3ac6e75b3f1f1abe73b..b891735728e14c40c67e21897b5043efc7077b7f 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
|
||||||
@@ -7,5 +7,6 @@ public interface Options {
|
|
||||||
|
|
||||||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
|
||||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
|
||||||
+ boolean DEVELOPMENT = getBoolean("Plazma.DevelopmentEnvironment");
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add more metrics
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
index 81b204c03b3c9a997f00fd423daa963757cb0daf..67e299893b7e1a64ab2962d79c2434dad189eed5 100644
|
index 8d5a52c5762c3d9b44dcdf00ae312e0bdc01fa1f..48d33d4131af90eee35c9553898a2ac7ec5e2b7e 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||||
@@ -636,38 +636,59 @@ public class Metrics {
|
@@ -636,38 +636,59 @@ public class Metrics {
|
||||||
@@ -9,10 +9,10 @@ Subject: [PATCH] Optimize default configurations
|
|||||||
- YouHaveTrouble/minecraft-exploits-and-how-to-fix-them
|
- YouHaveTrouble/minecraft-exploits-and-how-to-fix-them
|
||||||
|
|
||||||
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||||
index 8f1645573780d12bf29d441d31eab1b76cd9e70f..8e35f7fbe3629ab05c16f52d72a3cd7343cf835f 100644
|
index 411c81a88b8a008b2aaf0ca62fb7ffa1dd9e32a4..53dc2e3c22c5cb038b9a283112f265d362f187e3 100644
|
||||||
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||||
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
||||||
@@ -64,7 +64,7 @@ public class PufferfishConfig {
|
@@ -61,7 +61,7 @@ public class PufferfishConfig {
|
||||||
getString("info.version", "1.0");
|
getString("info.version", "1.0");
|
||||||
setComment("info",
|
setComment("info",
|
||||||
"Pufferfish Configuration",
|
"Pufferfish Configuration",
|
||||||
@@ -21,56 +21,35 @@ index 8f1645573780d12bf29d441d31eab1b76cd9e70f..8e35f7fbe3629ab05c16f52d72a3cd73
|
|||||||
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
|
"Join our Discord for support: https://discord.gg/reZw4vQV9H",
|
||||||
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
|
"Download new builds at https://ci.pufferfish.host/job/Pufferfish");
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ public class PufferfishConfig {
|
@@ -216,7 +216,7 @@ public class PufferfishConfig {
|
||||||
public static int maxProjectileLoadsPerTick;
|
public static int maxProjectileLoadsPerTick;
|
||||||
public static int maxProjectileLoadsPerProjectile;
|
public static int maxProjectileLoadsPerProjectile;
|
||||||
private static void projectileLoading() {
|
private static void projectileLoading() {
|
||||||
- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
|
- maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick.");
|
||||||
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma - Optimize default configurations
|
+ maxProjectileLoadsPerTick = getInt("projectile.max-loads-per-tick", plazma.Config.optimize() ? 8 : 10, "Controls how many chunks are allowed", "to be sync loaded by projectiles in a tick."); // Plazma - Optimize default configurations
|
||||||
maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
|
maxProjectileLoadsPerProjectile = getInt("projectile.max-loads-per-projectile", 10, "Controls how many chunks a projectile", "can load in its lifetime before it gets", "automatically removed.");
|
||||||
|
|
||||||
setComment("projectile", "Optimizes projectile settings");
|
setComment("projectile", "Optimizes projectile settings");
|
||||||
@@ -233,12 +233,12 @@ public class PufferfishConfig {
|
@@ -230,12 +230,12 @@ public class PufferfishConfig {
|
||||||
public static int activationDistanceMod;
|
public static int activationDistanceMod;
|
||||||
|
|
||||||
private static void dynamicActivationOfBrains() throws IOException {
|
private static void dynamicActivationOfBrains() throws IOException {
|
||||||
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
|
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
|
||||||
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()); // Purpur // Plazma - Optimize default configurations
|
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", plazma.Config.optimize()); // Purpur // Plazma - Optimize default configurations
|
||||||
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
|
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
|
||||||
"This value determines how far away an entity has to be",
|
"This value determines how far away an entity has to be",
|
||||||
"from the player to start being effected by DEAR.");
|
"from the player to start being effected by DEAR.");
|
||||||
startDistanceSquared = startDistance * startDistance;
|
startDistanceSquared = startDistance * startDistance;
|
||||||
- maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20,
|
- maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", 20,
|
||||||
+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize() ? 7 : 8, // Plazma - Optimize default configurations
|
+ maximumActivationPrio = getInt("dab.max-tick-freq", "activation-range.max-tick-freq", plazma.Config.optimize() ? 7 : 8, // Plazma - Optimize default configurations
|
||||||
"This value defines how often in ticks, the furthest entity",
|
"This value defines how often in ticks, the furthest entity",
|
||||||
"will get their pathfinders and behaviors ticked. 20 = 1s");
|
"will get their pathfinders and behaviors ticked. 20 = 1s");
|
||||||
activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8,
|
activationDistanceMod = getInt("dab.activation-dist-mod", "activation-range.activation-dist-mod", 8,
|
||||||
@@ -261,8 +261,18 @@ public class PufferfishConfig {
|
|
||||||
public static Map<String, Integer> projectileTimeouts;
|
|
||||||
private static void projectileTimeouts() {
|
|
||||||
// Set some defaults
|
|
||||||
- getInt("entity_timeouts.SNOWBALL", -1);
|
|
||||||
- getInt("entity_timeouts.LLAMA_SPIT", -1);
|
|
||||||
+ // Plazma start - Optimize default configurations
|
|
||||||
+ if (org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize()) {
|
|
||||||
+ getInt("entity_timeouts.ARROW", 200);
|
|
||||||
+ getInt("entity_timeouts.EGG", 200);
|
|
||||||
+ getInt("entity_timeouts.ENDER_PEARL", 200);
|
|
||||||
+ getInt("entity_timeouts.SNOWBALL", 200);
|
|
||||||
+ getInt("entity_timeouts.LLAMA_SPIT", 200);
|
|
||||||
+ } else {
|
|
||||||
+ getInt("entity_timeouts.SNOWBALL", -1);
|
|
||||||
+ getInt("entity_timeouts.LLAMA_SPIT", -1);
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Optimize default configurations
|
|
||||||
setComment("entity_timeouts",
|
|
||||||
"These values define a entity's maximum lifespan. If an",
|
|
||||||
"entity is in this list and it has survived for longer than",
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||||
index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d8e4b9f6c 100644
|
index 17e23ca4dd2bbfba49ea00aa2b719a95feb931be..a8e75eaadfcc6c8b2503776d7de197f756712819 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||||
@@ -172,7 +172,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -147,7 +147,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
public class Watchdog extends ConfigurationPart {
|
public class Watchdog extends ConfigurationPart {
|
||||||
public int earlyWarningEvery = 5000;
|
public int earlyWarningEvery = 5000;
|
||||||
@@ -79,7 +58,7 @@ index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d
|
|||||||
}
|
}
|
||||||
|
|
||||||
public SpamLimiter spamLimiter;
|
public SpamLimiter spamLimiter;
|
||||||
@@ -214,7 +214,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -187,7 +187,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public Commands commands;
|
public Commands commands;
|
||||||
|
|
||||||
public class Commands extends ConfigurationPart {
|
public class Commands extends ConfigurationPart {
|
||||||
@@ -88,7 +67,7 @@ index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d
|
|||||||
public boolean fixTargetSelectorTagCompletion = true;
|
public boolean fixTargetSelectorTagCompletion = true;
|
||||||
public boolean timeCommandAffectsAllWorlds = false;
|
public boolean timeCommandAffectsAllWorlds = false;
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -253,7 +253,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public BookSize bookSize;
|
public BookSize bookSize;
|
||||||
|
|
||||||
public class BookSize extends ConfigurationPart {
|
public class BookSize extends ConfigurationPart {
|
||||||
@@ -97,7 +76,7 @@ index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d
|
|||||||
public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class
|
public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class
|
||||||
}
|
}
|
||||||
public boolean resolveSelectorsInBooks = false;
|
public boolean resolveSelectorsInBooks = false;
|
||||||
@@ -274,7 +274,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -264,7 +264,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public class PacketLimiter extends ConfigurationPart {
|
public class PacketLimiter extends ConfigurationPart {
|
||||||
public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED);
|
public Component kickMessage = Component.translatable("disconnect.exceeded_packet_rate", NamedTextColor.RED);
|
||||||
public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK);
|
public PacketLimit allPackets = new PacketLimit(7.0, 500.0, PacketLimit.ViolateAction.KICK);
|
||||||
@@ -114,7 +93,7 @@ index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d
|
|||||||
|
|
||||||
@ConfigSerializable
|
@ConfigSerializable
|
||||||
public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) {
|
public record PacketLimit(@Required double interval, @Required double maxPacketRate, ViolateAction action) {
|
||||||
@@ -342,7 +350,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -332,7 +340,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
executor.setMaximumPoolSize(_chatExecutorMaxSize);
|
executor.setMaximumPoolSize(_chatExecutorMaxSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,10 +103,10 @@ index a9dd0e5216e95afd98fd2200d110e2cc0b1b0dca..d417b773dec5f2c4a8e115864338612d
|
|||||||
public boolean loadPermissionsYmlBeforePlugins = true;
|
public boolean loadPermissionsYmlBeforePlugins = true;
|
||||||
@Constraints.Min(4)
|
@Constraints.Min(4)
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||||
index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae8368bec410b 100644
|
index 82210667376fd466d5d4cdcb56b62f6165bd5cde..3c6e9ec236bfd851700ce7fae2599b725ec899eb 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
--- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
|
||||||
@@ -100,12 +100,32 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -103,12 +103,32 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
public class AntiXray extends ConfigurationPart {
|
public class AntiXray extends ConfigurationPart {
|
||||||
public boolean enabled = false;
|
public boolean enabled = false;
|
||||||
@@ -163,7 +142,7 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
//<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
|
//<editor-fold desc="Anti-Xray Hidden Blocks" defaultstate="collapsed">
|
||||||
Blocks.COPPER_ORE,
|
Blocks.COPPER_ORE,
|
||||||
Blocks.DEEPSLATE_COPPER_ORE,
|
Blocks.DEEPSLATE_COPPER_ORE,
|
||||||
@@ -132,7 +152,28 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -135,7 +155,28 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
Blocks.ENDER_CHEST
|
Blocks.ENDER_CHEST
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
);
|
);
|
||||||
@@ -193,7 +172,7 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,14 +196,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -157,14 +198,14 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
public ArmorStands armorStands;
|
public ArmorStands armorStands;
|
||||||
|
|
||||||
public class ArmorStands extends ConfigurationPart {
|
public class ArmorStands extends ConfigurationPart {
|
||||||
@@ -211,7 +190,7 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Sniffer sniffer;
|
public Sniffer sniffer;
|
||||||
@@ -407,7 +448,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -415,7 +456,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
public class Environment extends ConfigurationPart {
|
public class Environment extends ConfigurationPart {
|
||||||
public boolean disableThunder = false;
|
public boolean disableThunder = false;
|
||||||
public boolean disableIceAndSnow = false;
|
public boolean disableIceAndSnow = false;
|
||||||
@@ -220,16 +199,16 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
public boolean disableExplosionKnockback = false;
|
public boolean disableExplosionKnockback = false;
|
||||||
public boolean generateFlatBedrock = false;
|
public boolean generateFlatBedrock = false;
|
||||||
public FrostedIce frostedIce;
|
public FrostedIce frostedIce;
|
||||||
@@ -463,7 +504,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -471,7 +512,7 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
public Fixes fixes;
|
public Fixes fixes;
|
||||||
|
|
||||||
public class Fixes extends ConfigurationPart {
|
public class Fixes extends ConfigurationPart {
|
||||||
- public boolean fixItemsMergingThroughWalls = false;
|
- public boolean fixItemsMergingThroughWalls = false;
|
||||||
+ public boolean fixItemsMergingThroughWalls = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations
|
+ public boolean fixItemsMergingThroughWalls = org.plazmamc.plazma.configurations.PlazmaConfigurations.optimize(); // Plazma - Optimize default configurations
|
||||||
public boolean disableUnloadedChunkEnderpearlExploit = true;
|
public boolean disableUnloadedChunkEnderpearlExploit = false;
|
||||||
public boolean preventTntFromMovingInWater = false;
|
public boolean preventTntFromMovingInWater = false;
|
||||||
public boolean splitOverstackedLoot = true;
|
public boolean splitOverstackedLoot = true;
|
||||||
@@ -491,9 +532,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -499,9 +540,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
public class Collisions extends ConfigurationPart {
|
public class Collisions extends ConfigurationPart {
|
||||||
public boolean onlyPlayersCollide = false;
|
public boolean onlyPlayersCollide = false;
|
||||||
public boolean allowVehicleCollisions = true;
|
public boolean allowVehicleCollisions = true;
|
||||||
@@ -241,7 +220,7 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
public boolean allowPlayerCrammingDamage = false;
|
public boolean allowPlayerCrammingDamage = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,18 +542,41 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -509,18 +550,41 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
public class Chunks extends ConfigurationPart {
|
public class Chunks extends ConfigurationPart {
|
||||||
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
|
public AutosavePeriod autoSaveInterval = AutosavePeriod.def();
|
||||||
@@ -291,7 +270,7 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
});
|
});
|
||||||
public boolean flushRegionsOnSave = false;
|
public boolean flushRegionsOnSave = false;
|
||||||
}
|
}
|
||||||
@@ -527,9 +591,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -535,9 +599,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
public TickRates tickRates;
|
public TickRates tickRates;
|
||||||
|
|
||||||
public class TickRates extends ConfigurationPart {
|
public class TickRates extends ConfigurationPart {
|
||||||
@@ -303,7 +282,7 @@ index c867796f625813797f167610ad443c4be5a7561e..ecced20724bc7f6136ff023ca37ae836
|
|||||||
public int wetFarmland = 1;
|
public int wetFarmland = 1;
|
||||||
public int dryFarmland = 1;
|
public int dryFarmland = 1;
|
||||||
public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40));
|
public Table<EntityType<?>, String, Integer> sensor = Util.make(HashBasedTable.create(), table -> table.put(EntityType.VILLAGER, "secondarypoisensor", 40));
|
||||||
@@ -563,9 +627,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
@@ -571,9 +635,9 @@ public class WorldConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
public class Misc extends ConfigurationPart {
|
public class Misc extends ConfigurationPart {
|
||||||
public int lightQueueSize = 20;
|
public int lightQueueSize = 20;
|
||||||
@@ -328,7 +307,7 @@ index 24763d3d270c29c95e0b3e85111145234f660a62..80ddc627e02e3c749e6b074afa93d357
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||||
index 2807a67ad42b35045ef9f607062403c376e0c4ef..7306b1fff556859ccb0a705621a1c7031ed52e29 100644
|
index 694b126df2c3d1d6fa40ee9731c28886caf1a4fc..822ecda5f4dc6cc8cd0cc4da577f27cdcc5c4967 100644
|
||||||
--- a/src/main/java/net/minecraft/server/Main.java
|
--- a/src/main/java/net/minecraft/server/Main.java
|
||||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||||
@@ -164,7 +164,7 @@ public class Main {
|
@@ -164,7 +164,7 @@ public class Main {
|
||||||
@@ -341,7 +320,7 @@ index 2807a67ad42b35045ef9f607062403c376e0c4ef..7306b1fff556859ccb0a705621a1c703
|
|||||||
|
|
||||||
File commandFile = (File) optionset.valueOf("commands-settings");
|
File commandFile = (File) optionset.valueOf("commands-settings");
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
index e0a09827db002b87e738091d820f05a9a97f3edb..135476d68e4d9cb2d6a4cbe30e578e9e5fde90e0 100644
|
index 8f7e922ceca286b1a590181c301fbe9bff55c024..3dd5c7441bb300ca17d717af37edbefb89db4b2f 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
@@ -132,14 +132,14 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
@@ -132,14 +132,14 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
@@ -373,10 +352,10 @@ index e0a09827db002b87e738091d820f05a9a97f3edb..135476d68e4d9cb2d6a4cbe30e578e9e
|
|||||||
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
|
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
|
||||||
this.enableStatus = this.get("enable-status", true);
|
this.enableStatus = this.get("enable-status", true);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 0bd9f4dc28bb67def4af402f88b05a257262c0a4..52d9b6253e05cae57d44f340b33316eff113db2e 100644
|
index 655463a7d588ed88778d137b6fe5ac18951ff172..cc4762c13e21600b4c5e287a6fae9e6e472080b3 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -434,7 +434,7 @@ public final class CraftServer implements Server {
|
@@ -449,7 +449,7 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||||
this.configuration.options().copyDefaults(true);
|
this.configuration.options().copyDefaults(true);
|
||||||
@@ -386,13 +365,13 @@ index 0bd9f4dc28bb67def4af402f88b05a257262c0a4..52d9b6253e05cae57d44f340b33316ef
|
|||||||
if (!this.configuration.isString("aliases")) {
|
if (!this.configuration.isString("aliases")) {
|
||||||
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
index b891735728e14c40c67e21897b5043efc7077b7f..1bb779d7c87dcd1a9c819b08e509f62df0559559 100644
|
index 5d41bd4d4b86ca0c7c03d3ac6e75b3f1f1abe73b..c608770ea0df26859a09b794e93292f4aa6881b4 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
@@ -8,5 +8,6 @@ public interface Options {
|
@@ -7,5 +7,6 @@ public interface Options {
|
||||||
|
|
||||||
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
||||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
||||||
boolean DEVELOPMENT = getBoolean("Plazma.DevelopmentEnvironment");
|
|
||||||
+ boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
+ boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -417,10 +396,10 @@ index 09053b4ccf268fd204c81dbb8d4f10fa9edcad5f..93f67f125b3674e645cfdae27e579e12
|
|||||||
#### ENGLISH ####
|
#### ENGLISH ####
|
||||||
This is the %s configuration file for Plazma.
|
This is the %s configuration file for Plazma.
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||||
index 546d920198acc2a7aea6e251a34d92d33cbaaee7..97fc4fb795fa2dc859b0ea02dc132b41300d56ed 100644
|
index 95cd1156766895546ef5574b33a60806bff08fa2..097f3c34d244b89e7dd9f8b6f2a3d8fdc67b36dc 100644
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||||
@@ -243,7 +243,7 @@ public class PurpurConfig {
|
@@ -244,7 +244,7 @@ public class PurpurConfig {
|
||||||
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
laggingThreshold = getDouble("settings.lagging-threshold", laggingThreshold);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +408,7 @@ index 546d920198acc2a7aea6e251a34d92d33cbaaee7..97fc4fb795fa2dc859b0ea02dc132b41
|
|||||||
private static void useAlternateKeepAlive() {
|
private static void useAlternateKeepAlive() {
|
||||||
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
|
useAlternateKeepAlive = getBoolean("settings.use-alternate-keepalive", useAlternateKeepAlive);
|
||||||
}
|
}
|
||||||
@@ -492,7 +492,7 @@ public class PurpurConfig {
|
@@ -491,7 +491,7 @@ public class PurpurConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean useUPnP = false;
|
public static boolean useUPnP = false;
|
||||||
@@ -439,7 +418,7 @@ index 546d920198acc2a7aea6e251a34d92d33cbaaee7..97fc4fb795fa2dc859b0ea02dc132b41
|
|||||||
private static void networkSettings() {
|
private static void networkSettings() {
|
||||||
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
useUPnP = getBoolean("settings.network.upnp-port-forwarding", useUPnP);
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||||
index 3bcbf5e2dbb991a8416d827ddfe59e04f701ebf7..1ff95cced54e8230eb5b4b4314f8f3716e264264 100644
|
index 57ddb4e6a464567cc67e09ce06218cc25af4ddf9..e55993e318b7f7292e22c4539bc2fd1447f67fa8 100644
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||||
@@ -424,7 +424,7 @@ public class PurpurWorldConfig {
|
@@ -424,7 +424,7 @@ public class PurpurWorldConfig {
|
||||||
@@ -451,7 +430,7 @@ index 3bcbf5e2dbb991a8416d827ddfe59e04f701ebf7..1ff95cced54e8230eb5b4b4314f8f371
|
|||||||
public boolean teleportOnNetherCeilingDamage = false;
|
public boolean teleportOnNetherCeilingDamage = false;
|
||||||
public boolean totemOfUndyingWorksInInventory = false;
|
public boolean totemOfUndyingWorksInInventory = false;
|
||||||
public boolean playerFixStuckPortal = false;
|
public boolean playerFixStuckPortal = false;
|
||||||
@@ -3247,7 +3247,7 @@ public class PurpurWorldConfig {
|
@@ -3262,7 +3262,7 @@ public class PurpurWorldConfig {
|
||||||
public boolean zombieJockeyOnlyBaby = true;
|
public boolean zombieJockeyOnlyBaby = true;
|
||||||
public double zombieJockeyChance = 0.05D;
|
public double zombieJockeyChance = 0.05D;
|
||||||
public boolean zombieJockeyTryExistingChickens = true;
|
public boolean zombieJockeyTryExistingChickens = true;
|
||||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Add an option to apply the configuration to the vanilla
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||||
index d417b773dec5f2c4a8e115864338612d8e4b9f6c..f89ae1a542120eb01c028a1a1f0771ac211bcd49 100644
|
index a8e75eaadfcc6c8b2503776d7de197f756712819..99cf08bc17eec05463b300c0c9fd108cbfba1b8f 100644
|
||||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||||
@@ -89,7 +89,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -87,7 +87,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public Component flyingVehicle = Component.translatable("multiplayer.disconnect.flying");
|
public Component flyingVehicle = Component.translatable("multiplayer.disconnect.flying");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,10 +19,10 @@ index d417b773dec5f2c4a8e115864338612d8e4b9f6c..f89ae1a542120eb01c028a1a1f0771ac
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 52d9b6253e05cae57d44f340b33316eff113db2e..47cbac24d704a047f56a98c9eb0f8a8b2001ae48 100644
|
index cc4762c13e21600b4c5e287a6fae9e6e472080b3..76f255d12189ffe83426cc7aa85771d5c7cfb111 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -434,7 +434,19 @@ public final class CraftServer implements Server {
|
@@ -449,7 +449,19 @@ public final class CraftServer implements Server {
|
||||||
|
|
||||||
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile());
|
||||||
this.configuration.options().copyDefaults(true);
|
this.configuration.options().copyDefaults(true);
|
||||||
@@ -44,12 +44,12 @@ index 52d9b6253e05cae57d44f340b33316eff113db2e..47cbac24d704a047f56a98c9eb0f8a8b
|
|||||||
if (!this.configuration.isString("aliases")) {
|
if (!this.configuration.isString("aliases")) {
|
||||||
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
legacyAlias = this.configuration.getConfigurationSection("aliases");
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
index 1bb779d7c87dcd1a9c819b08e509f62df0559559..a8711b8a66b443d40cad8dfec31cca357e0877b4 100644
|
index c608770ea0df26859a09b794e93292f4aa6881b4..063b71b3043a69a90130a81686b6a5f1e5f22fd1 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
@@ -9,5 +9,7 @@ public interface Options {
|
@@ -8,5 +8,7 @@ public interface Options {
|
||||||
|
boolean NO_OPTIMIZE = getBoolean("Plazma.disableConfigOptimization");
|
||||||
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
boolean NO_WARN = getBoolean("Plazma.iKnowWhatIAmDoing");
|
||||||
boolean DEVELOPMENT = getBoolean("Plazma.DevelopmentEnvironment");
|
|
||||||
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||||
+ boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
+ boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||||
+ boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
+ boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Tweak console logging
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index 1bc42bcb5ecbf800684484530260192cc0ed0c5f..96b017a58fd12d635822255bb501ef99cdc27da6 100644
|
index d4a9b187b01c63342d9b05b5c29bb1d199deed6c..38752c9ba1726e3c38dd758287a920bc476ef88a 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -197,16 +197,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -194,16 +194,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ index 1bc42bcb5ecbf800684484530260192cc0ed0c5f..96b017a58fd12d635822255bb501ef99
|
|||||||
DedicatedServer.LOGGER.info("Loading properties");
|
DedicatedServer.LOGGER.info("Loading properties");
|
||||||
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();
|
DedicatedServerProperties dedicatedserverproperties = this.settings.getProperties();
|
||||||
|
|
||||||
@@ -238,6 +228,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -235,6 +225,15 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||||
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
||||||
// Paper end - initialize global and world-defaults configuration
|
// Paper end - initialize global and world-defaults configuration
|
||||||
@@ -41,7 +41,7 @@ index 1bc42bcb5ecbf800684484530260192cc0ed0c5f..96b017a58fd12d635822255bb501ef99
|
|||||||
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
this.server.spark.enableEarlyIfRequested(); // Paper - spark
|
||||||
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
// Paper start - fix converting txt to json file; convert old users earlier after PlayerList creation but before file load/save
|
||||||
if (this.convertOldUsers()) {
|
if (this.convertOldUsers()) {
|
||||||
@@ -338,6 +337,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -335,6 +334,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord";
|
||||||
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/";
|
||||||
// Paper end - Add Velocity IP Forwarding Support
|
// Paper end - Add Velocity IP Forwarding Support
|
||||||
@@ -49,7 +49,7 @@ index 1bc42bcb5ecbf800684484530260192cc0ed0c5f..96b017a58fd12d635822255bb501ef99
|
|||||||
if (!this.usesAuthentication()) {
|
if (!this.usesAuthentication()) {
|
||||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||||
@@ -351,7 +351,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -348,7 +348,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
|
||||||
}
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
@@ -59,10 +59,10 @@ index 1bc42bcb5ecbf800684484530260192cc0ed0c5f..96b017a58fd12d635822255bb501ef99
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 0ea07da1b4bd420cd6765577b4719a2368b5740c..f78a0a224c86c0e3e5a44ce4f589cd8a61c546f9 100644
|
index 16999fa20c3621e016d1b0fadfb76f2fe03a2a69..8d7d050f12df83931bbb32f1832d7fcbc06317da 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -1462,6 +1462,7 @@ public abstract class PlayerList {
|
@@ -1426,6 +1426,7 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||||
@@ -71,13 +71,14 @@ index 0ea07da1b4bd420cd6765577b4719a2368b5740c..f78a0a224c86c0e3e5a44ce4f589cd8a
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 57d29f8f3bc89529db9ee8f6dc3fffdbd4a03ceb..3ec9c947ac19412ad81d0cc85e0eff289a285d1e 100644
|
index 35d5bd2f7dba1aa74547b6ae994bc84a56911bf2..e153370e617e63a8e497036c93ea55dfe851bc6e 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -63,4 +63,13 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -79,4 +79,14 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+
|
||||||
+ public ConsoleLogs consoleLogs;
|
+ public ConsoleLogs consoleLogs;
|
||||||
+ public class ConsoleLogs extends ConfigurationPart {
|
+ public class ConsoleLogs extends ConfigurationPart {
|
||||||
+
|
+
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 13:08:37 +0900
|
||||||
|
Subject: [PATCH] Add missing Pufferfish configurations
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||||
|
index 9ef53608f1608e88de7a7b3e96b43d8d2b4230ae..8500ac473581b90036578d66243c5313e2ce3ddf 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||||
|
@@ -161,11 +161,13 @@ public class Armadillo extends Animal {
|
||||||
|
return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic));
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
|
||||||
|
@Override
|
||||||
|
protected void customServerAiStep(ServerLevel world) {
|
||||||
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||||
|
|
||||||
|
gameprofilerfiller.push("armadilloBrain");
|
||||||
|
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
||||||
|
((Brain<Armadillo>) this.brain).tick(world, this); // CraftBukkit - decompile error
|
||||||
|
gameprofilerfiller.pop();
|
||||||
|
gameprofilerfiller.push("armadilloActivityUpdate");
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
|
index dbce71f45c008da883b6d244a06343d83ae25e7e..d2f0b14a0014802605b601e62d0eebddf06d3737 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
|
@@ -152,6 +152,7 @@ public class Camel extends AbstractHorse {
|
||||||
|
return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations
|
||||||
|
@Override
|
||||||
|
protected void customServerAiStep(ServerLevel world) {
|
||||||
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||||
|
@@ -159,6 +160,7 @@ public class Camel extends AbstractHorse {
|
||||||
|
gameprofilerfiller.push("camelBrain");
|
||||||
|
Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
|
||||||
|
|
||||||
|
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
||||||
|
behaviorcontroller.tick(world, this);
|
||||||
|
gameprofilerfiller.pop();
|
||||||
|
gameprofilerfiller.push("camelActivityUpdate");
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||||
|
index 464a16df15d8759d66f94ad080d1ea28b3f6474c..6061cd4fc38fef0895571ab767e495d5755f9fc8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||||
|
@@ -493,11 +493,13 @@ public class Sniffer extends Animal {
|
||||||
|
return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
|
||||||
|
@Override
|
||||||
|
protected void customServerAiStep(ServerLevel world) {
|
||||||
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||||
|
|
||||||
|
gameprofilerfiller.push("snifferBrain");
|
||||||
|
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
||||||
|
this.getBrain().tick(world, this);
|
||||||
|
gameprofilerfiller.popPush("snifferActivityUpdate");
|
||||||
|
SnifferAi.updateActivity(this);
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Sun, 5 Nov 2023 11:27:51 +0900
|
|
||||||
Subject: [PATCH] Add option to change nether portal size
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
|
||||||
index 6c07fc507df6070854f5950a8616d2949c040656..19f58609aedecec1ea1a552c135a0b4199ab5c2a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
|
||||||
@@ -97,7 +97,7 @@ public class PortalShape {
|
|
||||||
private int calculateWidth() {
|
|
||||||
int i = this.getDistanceUntilEdgeAboveFrame(this.bottomLeft, this.rightDir);
|
|
||||||
|
|
||||||
- return i >= 2 && i <= 21 ? i : 0;
|
|
||||||
+ return i >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.min() && i <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.max() ? i : 0; // Plazma - Configurable nether portal size
|
|
||||||
}
|
|
||||||
|
|
||||||
private int getDistanceUntilEdgeAboveFrame(BlockPos pos, Direction direction) {
|
|
||||||
@@ -130,7 +130,7 @@ public class PortalShape {
|
|
||||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
|
||||||
int i = this.getDistanceUntilTop(blockposition_mutableblockposition);
|
|
||||||
|
|
||||||
- return i >= 3 && i <= 21 && this.hasTopFrame(blockposition_mutableblockposition, i) ? i : 0;
|
|
||||||
+ return i >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.min() && i <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.max() && this.hasTopFrame(blockposition_mutableblockposition, i) ? i : 0; // Plazma - Configurable nether portal size
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasTopFrame(BlockPos.MutableBlockPos pos, int height) {
|
|
||||||
@@ -184,7 +184,7 @@ public class PortalShape {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isValid() {
|
|
||||||
- return this.bottomLeft != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
|
|
||||||
+ return this.bottomLeft != null && this.width >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.min() && this.width <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.width.max() && this.height >= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.min() && this.height <= this.level.getMinecraftWorld().plazmaConfig().structure.netherPortal.height.max(); // Plazma - Configurable nether portal size
|
|
||||||
}
|
|
||||||
|
|
||||||
// CraftBukkit start - return boolean, add entity
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
index 8dce68cf7769fcd5ea03be32621ccb6bab174697..7bd566d6e15385850930a6c0b44d1d495a671e81 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
@@ -42,6 +42,21 @@ public class WorldConfigurations extends ConfigurationPart {
|
|
||||||
public NetherPortal netherPortal;
|
|
||||||
public class NetherPortal extends ConfigurationPart {
|
|
||||||
|
|
||||||
+ public Width width;
|
|
||||||
+ public class Width extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ int min = 2; public int min() { return Math.max(this.min, 1); }
|
|
||||||
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public Height height;
|
|
||||||
+ public class Height extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ int min = 3; public int min() { return Math.max(this.min, 2); }
|
|
||||||
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
Date: Sat, 25 Mar 2023 00:52:11 +0900
|
Date: Sat, 25 Mar 2023 00:52:11 +0900
|
||||||
Subject: [PATCH] Add missing purpur configuration options
|
Subject: [PATCH] Add missing Purpur configuration options
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||||
index 62c62fd26660d8405378340315042d7b95ac7046..771fe01b262e951f1350e4997f4cba1b35c79945 100644
|
index 0a173040c56fea6d8f83998b7c66aa8daaf648f2..16b98cad477d7af2d9534cc189aae43a5adc8d58 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java
|
||||||
@@ -158,6 +158,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
@@ -160,6 +160,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
|
||||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.allayMaxHealth);
|
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.allayMaxHealth);
|
||||||
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.allayScale);
|
this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.allayScale);
|
||||||
}
|
}
|
||||||
@@ -28,10 +28,10 @@ index 62c62fd26660d8405378340315042d7b95ac7046..771fe01b262e951f1350e4997f4cba1b
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
index e88d6d691bb176e33afeb294d735dfb2cbac12ff..00803dcc2d990046013b8a175af20359883a15fe 100644
|
index d2f0b14a0014802605b601e62d0eebddf06d3737..459a45f82c42b346a66bb1954e155a0970dcc30f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
||||||
@@ -96,6 +96,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
@@ -96,6 +96,18 @@ public class Camel extends AbstractHorse {
|
||||||
public int getPurpurBreedTime() {
|
public int getPurpurBreedTime() {
|
||||||
return this.level().purpurConfig.camelBreedingTicks;
|
return this.level().purpurConfig.camelBreedingTicks;
|
||||||
}
|
}
|
||||||
@@ -51,10 +51,10 @@ index e88d6d691bb176e33afeb294d735dfb2cbac12ff..00803dcc2d990046013b8a175af20359
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||||
index 4c861b18fbfbae3cb2f1e3563393cfcf4005591c..651f30b4fb02dc03fabad34b62d7d86fa0889754 100644
|
index 02581f47d1ca58c2b8abffc478adf48343585c8b..bd04af6311ca64d81c8829e731ac39a6486ee789 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||||
@@ -160,6 +160,23 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
@@ -163,6 +163,23 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
||||||
public float getJumpPower() {
|
public float getJumpPower() {
|
||||||
return (getRider() != null && isControllable()) ? level().purpurConfig.frogRidableJumpHeight * this.getBlockJumpFactor() : super.getJumpPower();
|
return (getRider() != null && isControllable()) ? level().purpurConfig.frogRidableJumpHeight * this.getBlockJumpFactor() : super.getJumpPower();
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ index 4c861b18fbfbae3cb2f1e3563393cfcf4005591c..651f30b4fb02dc03fabad34b62d7d86f
|
|||||||
|
|
||||||
public int getPurpurBreedTime() {
|
public int getPurpurBreedTime() {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||||
index 5cd69dd546f42e80a3d3e3a674f65c2ac39f3af9..1abf23fb16391087d41d8a180a17e394dd1a7dd0 100644
|
index 7e92e8c4fec36c8838604f17cf366cc80e82b19b..1b0e80ae62b5c5d4e1fcac71b90f83f12fe4878a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||||
@@ -93,6 +93,23 @@ public class Tadpole extends AbstractFish {
|
@@ -93,6 +93,23 @@ public class Tadpole extends AbstractFish {
|
||||||
@@ -107,10 +107,10 @@ index 5cd69dd546f42e80a3d3e3a674f65c2ac39f3af9..1abf23fb16391087d41d8a180a17e394
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||||
index b6f5281705ce4c7a755e3818cf6c4a2235a024f9..bc931f54d1087f2515b8185368ade3e8dd55a00d 100644
|
index 6061cd4fc38fef0895571ab767e495d5755f9fc8..0bc7856065fdc599890f18f5a4e2f6c2b3d94ba7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||||
@@ -120,6 +120,18 @@ public class Sniffer extends Animal {
|
@@ -116,6 +116,18 @@ public class Sniffer extends Animal {
|
||||||
public int getPurpurBreedTime() {
|
public int getPurpurBreedTime() {
|
||||||
return this.level().purpurConfig.snifferBreedingTicks;
|
return this.level().purpurConfig.snifferBreedingTicks;
|
||||||
}
|
}
|
||||||
@@ -130,10 +130,10 @@ index b6f5281705ce4c7a755e3818cf6c4a2235a024f9..bc931f54d1087f2515b8185368ade3e8
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||||
index 8e24cd9ed03e2f11da6f4fb2dd58dd9b9e5d7a06..c0398f21cb2ecc9e07f01163a4432a603ff26f03 100644
|
index 5a62fe9c4f0cee9e8b4a48564f76afec609335b1..79b090030b716029cc4cfc8bf9d81af0b2202313 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||||
@@ -148,6 +148,23 @@ public class Warden extends Monster implements VibrationSystem {
|
@@ -151,6 +151,23 @@ public class Warden extends Monster implements VibrationSystem {
|
||||||
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||||
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
this.targetSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur
|
||||||
}
|
}
|
||||||
@@ -157,26 +157,29 @@ index 8e24cd9ed03e2f11da6f4fb2dd58dd9b9e5d7a06..c0398f21cb2ecc9e07f01163a4432a60
|
|||||||
// Purpur end
|
// Purpur end
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
@@ -305,7 +322,7 @@ public class Warden extends Monster implements VibrationSystem {
|
||||||
index c14019a131c90c699b8a76bada82592b66f0fa89..8b9f78b3b0e00a859f3106fe383352863027f51e 100644
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java
|
|
||||||
@@ -45,12 +45,12 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
|
||||||
|
|
||||||
public ChestBoat(EntityType<? extends Boat> type, Level world) {
|
gameprofilerfiller.push("wardenBrain");
|
||||||
super(type, world);
|
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
||||||
|
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing Purpur configurations
|
||||||
|
this.getBrain().tick(world, this);
|
||||||
|
gameprofilerfiller.pop();
|
||||||
|
super.customServerAiStep(world);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||||
|
index 1f4cc08e84a23213bb9786ea09ad77caeec2d336..f888f1dd2e3c228b0a370fe920b63d547bbba571 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java
|
||||||
|
@@ -46,7 +46,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto
|
||||||
|
|
||||||
|
public AbstractChestBoat(EntityType<? extends AbstractChestBoat> type, Level world, Supplier<Item> itemSupplier) {
|
||||||
|
super(type, world, itemSupplier);
|
||||||
- this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
|
- this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||||
+ this.itemStacks = NonNullList.withSize(org.purpurmc.purpur.PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // Plazma - Add missing purpur configuration options
|
+ this.itemStacks = NonNullList.withSize(org.purpurmc.purpur.PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // Plazma - Add missing purpur configuration options
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChestBoat(Level world, double d0, double d1, double d2) {
|
@Override
|
||||||
super(EntityType.CHEST_BOAT, world);
|
@@ -142,7 +142,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto
|
||||||
- this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY);
|
|
||||||
+ this.itemStacks = NonNullList.withSize(org.purpurmc.purpur.PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // Plazma - Add missing purpur configuration options
|
|
||||||
this.setPos(d0, d1, d2);
|
|
||||||
this.xo = d0;
|
|
||||||
this.yo = d1;
|
|
||||||
@@ -177,7 +177,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getContainerSize() {
|
public int getContainerSize() {
|
||||||
@@ -186,10 +189,10 @@ index c14019a131c90c699b8a76bada82592b66f0fa89..8b9f78b3b0e00a859f3106fe38335286
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||||
index 97fc4fb795fa2dc859b0ea02dc132b41300d56ed..cd8194b08457d38b942631e0e6450264615f9427 100644
|
index 097f3c34d244b89e7dd9f8b6f2a3d8fdc67b36dc..3f4c94aada930e55dfe6a2dd6f3bfb51b2276b0d 100644
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
--- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java
|
||||||
@@ -330,6 +330,7 @@ public class PurpurConfig {
|
@@ -331,6 +331,7 @@ public class PurpurConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int barrelRows = 3;
|
public static int barrelRows = 3;
|
||||||
@@ -197,7 +200,7 @@ index 97fc4fb795fa2dc859b0ea02dc132b41300d56ed..cd8194b08457d38b942631e0e6450264
|
|||||||
public static boolean enderChestSixRows = false;
|
public static boolean enderChestSixRows = false;
|
||||||
public static boolean enderChestPermissionRows = false;
|
public static boolean enderChestPermissionRows = false;
|
||||||
public static boolean cryingObsidianValidForPortalFrame = false;
|
public static boolean cryingObsidianValidForPortalFrame = false;
|
||||||
@@ -372,6 +373,7 @@ public class PurpurConfig {
|
@@ -373,6 +374,7 @@ public class PurpurConfig {
|
||||||
case 1 -> 9;
|
case 1 -> 9;
|
||||||
default -> 27;
|
default -> 27;
|
||||||
});
|
});
|
||||||
@@ -206,7 +209,7 @@ index 97fc4fb795fa2dc859b0ea02dc132b41300d56ed..cd8194b08457d38b942631e0e6450264
|
|||||||
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
|
org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27);
|
||||||
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
|
enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows);
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||||
index 1ff95cced54e8230eb5b4b4314f8f3716e264264..0318c4916a17e6ec721efbfc98835424568366d9 100644
|
index e55993e318b7f7292e22c4539bc2fd1447f67fa8..b67b6147e9175041539b01357dd8b1e94cfd6841 100644
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||||
@@ -1135,7 +1135,13 @@ public class PurpurWorldConfig {
|
@@ -1135,7 +1135,13 @@ public class PurpurWorldConfig {
|
||||||
@@ -237,7 +240,7 @@ index 1ff95cced54e8230eb5b4b4314f8f3716e264264..0318c4916a17e6ec721efbfc98835424
|
|||||||
camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater);
|
camelRidableInWater = getBoolean("mobs.camel.ridable-in-water", camelRidableInWater);
|
||||||
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
|
camelMaxHealthMin = getDouble("mobs.camel.attributes.max_health.min", camelMaxHealthMin);
|
||||||
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
|
camelMaxHealthMax = getDouble("mobs.camel.attributes.max_health.max", camelMaxHealthMax);
|
||||||
@@ -1744,7 +1756,15 @@ public class PurpurWorldConfig {
|
@@ -1755,7 +1767,15 @@ public class PurpurWorldConfig {
|
||||||
public boolean frogControllable = true;
|
public boolean frogControllable = true;
|
||||||
public float frogRidableJumpHeight = 0.65F;
|
public float frogRidableJumpHeight = 0.65F;
|
||||||
public int frogBreedingTicks = 6000;
|
public int frogBreedingTicks = 6000;
|
||||||
@@ -253,7 +256,7 @@ index 1ff95cced54e8230eb5b4b4314f8f3716e264264..0318c4916a17e6ec721efbfc98835424
|
|||||||
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
|
frogRidable = getBoolean("mobs.frog.ridable", frogRidable);
|
||||||
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
|
frogRidableInWater = getBoolean("mobs.frog.ridable-in-water", frogRidableInWater);
|
||||||
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
|
frogControllable = getBoolean("mobs.frog.controllable", frogControllable);
|
||||||
@@ -2756,7 +2776,13 @@ public class PurpurWorldConfig {
|
@@ -2767,7 +2787,13 @@ public class PurpurWorldConfig {
|
||||||
public double snifferMaxHealth = 14.0D;
|
public double snifferMaxHealth = 14.0D;
|
||||||
public double snifferScale = 1.0D;
|
public double snifferScale = 1.0D;
|
||||||
public int snifferBreedingTicks = 6000;
|
public int snifferBreedingTicks = 6000;
|
||||||
@@ -267,7 +270,7 @@ index 1ff95cced54e8230eb5b4b4314f8f3716e264264..0318c4916a17e6ec721efbfc98835424
|
|||||||
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
|
snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable);
|
||||||
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
|
snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater);
|
||||||
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
|
snifferControllable = getBoolean("mobs.sniffer.controllable", snifferControllable);
|
||||||
@@ -2864,7 +2890,15 @@ public class PurpurWorldConfig {
|
@@ -2875,7 +2901,15 @@ public class PurpurWorldConfig {
|
||||||
public boolean tadpoleRidable = false;
|
public boolean tadpoleRidable = false;
|
||||||
public boolean tadpoleRidableInWater = true;
|
public boolean tadpoleRidableInWater = true;
|
||||||
public boolean tadpoleControllable = true;
|
public boolean tadpoleControllable = true;
|
||||||
@@ -283,7 +286,7 @@ index 1ff95cced54e8230eb5b4b4314f8f3716e264264..0318c4916a17e6ec721efbfc98835424
|
|||||||
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
|
tadpoleRidable = getBoolean("mobs.tadpole.ridable", tadpoleRidable);
|
||||||
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
|
tadpoleRidableInWater = getBoolean("mobs.tadpole.ridable-in-water", tadpoleRidableInWater);
|
||||||
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
|
tadpoleControllable = getBoolean("mobs.tadpole.controllable", tadpoleControllable);
|
||||||
@@ -3092,7 +3126,15 @@ public class PurpurWorldConfig {
|
@@ -3107,7 +3141,15 @@ public class PurpurWorldConfig {
|
||||||
public boolean wardenRidable = false;
|
public boolean wardenRidable = false;
|
||||||
public boolean wardenRidableInWater = true;
|
public boolean wardenRidableInWater = true;
|
||||||
public boolean wardenControllable = true;
|
public boolean wardenControllable = true;
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Sun, 5 Nov 2023 11:27:51 +0900
|
||||||
|
Subject: [PATCH] Add option to change nether portal size
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||||
|
index acdff7b4a00d563739fd301c3633a266875296fa..1266aaf4bfcf53aa16d7b9bd697a0c483d3218a9 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
|
||||||
|
@@ -113,7 +113,7 @@ public class PortalShape {
|
||||||
|
private static int calculateWidth(BlockGetter iblockaccess, BlockPos blockposition, Direction enumdirection, BlockStateListPopulator blocks) { // CraftBukkit
|
||||||
|
int i = PortalShape.getDistanceUntilEdgeAboveFrame(iblockaccess, blockposition, enumdirection, blocks); // CraftBukkit
|
||||||
|
|
||||||
|
- return i >= 2 && i <= 21 ? i : 0;
|
||||||
|
+ return i >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.min() && i <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.max() ? i : 0; // Plazma - Configurable nether portal size
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getDistanceUntilEdgeAboveFrame(BlockGetter iblockaccess, BlockPos blockposition, Direction enumdirection, BlockStateListPopulator blocks) { // CraftBukkit
|
||||||
|
@@ -146,7 +146,7 @@ public class PortalShape {
|
||||||
|
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||||
|
int j = PortalShape.getDistanceUntilTop(iblockaccess, blockposition, enumdirection, blockposition_mutableblockposition, i, mutableint, blocks); // CraftBukkit
|
||||||
|
|
||||||
|
- return j >= 3 && j <= 21 && PortalShape.hasTopFrame(iblockaccess, blockposition, enumdirection, blockposition_mutableblockposition, i, j, blocks) ? j : 0; // CraftBukkit
|
||||||
|
+ return j >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.min() && j <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.max() && PortalShape.hasTopFrame(iblockaccess, blockposition, enumdirection, blockposition_mutableblockposition, i, j, blocks) ? j : 0; // Craftbukkit // Plazma - Configurable nether portal size
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean hasTopFrame(BlockGetter iblockaccess, BlockPos blockposition, Direction enumdirection, BlockPos.MutableBlockPos blockposition_mutableblockposition, int i, int j, BlockStateListPopulator blocks) { // CraftBukkit
|
||||||
|
@@ -200,7 +200,7 @@ public class PortalShape {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
- return this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21;
|
||||||
|
+ return this.width >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.min() && this.width <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.width.max() && this.height >= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.min() && this.height <= org.plazmamc.plazma.configurations.GlobalConfiguration.get().structure.netherPortal.height.max(); // Plazma - Configurable nether portal size
|
||||||
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start - return boolean, add entity
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
index e153370e617e63a8e497036c93ea55dfe851bc6e..11d386d3e134b1994302c4e026b6a11c46336522 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -70,6 +70,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
public Structure structure;
|
||||||
|
public class Structure extends ConfigurationPart {
|
||||||
|
|
||||||
|
+ public NetherPortal netherPortal;
|
||||||
|
+ public class NetherPortal extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ public Width width;
|
||||||
|
+ public class Width extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ int min = 2; public int min() { return Math.max(this.min, 1); }
|
||||||
|
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Height height;
|
||||||
|
+ public class Height extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ int min = 3; public int min() { return Math.max(this.min, 2); }
|
||||||
|
+ int max = 21; public int max() { return Math.max(this.min, this.max); }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
index c222d58520b655b54b8975ec226a4ba948691cd4..c703237d46b114227cf0d5cdff2e033839bc5f57 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
@@ -36,17 +36,6 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- public Structure structure;
|
||||||
|
- public class Structure extends ConfigurationPart {
|
||||||
|
-
|
||||||
|
- public NetherPortal netherPortal;
|
||||||
|
- public class NetherPortal extends ConfigurationPart {
|
||||||
|
-
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
public Block block;
|
||||||
|
public class Block extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -7,10 +7,10 @@ Subject: [PATCH] Apply various optimizations
|
|||||||
Akarin - Swaps the predicate order of collision
|
Akarin - Swaps the predicate order of collision
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 7aadcaa1785c6560eb1ce2f1179225facca47d84..2adc6f3400a2b914176d0ae0a85c479b00289fb4 100644
|
index aa171a1afb9800e6ec84f6b4f1b28e44177752f7..eaf53f5f4c33ca7a7a988e7bd04b7033e16f9529 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -2211,8 +2211,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -2309,8 +2309,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
public void playerTouch(Player player) {}
|
public void playerTouch(Player player) {}
|
||||||
|
|
||||||
public void push(Entity entity) {
|
public void push(Entity entity) {
|
||||||
@@ -21,7 +21,7 @@ index 7aadcaa1785c6560eb1ce2f1179225facca47d84..2adc6f3400a2b914176d0ae0a85c479b
|
|||||||
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
|
if (this.level.paperConfig().collisions.onlyPlayersCollide && !(entity instanceof ServerPlayer || this instanceof ServerPlayer)) return; // Paper - Collision option for requiring a player participant
|
||||||
double d0 = entity.getX() - this.getX();
|
double d0 = entity.getX() - this.getX();
|
||||||
double d1 = entity.getZ() - this.getZ();
|
double d1 = entity.getZ() - this.getZ();
|
||||||
@@ -2240,8 +2241,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
@@ -2338,8 +2339,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
entity.push(d0, 0.0D, d1);
|
entity.push(d0, 0.0D, d1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Do not load chunks to spawn phantom
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||||
index 04f67f7b43d2f461c776c76614dc3e5f060aea63..b3fe0dd152b3e2e1b83b4ec2270d387e6117ec1c 100644
|
index 27eb9a365006884c85603dc6d9dd8eee009c98b3..958a48d05aba8e500c7b19a466dcca6fea8a8bcc 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||||
@@ -70,6 +70,7 @@ public class PhantomSpawner implements CustomSpawner {
|
@@ -70,6 +70,7 @@ public class PhantomSpawner implements CustomSpawner {
|
||||||
@@ -17,7 +17,7 @@ index 04f67f7b43d2f461c776c76614dc3e5f060aea63..b3fe0dd152b3e2e1b83b4ec2270d387e
|
|||||||
FluidState fluid = world.getFluidState(blockposition1);
|
FluidState fluid = world.getFluidState(blockposition1);
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index 7bd566d6e15385850930a6c0b44d1d495a671e81..d5e7d74b0e203c9f2c03c9b4f8d1b9c57168e61f 100644
|
index c703237d46b114227cf0d5cdff2e033839bc5f57..a976e2b960a5f3b7ecf6e42afcb1dd3bd140b8bd 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -31,6 +31,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
@@ -6,22 +6,28 @@ Subject: [PATCH] Add option to disable moved to quickly check for specific
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
index fd22a6709c7ffd828fbab5b8723f2b723af92f3d..79cfaf78840ac9052b83666d44cdd27f1ed3ae4f 100644
|
index 9ae16e24013ea5664d4ea6d52ed7dd188404890f..91f161d27a45174b6f3c31440eea46ff81185203 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -1462,6 +1462,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -1695,7 +1695,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
}
|
}
|
||||||
// Paper end - Prevent moving into unloaded chunks
|
}
|
||||||
|
|
||||||
+ if (!this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !(org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.checkSpectatorMovedToQuickly && this.player.isSpectator())) // Plazma - Options to bypass moved to quickly check
|
|
||||||
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !flag)) {
|
|
||||||
float f2 = flag ? 300.0F : 100.0F;
|
|
||||||
|
|
||||||
|
+ // Plazma start - Add option to bypass moved to quickly check
|
||||||
|
private boolean shouldCheckPlayerMovement(boolean elytra) {
|
||||||
|
+ return (!this.player.getBukkitEntity().hasPermission("plazma.bypass-moved-to-quickly-check") || !(org.plazmamc.plazma.configurations.GlobalConfiguration.get().player.checkSpectatorMovedToQuickly && this.player.isSpectator())) && shouldCheckPlayerMovement0(elytra);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private boolean shouldCheckPlayerMovement0(boolean elytra) {
|
||||||
|
+ // Plazma end - Add option to bypass moved to quickly check
|
||||||
|
if (this.isSingleplayerOwner()) {
|
||||||
|
return false;
|
||||||
|
} else if (this.player.isChangingDimension()) {
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 3ec9c947ac19412ad81d0cc85e0eff289a285d1e..af89ad0fcaebb5776ae3c18d02441c48f4227251 100644
|
index 11d386d3e134b1994302c4e026b6a11c46336522..93d746b0e7f263b36a66864834445cb41e5e2cee 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -37,6 +37,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public Player player;
|
public Player player;
|
||||||
public class Player extends ConfigurationPart {
|
public class Player extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Configurable cave lava sea level
|
|||||||
This patch also fix MC-237017.
|
This patch also fix MC-237017.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
index 68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8..688d9a2fe0ad0f176cd19a3ed7f2669fef2c962e 100644
|
index 3f39d6c786d9dfdd9ad591e08ff05fcbb41a1df6..0346fd4ab7095d66c0eef5a440afbc7a8ba52466 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
@@ -71,14 +71,14 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
@@ -71,14 +71,14 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||||
@@ -33,10 +33,10 @@ index 68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8..688d9a2fe0ad0f176cd19a3ed7f2669f
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index af89ad0fcaebb5776ae3c18d02441c48f4227251..aa8b0a9b3d98e2c2fb1bd3c374cd2e742e6e17cf 100644
|
index 93d746b0e7f263b36a66864834445cb41e5e2cee..0b59a3a36c86948877cb8cb875dc114e9f9d284a 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -35,6 +35,24 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -45,6 +45,24 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public WorldGeneration worldgen;
|
public WorldGeneration worldgen;
|
||||||
public class WorldGeneration extends ConfigurationPart {
|
public class WorldGeneration extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -5,24 +5,24 @@ Subject: [PATCH] Configurable entity sensor tick
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
index 4b4bdaf8c43e15ba953c160a003a719aaf730318..35f150d348c3bd27416c60840988d381b85f9ccf 100644
|
index 7ca12a1128661ea36e2e33cda204c7d2df55a21c..331a75fee26e3fe2532e8661db282a0c207ddf9b 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||||
@@ -953,10 +953,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
@@ -951,10 +951,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||||
//ProfilerFiller gameprofilerfiller = this.level().getProfiler(); // Purpur
|
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||||
|
|
||||||
//gameprofilerfiller.push("sensing"); // Purpur
|
gameprofilerfiller.push("sensing");
|
||||||
- this.sensing.tick();
|
- this.sensing.tick();
|
||||||
+ //this.sensing.tick(); // Plazma - Moved down
|
+ //this.sensing.tick(); // Plazma - moved down
|
||||||
//gameprofilerfiller.pop(); // Purpur
|
gameprofilerfiller.pop();
|
||||||
int i = this.tickCount + this.getId();
|
int i = this.tickCount + this.getId();
|
||||||
|
|
||||||
+ if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick
|
+ if (i % this.level().plazmaConfig().entity.sensorTick == 0) this.sensing.tick(); // Plazma - Configurable entity sensor tick
|
||||||
if (i % 2 != 0 && this.tickCount > 1) {
|
if (i % 2 != 0 && this.tickCount > 1) {
|
||||||
//gameprofilerfiller.push("targetSelector"); // Purpur
|
gameprofilerfiller.push("targetSelector");
|
||||||
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
|
if (this.targetSelector.inactiveTick(this.activatedPriority, false)) // Pufferfish - use this to alternate ticking
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index d5e7d74b0e203c9f2c03c9b4f8d1b9c57168e61f..eff241544ba009f62179fb1668bd9d78795e7002 100644
|
index a976e2b960a5f3b7ecf6e42afcb1dd3bd140b8bd..9e408d6c1826d36a935b3e382e8eb0283f3d1580 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -28,6 +28,8 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -28,6 +28,8 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Mon, 4 Dec 2023 23:12:47 +0900
|
|
||||||
Subject: [PATCH] Optimise state lookup more
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
|
|
||||||
index 57d0cd3ad6f972e986c72a57f1a6e36003f190c2..50d97c5ab33f33b81dbafd7cf42da5afd9856eeb 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/table/ZeroCollidingReferenceStateTable.java
|
|
||||||
@@ -17,6 +17,7 @@ public final class ZeroCollidingReferenceStateTable {
|
|
||||||
protected final StateHolder<?, ?> this_state;
|
|
||||||
|
|
||||||
protected long[] index_table;
|
|
||||||
+ public long[] index_table() { return this.index_table; } // Plazma - Getter
|
|
||||||
protected StateHolder<?, ?>[][] value_table;
|
|
||||||
|
|
||||||
public ZeroCollidingReferenceStateTable(final StateHolder<?, ?> state, final Map<Property<?>, Comparable<?>> this_map) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
|
|
||||||
index 45744d86e9582a93a0cec26009deea091080fbbe..5dd9473c55a08a775aa406901a0e54ef6f63837a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
|
|
||||||
@@ -114,6 +114,12 @@ public abstract class StateHolder<O, S> {
|
|
||||||
}
|
|
||||||
|
|
||||||
public <T extends Comparable<T>, V extends T> S trySetValue(Property<T> property, V value) {
|
|
||||||
+ // Plazma start - Optimise state lookup more
|
|
||||||
+ final S ret = (S) this.optimisedTable.get(property, value);
|
|
||||||
+ if (ret == null) throw new IllegalArgumentException("Cannot set property " + property + " to " + value + " on " + this.owner + ", it is not an allowed value");
|
|
||||||
+ return ret;
|
|
||||||
+ /*
|
|
||||||
+ // Plazma end - Optimise state lookup more
|
|
||||||
Comparable<?> comparable = this.values.get(property);
|
|
||||||
if (comparable != null && !comparable.equals(value)) {
|
|
||||||
S object = this.neighbours.get(property, value);
|
|
||||||
@@ -125,10 +131,11 @@ public abstract class StateHolder<O, S> {
|
|
||||||
} else {
|
|
||||||
return (S)this;
|
|
||||||
}
|
|
||||||
+ */ // Plazma - Optimise state lookup more
|
|
||||||
}
|
|
||||||
|
|
||||||
public void populateNeighbours(Map<Map<Property<?>, Comparable<?>>, S> states) {
|
|
||||||
- if (this.neighbours != null) {
|
|
||||||
+ if (this.optimisedTable.index_table() != null) { // Plazma - optimise state lookup
|
|
||||||
throw new IllegalStateException();
|
|
||||||
} else {
|
|
||||||
Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create();
|
|
||||||
@@ -143,7 +150,7 @@ public abstract class StateHolder<O, S> {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- this.neighbours = (Table<Property<?>, Comparable<?>, S>)(table.isEmpty() ? table : ArrayTable.create(table)); this.optimisedTable.loadInTable((Table)this.neighbours, this.values); // Paper - optimise state lookup
|
|
||||||
+ this.optimisedTable.loadInTable((Table) (table.isEmpty() ? table : ArrayTable.create(table)), this.values); // Plazma - Optimize state lookup more
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Variable entity wakeup duration
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index eff241544ba009f62179fb1668bd9d78795e7002..8690dc9d818d7991c7b05d471c547b4cb1713bbe 100644
|
index 9e408d6c1826d36a935b3e382e8eb0283f3d1580..a371893777a2c2d1de22e7d52f2fd3f55b82d74d 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -37,6 +37,20 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -37,6 +37,20 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
@@ -28,21 +28,22 @@ index eff241544ba009f62179fb1668bd9d78795e7002..8690dc9d818d7991c7b05d471c547b4c
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
public Structure structure;
|
public Block block;
|
||||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||||
index ed1cdea66dd117ecafd14a52727f094430f39b60..2c30e659d0ec28c0ec4f8ccb0fa29de5a31d3881 100644
|
index 9b1a16747aa23b18e4cff986efaac6ce64b6ddb9..6a45bafaa1d7ddc0f80c0945e15c3d6c67f9f2b3 100644
|
||||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||||
@@ -67,29 +67,36 @@ public class ActivationRange
|
@@ -66,29 +66,37 @@ public class ActivationRange
|
||||||
Activity.PANIC
|
net.minecraft.world.entity.schedule.Activity.PANIC
|
||||||
};
|
};
|
||||||
|
|
||||||
+ // Plazma start - Variable entity wakeup duration
|
+ // Plazma start - Variable entity wakeup duration
|
||||||
+ private static int getWakeupDuration(net.minecraft.util.RandomSource random, int duration, double deviation) {
|
+ private static int getWakeUpDuration(net.minecraft.util.RandomSource random, int duration, double deviation) {
|
||||||
+ if (deviation == 0) return duration;
|
+ if (deviation == 0) return duration;
|
||||||
+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(duration * (1 + deviation * random.nextGaussian()))));
|
+ return (int) Math.min(Integer.MAX_VALUE, Math.max(1, Math.round(duration * (1 + deviation * random.nextGaussian()))));
|
||||||
+ }
|
+ }
|
||||||
+ // Plazma end - Variable entity wakeup duration
|
+ // Plazma end - Variable entity wakeup duration
|
||||||
|
+
|
||||||
private static int checkInactiveWakeup(Entity entity) {
|
private static int checkInactiveWakeup(Entity entity) {
|
||||||
Level world = entity.level();
|
Level world = entity.level();
|
||||||
SpigotWorldConfig config = world.spigotConfig;
|
SpigotWorldConfig config = world.spigotConfig;
|
||||||
@@ -52,25 +53,25 @@ index ed1cdea66dd117ecafd14a52727f094430f39b60..2c30e659d0ec28c0ec4f8ccb0fa29de5
|
|||||||
if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
|
if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
|
||||||
world.wakeupInactiveRemainingVillagers--;
|
world.wakeupInactiveRemainingVillagers--;
|
||||||
- return config.wakeUpInactiveVillagersFor;
|
- return config.wakeUpInactiveVillagersFor;
|
||||||
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveVillagersFor, plazmaConfig.entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
|
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveVillagersFor, plazmaConfig.entity.wakeUpDurationVariance.villager()); // Plazma - Variable entity wakeup duration
|
||||||
}
|
}
|
||||||
} else if (entity.activationType == ActivationType.ANIMAL) {
|
} else if (entity.activationType == ActivationType.ANIMAL) {
|
||||||
if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
|
if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
|
||||||
world.wakeupInactiveRemainingAnimals--;
|
world.wakeupInactiveRemainingAnimals--;
|
||||||
- return config.wakeUpInactiveAnimalsFor;
|
- return config.wakeUpInactiveAnimalsFor;
|
||||||
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveAnimalsFor, plazmaConfig.entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
|
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveAnimalsFor, plazmaConfig.entity.wakeUpDurationVariance.animal()); // Plazma - Variable entity wakeup duration
|
||||||
}
|
}
|
||||||
} else if (entity.activationType == ActivationType.FLYING_MONSTER) {
|
} else if (entity.activationType == ActivationType.FLYING_MONSTER) {
|
||||||
if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
|
if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
|
||||||
world.wakeupInactiveRemainingFlying--;
|
world.wakeupInactiveRemainingFlying--;
|
||||||
- return config.wakeUpInactiveFlyingFor;
|
- return config.wakeUpInactiveFlyingFor;
|
||||||
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveFlyingFor, plazmaConfig.entity.wakeUpDurationVariance.flying()); // Plazma - Variable entity wakeup duration
|
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveFlyingFor, plazmaConfig.entity.wakeUpDurationVariance.flying()); // Plazma - Variable entity wakeup duration
|
||||||
}
|
}
|
||||||
} else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
|
} else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
|
||||||
if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
|
if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
|
||||||
world.wakeupInactiveRemainingMonsters--;
|
world.wakeupInactiveRemainingMonsters--;
|
||||||
- return config.wakeUpInactiveMonstersFor;
|
- return config.wakeUpInactiveMonstersFor;
|
||||||
+ return getWakeupDuration(world.getRandom(), config.wakeUpInactiveMonstersFor, plazmaConfig.entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
|
+ return getWakeUpDuration(world.getRandom(), config.wakeUpInactiveMonstersFor, plazmaConfig.entity.wakeUpDurationVariance.monster()); // Plazma - Variable entity wakeup duration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@@ -7,7 +7,7 @@ Subject: [PATCH] Add entity spawn deadlock timer
|
|||||||
- AbsolemJackdaw/FixMySpawnR
|
- AbsolemJackdaw/FixMySpawnR
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||||
index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa34a39ef28 100644
|
index bb4411cfdf1bc7adc12c2f918d2eec830299f38b..357d484029fe338bea4f5770d13ccfc0dce4432e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||||||
@@ -50,6 +50,8 @@ public abstract class BaseSpawner {
|
@@ -50,6 +50,8 @@ public abstract class BaseSpawner {
|
||||||
@@ -61,7 +61,7 @@ index 967af8771ff8564c715d89f4b4b69b16c25add59..2ac5fb585636523787e05edaa58a4fa3
|
|||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index 8690dc9d818d7991c7b05d471c547b4cb1713bbe..e5989010aa752c23eda58a6df87aa6925f45671a 100644
|
index a371893777a2c2d1de22e7d52f2fd3f55b82d74d..d366e8755ba91c329164c16659f6b07245577fba 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -51,6 +51,14 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -51,6 +51,14 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
@@ -78,4 +78,4 @@ index 8690dc9d818d7991c7b05d471c547b4cb1713bbe..e5989010aa752c23eda58a6df87aa692
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
public Structure structure;
|
public Block block;
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Improve SwingTime ticking
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index f714e2dc212a3b70977e93c55e94f8b272c5b02d..0d48209efc607dd7f81deffa96af2ff05ccd37b7 100644
|
index f4604e543a980d6aeb485252da5a4e755aa12bfa..f2753cf51634479e501c1a3e7931d6d9882bc801 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -2722,6 +2722,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -2821,6 +2821,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateSwingTime() {
|
protected void updateSwingTime() {
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Use Akair's flag when running the test server with gradle
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||||
index 95df5b7c437f95849b193345640e6001aed71a3d..9dcd555a7f3c6855d72718f46a2792298a33c56d 100644
|
index 746ad8087192931400256c8a1ef71e966eaf6b1a..14695f421c3751a1e75567aecf3685d901790011 100644
|
||||||
--- a/build.gradle.kts
|
--- a/build.gradle.kts
|
||||||
+++ b/build.gradle.kts
|
+++ b/build.gradle.kts
|
||||||
@@ -141,7 +141,7 @@ fun TaskContainer.registerRunTask(
|
@@ -164,7 +164,7 @@ fun TaskContainer.registerRunTask(
|
||||||
languageVersion.set(JavaLanguageVersion.of(21))
|
languageVersion.set(JavaLanguageVersion.of(21))
|
||||||
vendor.set(JvmVendorSpec.JETBRAINS)
|
vendor.set(JvmVendorSpec.JETBRAINS)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Use Plazma logo instead if server favicon doesn't exist
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index ccfeda1ba3f89112eccf29f382b5526934db1d91..94eb4e0686d8235f06ea7950c178cdec8bd6e037 100644
|
index 20266ef8f0974f47581e71175de4b01ea1a27bf0..54ef910938efb537a689dd5dbda119455bbf2a0e 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1584,29 +1584,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1627,29 +1627,32 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<ServerStatus.Favicon> loadStatusIcon() {
|
private Optional<ServerStatus.Favicon> loadStatusIcon() {
|
||||||
@@ -65,10 +65,10 @@ index ccfeda1ba3f89112eccf29f382b5526934db1d91..94eb4e0686d8235f06ea7950c178cdec
|
|||||||
|
|
||||||
public Optional<Path> getWorldScreenshotFile() {
|
public Optional<Path> getWorldScreenshotFile() {
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
index a8711b8a66b443d40cad8dfec31cca357e0877b4..4b3ae18ef8cd09a2d9c9eaee2bf402d0dd7ee1cd 100644
|
index 063b71b3043a69a90130a81686b6a5f1e5f22fd1..e7092aeb5abce5aa5f9bd434adc6acd4e43dec13 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
@@ -11,5 +11,6 @@ public interface Options {
|
@@ -10,5 +10,6 @@ public interface Options {
|
||||||
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
boolean AGGRESSIVE = getBoolean("Plazma.aggressiveOptimize") && !NO_OPTIMIZE;
|
||||||
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||||
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
index 560962109d43d27ba0681afe36e6324ae2a93867..97df4706150dd198dc9bbdd3bdcecea9094d3b62 100644
|
index 38752c9ba1726e3c38dd758287a920bc476ef88a..45fa867a22481bbba86e587767cfdb96d9691c49 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||||
@@ -710,6 +710,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
@@ -688,6 +688,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||||
// Paper start - Add setting for proxy online mode status
|
// Paper start - Add setting for proxy online mode status
|
||||||
return dedicatedserverproperties.enforceSecureProfile
|
return dedicatedserverproperties.enforceSecureProfile
|
||||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||||
@@ -32,7 +32,7 @@ index 560962109d43d27ba0681afe36e6324ae2a93867..97df4706150dd198dc9bbdd3bdcecea9
|
|||||||
// Paper end - Add setting for proxy online mode status
|
// Paper end - Add setting for proxy online mode status
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index f78a0a224c86c0e3e5a44ce4f589cd8a61c546f9..69ff5380eedb3e0b214324dec50bb5c0eb65001b 100644
|
index 8d7d050f12df83931bbb32f1832d7fcbc06317da..be4a5407fe9b692b72eb2b85e2dea160a0555bca 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -135,6 +135,7 @@ public abstract class PlayerList {
|
@@ -135,6 +135,7 @@ public abstract class PlayerList {
|
||||||
@@ -52,10 +52,10 @@ index f78a0a224c86c0e3e5a44ce4f589cd8a61c546f9..69ff5380eedb3e0b214324dec50bb5c0
|
|||||||
player.loadGameTypes((CompoundTag) optional.orElse(null)); // CraftBukkit - decompile error
|
player.loadGameTypes((CompoundTag) optional.orElse(null)); // CraftBukkit - decompile error
|
||||||
ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData);
|
ServerGamePacketListenerImpl playerconnection = new ServerGamePacketListenerImpl(this.server, connection, player, clientData);
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 516a4545b67a4bf0d37cee3d1e26772831944fe6..451723377d505f1fe15ddd4ac535ca61fa253f17 100644
|
index 0b59a3a36c86948877cb8cb875dc114e9f9d284a..6e14f6a03c7bcd820f3d787178a62844ad022332 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -29,6 +29,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -39,6 +39,15 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
|
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
|
||||||
|
|
||||||
|
|||||||
@@ -1,69 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Wed, 15 May 2024 14:30:55 +0900
|
|
||||||
Subject: [PATCH] Add some missing Pufferfish configurations
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
|
||||||
index 5b024bc6166a9034eeba729bf3a53236446a03de..d4d6e9f0d8bf15315412ce5193e45c147b047575 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
|
||||||
@@ -161,9 +161,11 @@ public class Armadillo extends Animal {
|
|
||||||
return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic));
|
|
||||||
}
|
|
||||||
|
|
||||||
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
|
|
||||||
@Override
|
|
||||||
protected void customServerAiStep() {
|
|
||||||
//this.level().getProfiler().push("armadilloBrain"); // Purpur
|
|
||||||
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
|
||||||
((Brain<Armadillo>) this.brain).tick((ServerLevel) this.level(), this); // CraftBukkit - decompile error
|
|
||||||
//this.level().getProfiler().pop(); // Purpur
|
|
||||||
//this.level().getProfiler().push("armadilloActivityUpdate"); // Purpur
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
||||||
index 00803dcc2d990046013b8a175af20359883a15fe..6781c9cda8118842e24712f335de6e5b817af82c 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
|
|
||||||
@@ -164,11 +164,12 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
|
|
||||||
return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ private int behaviorTick = 0; // Plazma - Add missing pufferfish configurations
|
|
||||||
@Override
|
|
||||||
protected void customServerAiStep() {
|
|
||||||
//this.level().getProfiler().push("camelBrain"); // Purpur
|
|
||||||
Brain<Camel> behaviorcontroller = (Brain<Camel>) this.getBrain(); // CraftBukkit - decompile error
|
|
||||||
-
|
|
||||||
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
|
||||||
behaviorcontroller.tick((ServerLevel) this.level(), this);
|
|
||||||
//this.level().getProfiler().pop(); // Purpur
|
|
||||||
//this.level().getProfiler().push("camelActivityUpdate"); // Purpur
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
||||||
index bc931f54d1087f2515b8185368ade3e8dd55a00d..65ce4ccbb91ff87762da5f9ef53e6d069149abd8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
|
||||||
@@ -515,9 +515,11 @@ public class Sniffer extends Animal {
|
|
||||||
return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ private int behaviorTick; // Plazma - Add missing pufferfish configurations
|
|
||||||
@Override
|
|
||||||
protected void customServerAiStep() {
|
|
||||||
//this.level().getProfiler().push("snifferBrain"); // Purpur
|
|
||||||
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Plazma - Add missing pufferfish configurations
|
|
||||||
this.getBrain().tick((ServerLevel) this.level(), this);
|
|
||||||
//this.level().getProfiler().popPush("snifferActivityUpdate"); // Purpur
|
|
||||||
SnifferAi.updateActivity(this);
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
|
||||||
index 78a5631753e5bdc16b786ac6951c8d39c4337767..7b1bf1449c2e1f1e2ea2a9f258624b128eb80918 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
|
||||||
@@ -320,7 +320,7 @@ public class Warden extends Monster implements VibrationSystem {
|
|
||||||
|
|
||||||
//worldserver.getProfiler().push("wardenBrain"); // Purpur
|
|
||||||
//if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - TODO: Move to Ridables patch
|
|
||||||
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
|
|
||||||
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Plazma - Add missing pufferfish configurations
|
|
||||||
this.getBrain().tick(worldserver, this);
|
|
||||||
//this.level().getProfiler().pop(); // Purpur
|
|
||||||
super.customServerAiStep();
|
|
||||||
@@ -7,7 +7,7 @@ Based on SparklyPaper, Copyright (C) 2024 SparklyPower
|
|||||||
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
|
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
index 769d283cd98cba829262e45020ce3936c484938a..726c3e81d04731fe6ac92f0b612ce33e53803132 100644
|
index 26da9e7c25ef6a89482838010d8ed6bcf8c87511..71aa3b9c5604f832e764e0d7a93da467ffe7dee1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
@@ -209,6 +209,7 @@ public class MapItemSavedData extends SavedData {
|
@@ -209,6 +209,7 @@ public class MapItemSavedData extends SavedData {
|
||||||
@@ -19,10 +19,10 @@ index 769d283cd98cba829262e45020ce3936c484938a..726c3e81d04731fe6ac92f0b612ce33e
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 7ccf554610bd00b602eb7be11df7028d2f6a7008..2f5b59ec72fff421e1bc254ebeba78647c7409fe 100644
|
index 6e14f6a03c7bcd820f3d787178a62844ad022332..193e565b6d62caf278223db033351d03ff417637 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -113,6 +113,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -124,6 +124,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public Miscellaneous misc;
|
public Miscellaneous misc;
|
||||||
public class Miscellaneous extends ConfigurationPart {
|
public class Miscellaneous extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ Based on SparklyPaper, Copyright (C) 2024 SparklyPower.
|
|||||||
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
|
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
index cab403efd471bb61835224eea4e99570d34dcaaa..4b4d31cb3c379a59c43c7356522a5b67c5a87de5 100644
|
index 5ebbdb94d9b91c442ff60eb6872f740ebd790fa0..aeeb8af68ea43ae6c93952610918d77b1593ed54 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
@@ -441,6 +441,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -441,6 +441,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
@@ -20,12 +20,12 @@ index cab403efd471bb61835224eea4e99570d34dcaaa..4b4d31cb3c379a59c43c7356522a5b67
|
|||||||
} else {
|
} else {
|
||||||
// Paper start - Perf: Optimize Hoppers
|
// Paper start - Perf: Optimize Hoppers
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index 00ab417a8b7da0457b6f8e18e4f877373774672e..f5880a045343e8d84492b61241ac1e514a0eb73d 100644
|
index d366e8755ba91c329164c16659f6b07245577fba..f21ed3431fd8472c78c15578bbd12214c499ceea 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -106,6 +106,13 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -64,6 +64,12 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
public Block block;
|
||||||
}
|
public class Block extends ConfigurationPart {
|
||||||
|
|
||||||
+ public Hopper hopper;
|
+ public Hopper hopper;
|
||||||
+ public class Hopper extends ConfigurationPart {
|
+ public class Hopper extends ConfigurationPart {
|
||||||
@@ -33,7 +33,6 @@ index 00ab417a8b7da0457b6f8e18e4f877373774672e..f5880a045343e8d84492b61241ac1e51
|
|||||||
+ public int fullCooldown = 0;
|
+ public int fullCooldown = 0;
|
||||||
+
|
+
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,909 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Thu, 25 Jan 2024 17:13:09 +0900
|
|
||||||
Subject: [PATCH] Port SparklyPaper patches
|
|
||||||
|
|
||||||
SparklyPower
|
|
||||||
Copyright (C) 2024 SparklyPower
|
|
||||||
|
|
||||||
Based on commit: 29212936a832106c4d68e2a2017acbea2fdd3cc4
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
||||||
index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..03be23690a94a14d7343526acad67ccf53b85c70 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
||||||
@@ -78,6 +78,47 @@ public final class MSPTCommand extends Command {
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
+
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
+ sender.sendMessage(text());
|
|
||||||
+ sender.sendMessage(text().content("World tick times ").color(GOLD)
|
|
||||||
+ .append(text().color(YELLOW)
|
|
||||||
+ .append(
|
|
||||||
+ text("("),
|
|
||||||
+ text("avg", GRAY),
|
|
||||||
+ text("/"),
|
|
||||||
+ text("min", GRAY),
|
|
||||||
+ text("/"),
|
|
||||||
+ text("max", GRAY),
|
|
||||||
+ text(")")
|
|
||||||
+ )
|
|
||||||
+ ).append(
|
|
||||||
+ text(" from last 5s"),
|
|
||||||
+ text(",", GRAY),
|
|
||||||
+ text(" 10s"),
|
|
||||||
+ text(",", GRAY),
|
|
||||||
+ text(" 1m"),
|
|
||||||
+ text(":", YELLOW)
|
|
||||||
+ )
|
|
||||||
+ );
|
|
||||||
+ for (net.minecraft.server.level.ServerLevel level: server.getAllLevels()) {
|
|
||||||
+ List<Component> worldTimes = new ArrayList<>();
|
|
||||||
+ worldTimes.addAll(eval(level.tickTimes5s.getTimes()));
|
|
||||||
+ worldTimes.addAll(eval(level.tickTimes10s.getTimes()));
|
|
||||||
+ worldTimes.addAll(eval(level.tickTimes60s.getTimes()));
|
|
||||||
+
|
|
||||||
+ sender.sendMessage(text().content("◴ " + level.getWorld().getName() + ": ").color(GOLD)
|
|
||||||
+ .append(text().color(GRAY)
|
|
||||||
+ .append(
|
|
||||||
+ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), text(", ", YELLOW),
|
|
||||||
+ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), text(", ", YELLOW),
|
|
||||||
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8)
|
|
||||||
+ )
|
|
||||||
+ )
|
|
||||||
+ );
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
+
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
|
||||||
index c03608fec96b51e1867f43d8f42e5aefb1520e46..93180066224345c0332fb33744f84204f15bba29 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
|
||||||
@@ -41,6 +41,7 @@ public final class EntityScheduler {
|
|
||||||
|
|
||||||
private long tickCount = 0L;
|
|
||||||
private static final long RETIRED_TICK_COUNT = -1L;
|
|
||||||
+ private static final net.minecraft.server.MinecraftServer SERVER = net.minecraft.server.MinecraftServer.getServer(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
private final Object stateLock = new Object();
|
|
||||||
private final Long2ObjectOpenHashMap<List<ScheduledTask>> oneTimeDelayed = new Long2ObjectOpenHashMap<>();
|
|
||||||
|
|
||||||
@@ -61,15 +62,15 @@ public final class EntityScheduler {
|
|
||||||
* @throws IllegalStateException If the scheduler is already retired.
|
|
||||||
*/
|
|
||||||
public void retire() {
|
|
||||||
+ final Entity thisEntity = this.entity.getHandleRaw(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
synchronized (this.stateLock) {
|
|
||||||
if (this.tickCount == RETIRED_TICK_COUNT) {
|
|
||||||
throw new IllegalStateException("Already retired");
|
|
||||||
}
|
|
||||||
this.tickCount = RETIRED_TICK_COUNT;
|
|
||||||
+ SERVER.entitiesWithScheduledTasks.remove(thisEntity); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
}
|
|
||||||
|
|
||||||
- final Entity thisEntity = this.entity.getHandleRaw();
|
|
||||||
-
|
|
||||||
// correctly handle and order retiring while running executeTick
|
|
||||||
for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) {
|
|
||||||
final ScheduledTask task = this.currentlyExecuting.pollFirst();
|
|
||||||
@@ -124,6 +125,7 @@ public final class EntityScheduler {
|
|
||||||
if (this.tickCount == RETIRED_TICK_COUNT) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
+ SERVER.entitiesWithScheduledTasks.add(this.entity.getHandleRaw()); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> {
|
|
||||||
return new ArrayList<>();
|
|
||||||
}).add(task);
|
|
||||||
@@ -143,6 +145,12 @@ public final class EntityScheduler {
|
|
||||||
TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously");
|
|
||||||
final List<ScheduledTask> toRun;
|
|
||||||
synchronized (this.stateLock) {
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
+ if (this.currentlyExecuting.isEmpty() && this.oneTimeDelayed.isEmpty()) {
|
|
||||||
+ SERVER.entitiesWithScheduledTasks.remove(thisEntity);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
if (this.tickCount == RETIRED_TICK_COUNT) {
|
|
||||||
throw new IllegalStateException("Ticking retired scheduler");
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index 94eb4e0686d8235f06ea7950c178cdec8bd6e037..118832d94f96d7624f9faee35b9da0aeb9d9ded8 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -327,6 +327,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
public volatile boolean abnormalExit = false; // Paper
|
|
||||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
|
||||||
public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
|
|
||||||
+ public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
|
|
||||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
|
||||||
AtomicReference<S> atomicreference = new AtomicReference();
|
|
||||||
@@ -1776,17 +1777,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
//MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper // Purpur
|
|
||||||
// Paper start - Folia scheduler API
|
|
||||||
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
|
||||||
- getAllLevels().forEach(level -> {
|
|
||||||
- for (final Entity entity : level.moonrise$getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system
|
|
||||||
- if (entity.isRemoved()) {
|
|
||||||
- continue;
|
|
||||||
- }
|
|
||||||
- final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
|
|
||||||
- if (bukkit != null) {
|
|
||||||
- bukkit.taskScheduler.executeTick();
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- });
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
+ for (final Entity entity : entitiesWithScheduledTasks) {
|
|
||||||
+ if (entity.isRemoved() || entity.getBukkitEntityRaw() == null) continue;
|
|
||||||
+ entity.getBukkitEntityRaw().taskScheduler.executeTick();
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Skip EntityScheduler's executeTick checks if there isn't any tasks to be run
|
|
||||||
// Paper end - Folia scheduler API
|
|
||||||
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
|
||||||
//this.profiler.push("commandFunctions"); // Purpur
|
|
||||||
@@ -1852,8 +1848,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
//this.profiler.push("tick"); // Purpur
|
|
||||||
|
|
||||||
try {
|
|
||||||
- //worldserver.timings.doTick.startTiming(); // Spigot // Purpur
|
|
||||||
- worldserver.tick(shouldKeepTicking);
|
|
||||||
+ //worldserver.timings.doTick.startTiming(); // Spigot // Purpur// Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
+ long before = Util.getNanos();
|
|
||||||
+ worldserver.tick(shouldKeepTicking); // diff on changes
|
|
||||||
+ long after = Util.getNanos() - before;
|
|
||||||
+
|
|
||||||
+ worldserver.tickTimes5s.add(this.tickCount, after);
|
|
||||||
+ worldserver.tickTimes10s.add(this.tickCount, after);
|
|
||||||
+ worldserver.tickTimes60s.add(this.tickCount, after);
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
//worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
|
|
||||||
} catch (Throwable throwable) {
|
|
||||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
||||||
index 97df4706150dd198dc9bbdd3bdcecea9094d3b62..d31fabbca11b1f619bfa62487eed2cd5f19844ce 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
||||||
@@ -227,6 +227,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
||||||
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
|
|
||||||
this.plazmaConfigurations.initializeGlobalConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
|
||||||
this.plazmaConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess()); // Plazma - Configurable Plazma
|
|
||||||
+ net.sparklypower.sparklypaper.HalloweenManager.startSyncEpochTask(); // Plazma - Port SparklyPaper patches; Optimize Spooky Season
|
|
||||||
// Paper end - initialize global and world-defaults configuration
|
|
||||||
// Paper start - detect running as root // Plazma - Tweak console logging (moved down)
|
|
||||||
if (io.papermc.paper.util.ServerEnvironment.userIsRootOrAdmin()) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
||||||
index 1883abec14e05f8eb2e865446b4d81091b1aa5e0..adfc891ae8868bb562910ad169c116e5d30348c7 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
||||||
@@ -1262,7 +1262,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
||||||
// Paper end - Configurable entity tracking range by Y
|
|
||||||
|
|
||||||
// CraftBukkit start - respect vanish API
|
|
||||||
- if (flag && !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Paper - only consider hits
|
|
||||||
+ if (flag && !player.getBukkitEntity().chunkMapCanSee(this.entity.getBukkitEntity())) { // Paper - only consider hits // Plazma - Port SparklyPaper patches; Optimize canSee check
|
|
||||||
flag = false;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
||||||
index dfd09004063a8d8d93357633c8d23b6acff67b73..7458cd657e809bba7483da31ddeb8f77aab1203d 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
|
||||||
@@ -78,6 +78,7 @@ public class ServerEntity {
|
|
||||||
private List<SynchedEntityData.DataValue<?>> trackedDataValues;
|
|
||||||
// CraftBukkit start
|
|
||||||
public final Set<ServerPlayerConnection> trackedPlayers; // Purpur - private -> public
|
|
||||||
+ public static boolean skipSqrWhenNoDeltaChanges = false; // Plazma - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
|
|
||||||
|
|
||||||
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
|
||||||
this.trackedPlayers = trackedPlayers;
|
|
||||||
@@ -218,20 +219,21 @@ public class ServerEntity {
|
|
||||||
|
|
||||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
|
||||||
Vec3 vec3d1 = this.entity.getDeltaMovement();
|
|
||||||
- double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
|
||||||
-
|
|
||||||
- if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
|
||||||
- this.lastSentMovement = vec3d1;
|
|
||||||
- Entity entity1 = this.entity;
|
|
||||||
-
|
|
||||||
- if (entity1 instanceof AbstractHurtingProjectile) {
|
|
||||||
- AbstractHurtingProjectile entityfireball = (AbstractHurtingProjectile) entity1;
|
|
||||||
-
|
|
||||||
- this.broadcast.accept(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(entityfireball.getId(), entityfireball.accelerationPower))));
|
|
||||||
- } else {
|
|
||||||
- this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ // Plazma start - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
|
|
||||||
+ if (!skipSqrWhenNoDeltaChanges && vec3d1 != this.lastSentMovement) {
|
|
||||||
+ double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
|
||||||
+ if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
|
||||||
+ this.lastSentMovement = vec3d1;
|
|
||||||
+ Entity entity1 = this.entity;
|
|
||||||
+ if (entity1 instanceof AbstractHurtingProjectile) {
|
|
||||||
+ AbstractHurtingProjectile entityfireball = (AbstractHurtingProjectile) entity1;
|
|
||||||
+ this.broadcast.accept(new ClientboundBundlePacket(List.of(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), new ClientboundProjectilePowerPacket(entityfireball.getId(), entityfireball.accelerationPower))));
|
|
||||||
+ } else {
|
|
||||||
+ this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
|
||||||
+ }
|
|
||||||
+ } // diff on changes
|
|
||||||
+ } // diff on changes
|
|
||||||
+ // Plazma end - SparklyPaper port; Skip distanceToSqr if the delta movement hasn't changed
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packet1 != null) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
index dfcd3989ffbd4aa5dc9368a34b95c1c2748c23a2..f5f944899d860d8363db43d430f3daab96e0d774 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
@@ -233,6 +233,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
|
||||||
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
|
||||||
public boolean hasRidableMoveEvent = false; // Purpur
|
|
||||||
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
+ public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
|
|
||||||
+ public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
|
|
||||||
+ public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
+
|
|
||||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
|
||||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
|
||||||
index fb7342f7a5008a283c3400c6313c637de8210dfa..8b068f6b4c52cdba60a7fbe21bc1f7a86891800a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
|
||||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
|
||||||
@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter {
|
|
||||||
this.dirty.add(stat);
|
|
||||||
}
|
|
||||||
|
|
||||||
+ /* // Plazma - Port SparklyPaper patches; Skip dirty stats copy when requesting player stats
|
|
||||||
private Set<Stat<?>> getDirty() {
|
|
||||||
Set<Stat<?>> set = Sets.newHashSet(this.dirty);
|
|
||||||
|
|
||||||
this.dirty.clear();
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
+ */ // Plazma - Port SparklyPaper patches; Skip dirty stats copy when requesting player stats
|
|
||||||
|
|
||||||
public void parseLocal(DataFixer dataFixer, String json) {
|
|
||||||
try {
|
|
||||||
@@ -243,7 +245,7 @@ public class ServerStatsCounter extends StatsCounter {
|
|
||||||
|
|
||||||
public void sendStats(ServerPlayer player) {
|
|
||||||
Object2IntMap<Stat<?>> object2intmap = new Object2IntOpenHashMap();
|
|
||||||
- Iterator iterator = this.getDirty().iterator();
|
|
||||||
+ Iterator<Stat<?>> iterator = this.dirty.iterator(); // Plazma - SparklyPaper port; Skip dirty stats copy when requesting player stats
|
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Stat<?> statistic = (Stat) iterator.next();
|
|
||||||
@@ -251,6 +253,7 @@ public class ServerStatsCounter extends StatsCounter {
|
|
||||||
object2intmap.put(statistic, this.getValue(statistic));
|
|
||||||
}
|
|
||||||
|
|
||||||
+ this.dirty.clear(); // Plazma - SparklyPaper port; Skip dirty stats copy when requesting player stats
|
|
||||||
player.connection.send(new ClientboundAwardStatsPacket(object2intmap));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
||||||
index 36e5a6462675ceb3cef236c451321b1656d9fcc0..bdc2391aed4fedc2e15a0b51a6930a2d85905c90 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
|
||||||
@@ -307,7 +307,7 @@ public class Bat extends AmbientCreature {
|
|
||||||
int i = world.getMaxLocalRawBrightness(pos);
|
|
||||||
byte b0 = 4;
|
|
||||||
|
|
||||||
- if (Bat.isHalloweenSeason(world.getMinecraftWorld())) { // Purpur
|
|
||||||
+ if (isSpookySeason(world.getMinecraftWorld())) { // Purpur // Plazma - Port SparklyPaper patches; Optimize Spooky Season
|
|
||||||
b0 = 7;
|
|
||||||
} else if (random.nextBoolean()) {
|
|
||||||
return false;
|
|
||||||
@@ -321,7 +321,24 @@ public class Bat extends AmbientCreature {
|
|
||||||
private static boolean isSpookySeason = false;
|
|
||||||
private static final int ONE_HOUR = 20 * 60 * 60;
|
|
||||||
private static int lastSpookyCheck = -ONE_HOUR;
|
|
||||||
- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Optimize Spooky Season
|
|
||||||
+ private static boolean isSpookySeason(Level level) {
|
|
||||||
+ if (level.purpurConfig.forceHalloweenSeason) return true;
|
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.spookyOptimize)
|
|
||||||
+ return net.sparklypower.sparklypaper.HalloweenManager.isSpookySeason()
|
|
||||||
+ || net.sparklypower.sparklypaper.HalloweenManager.isHalloween();
|
|
||||||
+ return isHalloween();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static boolean isHalloweenSeason(Level level) {
|
|
||||||
+ if (level.purpurConfig.forceHalloweenSeason) return true;
|
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.spookyOptimize)
|
|
||||||
+ return net.sparklypower.sparklypaper.HalloweenManager.isHalloween();
|
|
||||||
+ return isHalloween();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @SuppressWarnings("RedundantExplicitChronoField")
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Optimize Spooky Season
|
|
||||||
private static boolean isHalloween() {
|
|
||||||
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
|
|
||||||
LocalDate localdate = LocalDate.now();
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
|
||||||
index 608390ed36710a419de1542b80340dd3fcc7299c..043f068345ca3c50209c1c3cc1feb6277a3da61a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
|
||||||
@@ -268,11 +268,13 @@ public class MapItem extends ComplexItem {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public static boolean skipTickWhenCraftNotPresent = false; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present
|
|
||||||
@Override
|
|
||||||
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
|
|
||||||
if (!world.isClientSide) {
|
|
||||||
MapItemSavedData mapItemSavedData = getSavedData(stack, world);
|
|
||||||
if (mapItemSavedData != null) {
|
|
||||||
+ if (skipTickWhenCraftNotPresent && mapItemSavedData.mapView.getRenderers().stream().noneMatch(mapRenderer -> mapRenderer.getClass() == org.bukkit.craftbukkit.map.CraftMapRenderer.class)) return; // Plazma - SparklyPaper port; Skip map item ticking if the craft map renderer is not present
|
|
||||||
if (entity instanceof Player player) {
|
|
||||||
mapItemSavedData.tickCarriedBy(player, stack);
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
||||||
index 253d47418b4e9cbce74584c2461d12e17effd7bb..f3c44a2ddc52661984cc07b2ee23b3a3431a4b0a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
||||||
@@ -1456,6 +1456,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
||||||
int tickedEntities = 0; // Paper - rewrite chunk system
|
|
||||||
|
|
||||||
int tilesThisCycle = 0;
|
|
||||||
+ int shouldTickBlocksAtLastResult = -1; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
|
|
||||||
+ long shouldTickBlocksAtChunkPos = 0; // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
|
|
||||||
var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
|
|
||||||
toRemove.add(null); // Paper - Fix MC-117075
|
|
||||||
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
|
||||||
@@ -1468,14 +1470,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
|
||||||
tilesThisCycle--;
|
|
||||||
toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
|
|
||||||
// Spigot end
|
|
||||||
- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
|
||||||
- tickingblockentity.tick();
|
|
||||||
- // Paper start - rewrite chunk system
|
|
||||||
- if ((++tickedEntities & 7) == 0) {
|
|
||||||
- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
|
|
||||||
- }
|
|
||||||
- // Paper end - rewrite chunk system
|
|
||||||
- }
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Optimize tickingBlockEntities
|
|
||||||
+ } else if (flag) {
|
|
||||||
+ long chunkPos = tickingblockentity.getChunkCoordinateKey();
|
|
||||||
+ boolean shouldTick;
|
|
||||||
+ if (shouldTickBlocksAtChunkPos == chunkPos && shouldTickBlocksAtLastResult != -1)
|
|
||||||
+ shouldTick = shouldTickBlocksAtLastResult == 1;
|
|
||||||
+ else {
|
|
||||||
+ shouldTick = this.shouldTickBlocksAt(chunkPos);
|
|
||||||
+ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0;
|
|
||||||
+ shouldTickBlocksAtChunkPos = chunkPos;
|
|
||||||
+ } // diff on changes
|
|
||||||
+
|
|
||||||
+ if (shouldTick) {
|
|
||||||
+ tickingblockentity.tick();
|
|
||||||
+ // Paper start - execute chunk tasks during tick
|
|
||||||
+ if ((++tickedEntities & 7) == 0) {
|
|
||||||
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
|
|
||||||
+ }
|
|
||||||
+ // Paper end - execute chunk tasks during tick
|
|
||||||
+ } // diff on changes
|
|
||||||
+ } // diff on changes
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Optimize tickingBlockEntities
|
|
||||||
}
|
|
||||||
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
||||||
index 5a190834baef60c7b61074393f8856a933902d81..366ae05a060b5b12b85521a4b8aed1907f3f044a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
||||||
@@ -77,35 +77,57 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
||||||
- if (world.getRawBrightness(pos, 0) >= 9) {
|
|
||||||
- int i = this.getAge(state);
|
|
||||||
-
|
|
||||||
- if (i < this.getMaxAge()) {
|
|
||||||
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
-
|
|
||||||
- // Spigot start
|
|
||||||
- int modifier;
|
|
||||||
- if (this == Blocks.BEETROOTS) {
|
|
||||||
- modifier = world.spigotConfig.beetrootModifier;
|
|
||||||
- } else if (this == Blocks.CARROTS) {
|
|
||||||
- modifier = world.spigotConfig.carrotModifier;
|
|
||||||
- } else if (this == Blocks.POTATOES) {
|
|
||||||
- modifier = world.spigotConfig.potatoModifier;
|
|
||||||
- // Paper start - Fix Spigot growth modifiers
|
|
||||||
- } else if (this == Blocks.TORCHFLOWER_CROP) {
|
|
||||||
- modifier = world.spigotConfig.torchFlowerModifier;
|
|
||||||
- // Paper end - Fix Spigot growth modifiers
|
|
||||||
- } else {
|
|
||||||
- modifier = world.spigotConfig.wheatModifier;
|
|
||||||
- }
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks
|
|
||||||
+ if (world.getRawBrightness(pos, 0) < 9) return;
|
|
||||||
+
|
|
||||||
+ int age = this.getAge(state);
|
|
||||||
+ if (age >= this.getMaxAge()) return;
|
|
||||||
+
|
|
||||||
+ final int modifier;
|
|
||||||
+ if (this == Blocks.BEETROOTS) {
|
|
||||||
+ modifier = world.spigotConfig.beetrootModifier;
|
|
||||||
+ } else if (this == Blocks.CARROTS) {
|
|
||||||
+ modifier = world.spigotConfig.carrotModifier;
|
|
||||||
+ } else if (this == Blocks.POTATOES) {
|
|
||||||
+ modifier = world.spigotConfig.potatoModifier;
|
|
||||||
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
|
|
||||||
+ modifier = world.spigotConfig.torchFlowerModifier;
|
|
||||||
+ } else {
|
|
||||||
+ modifier = world.spigotConfig.wheatModifier;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
- // Spigot end
|
|
||||||
- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
|
||||||
- }
|
|
||||||
+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) {
|
|
||||||
+ BlockPos current = pos.below();
|
|
||||||
+ BlockState currentState = world.getBlockState(current);
|
|
||||||
+
|
|
||||||
+ boolean moist;
|
|
||||||
+ float growthSpeed;
|
|
||||||
+ if (currentState.is(Blocks.FARMLAND) && currentState.getValue(FarmBlock.MOISTURE) > 0) {
|
|
||||||
+ moist = true;
|
|
||||||
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.moist;
|
|
||||||
+ } else {
|
|
||||||
+ moist = false;
|
|
||||||
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.normal;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ if (world.plazmaConfig().block.optimizeFarmCheck.skipMiddleAgingStageForCrops) {
|
|
||||||
+ growthSpeed = growthSpeed / getMaxAge();
|
|
||||||
+ age = getMaxAge() - 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) return;
|
|
||||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2)) return;
|
|
||||||
+ if (!moist || age + 1 != this.getMaxAge() || FarmBlock.isNearWater(world, current)) return;
|
|
||||||
+
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, current, currentState.setValue(FarmBlock.MOISTURE, 0), 2);
|
|
||||||
+ return;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ float growthSpeed = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
+
|
|
||||||
+ if (random.nextFloat() < (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1))))
|
|
||||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2);
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks
|
|
||||||
}
|
|
||||||
|
|
||||||
public void growCrops(Level world, BlockPos pos, BlockState state) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
||||||
index d0ec0722496ed931b48c4e7076fddbb1ed36e111..b91afbc90c138ebb7f8722934f59f953642196c9 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
||||||
@@ -92,7 +92,19 @@ public class FarmBlock extends Block {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
||||||
- int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks
|
|
||||||
+ int i = state.getValue(FarmBlock.MOISTURE);
|
|
||||||
+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) {
|
|
||||||
+ if (i != 0) return;
|
|
||||||
+
|
|
||||||
+ if (isNearWater(world, pos))
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2);
|
|
||||||
+ else
|
|
||||||
+ turnToDirt(null, state, world, pos);
|
|
||||||
+
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks
|
|
||||||
if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
|
||||||
if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
|
||||||
|
|
||||||
@@ -167,7 +179,7 @@ public class FarmBlock extends Block {
|
|
||||||
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static boolean isNearWater(LevelReader world, BlockPos pos) {
|
|
||||||
+ static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - AT (private -> package)
|
|
||||||
// Paper start - Perf: remove abstract block iteration
|
|
||||||
int xOff = pos.getX();
|
|
||||||
int yOff = pos.getY();
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
|
||||||
index 924d80eb41d9a71d1e521c40742557251cf51832..4a30e1e6eac4b0e3dc2147a74e73e05fa76f5db2 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
|
||||||
@@ -72,38 +72,82 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
||||||
- if (world.getRawBrightness(pos, 0) >= 9) {
|
|
||||||
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
-
|
|
||||||
- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
- int i = (Integer) state.getValue(StemBlock.AGE);
|
|
||||||
-
|
|
||||||
- if (i < 7) {
|
|
||||||
- state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
|
||||||
- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
|
||||||
- } else {
|
|
||||||
- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
|
||||||
- BlockPos blockposition1 = pos.relative(enumdirection);
|
|
||||||
- BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
|
||||||
-
|
|
||||||
- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
|
||||||
- Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
|
||||||
- Optional<Block> optional = iregistry.getOptional(this.fruit);
|
|
||||||
- Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
|
||||||
-
|
|
||||||
- if (optional.isPresent() && optional1.isPresent()) {
|
|
||||||
- // CraftBukkit start
|
|
||||||
- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
- // CraftBukkit end
|
|
||||||
- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
- }
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Optimize Farm checks
|
|
||||||
+ if (world.getRawBrightness(pos, 0) < 9) return;
|
|
||||||
+
|
|
||||||
+ int modifier = this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier;
|
|
||||||
+
|
|
||||||
+ if (world.plazmaConfig().block.optimizeFarmCheck.enabled) {
|
|
||||||
+ final BlockPos current = pos.below();
|
|
||||||
+ final BlockState currentState = world.getBlockState(current);
|
|
||||||
+
|
|
||||||
+ final boolean moist;
|
|
||||||
+ final float growthSpeed;
|
|
||||||
+ if (currentState.is(Blocks.FARMLAND) && currentState.getValue(FarmBlock.MOISTURE) > 0) {
|
|
||||||
+ moist = true;
|
|
||||||
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.moist;
|
|
||||||
+ } else {
|
|
||||||
+ moist = false;
|
|
||||||
+ growthSpeed = world.plazmaConfig().block.optimizeFarmCheck.growthSpeed.normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / growthSpeed) + 1)))) return;
|
|
||||||
+
|
|
||||||
+ int age = state.getValue(AGE);
|
|
||||||
+
|
|
||||||
+ if (age < 7) {
|
|
||||||
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(AGE, age + 1), 2);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
|
||||||
+ BlockPos pos1 = pos.relative(direction);
|
|
||||||
+ BlockState state1 = world.getBlockState(pos1.below());
|
|
||||||
+
|
|
||||||
+ if (!world.getBlockState(pos1).isAir() || (!state1.is(Blocks.FARMLAND) && !state1.is(BlockTags.DIRT)))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ Registry<Block> registry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
|
||||||
+ Optional<Block> fruit = registry.getOptional(this.fruit);
|
|
||||||
+ Optional<Block> stem = registry.getOptional(this.attachedStem);
|
|
||||||
+
|
|
||||||
+ if (fruit.isEmpty() || stem.isEmpty()) return;
|
|
||||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos1, fruit.get().defaultBlockState())) return;
|
|
||||||
+ if (moist && !FarmBlock.isNearWater(world, current))
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, current, currentState.setValue(FarmBlock.MOISTURE, 0), 2);
|
|
||||||
+
|
|
||||||
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
|
|
||||||
+ return;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
+
|
|
||||||
+ if (random.nextFloat() >= (modifier / (100.0f * Math.floor((25.0F / f) + 1)))) return;
|
|
||||||
+
|
|
||||||
+ int age = state.getValue(StemBlock.AGE);
|
|
||||||
+
|
|
||||||
+ if (age < 7) {
|
|
||||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(StemBlock.AGE, age + 1), 2);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
|
||||||
+ BlockPos pos1 = pos.relative(direction);
|
|
||||||
+ BlockState state1 = world.getBlockState(pos1.below());
|
|
||||||
+
|
|
||||||
+ if (!world.getBlockState(pos1).isAir() || (!state1.is(Blocks.FARMLAND) && !state1.is(BlockTags.DIRT))) return;
|
|
||||||
+
|
|
||||||
+ Registry<Block> registry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
|
||||||
+ Optional<Block> fruit = registry.getOptional(this.fruit);
|
|
||||||
+ Optional<Block> stem = registry.getOptional(this.attachedStem);
|
|
||||||
+
|
|
||||||
+ if (fruit.isEmpty() || stem.isEmpty()) return;
|
|
||||||
+
|
|
||||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos1, fruit.get().defaultBlockState()))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Optimize Farm checks
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
|
|
||||||
index 28e3b73507b988f7234cbf29c4024c88180d0aef..6239c171ca996f3f5c23060f728a62236bc8b6d5 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
|
|
||||||
@@ -10,4 +10,6 @@ public interface TickingBlockEntity {
|
|
||||||
BlockPos getPos();
|
|
||||||
|
|
||||||
String getType();
|
|
||||||
+
|
|
||||||
+ long getChunkCoordinateKey(); // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
||||||
index 75c8125e20b70433fe9d143a3193d821043327c3..80511433c184c6918c8d2e7cff6ca257e8fbf676 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
|
||||||
@@ -66,6 +66,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
|
||||||
protected volatile boolean unsaved;
|
|
||||||
private volatile boolean isLightCorrect;
|
|
||||||
protected final ChunkPos chunkPos; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
|
|
||||||
+ public final long nearbyPlayersCoordinateKey; // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
|
||||||
private long inhabitedTime;
|
|
||||||
/** @deprecated */
|
|
||||||
@Nullable
|
|
||||||
@@ -144,6 +145,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
|
||||||
public ChunkAccess(ChunkPos pos, UpgradeData upgradeData, LevelHeightAccessor heightLimitView, Registry<Biome> biomeRegistry, long inhabitedTime, @Nullable LevelChunkSection[] sectionArray, @Nullable BlendingData blendingData) {
|
|
||||||
this.locX = pos.x; this.locZ = pos.z; // Paper - reduce need for field lookups
|
|
||||||
this.chunkPos = pos; this.coordinateKey = ChunkPos.asLong(locX, locZ); // Paper - cache long key
|
|
||||||
+ this.nearbyPlayersCoordinateKey = ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(locX, locZ); // Plazma - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
|
||||||
this.upgradeData = upgradeData;
|
|
||||||
this.levelHeightAccessor = heightLimitView;
|
|
||||||
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
||||||
index a4578ae22409edb686d0bcbac8cbc1a2e1d7b988..9cc1a79dd25c63af6986e721ceff5560cf56b7d1 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
||||||
@@ -74,6 +74,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
||||||
public String getType() {
|
|
||||||
return "<null>";
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ @Override public long getChunkCoordinateKey() { return 0; } // Plazma - Port SparklyPaper patches; Optimize tickingBlockEntities
|
|
||||||
};
|
|
||||||
private final Map<BlockPos, LevelChunk.RebindableTickingBlockEntityWrapper> tickersInLevel;
|
|
||||||
public boolean loaded;
|
|
||||||
@@ -966,7 +968,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T extends BlockEntity> TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker<T> blockEntityTicker) {
|
|
||||||
- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker);
|
|
||||||
+ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
|
||||||
}
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
@@ -1017,6 +1019,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
||||||
public String toString() {
|
|
||||||
return String.valueOf(this.ticker) + " <wrapped>";
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ @Override public long getChunkCoordinateKey() { return this.ticker.getChunkCoordinateKey(); } // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
|
||||||
}
|
|
||||||
|
|
||||||
private class BoundTickingBlockEntity<T extends BlockEntity> implements TickingBlockEntity {
|
|
||||||
@@ -1024,10 +1028,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
||||||
private final T blockEntity;
|
|
||||||
private final BlockEntityTicker<T> ticker;
|
|
||||||
private boolean loggedInvalidBlockState;
|
|
||||||
+ private final long chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
|
||||||
|
|
||||||
- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) {
|
|
||||||
+ BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker, long chunkCoordinateKey) { // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
|
||||||
this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
|
|
||||||
this.ticker = blockentityticker;
|
|
||||||
+ this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -1095,5 +1101,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
|
||||||
|
|
||||||
return "Level ticker for " + s + "@" + String.valueOf(this.getPos());
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ @Override public long getChunkCoordinateKey() { return this.chunkCoordinateKey; } // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..f8c26e26025d7a7b5489ed5b3274ba734db27a1d
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
|
|
||||||
@@ -0,0 +1,78 @@
|
|
||||||
+package net.sparklypower.sparklypaper;
|
|
||||||
+
|
|
||||||
+import com.mojang.logging.LogUtils;
|
|
||||||
+import it.unimi.dsi.fastutil.Pair;
|
|
||||||
+import net.minecraft.world.level.Level;
|
|
||||||
+import org.slf4j.Logger;
|
|
||||||
+import java.time.LocalDateTime;
|
|
||||||
+import java.time.Month;
|
|
||||||
+import java.time.ZoneOffset;
|
|
||||||
+import java.util.concurrent.CountDownLatch;
|
|
||||||
+import java.util.concurrent.Executors;
|
|
||||||
+import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
+import java.util.concurrent.ScheduledFuture;
|
|
||||||
+import java.util.concurrent.TimeUnit;
|
|
||||||
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
+
|
|
||||||
+import static org.plazmamc.plazma.configurations.GlobalConfiguration.get;
|
|
||||||
+
|
|
||||||
+public class HalloweenManager {
|
|
||||||
+
|
|
||||||
+ private static final Logger LOGGER = LogUtils.getClassLogger();
|
|
||||||
+ private static final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(factory -> {
|
|
||||||
+ Thread thread = new Thread(factory);
|
|
||||||
+ thread.setName("halloween-timer-updater");
|
|
||||||
+ thread.setPriority(1);
|
|
||||||
+ return thread;
|
|
||||||
+ });
|
|
||||||
+
|
|
||||||
+ private static ScheduledFuture<?> future;
|
|
||||||
+ private static Pair<Long, Long> spookyEpoch;
|
|
||||||
+ private static Pair<Long, Long> halloweenEpoch;
|
|
||||||
+
|
|
||||||
+ private static long getEpochMillisAtDate(Month month, int day, boolean start) {
|
|
||||||
+ LocalDateTime now = LocalDateTime.now();
|
|
||||||
+ LocalDateTime target = LocalDateTime.of(
|
|
||||||
+ now.getYear(), month, day, start ? 0 : 23, start ? 0 : 59, start ? 0 : 59, start ? 0 : 999_999_999
|
|
||||||
+ );
|
|
||||||
+
|
|
||||||
+ if (now.isAfter(target)) target = target.plusYears(1);
|
|
||||||
+ return target.atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ private static void syncEpoch() {
|
|
||||||
+ LOGGER.info("Updating Spooky Season and Halloween epoch...");
|
|
||||||
+ spookyEpoch = Pair.of(
|
|
||||||
+ getEpochMillisAtDate(Month.OCTOBER, 20, true),
|
|
||||||
+ getEpochMillisAtDate(Month.NOVEMBER, 3, false)
|
|
||||||
+ );
|
|
||||||
+ halloweenEpoch = Pair.of(
|
|
||||||
+ getEpochMillisAtDate(Month.OCTOBER, 31, true),
|
|
||||||
+ getEpochMillisAtDate(Month.OCTOBER, 31, false)
|
|
||||||
+ );
|
|
||||||
+ LOGGER.info("Successfully updated Spooky Season and Halloween epoch");
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void syncConfiguration() {
|
|
||||||
+ if (get().entity.spookyOptimize && future == null) {
|
|
||||||
+ startSyncEpochTask();
|
|
||||||
+ } else if (!get().entity.spookyOptimize && future != null) {
|
|
||||||
+ future.cancel(true);
|
|
||||||
+ future = null;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static void startSyncEpochTask() {
|
|
||||||
+ if (!get().entity.spookyOptimize) return;
|
|
||||||
+ future = EXECUTOR.scheduleAtFixedRate(HalloweenManager::syncEpoch, 0, 90, TimeUnit.DAYS);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static boolean isSpookySeason() {
|
|
||||||
+ return spookyEpoch.first() <= System.currentTimeMillis() && System.currentTimeMillis() <= spookyEpoch.second();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static boolean isHalloween() {
|
|
||||||
+ return halloweenEpoch.first() <= System.currentTimeMillis() && System.currentTimeMillis() <= halloweenEpoch.second();
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
index 173e4a075078af67f030750c9a6294ab3f796677..92ad49e0ff5dc17bc8e181578ff93bc96e3503ef 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
@@ -978,7 +978,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
||||||
public void sendMultiBlockChange(final Map<? extends io.papermc.paper.math.Position, BlockData> blockChanges) {
|
|
||||||
if (this.getHandle().connection == null) return;
|
|
||||||
|
|
||||||
- Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new HashMap<>();
|
|
||||||
+ Map<SectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<net.minecraft.world.level.block.state.BlockState>> sectionMap = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Plazma - Port SparklyPaper patches; Optimize canSee checks
|
|
||||||
|
|
||||||
for (Map.Entry<? extends io.papermc.paper.math.Position, BlockData> entry : blockChanges.entrySet()) {
|
|
||||||
BlockData blockData = entry.getValue();
|
|
||||||
@@ -2259,9 +2259,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canSee(org.bukkit.entity.Entity entity) {
|
|
||||||
- return this.equals(entity) || entity.isVisibleByDefault() ^ this.invertedVisibilityEntities.containsKey(entity.getUniqueId()); // SPIGOT-7312: Can always see self
|
|
||||||
+ return this.equals(entity) || this.chunkMapCanSee(entity); // SPIGOT-7312: Can always see self // Plazma - Port SparklyPaper patches; Optimize canSee check
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Optimize canSee check (The check in ChunkMap#updatePlayer already rejects if it is the same entity, so we don't need to check it twice, especially because CraftPlayer's equals check is a bit expensive)
|
|
||||||
+ public boolean chunkMapCanSee(org.bukkit.entity.Entity entity) {
|
|
||||||
+ return entity.isVisibleByDefault() ^ (!invertedVisibilityEntities.isEmpty() && this.invertedVisibilityEntities.containsKey(entity.getUniqueId()));
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Optimize canSee check
|
|
||||||
+
|
|
||||||
public boolean canSeePlayer(UUID uuid) {
|
|
||||||
org.bukkit.entity.Entity entity = this.getServer().getPlayer(uuid);
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
|
|
||||||
index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..b9a303f6280a2f6ad3616da152922a4f4a504281 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
|
|
||||||
@@ -145,7 +145,7 @@ public class CraftMapColorCache implements MapPalette.MapColorCache {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
- public boolean isCached() {
|
|
||||||
+ public synchronized boolean isCached() { // Plazma - Fix concurrency issues when using "imageToBytes" in multiple threads
|
|
||||||
return this.cached || (!this.running.get() && this.initCache().isDone());
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
index 451723377d505f1fe15ddd4ac535ca61fa253f17..7ccf554610bd00b602eb7be11df7028d2f6a7008 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
@@ -68,6 +68,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
||||||
public Entity entity;
|
|
||||||
public class Entity extends ConfigurationPart {
|
|
||||||
|
|
||||||
+ boolean skipSqrWhenNoDeltaChanges = OPTIMIZE;
|
|
||||||
+ public boolean spookyOptimize = OPTIMIZE;
|
|
||||||
|
|
||||||
public AsyncPathProcess asyncPathProcess;
|
|
||||||
public class AsyncPathProcess extends ConfigurationPart {
|
|
||||||
@@ -91,6 +93,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
||||||
|
|
||||||
@PostProcess
|
|
||||||
public void post() {
|
|
||||||
+ net.minecraft.server.level.ServerEntity.skipSqrWhenNoDeltaChanges = this.skipSqrWhenNoDeltaChanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -98,9 +101,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
||||||
public World world;
|
|
||||||
public class World extends ConfigurationPart {
|
|
||||||
|
|
||||||
+ boolean skipTickWhenCraftNotPresent = OPTIMIZE;
|
|
||||||
|
|
||||||
@PostProcess
|
|
||||||
public void post() {
|
|
||||||
+ net.minecraft.world.item.MapItem.skipTickWhenCraftNotPresent = this.skipTickWhenCraftNotPresent;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
index e5989010aa752c23eda58a6df87aa6925f45671a..00ab417a8b7da0457b6f8e18e4f877373774672e 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
@@ -89,7 +89,22 @@ public class WorldConfigurations extends ConfigurationPart {
|
|
||||||
|
|
||||||
public Block block;
|
|
||||||
public class Block extends ConfigurationPart {
|
|
||||||
-
|
|
||||||
+
|
|
||||||
+ public OptimizeFarmCheck optimizeFarmCheck;
|
|
||||||
+ public class OptimizeFarmCheck extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public boolean enabled = OPTIMIZE;
|
|
||||||
+ public boolean skipMiddleAgingStageForCrops = true;
|
|
||||||
+
|
|
||||||
+ public GrowthSpeed growthSpeed;
|
|
||||||
+ public class GrowthSpeed extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public int normal = 1;
|
|
||||||
+ public int moist = 4;
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Sun, 5 May 2024 00:01:03 +0900
|
|
||||||
Subject: [PATCH] Add more MSPT
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
||||||
index 03be23690a94a14d7343526acad67ccf53b85c70..416c0a736edf47f76a37be0bc5fe8678cf89cdb3 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
|
||||||
@@ -45,8 +45,10 @@ public final class MSPTCommand extends Command {
|
|
||||||
MinecraftServer server = MinecraftServer.getServer();
|
|
||||||
|
|
||||||
List<Component> times = new ArrayList<>();
|
|
||||||
+ times.addAll(eval(server.tickTimes1s.getTimes())); // Plazma - Add more MSPT
|
|
||||||
times.addAll(eval(server.tickTimes5s.getTimes()));
|
|
||||||
times.addAll(eval(server.tickTimes10s.getTimes()));
|
|
||||||
+ times.addAll(eval(server.tickTimes30s.getTimes())); // Plazma - Add more MSPT
|
|
||||||
times.addAll(eval(server.tickTimes60s.getTimes()));
|
|
||||||
|
|
||||||
sender.sendMessage(text().content("Server tick times ").color(GOLD)
|
|
||||||
@@ -61,12 +63,18 @@ public final class MSPTCommand extends Command {
|
|
||||||
text(")")
|
|
||||||
)
|
|
||||||
).append(
|
|
||||||
- text(" from last 5s"),
|
|
||||||
+ // Plazma start - Add more MSPT
|
|
||||||
+ text(" from last 1s"),
|
|
||||||
+ text(",", GRAY),
|
|
||||||
+ text(" 5s"),
|
|
||||||
text(",", GRAY),
|
|
||||||
text(" 10s"),
|
|
||||||
text(",", GRAY),
|
|
||||||
+ text(" 30s"),
|
|
||||||
+ text(",", GRAY),
|
|
||||||
text(" 1m"),
|
|
||||||
text(":", YELLOW)
|
|
||||||
+ // Plazma end - Add more MSPT
|
|
||||||
)
|
|
||||||
);
|
|
||||||
sender.sendMessage(text().content("◴ ").color(GOLD)
|
|
||||||
@@ -74,7 +82,11 @@ public final class MSPTCommand extends Command {
|
|
||||||
.append(
|
|
||||||
times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW),
|
|
||||||
times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW),
|
|
||||||
- times.get(6), SLASH, times.get(7), SLASH, times.get(8)
|
|
||||||
+ // Plazma start - Add more MSPT
|
|
||||||
+ times.get(6), SLASH, times.get(7), SLASH, times.get(8), text(", ", YELLOW),
|
|
||||||
+ times.get(9), SLASH, times.get(10), SLASH, times.get(11), text(", ", YELLOW),
|
|
||||||
+ times.get(12), SLASH, times.get(13), SLASH, times.get(14), text(", ", YELLOW)
|
|
||||||
+ // Plazma end - Add more MSPT
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
@@ -93,18 +105,26 @@ public final class MSPTCommand extends Command {
|
|
||||||
text(")")
|
|
||||||
)
|
|
||||||
).append(
|
|
||||||
- text(" from last 5s"),
|
|
||||||
+ // Plazma start - Add more MSPT
|
|
||||||
+ text(" from last 1s"),
|
|
||||||
+ text(",", GRAY),
|
|
||||||
+ text(" 5s"),
|
|
||||||
text(",", GRAY),
|
|
||||||
text(" 10s"),
|
|
||||||
text(",", GRAY),
|
|
||||||
+ text(" 30s"),
|
|
||||||
+ text(",", GRAY),
|
|
||||||
text(" 1m"),
|
|
||||||
text(":", YELLOW)
|
|
||||||
+ // Plazma end - Add more MSPT
|
|
||||||
)
|
|
||||||
);
|
|
||||||
for (net.minecraft.server.level.ServerLevel level: server.getAllLevels()) {
|
|
||||||
List<Component> worldTimes = new ArrayList<>();
|
|
||||||
+ worldTimes.addAll(eval(level.tickTimes1s.getTimes())); // Plazma - Add more MSPT
|
|
||||||
worldTimes.addAll(eval(level.tickTimes5s.getTimes()));
|
|
||||||
worldTimes.addAll(eval(level.tickTimes10s.getTimes()));
|
|
||||||
+ worldTimes.addAll(eval(level.tickTimes30s.getTimes())); // Plazma - Add more MSPT
|
|
||||||
worldTimes.addAll(eval(level.tickTimes60s.getTimes()));
|
|
||||||
|
|
||||||
sender.sendMessage(text().content("◴ " + level.getWorld().getName() + ": ").color(GOLD)
|
|
||||||
@@ -112,7 +132,11 @@ public final class MSPTCommand extends Command {
|
|
||||||
.append(
|
|
||||||
worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), text(", ", YELLOW),
|
|
||||||
worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), text(", ", YELLOW),
|
|
||||||
- worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8)
|
|
||||||
+ // Plazma start - Add more MSPT
|
|
||||||
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), text(", ", YELLOW),
|
|
||||||
+ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), text(", ", YELLOW),
|
|
||||||
+ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14), text(", ", YELLOW)
|
|
||||||
+ // Plazma end - Add more MSPT
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index 118832d94f96d7624f9faee35b9da0aeb9d9ded8..1c3bb7cd27d97e54cbe74465bd8a7c5faeafdf4a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -259,8 +259,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
private final long[] tickTimesNanos;
|
|
||||||
private long aggregatedTickTimesNanos;
|
|
||||||
// Paper start - Add tick times API and /mspt command
|
|
||||||
+ public final TickTimes tickTimes1s = new TickTimes(20); // Plazma - Add more MSPT
|
|
||||||
public final TickTimes tickTimes5s = new TickTimes(100);
|
|
||||||
public final TickTimes tickTimes10s = new TickTimes(200);
|
|
||||||
+ public final TickTimes tickTimes30s = new TickTimes(600); // Plazma - Add more MSPT
|
|
||||||
public final TickTimes tickTimes60s = new TickTimes(1200);
|
|
||||||
// Paper end - Add tick times API and /mspt command
|
|
||||||
@Nullable
|
|
||||||
@@ -1853,8 +1855,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
worldserver.tick(shouldKeepTicking); // diff on changes
|
|
||||||
long after = Util.getNanos() - before;
|
|
||||||
|
|
||||||
+ worldserver.tickTimes1s.add(this.tickCount, after); // Plazma - Add more MSPT
|
|
||||||
worldserver.tickTimes5s.add(this.tickCount, after);
|
|
||||||
worldserver.tickTimes10s.add(this.tickCount, after);
|
|
||||||
+ worldserver.tickTimes30s.add(this.tickCount, after); // Plazma - Add more MSPT
|
|
||||||
worldserver.tickTimes60s.add(this.tickCount, after);
|
|
||||||
// Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
//worldserver.timings.doTick.stopTiming(); // Spigot // Purpur
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
index f5f944899d860d8363db43d430f3daab96e0d774..6fbf3a479ee1927b1099d2678db693341491b2b7 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
@@ -234,8 +234,10 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
|
||||||
public boolean hasRidableMoveEvent = false; // Purpur
|
|
||||||
|
|
||||||
// Plazma start - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
+ public final MinecraftServer.TickTimes tickTimes1s = new MinecraftServer.TickTimes(20); // Plazma - Add more MSPT
|
|
||||||
public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
|
|
||||||
public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
|
|
||||||
+ public final MinecraftServer.TickTimes tickTimes30s = new MinecraftServer.TickTimes(600); // Plazma - Add more MSPT
|
|
||||||
public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
|
|
||||||
// Plazma end - Port SparklyPaper patches; Track World specific MSPT
|
|
||||||
|
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Suppress errors from dirty attributes
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 0d48209efc607dd7f81deffa96af2ff05ccd37b7..9ab19aa8d05384bc03c8250f8ea628a9b0a00fa2 100644
|
index f2753cf51634479e501c1a3e7931d6d9882bc801..02288d8f3521756770351c02f623f9db02efd40c 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -1348,7 +1348,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1390,7 +1390,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshDirtyAttributes() {
|
private void refreshDirtyAttributes() {
|
||||||
@@ -18,7 +18,7 @@ index 0d48209efc607dd7f81deffa96af2ff05ccd37b7..9ab19aa8d05384bc03c8250f8ea628a9
|
|||||||
Iterator iterator = set.iterator();
|
Iterator iterator = set.iterator();
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
@@ -1357,7 +1358,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -1399,7 +1400,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
this.onAttributeUpdated(attributemodifiable.getAttribute());
|
this.onAttributeUpdated(attributemodifiable.getAttribute());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,9 +26,9 @@ index 0d48209efc607dd7f81deffa96af2ff05ccd37b7..9ab19aa8d05384bc03c8250f8ea628a9
|
|||||||
+ attr.clear(); // Plazma - Suppress errors from dirty attributes
|
+ attr.clear(); // Plazma - Suppress errors from dirty attributes
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onAttributeUpdated(Holder<Attribute> attribute) {
|
protected void onAttributeUpdated(Holder<Attribute> attribute) {
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index f5880a045343e8d84492b61241ac1e514a0eb73d..97da147ae867500a343af7beea51ed5e89543a47 100644
|
index f21ed3431fd8472c78c15578bbd12214c499ceea..9cfab16b9cdf40ccb709c0af66c406954560c0ef 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -29,6 +29,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
@@ -21,10 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
diff --git a/src/main/java/ca/fxco/railoptimization/RailLogic.java b/src/main/java/ca/fxco/railoptimization/RailLogic.java
|
diff --git a/src/main/java/ca/fxco/railoptimization/RailLogic.java b/src/main/java/ca/fxco/railoptimization/RailLogic.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf041fa4ed
|
index 0000000000000000000000000000000000000000..6c0a70c8902623991977c19a1c649488c9ad4afa
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/ca/fxco/railoptimization/RailLogic.java
|
+++ b/src/main/java/ca/fxco/railoptimization/RailLogic.java
|
||||||
@@ -0,0 +1,301 @@
|
@@ -0,0 +1,302 @@
|
||||||
+package ca.fxco.railoptimization;
|
+package ca.fxco.railoptimization;
|
||||||
+
|
+
|
||||||
+import net.minecraft.core.BlockPos;
|
+import net.minecraft.core.BlockPos;
|
||||||
@@ -39,6 +39,7 @@ index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf
|
|||||||
+
|
+
|
||||||
+import static net.minecraft.world.level.block.PoweredRailBlock.POWERED;
|
+import static net.minecraft.world.level.block.PoweredRailBlock.POWERED;
|
||||||
+import static net.minecraft.world.level.block.PoweredRailBlock.SHAPE;
|
+import static net.minecraft.world.level.block.PoweredRailBlock.SHAPE;
|
||||||
|
+import static net.minecraft.world.level.redstone.ExperimentalRedstoneUtils.initialOrientation;
|
||||||
+
|
+
|
||||||
+public class RailLogic {
|
+public class RailLogic {
|
||||||
+
|
+
|
||||||
@@ -54,10 +55,10 @@ index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf
|
|||||||
+ if (shouldBePowered == state.getValue(POWERED)) return;
|
+ if (shouldBePowered == state.getValue(POWERED)) return;
|
||||||
+
|
+
|
||||||
+ RailShape railShape = state.getValue(SHAPE);
|
+ RailShape railShape = state.getValue(SHAPE);
|
||||||
+ if (railShape.isAscending()) {
|
+ if (railShape.isSlope()) {
|
||||||
+ level.setBlock(pos, state.setValue(POWERED, shouldBePowered), 3);
|
+ level.setBlock(pos, state.setValue(POWERED, shouldBePowered), 3);
|
||||||
+ level.updateNeighborsAtExceptFromFacing(pos.below(), self, Direction.UP);
|
+ level.updateNeighborsAtExceptFromFacing(pos.below(), self, Direction.UP, initialOrientation(level, Direction.DOWN, Direction.UP));
|
||||||
+ level.updateNeighborsAtExceptFromFacing(pos.above(), self, Direction.DOWN); //isAscending
|
+ level.updateNeighborsAtExceptFromFacing(pos.above(), self, Direction.DOWN, initialOrientation(level, Direction.UP, Direction.DOWN)); //isAscending
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -69,7 +70,7 @@ index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf
|
|||||||
+ BlockState oldState = level.getBlockState(pos);
|
+ BlockState oldState = level.getBlockState(pos);
|
||||||
+ Block.updateOrDestroy(
|
+ Block.updateOrDestroy(
|
||||||
+ oldState,
|
+ oldState,
|
||||||
+ oldState.updateShape(direction.getOpposite(), state, level, pos, fromPos),
|
+ oldState.updateShape(level, level, pos, direction.getOpposite(), fromPos, state, level.getRandom()),
|
||||||
+ level,
|
+ level,
|
||||||
+ pos,
|
+ pos,
|
||||||
+ Block.UPDATE_CLIENTS & -34,
|
+ Block.UPDATE_CLIENTS & -34,
|
||||||
@@ -238,33 +239,33 @@ index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf
|
|||||||
+ giveShapeUpdate(level, state, newPos, pos, direction);
|
+ giveShapeUpdate(level, state, newPos, pos, direction);
|
||||||
+
|
+
|
||||||
+ BlockState blockState = level.getBlockState(blockPos);
|
+ BlockState blockState = level.getBlockState(blockPos);
|
||||||
+ if (blockState.is(self) && blockState.getValue(SHAPE).isAscending()) giveShapeUpdate(level, state, newPos.above(), pos, direction);
|
+ if (blockState.is(self) && blockState.getValue(SHAPE).isSlope()) giveShapeUpdate(level, state, newPos.above(), pos, direction);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static void neighborUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, int endPos, Direction dir, Block block, int currentPos, BlockPos blockPos) {
|
+ private static void neighborUpdateEnd(PoweredRailBlock self, Level level, BlockPos pos, int endPos, Direction dir, Block block, int currentPos, BlockPos blockPos) {
|
||||||
+ if (currentPos != endPos) return;
|
+ if (currentPos != endPos) return;
|
||||||
+
|
+
|
||||||
+ BlockPos newPos = pos.relative(dir, currentPos+1);
|
+ BlockPos newPos = pos.relative(dir, currentPos+1);
|
||||||
+ level.neighborChanged(newPos, block, pos);
|
+ level.neighborChanged(newPos, block, null); // TODO: Orientation
|
||||||
+
|
+
|
||||||
+ BlockState blockState = level.getBlockState(blockPos);
|
+ BlockState blockState = level.getBlockState(blockPos);
|
||||||
+ if (blockState.is(self) && blockState.getValue(SHAPE).isAscending()) level.neighborChanged(newPos.above(), block, blockPos);
|
+ if (blockState.is(self) && blockState.getValue(SHAPE).isSlope()) level.neighborChanged(newPos.above(), block, null); // TODO: Orientation
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static void updateRailsNeighborEW(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
|
+ private static void updateRailsNeighborEW(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
|
||||||
+ BlockPos pos1 = pos.relative(dir, c);
|
+ BlockPos pos1 = pos.relative(dir, c);
|
||||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, pos);
|
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, null); // TODO: Orientation
|
||||||
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
|
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
|
||||||
+ level.neighborChanged(pos1.below(), block, pos);
|
+ level.neighborChanged(pos1.below(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos1.above(), block, pos);
|
+ level.neighborChanged(pos1.above(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos1.north(), block, pos);
|
+ level.neighborChanged(pos1.north(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos1.south(), block, pos);
|
+ level.neighborChanged(pos1.south(), block, null); // TODO: Orientation
|
||||||
+ BlockPos pos2 = pos.relative(dir, c).below();
|
+ BlockPos pos2 = pos.relative(dir, c).below();
|
||||||
+ level.neighborChanged(pos2.below(), block, pos);
|
+ level.neighborChanged(pos2.below(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos2.north(), block, pos);
|
+ level.neighborChanged(pos2.north(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos2.south(), block, pos);
|
+ level.neighborChanged(pos2.south(), block, null); // TODO: Orientation
|
||||||
+ if (c == countAmt) level.neighborChanged(pos.relative(dir, c + 1).below(), block, pos);
|
+ if (c == countAmt) level.neighborChanged(pos.relative(dir, c + 1).below(), block, null); // TODO: Orientation
|
||||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, pos);
|
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, null); // TODO: Orientation
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static void updateRailsSectionEW(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState mainState, Direction dir, int[] count, int countAmt) {
|
+ private static void updateRailsSectionEW(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState mainState, Direction dir, int[] count, int countAmt) {
|
||||||
@@ -279,18 +280,18 @@ index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf
|
|||||||
+
|
+
|
||||||
+ private static void updateRailsNeighborNS(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
|
+ private static void updateRailsNeighborNS(PoweredRailBlock self, Level level, BlockPos pos, int c, Block block, Direction dir, int[] count, int countAmt) {
|
||||||
+ BlockPos pos1 = pos.relative(dir,c);
|
+ BlockPos pos1 = pos.relative(dir,c);
|
||||||
+ level.neighborChanged(pos1.west(), block, pos);
|
+ level.neighborChanged(pos1.west(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos1.east(), block, pos);
|
+ level.neighborChanged(pos1.east(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos1.below(), block, pos);
|
+ level.neighborChanged(pos1.below(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos1.above(), block, pos);
|
+ level.neighborChanged(pos1.above(), block, null); // TODO: Orientation
|
||||||
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
|
+ neighborUpdateEnd(self, level, pos, countAmt, dir, block, c, pos1);
|
||||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, pos);
|
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()), block, null); // TODO: Orientation
|
||||||
+ BlockPos pos2 = pos.relative(dir,c).below();
|
+ BlockPos pos2 = pos.relative(dir,c).below();
|
||||||
+ level.neighborChanged(pos2.west(), block, pos);
|
+ level.neighborChanged(pos2.west(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos2.east(), block, pos);
|
+ level.neighborChanged(pos2.east(), block, null); // TODO: Orientation
|
||||||
+ level.neighborChanged(pos2.below(), block, pos);
|
+ level.neighborChanged(pos2.below(), block, null); // TODO: Orientation
|
||||||
+ if (c == countAmt) level.neighborChanged(pos.relative(dir,c + 1).below(), block, pos);
|
+ if (c == countAmt) level.neighborChanged(pos.relative(dir,c + 1).below(), block, null); // TODO: Orientation
|
||||||
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, pos);
|
+ if (c == 0 && count[1] == 0) level.neighborChanged(pos1.relative(dir.getOpposite()).below(), block, null); // TODO: Orientation
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ private static void updateRailsSectionNS(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState state, Direction dir, int[] count, int countAmt) {
|
+ private static void updateRailsSectionNS(PoweredRailBlock self, Level level, BlockPos pos, int c, BlockState state, Direction dir, int[] count, int countAmt) {
|
||||||
@@ -327,7 +328,7 @@ index 0000000000000000000000000000000000000000..3a0a3fe0c216414142134086e82cffaf
|
|||||||
+
|
+
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||||
index 8fc65c32a3c6e6842a76b36f45e1b1c23abbc480..364b161a1e22b9b3a7de4de954969fa4d2731dd7 100644
|
index bd14c08defe8afc5ceca59d16a5b1dbad178f594..99dc44c569b6003b271ce2ea3f80cb194173ff95 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/PoweredRailBlock.java
|
||||||
@@ -29,7 +29,7 @@ public class PoweredRailBlock extends BaseRailBlock {
|
@@ -29,7 +29,7 @@ public class PoweredRailBlock extends BaseRailBlock {
|
||||||
@@ -353,10 +354,10 @@ index 8fc65c32a3c6e6842a76b36f45e1b1c23abbc480..364b161a1e22b9b3a7de4de954969fa4
|
|||||||
boolean flag1 = world.hasNeighborSignal(pos) || this.findPoweredRailSignal(world, pos, state, true, 0) || this.findPoweredRailSignal(world, pos, state, false, 0);
|
boolean flag1 = world.hasNeighborSignal(pos) || this.findPoweredRailSignal(world, pos, state, true, 0) || this.findPoweredRailSignal(world, pos, state, false, 0);
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index 97da147ae867500a343af7beea51ed5e89543a47..db87e8d98aeeeb89566dac8f94c02846cb287fb9 100644
|
index 9cfab16b9cdf40ccb709c0af66c406954560c0ef..0e27e4a1f767842d1dcd2ed235a6a45f120bf32e 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -114,6 +114,13 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -72,6 +72,13 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,4 +370,4 @@ index 97da147ae867500a343af7beea51ed5e89543a47..db87e8d98aeeeb89566dac8f94c02846
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public Item item;
|
||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Load player data asynchronously
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
index 19d3423644a6a394743c09eb6935bb7633a329a2..7c9edbe4073bb63c680c9839aa38d92139a90b81 100644
|
index 16069b9cbf6c7679c28a2e9a54e77d23cd10e541..bb10892f33ba0d7fc3959debef1045073868f8b8 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||||
@@ -76,7 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
@@ -76,7 +76,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||||
@@ -18,7 +18,7 @@ index 19d3423644a6a394743c09eb6935bb7633a329a2..7c9edbe4073bb63c680c9839aa38d921
|
|||||||
private final byte[] challenge;
|
private final byte[] challenge;
|
||||||
final MinecraftServer server;
|
final MinecraftServer server;
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
index 69ff5380eedb3e0b214324dec50bb5c0eb65001b..a044b9393e54bb46794ec477cb11bdacf62e0181 100644
|
index be4a5407fe9b692b72eb2b85e2dea160a0555bca..579f81ed04eeb6373b25e6794d3bf0c403891011 100644
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -183,6 +183,16 @@ public abstract class PlayerList {
|
@@ -183,6 +183,16 @@ public abstract class PlayerList {
|
||||||
@@ -56,10 +56,10 @@ index 69ff5380eedb3e0b214324dec50bb5c0eb65001b..a044b9393e54bb46794ec477cb11bdac
|
|||||||
// CraftBukkit start - Better rename detection
|
// CraftBukkit start - Better rename detection
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 7ef541c5d8306ef66214e7150aca0fa53c14d12a..9de9b3f2148216df41258d503fa1de896cca4771 100644
|
index 193e565b6d62caf278223db033351d03ff417637..7f30fa1928e1a7e59ee5acfdfd2334f810c30243 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -28,6 +28,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -38,6 +38,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public class Player extends ConfigurationPart {
|
public class Player extends ConfigurationPart {
|
||||||
|
|
||||||
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
|
public boolean checkSpectatorMovedToQuickly = !OPTIMIZE;
|
||||||
@@ -21,7 +21,7 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||||
index cd61276a45894a02cbefc41a63c27e2cf6361d1e..77007cdfd2e423d26d407d0403f4d1033f9c276a 100644
|
index 861bff267cb397e13e8e1c79bd0776b130c6e5da..266e56f2c2e6d8b760209b5d58c58333af5bd0c1 100644
|
||||||
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
--- a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
+++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java
|
||||||
@@ -21,7 +21,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
@@ -21,7 +21,7 @@ import org.checkerframework.framework.qual.DefaultQualifier;
|
||||||
@@ -155,7 +155,7 @@ index 0000000000000000000000000000000000000000..a060fdbdc4daaffd9aafc707dc567cb5
|
|||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java
|
diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java
|
||||||
index 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..4d41cd53f7f892df5f2f67968dbe001046b185bc 100644
|
index 252aef3ffe0fecd47ebea1ed7df48e14fa873eb9..f73f8faac05f90c646a23fadf3da565938a4f788 100644
|
||||||
--- a/src/main/java/net/minecraft/util/RandomSource.java
|
--- a/src/main/java/net/minecraft/util/RandomSource.java
|
||||||
+++ b/src/main/java/net/minecraft/util/RandomSource.java
|
+++ b/src/main/java/net/minecraft/util/RandomSource.java
|
||||||
@@ -10,18 +10,39 @@ import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandomSource;
|
@@ -10,18 +10,39 @@ import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandomSource;
|
||||||
@@ -201,10 +201,10 @@ index 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..4d41cd53f7f892df5f2f67968dbe0010
|
|||||||
|
|
||||||
static RandomSource createNewThreadLocalInstance() {
|
static RandomSource createNewThreadLocalInstance() {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
index d6cac5ed7916040104f2a79ed38eb8b453ea3db6..a16eaefaf146add122f128fa9ed03b7cdd74d198 100644
|
index 27a6de70530c2a1cbe2f77a7fb493038121710ea..bbe093f7d5e0dc8e875f237058aa74c739967dd9 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
|
||||||
@@ -393,7 +393,7 @@ public class PiglinAi {
|
@@ -395,7 +395,7 @@ public class PiglinAi {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean wantsToDance(LivingEntity piglin, LivingEntity target) {
|
private static boolean wantsToDance(LivingEntity piglin, LivingEntity target) {
|
||||||
@@ -214,7 +214,7 @@ index d6cac5ed7916040104f2a79ed38eb8b453ea3db6..a16eaefaf146add122f128fa9ed03b7c
|
|||||||
|
|
||||||
protected static boolean wantsToPickup(Piglin piglin, ItemStack stack) {
|
protected static boolean wantsToPickup(Piglin piglin, ItemStack stack) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
index ab3e35069a069040f72900a9581f41848e4c4653..30a31c21aa941f518eff542721e25450565368ba 100644
|
index 0e4c17c7246093d7fdb64a8f98536a84a8cfd978..0147a7be5fd147ffa9bd42a90e85a324bc317a81 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
|
||||||
@@ -343,7 +343,7 @@ public class StructureBlockEntity extends BlockEntity {
|
@@ -343,7 +343,7 @@ public class StructureBlockEntity extends BlockEntity {
|
||||||
@@ -240,10 +240,10 @@ index f1e0d3d7b1f458fcce83cf67762a16309123cdcb..6a8d5948f127ea87a0b4554ece4ad2c4
|
|||||||
|
|
||||||
public boolean isIgnoreEntities() {
|
public boolean isIgnoreEntities() {
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
index 0921894dbc0d81b943827ecda6e6befdbfd715f5..95df118e292422cc11c833bfe6e741c1fd3aa421 100644
|
index 907fe00ab752ad124020755f211567af771b9d70..e041752bbcba5cefce0dde8db917510129d29987 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
@@ -291,7 +291,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
@@ -288,7 +288,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
@@ -266,10 +266,10 @@ index 759b6e54db93792c9862b1f1625118ac6fa49d7a..e81fa9aefc76af906ed1b6903f416f4d
|
|||||||
|
|
||||||
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
|
public CraftFirework(CraftServer server, FireworkRocketEntity entity) {
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
diff --git a/src/main/java/org/plazmamc/plazma/Options.java b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
index 4b3ae18ef8cd09a2d9c9eaee2bf402d0dd7ee1cd..016a1cd625091fe9b93b27a9782cdc13057a0c8a 100644
|
index e7092aeb5abce5aa5f9bd434adc6acd4e43dec13..5673e587247d0cd644e694ca68bdbb340676a73d 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
--- a/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
+++ b/src/main/java/org/plazmamc/plazma/Options.java
|
||||||
@@ -12,5 +12,10 @@ public interface Options {
|
@@ -11,5 +11,10 @@ public interface Options {
|
||||||
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
boolean VANILLAIZE = getBoolean("Plazma.vanillaize") && !AGGRESSIVE;
|
||||||
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
boolean USE_VANILLA = getBoolean("Plazma.useVanillaConfiguration") && !AGGRESSIVE && NO_OPTIMIZE;
|
||||||
boolean VANILLA_ICO = getBoolean("Plazma.useVanillaFavicon");
|
boolean VANILLA_ICO = getBoolean("Plazma.useVanillaFavicon");
|
||||||
@@ -24,7 +24,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
diff --git a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
||||||
index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6df92db2fc 100644
|
index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6df92db2fc 100644
|
||||||
--- a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
--- a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
|
||||||
@@ -52,10 +51,10 @@ index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6d
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 9de9b3f2148216df41258d503fa1de896cca4771..49bce6e28e12f3729cab5628cf3e0f508a56d0d7 100644
|
index 7f30fa1928e1a7e59ee5acfdfd2334f810c30243..ba2c7b679f68d49add77731383bf68292fe9614a 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -134,4 +134,16 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -139,4 +139,16 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable water flowing speed
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||||
index 9dcdb2f4001115db0c26fdbf86531dbe6098485d..0fc89b33864000a262ec5369708f7aedeaf6dc0b 100644
|
index 1e741f36b79585f33abe413beafe00cf5205d54f..028aea6640356ba80f5d682e3cc03b7f82f5b9c7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||||
@@ -122,7 +122,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
@@ -123,7 +123,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTickDelay(LevelReader world) {
|
public int getTickDelay(LevelReader world) {
|
||||||
@@ -18,15 +18,17 @@ index 9dcdb2f4001115db0c26fdbf86531dbe6098485d..0fc89b33864000a262ec5369708f7aed
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
index db87e8d98aeeeb89566dac8f94c02846cb287fb9..f3ac159231768b9b39550e6f5fd512c340738e61 100644
|
index 0e27e4a1f767842d1dcd2ed235a6a45f120bf32e..c1d4a96cf5be77f4460c54ed19622f527d42ca06 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
@@ -91,6 +91,8 @@ public class WorldConfigurations extends ConfigurationPart {
|
@@ -64,7 +64,9 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
|
||||||
public Block block;
|
public Block block;
|
||||||
public class Block extends ConfigurationPart {
|
public class Block extends ConfigurationPart {
|
||||||
|
-
|
||||||
|
+
|
||||||
+ public int waterFlowingTick = 5;
|
+ public int waterFlowingTick = 5;
|
||||||
+
|
+
|
||||||
public OptimizeFarmCheck optimizeFarmCheck;
|
public Hopper hopper;
|
||||||
public class OptimizeFarmCheck extends ConfigurationPart {
|
public class Hopper extends ConfigurationPart {
|
||||||
|
|
||||||
37
patches/server/0040-cleanup-logs.patch
Normal file
37
patches/server/0040-cleanup-logs.patch
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Thu, 31 Oct 2024 22:53:16 +0900
|
||||||
|
Subject: [PATCH] cleanup logs
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
|
||||||
|
index a056aa167887abef9e6d531a9edd2cda433567d2..dbd822604471e7405e350586ea0e294e0234cf06 100644
|
||||||
|
--- a/src/main/resources/log4j2.xml
|
||||||
|
+++ b/src/main/resources/log4j2.xml
|
||||||
|
@@ -7,7 +7,7 @@
|
||||||
|
<LoggerNamePatternSelector defaultPattern="%highlightGUIError{[%d{HH:mm:ss} %level]: [%logger] %stripAnsi{%msg}%n%xEx{full}}">
|
||||||
|
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
|
||||||
|
<!-- Disable prefix for various plugins that bypass the plugin logger -->
|
||||||
|
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
|
||||||
|
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
|
||||||
|
pattern="%highlightGUIError{[%d{HH:mm:ss} %level]: %stripAnsi{%msg}%n%xEx{full}}" />
|
||||||
|
</LoggerNamePatternSelector>
|
||||||
|
</PatternLayout>
|
||||||
|
@@ -18,7 +18,7 @@
|
||||||
|
<LoggerNamePatternSelector defaultPattern="%highlightError{[%d{HH:mm:ss} %level]: [%logger] %msg%n%xEx{full}}">
|
||||||
|
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
|
||||||
|
<!-- Disable prefix for various plugins that bypass the plugin logger -->
|
||||||
|
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
|
||||||
|
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
|
||||||
|
pattern="%highlightError{[%d{HH:mm:ss} %level]: %msg%n%xEx{full}}" />
|
||||||
|
</LoggerNamePatternSelector>
|
||||||
|
</PatternLayout>
|
||||||
|
@@ -28,7 +28,7 @@
|
||||||
|
<LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level]: [%logger] %stripAnsi{%msg}%n%xEx{full}">
|
||||||
|
<!-- Log root, Minecraft, Mojang and Bukkit loggers without prefix -->
|
||||||
|
<!-- Disable prefix for various plugins that bypass the plugin logger -->
|
||||||
|
- <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE"
|
||||||
|
+ <PatternMatch key=",net.minecraft.,Minecraft,com.mojang.,com.sk89q.,ru.tehkode.,Minecraft.AWE,ca.spottedleaf."
|
||||||
|
pattern="[%d{HH:mm:ss}] [%t/%level]: %stripAnsi{%msg}%n%xEx{full}" />
|
||||||
|
</LoggerNamePatternSelector>
|
||||||
|
</PatternLayout>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Wed, 15 May 2024 14:12:50 +0900
|
||||||
|
Subject: [PATCH] Completely remove timings implementation
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||||
|
index 23594fb7eb4b2f33146592866608c2858ef23937..8acdea0f086129854cb44bc5ce8bbbc4e810b9ad 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
package io.papermc.paper.plugin.manager;
|
||||||
|
|
||||||
|
-import co.aikar.timings.TimedEventExecutor;
|
||||||
|
+//import co.aikar.timings.TimedEventExecutor; // Plazma - Completely remove timings implementation
|
||||||
|
import com.destroystokyo.paper.event.server.ServerExceptionEvent;
|
||||||
|
import com.destroystokyo.paper.exception.ServerEventException;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
@@ -96,7 +96,7 @@ class PaperEventManager {
|
||||||
|
throw new IllegalPluginAccessException("Plugin attempted to register " + event + " while not enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
- executor = new TimedEventExecutor(executor, plugin, null, event);
|
||||||
|
+ //executor = new TimedEventExecutor(executor, plugin, null, event); // Plazma - Completely remove timings implementation
|
||||||
|
this.getEventListeners(event).register(new RegisteredListener(listener, executor, priority, plugin, ignoreCancelled));
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -183,7 +183,7 @@ class PaperEventManager {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- EventExecutor executor = new TimedEventExecutor(EventExecutor.create(method, eventClass), plugin, method, eventClass);
|
||||||
|
+ EventExecutor executor = EventExecutor.create(method, eventClass); // Plazma - Completely remove timings implementation
|
||||||
|
eventSet.add(new RegisteredListener(listener, executor, eh.priority(), plugin, eh.ignoreCancelled()));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java
|
||||||
|
index 097500a59336db1bbfffcd1aa4cff7a8586e46ec..844e340c331c6dd12eaaac247f871b042ceb6c25 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginManagerImpl.java
|
||||||
|
@@ -232,7 +232,7 @@ public class PaperPluginManagerImpl implements PluginManager, DependencyContext
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useTimings() {
|
||||||
|
- return co.aikar.timings.Timings.isTimingsEnabled();
|
||||||
|
+ return false; // Thunderbolt - Remove remaining timings implementations
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
index 54ef910938efb537a689dd5dbda119455bbf2a0e..6e9766aff9a9f2b578f5b8a6b42e206fb7ad1bc6 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -3,7 +3,7 @@ package net.minecraft.server;
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.google.common.base.Splitter;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
-import co.aikar.timings.Timings;
|
||||||
|
+//import co.aikar.timings.Timings; // Plazma - Completely remove timings implementation
|
||||||
|
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||||
|
import com.google.common.base.Stopwatch;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
8515
patches/server/0042-Remove-persist-isClientSide-flag.patch
Normal file
8515
patches/server/0042-Remove-persist-isClientSide-flag.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -464,11 +464,11 @@ index 0000000000000000000000000000000000000000..3456f38d381643b0461669b0b5fec6bf
|
|||||||
+
|
+
|
||||||
+}
|
+}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||||
index ecd1bbd17cb0134cf1f4e99a3fea9e205d38f46b..a064bca7d59dc645b28d5c4d92611d7aff5d3c7d 100644
|
index 3d7578605812021bc84b99d4db1672a682d897ad..58feaaed5e301eb402dab24e6f155beb865fa5ee 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
|
||||||
@@ -76,6 +76,35 @@ public class AcquirePoi {
|
@@ -76,6 +76,35 @@ public class AcquirePoi {
|
||||||
io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur
|
io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes);
|
||||||
Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
Set<Pair<Holder<PoiType>, BlockPos>> set = new java.util.HashSet<>(poiposes);
|
||||||
// Paper end - optimise POI access
|
// Paper end - optimise POI access
|
||||||
+ // Plazma start - Process Pathfinding Asynchronously
|
+ // Plazma start - Process Pathfinding Asynchronously
|
||||||
@@ -478,7 +478,7 @@ index ecd1bbd17cb0134cf1f4e99a3fea9e205d38f46b..a064bca7d59dc645b28d5c4d92611d7a
|
|||||||
+ if (path == null || !path.canReach()) {
|
+ if (path == null || !path.canReach()) {
|
||||||
+ for (Pair<Holder<PoiType>, BlockPos> pair : set) long2ObjectMap.computeIfAbsent(
|
+ for (Pair<Holder<PoiType>, BlockPos> pair : set) long2ObjectMap.computeIfAbsent(
|
||||||
+ pair.getSecond().asLong(),
|
+ pair.getSecond().asLong(),
|
||||||
+ ignored -> new JitteredLinearRetry(entity.level().random, time)
|
+ ignored -> new net.minecraft.world.entity.ai.behavior.AcquirePoi.JitteredLinearRetry(entity.level().random, time)
|
||||||
+ );
|
+ );
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
@@ -736,10 +736,10 @@ index a3e0c5af4cc9323c02e88e768cbda9e46854aea1..d68e97084ba6bc97312fc5b62ffcb6e6
|
|||||||
if (this.canUpdatePath()) {
|
if (this.canUpdatePath()) {
|
||||||
this.followThePath();
|
this.followThePath();
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
||||||
index 62634bedd97c5be9ecce24ab0cff205715a68da8..d7bbb9ddb97b336a2198b07cb2395f1b8b8e9d30 100644
|
index f73b559b8e60859020f762dab88b67b8c912bf8f..d218604447afbde96dc4af33ba90a87617a13ed4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java
|
||||||
@@ -23,12 +23,26 @@ public class GroundPathNavigation extends PathNavigation {
|
@@ -24,10 +24,23 @@ public class GroundPathNavigation extends PathNavigation {
|
||||||
super(entity, world);
|
super(entity, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -753,24 +753,21 @@ index 62634bedd97c5be9ecce24ab0cff205715a68da8..d7bbb9ddb97b336a2198b07cb2395f1b
|
|||||||
+ evaluator.setCanWalkOverFences(features.canWalkOverFences());
|
+ evaluator.setCanWalkOverFences(features.canWalkOverFences());
|
||||||
+ return evaluator;
|
+ return evaluator;
|
||||||
+ };
|
+ };
|
||||||
|
+ // Plazma end - Process pathfinding asynchronously
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
protected PathFinder createPathFinder(int range) {
|
protected PathFinder createPathFinder(int range) {
|
||||||
this.nodeEvaluator = new WalkNodeEvaluator();
|
this.nodeEvaluator = new WalkNodeEvaluator();
|
||||||
this.nodeEvaluator.setCanPassDoors(true);
|
this.nodeEvaluator.setCanPassDoors(true);
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
|
||||||
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
|
|
||||||
return new PathFinder(this.nodeEvaluator, range);
|
return new PathFinder(this.nodeEvaluator, range);
|
||||||
}
|
}
|
||||||
+ // Plazma end - Process pathfinding asynchronously
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canUpdatePath() {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||||
index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f57890b04716 100644
|
index 48c0de870a5bbf647309e69361dfb10ab56c65ab..99e31c8e8488ce7138c5385575cbbabe0bd7394e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||||
@@ -152,6 +152,7 @@ public abstract class PathNavigation {
|
@@ -168,6 +168,7 @@ public abstract class PathNavigation {
|
||||||
return null;
|
return null;
|
||||||
} else if (!this.canUpdatePath()) {
|
} else if (!this.canUpdatePath()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -778,11 +775,10 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
|
|||||||
} else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) {
|
} else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) {
|
||||||
return this.path;
|
return this.path;
|
||||||
} else {
|
} else {
|
||||||
@@ -177,7 +178,23 @@ public abstract class PathNavigation {
|
@@ -195,6 +196,23 @@ public abstract class PathNavigation {
|
||||||
int i = (int)(followRange + (float)range);
|
|
||||||
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
|
PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i));
|
||||||
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier);
|
Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier);
|
||||||
- //this.level.getProfiler().pop(); // Purpur
|
profilerFiller.pop();
|
||||||
+ // Plazma start - Process pathfinding asynchronously
|
+ // Plazma start - Process pathfinding asynchronously
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) {
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) {
|
||||||
+ if (!positions.isEmpty()) this.targetPos = positions.iterator().next();
|
+ if (!positions.isEmpty()) this.targetPos = positions.iterator().next();
|
||||||
@@ -799,11 +795,11 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
|
|||||||
+
|
+
|
||||||
+ return path;
|
+ return path;
|
||||||
+ }
|
+ }
|
||||||
+ // Plazma end
|
+ // Plazma end - Process pathfinding asynchronously
|
||||||
if (path != null && path.getTarget() != null) {
|
if (path != null && path.getTarget() != null) {
|
||||||
this.targetPos = path.getTarget();
|
this.targetPos = path.getTarget();
|
||||||
this.reachRange = distance;
|
this.reachRange = distance;
|
||||||
@@ -233,8 +250,8 @@ public abstract class PathNavigation {
|
@@ -250,8 +268,8 @@ public abstract class PathNavigation {
|
||||||
if (this.isDone()) {
|
if (this.isDone()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -814,7 +810,7 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this.speedModifier = speed;
|
this.speedModifier = speed;
|
||||||
@@ -257,6 +274,7 @@ public abstract class PathNavigation {
|
@@ -274,6 +292,7 @@ public abstract class PathNavigation {
|
||||||
if (this.hasDelayedRecomputation) {
|
if (this.hasDelayedRecomputation) {
|
||||||
this.recomputePath();
|
this.recomputePath();
|
||||||
}
|
}
|
||||||
@@ -822,17 +818,15 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
|
|||||||
|
|
||||||
if (!this.isDone()) {
|
if (!this.isDone()) {
|
||||||
if (this.canUpdatePath()) {
|
if (this.canUpdatePath()) {
|
||||||
@@ -282,7 +300,9 @@ public abstract class PathNavigation {
|
@@ -300,6 +319,7 @@ public abstract class PathNavigation {
|
||||||
return this.level.getBlockState(blockPos.below()).isAir() ? pos.y : WalkNodeEvaluator.getFloorLevel(this.level, blockPos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @SuppressWarnings("DataFlowIssue") // Plazma - Process pathfinding asynchronously
|
|
||||||
protected void followThePath() {
|
protected void followThePath() {
|
||||||
+ if (!this.path.isProcessed()) return; // Plazma - Process pathfinding asynchronously
|
+ if (!this.path.isProcessed()) return; // Plazma - Process pathfinding asynchronously
|
||||||
Vec3 vec3 = this.getTempMobPos();
|
Vec3 vec3 = this.getTempMobPos();
|
||||||
this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F;
|
this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F;
|
||||||
Vec3i vec3i = this.path.getNextNodePos();
|
Vec3i vec3i = this.path.getNextNodePos();
|
||||||
@@ -439,7 +459,7 @@ public abstract class PathNavigation {
|
@@ -456,7 +476,7 @@ public abstract class PathNavigation {
|
||||||
public boolean shouldRecomputePath(BlockPos pos) {
|
public boolean shouldRecomputePath(BlockPos pos) {
|
||||||
if (this.hasDelayedRecomputation) {
|
if (this.hasDelayedRecomputation) {
|
||||||
return false;
|
return false;
|
||||||
@@ -842,10 +836,10 @@ index 544920a31b649985333f82beafa94a3392f5853e..05715fa17caf8d8eece85b7ad752f578
|
|||||||
Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0, ((double)node.y + this.mob.getY()) / 2.0, ((double)node.z + this.mob.getZ()) / 2.0);
|
Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0, ((double)node.y + this.mob.getY()) / 2.0, ((double)node.z + this.mob.getZ()) / 2.0);
|
||||||
return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex()));
|
return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex()));
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
||||||
index ce7398a617abe6e800c1e014b3ac5c970eb15c8a..8e9a00ee90f97d2684f72eca5006568aa2a858da 100644
|
index 0446ac540d8509a653abe1a8bc10f52fb43d6ae1..77c10a3e9570f53ce73dacb39cb86a00202e6ce6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java
|
||||||
@@ -15,12 +15,26 @@ public class WaterBoundPathNavigation extends PathNavigation {
|
@@ -15,10 +15,23 @@ public class WaterBoundPathNavigation extends PathNavigation {
|
||||||
super(entity, world);
|
super(entity, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -859,19 +853,16 @@ index ce7398a617abe6e800c1e014b3ac5c970eb15c8a..8e9a00ee90f97d2684f72eca5006568a
|
|||||||
+ evaluator.setCanWalkOverFences(features.canWalkOverFences());
|
+ evaluator.setCanWalkOverFences(features.canWalkOverFences());
|
||||||
+ return evaluator;
|
+ return evaluator;
|
||||||
+ };
|
+ };
|
||||||
|
+ // Plazma end - Process pathfinding asynchronously
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
protected PathFinder createPathFinder(int range) {
|
protected PathFinder createPathFinder(int range) {
|
||||||
this.allowBreaching = this.mob.getType() == EntityType.DOLPHIN;
|
this.allowBreaching = this.mob.getType() == EntityType.DOLPHIN;
|
||||||
this.nodeEvaluator = new SwimNodeEvaluator(this.allowBreaching);
|
this.nodeEvaluator = new SwimNodeEvaluator(this.allowBreaching);
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
|
||||||
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
|
|
||||||
return new PathFinder(this.nodeEvaluator, range);
|
return new PathFinder(this.nodeEvaluator, range);
|
||||||
}
|
}
|
||||||
+ // Plazma end - Process pathfinding asynchronously
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canUpdatePath() {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
||||||
index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa630643e3535f 100644
|
index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa630643e3535f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
|
||||||
@@ -903,10 +894,10 @@ index 9104d7010bda6f9f73b478c11490ef9c53f76da2..a53950a6e4cb2e672b6f130461fa6306
|
|||||||
// Paper end - optimise POI access
|
// Paper end - optimise POI access
|
||||||
if (path != null && path.canReach()) {
|
if (path != null && path.canReach()) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..d1a31e04899e3bce3f884f60916abd4e25dd3afd 100644
|
index 6dec1720aea724baab541e26e14c9fa0646abdbf..bf4a3bc730709f41a5089dfe4c6342b08057ef02 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
@@ -1147,7 +1147,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
@@ -1206,7 +1206,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||||
} else {
|
} else {
|
||||||
Bee.this.pathfindRandomlyTowards(Bee.this.hivePos);
|
Bee.this.pathfindRandomlyTowards(Bee.this.hivePos);
|
||||||
}
|
}
|
||||||
@@ -915,7 +906,7 @@ index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..d1a31e04899e3bce3f884f60916abd4e
|
|||||||
boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos);
|
boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos);
|
||||||
|
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
@@ -1209,7 +1209,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
@@ -1265,7 +1265,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||||
} else {
|
} else {
|
||||||
Path pathentity = Bee.this.navigation.getPath();
|
Path pathentity = Bee.this.navigation.getPath();
|
||||||
|
|
||||||
@@ -925,10 +916,10 @@ index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..d1a31e04899e3bce3f884f60916abd4e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||||
index 651f30b4fb02dc03fabad34b62d7d86fa0889754..2fb5e4fc7422c81c67a026143c92f5e787d864fb 100644
|
index 17ba0c6060ab56ab97b133565ebf86320ab52e1b..305fe2c13ae2d81b99ff36f8ef18e24c23255eae 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
|
||||||
@@ -491,11 +491,25 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
@@ -506,10 +506,23 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
|
||||||
return nodeType != PathType.WATER_BORDER && super.canCutCorner(nodeType);
|
return nodeType != PathType.WATER_BORDER && super.canCutCorner(nodeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -942,33 +933,31 @@ index 651f30b4fb02dc03fabad34b62d7d86fa0889754..2fb5e4fc7422c81c67a026143c92f5e7
|
|||||||
+ evaluator.setCanFloat(features.canFloat());
|
+ evaluator.setCanFloat(features.canFloat());
|
||||||
+ return evaluator;
|
+ return evaluator;
|
||||||
+ };
|
+ };
|
||||||
|
+ // Plazma end - Process pathfinding asynchronously
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
protected PathFinder createPathFinder(int range) {
|
protected PathFinder createPathFinder(int range) {
|
||||||
this.nodeEvaluator = new Frog.FrogNodeEvaluator(true);
|
this.nodeEvaluator = new Frog.FrogNodeEvaluator(true);
|
||||||
this.nodeEvaluator.setCanPassDoors(true);
|
this.nodeEvaluator.setCanPassDoors(true);
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled)
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) return new PathFinder(this.nodeEvaluator, range, GENERATOR); // Plazma - Process pathfinding asynchronously
|
||||||
+ return new PathFinder(this.nodeEvaluator, range, GENERATOR);
|
|
||||||
return new PathFinder(this.nodeEvaluator, range);
|
return new PathFinder(this.nodeEvaluator, range);
|
||||||
}
|
}
|
||||||
+ // Plazma end - Process pathfinding asynchronously
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||||
index 94de51bf9acb32421838ffe54602310f0263b3c4..1afa876e6abac59320c10d37ec8664db1af751b2 100644
|
index 19bc362ff8e28cd0e26ba357dda425bac24c5a56..e4784d37c4b93c34325eb72cfbaa640c63d0c3c1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
|
||||||
@@ -296,7 +296,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
@@ -308,7 +308,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
|
||||||
|
|
||||||
protected boolean closeToNextPos() {
|
protected boolean closeToNextPos() {
|
||||||
Path pathentity = this.getNavigation().getPath();
|
Path path = this.getNavigation().getPath();
|
||||||
|
- if (path != null) {
|
||||||
- if (pathentity != null) {
|
+ if (path != null && path.isProcessed()) { // Plazma - Process pathfinding asynchronously
|
||||||
+ if (pathentity != null && pathentity.isProcessed()) { // Plazma - Process pathfinding asynchronously
|
BlockPos blockPos = path.getTarget();
|
||||||
BlockPos blockposition = pathentity.getTarget();
|
if (blockPos != null) {
|
||||||
|
double d = this.distanceToSqr((double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ());
|
||||||
if (blockposition != null) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||||
index 70650cc6f76bed79a31a9e8c86205910994a920f..ca521f6ddaf898f17473e9b87e302ddaf9f30380 100644
|
index c09e49f928e32a3dc6c557f01d92c455d9bfc8c6..bf507bcb8746298ca96e50686cdf1bd91c91e4c1 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
|
||||||
@@ -610,10 +610,23 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
@@ -610,10 +610,23 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
|
||||||
@@ -996,10 +985,10 @@ index 70650cc6f76bed79a31a9e8c86205910994a920f..ca521f6ddaf898f17473e9b87e302dda
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||||
index c0398f21cb2ecc9e07f01163a4432a603ff26f03..78a5631753e5bdc16b786ac6951c8d39c4337767 100644
|
index 6cce132f43ce7aad6f5ee2b351855c9b57b8f0c1..4102dc4c8b63a1d00a8417aa303521590202f9a6 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
--- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java
|
||||||
@@ -634,6 +634,15 @@ public class Warden extends Monster implements VibrationSystem {
|
@@ -638,6 +638,15 @@ public class Warden extends Monster implements VibrationSystem {
|
||||||
protected PathFinder createPathFinder(int range) {
|
protected PathFinder createPathFinder(int range) {
|
||||||
this.nodeEvaluator = new WalkNodeEvaluator();
|
this.nodeEvaluator = new WalkNodeEvaluator();
|
||||||
this.nodeEvaluator.setCanPassDoors(true);
|
this.nodeEvaluator.setCanPassDoors(true);
|
||||||
@@ -1037,10 +1026,10 @@ index d9d0fff9962131808d54cca20f209df50b8e4af1..420dd323790e72aa12c942d31a94bcb8
|
|||||||
public void write(FriendlyByteBuf buf) {
|
public void write(FriendlyByteBuf buf) {
|
||||||
buf.writeCollection(this.targetNodes, (bufx, node) -> node.writeToStream(bufx));
|
buf.writeCollection(this.targetNodes, (bufx, node) -> node.writeToStream(bufx));
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||||
index 404080976208c30e9e95e5bee47c2a749e709a45..e31ee7508a1af51bec628141c3a153997dc75672 100644
|
index cc7d94144e39f7dace7b569b4567def98396e8f9..95e71c471904fc54003180632dc85398ae06d241 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||||
@@ -16,6 +16,7 @@ import net.minecraft.util.profiling.ProfilerFiller;
|
@@ -17,6 +17,7 @@ import net.minecraft.util.profiling.ProfilerFiller;
|
||||||
import net.minecraft.util.profiling.metrics.MetricCategory;
|
import net.minecraft.util.profiling.metrics.MetricCategory;
|
||||||
import net.minecraft.world.entity.Mob;
|
import net.minecraft.world.entity.Mob;
|
||||||
import net.minecraft.world.level.PathNavigationRegion;
|
import net.minecraft.world.level.PathNavigationRegion;
|
||||||
@@ -1048,49 +1037,36 @@ index 404080976208c30e9e95e5bee47c2a749e709a45..e31ee7508a1af51bec628141c3a15399
|
|||||||
|
|
||||||
public class PathFinder {
|
public class PathFinder {
|
||||||
private static final float FUDGING = 1.5F;
|
private static final float FUDGING = 1.5F;
|
||||||
@@ -24,91 +25,138 @@ public class PathFinder {
|
@@ -25,8 +26,20 @@ public class PathFinder {
|
||||||
public final NodeEvaluator nodeEvaluator;
|
public final NodeEvaluator nodeEvaluator;
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
private final BinaryHeap openSet = new BinaryHeap();
|
private final BinaryHeap openSet = new BinaryHeap();
|
||||||
+ // Plazma start - Process pathfinding asynchronously
|
+ // Plazma start - Process pathfinding asynchronously
|
||||||
|
+ public static boolean ASYNC = false;
|
||||||
+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
|
+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
|
||||||
+ private final @Nullable NodeEvaluatorGenerator evaluatorGenerator;
|
+ private final @Nullable NodeEvaluatorGenerator evaluatorGenerator;
|
||||||
|
+ // Plazma end - Process pathfinding asynchronously
|
||||||
|
|
||||||
public PathFinder(NodeEvaluator pathNodeMaker, int range) {
|
public PathFinder(NodeEvaluator pathNodeMaker, int range) {
|
||||||
|
+ // Plazma start - Process pathfinding asynchronously
|
||||||
+ this(pathNodeMaker, range, null);
|
+ this(pathNodeMaker, range, null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public PathFinder(NodeEvaluator pathNodeMaker, int range, @Nullable NodeEvaluatorGenerator evaluatorGenerator) {
|
+ public PathFinder(NodeEvaluator pathNodeMaker, int range, @Nullable NodeEvaluatorGenerator evaluatorGenerator) {
|
||||||
|
+ this.evaluatorGenerator = evaluatorGenerator;
|
||||||
|
+ // Plazma end - Process pathfinding asynchronously
|
||||||
this.nodeEvaluator = pathNodeMaker;
|
this.nodeEvaluator = pathNodeMaker;
|
||||||
this.maxVisitedNodes = range;
|
this.maxVisitedNodes = range;
|
||||||
+ this.evaluatorGenerator = evaluatorGenerator;
|
|
||||||
}
|
}
|
||||||
|
@@ -37,100 +50,48 @@ public class PathFinder {
|
||||||
|
|
||||||
+ @SuppressWarnings("ConstantValue")
|
|
||||||
@Nullable
|
@Nullable
|
||||||
- public Path findPath(PathNavigationRegion world, Mob mob, Set<BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
|
public Path findPath(PathNavigationRegion world, Mob mob, Set<BlockPos> positions, float followRange, int distance, float rangeMultiplier) {
|
||||||
- this.openSet.clear();
|
- this.openSet.clear();
|
||||||
- this.nodeEvaluator.prepare(world, mob);
|
- this.nodeEvaluator.prepare(world, mob);
|
||||||
- Node node = this.nodeEvaluator.getStart();
|
- Node node = this.nodeEvaluator.getStart();
|
||||||
+ public Path findPath(
|
- if (node == null) {
|
||||||
+ PathNavigationRegion world,
|
- return null;
|
||||||
+ Mob mob,
|
|
||||||
+ Set<BlockPos> positions,
|
|
||||||
+ float followRange,
|
|
||||||
+ int distance,
|
|
||||||
+ float rangeMultiplier
|
|
||||||
+ ) {
|
|
||||||
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().entity.asyncPathProcess.enabled) this.openSet.clear();
|
|
||||||
+ NodeEvaluator evaluator = this.evaluatorGenerator == null
|
|
||||||
+ ? this.nodeEvaluator
|
|
||||||
+ : NodeEvaluatorCache.take(this.evaluatorGenerator, this.nodeEvaluator);
|
|
||||||
+
|
|
||||||
+ evaluator.prepare(world, mob);
|
|
||||||
+ Node node = evaluator.getStart();
|
|
||||||
+
|
|
||||||
if (node == null) {
|
|
||||||
+ NodeEvaluatorCache.remove(evaluator);
|
|
||||||
return null;
|
|
||||||
- } else {
|
- } else {
|
||||||
- // Paper start - Perf: remove streams and optimize collection
|
- // Paper start - Perf: remove streams and optimize collection
|
||||||
- List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
|
- List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
|
||||||
@@ -1098,112 +1074,66 @@ index 404080976208c30e9e95e5bee47c2a749e709a45..e31ee7508a1af51bec628141c3a15399
|
|||||||
- map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
|
- map.add(new java.util.AbstractMap.SimpleEntry<>(this.nodeEvaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
|
||||||
- }
|
- }
|
||||||
- // Paper end - Perf: remove streams and optimize collection
|
- // Paper end - Perf: remove streams and optimize collection
|
||||||
- Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier);
|
- Path path = this.findPath(node, map, followRange, distance, rangeMultiplier);
|
||||||
- this.nodeEvaluator.done();
|
- this.nodeEvaluator.done();
|
||||||
- return path;
|
- return path;
|
||||||
}
|
- }
|
||||||
+
|
- }
|
||||||
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
|
-
|
||||||
+ for (final BlockPos pos : positions)
|
- @Nullable
|
||||||
+ map.add(new java.util.AbstractMap.SimpleEntry<>(evaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
|
- // Paper start - Perf: remove streams and optimize collection
|
||||||
+
|
- private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||||
+ if (this.evaluatorGenerator == null) {
|
- ProfilerFiller profilerFiller = Profiler.get();
|
||||||
+ NodeEvaluatorCache.remove(evaluator);
|
- profilerFiller.push("find_path");
|
||||||
+ return this.findPath(node, map, followRange, distance, rangeMultiplier);
|
- profilerFiller.markForCharting(MetricCategory.PATH_FINDING);
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return new AsyncPath(
|
|
||||||
+ Lists.newArrayList(),
|
|
||||||
+ positions,
|
|
||||||
+ () -> this.processPath(evaluator, node, map, followRange, distance, rangeMultiplier),
|
|
||||||
+ () -> {
|
|
||||||
+ evaluator.done();
|
|
||||||
+ NodeEvaluatorCache.returnEvaluator(evaluator);
|
|
||||||
+ }
|
|
||||||
+ );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
// Paper start - Perf: remove streams and optimize collection
|
|
||||||
- private Path findPath(ProfilerFiller profiler, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
|
||||||
- //profiler.push("find_path"); // Purpur
|
|
||||||
- //profiler.markForCharting(MetricCategory.PATH_FINDING); // Purpur
|
|
||||||
- // Set<Target> set = positions.keySet();
|
- // Set<Target> set = positions.keySet();
|
||||||
+ private Path findPath(
|
- startNode.g = 0.0F;
|
||||||
+ Node startNode,
|
- startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
|
||||||
+ List<Map.Entry<Target, BlockPos>> positions,
|
- startNode.f = startNode.h;
|
||||||
+ float followRange,
|
- this.openSet.clear();
|
||||||
+ int distance,
|
- this.openSet.insert(startNode);
|
||||||
+ float rangeMultiplier
|
|
||||||
+ ) {
|
|
||||||
+ try {
|
|
||||||
+ return this.processPath(this.nodeEvaluator, startNode, positions, followRange, distance, rangeMultiplier);
|
|
||||||
+ } catch (Exception e) {
|
|
||||||
+ LOGGER.error("Failed to process path", e);
|
|
||||||
+ return null;
|
|
||||||
+ } finally {
|
|
||||||
+ this.nodeEvaluator.done();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @SuppressWarnings("DataFlowIssue")
|
|
||||||
+ @org.jetbrains.annotations.NotNull
|
|
||||||
+ private synchronized Path processPath(
|
|
||||||
+ NodeEvaluator nodeEvaluator,
|
|
||||||
+ Node startNode,
|
|
||||||
+ List<Map.Entry<Target, BlockPos>> positions,
|
|
||||||
+ float followRange,
|
|
||||||
+ int distance,
|
|
||||||
+ float rangeMultiplier
|
|
||||||
+ ) {
|
|
||||||
+ org.apache.commons.lang3.Validate.isTrue(!positions.isEmpty());
|
|
||||||
startNode.g = 0.0F;
|
|
||||||
startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection
|
|
||||||
startNode.f = startNode.h;
|
|
||||||
this.openSet.clear();
|
|
||||||
this.openSet.insert(startNode);
|
|
||||||
- // Set<Node> set2 = ImmutableSet.of(); // Paper - unused - diff on change
|
- // Set<Node> set2 = ImmutableSet.of(); // Paper - unused - diff on change
|
||||||
+
|
- int i = 0;
|
||||||
int i = 0;
|
- List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection
|
||||||
List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection
|
- int j = (int)((float)this.maxVisitedNodes * rangeMultiplier);
|
||||||
int j = (int)((float)this.maxVisitedNodes * rangeMultiplier);
|
+ if (ASYNC) this.openSet.clear();
|
||||||
|
|
||||||
while (!this.openSet.isEmpty()) {
|
- while (!this.openSet.isEmpty()) {
|
||||||
- if (++i >= j) {
|
- if (++i >= j) {
|
||||||
- break;
|
- break;
|
||||||
- }
|
- }
|
||||||
+ if (++i >= j) break;
|
+ NodeEvaluator evaluator = this.evaluatorGenerator == null ? this.nodeEvaluator : NodeEvaluatorCache.take(this.evaluatorGenerator, this.nodeEvaluator);
|
||||||
|
+ evaluator.prepare(world, mob);
|
||||||
|
|
||||||
Node node = this.openSet.pop();
|
- Node node = this.openSet.pop();
|
||||||
node.closed = true;
|
- node.closed = true;
|
||||||
|
+ Node node = evaluator.getStart();
|
||||||
|
+ if ( node == null ) {
|
||||||
|
+ NodeEvaluatorCache.remove(evaluator);
|
||||||
|
+ return null; // diff on change
|
||||||
|
+ }
|
||||||
|
|
||||||
- // Paper start - optimize collection
|
- // Paper start - optimize collection
|
||||||
- for (int i1 = 0; i1 < positions.size(); i1++) {
|
- for (int i1 = 0; i1 < positions.size(); i1++) {
|
||||||
- final Map.Entry<Target, BlockPos> entry = positions.get(i1);
|
- final Map.Entry<Target, BlockPos> entry = positions.get(i1);
|
||||||
+ for (final Map.Entry<Target, BlockPos> entry : positions) {
|
- Target target = entry.getKey();
|
||||||
Target target = entry.getKey();
|
|
||||||
- if (node.distanceManhattan(target) <= (float)distance) {
|
- if (node.distanceManhattan(target) <= (float)distance) {
|
||||||
+ if (node.distanceManhattan(target) <= (float) distance) {
|
- target.setReached();
|
||||||
target.setReached();
|
- entryList.add(entry);
|
||||||
entryList.add(entry);
|
|
||||||
- // Paper end - Perf: remove streams and optimize collection
|
- // Paper end - Perf: remove streams and optimize collection
|
||||||
}
|
- }
|
||||||
}
|
- }
|
||||||
|
+ List<Map.Entry<Target, BlockPos>> map = Lists.newArrayList();
|
||||||
|
+ for (final BlockPos pos : positions)
|
||||||
|
+ map.add(new java.util.AbstractMap.SimpleEntry<>(evaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos));
|
||||||
|
|
||||||
- if (!entryList.isEmpty()) { // Paper - Perf: remove streams and optimize collection; rename
|
- if (!entryList.isEmpty()) { // Paper - Perf: remove streams and optimize collection; rename
|
||||||
- break;
|
- break;
|
||||||
- }
|
- }
|
||||||
+ if (!entryList.isEmpty()) break;
|
+ if (this.evaluatorGenerator == null) {
|
||||||
+ if (node.distanceTo(startNode) >= followRange) continue;
|
+ NodeEvaluatorCache.remove(evaluator);
|
||||||
+
|
+ return this.findPath(node, map, followRange, distance, rangeMultiplier);
|
||||||
+ int k = nodeEvaluator.getNeighbors(this.neighbors, node);
|
+ }
|
||||||
+
|
|
||||||
+ for (int l = 0; l < k; l++) {
|
|
||||||
+ Node node2 = this.neighbors[l];
|
|
||||||
+ float f = this.distance(node, node2);
|
|
||||||
+ node2.walkedDistance = node.walkedDistance + f;
|
|
||||||
+ float g = node.g + f + node2.costMalus;
|
|
||||||
+ if (node2.walkedDistance >= followRange || (node2.inOpenSet() && g >= node2.g)) continue;
|
|
||||||
|
|
||||||
- if (!(node.distanceTo(startNode) >= followRange)) {
|
- if (!(node.distanceTo(startNode) >= followRange)) {
|
||||||
- int k = this.nodeEvaluator.getNeighbors(this.neighbors, node);
|
- int k = this.nodeEvaluator.getNeighbors(this.neighbors, node);
|
||||||
@@ -1224,26 +1154,124 @@ index 404080976208c30e9e95e5bee47c2a749e709a45..e31ee7508a1af51bec628141c3a15399
|
|||||||
- this.openSet.insert(node2);
|
- this.openSet.insert(node2);
|
||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
|
- }
|
||||||
|
+ return new AsyncPath(
|
||||||
|
+ Lists.newArrayList(),
|
||||||
|
+ positions,
|
||||||
|
+ () -> this.processPath(evaluator, node, map, followRange, distance, rangeMultiplier),
|
||||||
|
+ () -> {
|
||||||
|
+ evaluator.done();
|
||||||
|
+ NodeEvaluatorCache.returnEvaluator(evaluator);
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- // Paper start - Perf: remove streams and optimize collection
|
||||||
|
- Path best = null;
|
||||||
|
- boolean entryListIsEmpty = entryList.isEmpty();
|
||||||
|
- Comparator<Path> comparator = entryListIsEmpty ? Comparator.comparingInt(Path::getNodeCount)
|
||||||
|
- : Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount);
|
||||||
|
- for (Map.Entry<Target, BlockPos> entry : entryListIsEmpty ? positions : entryList) {
|
||||||
|
- Path path = this.reconstructPath(entry.getKey().getBestNode(), entry.getValue(), !entryListIsEmpty);
|
||||||
|
- if (best == null || comparator.compare(path, best) < 0)
|
||||||
|
- best = path;
|
||||||
|
+ @Nullable
|
||||||
|
+ // Paper start - Perf: remove streams and optimize collection
|
||||||
|
+ private Path findPath(Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||||
|
+ try {
|
||||||
|
+ return this.processPath(this.nodeEvaluator, startNode, positions, followRange, distance, rangeMultiplier);
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ LOGGER.error("Failed to process path", e);
|
||||||
|
+ return null;
|
||||||
|
+ } finally {
|
||||||
|
+ this.nodeEvaluator.done();
|
||||||
|
}
|
||||||
|
- profilerFiller.pop();
|
||||||
|
- return best;
|
||||||
|
- // Paper end - Perf: remove streams and optimize collection
|
||||||
|
}
|
||||||
|
|
||||||
|
protected float distance(Node a, Node b) {
|
||||||
|
@@ -164,4 +125,78 @@ public class PathFinder {
|
||||||
|
|
||||||
|
return new Path(list, target, reachesTarget);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Nullable
|
||||||
|
+ private Path processPath(NodeEvaluator evaluator, Node startNode, List<Map.Entry<Target, BlockPos>> positions, float followRange, int distance, float rangeMultiplier) {
|
||||||
|
+ org.apache.commons.lang3.Validate.isTrue(!positions.isEmpty());
|
||||||
|
+
|
||||||
|
+ startNode.g = 0.0F;
|
||||||
|
+ startNode.h = this.getBestH(startNode, positions);
|
||||||
|
+ startNode.f = startNode.h;
|
||||||
|
+
|
||||||
|
+ this.openSet.clear();
|
||||||
|
+ this.openSet.insert(startNode);
|
||||||
|
+
|
||||||
|
+ int i = 0;
|
||||||
|
+ int j = (int) (this.maxVisitedNodes * rangeMultiplier);
|
||||||
|
+ List<Map.Entry<Target, BlockPos>> entryList = Lists.newArrayListWithExpectedSize(positions.size());
|
||||||
|
+
|
||||||
|
+ while (!this.openSet.isEmpty()) {
|
||||||
|
+ if (++i >= j) break;
|
||||||
|
+
|
||||||
|
+ Node node = this.openSet.pop();
|
||||||
|
+ node.closed = true;
|
||||||
|
+
|
||||||
|
+ for (final Map.Entry<Target, BlockPos> entry : positions) {
|
||||||
|
+ Target target = entry.getKey();
|
||||||
|
+ if (node.distanceManhattan(target) > distance) continue;
|
||||||
|
+
|
||||||
|
+ target.setReached();
|
||||||
|
+ entryList.add(entry);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!entryList.isEmpty()) break;
|
||||||
|
+ if (node.distanceTo(startNode) >= followRange) continue;
|
||||||
|
+
|
||||||
|
+ int k = evaluator.getNeighbors(this.neighbors, node);
|
||||||
|
+ for (int l = 0; l < k; l++) {
|
||||||
|
+ Node node2 = this.neighbors[l];
|
||||||
|
+
|
||||||
|
+ float f = this.distance(node, node2);
|
||||||
|
+ float g = node.g + f + node2.costMalus;
|
||||||
|
+
|
||||||
|
+ node2.walkedDistance = node.walkedDistance + f;
|
||||||
|
+ if (node2.walkedDistance >= followRange && !(!node2.inOpenSet() || g < node2.g)) continue;
|
||||||
|
+
|
||||||
+ node2.cameFrom = node;
|
+ node2.cameFrom = node;
|
||||||
+ node2.g = g;
|
+ node2.g = g;
|
||||||
+ node2.h = this.getBestH(node2, positions) * 1.5F; // Paper - Perf: remove streams and optimize collection
|
+ node2.h = this.getBestH(node2, positions) * 1.5F;
|
||||||
|
+
|
||||||
+ if (node2.inOpenSet()) {
|
+ if (node2.inOpenSet()) {
|
||||||
+ this.openSet.changeCost(node2, node2.g + node2.h);
|
+ this.openSet.changeCost(node2, node2.g + node2.h);
|
||||||
+ continue;
|
+ continue;
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ node2.f = node2.g + node2.h;
|
+ node2.f = node2.g + node2.h;
|
||||||
+ this.openSet.insert(node2);
|
+ this.openSet.insert(node2);
|
||||||
}
|
+ }
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
@@ -126,6 +174,7 @@ public class PathFinder {
|
+ Path best = null;
|
||||||
return best;
|
+ boolean isEmpty = entryList.isEmpty();
|
||||||
// Paper end - Perf: remove streams and optimize collection
|
+
|
||||||
}
|
+ Comparator<Path> comparator = isEmpty
|
||||||
+ // Plazma end - Process pathfinding asynchronously
|
+ ? Comparator.comparingInt(Path::getNodeCount)
|
||||||
|
+ : Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount);
|
||||||
protected float distance(Node a, Node b) {
|
+
|
||||||
return a.distanceTo(b);
|
+ for (final Map.Entry<Target, BlockPos> entry : isEmpty ? positions : entryList) {
|
||||||
|
+ Path path = this.reconstructPath(entry.getKey().getBestNode(), entry.getValue(), !isEmpty);
|
||||||
|
+ if (best != null && comparator.compare(path, best) >= 0) continue;
|
||||||
|
+
|
||||||
|
+ best = path;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return best;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||||
index 6308822f819d7cb84c8070c8a7eec1a3f822114b..370540e48a5fd5693bf956ffbddccca58a1482f8 100644
|
index 6308822f819d7cb84c8070c8a7eec1a3f822114b..370540e48a5fd5693bf956ffbddccca58a1482f8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
--- a/src/main/java/net/minecraft/world/level/pathfinder/SwimNodeEvaluator.java
|
||||||
@@ -1270,10 +1298,10 @@ index 1c83926923f50fb4da1a83dc91614c20a831555f..aec2d0f9a957be65d031957dbff874d8
|
|||||||
|
|
||||||
Command.broadcastCommandMessage(sender, text("Successfully reloaded Plazma configuration files.", NamedTextColor.GREEN));
|
Command.broadcastCommandMessage(sender, text("Successfully reloaded Plazma configuration files.", NamedTextColor.GREEN));
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index aa8b0a9b3d98e2c2fb1bd3c374cd2e742e6e17cf..516a4545b67a4bf0d37cee3d1e26772831944fe6 100644
|
index ba2c7b679f68d49add77731383bf68292fe9614a..81f7ac9753058aa72dea5704fc9859ba3b909fb1 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -60,6 +60,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -80,6 +80,26 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public class Entity extends ConfigurationPart {
|
public class Entity extends ConfigurationPart {
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||||
index a28366b8ed0da356dad6941e0a817d0b7ec43738..a4e655e40282def5d94a598230485f2a02b14eab 100644
|
index e4ae25c83ab9dd1aaa530a5456275ef63cdb8511..03a5effa6f0ef4d5c46a03a39cf336493873cfea 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||||
@@ -19,9 +19,9 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
@@ -19,9 +19,9 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||||
@@ -33,21 +33,21 @@ index a28366b8ed0da356dad6941e0a817d0b7ec43738..a4e655e40282def5d94a598230485f2a
|
|||||||
+ public short nonEmptyBlockCount; // Paper - package private // Plazma -> public
|
+ public short nonEmptyBlockCount; // Paper - package private // Plazma -> public
|
||||||
+ public short tickingBlockCount; // Plazma - private -> public
|
+ public short tickingBlockCount; // Plazma - private -> public
|
||||||
+ public short tickingFluidCount; // Plazma - private -> public
|
+ public short tickingFluidCount; // Plazma - private -> public
|
||||||
public short fluidStateCount; // Pufferfish
|
|
||||||
public final PalettedContainer<BlockState> states;
|
public final PalettedContainer<BlockState> states;
|
||||||
// CraftBukkit start - read/write
|
private PalettedContainer<Holder<Biome>> biomes; // CraftBukkit - read/write
|
||||||
@@ -35,8 +35,8 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- private int specialCollidingBlocks;
|
@@ -35,8 +35,8 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||||
- private final ca.spottedleaf.moonrise.common.list.IBlockDataList tickingBlocks = new ca.spottedleaf.moonrise.common.list.IBlockDataList();
|
|
||||||
+ public int specialCollidingBlocks; // Plazma - private -> public
|
private boolean isClient;
|
||||||
+ public final ca.spottedleaf.moonrise.common.list.IBlockDataList tickingBlocks = new ca.spottedleaf.moonrise.common.list.IBlockDataList(); // Plazma - private -> public
|
private static final short CLIENT_FORCED_SPECIAL_COLLIDING_BLOCKS = (short)9999;
|
||||||
|
- private short specialCollidingBlocks;
|
||||||
|
- private final ca.spottedleaf.moonrise.common.list.ShortList tickingBlocks = new ca.spottedleaf.moonrise.common.list.ShortList();
|
||||||
|
+ public short specialCollidingBlocks; // Plazma - private -> public
|
||||||
|
+ public final ca.spottedleaf.moonrise.common.list.ShortList tickingBlocks = new ca.spottedleaf.moonrise.common.list.ShortList(); // Plazma - private -> public
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final int moonrise$getSpecialCollidingBlocks() {
|
public final boolean moonrise$hasSpecialCollidingBlocks() {
|
||||||
@@ -271,17 +271,13 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
@@ -309,18 +309,14 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public void fillBiomesFromNoise(BiomeResolver biomeSupplier, Climate.Sampler sampler, int x, int y, int z) {
|
public void fillBiomesFromNoise(BiomeResolver biomeSupplier, Climate.Sampler sampler, int x, int y, int z) {
|
||||||
@@ -70,9 +70,10 @@ index a28366b8ed0da356dad6941e0a817d0b7ec43738..a4e655e40282def5d94a598230485f2a
|
|||||||
+ this.biomes = block;
|
+ this.biomes = block;
|
||||||
+ // Plazma end - Optimize noise
|
+ // Plazma end - Optimize noise
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public LevelChunkSection copy() {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||||
index 13d3c877b006a4975e7370713e3919c661e7890f..f3e7dcd0a5625c7b4e8a3512ee05637ab298a598 100644
|
index 8b84bf2272556ac3321cbf16361d7f48a1cc6873..84047336fbd8833cc95bf5afa721f983aee97d4d 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||||
@@ -30,7 +30,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
@@ -30,7 +30,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||||
@@ -84,17 +85,8 @@ index 13d3c877b006a4975e7370713e3919c661e7890f..f3e7dcd0a5625c7b4e8a3512ee05637a
|
|||||||
// private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused
|
// private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused
|
||||||
|
|
||||||
public void acquire() {
|
public void acquire() {
|
||||||
@@ -386,7 +386,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
|
||||||
void accept(T object, int count);
|
|
||||||
}
|
|
||||||
|
|
||||||
- static record Data<T>(PalettedContainer.Configuration<T> configuration, BitStorage storage, Palette<T> palette) {
|
|
||||||
+ public record Data<T>(PalettedContainer.Configuration<T> configuration, BitStorage storage, Palette<T> palette) { // Plazma - package-private -> public
|
|
||||||
public void copyFrom(Palette<T> palette, BitStorage storage) {
|
|
||||||
for (int i = 0; i < storage.getSize(); i++) {
|
|
||||||
T object = palette.valueFor(storage.get(i));
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
index 688d9a2fe0ad0f176cd19a3ed7f2669fef2c962e..e22a7d4f2831b4d03b797cfb043a17c0d61b5f3b 100644
|
index 0346fd4ab7095d66c0eef5a440afbc7a8ba52466..35b589fa6d53cce957365e1cfcb5cf1978390546 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||||
@@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableObject;
|
@@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableObject;
|
||||||
@@ -108,7 +100,7 @@ index 688d9a2fe0ad0f176cd19a3ed7f2669fef2c962e..e22a7d4f2831b4d03b797cfb043a17c0
|
|||||||
@@ -270,6 +271,24 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
@@ -270,6 +271,24 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||||
int k = Mth.floorDiv(noisesettings.height(), noisesettings.getCellHeight());
|
int k = Mth.floorDiv(noisesettings.height(), noisesettings.getCellHeight());
|
||||||
|
|
||||||
return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(Util.wrapThreadWithTaskName("wgen_fill_noise", () -> {
|
return k <= 0 ? CompletableFuture.completedFuture(chunk) : CompletableFuture.supplyAsync(() -> {
|
||||||
+ // Plazma start - Optimize noise chunk generation
|
+ // Plazma start - Optimize noise chunk generation
|
||||||
+ if (PLAZMA_USE_NOISIUM) {
|
+ if (PLAZMA_USE_NOISIUM) {
|
||||||
+ int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
|
+ int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
|
||||||
@@ -130,34 +122,27 @@ index 688d9a2fe0ad0f176cd19a3ed7f2669fef2c962e..e22a7d4f2831b4d03b797cfb043a17c0
|
|||||||
int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
|
int l = chunk.getSectionIndex(k * noisesettings.getCellHeight() - 1 + i);
|
||||||
int i1 = chunk.getSectionIndex(i);
|
int i1 = chunk.getSectionIndex(i);
|
||||||
Set<LevelChunkSection> set = Sets.newHashSet();
|
Set<LevelChunkSection> set = Sets.newHashSet();
|
||||||
@@ -377,6 +396,25 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
@@ -377,6 +396,18 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||||
|
|
||||||
iblockdata = this.debugPreliminarySurfaceLevel(noisechunk, j4, j3, i5, iblockdata);
|
iblockdata = this.debugPreliminarySurfaceLevel(noisechunk, j4, j3, i5, iblockdata);
|
||||||
if (iblockdata != NoiseBasedChunkGenerator.AIR && !SharedConstants.debugVoidTerrain(chunk.getPos())) {
|
if (iblockdata != NoiseBasedChunkGenerator.AIR && !SharedConstants.debugVoidTerrain(chunk.getPos())) {
|
||||||
+ // Plazma start - Optimize noise
|
+ // Plazma start - Optimize noise
|
||||||
+ if (PLAZMA_USE_NOISIUM) {
|
+ if (PLAZMA_USE_NOISIUM) {
|
||||||
|
+ var id = chunksection.states.data.palette().idFor(iblockdata);
|
||||||
|
+ chunksection.states.data.storage().getAndSet(chunksection.states.strategy.getIndex(k4, k3, j5), id);
|
||||||
|
+
|
||||||
+ ++chunksection.nonEmptyBlockCount;
|
+ ++chunksection.nonEmptyBlockCount;
|
||||||
+ if (!iblockdata.getFluidState().isEmpty()) ++chunksection.tickingFluidCount;
|
+ if (iblockdata.isRandomlyTicking()) ++chunksection.tickingBlockCount;
|
||||||
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(iblockdata))
|
+ if (iblockdata.getFluidState().isRandomlyTicking()) ++chunksection.tickingFluidCount;
|
||||||
+ ++chunksection.specialCollidingBlocks;
|
+ if (ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isSpecialCollidingBlock(iblockdata)) ++chunksection.specialCollidingBlocks;
|
||||||
+
|
+ if (chunksection.isRandomlyTicking()) chunksection.tickingBlocks.add((short) (k4 | (k3 << 4) | (j5 << (4+4))));
|
||||||
+ if (!iblockdata.isRandomlyTicking()) {
|
|
||||||
+ ++chunksection.tickingBlockCount;
|
|
||||||
+ chunksection.tickingBlocks.remove(k4, k3, j5);
|
|
||||||
+ chunksection.tickingBlocks.add(k4, k3, j5, iblockdata);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ chunksection.states.data.storage().set(
|
|
||||||
+ chunksection.states.strategy.getIndex(k4, k3, j5),
|
|
||||||
+ chunksection.states.data.palette().idFor(iblockdata)
|
|
||||||
+ );
|
|
||||||
+ } else
|
+ } else
|
||||||
+ // Plazma end - Optimize noise
|
+ // Plazma end - Optimize noise
|
||||||
chunksection.setBlockState(k4, k3, j5, iblockdata, false);
|
chunksection.setBlockState(k4, k3, j5, iblockdata, false);
|
||||||
heightmap.update(k4, j3, j5, iblockdata);
|
heightmap.update(k4, j3, j5, iblockdata);
|
||||||
heightmap1.update(k4, j3, j5, iblockdata);
|
heightmap1.update(k4, j3, j5, iblockdata);
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
||||||
index 52fcf1b92854e5c67c51a83d31b4a136413b54e0..e8fbf1408102681fabb588c2bcc4a56df9b0152f 100644
|
index 932d1d9bd717b1176f8c82b0cf65d2eb6403ad40..a54a279cbaa30c58df572242ad5cf9786c715b66 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseSettings.java
|
||||||
@@ -8,7 +8,7 @@ import net.minecraft.core.QuartPos;
|
@@ -8,7 +8,7 @@ import net.minecraft.core.QuartPos;
|
||||||
@@ -192,26 +177,26 @@ index 52fcf1b92854e5c67c51a83d31b4a136413b54e0..e8fbf1408102681fabb588c2bcc4a56d
|
|||||||
|
|
||||||
public int getCellHeight() {
|
public int getCellHeight() {
|
||||||
- return QuartPos.toBlock(this.noiseSizeVertical());
|
- return QuartPos.toBlock(this.noiseSizeVertical());
|
||||||
+ return this.noiseSizeHorizontal; // Plazma - Optimize noise
|
+ return this.horizontalCellBlockCount; // Plazma - Optimize noise
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCellWidth() {
|
public int getCellWidth() {
|
||||||
- return QuartPos.toBlock(this.noiseSizeHorizontal());
|
- return QuartPos.toBlock(this.noiseSizeHorizontal());
|
||||||
+ return this.noiseSizeVertical; // Plazma - Optimize noise
|
+ return this.verticalCellBlockCount; // Plazma - Optimize noise
|
||||||
}
|
}
|
||||||
|
|
||||||
public NoiseSettings clampToHeightAccessor(LevelHeightAccessor world) {
|
public NoiseSettings clampToHeightAccessor(LevelHeightAccessor world) {
|
||||||
int i = Math.max(this.minY, world.getMinBuildHeight());
|
int i = Math.max(this.minY, world.getMinY());
|
||||||
int j = Math.min(this.minY + this.height, world.getMaxBuildHeight()) - i;
|
int j = Math.min(this.minY + this.height, world.getMaxY() + 1) - i;
|
||||||
- return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical);
|
- return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical);
|
||||||
+ return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical, QuartPos.toBlock(this.noiseSizeHorizontal), QuartPos.toBlock(this.noiseSizeVertical)); // Plazma - Optimize noise
|
+ return new NoiseSettings(i, j, this.noiseSizeHorizontal, this.noiseSizeVertical, QuartPos.toBlock(this.noiseSizeHorizontal), QuartPos.toBlock(this.noiseSizeVertical)); // Plazma - Optimize noise
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||||
index afdbc74a3012fa717f59ecef613567338d285b7b..89dbfdb315c02a15deae51b176fdd3e0d8b03496 100644
|
index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..584311a00c5037a6d5bc05b1261969aad1c38a4c 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
--- a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java
|
||||||
@@ -10,13 +10,15 @@ public record MaterialRuleList(List<NoiseChunk.BlockStateFiller> materialRuleLis
|
@@ -9,12 +9,15 @@ public record MaterialRuleList(NoiseChunk.BlockStateFiller[] materialRuleList) i
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public BlockState calculate(DensityFunction.FunctionContext pos) {
|
public BlockState calculate(DensityFunction.FunctionContext pos) {
|
||||||
@@ -221,22 +206,22 @@ index afdbc74a3012fa717f59ecef613567338d285b7b..89dbfdb315c02a15deae51b176fdd3e0
|
|||||||
- return blockState;
|
- return blockState;
|
||||||
- }
|
- }
|
||||||
+ // Plazma start - Optimize noise
|
+ // Plazma start - Optimize noise
|
||||||
+ for (int i = 0; i < this.materialRuleList.size(); i++) {
|
+ //noinspection ForLoopReplaceableByForEach
|
||||||
+ BlockState state = this.materialRuleList.get(i).calculate(pos);
|
+ for (int i = 0; i < this.materialRuleList.length; i++) {
|
||||||
|
+ BlockState state = this.materialRuleList[i].calculate(pos);
|
||||||
+ if (state == null) continue;
|
+ if (state == null) continue;
|
||||||
+
|
+
|
||||||
+ return state;
|
+ return state;
|
||||||
}
|
}
|
||||||
|
+ // Plazma end - Optimize noise
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
+ // Plazma end - Optimize noise
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 2f5b59ec72fff421e1bc254ebeba78647c7409fe..7ef541c5d8306ef66214e7150aca0fa53c14d12a 100644
|
index 81f7ac9753058aa72dea5704fc9859ba3b909fb1..dc632fe50e777c019705796602debc3a7f33152d 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -44,6 +44,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -55,6 +55,8 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
public WorldGeneration worldgen;
|
public WorldGeneration worldgen;
|
||||||
public class WorldGeneration extends ConfigurationPart {
|
public class WorldGeneration extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -245,7 +230,7 @@ index 2f5b59ec72fff421e1bc254ebeba78647c7409fe..7ef541c5d8306ef66214e7150aca0fa5
|
|||||||
public LavaSea lavaSea;
|
public LavaSea lavaSea;
|
||||||
public class LavaSea extends ConfigurationPart {
|
public class LavaSea extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -63,6 +65,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -74,6 +76,11 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1266
patches/server/0045-Reduce-allocations.patch
Normal file
1266
patches/server/0045-Reduce-allocations.patch
Normal file
File diff suppressed because it is too large
Load Diff
236
patches/server/0046-Hashed-rcon-password.patch
Normal file
236
patches/server/0046-Hashed-rcon-password.patch
Normal file
@@ -0,0 +1,236 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Tue, 5 Nov 2024 18:31:09 +0900
|
||||||
|
Subject: [PATCH] Hashed rcon password
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
|
index 3dd5c7441bb300ca17d717af37edbefb89db4b2f..df367fbb8c582614aaf2087aa37d5e47247af810 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
|
@@ -73,7 +73,6 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
|
public final int queryPort;
|
||||||
|
public final boolean enableRcon;
|
||||||
|
public final int rconPort;
|
||||||
|
- public final String rconPassword;
|
||||||
|
public final boolean hardcore;
|
||||||
|
public final boolean allowNether;
|
||||||
|
public final boolean spawnMonsters;
|
||||||
|
@@ -113,6 +112,25 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
|
|
||||||
|
public final String rconIp; // Paper - Configurable rcon ip
|
||||||
|
|
||||||
|
+ // Plazma start - hashed rcon password
|
||||||
|
+ private final boolean rconHash;
|
||||||
|
+ private final int rconHashIterationCount;
|
||||||
|
+ private final byte[] rconSalt;
|
||||||
|
+ private final String rconPassword;
|
||||||
|
+
|
||||||
|
+ private static final @Nullable javax.crypto.SecretKeyFactory HASH_INSTANCE;
|
||||||
|
+ static {
|
||||||
|
+ @Nullable javax.crypto.SecretKeyFactory factory;
|
||||||
|
+ try {
|
||||||
|
+ factory = javax.crypto.SecretKeyFactory.getInstance("PBKDF2WithHmacSHA512/256");
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ LOGGER.error("Failed to initialize rcon hash instance", e);
|
||||||
|
+ factory = null;
|
||||||
|
+ }
|
||||||
|
+ HASH_INSTANCE = factory;
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - hashed rcon password
|
||||||
|
+
|
||||||
|
// CraftBukkit start
|
||||||
|
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
|
||||||
|
super(properties, optionset);
|
||||||
|
@@ -126,7 +144,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
|
this.queryPort = this.get("query.port", 25565);
|
||||||
|
this.enableRcon = this.get("enable-rcon", false);
|
||||||
|
this.rconPort = this.get("rcon.port", 25575);
|
||||||
|
- this.rconPassword = this.get("rcon.password", "");
|
||||||
|
+ // this.rconPassword = this.get("rcon.password", ""); // Plazma - hashed rcon password
|
||||||
|
this.hardcore = this.get("hardcore", false);
|
||||||
|
this.allowNether = this.get("allow-nether", true);
|
||||||
|
this.spawnMonsters = this.get("spawn-monsters", true);
|
||||||
|
@@ -179,7 +197,82 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
|
final String rconIp = this.getStringRaw("rcon.ip");
|
||||||
|
this.rconIp = rconIp == null ? this.serverIp : rconIp;
|
||||||
|
// Paper end - Configurable rcon ip
|
||||||
|
+
|
||||||
|
+ // Plazma start - hashed rcon password
|
||||||
|
+ this.rconHash = this.get("rcon.hash", false);
|
||||||
|
+ this.rconHashIterationCount = this.get("rcon.hash.iteration-count", Character.MAX_VALUE);
|
||||||
|
+ this.rconSalt = this.rconSalt();
|
||||||
|
+ this.rconPassword = this.rconPassword();
|
||||||
|
+ // Plazma end - hashed rcon password
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Plazma start - hashed rcon password
|
||||||
|
+ private byte[] rconSalt() {
|
||||||
|
+ if (!this.rconHash) return org.plazmamc.plazma.constants.Null.BYTE;
|
||||||
|
+
|
||||||
|
+ String salt = this.get("rcon.hash.salt", "");
|
||||||
|
+ if (!salt.isBlank()) {
|
||||||
|
+ try {
|
||||||
|
+ return java.util.HexFormat.of().parseHex(salt);
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ LOGGER.error("Invalid RCON salt detected! RCON will be disabled");
|
||||||
|
+ return org.plazmamc.plazma.constants.Null.BYTE;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ byte[] newSalt = new byte[16];
|
||||||
|
+ (new java.security.SecureRandom()).nextBytes(newSalt);
|
||||||
|
+ salt = java.util.HexFormat.of().formatHex(newSalt);
|
||||||
|
+ this.set("rcon.hash.salt", salt);
|
||||||
|
+ return newSalt;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private String rconPassword() {
|
||||||
|
+ String hashed = this.get("rcon.hash.password", "");
|
||||||
|
+ if (!hashed.isBlank()) {
|
||||||
|
+ try {
|
||||||
|
+ java.util.HexFormat.of().parseHex(hashed);
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ LOGGER.error("Invalid hashed RCON password detected! RCON will be disabled");
|
||||||
|
+ return "";
|
||||||
|
+ }
|
||||||
|
+ return hashed;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ String decoded = this.get("rcon.password", "");
|
||||||
|
+ if (decoded.isBlank() || HASH_INSTANCE == null || this.rconSalt.length == 0) return decoded;
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ final java.security.spec.KeySpec spec = new javax.crypto.spec.PBEKeySpec(decoded.toCharArray(), this.rconSalt, this.rconHashIterationCount, 256);
|
||||||
|
+ byte[] hashedByte = HASH_INSTANCE.generateSecret(spec).getEncoded();
|
||||||
|
+ hashed = java.util.HexFormat.of().formatHex(hashedByte);
|
||||||
|
+ this.set("rcon.hash.password", hashed);
|
||||||
|
+ this.remove("rcon.password");
|
||||||
|
+ return hashed;
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ LOGGER.error("Failed to encode rcon password", e);
|
||||||
|
+ return "";
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Boolean shouldStartRCON() {
|
||||||
|
+ return this.enableRcon && !this.rconPassword.isBlank();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Boolean matchRconPassword(String value) {
|
||||||
|
+ if (this.rconSalt.length == 0 || HASH_INSTANCE == null) return this.rconPassword.equals(value);
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ final java.security.spec.KeySpec spec = new javax.crypto.spec.PBEKeySpec(value.toCharArray(), this.rconSalt, this.rconHashIterationCount, 256);
|
||||||
|
+ byte[] hashedByte = HASH_INSTANCE.generateSecret(spec).getEncoded();
|
||||||
|
+ String hashed = java.util.HexFormat.of().formatHex(hashedByte);
|
||||||
|
+ return this.rconPassword.equals(hashed);
|
||||||
|
+ } catch (Exception e) {
|
||||||
|
+ LOGGER.error("Failed to validate rcon password", e);
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
+ // Plazma end - hashed rcon password
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
public static DedicatedServerProperties fromFile(Path path, OptionSet optionset) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
|
||||||
|
index d7bd235ef2815890e038091dd625177049d253a5..afced52731868d5726b85a03011111adeffeb074 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/dedicated/Settings.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
|
||||||
|
@@ -243,6 +243,11 @@ public abstract class Settings<T extends Settings<T>> {
|
||||||
|
return v1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Plazma start - Settings helper
|
||||||
|
+ protected <V> void set(String key, V value) { this.properties.put(key, value); }
|
||||||
|
+ protected void remove(String key) { this.properties.remove(key); }
|
||||||
|
+ // Plazma end - Settings helper
|
||||||
|
+
|
||||||
|
protected <V> Settings<T>.MutableValue<V> getMutable(String key, Function<String, V> parser, Function<V, String> stringifier, V fallback) {
|
||||||
|
String s1 = this.getStringRaw(key);
|
||||||
|
V v1 = MoreObjects.firstNonNull(s1 != null ? parser.apply(s1) : null, fallback);
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconClient.java b/src/main/java/net/minecraft/server/rcon/thread/RconClient.java
|
||||||
|
index 1c3775c6d29a85803c87948c64ec81cbeb87aef4..4f6f46398ac0814a95d8253cc5f575b8f09f7209 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/rcon/thread/RconClient.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/rcon/thread/RconClient.java
|
||||||
|
@@ -26,13 +26,12 @@ public class RconClient extends GenericThread {
|
||||||
|
private boolean authed;
|
||||||
|
private final Socket client;
|
||||||
|
private final byte[] buf = new byte[1460];
|
||||||
|
- private final String rconPassword;
|
||||||
|
// CraftBukkit start
|
||||||
|
private final DedicatedServer serverInterface;
|
||||||
|
private final RconConsoleSource rconConsoleSource;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
- RconClient(ServerInterface server, String password, Socket socket) {
|
||||||
|
+ RconClient(ServerInterface server, Socket socket) {// Plazma - hashed rcon password
|
||||||
|
super("RCON Client " + String.valueOf(socket.getInetAddress()));
|
||||||
|
this.serverInterface = (DedicatedServer) server; // CraftBukkit
|
||||||
|
this.client = socket;
|
||||||
|
@@ -43,7 +42,6 @@ public class RconClient extends GenericThread {
|
||||||
|
this.running = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- this.rconPassword = password;
|
||||||
|
this.rconConsoleSource = new net.minecraft.server.rcon.RconConsoleSource(this.serverInterface, socket.getRemoteSocketAddress()); // CraftBukkit
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -93,7 +91,7 @@ public class RconClient extends GenericThread {
|
||||||
|
String s1 = PktUtils.stringFromByteArray(this.buf, j, i);
|
||||||
|
int j1 = j + s1.length();
|
||||||
|
|
||||||
|
- if (!s1.isEmpty() && s1.equals(this.rconPassword)) {
|
||||||
|
+ if (!s1.isEmpty() && serverInterface.getProperties().matchRconPassword(s1)) {
|
||||||
|
this.authed = true;
|
||||||
|
this.send(l, 2, "");
|
||||||
|
continue;
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
|
||||||
|
index c12d7db2b048a327c0e8f398848cd3a9bce0ebce..150cecc44a7f49740fa400e02de09671ff8b392a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
|
||||||
|
@@ -16,15 +16,13 @@ import org.slf4j.Logger;
|
||||||
|
public class RconThread extends GenericThread {
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
private final ServerSocket socket;
|
||||||
|
- private final String rconPassword;
|
||||||
|
private final List<RconClient> clients = Lists.newArrayList();
|
||||||
|
private final ServerInterface serverInterface;
|
||||||
|
|
||||||
|
- private RconThread(ServerInterface server, ServerSocket listener, String password) {
|
||||||
|
+ private RconThread(ServerInterface server, ServerSocket listener) {// Plazma - hashed rcon password
|
||||||
|
super("RCON Listener");
|
||||||
|
this.serverInterface = server;
|
||||||
|
this.socket = listener;
|
||||||
|
- this.rconPassword = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearClients() {
|
||||||
|
@@ -37,7 +35,7 @@ public class RconThread extends GenericThread {
|
||||||
|
while (this.running) {
|
||||||
|
try {
|
||||||
|
Socket socket = this.socket.accept();
|
||||||
|
- RconClient rconClient = new RconClient(this.serverInterface, this.rconPassword, socket);
|
||||||
|
+ RconClient rconClient = new RconClient(this.serverInterface, socket); // Plazma - hashed rcon password
|
||||||
|
rconClient.start();
|
||||||
|
this.clients.add(rconClient);
|
||||||
|
this.clearClients();
|
||||||
|
@@ -64,15 +62,14 @@ public class RconThread extends GenericThread {
|
||||||
|
|
||||||
|
int i = dedicatedServerProperties.rconPort;
|
||||||
|
if (0 < i && 65535 >= i) {
|
||||||
|
- String string2 = dedicatedServerProperties.rconPassword;
|
||||||
|
- if (string2.isEmpty()) {
|
||||||
|
+ if (!dedicatedServerProperties.shouldStartRCON()) { // Plazma - hashed rcon password
|
||||||
|
LOGGER.warn("No rcon password set in server.properties, rcon disabled!");
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
ServerSocket serverSocket = new ServerSocket(i, 0, InetAddress.getByName(string));
|
||||||
|
serverSocket.setSoTimeout(500);
|
||||||
|
- RconThread rconThread = new RconThread(server, serverSocket, string2);
|
||||||
|
+ RconThread rconThread = new RconThread(server, serverSocket); // Plazma - hashed rcon password
|
||||||
|
if (!rconThread.start()) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
138
patches/server/0047-Add-option-to-allow-shoot-fireball.patch
Normal file
138
patches/server/0047-Add-option-to-allow-shoot-fireball.patch
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 11:14:49 +0900
|
||||||
|
Subject: [PATCH] Add option to allow shoot fireball
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/FireChargeItem.java b/src/main/java/net/minecraft/world/item/FireChargeItem.java
|
||||||
|
index 641eb27097740219199ce61ed3e6aa5f42a51b1c..f51be1746fc649d636bc9e3ae451d18e35a04026 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/FireChargeItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/FireChargeItem.java
|
||||||
|
@@ -30,6 +30,58 @@ public class FireChargeItem extends Item implements ProjectileItem {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Plazma start - Option to shoot fireballs
|
||||||
|
+ @Override
|
||||||
|
+ public InteractionResult use(Level world, Player user, net.minecraft.world.InteractionHand hand) {
|
||||||
|
+ if (!(world instanceof net.minecraft.server.level.ServerLevel level) || !world.plazmaConfig().item.shootableFireCharge.enabled) {
|
||||||
|
+ super.use(world, user, hand);
|
||||||
|
+ return InteractionResult.PASS;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Vec3 vec = user.getDirection().getUnitVec3().multiply(10, 10, 10);
|
||||||
|
+ net.minecraft.world.entity.projectile.AbstractHurtingProjectile fireball = switch(world.plazmaConfig().item.shootableFireCharge.shootType) {
|
||||||
|
+ case SMALL_FIREBALL -> new SmallFireball(world, user, vec);
|
||||||
|
+ case LARGE_FIREBALL -> new net.minecraft.world.entity.projectile.LargeFireball(world, user, vec, world.plazmaConfig().item.shootableFireCharge.explosionPower);
|
||||||
|
+ case DRAGON_FIREBALL -> new net.minecraft.world.entity.projectile.DragonFireball(world, user, vec);
|
||||||
|
+ case WITHER_SKULL -> new net.minecraft.world.entity.projectile.WitherSkull(world, user, vec);
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ ItemStack itemStack = user.getItemInHand(hand);
|
||||||
|
+ net.minecraft.world.entity.projectile.Projectile.Delayed<net.minecraft.world.entity.projectile.AbstractHurtingProjectile> delayed;
|
||||||
|
+ delayed = net.minecraft.world.entity.projectile.Projectile.spawnProjectileDelayed(
|
||||||
|
+ fireball,
|
||||||
|
+ level,
|
||||||
|
+ itemStack,
|
||||||
|
+ projectile -> {
|
||||||
|
+ projectile.setPos(user.getX(), user.getEyeY() - 0.10000000149011612D, user.getZ());
|
||||||
|
+ projectile.shootFromRotation(user, user.getXRot(), user.getYRot(), world.plazmaConfig().item.shootableFireCharge.shootRoll, world.plazmaConfig().item.shootableFireCharge.shootPower, world.plazmaConfig().item.shootableFireCharge.shootOffset);
|
||||||
|
+ if (!(projectile instanceof net.minecraft.world.entity.projectile.Fireball ball)) return;
|
||||||
|
+ ball.setItem(itemStack);
|
||||||
|
+ }
|
||||||
|
+ );
|
||||||
|
+
|
||||||
|
+ com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event;
|
||||||
|
+ event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent(
|
||||||
|
+ (org.bukkit.entity.Player) user.getBukkitEntity(),
|
||||||
|
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack),
|
||||||
|
+ (org.bukkit.entity.Projectile) delayed.projectile().getBukkitEntity()
|
||||||
|
+ );
|
||||||
|
+
|
||||||
|
+ if (event.callEvent() && delayed.attemptSpawn(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.FIRE_CHARGE)) {
|
||||||
|
+ user.awardStat(net.minecraft.stats.Stats.ITEM_USED.get(this));
|
||||||
|
+
|
||||||
|
+ if (event.shouldConsume()) itemStack.consume(1, user);
|
||||||
|
+ else if (user instanceof net.minecraft.server.level.ServerPlayer) ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
|
||||||
|
+
|
||||||
|
+ world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.FIRECHARGE_USE, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||||
|
+ return InteractionResult.SUCCESS;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (user instanceof net.minecraft.server.level.ServerPlayer) ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory();
|
||||||
|
+ return InteractionResult.FAIL;
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Option to shoot fireballs
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public InteractionResult useOn(UseOnContext context) {
|
||||||
|
Level world = context.getLevel();
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/Items.java b/src/main/java/net/minecraft/world/item/Items.java
|
||||||
|
index 580bd63fdbf9555f867362d3c1f39f41fd750089..bfde7c2d386d94913bde5452b903f2f2ee7ac672 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/Items.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/Items.java
|
||||||
|
@@ -1698,7 +1698,7 @@ public class Items {
|
||||||
|
ExperienceBottleItem::new,
|
||||||
|
new Item.Properties().rarity(Rarity.UNCOMMON).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, true)
|
||||||
|
);
|
||||||
|
- public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new);
|
||||||
|
+ public static final Item FIRE_CHARGE = registerItem("fire_charge", FireChargeItem::new, new Item.Properties().useCooldown(org.plazmamc.plazma.configurations.GlobalConfiguration.get().item.fireCharge.cooldown()));
|
||||||
|
public static final Item WIND_CHARGE = registerItem("wind_charge", WindChargeItem::new, new Item.Properties().useCooldown(0.5F));
|
||||||
|
public static final Item WRITABLE_BOOK = registerItem(
|
||||||
|
"writable_book", WritableBookItem::new, new Item.Properties().stacksTo(1).component(DataComponents.WRITABLE_BOOK_CONTENT, WritableBookContent.EMPTY)
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
index dc632fe50e777c019705796602debc3a7f33152d..3c917e2a7fe8e5ff1ac91ddba29c717952a15d57 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -156,7 +156,6 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
public ConsoleLogs consoleLogs;
|
||||||
|
public class ConsoleLogs extends ConfigurationPart {
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
|
||||||
|
index ac0f038de0ce5cf6df0b730af69d3229c3119eff..ba3331a81002304187318ed32fec2dd31e4c23ee 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/RemovedConfigurations.java
|
||||||
|
@@ -7,7 +7,8 @@ import static org.spongepowered.configurate.NodePath.path;
|
||||||
|
interface RemovedConfigurations {
|
||||||
|
|
||||||
|
NodePath[] WORLD_PATHS = {
|
||||||
|
- path("structure", "nether-portal")
|
||||||
|
+ path("structure", "nether-portal"),
|
||||||
|
+ path("item", "allow-shoot-fireballs")
|
||||||
|
};
|
||||||
|
|
||||||
|
NodePath[] GLOBAL_PATHS = {
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
index c1d4a96cf5be77f4460c54ed19622f527d42ca06..bbb51ccf2016987202811ee893f855da2612dd17 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
@@ -86,6 +86,25 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
public Item item;
|
||||||
|
public class Item extends ConfigurationPart {
|
||||||
|
|
||||||
|
+ public ShootableFireCharge shootableFireCharge;
|
||||||
|
+ public class ShootableFireCharge extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ public boolean enabled = false;
|
||||||
|
+ public ShootType shootType = ShootType.SMALL_FIREBALL;
|
||||||
|
+ public int explosionPower = 1;
|
||||||
|
+
|
||||||
|
+ public float shootRoll = 0.0f;
|
||||||
|
+ public float shootPower = 1.5f;
|
||||||
|
+ public float shootOffset = 1.0f;
|
||||||
|
+
|
||||||
|
+ public enum ShootType {
|
||||||
|
+ SMALL_FIREBALL,
|
||||||
|
+ LARGE_FIREBALL,
|
||||||
|
+ DRAGON_FIREBALL,
|
||||||
|
+ WITHER_SKULL
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
2922
patches/server/0049-Completely-remove-Mojang-profiler.patch
Normal file
2922
patches/server/0049-Completely-remove-Mojang-profiler.patch
Normal file
File diff suppressed because it is too large
Load Diff
117
patches/server/0050-Port-minor-SparklyPaper-patches.patch
Normal file
117
patches/server/0050-Port-minor-SparklyPaper-patches.patch
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 21:10:27 +0900
|
||||||
|
Subject: [PATCH] Port minor SparklyPaper patches
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
|
index c14ce846afb7364e541bfe01b73a06a94e48f55b..3b11cc112e98cea1067ecdfe20d894f8ba753b93 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
|
@@ -58,6 +58,7 @@ import org.bukkit.event.player.PlayerVelocityEvent;
|
||||||
|
|
||||||
|
public class ServerEntity {
|
||||||
|
|
||||||
|
+ public static boolean PLAZMA_DISTANCE_SQR = false; // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same
|
||||||
|
private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
private static final int TOLERANCE_LEVEL_ROTATION = 1;
|
||||||
|
private static final double TOLERANCE_LEVEL_POSITION = 7.62939453125E-6D;
|
||||||
|
@@ -232,6 +233,7 @@ public class ServerEntity {
|
||||||
|
|
||||||
|
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||||
|
Vec3 vec3d1 = this.entity.getDeltaMovement();
|
||||||
|
+ if (PLAZMA_DISTANCE_SQR || vec3d1 != this.lastSentMovement) { // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same
|
||||||
|
double d0 = vec3d1.distanceToSqr(this.lastSentMovement);
|
||||||
|
|
||||||
|
if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) {
|
||||||
|
@@ -246,6 +248,7 @@ public class ServerEntity {
|
||||||
|
this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ } // Plazma - Port Minor SparklyPaper patches; Skip distanceToSqr if the delta is the same
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet1 != null) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||||
|
index da7e1a69ecb4e6b3be2d8544ac406aa519bd196e..ce56fdd0bbe1c95146c88594c68a6a399f01218e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||||
|
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||||
|
@@ -90,12 +90,14 @@ public class ServerStatsCounter extends StatsCounter {
|
||||||
|
this.dirty.add(stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* // Plazma - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
|
||||||
|
private Set<Stat<?>> getDirty() {
|
||||||
|
Set<Stat<?>> set = Sets.newHashSet(this.dirty);
|
||||||
|
|
||||||
|
this.dirty.clear();
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
+ */ // Plazma - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
|
||||||
|
|
||||||
|
public void parseLocal(DataFixer dataFixer, String json) {
|
||||||
|
try {
|
||||||
|
@@ -242,14 +244,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendStats(ServerPlayer player) {
|
||||||
|
- Object2IntMap<Stat<?>> object2intmap = new Object2IntOpenHashMap();
|
||||||
|
- Iterator iterator = this.getDirty().iterator();
|
||||||
|
+ // Plazma start - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
|
||||||
|
+ Object2IntMap<Stat<?>> object2intmap = new Object2IntOpenHashMap<>();
|
||||||
|
+ for (final Stat<?> stat : this.dirty) object2intmap.put(stat, this.getValue(stat));
|
||||||
|
|
||||||
|
- while (iterator.hasNext()) {
|
||||||
|
- Stat<?> statistic = (Stat) iterator.next();
|
||||||
|
-
|
||||||
|
- object2intmap.put(statistic, this.getValue(statistic));
|
||||||
|
- }
|
||||||
|
+ this.dirty.clear();
|
||||||
|
+ // Plazma end - Port Minor SparklyPaper patches; Skip dirty stats copy when requesting player stats
|
||||||
|
|
||||||
|
player.connection.send(new ClientboundAwardStatsPacket(object2intmap));
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
|
index 8c455ac7dcb126e2b2932eba980454513947fac2..ecf9153b0eadb264d79fe9a809918bb13cd6d4b8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
|
@@ -276,7 +276,12 @@ public class MapItem extends Item {
|
||||||
|
mapItemSavedData.tickCarriedBy(player, stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!mapItemSavedData.locked && (selected || entity instanceof Player && ((Player)entity).getOffhandItem() == stack)) {
|
||||||
|
+ // Plazma start - Port Minor SparklyPaper patches; Skip map update if the craft renderer is null
|
||||||
|
+ if (!mapItemSavedData.locked
|
||||||
|
+ && (!world.plazmaConfig().item.skipMapUpdateIfCraftRenderIsNull || mapItemSavedData.mapView.getRenderers().stream().anyMatch(renderer -> renderer instanceof org.bukkit.craftbukkit.map.CraftMapRenderer))
|
||||||
|
+ && (selected || entity instanceof Player player && player.getOffhandItem() == stack)
|
||||||
|
+ ) {
|
||||||
|
+ // Plazma end - Port Minor SparklyPaper patches; Skip map update if the craft renderer is null
|
||||||
|
this.update(world, entity, mapItemSavedData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
|
||||||
|
index 8149b9c51b78eb5c689b7218a2ca3aab60e73bcf..125a4f13dbe98976c4cf94bb523463a51bd4f8dd 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapColorCache.java
|
||||||
|
@@ -145,7 +145,7 @@ public class CraftMapColorCache implements MapPalette.MapColorCache {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
- public boolean isCached() {
|
||||||
|
+ public synchronized boolean isCached() { // Plazma - Port Minor SparklyPaper patches; Fix concurrency issues when using "imageToBytes" in multiple threads
|
||||||
|
return this.cached || (!this.running.get() && this.initCache().isDone());
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
index bbb51ccf2016987202811ee893f855da2612dd17..f6f372644bca9111aa3f45bf7ae8e66e53d11505 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
@@ -86,6 +86,8 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
public Item item;
|
||||||
|
public class Item extends ConfigurationPart {
|
||||||
|
|
||||||
|
+ public boolean skipMapUpdateIfCraftRenderIsNull = true;
|
||||||
|
+
|
||||||
|
public ShootableFireCharge shootableFireCharge;
|
||||||
|
public class ShootableFireCharge extends ConfigurationPart {
|
||||||
|
|
||||||
@@ -0,0 +1,317 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 21:00:07 +0900
|
||||||
|
Subject: [PATCH] SparklyPaper - Optimize framed map tracker ticking
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
|
index 3b11cc112e98cea1067ecdfe20d894f8ba753b93..f33e7f7fdee160b7397b1156c179a5c95816307a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||||
|
@@ -129,33 +129,31 @@ public class ServerEntity {
|
||||||
|
|
||||||
|
Entity entity = this.entity;
|
||||||
|
|
||||||
|
- if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame entityitemframe) { // Paper - Perf: Only tick item frames if players can see it
|
||||||
|
- if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
|
||||||
|
- ItemStack itemstack = entityitemframe.getItem();
|
||||||
|
-
|
||||||
|
- if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
|
||||||
|
- MapId mapid = entityitemframe.cachedMapId; // Paper - Perf: Cache map ids on item frames
|
||||||
|
- MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level);
|
||||||
|
-
|
||||||
|
- if (worldmap != null) {
|
||||||
|
- Iterator<ServerPlayerConnection> iterator = this.trackedPlayers.iterator(); // CraftBukkit
|
||||||
|
-
|
||||||
|
- while (iterator.hasNext()) {
|
||||||
|
- ServerPlayer entityplayer = iterator.next().getPlayer(); // CraftBukkit
|
||||||
|
-
|
||||||
|
- worldmap.tickCarriedBy(entityplayer, itemstack);
|
||||||
|
- Packet<?> packet = worldmap.getUpdatePacket(mapid, entityplayer);
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking
|
||||||
|
+ if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame frame && frame.cachedMapId != null) { // Paper - Perf: Only tick item frames if players can see it
|
||||||
|
+ if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable
|
||||||
|
+ MapId id = frame.cachedMapId; // Paper - Perf: Cache map ids on item frames
|
||||||
|
+ MapItemSavedData data = MapItem.getSavedData(id, this.level);
|
||||||
|
+
|
||||||
|
+ if (data != null) for (final ServerPlayerConnection trackedPlayer : this.trackedPlayers) {
|
||||||
|
+ if (!data.hasContextualRenderer) {
|
||||||
|
+ // Pass in a "random" player when a non-contextual plugin renderer is added to make sure it is called
|
||||||
|
+ final Packet<?> updatePacket = data.framedUpdatePacket(id, data.hasPluginRenderer ? com.google.common.collect.Iterables.getFirst(this.trackedPlayers, null).getPlayer() : null);
|
||||||
|
+
|
||||||
|
+ if (updatePacket != null)
|
||||||
|
+ for (ServerPlayerConnection connection : this.trackedPlayers) connection.send(updatePacket);
|
||||||
|
+ } else {
|
||||||
|
+ ServerPlayer player = trackedPlayer.getPlayer(); // CraftBukkit
|
||||||
|
+ Packet<?> packet = data.getUpdatePacket(id, player);
|
||||||
|
|
||||||
|
- if (packet != null) {
|
||||||
|
- entityplayer.connection.send(packet);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ if (packet != null) player.connection.send(packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- this.sendDirtyEntityData();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ this.sendDirtyEntityData();
|
||||||
|
}
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking
|
||||||
|
|
||||||
|
if (this.forceStateResync || this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) { // Paper - fix desync when a player is added to the tracker
|
||||||
|
byte b0 = Mth.packDegrees(this.entity.getYRot());
|
||||||
|
@@ -426,6 +424,16 @@ public class ServerEntity {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Plazma start - Optimize framed map tracker adding
|
||||||
|
+ if (this.entity instanceof ItemFrame frame && frame.cachedMapId != null) {
|
||||||
|
+ MapItemSavedData mapData = MapItem.getSavedData(frame.cachedMapId, this.level);
|
||||||
|
+ if (mapData == null) return;
|
||||||
|
+
|
||||||
|
+ mapData.addFrameDecoration(frame);
|
||||||
|
+ final Packet<?> mapPacket = mapData.fullUpdatePacket(frame.cachedMapId, mapData.hasPluginRenderer ? player : null);
|
||||||
|
+ if (mapPacket != null) sender.accept((Packet<ClientGamePacketListener>) mapPacket);
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Optimize framed map tracker adding
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vec3 getPositionBase() {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
|
index 27f7a0abf77e94f15ff5f42e54e979377c94e63c..d1b8edccf3d7418a4aceba8491491b3a339b645a 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
|
||||||
|
@@ -175,6 +175,16 @@ public class ItemFrame extends HangingEntity {
|
||||||
|
this.setItem(ItemStack.fromBukkitCopy(event.getItemStack()), false);
|
||||||
|
}
|
||||||
|
// Paper end - Add PlayerItemFrameChangeEvent
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking
|
||||||
|
+ final ItemStack item = this.getItem();
|
||||||
|
+ if (item.is(Items.FILLED_MAP)) {
|
||||||
|
+ final MapItemSavedData data = MapItem.getSavedData(item, this.level());
|
||||||
|
+ if (data != null) {
|
||||||
|
+ data.addFrameDecoration(this);
|
||||||
|
+ data.markAllDirty();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking
|
||||||
|
this.dropItem(world, source.getEntity(), false);
|
||||||
|
this.gameEvent(GameEvent.BLOCK_CHANGE, source.getEntity());
|
||||||
|
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
index 71aa3b9c5604f832e764e0d7a93da467ffe7dee1..e1440d1fc32229867e1f1543961fdfcec99a36fd 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
|
@@ -80,12 +80,22 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap();
|
||||||
|
private final Map<String, MapFrame> frameMarkers = Maps.newHashMap();
|
||||||
|
private int trackedDecorationCount;
|
||||||
|
- private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
|
||||||
|
+ private final org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper // Plazma - Improve code styling
|
||||||
|
public boolean isExplorerMap; // Purpur
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking; Shared between all players tracking this map inside an item frame
|
||||||
|
+ public boolean dirtyColorData;
|
||||||
|
+ public int minDirtyX;
|
||||||
|
+ public int minDirtyY;
|
||||||
|
+ public int maxDirtyX;
|
||||||
|
+ public int maxDirtyY;
|
||||||
|
+ public boolean dirtyFrameDecorations;
|
||||||
|
+ public boolean hasPluginRenderer;
|
||||||
|
+ public boolean hasContextualRenderer;
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking; Shared between all players tracking this map inside an item frame
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
public final CraftMapView mapView;
|
||||||
|
- private CraftServer server;
|
||||||
|
+ private final CraftServer server; // Plazma - Improve code styling
|
||||||
|
public UUID uniqueId = null;
|
||||||
|
public MapId id;
|
||||||
|
// CraftBukkit end
|
||||||
|
@@ -372,7 +382,7 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
--this.trackedDecorationCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (mapicon != null) this.setDecorationsDirty(); // Paper - only mark dirty if a change occurs
|
||||||
|
+ if (mapicon != null && mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder<MapDecorationType> decorationType) {
|
||||||
|
@@ -409,6 +419,7 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setDecorationsDirty();
|
||||||
|
+ if (mapicon.renderOnFrame()) this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -480,14 +491,23 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
|
||||||
|
public void setColorsDirty(int x, int z) {
|
||||||
|
this.setDirty();
|
||||||
|
- Iterator iterator = this.carriedBy.iterator();
|
||||||
|
-
|
||||||
|
- while (iterator.hasNext()) {
|
||||||
|
- MapItemSavedData.HoldingPlayer worldmap_worldmaphumantracker = (MapItemSavedData.HoldingPlayer) iterator.next();
|
||||||
|
-
|
||||||
|
- worldmap_worldmaphumantracker.markColorsDirty(x, z);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking
|
||||||
|
+ if (this.dirtyColorData) {
|
||||||
|
+ this.minDirtyX = Math.min(this.minDirtyX, x);
|
||||||
|
+ this.minDirtyY = Math.min(this.minDirtyY, z);
|
||||||
|
+ this.maxDirtyX = Math.max(this.maxDirtyX, x);
|
||||||
|
+ this.maxDirtyY = Math.max(this.maxDirtyY, z);
|
||||||
|
+ } else {
|
||||||
|
+ this.dirtyColorData = true;
|
||||||
|
+ this.minDirtyX = x;
|
||||||
|
+ this.minDirtyY = z;
|
||||||
|
+ this.maxDirtyX = x;
|
||||||
|
+ this.maxDirtyY = z;
|
||||||
|
+ } // diff on change
|
||||||
|
+ for (final HoldingPlayer tracker : this.carriedBy) {
|
||||||
|
+ tracker.markColorsDirty(x, z);
|
||||||
|
+ } // diff on change
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDecorationsDirty() {
|
||||||
|
@@ -563,6 +583,7 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
this.removeDecoration(MapItemSavedData.getFrameKey(id));
|
||||||
|
this.frameMarkers.remove(MapFrame.frameId(pos));
|
||||||
|
this.setDirty();
|
||||||
|
+ this.dirtyFrameDecorations = true; // Plazma - Optimize framed map tracker ticking
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateColor(int x, int z, byte color) {
|
||||||
|
@@ -776,4 +797,86 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking
|
||||||
|
+ public final @Nullable Packet<?> framedUpdatePacket(MapId id, @Nullable Player player) {
|
||||||
|
+ return createUpdatePacket(id, player, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public final @Nullable Packet<?> fullUpdatePacket(MapId id, @Nullable Player player) {
|
||||||
|
+ return createUpdatePacket(id, player, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public final @Nullable Packet<?> createUpdatePacket(MapId id, @Nullable Player player, boolean full) {
|
||||||
|
+ if (!dirtyColorData && !dirtyFrameDecorations && (player == null || server.getCurrentTick() % 5 != 0) && !full)
|
||||||
|
+ // Periodically send update packets if a renderer is added
|
||||||
|
+ return null;
|
||||||
|
+
|
||||||
|
+ final org.bukkit.craftbukkit.map.RenderData render = player != null
|
||||||
|
+ ? this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) player.getBukkitEntity())
|
||||||
|
+ : this.vanillaRender;
|
||||||
|
+
|
||||||
|
+ final MapPatch patch;
|
||||||
|
+ if (full) {
|
||||||
|
+ patch = createPatch(render.buffer, 0, 0, 127, 127);
|
||||||
|
+ } else if (dirtyColorData) {
|
||||||
|
+ dirtyColorData = false;
|
||||||
|
+ patch = createPatch(render.buffer, this.minDirtyX, this.minDirtyY, this.maxDirtyX, this.maxDirtyY);
|
||||||
|
+ } else {
|
||||||
|
+ patch = null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Collection<MapDecoration> decorations = null;
|
||||||
|
+ if (dirtyFrameDecorations || full || hasPluginRenderer) { // Always add decorations when a plugin renderer is added
|
||||||
|
+ dirtyFrameDecorations = false;
|
||||||
|
+ decorations = new java.util.ArrayList<>();
|
||||||
|
+
|
||||||
|
+ if (player == null) {
|
||||||
|
+ // Using the vanilla renderer, add in vanilla decorations
|
||||||
|
+ for (MapDecoration decoration : this.decorations.values()) {
|
||||||
|
+ // Skip sending decorations that are not rendered, i.e., player decorations.
|
||||||
|
+ // Skipping player decorations also allows sending the same update packet to all tracking players, the only issue
|
||||||
|
+ // being that it causes a slight flicker of the player decoration for anyone holding and looking at the map.
|
||||||
|
+ if (decoration.renderOnFrame()) decorations.add(decoration);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (final org.bukkit.map.MapCursor cursor : render.cursors) {
|
||||||
|
+ if (cursor.isVisible()) continue;
|
||||||
|
+ decorations.add(new MapDecoration(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), Optional.ofNullable(PaperAdventure.asVanilla(cursor.caption()))));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return new ClientboundMapItemDataPacket(id, this.scale, this.locked, decorations, patch);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private MapPatch createPatch(byte[] buffer, int minDirtyX, int minDirtyY, int maxDirtyX, int maxDirtyY) {
|
||||||
|
+ int xL = maxDirtyX + 1 - minDirtyX;
|
||||||
|
+ int yL = maxDirtyY + 1 - minDirtyY;
|
||||||
|
+ byte[] bytes = new byte[xL * yL];
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < xL; ++i) for (int j = 0; j < yL; ++j)
|
||||||
|
+ bytes[i + j * xL] = buffer[minDirtyX + i + (minDirtyY + j) * 128];
|
||||||
|
+
|
||||||
|
+ return new MapItemSavedData.MapPatch(minDirtyX, minDirtyY, xL, yL, bytes);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void addFrameDecoration(net.minecraft.world.entity.decoration.ItemFrame frame) {
|
||||||
|
+ if (this.trackedDecorationCount >= frame.level().paperConfig().maps.itemFrameCursorLimit || this.frameMarkers.containsKey(MapFrame.frameId(frame.getPos())))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ MapFrame mapFrame = new MapFrame(frame.getPos(), frame.getDirection().get2DDataValue() * 90, frame.getId());
|
||||||
|
+ this.addDecoration(MapDecorationTypes.FRAME, frame.level(), "frame-" + frame.getId(), frame.getPos().getX(), frame.getPos().getZ(), mapFrame.getRotation(), null);
|
||||||
|
+ this.frameMarkers.put(mapFrame.getId(), mapFrame);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void markAllDirty() {
|
||||||
|
+ this.dirtyColorData = true;
|
||||||
|
+ this.minDirtyX = 0;
|
||||||
|
+ this.minDirtyY = 0;
|
||||||
|
+ this.maxDirtyX = 127;
|
||||||
|
+ this.maxDirtyY = 127;
|
||||||
|
+ this.dirtyFrameDecorations = true;
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
|
||||||
|
index a15cdf64575841edfe30f2b2c522f8fdfe2caae3..d8e8faf38a2fc6ae9846a6a0d2868d0a1418afef 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapView.java
|
||||||
|
@@ -97,11 +97,15 @@ public final class CraftMapView implements MapView {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRenderer(MapRenderer renderer) {
|
||||||
|
- if (!this.renderers.contains(renderer)) {
|
||||||
|
- this.renderers.add(renderer);
|
||||||
|
- this.canvases.put(renderer, new HashMap<CraftPlayer, CraftMapCanvas>());
|
||||||
|
- renderer.initialize(this);
|
||||||
|
- }
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking
|
||||||
|
+ if (this.renderers.contains(renderer)) return;
|
||||||
|
+
|
||||||
|
+ this.renderers.add(renderer);
|
||||||
|
+ this.canvases.put(renderer, new HashMap<>());
|
||||||
|
+ this.worldMap.hasPluginRenderer |= !(renderer instanceof CraftMapRenderer);
|
||||||
|
+ this.worldMap.hasContextualRenderer |= renderer.isContextual();
|
||||||
|
+ renderer.initialize(this);
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -116,6 +120,16 @@ public final class CraftMapView implements MapView {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.canvases.remove(renderer);
|
||||||
|
+ // Plazma start - Optimize framed map tracker ticking
|
||||||
|
+ this.worldMap.hasPluginRenderer = !(this.renderers.size() == 1 && this.renderers.getFirst() instanceof CraftMapRenderer);
|
||||||
|
+ if (!renderer.isContextual()) return true;
|
||||||
|
+
|
||||||
|
+ // Re-check all renderers
|
||||||
|
+ boolean contextualFound = false;
|
||||||
|
+ for (final MapRenderer mapRenderer : this.renderers) contextualFound |= mapRenderer.isContextual();
|
||||||
|
+
|
||||||
|
+ this.worldMap.hasContextualRenderer = contextualFound;
|
||||||
|
+ // Plazma end - Optimize framed map tracker ticking
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 21:18:55 +0900
|
||||||
|
Subject: [PATCH] SparklyPaper - Skip executeTick check if there's no task to
|
||||||
|
be run
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
||||||
|
index c03608fec96b51e1867f43d8f42e5aefb1520e46..9bb01accce426fafbddc1965a61257a73af8f152 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
|
||||||
|
@@ -36,8 +36,9 @@ public final class EntityScheduler {
|
||||||
|
* The Entity. Note that it is the CraftEntity, since only that class properly tracks world transfers.
|
||||||
|
*/
|
||||||
|
public final CraftEntity entity;
|
||||||
|
+ public final net.minecraft.server.MinecraftServer server; // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
|
||||||
|
- private static final record ScheduledTask(Consumer<? extends Entity> run, Consumer<? extends Entity> retired) {}
|
||||||
|
+ private record ScheduledTask(Consumer<? extends Entity> run, Consumer<? extends Entity> retired) {} // Plazma - minor code improvement
|
||||||
|
|
||||||
|
private long tickCount = 0L;
|
||||||
|
private static final long RETIRED_TICK_COUNT = -1L;
|
||||||
|
@@ -46,7 +47,8 @@ public final class EntityScheduler {
|
||||||
|
|
||||||
|
private final ArrayDeque<ScheduledTask> currentlyExecuting = new ArrayDeque<>();
|
||||||
|
|
||||||
|
- public EntityScheduler(final CraftEntity entity) {
|
||||||
|
+ public EntityScheduler(final net.minecraft.server.MinecraftServer server, final CraftEntity entity) { // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
+ this.server = Validate.notNull(server); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
this.entity = Validate.notNull(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -61,15 +63,15 @@ public final class EntityScheduler {
|
||||||
|
* @throws IllegalStateException If the scheduler is already retired.
|
||||||
|
*/
|
||||||
|
public void retire() {
|
||||||
|
+ final Entity thisEntity = this.entity.getHandleRaw(); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
synchronized (this.stateLock) {
|
||||||
|
if (this.tickCount == RETIRED_TICK_COUNT) {
|
||||||
|
throw new IllegalStateException("Already retired");
|
||||||
|
}
|
||||||
|
this.tickCount = RETIRED_TICK_COUNT;
|
||||||
|
+ this.server.entitiesWithScheduledTasks.remove(thisEntity); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
}
|
||||||
|
|
||||||
|
- final Entity thisEntity = this.entity.getHandleRaw();
|
||||||
|
-
|
||||||
|
// correctly handle and order retiring while running executeTick
|
||||||
|
for (int i = 0, len = this.currentlyExecuting.size(); i < len; ++i) {
|
||||||
|
final ScheduledTask task = this.currentlyExecuting.pollFirst();
|
||||||
|
@@ -124,9 +126,8 @@ public final class EntityScheduler {
|
||||||
|
if (this.tickCount == RETIRED_TICK_COUNT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
- this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), (final long keyInMap) -> {
|
||||||
|
- return new ArrayList<>();
|
||||||
|
- }).add(task);
|
||||||
|
+ this.server.entitiesWithScheduledTasks.add(this.entity.getHandleRaw()); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
+ this.oneTimeDelayed.computeIfAbsent(this.tickCount + Math.max(1L, delay), ignored -> new ArrayList<>()).add(task); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
@@ -143,6 +144,13 @@ public final class EntityScheduler {
|
||||||
|
TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously");
|
||||||
|
final List<ScheduledTask> toRun;
|
||||||
|
synchronized (this.stateLock) {
|
||||||
|
+ // Plazma start - Skip executeTick check if there is no any task to be run
|
||||||
|
+ if (this.currentlyExecuting.isEmpty() && this.oneTimeDelayed.isEmpty()) {
|
||||||
|
+ this.server.entitiesWithScheduledTasks.remove(thisEntity);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Skip executeTick check if there is no any task to be run
|
||||||
|
+
|
||||||
|
if (this.tickCount == RETIRED_TICK_COUNT) {
|
||||||
|
throw new IllegalStateException("Ticking retired scheduler");
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
index e63e6d885054cd926508f9999c8a4eed712d4891..022c4c01ab015a2a6135baa5dbe442fa7a1b4615 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -337,6 +337,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
public volatile boolean abnormalExit = false; // Paper
|
||||||
|
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||||
|
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
||||||
|
+ public final Set<Entity> entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
|
||||||
|
|
||||||
|
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||||
|
@@ -1869,17 +1870,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit
|
||||||
|
// Paper start - Folia scheduler API
|
||||||
|
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) Bukkit.getGlobalRegionScheduler()).tick();
|
||||||
|
- getAllLevels().forEach(level -> {
|
||||||
|
- for (final Entity entity : level.getEntities().getAll()) {
|
||||||
|
- if (entity.isRemoved()) {
|
||||||
|
- continue;
|
||||||
|
- }
|
||||||
|
- final org.bukkit.craftbukkit.entity.CraftEntity bukkit = entity.getBukkitEntityRaw();
|
||||||
|
- if (bukkit != null) {
|
||||||
|
- bukkit.taskScheduler.executeTick();
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- });
|
||||||
|
+ // Plazma start - Skip executeTick check if there is no any task to be run
|
||||||
|
+ for (final Entity entity : entitiesWithScheduledTasks) {
|
||||||
|
+ if (entity.isRemoved()) continue;
|
||||||
|
+
|
||||||
|
+ final org.bukkit.craftbukkit.entity.CraftEntity craftEntity = entity.getBukkitEntityRaw();
|
||||||
|
+ if (craftEntity == null) return;
|
||||||
|
+
|
||||||
|
+ craftEntity.taskScheduler.executeTick();
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Skip executeTick check if there is no any task to be run
|
||||||
|
// Paper end - Folia scheduler API
|
||||||
|
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.CALLBACK_MANAGER.handleQueue(this.tickCount); // Paper
|
||||||
|
//gameprofilerfiller.push("commandFunctions"); // Plazma - Completely remove Mojang profilers
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
index 51aee9a468f4ebfa9672fd9ce84883cf080859e3..94bdeaf15a73228ff92b50a22bc3aca41658de8d 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
@@ -72,7 +72,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
|
private final CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(CraftEntity.DATA_TYPE_REGISTRY);
|
||||||
|
protected net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
|
||||||
|
// Paper start - Folia shedulers
|
||||||
|
- public final io.papermc.paper.threadedregions.EntityScheduler taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this);
|
||||||
|
+ public final io.papermc.paper.threadedregions.EntityScheduler taskScheduler; // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
private final io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler apiScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaEntityScheduler(this);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -85,6 +85,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
|
this.server = server;
|
||||||
|
this.entity = entity;
|
||||||
|
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
|
||||||
|
+ this.taskScheduler = new io.papermc.paper.threadedregions.EntityScheduler(this.entity.getServer(), this); // Plazma - Skip executeTick check if there is no any task to be run
|
||||||
|
}
|
||||||
|
|
||||||
|
// Purpur start - API for any mob to burn daylight
|
||||||
177
patches/server/0053-SparklyPaper-MSPT-by-World.patch
Normal file
177
patches/server/0053-SparklyPaper-MSPT-by-World.patch
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 23:36:03 +0900
|
||||||
|
Subject: [PATCH] SparklyPaper - MSPT by World
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/command/MSPTCommand.java b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
||||||
|
index 8b5293b0c696ef21d0101493ffa41b60bf0bc86b..bf3a6e8e35fe9869dfa56a97dd5d820296de9721 100644
|
||||||
|
--- a/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
||||||
|
+++ b/src/main/java/io/papermc/paper/command/MSPTCommand.java
|
||||||
|
@@ -25,6 +25,29 @@ import static net.kyori.adventure.text.format.NamedTextColor.YELLOW;
|
||||||
|
public final class MSPTCommand extends Command {
|
||||||
|
private static final DecimalFormat DF = new DecimalFormat("########0.0");
|
||||||
|
private static final Component SLASH = text("/");
|
||||||
|
+ // Plazma start - MSPT by world
|
||||||
|
+ private static final Component COMMA = text(", ", YELLOW);
|
||||||
|
+ private static final Component HEADER = text().color(YELLOW).append(
|
||||||
|
+ text("("),
|
||||||
|
+ text("avg", GRAY),
|
||||||
|
+ text("/"),
|
||||||
|
+ text("min", GRAY),
|
||||||
|
+ text("/"),
|
||||||
|
+ text("max", GRAY),
|
||||||
|
+ text(")")
|
||||||
|
+ ).append(
|
||||||
|
+ text(" from last 1s"),
|
||||||
|
+ text(",", GRAY),
|
||||||
|
+ text(" 5s"),
|
||||||
|
+ text(",", GRAY),
|
||||||
|
+ text(" 10s"),
|
||||||
|
+ text(",", GRAY),
|
||||||
|
+ text(" 30s"),
|
||||||
|
+ text(",", GRAY),
|
||||||
|
+ text(" 1m"),
|
||||||
|
+ text(":", YELLOW)
|
||||||
|
+ ).build();
|
||||||
|
+ // Plazma end - MSPT by world
|
||||||
|
|
||||||
|
public MSPTCommand(final String name) {
|
||||||
|
super(name);
|
||||||
|
@@ -45,39 +68,44 @@ public final class MSPTCommand extends Command {
|
||||||
|
MinecraftServer server = MinecraftServer.getServer();
|
||||||
|
|
||||||
|
List<Component> times = new ArrayList<>();
|
||||||
|
+ // Plazma start - MSPT by world
|
||||||
|
+ times.addAll(eval(server.tickTimes1s.getTimes()));
|
||||||
|
times.addAll(eval(server.tickTimes5s.getTimes()));
|
||||||
|
times.addAll(eval(server.tickTimes10s.getTimes()));
|
||||||
|
+ times.addAll(eval(server.tickTimes30s.getTimes()));
|
||||||
|
times.addAll(eval(server.tickTimes60s.getTimes()));
|
||||||
|
|
||||||
|
- sender.sendMessage(text().content("Server tick times ").color(GOLD)
|
||||||
|
- .append(text().color(YELLOW)
|
||||||
|
- .append(
|
||||||
|
- text("("),
|
||||||
|
- text("avg", GRAY),
|
||||||
|
- text("/"),
|
||||||
|
- text("min", GRAY),
|
||||||
|
- text("/"),
|
||||||
|
- text("max", GRAY),
|
||||||
|
- text(")")
|
||||||
|
- )
|
||||||
|
- ).append(
|
||||||
|
- text(" from last 5s"),
|
||||||
|
- text(",", GRAY),
|
||||||
|
- text(" 10s"),
|
||||||
|
- text(",", GRAY),
|
||||||
|
- text(" 1m"),
|
||||||
|
- text(":", YELLOW)
|
||||||
|
- )
|
||||||
|
- );
|
||||||
|
- sender.sendMessage(text().content("◴ ").color(GOLD)
|
||||||
|
- .append(text().color(GRAY)
|
||||||
|
- .append(
|
||||||
|
- times.get(0), SLASH, times.get(1), SLASH, times.get(2), text(", ", YELLOW),
|
||||||
|
- times.get(3), SLASH, times.get(4), SLASH, times.get(5), text(", ", YELLOW),
|
||||||
|
- times.get(6), SLASH, times.get(7), SLASH, times.get(8)
|
||||||
|
- )
|
||||||
|
- )
|
||||||
|
- );
|
||||||
|
+ sender.sendMessage(text().content("Server tick times ").color(GOLD).append(HEADER));
|
||||||
|
+ sender.sendMessage(text().content("◴ ").color(GOLD).append(text().color(GRAY).append(
|
||||||
|
+ times.get(0), SLASH, times.get(1), SLASH, times.get(2), COMMA,
|
||||||
|
+ times.get(3), SLASH, times.get(4), SLASH, times.get(5), COMMA,
|
||||||
|
+ times.get(6), SLASH, times.get(7), SLASH, times.get(8), COMMA,
|
||||||
|
+ times.get(9), SLASH, times.get(10), SLASH, times.get(11), COMMA,
|
||||||
|
+ times.get(12), SLASH, times.get(13), SLASH, times.get(14)
|
||||||
|
+ )));
|
||||||
|
+
|
||||||
|
+ sender.sendMessage(text());
|
||||||
|
+ sender.sendMessage(text().content("World tick times ").color(GOLD).append(HEADER));
|
||||||
|
+ for (net.minecraft.server.level.ServerLevel serverLevel : server.getAllLevels()) {
|
||||||
|
+ List<Component> worldTimes = new ArrayList<>();
|
||||||
|
+ worldTimes.addAll(eval(serverLevel.tickTimes1s.getTimes()));
|
||||||
|
+ worldTimes.addAll(eval(serverLevel.tickTimes5s.getTimes()));
|
||||||
|
+ worldTimes.addAll(eval(serverLevel.tickTimes10s.getTimes()));
|
||||||
|
+ worldTimes.addAll(eval(serverLevel.tickTimes30s.getTimes()));
|
||||||
|
+ worldTimes.addAll(eval(serverLevel.tickTimes60s.getTimes()));
|
||||||
|
+
|
||||||
|
+ sender.sendMessage(text().content("◴ " + serverLevel.getWorld().getName() + ": ").color(GOLD).append(
|
||||||
|
+ text().color(GRAY).append(
|
||||||
|
+ worldTimes.get(0), SLASH, worldTimes.get(1), SLASH, worldTimes.get(2), COMMA,
|
||||||
|
+ worldTimes.get(3), SLASH, worldTimes.get(4), SLASH, worldTimes.get(5), COMMA,
|
||||||
|
+ worldTimes.get(6), SLASH, worldTimes.get(7), SLASH, worldTimes.get(8), COMMA,
|
||||||
|
+ worldTimes.get(9), SLASH, worldTimes.get(10), SLASH, worldTimes.get(11), COMMA,
|
||||||
|
+ worldTimes.get(12), SLASH, worldTimes.get(13), SLASH, worldTimes.get(14)
|
||||||
|
+ ))
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - MSPT by world
|
||||||
|
+
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
index 022c4c01ab015a2a6135baa5dbe442fa7a1b4615..26c5cb68b464305fde43e2e0e1a415a2425483ea 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -264,8 +264,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
private final long[] tickTimesNanos;
|
||||||
|
private long aggregatedTickTimesNanos;
|
||||||
|
// Paper start - Add tick times API and /mspt command
|
||||||
|
+ public final TickTimes tickTimes1s = new TickTimes(20); // Plazma - Add more MSPT
|
||||||
|
public final TickTimes tickTimes5s = new TickTimes(100);
|
||||||
|
public final TickTimes tickTimes10s = new TickTimes(200);
|
||||||
|
+ public final TickTimes tickTimes30s = new TickTimes(600); // Plazma - Add more MSPT
|
||||||
|
public final TickTimes tickTimes60s = new TickTimes(1200);
|
||||||
|
// Paper end - Add tick times API and /mspt command
|
||||||
|
@Nullable
|
||||||
|
@@ -1778,8 +1780,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
this.tickTimesNanos[l] = k;
|
||||||
|
this.smoothedTickTimeMillis = this.smoothedTickTimeMillis * 0.8F + (float) k / (float) TimeUtil.NANOSECONDS_PER_MILLISECOND * 0.19999999F;
|
||||||
|
// Paper start - Add tick times API and /mspt command
|
||||||
|
+ this.tickTimes1s.add(this.tickCount, k); // Plazma - Add more MSPT
|
||||||
|
this.tickTimes5s.add(this.tickCount, k);
|
||||||
|
this.tickTimes10s.add(this.tickCount, k);
|
||||||
|
+ this.tickTimes30s.add(this.tickCount, k); // Plazma - Add more MSPT
|
||||||
|
this.tickTimes60s.add(this.tickCount, k);
|
||||||
|
// Paper end - Add tick times API and /mspt command
|
||||||
|
this.logTickMethodTime(i);
|
||||||
|
@@ -1941,7 +1945,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
//gameprofilerfiller.push("tick"); // Plazma - Completely remove Mojang profilers
|
||||||
|
|
||||||
|
try {
|
||||||
|
+ // Plazma start - MSPT by world
|
||||||
|
+ long i = Util.getNanos();
|
||||||
|
worldserver.tick(shouldKeepTicking);
|
||||||
|
+ long d = Util.getNanos() - i;
|
||||||
|
+
|
||||||
|
+ worldserver.tickTimes1s.add(this.tickCount, d);
|
||||||
|
+ worldserver.tickTimes5s.add(this.tickCount, d);
|
||||||
|
+ worldserver.tickTimes10s.add(this.tickCount, d);
|
||||||
|
+ worldserver.tickTimes30s.add(this.tickCount, d);
|
||||||
|
+ worldserver.tickTimes60s.add(this.tickCount, d);
|
||||||
|
+ // Plazma end - MSPT by world
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
index 14188b6e317dca2bbf98896951605f2e3742506f..137138aa1e42d4f12ed0bc54bc25918d29120333 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
|
@@ -598,6 +598,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
|
}
|
||||||
|
// Paper end - lag compensation
|
||||||
|
|
||||||
|
+ // Plazma start - MSPT by world
|
||||||
|
+ public final MinecraftServer.TickTimes tickTimes1s = new MinecraftServer.TickTimes(20);
|
||||||
|
+ public final MinecraftServer.TickTimes tickTimes5s = new MinecraftServer.TickTimes(100);
|
||||||
|
+ public final MinecraftServer.TickTimes tickTimes10s = new MinecraftServer.TickTimes(200);
|
||||||
|
+ public final MinecraftServer.TickTimes tickTimes30s = new MinecraftServer.TickTimes(600);
|
||||||
|
+ public final MinecraftServer.TickTimes tickTimes60s = new MinecraftServer.TickTimes(1200);
|
||||||
|
+ // Plazma end - MSPT by world
|
||||||
|
+
|
||||||
|
// Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||||
|
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||||
|
// Plazma start - Configurable Plazma
|
||||||
275
patches/server/0054-SparklyPaper-Optimize-farm-check.patch
Normal file
275
patches/server/0054-SparklyPaper-Optimize-farm-check.patch
Normal file
@@ -0,0 +1,275 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 23:36:36 +0900
|
||||||
|
Subject: [PATCH] SparklyPaper - Optimize farm check
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||||
|
index 33c27909290ff3ab483226cf65b1a1bc2e983cbc..df4bb6a77775fe7aab3f47c13c9755a7374d0761 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
||||||
|
@@ -77,35 +77,52 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||||
|
- if (world.getRawBrightness(pos, 0) >= 9) {
|
||||||
|
- int i = this.getAge(state);
|
||||||
|
-
|
||||||
|
- if (i < this.getMaxAge()) {
|
||||||
|
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||||
|
-
|
||||||
|
- // Spigot start
|
||||||
|
- int modifier;
|
||||||
|
- if (this == Blocks.BEETROOTS) {
|
||||||
|
- modifier = world.spigotConfig.beetrootModifier;
|
||||||
|
- } else if (this == Blocks.CARROTS) {
|
||||||
|
- modifier = world.spigotConfig.carrotModifier;
|
||||||
|
- } else if (this == Blocks.POTATOES) {
|
||||||
|
- modifier = world.spigotConfig.potatoModifier;
|
||||||
|
- // Paper start - Fix Spigot growth modifiers
|
||||||
|
- } else if (this == Blocks.TORCHFLOWER_CROP) {
|
||||||
|
- modifier = world.spigotConfig.torchFlowerModifier;
|
||||||
|
- // Paper end - Fix Spigot growth modifiers
|
||||||
|
- } else {
|
||||||
|
- modifier = world.spigotConfig.wheatModifier;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||||
|
- // Spigot end
|
||||||
|
- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
||||||
|
- }
|
||||||
|
+ // Plazma start - Optimize farm check
|
||||||
|
+ if (world.getRawBrightness(pos, 0) < 9) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ int age = this.getAge(state);
|
||||||
|
+ if (age >= this.getMaxAge()) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ // Spigot start
|
||||||
|
+ int modifier = switch (this) {
|
||||||
|
+ case BeetrootBlock ignored -> world.spigotConfig.beetrootModifier;
|
||||||
|
+ case CarrotBlock ignored -> world.spigotConfig.carrotModifier;
|
||||||
|
+ case PotatoBlock ignored -> world.spigotConfig.potatoModifier;
|
||||||
|
+ case TorchflowerCropBlock ignored -> world.spigotConfig.torchFlowerModifier;
|
||||||
|
+ default -> world.spigotConfig.wheatModifier;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) {
|
||||||
|
+ final BlockPos below = pos.below();
|
||||||
|
+ final BlockState belowState = world.getBlockState(below);
|
||||||
|
+
|
||||||
|
+ boolean isMoist = false;
|
||||||
|
+ float growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.base;
|
||||||
|
+ if (belowState.is(Blocks.FARMLAND) && belowState.getValue(FarmBlock.MOISTURE) > 0) {
|
||||||
|
+ growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.moist;
|
||||||
|
+ isMoist = true;
|
||||||
|
+ }
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (world.plazmaConfig().block.optimizedFarmCheck.skipMiddleAges) {
|
||||||
|
+ growthSpeed /= getMaxAge();
|
||||||
|
+ age = getMaxAge() - 1;
|
||||||
|
+ }
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) {
|
||||||
|
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2)) return;
|
||||||
|
+ if ((age + 1) != getMaxAge() || !isMoist || FarmBlock.isNearWater(world, below)) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ CraftEventFactory.handleMoistureChangeEvent(world, below, state.setValue(FarmBlock.MOISTURE, 0), 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ float growthSpeed = CropBlock.getGrowthSpeed(this, world, pos); // Plazma - moved down
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||||
|
+ // Spigot end
|
||||||
|
+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(age + 1), 2); // CraftBukkit
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Optimize farm check
|
||||||
|
}
|
||||||
|
|
||||||
|
public void growCrops(Level world, BlockPos pos, BlockState state) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||||
|
index eaac00e2534aca4eab92c7b9f9248e04b35b47df..14f807b6214529d909fd93cc7ce28eb712975f8c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||||
|
@@ -92,20 +92,29 @@ public class FarmBlock extends Block {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||||
|
- int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
||||||
|
- if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||||
|
- if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||||
|
-
|
||||||
|
- if (!FarmBlock.isNearWater(world, pos) && !world.isRainingAt(pos.above())) {
|
||||||
|
- if (i > 0) {
|
||||||
|
- org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, i - 1), 2); // CraftBukkit
|
||||||
|
- } else if (!FarmBlock.shouldMaintainFarmland(world, pos)) {
|
||||||
|
- FarmBlock.turnToDirt((Entity) null, state, world, pos);
|
||||||
|
- }
|
||||||
|
- } else if (i < 7) {
|
||||||
|
- org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, 7), 2); // CraftBukkit
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
+ // Plazma start - Optimize farm check
|
||||||
|
+ int moistLevel = state.getValue(MOISTURE);
|
||||||
|
+ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) {
|
||||||
|
+ if (moistLevel != 0) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (isNearWater(world, pos))
|
||||||
|
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2);
|
||||||
|
+ else
|
||||||
|
+ turnToDirt(null, state, world, pos);
|
||||||
|
+ return;
|
||||||
|
+ } // diff on change
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (moistLevel > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||||
|
+ if (moistLevel == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (!isNearWater(world, pos) && !world.isRainingAt(pos.above())) {
|
||||||
|
+ if (moistLevel > 0)
|
||||||
|
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, moistLevel - 1), 2); // CraftBukkit
|
||||||
|
+ else if (!shouldMaintainFarmland(world, pos))
|
||||||
|
+ turnToDirt(null, state, world, pos);
|
||||||
|
+ } else if (moistLevel < 7)
|
||||||
|
+ CraftEventFactory.handleMoistureChangeEvent(world, pos, state.setValue(MOISTURE, 7), 2); // CraftBukkit
|
||||||
|
+ // Plazma end - Optimize farm check
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -169,7 +178,7 @@ public class FarmBlock extends Block {
|
||||||
|
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static boolean isNearWater(LevelReader world, BlockPos pos) {
|
||||||
|
+ static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - AT (private -> package-private)
|
||||||
|
// Paper start - Perf: remove abstract block iteration
|
||||||
|
int xOff = pos.getX();
|
||||||
|
int yOff = pos.getY();
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||||
|
index 76109aceb24a4719d49c1a55e3621cf2a63bbe16..00b3275305b5f1c2ea2516dcad3c7c62f06db49f 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
||||||
|
@@ -72,38 +72,66 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||||
|
- if (world.getRawBrightness(pos, 0) >= 9) {
|
||||||
|
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
||||||
|
-
|
||||||
|
- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
||||||
|
- int i = (Integer) state.getValue(StemBlock.AGE);
|
||||||
|
-
|
||||||
|
- if (i < 7) {
|
||||||
|
- state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
||||||
|
- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
||||||
|
- } else {
|
||||||
|
- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
||||||
|
- BlockPos blockposition1 = pos.relative(enumdirection);
|
||||||
|
- BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
||||||
|
-
|
||||||
|
- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
||||||
|
- Registry<Block> iregistry = world.registryAccess().lookupOrThrow(Registries.BLOCK);
|
||||||
|
- Optional<Block> optional = iregistry.getOptional(this.fruit);
|
||||||
|
- Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
||||||
|
-
|
||||||
|
- if (optional.isPresent() && optional1.isPresent()) {
|
||||||
|
- // CraftBukkit start
|
||||||
|
- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- // CraftBukkit end
|
||||||
|
- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
+ if (world.getRawBrightness(pos, 0) < 9) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (world.plazmaConfig().block.optimizedFarmCheck.enabled) {
|
||||||
|
+ final BlockPos below = pos.below();
|
||||||
|
+ final BlockState belowState = world.getBlockState(below);
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ boolean isMoist = false;
|
||||||
|
+ float growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.base;
|
||||||
|
+ if (belowState.is(Blocks.FARMLAND) && belowState.getValue(BlockStateProperties.MOISTURE) > 0) {
|
||||||
|
+ growthSpeed = world.plazmaConfig().block.optimizedFarmCheck.growthSpeed.moist;
|
||||||
|
+ isMoist = true;
|
||||||
|
}
|
||||||
|
-
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (random.nextFloat() >= ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / growthSpeed) + 1))))) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ int age = state.getValue(StemBlock.AGE);
|
||||||
|
+ if (age < 7) {
|
||||||
|
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(StemBlock.AGE, age + 1), 2);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ final Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
||||||
|
+ final BlockPos blockPos = pos.relative(direction);
|
||||||
|
+ final BlockState belowState1 = world.getBlockState(blockPos.below());
|
||||||
|
+ if (!world.getBlockState(blockPos).isAir() || (!belowState1.is(Blocks.FARMLAND) && !belowState1.is(BlockTags.DIRT))) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ final Registry<Block> registry = world.registryAccess().lookupOrThrow(Registries.BLOCK);
|
||||||
|
+ final Optional<Block> fruit = registry.getOptional(this.fruit);
|
||||||
|
+ final Optional<Block> stem = registry.getOptional(this.attachedStem);
|
||||||
|
+ if (fruit.isEmpty() || stem.isEmpty()) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockPos, fruit.get().defaultBlockState())) return; // CraftBukkit
|
||||||
|
+ if (isMoist && !FarmBlock.isNearWater(world, blockPos))
|
||||||
|
+ CraftEventFactory.handleMoistureChangeEvent(world, blockPos, belowState1.setValue(BlockStateProperties.MOISTURE, 0), 2);
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (random.nextFloat() >= ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / CropBlock.getGrowthSpeed(this, world, pos)) + 1))))) return; // Spigot - SPIGOT-7159: Better modifier resolution
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ final int age = state.getValue(StemBlock.AGE);
|
||||||
|
+ if (age < 7) {
|
||||||
|
+ state = state.setValue(StemBlock.AGE, age + 1);
|
||||||
|
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
||||||
|
+ return;
|
||||||
|
}
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ final Direction direction = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
||||||
|
+ final BlockPos blockPos = pos.relative(direction);
|
||||||
|
+ final BlockState belowState = world.getBlockState(blockPos.below());
|
||||||
|
+ if (!world.getBlockState(blockPos).isAir() || (!belowState.is(Blocks.FARMLAND) && !belowState.is(BlockTags.DIRT))) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ final Registry<Block> registry = world.registryAccess().lookupOrThrow(Registries.BLOCK);
|
||||||
|
+ final Optional<Block> fruit = registry.getOptional(this.fruit);
|
||||||
|
+ final Optional<Block> stem = registry.getOptional(this.attachedStem);
|
||||||
|
+ if (fruit.isEmpty() || stem.isEmpty()) return;
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockPos, fruit.get().defaultBlockState())) return; // CraftBukkit
|
||||||
|
+ world.setBlockAndUpdate(pos, stem.get().defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, direction));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
index bab5f682b8aeaa6dfcda7f07499ae297cbcbe23e..f822b544d98602be85bf0c54a6040a5907b1906e 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
@@ -81,6 +81,22 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public OptimizedFarmCheck optimizedFarmCheck;
|
||||||
|
+ public class OptimizedFarmCheck extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ public boolean enabled = OPTIMIZE;
|
||||||
|
+ public boolean skipMiddleAges = false;
|
||||||
|
+
|
||||||
|
+ public GrowthSpeed growthSpeed;
|
||||||
|
+ public class GrowthSpeed extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ public float base = 1.0f;
|
||||||
|
+ public float moist = 5.0f;
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
|
public Item item;
|
||||||
146
patches/server/0055-SparklyPaper-Optimize-season-check.patch
Normal file
146
patches/server/0055-SparklyPaper-Optimize-season-check.patch
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 23:37:17 +0900
|
||||||
|
Subject: [PATCH] SparklyPaper - Optimize season check
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||||
|
index 0d3f4702c8bf3d66b01b42c5da1761e93e1d6ed2..a749adca6c758c0008ab8b27f307ac4570c82652 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||||
|
@@ -324,15 +324,19 @@ public class Bat extends AmbientCreature {
|
||||||
|
private static boolean isSpookySeason = false;
|
||||||
|
private static final int ONE_HOUR = 20 * 60 * 60;
|
||||||
|
private static int lastSpookyCheck = -ONE_HOUR;
|
||||||
|
- public static boolean isHalloweenSeason(Level level) { return level.purpurConfig.forceHalloweenSeason || isHalloween(); } // Purpur
|
||||||
|
+
|
||||||
|
+ public static boolean isHalloweenSeason(Level level) {
|
||||||
|
+ return level.purpurConfig.forceHalloweenSeason || net.sparklypower.sparklypaper.HalloweenManager.isInSeason() || isHalloween();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
private static boolean isHalloween() {
|
||||||
|
if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
|
||||||
|
- LocalDate localdate = LocalDate.now();
|
||||||
|
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||||
|
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||||
|
+ LocalDate now = LocalDate.now();
|
||||||
|
+ int day = now.getDayOfMonth();
|
||||||
|
+ int month = now.getMonth().getValue();
|
||||||
|
|
||||||
|
- isSpookySeason = j == 10 && i >= 20 || j == 11 && i <= 3;
|
||||||
|
- lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick;
|
||||||
|
+ isSpookySeason = month == 10 && day >= 20 || month == 11 && day <= 3;
|
||||||
|
+ lastSpookyCheck = net.minecraft.server.MinecraftServer.currentTick;
|
||||||
|
}
|
||||||
|
return isSpookySeason;
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..530bac5a415c8597ae76ec603c1d8158535c66d0
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/sparklypower/sparklypaper/HalloweenManager.java
|
||||||
|
@@ -0,0 +1,82 @@
|
||||||
|
+package net.sparklypower.sparklypaper;
|
||||||
|
+
|
||||||
|
+import com.mojang.logging.LogUtils;
|
||||||
|
+import org.jetbrains.annotations.Nullable;
|
||||||
|
+import org.slf4j.Logger;
|
||||||
|
+import java.time.LocalDateTime;
|
||||||
|
+import java.time.Month;
|
||||||
|
+import java.time.ZoneOffset;
|
||||||
|
+import java.util.concurrent.CountDownLatch;
|
||||||
|
+import java.util.concurrent.Executors;
|
||||||
|
+import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
+import java.util.concurrent.TimeUnit;
|
||||||
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
+
|
||||||
|
+public final class HalloweenManager {
|
||||||
|
+
|
||||||
|
+ private static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
+ public static @Nullable net.sparklypower.sparklypaper.HalloweenManager INSTANCE;
|
||||||
|
+
|
||||||
|
+ private long seasonStartEpoch = 0L;
|
||||||
|
+ private long seasonEndEpoch = 0L;
|
||||||
|
+
|
||||||
|
+ private final ScheduledExecutorService EXECUTOR = Executors.newSingleThreadScheduledExecutor(runnable -> {
|
||||||
|
+ final Thread thread = new Thread(runnable);
|
||||||
|
+ thread.setName("halloween-timer-updater");
|
||||||
|
+ thread.setPriority(1);
|
||||||
|
+ return thread;
|
||||||
|
+ });
|
||||||
|
+
|
||||||
|
+ public HalloweenManager() {
|
||||||
|
+ final AtomicBoolean first = new AtomicBoolean(true);
|
||||||
|
+ final CountDownLatch LATCH = new CountDownLatch(1);
|
||||||
|
+
|
||||||
|
+ try {
|
||||||
|
+ EXECUTOR.scheduleAtFixedRate(() -> {
|
||||||
|
+ updateEpoch();
|
||||||
|
+ if (first.get()) LATCH.countDown();
|
||||||
|
+ first.set(false);
|
||||||
|
+ }, 0L, 90L, TimeUnit.DAYS);
|
||||||
|
+
|
||||||
|
+ LATCH.await();
|
||||||
|
+ } catch (InterruptedException e) {
|
||||||
|
+ LOGGER.error("Interrupted while waiting for HalloweenManager to start", e);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public @Nullable HalloweenManager close() {
|
||||||
|
+ EXECUTOR.shutdownNow();
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static boolean isInSeason() {
|
||||||
|
+ return INSTANCE != null && INSTANCE.isSeason();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private boolean isSeason() {
|
||||||
|
+ return this.seasonStartEpoch <= System.currentTimeMillis() && System.currentTimeMillis() < this.seasonEndEpoch;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void updateEpoch() {
|
||||||
|
+ LOGGER.info("Updating Spooky Season and Halloween Time");
|
||||||
|
+ this.seasonStartEpoch = millisFromDate(20, 10, false);
|
||||||
|
+ this.seasonEndEpoch = millisFromDate(3, 11, true);
|
||||||
|
+ LOGGER.info("Updated Spooky Season and Halloween Time!");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private static long millisFromDate(int day, int month, boolean endOfMonth) {
|
||||||
|
+ LocalDateTime target = LocalDateTime.of(
|
||||||
|
+ LocalDateTime.now().getYear(),
|
||||||
|
+ Month.of(month),
|
||||||
|
+ day,
|
||||||
|
+ endOfMonth ? 23 : 0,
|
||||||
|
+ endOfMonth ? 59 : 0,
|
||||||
|
+ endOfMonth ? 59 : 0,
|
||||||
|
+ endOfMonth ? 999_999_999 : 0
|
||||||
|
+ );
|
||||||
|
+
|
||||||
|
+ return (LocalDateTime.now().isAfter(target) ? target.plusYears(1) : target)
|
||||||
|
+ .atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
index 3c917e2a7fe8e5ff1ac91ddba29c717952a15d57..538c572661bd92666f84e6f9ef3e9760f69f50a9 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -153,6 +153,17 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
public class Miscellaneous extends ConfigurationPart {
|
||||||
|
|
||||||
|
public boolean resetDirtyWhenLoadingMapsFromDisk = false;
|
||||||
|
+ public boolean optimizeHalloweenCheck = OPTIMIZE;
|
||||||
|
+
|
||||||
|
+ @PostProcess
|
||||||
|
+ void post() {
|
||||||
|
+ net.sparklypower.sparklypaper.HalloweenManager manager = net.sparklypower.sparklypaper.HalloweenManager.INSTANCE;
|
||||||
|
+
|
||||||
|
+ if (manager == null && this.optimizeHalloweenCheck)
|
||||||
|
+ net.sparklypower.sparklypaper.HalloweenManager.INSTANCE = new net.sparklypower.sparklypaper.HalloweenManager();
|
||||||
|
+ else if (manager != null && !this.optimizeHalloweenCheck)
|
||||||
|
+ net.sparklypower.sparklypaper.HalloweenManager.INSTANCE = manager.close();
|
||||||
|
+ }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Fri, 13 Dec 2024 23:52:46 +0900
|
||||||
|
Subject: [PATCH] SparklyPaper - Optimize tickingBlockEntity
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
index 332c1d890eefb0c705200a61b8bc7369457bc3af..ca7d4efd7b813c58169d251b23cf6a6fa71c9cee 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||||
|
@@ -1526,28 +1526,42 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||||
|
|
||||||
|
int tickedEntities = 0; // Paper - rewrite chunk system
|
||||||
|
|
||||||
|
- int tilesThisCycle = 0;
|
||||||
|
- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
|
||||||
|
+ // Plazma start - Optimize tickingBlockEntity
|
||||||
|
+ int shouldTickBlocksAtLastResult = -1;
|
||||||
|
+ long shouldTickBlocksAtChunkPos = 0L;
|
||||||
|
+ final it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity> toRemove =
|
||||||
|
+ new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Fix MC-117075; use removeAll
|
||||||
|
+
|
||||||
|
toRemove.add(null); // Paper - Fix MC-117075
|
||||||
|
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
|
||||||
|
- this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
|
||||||
|
- TickingBlockEntity tickingblockentity = (TickingBlockEntity) this.blockEntityTickers.get(this.tileTickPosition);
|
||||||
|
- // Spigot end
|
||||||
|
-
|
||||||
|
- if (tickingblockentity.isRemoved()) {
|
||||||
|
- // Spigot start
|
||||||
|
- tilesThisCycle--;
|
||||||
|
- toRemove.add(tickingblockentity); // Paper - Fix MC-117075; use removeAll
|
||||||
|
- // Spigot end
|
||||||
|
- } else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
|
||||||
|
- tickingblockentity.tick();
|
||||||
|
- // Paper start - rewrite chunk system
|
||||||
|
- if ((++tickedEntities & 7) == 0) {
|
||||||
|
- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)(Level)(Object)this).moonrise$midTickTasks();
|
||||||
|
+ TickingBlockEntity tickingEntity = this.blockEntityTickers.get(this.tileTickPosition);
|
||||||
|
+
|
||||||
|
+ if (tickingEntity.isRemoved()) {
|
||||||
|
+ toRemove.add(tickingEntity); // Paper - Fix MC-117075; use removeAll
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (flag) {
|
||||||
|
+ long pos = tickingEntity.getChunkCoordinateKey();
|
||||||
|
+
|
||||||
|
+ boolean shouldTick;
|
||||||
|
+ if (shouldTickBlocksAtChunkPos == pos && shouldTickBlocksAtLastResult != -1) {
|
||||||
|
+ shouldTick = shouldTickBlocksAtLastResult == 1;
|
||||||
|
+ } else {
|
||||||
|
+ shouldTick = this.shouldTickBlocksAt(pos);
|
||||||
|
+ shouldTickBlocksAtLastResult = shouldTick ? 1 : 0;
|
||||||
|
+ shouldTickBlocksAtChunkPos = pos;
|
||||||
|
}
|
||||||
|
- // Paper end - rewrite chunk system
|
||||||
|
+
|
||||||
|
+ if (!shouldTick) continue;
|
||||||
|
+
|
||||||
|
+ tickingEntity.tick();
|
||||||
|
+ if ((++tickedEntities & 7) != 0) continue;
|
||||||
|
+
|
||||||
|
+ this.moonrise$midTickTasks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+ // Plazma end - Optimize tickingBlockEntity
|
||||||
|
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
|
||||||
|
|
||||||
|
this.tickingBlockEntities = false;
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
|
||||||
|
index 28e3b73507b988f7234cbf29c4024c88180d0aef..de15cbda0c180e0d071ce7ac41d2fd1aeca60985 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/TickingBlockEntity.java
|
||||||
|
@@ -10,4 +10,6 @@ public interface TickingBlockEntity {
|
||||||
|
BlockPos getPos();
|
||||||
|
|
||||||
|
String getType();
|
||||||
|
+
|
||||||
|
+ long getChunkCoordinateKey(); // Plazma - Optimize tickingBlockEntity
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
|
index 3c92e6b52394eed3ac66d44973288e4de2c133cc..2966caede97e01b5ad15a0d56232a0f5526685e2 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
|
@@ -75,6 +75,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
|
public String getType() {
|
||||||
|
return "<null>";
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ @Override public long getChunkCoordinateKey() { return 0; } // Plazma - Optimize tickingBlockEntity;
|
||||||
|
};
|
||||||
|
private final Map<BlockPos, LevelChunk.RebindableTickingBlockEntityWrapper> tickersInLevel;
|
||||||
|
public boolean loaded;
|
||||||
|
@@ -995,7 +997,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T extends BlockEntity> TickingBlockEntity createTicker(T blockEntity, BlockEntityTicker<T> blockEntityTicker) {
|
||||||
|
- return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker);
|
||||||
|
+ return new LevelChunk.BoundTickingBlockEntity<>(blockEntity, blockEntityTicker, this.coordinateKey); // Plazma - Optimize tickingBlockEntity
|
||||||
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
@@ -1049,8 +1051,15 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
|
return this.ticker.getType();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Override // Plazma - minor code improvement
|
||||||
|
public String toString() {
|
||||||
|
- return String.valueOf(this.ticker) + " <wrapped>";
|
||||||
|
+ return this.ticker + " <wrapped>"; // Plazma - minor code improvement
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // Plazma start - Optimize tickingBlockEntity
|
||||||
|
+ @Override
|
||||||
|
+ public long getChunkCoordinateKey() {
|
||||||
|
+ return this.ticker.getChunkCoordinateKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1059,51 +1068,45 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
|
private final T blockEntity;
|
||||||
|
private final BlockEntityTicker<T> ticker;
|
||||||
|
private boolean loggedInvalidBlockState;
|
||||||
|
+ private final long chunkCoordinateKey;
|
||||||
|
|
||||||
|
- BoundTickingBlockEntity(final BlockEntity tileentity, final BlockEntityTicker blockentityticker) {
|
||||||
|
- this.blockEntity = (T) tileentity; // CraftBukkit - decompile error
|
||||||
|
- this.ticker = blockentityticker;
|
||||||
|
+ BoundTickingBlockEntity(final T blockEntity, final BlockEntityTicker<T> ticker, final long chunkCoordinateKey) {
|
||||||
|
+ this.blockEntity = blockEntity;
|
||||||
|
+ this.ticker = ticker;
|
||||||
|
+ this.chunkCoordinateKey = chunkCoordinateKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
- if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) {
|
||||||
|
- BlockPos blockposition = this.blockEntity.getBlockPos();
|
||||||
|
+ if (this.blockEntity.isRemoved() || !this.blockEntity.hasLevel()) return;
|
||||||
|
|
||||||
|
- if (LevelChunk.this.isTicking(blockposition)) {
|
||||||
|
- try {
|
||||||
|
- //ProfilerFiller gameprofilerfiller = Profiler.get(); // Plazma - Completely remove Mojang profiler
|
||||||
|
-
|
||||||
|
- //gameprofilerfiller.push(this::getType); // Plazma - Completely remove Mojang profiler
|
||||||
|
- BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
||||||
|
+ BlockPos pos = this.blockEntity.getBlockPos();
|
||||||
|
+ if (!LevelChunk.this.isTicking(pos)) return;
|
||||||
|
|
||||||
|
- if (this.blockEntity.getType().isValid(iblockdata)) {
|
||||||
|
- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
||||||
|
- this.loggedInvalidBlockState = false;
|
||||||
|
- // Paper start - Remove the Block Entity if it's invalid
|
||||||
|
- } else {
|
||||||
|
- LevelChunk.this.removeBlockEntity(this.getPos());
|
||||||
|
- if (!this.loggedInvalidBlockState) {
|
||||||
|
- this.loggedInvalidBlockState = true;
|
||||||
|
- LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", new Object[]{LogUtils.defer(this::getType), LogUtils.defer(this::getPos), iblockdata});
|
||||||
|
- }
|
||||||
|
- // Paper end - Remove the Block Entity if it's invalid
|
||||||
|
- }
|
||||||
|
+ try {
|
||||||
|
+ BlockState state = LevelChunk.this.getBlockState(pos);
|
||||||
|
|
||||||
|
- //gameprofilerfiller.pop(); // Plazma - Completely remove Mojang profiler
|
||||||
|
- } catch (Throwable throwable) {
|
||||||
|
- if (throwable instanceof ThreadDeath) throw throwable; // Paper
|
||||||
|
- // Paper start - Prevent block entity and entity crashes
|
||||||
|
- final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||||
|
- net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
||||||
|
- net.minecraft.world.level.chunk.LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
|
||||||
|
- LevelChunk.this.removeBlockEntity(this.getPos());
|
||||||
|
- // Paper end - Prevent block entity and entity crashes
|
||||||
|
- // Spigot start
|
||||||
|
+ if (this.blockEntity.getType().isValid(state)) {
|
||||||
|
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
|
||||||
|
+ this.loggedInvalidBlockState = false;
|
||||||
|
+ // Paper start - Remove the Block Entity if it's invalid
|
||||||
|
+ } else {
|
||||||
|
+ LevelChunk.this.removeBlockEntity(this.getPos());
|
||||||
|
+ if (!this.loggedInvalidBlockState) {
|
||||||
|
+ this.loggedInvalidBlockState = true;
|
||||||
|
+ LevelChunk.LOGGER.warn("Block entity {} @ {} state {} invalid for ticking:", LogUtils.defer(this::getType), LogUtils.defer(this::getPos), state);
|
||||||
|
}
|
||||||
|
+ // Paper end - Remove the Block Entity if it's invalid
|
||||||
|
}
|
||||||
|
+ } catch (Throwable throwable) {
|
||||||
|
+ if (throwable instanceof ThreadDeath) throw throwable; // Paper
|
||||||
|
+ // Paper start - Prevent block entity and entity crashes
|
||||||
|
+ final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
|
||||||
|
+ net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
|
||||||
|
+ LevelChunk.this.level.getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable))); // Paper - ServerExceptionEvent
|
||||||
|
+ LevelChunk.this.removeBlockEntity(this.getPos());
|
||||||
|
+ // Paper end - Prevent block entity and entity crashes
|
||||||
|
}
|
||||||
|
-
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -1121,10 +1124,15 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
|
return BlockEntityType.getKey(this.blockEntity.getType()).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Override
|
||||||
|
public String toString() {
|
||||||
|
- String s = this.getType();
|
||||||
|
+ return "Level ticker for " + this.getType() + "@" + this.getPos();
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- return "Level ticker for " + s + "@" + String.valueOf(this.getPos());
|
||||||
|
+ @Override
|
||||||
|
+ public long getChunkCoordinateKey() {
|
||||||
|
+ return this.chunkCoordinateKey;
|
||||||
|
}
|
||||||
|
+ // Plazma end - Optimize tickingBlockEntity
|
||||||
|
}
|
||||||
|
}
|
||||||
227
patches/server/0057-Implement-CarpetFixes.patch
Normal file
227
patches/server/0057-Implement-CarpetFixes.patch
Normal file
@@ -0,0 +1,227 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Sat, 14 Dec 2024 00:29:15 +0900
|
||||||
|
Subject: [PATCH] Implement CarpetFixes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||||
|
index 0503f936d0d7194f110069adabff984f51af0a3a..0ca88636cca9b8f93cddf8bc58038e626e171df8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
||||||
|
@@ -379,19 +379,22 @@ public class Sheep extends Animal implements Shearable {
|
||||||
|
}
|
||||||
|
|
||||||
|
private DyeColor getOffspringColor(ServerLevel world, Sheep firstParent, Sheep secondParent) {
|
||||||
|
- DyeColor enumcolor = firstParent.getColor();
|
||||||
|
- DyeColor enumcolor1 = secondParent.getColor();
|
||||||
|
- CraftingInput craftinginput = Sheep.makeCraftInput(enumcolor, enumcolor1);
|
||||||
|
- Optional<Item> optional = world.recipeAccess().getRecipeFor(RecipeType.CRAFTING, craftinginput, world).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||||
|
- return ((CraftingRecipe) recipeholder.value()).assemble(craftinginput, world.registryAccess());
|
||||||
|
- }).map(ItemStack::getItem);
|
||||||
|
-
|
||||||
|
- Objects.requireNonNull(DyeItem.class);
|
||||||
|
- optional = optional.filter(DyeItem.class::isInstance);
|
||||||
|
- Objects.requireNonNull(DyeItem.class);
|
||||||
|
- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
||||||
|
- return world.random.nextBoolean() ? enumcolor : enumcolor1;
|
||||||
|
- });
|
||||||
|
+ // Plazma start - Implement CarpetFixes
|
||||||
|
+ final DyeColor firstColor = firstParent.getColor();
|
||||||
|
+ final DyeColor secondColor = secondParent.getColor();
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ if (world.plazmaConfig().carpetFixes.preparedSheepChildColor) {
|
||||||
|
+ final DyeColor color = org.plazmamc.plazma.util.CarpetFixes.properDyeMixin(firstColor, secondColor);
|
||||||
|
+ if (color != null) return color;
|
||||||
|
+ return world.random.nextBoolean() ? firstColor : secondColor;
|
||||||
|
+ }
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ final CraftingInput input = Sheep.makeCraftInput(firstColor, secondColor);
|
||||||
|
+// PLAZMA - REMOVE THIS
|
||||||
|
+ Optional<Item> result = world.recipeAccess().getRecipeFor(RecipeType.CRAFTING, input, world).map((recipeholder) -> recipeholder.value().assemble(input, world.registryAccess())).map(ItemStack::getItem);
|
||||||
|
+ result = result.filter(DyeItem.class::isInstance);
|
||||||
|
+ return result.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> world.random.nextBoolean() ? firstColor : secondColor);
|
||||||
|
+ // Plazma end - Implement CarpetFixes
|
||||||
|
}
|
||||||
|
|
||||||
|
private static CraftingInput makeCraftInput(DyeColor firstColor, DyeColor secondColor) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||||
|
index 90f8360f547ce709fd13ee34f8e67d8bfa94b498..4e5fb377696c0a98a56f9ea11d0116b28399c8f6 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
||||||
|
@@ -9,6 +9,8 @@ import net.minecraft.util.Mth;
|
||||||
|
|
||||||
|
public class BiomeManager {
|
||||||
|
public static final int CHUNK_CENTER_QUART = QuartPos.fromBlock(8);
|
||||||
|
+ public static boolean PLAZMA_CARPET_FIXES = false; // Plazma - Implement CarpetFixes
|
||||||
|
+ private static final double MAX_OFFSET = 0.450_000_000_1; // Plazma - Implement CarpetFixes
|
||||||
|
private static final int ZOOM_BITS = 2;
|
||||||
|
private static final int ZOOM = 4;
|
||||||
|
private static final int ZOOM_MASK = 3;
|
||||||
|
@@ -29,6 +31,79 @@ public class BiomeManager {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Holder<Biome> getBiome(BlockPos pos) {
|
||||||
|
+ // Plazma start - Implement CarpetFixes
|
||||||
|
+ if (PLAZMA_CARPET_FIXES) {
|
||||||
|
+ final int x2 = pos.getX() - 2;
|
||||||
|
+ final int y2 = pos.getY() - 2;
|
||||||
|
+ final int z2 = pos.getZ() - 2;
|
||||||
|
+
|
||||||
|
+ final int x = x2 >> 2;
|
||||||
|
+ final int y = y2 >> 2;
|
||||||
|
+ final int z = z2 >> 2;
|
||||||
|
+
|
||||||
|
+ final double qX = (x2 & 3) / 4.0D;
|
||||||
|
+ final double qY = (y2 & 3) / 4.0D;
|
||||||
|
+ final double qZ = (z2 & 3) / 4.0D;
|
||||||
|
+
|
||||||
|
+ int minX = 0;
|
||||||
|
+ double minD = Double.POSITIVE_INFINITY;
|
||||||
|
+ for (int bX = 0; bX < 8; ++bX) {
|
||||||
|
+ final boolean x0 = (bX & 4) == 0;
|
||||||
|
+ final boolean y0 = (bX & 2) == 0;
|
||||||
|
+ final boolean z0 = (bX & 1) == 0;
|
||||||
|
+
|
||||||
|
+ final double x1 = x0 ? qX : qX - 1.0D;
|
||||||
|
+ final double y1 = y0 ? qY : qY - 1.0D;
|
||||||
|
+ final double z1 = z0 ? qZ : qZ - 1.0D;
|
||||||
|
+
|
||||||
|
+ double maxQY = 0.0D;
|
||||||
|
+ double maxQZ = 0.0D;
|
||||||
|
+ if (bX != 0) {
|
||||||
|
+ final double maxQX = Mth.square(Math.max(x1 + MAX_OFFSET, Math.abs(x1 - MAX_OFFSET)));
|
||||||
|
+ maxQY = Mth.square(Math.max(y1 + MAX_OFFSET, Math.abs(y1 - MAX_OFFSET)));
|
||||||
|
+ maxQZ = Mth.square(Math.max(z1 + MAX_OFFSET, Math.abs(z1 - MAX_OFFSET)));
|
||||||
|
+
|
||||||
|
+ if (minD < maxQY + maxQZ + maxQX) continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int pX = x0 ? x : x + 1;
|
||||||
|
+ int pY = y0 ? y : y + 1;
|
||||||
|
+ int pZ = z0 ? z : z + 1;
|
||||||
|
+
|
||||||
|
+ long seed = this.biomeZoomSeed;
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, pX);
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, pY);
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, pZ);
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, pX);
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, pY);
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, pZ);
|
||||||
|
+
|
||||||
|
+ double dX = getFiddle(seed);
|
||||||
|
+ double sX = Mth.square(x1 + dX);
|
||||||
|
+ if (bX != 0 && minD < sX + maxQY + maxQZ) continue;
|
||||||
|
+
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
||||||
|
+ double dY = getFiddle(seed);
|
||||||
|
+ double sY = Mth.square(y1 + dY);
|
||||||
|
+ if (bX != 0 && minD < sX + sY + maxQZ) continue;
|
||||||
|
+
|
||||||
|
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
||||||
|
+ double dZ = getFiddle(seed);
|
||||||
|
+ double bD = sX + sY + Mth.square(z1 + dZ);
|
||||||
|
+
|
||||||
|
+ if (minD <= bD) continue;
|
||||||
|
+ minX = bX;
|
||||||
|
+ minD = bD;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return this.noiseBiomeSource.getNoiseBiome(
|
||||||
|
+ (minX & 4) == 0 ? x : x + 1,
|
||||||
|
+ (minX & 2) == 0 ? y : y + 1,
|
||||||
|
+ (minX & 1) == 0 ? z : z + 1
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Implement CarpetFixes
|
||||||
|
+
|
||||||
|
int i = pos.getX() - 2;
|
||||||
|
int j = pos.getY() - 2;
|
||||||
|
int k = pos.getZ() - 2;
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
index 538c572661bd92666f84e6f9ef3e9760f69f50a9..db31d0c066e92fe308e7e64075e832bec66a5c02 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
|
@@ -188,4 +188,16 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public CarpetFixes carpetFixes;
|
||||||
|
+ public class CarpetFixes extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ boolean optimizeBiomeAccess = OPTIMIZE;
|
||||||
|
+
|
||||||
|
+ @PostProcess
|
||||||
|
+ void post() {
|
||||||
|
+ net.minecraft.world.level.biome.BiomeManager.PLAZMA_CARPET_FIXES = this.optimizeBiomeAccess;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
index 36345efa302413ad4e7d6e611d182572622f76ff..d314be46a02d73e669088d3a37937c8751f7735d 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
@@ -126,4 +126,11 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public CarpetFixes carpetFixes;
|
||||||
|
+ public class CarpetFixes extends ConfigurationPart {
|
||||||
|
+
|
||||||
|
+ public boolean preparedSheepChildColor = OPTIMIZE;
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..a5b0ce75a0ffa65e357cde2d55b7a0f116a2afad
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixes.java
|
||||||
|
@@ -0,0 +1,45 @@
|
||||||
|
+package org.plazmamc.plazma.util;
|
||||||
|
+
|
||||||
|
+import net.minecraft.world.item.DyeColor;
|
||||||
|
+
|
||||||
|
+public interface CarpetFixes {
|
||||||
|
+
|
||||||
|
+ static DyeColor properDyeMixin(DyeColor firstColor, DyeColor secondColor) {
|
||||||
|
+ if (firstColor.equals(secondColor)) return firstColor;
|
||||||
|
+
|
||||||
|
+ return switch (firstColor) {
|
||||||
|
+ case WHITE -> switch (secondColor) {
|
||||||
|
+ case BLUE -> DyeColor.LIGHT_BLUE;
|
||||||
|
+ case GRAY -> DyeColor.LIGHT_GRAY;
|
||||||
|
+ case BLACK -> DyeColor.GRAY;
|
||||||
|
+ case GREEN -> DyeColor.LIME;
|
||||||
|
+ case RED -> DyeColor.PINK;
|
||||||
|
+ default -> null;
|
||||||
|
+ };
|
||||||
|
+ case BLUE -> switch (secondColor) {
|
||||||
|
+ case WHITE -> DyeColor.LIGHT_BLUE;
|
||||||
|
+ case GREEN -> DyeColor.CYAN;
|
||||||
|
+ case RED -> DyeColor.PURPLE;
|
||||||
|
+ default -> null;
|
||||||
|
+ };
|
||||||
|
+ case RED -> switch (secondColor) {
|
||||||
|
+ case YELLOW -> DyeColor.ORANGE;
|
||||||
|
+ case WHITE -> DyeColor.PINK;
|
||||||
|
+ case BLUE -> DyeColor.PURPLE;
|
||||||
|
+ default -> null;
|
||||||
|
+ };
|
||||||
|
+ case GREEN -> switch (secondColor) {
|
||||||
|
+ case BLUE -> DyeColor.CYAN;
|
||||||
|
+ case WHITE -> DyeColor.LIME;
|
||||||
|
+ default -> null;
|
||||||
|
+ };
|
||||||
|
+ case YELLOW -> secondColor.equals(DyeColor.RED) ? DyeColor.ORANGE : null;
|
||||||
|
+ case PURPLE -> secondColor.equals(DyeColor.PINK) ? DyeColor.MAGENTA : null;
|
||||||
|
+ case PINK -> secondColor.equals(DyeColor.PURPLE) ? DyeColor.MAGENTA : null;
|
||||||
|
+ case GRAY -> secondColor.equals(DyeColor.WHITE) ? DyeColor.LIGHT_GRAY : null;
|
||||||
|
+ case BLACK -> secondColor.equals(DyeColor.WHITE) ? DyeColor.GRAY : null;
|
||||||
|
+ default -> null;
|
||||||
|
+ };
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+}
|
||||||
@@ -1,39 +1,23 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
Date: Sun, 27 Oct 2024 15:07:43 +0900
|
Date: Sat, 14 Dec 2024 00:39:05 +0900
|
||||||
Subject: [PATCH] TickControl System
|
Subject: [PATCH] Ticking Controller
|
||||||
|
|
||||||
Based on snackbag/TT20
|
|
||||||
Copyright (C) 2024 snackbag, Licensed under AGPL v3.0
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
index 1c3bb7cd27d97e54cbe74465bd8a7c5faeafdf4a..fd23107e3777b79ac7d598bdd5ec9b9fb8822dbb 100644
|
index 26c5cb68b464305fde43e2e0e1a415a2425483ea..ef1b47ebb8d79fbe177d4ad08e07bd182657c5d3 100644
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -1704,6 +1704,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -1689,6 +1689,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
//this.profiler.pop(); // Purpur
|
|
||||||
org.spigotmc.WatchdogThread.tick(); // Spigot
|
|
||||||
//co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper // Purpur
|
|
||||||
+ org.plazmamc.plazma.util.TickControl.tick(); // Plazma - TickControl System
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logTickMethodTime(long tickStartTime) {
|
public void tickServer(BooleanSupplier shouldKeepTicking) {
|
||||||
|
+ org.plazmamc.plazma.util.TickingController.tick(); // Plazma - TickControl System
|
||||||
|
org.spigotmc.WatchdogThread.tick(); // Spigot
|
||||||
|
long i = Util.getNanos();
|
||||||
|
int j = this.pauseWhileEmptySeconds() * 20;
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
||||||
index a08159bf2fcfe343ca21eb996f085aa71681a7af..48e2a040f60f843493f363d2f218d2c151b27464 100644
|
index 660a142036c4e608d3d6fed6ec700a3488400bec..d092bef5e6626f000a44a0f424f247a1a69d34af 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
--- a/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/ServerWatchdog.java
|
||||||
@@ -34,6 +34,7 @@ public class ServerWatchdog implements Runnable {
|
@@ -34,6 +34,7 @@ public class ServerWatchdog implements Runnable {
|
||||||
@@ -45,53 +29,50 @@ index a08159bf2fcfe343ca21eb996f085aa71681a7af..48e2a040f60f843493f363d2f218d2c1
|
|||||||
long m = Util.getNanos();
|
long m = Util.getNanos();
|
||||||
long n = m - l;
|
long n = m - l;
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
index ebe872c4643038f0c99b289d4d5afdbedd76c6ef..eb75a457c207059591d5e42d1cd46a50facc65db 100644
|
index e1957ad2a804f1272ccd458560bd7bde4ed0fe53..97e9f64498b9eb4d595e94cc63038363092809ae 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||||
@@ -504,7 +504,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
@@ -621,7 +621,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||||
entityPlayer.playerNaturallySpawnedEvent.callEvent();
|
// this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
|
||||||
}
|
//profiler.popPush("spawnAndTick"); // Plazma - Completely remove Mojang profiler
|
||||||
// Paper end - PlayerNaturallySpawnCreaturesEvent
|
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
|
||||||
- int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
- int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||||
+ int l = org.plazmamc.plazma.util.TickControl.calc(this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING), it -> it.accelerate.randomTick, false); // Plazma - TickControl system
|
+ int k = org.plazmamc.plazma.util.TickingController.calc(this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING), it -> it.accelerate.randomTick, false); // Plazma - TickControl system
|
||||||
boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
|
List list1;
|
||||||
Iterator iterator1 = list.iterator();
|
|
||||||
|
|
||||||
|
if (flag && (this.spawnEnemies || this.spawnFriendlies)) {
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
index 6fbf3a479ee1927b1099d2678db693341491b2b7..e5721ae2d55c614bcee58868acfcd06025d9e3c8 100644
|
index 137138aa1e42d4f12ed0bc54bc25918d29120333..b1bdd91eb821dee6c20bed9adb019eda2e8395d7 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||||
@@ -832,9 +832,14 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
@@ -908,7 +908,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||||
if (incrementTicks != 12000) {
|
|
||||||
this.preciseTime += 12000 / (double) incrementTicks;
|
|
||||||
this.setDayTime(this.preciseTime);
|
this.setDayTime(this.preciseTime);
|
||||||
- } else
|
} else
|
||||||
+ } // Plazma - TickControl System
|
|
||||||
// Purpur end
|
// Purpur end
|
||||||
- this.setDayTime(this.levelData.getDayTime() + 1L);
|
- this.setDayTime(this.levelData.getDayTime() + 1L);
|
||||||
+ // Plazma start - TickControl System
|
+ // Plazma start - TickControl System
|
||||||
+ else if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.accelerate.dayTime)
|
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.accelerate.dayTime)
|
||||||
+ this.setDayTime(this.levelData.getDayTime() + org.plazmamc.plazma.util.TickControl.missedTicks() + 1L);
|
+ this.setDayTime(this.levelData.getDayTime() + org.plazmamc.plazma.util.TickingController.missedTicks() + 1L);
|
||||||
+ else
|
+ else
|
||||||
+ this.setDayTime(this.levelData.getDayTime() + 1L);
|
+ this.setDayTime(this.levelData.getDayTime() + 1L);
|
||||||
+ // Plazma end - TickControl System
|
+ // Plazma end - TickControl System
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 9ab19aa8d05384bc03c8250f8ea628a9b0a00fa2..794c012ebc2c46a1f31a71eec1753374bb2ea88c 100644
|
index 9cd39ccca746c96809e3e1862e25240714662fb2..5f8415f510bb13f9ffe16c869cf8b010c5cbb5e8 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -545,6 +545,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -562,6 +562,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tickEffects();
|
this.tickEffects();
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.potionEffect) for (int i = 0; i < org.plazmamc.plazma.util.TickControl.missedTicks(); i++) this.tickEffects(); // Plazma - TickControl System
|
+ if (plazma.Config.get().tickControl.delay.potionEffect) for (int i = 0; i < org.plazmamc.plazma.util.TickingController.missedTicks(); i++) this.tickEffects(); // Plazma - TickControl System
|
||||||
this.animStepO = this.animStep;
|
this.animStepO = this.animStep;
|
||||||
this.yBodyRotO = this.yBodyRot;
|
this.yBodyRotO = this.yBodyRot;
|
||||||
this.yHeadRotO = this.yHeadRot;
|
this.yHeadRotO = this.yHeadRot;
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/PortalProcessor.java b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
diff --git a/src/main/java/net/minecraft/world/entity/PortalProcessor.java b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
||||||
index 45761c113116ae7417e6ae99069bff35dbccdf30..1727d9d7a3787220f09b6574ce6e4c828106d680 100644
|
index b4a8249964786d484aa0767d0e73d71d2156f0e8..49505d04c737c41e4229d80a7b96d4ed0b68d083 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
--- a/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
+++ b/src/main/java/net/minecraft/world/entity/PortalProcessor.java
|
||||||
@@ -24,7 +24,7 @@ public class PortalProcessor {
|
@@ -24,7 +24,7 @@ public class PortalProcessor {
|
||||||
@@ -103,35 +84,35 @@ index 45761c113116ae7417e6ae99069bff35dbccdf30..1727d9d7a3787220f09b6574ce6e4c82
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,6 +41,14 @@ public class PortalProcessor {
|
@@ -33,6 +33,14 @@ public class PortalProcessor {
|
||||||
this.portalTime = Math.max(this.portalTime - 4, 0);
|
return this.portal.getPortalDestination(world, entity, this.entryPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Plazma start - TickControl System
|
+ // Plazma start - TickControl System
|
||||||
+ private int increaseTick() {
|
+ private int increaseTick() {
|
||||||
+ if (!org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.portalUse)
|
+ if (!plazma.Config.get().tickControl.delay.portalUse)
|
||||||
+ this.portalTime += org.plazmamc.plazma.util.TickControl.missedTicks();
|
+ this.portalTime += org.plazmamc.plazma.util.TickingController.missedTicks();
|
||||||
+ return this.portalTime++;
|
+ return this.portalTime++;
|
||||||
+ }
|
+ }
|
||||||
+ // Plazma end - TickControl System
|
+ // Plazma end - TickControl System
|
||||||
+
|
+
|
||||||
public boolean hasExpired() {
|
public Portal.Transition getPortalLocalTransition() {
|
||||||
return this.portalTime <= 0;
|
return this.portal.getLocalTransition();
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
index ffc754aa6ed61f62a0c94e9117f3008d24c0c163..744385f34727729f7ac4222ed140a9c7326147a8 100644
|
index 8c5dff4e24c1366d583ba9c7c2c15ea166a24933..96f34e3cd6fcb44f503ce25a3479997ed84c7ce7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||||
@@ -158,6 +158,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
@@ -158,6 +158,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||||
if (this.getItem().isEmpty()) {
|
if (this.getItem().isEmpty()) {
|
||||||
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||||
} else {
|
} else {
|
||||||
+ if (this.pickupDelay > 0 && org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.itemPickup) this.pickupDelay = Math.max(this.pickupDelay - org.plazmamc.plazma.util.TickControl.missedTicks(), 0); // Plazma - TickControl System
|
+ if (this.pickupDelay > 0 && plazma.Config.get().tickControl.delay.itemPickup) this.pickupDelay = Math.max(this.pickupDelay - org.plazmamc.plazma.util.TickingController.missedTicks(), 0); // Plazma - TickControl System
|
||||||
super.tick();
|
super.tick();
|
||||||
// Paper start - remove anti tick skipping measures / wall time - revert to vanilla
|
// Paper start - remove anti tick skipping measures / wall time - revert to vanilla
|
||||||
if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
|
if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||||
index 330b21946564e6a7b463a258c02fee3f91e0f057..f8e09f24e818f960ea24446675996a25ed06d9a9 100644
|
index f92b72ee0172cd878baef69b9710dbaf7e5c4495..7865f5375ab3938e326a76766517785821efe19a 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||||
@@ -302,6 +302,11 @@ public abstract class Player extends LivingEntity {
|
@@ -302,6 +302,11 @@ public abstract class Player extends LivingEntity {
|
||||||
@@ -139,31 +120,31 @@ index 330b21946564e6a7b463a258c02fee3f91e0f057..f8e09f24e818f960ea24446675996a25
|
|||||||
this.sleepCounter = 100;
|
this.sleepCounter = 100;
|
||||||
}
|
}
|
||||||
+ // Plazma start - TickControl System
|
+ // Plazma start - TickControl System
|
||||||
+ else if (this.sleepCounter < 100 && org.plazmamc.plazma.configurations.GlobalConfiguration.get().tickControl.delay.sleep && org.plazmamc.plazma.util.TickControl.missedTicks() > 0) {
|
+ else if (this.sleepCounter < 100 && plazma.Config.get().tickControl.delay.sleep && org.plazmamc.plazma.util.TickingController.missedTicks() > 0) {
|
||||||
+ this.sleepCounter += org.plazmamc.plazma.util.TickControl.missedTicks();
|
+ this.sleepCounter += org.plazmamc.plazma.util.TickingController.missedTicks();
|
||||||
+ }
|
+ }
|
||||||
+ // Plazma end - TickControl System
|
+ // Plazma end - TickControl System
|
||||||
|
|
||||||
if (!this.level().isClientSide && this.level().isDay()) {
|
if (/*!this.level().isClientSide &&*/ this.level().isDay()) { // Plazma - Remove persist 'isClientSide' flag
|
||||||
this.stopSleepInBed(false, true);
|
this.stopSleepInBed(false, true);
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java
|
diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java
|
||||||
index 8fd54bccb7af59da9113d8a289d12d8fad1fb467..e295b6b920dbb678bafe2042e4b82dc193bae4ef 100644
|
index 7fc8fcab93be9076391a2981d028831cbd02a3d2..dccc95834b4cf625b7f5ce88916cbf9a865d87a4 100644
|
||||||
--- a/src/main/java/net/minecraft/world/item/Item.java
|
--- a/src/main/java/net/minecraft/world/item/Item.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/Item.java
|
+++ b/src/main/java/net/minecraft/world/item/Item.java
|
||||||
@@ -268,7 +268,7 @@ public class Item implements FeatureElement, ItemLike {
|
@@ -260,7 +260,7 @@ public class Item implements FeatureElement, ItemLike {
|
||||||
|
|
||||||
public int getUseDuration(ItemStack stack, LivingEntity user) {
|
public int getUseDuration(ItemStack stack, LivingEntity user) {
|
||||||
FoodProperties foodProperties = stack.get(DataComponents.FOOD);
|
Consumable consumable = stack.get(DataComponents.CONSUMABLE);
|
||||||
- return foodProperties != null ? foodProperties.eatDurationTicks() : 0;
|
- return consumable != null ? consumable.consumeTicks() : 0;
|
||||||
+ return foodProperties != null ? org.plazmamc.plazma.util.TickControl.calc(foodProperties.eatDurationTicks(), it -> it.delay.itemUse, true) : 0; // Plazma - TickControl System
|
+ return consumable != null ? org.plazmamc.plazma.util.TickingController.calc(consumable.consumeTicks(), it -> it.delay.itemUse, true) : 0; // Plazma - TickControl System
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
|
public boolean releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
index 40f15a30b1a0dd2040e75045f32f33082e70aaeb..0e022da01f4526b589774a7d304d32a5562d8ce4 100644
|
index dcf2dcece3e995ce4646b931329246be19a4e1c2..b99945c052d62e293bd3e516c7e9e407d358bbb7 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||||
@@ -339,13 +339,14 @@ public abstract class BlockBehaviour implements FeatureElement {
|
@@ -336,13 +336,14 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||||
protected float getDestroyProgress(BlockState state, Player player, BlockGetter world, BlockPos pos) {
|
protected float getDestroyProgress(BlockState state, Player player, BlockGetter world, BlockPos pos) {
|
||||||
float f = state.getDestroySpeed(world, pos);
|
float f = state.getDestroySpeed(world, pos);
|
||||||
|
|
||||||
@@ -176,7 +157,7 @@ index 40f15a30b1a0dd2040e75045f32f33082e70aaeb..0e022da01f4526b589774a7d304d32a5
|
|||||||
- }
|
- }
|
||||||
+ // Plazma start - TickControl system
|
+ // Plazma start - TickControl system
|
||||||
+ if (f == -1.0F) return 0.0F;
|
+ if (f == -1.0F) return 0.0F;
|
||||||
+ return org.plazmamc.plazma.util.TickControl.calc(
|
+ return org.plazmamc.plazma.util.TickingController.calc(
|
||||||
+ player.getDestroySpeed(state) / f / (player.hasCorrectToolForDrops(state) ? 30 : 100),
|
+ player.getDestroySpeed(state) / f / (player.hasCorrectToolForDrops(state) ? 30 : 100),
|
||||||
+ it -> it.delay.blockBreak,
|
+ it -> it.delay.blockBreak,
|
||||||
+ false
|
+ false
|
||||||
@@ -186,69 +167,69 @@ index 40f15a30b1a0dd2040e75045f32f33082e70aaeb..0e022da01f4526b589774a7d304d32a5
|
|||||||
|
|
||||||
protected void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {}
|
protected void spawnAfterBreak(BlockState state, ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) {}
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
index 9cc1a79dd25c63af6986e721ceff5560cf56b7d1..c45224e142905921305da51139d5fd3f51583cca 100644
|
index 2966caede97e01b5ad15a0d56232a0f5526685e2..f1baa2a5ba541fb4a99500b2c79326dec1cd0128 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||||
@@ -1036,8 +1036,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
@@ -1076,8 +1076,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
this.chunkCoordinateKey = chunkCoordinateKey; // Plazma - Port SparklyPaper patches; Optimize TickingBlockEntity
|
this.chunkCoordinateKey = chunkCoordinateKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Plazma start - TickControl System
|
+ // Plazma start - TickControl System
|
||||||
+ private void tickTicker(BlockState iblockdata) {
|
+ private void tickTicker(BlockState state) {
|
||||||
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
|
||||||
+
|
+
|
||||||
+ if (!org.plazmamc.plazma.util.TickControl.shouldTickAgain(iblockdata.getBlock())) return;
|
+ if (!org.plazmamc.plazma.util.TickingController.shouldTickAgain(state.getBlock())) return;
|
||||||
+ for (int i = 0; i < org.plazmamc.plazma.util.TickControl.missedTicks(); i++)
|
+ for (int i = 0; i < org.plazmamc.plazma.util.TickingController.missedTicks(); i++)
|
||||||
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
+ this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
|
||||||
+ }
|
+ }
|
||||||
+ // Plazma end - TickControl System
|
+ // Plazma end - TickControl System
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
- public void tick() {
|
- public void tick() {
|
||||||
+ public final void tick() { // Plazma - TickControl System (make final)
|
+ public final void tick() { // Plazma - TickControl System (make final)
|
||||||
if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) {
|
if (this.blockEntity.isRemoved() || !this.blockEntity.hasLevel()) return;
|
||||||
BlockPos blockposition = this.blockEntity.getBlockPos();
|
|
||||||
|
|
||||||
@@ -1050,7 +1060,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
BlockPos pos = this.blockEntity.getBlockPos();
|
||||||
BlockState iblockdata = LevelChunk.this.getBlockState(blockposition);
|
@@ -1087,7 +1097,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||||
|
BlockState state = LevelChunk.this.getBlockState(pos);
|
||||||
|
|
||||||
if (this.blockEntity.getType().isValid(iblockdata)) {
|
if (this.blockEntity.getType().isValid(state)) {
|
||||||
- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), iblockdata, this.blockEntity);
|
- this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), state, this.blockEntity);
|
||||||
+ this.tickTicker(iblockdata); // Plazma - TickControl System
|
+ this.tickTicker(state); // Plazma - TickControl System
|
||||||
this.loggedInvalidBlockState = false;
|
this.loggedInvalidBlockState = false;
|
||||||
// Paper start - Remove the Block Entity if it's invalid
|
// Paper start - Remove the Block Entity if it's invalid
|
||||||
} else {
|
} else {
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||||
index 2d492d849ff73a738dfbcb16507feb89bf19a962..67206b9c754dfe90002e0bcf6995eae60b852acd 100644
|
index 6e643c1a7f7e71cfd20603facaf224985ee81716..cbbbcf8a915a4146eb63e29ba5dd91354ac7228b 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
|
||||||
@@ -180,7 +180,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
@@ -181,7 +181,7 @@ public abstract class LavaFluid extends FlowingFluid {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTickDelay(LevelReader world) {
|
public int getTickDelay(LevelReader world) {
|
||||||
- return world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur
|
- return world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether; // Purpur
|
||||||
+ return org.plazmamc.plazma.util.TickControl.calc(world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, it -> it.delay.lavaFluid, true); // Purpur // Plazma - TickControl system
|
+ return org.plazmamc.plazma.util.TickingController.calc(world.dimensionType().ultraWarm() ? world.getWorldBorder().world.purpurConfig.lavaSpeedNether : world.getWorldBorder().world.purpurConfig.lavaSpeedNotNether, it -> it.delay.lavaFluid, true); // Purpur // Plazma - TickControl system
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||||
index 0fc89b33864000a262ec5369708f7aedeaf6dc0b..5055730053d9d9c1da0a5252654c936c75d04fb6 100644
|
index 028aea6640356ba80f5d682e3cc03b7f82f5b9c7..d788849dc5a568d455cd83ca5b6e1b4ba1a9161f 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
--- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
+++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java
|
||||||
@@ -122,7 +122,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
@@ -123,7 +123,7 @@ public abstract class WaterFluid extends FlowingFluid {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTickDelay(LevelReader world) {
|
public int getTickDelay(LevelReader world) {
|
||||||
- return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed
|
- return world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick; // Plazma - Configurable water flowing speed
|
||||||
+ return org.plazmamc.plazma.util.TickControl.calc(world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick, it -> it.delay.waterFluid, true); // Plazma - Configurable water flowing speed; TickControl System
|
+ return org.plazmamc.plazma.util.TickingController.calc(world.getWorldBorder().world.plazmaConfig().block.waterFlowingTick, it -> it.delay.waterFluid, true); // Plazma - Configurable water flowing speed // Plazma - TickControl System
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
index 49bce6e28e12f3729cab5628cf3e0f508a56d0d7..2a88a25793e6d963a9a08e615a72c6ed1677a18b 100644
|
index db31d0c066e92fe308e7e64075e832bec66a5c02..04a8bb41b27b8c435203991bebddccb27f472cdb 100644
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
||||||
@@ -146,4 +146,39 @@ public class GlobalConfiguration extends ConfigurationPart {
|
@@ -200,4 +200,39 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,18 +263,18 @@ index 49bce6e28e12f3729cab5628cf3e0f508a56d0d7..2a88a25793e6d963a9a08e615a72c6ed
|
|||||||
+
|
+
|
||||||
+ @PostProcess
|
+ @PostProcess
|
||||||
+ void post() {
|
+ void post() {
|
||||||
+ org.plazmamc.plazma.util.TickControl.post(this);
|
+ org.plazmamc.plazma.util.TickingController.post(this);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/util/TickControl.java b/src/main/java/org/plazmamc/plazma/util/TickControl.java
|
diff --git a/src/main/java/org/plazmamc/plazma/util/TickingController.java b/src/main/java/org/plazmamc/plazma/util/TickingController.java
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd73eab8d8
|
index 0000000000000000000000000000000000000000..0e71a47a639a1a3dd0918c5a403ed827aca67966
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/util/TickControl.java
|
+++ b/src/main/java/org/plazmamc/plazma/util/TickingController.java
|
||||||
@@ -0,0 +1,57 @@
|
@@ -0,0 +1,56 @@
|
||||||
+package org.plazmamc.plazma.util;
|
+package org.plazmamc.plazma.util;
|
||||||
+
|
+
|
||||||
+import net.minecraft.world.level.block.Block;
|
+import net.minecraft.world.level.block.Block;
|
||||||
@@ -304,14 +285,13 @@ index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd
|
|||||||
+
|
+
|
||||||
+import static net.minecraft.server.MinecraftServer.getServer;
|
+import static net.minecraft.server.MinecraftServer.getServer;
|
||||||
+
|
+
|
||||||
+public final class TickControl {
|
+public final class TickingController {
|
||||||
+
|
+
|
||||||
+
|
+ private static @Nullable TickingController INSTANCE;
|
||||||
+ private static @Nullable TickControl INSTANCE;
|
|
||||||
+ private final GlobalConfiguration.TickControl configuration;
|
+ private final GlobalConfiguration.TickControl configuration;
|
||||||
+ private int missedTicks = 0;
|
+ private int missedTicks = 0;
|
||||||
+
|
+
|
||||||
+ private TickControl(GlobalConfiguration.TickControl configuration) {
|
+ private TickingController(GlobalConfiguration.TickControl configuration) {
|
||||||
+ this.configuration = configuration;
|
+ this.configuration = configuration;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -327,7 +307,7 @@ index 0000000000000000000000000000000000000000..c8db7b9f590a34b38448a970baaa79dd
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ INSTANCE = new TickControl(configuration);
|
+ INSTANCE = new TickingController(configuration);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public static float calc(float original, @NonNull Function<GlobalConfiguration.TickControl, Boolean> isAffected, boolean swap) {
|
+ public static float calc(float original, @NonNull Function<GlobalConfiguration.TickControl, Boolean> isAffected, boolean swap) {
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Sat, 14 Dec 2024 01:03:07 +0900
|
||||||
|
Subject: [PATCH] Add option to disable beacon effect ambient
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
index 69ef5c805d802575a639027fd40064d92fcfe89d..31d6bf6c1bcca32ce8a8a8810807dec4d5000ab9 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
|
||||||
|
@@ -368,24 +368,20 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- private static void applyEffect(List list, @Nullable Holder<MobEffect> holder, int j, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent
|
||||||
|
- if (!list.isEmpty()) { // Paper - BeaconEffectEvent
|
||||||
|
- Iterator iterator = list.iterator();
|
||||||
|
+ private static void applyEffect(List<Player> list, @Nullable Holder<MobEffect> holder, int j, int b0, boolean isPrimary, BlockPos worldPosition) { // Paper - BeaconEffectEvent
|
||||||
|
+ if (list.isEmpty()) return;
|
||||||
|
|
||||||
|
- Player entityhuman;
|
||||||
|
+ // Paper start - BeaconEffectEvent
|
||||||
|
+ org.bukkit.craftbukkit.block.CraftBlock block = org.bukkit.craftbukkit.block.CraftBlock.at(list.getFirst().level(), worldPosition);
|
||||||
|
+ PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(holder, j, b0, true, !(block).getCraftWorld().getHandle().plazmaConfig().entity.disableBeaconEffectAmbient, true));
|
||||||
|
+ // Paper end - BeaconEffectEvent
|
||||||
|
+
|
||||||
|
+ for (final Player player : list) {
|
||||||
|
// Paper start - BeaconEffectEvent
|
||||||
|
- org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(((Player) list.get(0)).level(), worldPosition);
|
||||||
|
- PotionEffect effect = CraftPotionUtil.toBukkit(new MobEffectInstance(holder, j, b0, true, true));
|
||||||
|
+ BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) player.getBukkitEntity(), isPrimary);
|
||||||
|
+ if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||||
|
+ player.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||||
|
// Paper end - BeaconEffectEvent
|
||||||
|
-
|
||||||
|
- while (iterator.hasNext()) {
|
||||||
|
- // Paper start - BeaconEffectEvent
|
||||||
|
- entityhuman = (ServerPlayer) iterator.next();
|
||||||
|
- BeaconEffectEvent event = new BeaconEffectEvent(block, effect, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), isPrimary);
|
||||||
|
- if (CraftEventFactory.callEvent(event).isCancelled()) continue;
|
||||||
|
- entityhuman.addEffect(new MobEffectInstance(CraftPotionUtil.fromBukkit(event.getEffect())), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.BEACON);
|
||||||
|
- // Paper end - BeaconEffectEvent
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
index ee7655924358642d4fc58c261decd808ff7f8019..943ef13e5a94e225725d2b390ec11bee677a6cf4 100644
|
||||||
|
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
||||||
|
@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart {
|
||||||
|
|
||||||
|
public int sensorTick = 1;
|
||||||
|
public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;
|
||||||
|
+ public boolean disableBeaconEffectAmbient = false;
|
||||||
|
|
||||||
|
public Phantom phantom;
|
||||||
|
public class Phantom extends ConfigurationPart {
|
||||||
36
patches/server/0060-Tick-toggle-subcommand.patch
Normal file
36
patches/server/0060-Tick-toggle-subcommand.patch
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: AlphaKR93 <dev@alpha93.kr>
|
||||||
|
Date: Sat, 14 Dec 2024 11:06:41 +0900
|
||||||
|
Subject: [PATCH] Tick toggle subcommand
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/commands/TickCommand.java b/src/main/java/net/minecraft/server/commands/TickCommand.java
|
||||||
|
index 13d96b54f48d60b098b80e04ba6168762c335c75..5aab945085eb4ed2ea44832319c6daad96fe3a71 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/commands/TickCommand.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/commands/TickCommand.java
|
||||||
|
@@ -21,6 +21,10 @@ public class TickCommand {
|
||||||
|
dispatcher.register(
|
||||||
|
Commands.literal("tick")
|
||||||
|
.requires(source -> source.hasPermission(3))
|
||||||
|
+ // Plazma start - Tick toggle subcommand
|
||||||
|
+ .executes(context -> toggleFreeze(context.getSource()))
|
||||||
|
+ .then(Commands.literal("toggle").executes(context -> toggleFreeze(context.getSource())))
|
||||||
|
+ // Plazma end - Tick toggle subcommand
|
||||||
|
.then(Commands.literal("query").executes(context -> tickQuery(context.getSource())))
|
||||||
|
.then(
|
||||||
|
Commands.literal("rate")
|
||||||
|
@@ -108,6 +112,14 @@ public class TickCommand {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Plazma start - Tick toggle subcommand
|
||||||
|
+ private static int toggleFreeze(CommandSourceStack source) {
|
||||||
|
+ ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager();
|
||||||
|
+ boolean frozen = !serverTickRateManager.isFrozen();
|
||||||
|
+ return setFreeze(source, frozen);
|
||||||
|
+ }
|
||||||
|
+ // Plazma end - Tick toggle subcommand
|
||||||
|
+
|
||||||
|
private static int setFreeze(CommandSourceStack source, boolean frozen) {
|
||||||
|
ServerTickRateManager serverTickRateManager = source.getServer().tickRateManager();
|
||||||
|
if (frozen) {
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,897 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Wed, 10 Jan 2024 12:43:26 +0900
|
|
||||||
Subject: [PATCH] Reduce allocations
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java b/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java
|
|
||||||
index ad1eeebe6de219143492b94da309cb54ae9e0a5b..f83bdcf5d2d6f676b2dc83bc1fc0a7453fc2b36a 100644
|
|
||||||
--- a/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java
|
|
||||||
+++ b/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java
|
|
||||||
@@ -38,6 +38,7 @@ public abstract class StarLightEngine {
|
|
||||||
AxisDirection.POSITIVE_X, AxisDirection.NEGATIVE_X,
|
|
||||||
AxisDirection.POSITIVE_Z, AxisDirection.NEGATIVE_Z
|
|
||||||
};
|
|
||||||
+ private static final AxisDirection[] EMPTY_DIRECTIONS = new AxisDirection[0]; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
protected static enum AxisDirection {
|
|
||||||
|
|
||||||
@@ -1094,7 +1095,7 @@ public abstract class StarLightEngine {
|
|
||||||
for (int bitset = i, len = Integer.bitCount(i), index = 0; index < len; ++index, bitset ^= IntegerUtil.getTrailingBit(bitset)) {
|
|
||||||
directions.add(AXIS_DIRECTIONS[IntegerUtil.trailingZeros(bitset)]);
|
|
||||||
}
|
|
||||||
- OLD_CHECK_DIRECTIONS[i] = directions.toArray(new AxisDirection[0]);
|
|
||||||
+ OLD_CHECK_DIRECTIONS[i] = directions.toArray(EMPTY_DIRECTIONS); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
|
||||||
index e7fe98ea30ae6d0baea3ec1f9f98a89502a49a12..7663ccd247b9942ccfb7a320b047ee621fc1bebe 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
|
||||||
@@ -97,8 +97,8 @@ public final class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockCo
|
|
||||||
Set<BlockState> presetBlockStateSet = new LinkedHashSet<>();
|
|
||||||
// Therefore addAll(Collection<? extends E>) is used, which guarantees this order in the doc
|
|
||||||
presetBlockStateSet.addAll(presetBlockStateList);
|
|
||||||
- presetBlockStates = presetBlockStateSet.isEmpty() ? new BlockState[]{Blocks.DIAMOND_ORE.defaultBlockState()} : presetBlockStateSet.toArray(new BlockState[0]);
|
|
||||||
- presetBlockStatesFull = presetBlockStateSet.isEmpty() ? new BlockState[]{Blocks.DIAMOND_ORE.defaultBlockState()} : presetBlockStateList.toArray(new BlockState[0]);
|
|
||||||
+ presetBlockStates = presetBlockStateSet.isEmpty() ? new BlockState[]{Blocks.DIAMOND_ORE.defaultBlockState()} : presetBlockStateSet.toArray(org.plazmamc.plazma.constants.Empty.BLOCK_STATE); // Plazma - Reduce allocations
|
|
||||||
+ presetBlockStatesFull = presetBlockStateSet.isEmpty() ? new BlockState[]{Blocks.DIAMOND_ORE.defaultBlockState()} : presetBlockStateList.toArray(org.plazmamc.plazma.constants.Empty.BLOCK_STATE); // Plazma - Reduce allocations
|
|
||||||
presetBlockStatesStone = null;
|
|
||||||
presetBlockStatesDeepslate = null;
|
|
||||||
presetBlockStatesNetherrack = null;
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
|
|
||||||
index 0133ea6feb1ab88f021f66855669f58367e7420b..a04049bc7738225633ac0b01c470cfbfde86c032 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
|
|
||||||
@@ -17,9 +17,9 @@ public final class EntityList implements Iterable<Entity> {
|
|
||||||
this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
- protected static final Entity[] EMPTY_LIST = new Entity[0];
|
|
||||||
+ //protected static final Entity[] EMPTY_LIST = new Entity[0]; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
- protected Entity[] entities = EMPTY_LIST;
|
|
||||||
+ protected Entity[] entities = org.plazmamc.plazma.constants.Empty.ENTITY; // Plazma - Reduce allocations
|
|
||||||
protected int count;
|
|
||||||
|
|
||||||
public int size() {
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
|
|
||||||
index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..30d8d9c2dce5e4eb26cc52a03bc395c16c04c256 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
|
|
||||||
@@ -20,9 +20,9 @@ public final class IBlockDataList {
|
|
||||||
this.map.defaultReturnValue(Long.MAX_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static final long[] EMPTY_LIST = new long[0];
|
|
||||||
+ //private static final long[] EMPTY_LIST = new long[0]; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
- private long[] byIndex = EMPTY_LIST;
|
|
||||||
+ private long[] byIndex = org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations
|
|
||||||
private int size;
|
|
||||||
|
|
||||||
public static int getLocationKey(final int x, final int y, final int z) {
|
|
||||||
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java
|
|
||||||
index 190c5f0b02a3d99054704ae1afbffb3498ddffe1..042ea49ec61ee327c0f67ddcf080774042e44c02 100644
|
|
||||||
--- a/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java
|
|
||||||
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/ReferenceList.java
|
|
||||||
@@ -15,9 +15,9 @@ public final class ReferenceList<E> implements Iterable<E> {
|
|
||||||
this.referenceToIndex.defaultReturnValue(Integer.MIN_VALUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
- protected static final Object[] EMPTY_LIST = new Object[0];
|
|
||||||
+ //protected static final Object[] EMPTY_LIST = new Object[0]; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
- protected Object[] references = EMPTY_LIST;
|
|
||||||
+ protected Object[] references = org.plazmamc.plazma.constants.Empty.OBJECT; // Plazma - Reduce allocations
|
|
||||||
protected int count;
|
|
||||||
|
|
||||||
public int size() {
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java
|
|
||||||
index 049e20407..bbd0b944c 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/ChunkTaskScheduler.java
|
|
||||||
@@ -42,6 +42,7 @@ import java.util.function.Consumer;
|
|
||||||
public final class ChunkTaskScheduler {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LogUtils.getClassLogger();
|
|
||||||
+ private static final ChunkInfo[] EMPTY_INFO = new ChunkInfo[0]; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
static int newChunkSystemIOThreads;
|
|
||||||
static int newChunkSystemWorkerThreads;
|
|
||||||
@@ -854,7 +855,7 @@ public final class ChunkTaskScheduler {
|
|
||||||
|
|
||||||
public static ChunkInfo[] getChunkInfos() {
|
|
||||||
synchronized (WAITING_CHUNKS) {
|
|
||||||
- return WAITING_CHUNKS.toArray(new ChunkInfo[0]);
|
|
||||||
+ return WAITING_CHUNKS.toArray(EMPTY_INFO); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java
|
|
||||||
index ae60bd96b5284d54676d8e7e4dd5d170b526ec1e..359c4b080bd47234e569dce7055da03ddb7b1e90 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/command/subcommands/VersionCommand.java
|
|
||||||
@@ -14,7 +14,7 @@ public final class VersionCommand implements PaperSubcommand {
|
|
||||||
public boolean execute(final CommandSender sender, final String subCommand, final String[] args) {
|
|
||||||
final @Nullable Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
|
|
||||||
if (ver != null) {
|
|
||||||
- ver.execute(sender, "paper", new String[0]);
|
|
||||||
+ ver.execute(sender, "paper", org.plazmamc.plazma.constants.Empty.STRING); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
|
||||||
index 3e82ea07c..692bef556 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
|
|
||||||
@@ -47,6 +47,8 @@ import java.util.logging.Level;
|
|
||||||
class PaperPluginInstanceManager {
|
|
||||||
|
|
||||||
private static final FileProviderSource FILE_PROVIDER_SOURCE = new FileProviderSource("File '%s'"::formatted);
|
|
||||||
+ private static final JavaPlugin[] EMPTY_JPLUGIN = new JavaPlugin[0]; // Plazma - Reduce allocations
|
|
||||||
+ private static final Plugin[] EMPTY_PLUGIN = new Plugin[0]; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
private final List<Plugin> plugins = new ArrayList<>();
|
|
||||||
private final Map<String, Plugin> lookupNames = new HashMap<>();
|
|
||||||
@@ -68,7 +70,7 @@ class PaperPluginInstanceManager {
|
|
||||||
}
|
|
||||||
|
|
||||||
public @NotNull Plugin[] getPlugins() {
|
|
||||||
- return this.plugins.toArray(new Plugin[0]);
|
|
||||||
+ return this.plugins.toArray(EMPTY_PLUGIN); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPluginEnabled(@NotNull String name) {
|
|
||||||
@@ -133,7 +135,7 @@ class PaperPluginInstanceManager {
|
|
||||||
this.server.getLogger().log(Level.SEVERE, "Unknown error occurred while loading plugins through PluginManager.", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
- return runtimePluginEntrypointHandler.getPluginProviderStorage().getLoaded().toArray(new JavaPlugin[0]);
|
|
||||||
+ return runtimePluginEntrypointHandler.getPluginProviderStorage().getLoaded().toArray(EMPTY_JPLUGIN); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
// The behavior of this is that all errors are logged instead of being thrown
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
|
||||||
index ee8e9c0e3..f2598e139 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
|
||||||
@@ -1149,7 +1149,7 @@ public final class CollisionUtil {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final MergedVoxelCoordinateList EMPTY = new MergedVoxelCoordinateList(
|
|
||||||
- new double[] { 0.0 }, 0.0, new int[0], new int[0], 0
|
|
||||||
+ new double[] { 0.0 }, 0.0, org.plazmamc.plazma.constants.Empty.INT, org.plazmamc.plazma.constants.Empty.INT, 0 // Plazma - Reduce allocations
|
|
||||||
);
|
|
||||||
|
|
||||||
private static int[] getIndices(final int length) {
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
||||||
index c78cbec447032de9fe69748591bef6be300160ed..8ca248e844e73685a8d44a966144657315a799aa 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
||||||
@@ -304,7 +304,7 @@ public final class ChunkEntitySlices {
|
|
||||||
|
|
||||||
protected static final class BasicEntityList<E extends Entity> {
|
|
||||||
|
|
||||||
- protected static final Entity[] EMPTY = new Entity[0];
|
|
||||||
+ //protected static final Entity[] EMPTY = new Entity[0]; // Plazma - Reduce allocations
|
|
||||||
protected static final int DEFAULT_CAPACITY = 4;
|
|
||||||
|
|
||||||
protected E[] storage;
|
|
||||||
@@ -315,7 +315,7 @@ public final class ChunkEntitySlices {
|
|
||||||
}
|
|
||||||
|
|
||||||
public BasicEntityList(final int cap) {
|
|
||||||
- this.storage = (E[])(cap <= 0 ? EMPTY : new Entity[cap]);
|
|
||||||
+ this.storage = (E[])(cap <= 0 ? org.plazmamc.plazma.constants.Empty.ENTITY : new Entity[cap]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
@@ -327,7 +327,7 @@ public final class ChunkEntitySlices {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resize() {
|
|
||||||
- if (this.storage == EMPTY) {
|
|
||||||
+ if (this.storage == org.plazmamc.plazma.constants.Empty.ENTITY) {
|
|
||||||
this.storage = (E[])new Entity[DEFAULT_CAPACITY];
|
|
||||||
} else {
|
|
||||||
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
|
|
||||||
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
|
|
||||||
index c5a3f9c2daf3da135cccecb757353534e1688821..e5585c6befeef62ecf130e8dabbe6b78f9e90a65 100644
|
|
||||||
--- a/src/main/java/net/minecraft/CrashReport.java
|
|
||||||
+++ b/src/main/java/net/minecraft/CrashReport.java
|
|
||||||
@@ -30,7 +30,7 @@ public class CrashReport {
|
|
||||||
@Nullable
|
|
||||||
private File saveFile;
|
|
||||||
private boolean trackingStackTrace = true;
|
|
||||||
- private StackTraceElement[] uncategorizedStackTrace = new StackTraceElement[0];
|
|
||||||
+ private StackTraceElement[] uncategorizedStackTrace = org.plazmamc.plazma.constants.Empty.TRACE; // Plazma - Reduce allocations
|
|
||||||
private final SystemReport systemReport = new SystemReport();
|
|
||||||
|
|
||||||
public CrashReport(String message, Throwable cause) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/CrashReportCategory.java b/src/main/java/net/minecraft/CrashReportCategory.java
|
|
||||||
index 2176171954609fd88f97f93408e14e018c1d6eaa..2a5576dc66a9b1f56e06ba47bef4fe882935c382 100644
|
|
||||||
--- a/src/main/java/net/minecraft/CrashReportCategory.java
|
|
||||||
+++ b/src/main/java/net/minecraft/CrashReportCategory.java
|
|
||||||
@@ -12,7 +12,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
public class CrashReportCategory {
|
|
||||||
private final String title;
|
|
||||||
private final List<CrashReportCategory.Entry> entries = Lists.newArrayList();
|
|
||||||
- private StackTraceElement[] stackTrace = new StackTraceElement[0];
|
|
||||||
+ private StackTraceElement[] stackTrace = org.plazmamc.plazma.constants.Empty.TRACE; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
public CrashReportCategory(String title) {
|
|
||||||
this.title = title;
|
|
||||||
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
|
|
||||||
index 01a12f4d6f3c2f09bffc78692443b9fd391db45a..9a6e4538dd09263544f39c93f5f1480dc589fb4d 100644
|
|
||||||
--- a/src/main/java/net/minecraft/Util.java
|
|
||||||
+++ b/src/main/java/net/minecraft/Util.java
|
|
||||||
@@ -409,7 +409,7 @@ public class Util {
|
|
||||||
} else if (futures.size() == 1) {
|
|
||||||
return futures.get(0).thenApply(List::of);
|
|
||||||
} else {
|
|
||||||
- CompletableFuture<Void> completableFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0]));
|
|
||||||
+ CompletableFuture<Void> completableFuture = CompletableFuture.allOf(futures.toArray(org.plazmamc.plazma.constants.Empty.FUTURE)); // Plazma - Reduce allocations
|
|
||||||
return completableFuture.thenApply(void_ -> futures.stream().map(CompletableFuture::join).toList());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/ByteArrayTag.java b/src/main/java/net/minecraft/nbt/ByteArrayTag.java
|
|
||||||
index 06648f9751fd8a322d0809ffebf6a544596ee1a4..b0ea87e2ed8f9bf04b33c2ff8a827d4f6f57a435 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/ByteArrayTag.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/ByteArrayTag.java
|
|
||||||
@@ -175,7 +175,7 @@ public class ByteArrayTag extends CollectionTag<ByteTag> {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
- this.data = new byte[0];
|
|
||||||
+ this.data = org.plazmamc.plazma.constants.Empty.BYTE; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
|
||||||
index 4e005b7b0..059a1e49f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
|
||||||
@@ -409,7 +409,7 @@ public class CompoundTag implements Tag {
|
|
||||||
throw new ReportedException(this.createReport(key, ByteArrayTag.TYPE, var3));
|
|
||||||
}
|
|
||||||
|
|
||||||
- return new byte[0];
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.BYTE; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getIntArray(String key) {
|
|
||||||
@@ -421,7 +421,7 @@ public class CompoundTag implements Tag {
|
|
||||||
throw new ReportedException(this.createReport(key, IntArrayTag.TYPE, var3));
|
|
||||||
}
|
|
||||||
|
|
||||||
- return new int[0];
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.INT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public long[] getLongArray(String key) {
|
|
||||||
@@ -433,7 +433,7 @@ public class CompoundTag implements Tag {
|
|
||||||
throw new ReportedException(this.createReport(key, LongArrayTag.TYPE, var3));
|
|
||||||
}
|
|
||||||
|
|
||||||
- return new long[0];
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public CompoundTag getCompound(String key) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/IntArrayTag.java b/src/main/java/net/minecraft/nbt/IntArrayTag.java
|
|
||||||
index ff13d67151c50ea11a45117e524c7524e2b1a202..5048ec707c147b9a5b2dd8736d518d938ba95df0 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/IntArrayTag.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/IntArrayTag.java
|
|
||||||
@@ -186,7 +186,7 @@ public class IntArrayTag extends CollectionTag<IntTag> {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
- this.data = new int[0];
|
|
||||||
+ this.data = org.plazmamc.plazma.constants.Empty.INT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
|
|
||||||
index 154bffd34..83c36d452 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/ListTag.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
|
|
||||||
@@ -258,7 +258,7 @@ public class ListTag extends CollectionTag<Tag> {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- return new int[0];
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.INT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public long[] getLongArray(int index) {
|
|
||||||
@@ -269,7 +269,7 @@ public class ListTag extends CollectionTag<Tag> {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- return new long[0];
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDouble(int index) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/LongArrayTag.java b/src/main/java/net/minecraft/nbt/LongArrayTag.java
|
|
||||||
index 2e5c34ebb94a1536cf09d71bdf052a49ecb9159d..144d3bbe80fc0f459a06017a19929e3e849aabd0 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/LongArrayTag.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/LongArrayTag.java
|
|
||||||
@@ -185,7 +185,7 @@ public class LongArrayTag extends CollectionTag<LongTag> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
- this.data = new long[0];
|
|
||||||
+ this.data = org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/nbt/NbtIo.java b/src/main/java/net/minecraft/nbt/NbtIo.java
|
|
||||||
index 9f659af04..d2969c1ce 100644
|
|
||||||
--- a/src/main/java/net/minecraft/nbt/NbtIo.java
|
|
||||||
+++ b/src/main/java/net/minecraft/nbt/NbtIo.java
|
|
||||||
@@ -277,7 +277,7 @@ public class NbtIo {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public static CompoundTag read(Path path) throws IOException {
|
|
||||||
- if (!Files.exists(path, new LinkOption[0])) {
|
|
||||||
+ if (!Files.exists(path/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
InputStream inputstream = Files.newInputStream(path);
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/CipherBase.java b/src/main/java/net/minecraft/network/CipherBase.java
|
|
||||||
index a2920b8a9eff77d9c5d1d7f70ad3abdacba8f0fa..70d776d5cfdb0612f65d92333d6f872afedc2207 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/CipherBase.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/CipherBase.java
|
|
||||||
@@ -7,8 +7,8 @@ import javax.crypto.ShortBufferException;
|
|
||||||
|
|
||||||
public class CipherBase {
|
|
||||||
private final Cipher cipher;
|
|
||||||
- private byte[] heapIn = new byte[0];
|
|
||||||
- private byte[] heapOut = new byte[0];
|
|
||||||
+ private byte[] heapIn = org.plazmamc.plazma.constants.Empty.BYTE; // Plazma - Reduce allocations
|
|
||||||
+ private byte[] heapOut = org.plazmamc.plazma.constants.Empty.BYTE; // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
protected CipherBase(Cipher cipher) {
|
|
||||||
this.cipher = cipher;
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
|
||||||
index 9f274048b..ba54c16f1 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
|
||||||
@@ -316,7 +316,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateListener(ProtocolInfo<?> state, PacketListener listener) {
|
|
||||||
- Validate.notNull(listener, "packetListener", new Object[0]);
|
|
||||||
+ Validate.notNull(listener, "packetListener"/*, new Object[0]*/); // Plazma - Reduce allocations
|
|
||||||
PacketFlow enumprotocoldirection = listener.flow();
|
|
||||||
String s;
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
index 6dcade427..4a0b4b0fa 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/Component.java
|
|
||||||
@@ -189,7 +189,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
}
|
|
||||||
|
|
||||||
static MutableComponent translatable(String key) {
|
|
||||||
- return MutableComponent.create(new TranslatableContents(key, (String) null, TranslatableContents.NO_ARGS));
|
|
||||||
+ return MutableComponent.create(new TranslatableContents(key, (String) null, org.plazmamc.plazma.constants.Empty.OBJECT)); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
static MutableComponent translatable(String key, Object... args) {
|
|
||||||
@@ -209,7 +209,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
|
|
||||||
}
|
|
||||||
|
|
||||||
static MutableComponent translatableWithFallback(String key, @Nullable String fallback) {
|
|
||||||
- return MutableComponent.create(new TranslatableContents(key, fallback, TranslatableContents.NO_ARGS));
|
|
||||||
+ return MutableComponent.create(new TranslatableContents(key, fallback, org.plazmamc.plazma.constants.Empty.OBJECT)); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
static MutableComponent translatableWithFallback(String key, @Nullable String fallback, Object... args) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
|
|
||||||
index 4aa6232bf..84e8a29f0 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java
|
|
||||||
@@ -29,7 +29,7 @@ import net.minecraft.util.ExtraCodecs;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
|
|
||||||
public class TranslatableContents implements ComponentContents {
|
|
||||||
- public static final Object[] NO_ARGS = new Object[0];
|
|
||||||
+ // public static final Object[] NO_ARGS = new Object[0]; // Plazma - Reduce allocations
|
|
||||||
private static final Codec<Object> PRIMITIVE_ARG_CODEC = ExtraCodecs.JAVA.validate(TranslatableContents::filterAllowedArguments);
|
|
||||||
private static final Codec<Object> ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, ComponentSerialization.CODEC)
|
|
||||||
.xmap(
|
|
||||||
@@ -69,7 +69,7 @@ public class TranslatableContents implements ComponentContents {
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Object[] adjustArgs(Optional<List<Object>> args) {
|
|
||||||
- return args.<Object[]>map(list -> list.isEmpty() ? NO_ARGS : list.toArray()).orElse(NO_ARGS);
|
|
||||||
+ return args.<Object[]>map(list -> list.isEmpty() ? org.plazmamc.plazma.constants.Empty.OBJECT : list.toArray()).orElse(org.plazmamc.plazma.constants.Empty.OBJECT); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
private static TranslatableContents create(String key, Optional<String> fallback, Optional<List<Object>> args) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
|
||||||
index 1a37654af..0e61f8cb3 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
|
|
||||||
@@ -66,7 +66,7 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet<ClientGamePa
|
|
||||||
public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, it.unimi.dsi.fastutil.shorts.Short2ObjectMap<BlockState> blockChanges) {
|
|
||||||
this.sectionPos = sectionPos;
|
|
||||||
this.positions = blockChanges.keySet().toShortArray();
|
|
||||||
- this.states = blockChanges.values().toArray(new BlockState[0]);
|
|
||||||
+ this.states = blockChanges.values().toArray(org.plazmamc.plazma.constants.Empty.BLOCK_STATE); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
// Paper end - Multi Block Change API
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
index e121cc57e..7b27af22a 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
||||||
@@ -1541,13 +1541,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
||||||
}
|
|
||||||
|
|
||||||
private Optional<ServerStatus.Favicon> loadStatusIcon() {
|
|
||||||
- Optional<Path> optional = Optional.of(this.getFile("server-icon.png").toPath()).filter((path) -> {
|
|
||||||
- return Files.isRegularFile(path, new LinkOption[0]);
|
|
||||||
- }).or(() -> {
|
|
||||||
- return this.storageSource.getIconFile().filter((path) -> {
|
|
||||||
- return Files.isRegularFile(path, new LinkOption[0]);
|
|
||||||
- });
|
|
||||||
- });
|
|
||||||
+ // Plazma start - Reduce allocations
|
|
||||||
+ Optional<Path> optional = Optional.of(this.getFile("server-icon.png").toPath()).filter(Files::isRegularFile)
|
|
||||||
+ .or(() -> this.storageSource.getIconFile().filter(Files::isRegularFile));
|
|
||||||
+ // Plazma end
|
|
||||||
|
|
||||||
return optional.flatMap((path) -> {
|
|
||||||
try {
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
||||||
index ef520d1dd..b3b0c18b4 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
|
||||||
@@ -130,7 +130,7 @@ public class PlayerAdvancements {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void load(ServerAdvancementManager advancementLoader) {
|
|
||||||
- if (Files.isRegularFile(this.playerSavePath, new LinkOption[0])) {
|
|
||||||
+ if (Files.isRegularFile(this.playerSavePath/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
try {
|
|
||||||
JsonReader jsonreader = new JsonReader(Files.newBufferedReader(this.playerSavePath, StandardCharsets.UTF_8));
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/RunningOnDifferentThreadException.java b/src/main/java/net/minecraft/server/RunningOnDifferentThreadException.java
|
|
||||||
index 0f52e8a61ca7e57e9f52473dceb9cc3464c0c86d..f54bde32760541a653460682e5a3ddd0b2ceec51 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/RunningOnDifferentThreadException.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/RunningOnDifferentThreadException.java
|
|
||||||
@@ -4,12 +4,12 @@ public final class RunningOnDifferentThreadException extends RuntimeException {
|
|
||||||
public static final RunningOnDifferentThreadException RUNNING_ON_DIFFERENT_THREAD = new RunningOnDifferentThreadException();
|
|
||||||
|
|
||||||
private RunningOnDifferentThreadException() {
|
|
||||||
- this.setStackTrace(new StackTraceElement[0]);
|
|
||||||
+ this.setStackTrace(org.plazmamc.plazma.constants.Empty.TRACE); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized Throwable fillInStackTrace() {
|
|
||||||
- this.setStackTrace(new StackTraceElement[0]);
|
|
||||||
+ this.setStackTrace(org.plazmamc.plazma.constants.Empty.TRACE); // Plazma - Reduce allocations
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/ServerFunctionLibrary.java b/src/main/java/net/minecraft/server/ServerFunctionLibrary.java
|
|
||||||
index bae0d208b31aa0a6977c30f2f8484ab3c316bc71..981c3023044f3cc6dc22ada20cd4bedcf7a28db3 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/ServerFunctionLibrary.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/ServerFunctionLibrary.java
|
|
||||||
@@ -92,7 +92,7 @@ public class ServerFunctionLibrary implements PreparableReloadListener {
|
|
||||||
}, prepareExecutor));
|
|
||||||
}
|
|
||||||
|
|
||||||
- CompletableFuture<?>[] completableFutures = map.values().toArray(new CompletableFuture[0]);
|
|
||||||
+ CompletableFuture<?>[] completableFutures = map.values().toArray(org.plazmamc.plazma.constants.Empty.FUTURE); // Plazma - Reduce allocations
|
|
||||||
return CompletableFuture.allOf(completableFutures).handle((unused, ex) -> map);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
||||||
index 4e6fccec4..618dc900d 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
||||||
@@ -112,6 +112,7 @@ import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
|
|
||||||
|
|
||||||
public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider {
|
|
||||||
|
|
||||||
+ private static final ServerPlayerConnection[] EMPTY_CONNECTION = new ServerPlayerConnection[0]; // Plazma - Reduce allocations
|
|
||||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
|
||||||
private static final byte CHUNK_TYPE_UNKNOWN = 0;
|
|
||||||
private static final byte CHUNK_TYPE_FULL = 1;
|
|
||||||
@@ -1361,7 +1362,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
|
||||||
// stuff could have been removed, so we need to check the trackedPlayers set
|
|
||||||
// for players that were removed
|
|
||||||
|
|
||||||
- for (ServerPlayerConnection conn : this.seenBy.toArray(new ServerPlayerConnection[0])) { // avoid CME
|
|
||||||
+ for (ServerPlayerConnection conn : this.seenBy.toArray(EMPTY_CONNECTION)) { // avoid CME // Plazma - Reduce allocations
|
|
||||||
if (newTrackerCandidates == null || !newTrackerCandidates.contains(conn.getPlayer())) {
|
|
||||||
this.updatePlayer(conn.getPlayer());
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
index f72af2feb..0aaa0e63f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
||||||
@@ -1439,7 +1439,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
||||||
|
|
||||||
public static List<Entity> getCurrentlyTickingEntities() {
|
|
||||||
Entity ticking = currentlyTickingEntity.get();
|
|
||||||
- List<Entity> ret = java.util.Arrays.asList(ticking == null ? new Entity[0] : new Entity[] { ticking });
|
|
||||||
+ List<Entity> ret = java.util.Arrays.asList(ticking == null ? org.plazmamc.plazma.constants.Empty.ENTITY : new Entity[] { ticking }); // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
||||||
index 3b4fadb37..f276fe09f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
||||||
@@ -165,12 +165,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleHello(ServerboundHelloPacket packet) {
|
|
||||||
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
|
|
||||||
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet"/*, new Object[0]*/); // Plazma - Reduce allocations
|
|
||||||
// Paper start - Validate usernames
|
|
||||||
if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
|
||||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
|
|
||||||
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
|
|
||||||
- Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", new Object[0]);
|
|
||||||
+ Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username"/*, new Object[0]*/); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
// Paper end - Validate usernames
|
|
||||||
this.requestedUsername = packet.name();
|
|
||||||
@@ -268,7 +268,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleKey(ServerboundKeyPacket packet) {
|
|
||||||
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", new Object[0]);
|
|
||||||
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet"/*, new Object[0]*/); // Plazma - Reduce allocations
|
|
||||||
|
|
||||||
final String s;
|
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleLoginAcknowledgement(ServerboundLoginAcknowledgedPacket packet) {
|
|
||||||
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet", new Object[0]);
|
|
||||||
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet"/*, new Object[0]*/); // Plazma - Reduce allocations
|
|
||||||
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
|
|
||||||
CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial((GameProfile) Objects.requireNonNull(this.authenticatedProfile), this.transferred);
|
|
||||||
ServerConfigurationPacketListenerImpl serverconfigurationpacketlistenerimpl = new ServerConfigurationPacketListenerImpl(this.server, this.connection, commonlistenercookie, this.player); // CraftBukkit
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
index b863f6fe6..068c7619b 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
||||||
@@ -135,6 +135,7 @@ public abstract class PlayerList {
|
|
||||||
private static final Logger LOGGER = LogUtils.getLogger();
|
|
||||||
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
|
|
||||||
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
|
||||||
+ private static final org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[] EMPTY_FLAG = new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]; // Plazma - Reduce allocations
|
|
||||||
private final MinecraftServer server;
|
|
||||||
public final List<ServerPlayer> players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
|
|
||||||
private final Map<UUID, ServerPlayer> playersByUUID = Maps.newHashMap();
|
|
||||||
@@ -815,7 +816,7 @@ public abstract class PlayerList {
|
|
||||||
|
|
||||||
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
|
||||||
// Paper start - Expand PlayerRespawnEvent
|
|
||||||
- return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, reason, new org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag[0]);
|
|
||||||
+ return respawn(entityplayer, worldserver, flag, location, avoidSuffocation, reason, EMPTY_FLAG); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerPlayer respawn(ServerPlayer entityplayer, ServerLevel worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag...respawnFlags) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
|
|
||||||
index c038da20b..b6cab933d 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
|
|
||||||
@@ -76,7 +76,7 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getUserList() {
|
|
||||||
- return (String[]) this.map.keySet().toArray(new String[0]);
|
|
||||||
+ return this.map.keySet().toArray(org.plazmamc.plazma.constants.Empty.STRING); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEmpty() {
|
|
||||||
diff --git a/src/main/java/net/minecraft/util/MemoryReserve.java b/src/main/java/net/minecraft/util/MemoryReserve.java
|
|
||||||
index 0ee04fe6ff6a4d09754f326526ae04fe7226bab2..5663ce568a1daa638b7387bee8b9917ce1f64d14 100644
|
|
||||||
--- a/src/main/java/net/minecraft/util/MemoryReserve.java
|
|
||||||
+++ b/src/main/java/net/minecraft/util/MemoryReserve.java
|
|
||||||
@@ -11,6 +11,6 @@ public class MemoryReserve {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void release() {
|
|
||||||
- reserve = new byte[0];
|
|
||||||
+ reserve = org.plazmamc.plazma.constants.Empty.BYTE; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
|
||||||
index 01f5b946fabbe34f31110e75973dab9f39897346..2564c21900df7ca3c58872741ec8f68bce80a903 100644
|
|
||||||
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
|
||||||
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
|
||||||
@@ -5,7 +5,7 @@ import java.util.function.IntConsumer;
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
|
|
||||||
public class ZeroBitStorage implements BitStorage {
|
|
||||||
- public static final long[] RAW = new long[0];
|
|
||||||
+ // public static final long[] RAW = new long[0]; // Plazma - Reduce allocations
|
|
||||||
private final int size;
|
|
||||||
|
|
||||||
public ZeroBitStorage(int size) {
|
|
||||||
@@ -33,7 +33,7 @@ public class ZeroBitStorage implements BitStorage {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long[] getRaw() {
|
|
||||||
- return RAW;
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.LONG; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
|
||||||
index f34159f8d..4088ec804 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
|
||||||
@@ -57,6 +57,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
||||||
public static final Object2FloatMap<ItemLike> COMPOSTABLES = new Object2FloatOpenHashMap();
|
|
||||||
private static final int AABB_SIDE_THICKNESS = 2;
|
|
||||||
private static final VoxelShape OUTER_SHAPE = Shapes.block();
|
|
||||||
+ private static final int[] ZERO_INT = new int[]{0}; // Plazma - Reduce allocations // Plazma - Reduce allocations
|
|
||||||
private static final VoxelShape[] SHAPES = (VoxelShape[]) Util.make(new VoxelShape[9], (avoxelshape) -> {
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
|
||||||
avoxelshape[i] = Shapes.join(ComposterBlock.OUTER_SHAPE, Block.box(2.0D, (double) Math.max(2, 1 + i * 2), 2.0D, 14.0D, 16.0D, 14.0D), BooleanOp.ONLY_FIRST);
|
|
||||||
@@ -458,7 +459,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(Direction side) {
|
|
||||||
- return side == Direction.DOWN ? new int[]{0} : new int[0];
|
|
||||||
+ return side == Direction.DOWN ? ZERO_INT : org.plazmamc.plazma.constants.Empty.INT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -507,7 +508,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(Direction side) {
|
|
||||||
- return side == Direction.UP ? new int[]{0} : new int[0];
|
|
||||||
+ return side == Direction.UP ? ZERO_INT : org.plazmamc.plazma.constants.Empty.INT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@@ -549,7 +550,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int[] getSlotsForFace(Direction side) {
|
|
||||||
- return new int[0];
|
|
||||||
+ return org.plazmamc.plazma.constants.Empty.INT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
|
||||||
index 1362a4794..2490b63cb 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
|
||||||
@@ -445,7 +445,7 @@ public class RegionFile implements AutoCloseable {
|
|
||||||
this.path = path;
|
|
||||||
initOversizedState(); // Paper
|
|
||||||
this.version = compressionFormat;
|
|
||||||
- if (!Files.isDirectory(directory, new LinkOption[0])) {
|
|
||||||
+ if (!Files.isDirectory(directory/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
throw new IllegalArgumentException("Expected directory, got " + String.valueOf(directory.toAbsolutePath()));
|
|
||||||
} else {
|
|
||||||
this.externalFileDir = directory;
|
|
||||||
@@ -717,7 +717,7 @@ public class RegionFile implements AutoCloseable {
|
|
||||||
private DataInputStream createExternalChunkInputStream(ChunkPos pos, byte flags) throws IOException {
|
|
||||||
Path path = this.getExternalChunkPath(pos);
|
|
||||||
|
|
||||||
- if (!Files.isRegularFile(path, new LinkOption[0])) {
|
|
||||||
+ if (!Files.isRegularFile(path/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
RegionFile.LOGGER.error("External chunk path {} is not file", path);
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
@@ -769,7 +769,7 @@ public class RegionFile implements AutoCloseable {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (!Files.isRegularFile(this.getExternalChunkPath(pos), new LinkOption[0])) {
|
|
||||||
+ if (!Files.isRegularFile(this.getExternalChunkPath(pos)/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java b/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java
|
|
||||||
index b8e333e79..b6012d360 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/DebugLevelSource.java
|
|
||||||
@@ -89,7 +89,7 @@ public class DebugLevelSource extends ChunkGenerator {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public NoiseColumn getBaseColumn(int x, int z, LevelHeightAccessor world, RandomState noiseConfig) {
|
|
||||||
- return new NoiseColumn(0, new BlockState[0]);
|
|
||||||
+ return new NoiseColumn(0, org.plazmamc.plazma.constants.Empty.BLOCK_STATE); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
|
||||||
index 399da9d43aefbb95897df4697860d5bce5317152..df7816c1c5f069d89a22dbd876a2d663ba68949f 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
|
|
||||||
@@ -110,7 +110,7 @@ public class LevelStorageSource {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DirectoryValidator parseValidator(Path allowedSymlinksFile) {
|
|
||||||
- if (Files.exists(allowedSymlinksFile, new LinkOption[0])) {
|
|
||||||
+ if (Files.exists(allowedSymlinksFile/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
try {
|
|
||||||
BufferedReader bufferedreader = Files.newBufferedReader(allowedSymlinksFile);
|
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ public class LevelStorageSource {
|
|
||||||
}
|
|
||||||
|
|
||||||
public LevelStorageSource.LevelCandidates findLevelCandidates() throws LevelStorageException {
|
|
||||||
- if (!Files.isDirectory(this.baseDir, new LinkOption[0])) {
|
|
||||||
+ if (!Files.isDirectory(this.baseDir/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
throw new LevelStorageException(Component.translatable("selectWorld.load_folder_access"));
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
@@ -198,11 +198,12 @@ public class LevelStorageSource {
|
|
||||||
LevelStorageSource.LevelCandidates convertable_a;
|
|
||||||
|
|
||||||
try {
|
|
||||||
- List<LevelStorageSource.LevelDirectory> list = stream.filter((path) -> {
|
|
||||||
- return Files.isDirectory(path, new LinkOption[0]);
|
|
||||||
- }).map(LevelStorageSource.LevelDirectory::new).filter((convertable_b) -> {
|
|
||||||
- return Files.isRegularFile(convertable_b.dataFile(), new LinkOption[0]) || Files.isRegularFile(convertable_b.oldDataFile(), new LinkOption[0]);
|
|
||||||
- }).toList();
|
|
||||||
+ // Plazma start - Reduce allocations
|
|
||||||
+ List<LevelStorageSource.LevelDirectory> list = stream.filter(Files::isDirectory)
|
|
||||||
+ .map(LevelStorageSource.LevelDirectory::new)
|
|
||||||
+ .filter(convertable_b -> Files.isRegularFile(convertable_b.dataFile()) || Files.isRegularFile(convertable_b.oldDataFile()))
|
|
||||||
+ .toList();
|
|
||||||
+ // Plazma end
|
|
||||||
|
|
||||||
convertable_a = new LevelStorageSource.LevelCandidates(list);
|
|
||||||
} catch (Throwable throwable) {
|
|
||||||
@@ -312,7 +313,7 @@ public class LevelStorageSource {
|
|
||||||
private LevelSummary readLevelSummary(LevelStorageSource.LevelDirectory save, boolean locked) {
|
|
||||||
Path path = save.dataFile();
|
|
||||||
|
|
||||||
- if (Files.exists(path, new LinkOption[0])) {
|
|
||||||
+ if (Files.exists(path/*, new LinkOption[0]*/)) { // Plazma - Reduce allocations
|
|
||||||
try {
|
|
||||||
if (Files.isSymbolicLink(path)) {
|
|
||||||
List<ForbiddenSymlinkInfo> list = this.worldDirValidator.validateSymlink(path);
|
|
||||||
@@ -411,7 +412,7 @@ public class LevelStorageSource {
|
|
||||||
|
|
||||||
public boolean levelExists(String name) {
|
|
||||||
try {
|
|
||||||
- return Files.isDirectory(this.getLevelPath(name), new LinkOption[0]);
|
|
||||||
+ return Files.isDirectory(this.getLevelPath(name)/*, new LinkOption[0]*/); // Plazma - Reduce allocations
|
|
||||||
} catch (InvalidPathException invalidpathexception) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -752,7 +753,7 @@ public class LevelStorageSource {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasWorldData() {
|
|
||||||
- return Files.exists(this.levelDirectory.dataFile(), new LinkOption[0]) || Files.exists(this.levelDirectory.oldDataFile(), new LinkOption[0]);
|
|
||||||
+ return Files.exists(this.levelDirectory.dataFile()/*, new LinkOption[0]*/) || Files.exists(this.levelDirectory.oldDataFile()/*, new LinkOption[0]*/); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() throws IOException {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
|
||||||
index 63e187c65cb855031f286aad0d25ac4694f7a331..e0f085169fafa5e574caf368efa343514540b348 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
|
||||||
@@ -124,7 +124,7 @@ public class PlayerDataStorage {
|
|
||||||
String[] astring = this.playerDir.list();
|
|
||||||
|
|
||||||
if (astring == null) {
|
|
||||||
- astring = new String[0];
|
|
||||||
+ astring = org.plazmamc.plazma.constants.Empty.STRING; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < astring.length; ++i) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/scores/Team.java b/src/main/java/net/minecraft/world/scores/Team.java
|
|
||||||
index f00791b89fdb1bb0fb358eff2af2e687bda15e85..aa16c93a4333b603729e2704b92f6d38aec0fd7b 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/scores/Team.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/scores/Team.java
|
|
||||||
@@ -70,7 +70,7 @@ public abstract class Team {
|
|
||||||
public final int id;
|
|
||||||
|
|
||||||
public static String[] getAllNames() {
|
|
||||||
- return BY_NAME.keySet().toArray(new String[0]);
|
|
||||||
+ return BY_NAME.keySet().toArray(org.plazmamc.plazma.constants.Empty.STRING); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
index fb2d05e43df3bfb72b1f6e325736dd3cbc6c3096..de4e1d713e5ec182ea8d4832b8359556095ac214 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
||||||
@@ -426,7 +426,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
||||||
public void sendTitle(Title title) {
|
|
||||||
Preconditions.checkNotNull(title, "Title is null");
|
|
||||||
setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut());
|
|
||||||
- setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle());
|
|
||||||
+ setSubtitle(title.getSubtitle() == null ? org.plazmamc.plazma.constants.Empty.BASE_COMPONENT : title.getSubtitle()); // Plazma - Reduce allocations
|
|
||||||
showTitle(title.getTitle());
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
||||||
index c5d1ba7a1be3f102edcdfdc05fc50b30ef1f775b..66006d9ff581ac96f13389261de0cd647279b98a 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java
|
|
||||||
@@ -610,7 +610,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
||||||
throw new IllegalArgumentException("Invalid page number " + page + "/" + CraftMetaBook.this.getPageCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
- BaseComponent[] newText = text == null ? new BaseComponent[0] : text;
|
|
||||||
+ BaseComponent[] newText = text == null ? org.plazmamc.plazma.constants.Empty.BASE_COMPONENT : text; // Plazma - Reduce allocations
|
|
||||||
CraftMetaBook.this.pages.set(page - 1, this.componentsToPage(newText));
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -623,7 +623,7 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta {
|
|
||||||
public void addPage(final BaseComponent[]... pages) {
|
|
||||||
for (BaseComponent[] page : pages) {
|
|
||||||
if (page == null) {
|
|
||||||
- page = new BaseComponent[0];
|
|
||||||
+ page = org.plazmamc.plazma.constants.Empty.BASE_COMPONENT; // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
CraftMetaBook.this.internalAddPage(this.componentsToPage(page));
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
|
|
||||||
index b25dc23b81687dd4d4e70b3615ffb91f8c03c68b..acb98770b9d01e930642a5794f9179660b411c02 100644
|
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
|
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
|
|
||||||
@@ -164,7 +164,7 @@ public final class WeakCollection<T> implements Collection<T> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object[] toArray() {
|
|
||||||
- return this.toArray(new Object[0]);
|
|
||||||
+ return this.toArray(org.plazmamc.plazma.constants.Empty.OBJECT); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/constants/Empty.java b/src/main/java/org/plazmamc/plazma/constants/Empty.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..2b6eb7997986ab73ccb3b1baca945a3234ae916e
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/constants/Empty.java
|
|
||||||
@@ -0,0 +1,20 @@
|
|
||||||
+package org.plazmamc.plazma.constants;
|
|
||||||
+
|
|
||||||
+public interface Empty {
|
|
||||||
+
|
|
||||||
+ int[] INT = new int[0];
|
|
||||||
+ long[] LONG = new long[0];
|
|
||||||
+ byte[] BYTE = new byte[0];
|
|
||||||
+
|
|
||||||
+ Object[] OBJECT = new Object[0];
|
|
||||||
+ String[] STRING = new String[0];
|
|
||||||
+ StackTraceElement[] TRACE = new StackTraceElement[0];
|
|
||||||
+ java.util.concurrent.CompletableFuture<?>[] FUTURE = new java.util.concurrent.CompletableFuture[0];
|
|
||||||
+
|
|
||||||
+ net.minecraft.world.level.block.state.BlockState[] BLOCK_STATE = new net.minecraft.world.level.block.state.BlockState[0];
|
|
||||||
+ net.minecraft.world.entity.Entity[] ENTITY = new net.minecraft.world.entity.Entity[0];
|
|
||||||
+
|
|
||||||
+ @SuppressWarnings("deprecation")
|
|
||||||
+ net.md_5.bungee.api.chat.BaseComponent[] BASE_COMPONENT = new net.md_5.bungee.api.chat.BaseComponent[0];
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/command/PurpurCommand.java b/src/main/java/org/purpurmc/purpur/command/PurpurCommand.java
|
|
||||||
index 2621e54879e9ab0029a875f1d09eee67878b90d5..e7e959368c01de69261618d1eb749bebba3527af 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/command/PurpurCommand.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/command/PurpurCommand.java
|
|
||||||
@@ -57,7 +57,7 @@ public class PurpurCommand extends Command {
|
|
||||||
} else if (args[0].equalsIgnoreCase("version")) {
|
|
||||||
Command verCmd = org.bukkit.Bukkit.getServer().getCommandMap().getCommand("version");
|
|
||||||
if (verCmd != null) {
|
|
||||||
- return verCmd.execute(sender, commandLabel, new String[0]);
|
|
||||||
+ return verCmd.execute(sender, commandLabel, org.plazmamc.plazma.constants.Empty.STRING); // Plazma - Reduce allocations
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,311 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?IPECTER=20=EC=9D=B4=ED=8C=A9=ED=84=B0?=
|
|
||||||
<80433772+IPECTER@users.noreply.github.com>
|
|
||||||
Date: Wed, 21 Aug 2024 16:16:22 +0900
|
|
||||||
Subject: [PATCH] Implement-CarpetFixes
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Sheep.java b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
|
||||||
index 658f7943d275267d3fc556572831cc095259d12e..8ad02b079c729320f5968eee5e6284371d11250e 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Sheep.java
|
|
||||||
@@ -460,17 +460,25 @@ public class Sheep extends Animal implements Shearable {
|
|
||||||
private DyeColor getOffspringColor(Animal firstParent, Animal secondParent) {
|
|
||||||
DyeColor enumcolor = ((Sheep) firstParent).getColor();
|
|
||||||
DyeColor enumcolor1 = ((Sheep) secondParent).getColor();
|
|
||||||
- CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1);
|
|
||||||
- Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
|
||||||
- return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
|
||||||
- }).map(ItemStack::getItem);
|
|
||||||
-
|
|
||||||
- Objects.requireNonNull(DyeItem.class);
|
|
||||||
- optional = optional.filter(DyeItem.class::isInstance);
|
|
||||||
- Objects.requireNonNull(DyeItem.class);
|
|
||||||
- return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
|
||||||
- return this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
|
||||||
- });
|
|
||||||
+ // Plazma start - Implement CarpetFixes
|
|
||||||
+ if (this.level().plazmaConfig().carpetFixes.preparedSheepChildColor()) {
|
|
||||||
+ DyeColor col = org.plazmamc.plazma.util.CarpetFixesUtils.properDyeMixin(enumcolor, enumcolor1);
|
|
||||||
+ if (col == null) col = this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
|
||||||
+ return col;
|
|
||||||
+ } else {
|
|
||||||
+ CraftingContainer inventorycrafting = Sheep.makeContainer(enumcolor, enumcolor1);
|
|
||||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
|
||||||
+ return ((CraftingRecipe) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
|
||||||
+ }).map(ItemStack::getItem);
|
|
||||||
+
|
|
||||||
+ Objects.requireNonNull(DyeItem.class);
|
|
||||||
+ optional = optional.filter(DyeItem.class::isInstance);
|
|
||||||
+ Objects.requireNonNull(DyeItem.class);
|
|
||||||
+ return (DyeColor) optional.map(DyeItem.class::cast).map(DyeItem::getDyeColor).orElseGet(() -> {
|
|
||||||
+ return this.level().random.nextBoolean() ? enumcolor : enumcolor1;
|
|
||||||
+ });
|
|
||||||
+ }
|
|
||||||
+ // Plazma end
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CraftingContainer makeContainer(DyeColor firstColor, DyeColor secondColor) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
||||||
index 681e3fcd759a26578e054f88e8048e392312b84b..253819783d577c4c2abe737e0c76ac88121387db 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java
|
|
||||||
@@ -137,7 +137,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener {
|
|
||||||
}
|
|
||||||
|
|
||||||
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getAllRecipesFor(RecipeType<T> type) {
|
|
||||||
- return List.copyOf(this.byType(type).values());
|
|
||||||
+ return org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.fasterRecipeList() ? new java.util.ArrayList<>(this.byType(type).values()) : List.copyOf(this.byType(type).values()); // Plazma - Implement CarpetFixes
|
|
||||||
}
|
|
||||||
|
|
||||||
public <C extends Container, T extends Recipe<C>> List<RecipeHolder<T>> getRecipesFor(RecipeType<T> type, C inventory, Level world) {
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
|
||||||
index 01352cc83b25eb0e30b7e0ff521fc7c1b3d5155b..e6544cf89bc5e85d9b7fb9b278ffc765c5268f37 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java
|
|
||||||
@@ -12,6 +12,7 @@ public class BiomeManager {
|
|
||||||
private static final int ZOOM_BITS = 2;
|
|
||||||
private static final int ZOOM = 4;
|
|
||||||
private static final int ZOOM_MASK = 3;
|
|
||||||
+ private static final double maxOffset = 0.4500000001D; // Plazma - Implement CarpetFixes
|
|
||||||
private final BiomeManager.NoiseBiomeSource noiseBiomeSource;
|
|
||||||
private final long biomeZoomSeed;
|
|
||||||
|
|
||||||
@@ -29,39 +30,104 @@ public class BiomeManager {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Holder<Biome> getBiome(BlockPos pos) {
|
|
||||||
- int i = pos.getX() - 2;
|
|
||||||
- int j = pos.getY() - 2;
|
|
||||||
- int k = pos.getZ() - 2;
|
|
||||||
- int l = i >> 2;
|
|
||||||
- int m = j >> 2;
|
|
||||||
- int n = k >> 2;
|
|
||||||
- double d = (double)(i & 3) / 4.0;
|
|
||||||
- double e = (double)(j & 3) / 4.0;
|
|
||||||
- double f = (double)(k & 3) / 4.0;
|
|
||||||
- int o = 0;
|
|
||||||
- double g = Double.POSITIVE_INFINITY;
|
|
||||||
-
|
|
||||||
- for (int p = 0; p < 8; p++) {
|
|
||||||
- boolean bl = (p & 4) == 0;
|
|
||||||
- boolean bl2 = (p & 2) == 0;
|
|
||||||
- boolean bl3 = (p & 1) == 0;
|
|
||||||
- int q = bl ? l : l + 1;
|
|
||||||
- int r = bl2 ? m : m + 1;
|
|
||||||
- int s = bl3 ? n : n + 1;
|
|
||||||
- double h = bl ? d : d - 1.0;
|
|
||||||
- double t = bl2 ? e : e - 1.0;
|
|
||||||
- double u = bl3 ? f : f - 1.0;
|
|
||||||
- double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
|
|
||||||
- if (g > v) {
|
|
||||||
- o = p;
|
|
||||||
- g = v;
|
|
||||||
+ // Plazma start - Implement CarpetFixes
|
|
||||||
+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().carpetFixes.optimizedBiomeAccess()) {
|
|
||||||
+ int xMinus2 = pos.getX() - 2;
|
|
||||||
+ int yMinus2 = pos.getY() - 2;
|
|
||||||
+ int zMinus2 = pos.getZ() - 2;
|
|
||||||
+ int x = xMinus2 >> 2; // BlockPos to BiomePos
|
|
||||||
+ int y = yMinus2 >> 2;
|
|
||||||
+ int z = zMinus2 >> 2;
|
|
||||||
+ double quartX = (double) (xMinus2 & 3) / 4.0D; // quartLocal divided by 4
|
|
||||||
+ double quartY = (double) (yMinus2 & 3) / 4.0D; // 0/4, 1/4, 2/4, 3/4
|
|
||||||
+ double quartZ = (double) (zMinus2 & 3) / 4.0D; // [0, 0.25, 0.5, 0.75]
|
|
||||||
+ int smallestX = 0;
|
|
||||||
+ double smallestDist = Double.POSITIVE_INFINITY;
|
|
||||||
+ for (int biomeX = 0; biomeX < 8; ++biomeX) {
|
|
||||||
+ boolean everyOtherQuad = (biomeX & 4) == 0; // 1 1 1 1 0 0 0 0
|
|
||||||
+ boolean everyOtherPair = (biomeX & 2) == 0; // 1 1 0 0 1 1 0 0
|
|
||||||
+ boolean everyOther = (biomeX & 1) == 0; // 1 0 1 0 1 0 1 0
|
|
||||||
+ double quartXX = everyOtherQuad ? quartX : quartX - 1.0D; //[-1.0,-0.75,-0.5,-0.25,0.0,0.25,0.5,0.75]
|
|
||||||
+ double quartYY = everyOtherPair ? quartY : quartY - 1.0D;
|
|
||||||
+ double quartZZ = everyOther ? quartZ : quartZ - 1.0D;
|
|
||||||
+
|
|
||||||
+ //This code block is new
|
|
||||||
+ double maxQuartYY = 0.0D, maxQuartZZ = 0.0D;
|
|
||||||
+ if (biomeX != 0) {
|
|
||||||
+ maxQuartYY = Mth.square(Math.max(quartYY + maxOffset, Math.abs(quartYY - maxOffset)));
|
|
||||||
+ maxQuartZZ = Mth.square(Math.max(quartZZ + maxOffset, Math.abs(quartZZ - maxOffset)));
|
|
||||||
+ double maxQuartXX = Mth.square(Math.max(quartXX + maxOffset, Math.abs(quartXX - maxOffset)));
|
|
||||||
+ if (smallestDist < maxQuartXX + maxQuartYY + maxQuartZZ) continue;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ int xx = everyOtherQuad ? x : x + 1;
|
|
||||||
+ int yy = everyOtherPair ? y : y + 1;
|
|
||||||
+ int zz = everyOther ? z : z + 1;
|
|
||||||
+
|
|
||||||
+ //I transferred the code from method_38106 to here, so I could call continue halfway through
|
|
||||||
+ long seed = LinearCongruentialGenerator.next(this.biomeZoomSeed, xx);
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, yy);
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, zz);
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, xx);
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, yy);
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, zz);
|
|
||||||
+ double offsetX = getFiddle(seed);
|
|
||||||
+ double sqrX = Mth.square(quartXX + offsetX);
|
|
||||||
+ if (biomeX != 0 && smallestDist < sqrX + maxQuartYY + maxQuartZZ) continue; //skip the rest of the loop
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
|
||||||
+ double offsetY = getFiddle(seed);
|
|
||||||
+ double sqrY = Mth.square(quartYY + offsetY);
|
|
||||||
+ if (biomeX != 0 && smallestDist < sqrX + sqrY + maxQuartZZ) continue; // skip the rest of the loop
|
|
||||||
+ seed = LinearCongruentialGenerator.next(seed, this.biomeZoomSeed);
|
|
||||||
+ double offsetZ = getFiddle(seed);
|
|
||||||
+ double biomeDist = sqrX + sqrY + Mth.square(quartZZ + offsetZ);
|
|
||||||
+
|
|
||||||
+ if (smallestDist > biomeDist) {
|
|
||||||
+ smallestX = biomeX;
|
|
||||||
+ smallestDist = biomeDist;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return this.noiseBiomeSource.getNoiseBiome(
|
|
||||||
+ (smallestX & 4) == 0 ? x : x + 1,
|
|
||||||
+ (smallestX & 2) == 0 ? y : y + 1,
|
|
||||||
+ (smallestX & 1) == 0 ? z : z + 1
|
|
||||||
+ );
|
|
||||||
+ } else {
|
|
||||||
+ int i = pos.getX() - 2;
|
|
||||||
+ int j = pos.getY() - 2;
|
|
||||||
+ int k = pos.getZ() - 2;
|
|
||||||
+ int l = i >> 2;
|
|
||||||
+ int m = j >> 2;
|
|
||||||
+ int n = k >> 2;
|
|
||||||
+ double d = (double) (i & 3) / 4.0;
|
|
||||||
+ double e = (double) (j & 3) / 4.0;
|
|
||||||
+ double f = (double) (k & 3) / 4.0;
|
|
||||||
+ int o = 0;
|
|
||||||
+ double g = Double.POSITIVE_INFINITY;
|
|
||||||
+
|
|
||||||
+ for (int p = 0; p < 8; p++) {
|
|
||||||
+ boolean bl = (p & 4) == 0;
|
|
||||||
+ boolean bl2 = (p & 2) == 0;
|
|
||||||
+ boolean bl3 = (p & 1) == 0;
|
|
||||||
+ int q = bl ? l : l + 1;
|
|
||||||
+ int r = bl2 ? m : m + 1;
|
|
||||||
+ int s = bl3 ? n : n + 1;
|
|
||||||
+ double h = bl ? d : d - 1.0;
|
|
||||||
+ double t = bl2 ? e : e - 1.0;
|
|
||||||
+ double u = bl3 ? f : f - 1.0;
|
|
||||||
+ double v = getFiddledDistance(this.biomeZoomSeed, q, r, s, h, t, u);
|
|
||||||
+ if (g > v) {
|
|
||||||
+ o = p;
|
|
||||||
+ g = v;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
- }
|
|
||||||
|
|
||||||
- int w = (o & 4) == 0 ? l : l + 1;
|
|
||||||
- int x = (o & 2) == 0 ? m : m + 1;
|
|
||||||
- int y = (o & 1) == 0 ? n : n + 1;
|
|
||||||
- return this.noiseBiomeSource.getNoiseBiome(w, x, y);
|
|
||||||
+ int w = (o & 4) == 0 ? l : l + 1;
|
|
||||||
+ int x = (o & 2) == 0 ? m : m + 1;
|
|
||||||
+ int y = (o & 1) == 0 ? n : n + 1;
|
|
||||||
+ return this.noiseBiomeSource.getNoiseBiome(w, x, y);
|
|
||||||
+ }
|
|
||||||
+ // Plazma end
|
|
||||||
}
|
|
||||||
|
|
||||||
public Holder<Biome> getNoiseBiomeAtPosition(double x, double y, double z) {
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
index 98f26e3de66a881163e84295e9156c7f362bf7cb..9af184b55fd32d16194b669c42bfbf9b18e96e26 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
@@ -109,4 +109,21 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public CarpetFixes carpetFixes;
|
|
||||||
+ public class CarpetFixes extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public boolean enabled = OPTIMIZE;
|
|
||||||
+ boolean optimizedBiomeAccess = true;
|
|
||||||
+ boolean fasterRecipeList = true;
|
|
||||||
+
|
|
||||||
+ public boolean optimizedBiomeAccess() {
|
|
||||||
+ return enabled && optimizedBiomeAccess;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public boolean fasterRecipeList() {
|
|
||||||
+ return enabled && fasterRecipeList;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
index 6a0cfec24618227d9a5ddc6c71e37d1986147799..9d6d4400be8bf189308cbd0cb14afa1ff0191a57 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
@@ -90,4 +90,16 @@ public class WorldConfigurations extends ConfigurationPart {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public CarpetFixes carpetFixes;
|
|
||||||
+ public class CarpetFixes extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public boolean enabled = OPTIMIZE;
|
|
||||||
+ boolean preparedSheepChildColor = true;
|
|
||||||
+
|
|
||||||
+ public boolean preparedSheepChildColor() {
|
|
||||||
+ return enabled && preparedSheepChildColor;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000000000000000000000000000000000000..5d6deb61ef10039a551849e9b83798916f1dc58c
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/util/CarpetFixesUtils.java
|
|
||||||
@@ -0,0 +1,48 @@
|
|
||||||
+package org.plazmamc.plazma.util;
|
|
||||||
+
|
|
||||||
+import net.minecraft.world.item.DyeColor;
|
|
||||||
+
|
|
||||||
+public class CarpetFixesUtils {
|
|
||||||
+
|
|
||||||
+ //If I was actually implementing this, the color values would have been binary in order for fast calculations.
|
|
||||||
+ //Never do this in a production build, although this is better than using the RecipeManager xD
|
|
||||||
+ public static DyeColor properDyeMixin(DyeColor col1, DyeColor col2) {
|
|
||||||
+ if (col1.equals(col2)) return col1;
|
|
||||||
+ switch(col1) {
|
|
||||||
+ case WHITE -> {
|
|
||||||
+ switch(col2) {
|
|
||||||
+ case BLUE -> {return DyeColor.LIGHT_BLUE;}
|
|
||||||
+ case GRAY -> {return DyeColor.LIGHT_GRAY;}
|
|
||||||
+ case BLACK -> {return DyeColor.GRAY;}
|
|
||||||
+ case GREEN -> {return DyeColor.LIME;}
|
|
||||||
+ case RED -> {return DyeColor.PINK;}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ case BLUE -> {
|
|
||||||
+ switch(col2) {
|
|
||||||
+ case WHITE -> {return DyeColor.LIGHT_BLUE;}
|
|
||||||
+ case GREEN -> {return DyeColor.CYAN;}
|
|
||||||
+ case RED -> {return DyeColor.PURPLE;}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ case RED -> {
|
|
||||||
+ switch(col2) {
|
|
||||||
+ case YELLOW -> {return DyeColor.ORANGE;}
|
|
||||||
+ case WHITE -> {return DyeColor.PINK;}
|
|
||||||
+ case BLUE -> {return DyeColor.PURPLE;}
|
|
||||||
+ }
|
|
||||||
+ }case GREEN -> {
|
|
||||||
+ switch(col2) {
|
|
||||||
+ case BLUE -> {return DyeColor.CYAN;}
|
|
||||||
+ case WHITE -> {return DyeColor.LIME;}
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ case YELLOW -> {if (col2.equals(DyeColor.RED)) return DyeColor.ORANGE;}
|
|
||||||
+ case PURPLE -> {if (col2.equals(DyeColor.PINK)) return DyeColor.MAGENTA;}
|
|
||||||
+ case PINK -> {if (col2.equals(DyeColor.PURPLE)) return DyeColor.MAGENTA;}
|
|
||||||
+ case GRAY -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.LIGHT_GRAY;}
|
|
||||||
+ case BLACK -> {if (col2.equals(DyeColor.WHITE)) return DyeColor.GRAY;}
|
|
||||||
+ }
|
|
||||||
+ return null;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
\ No newline at end of file
|
|
||||||
@@ -1,282 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?IPECTER=20=EC=9D=B4=ED=8C=A9=ED=84=B0?=
|
|
||||||
<80433772+IPECTER@users.noreply.github.com>
|
|
||||||
Date: Sun, 25 Aug 2024 05:21:35 +0900
|
|
||||||
Subject: [PATCH] Blazingly-simple-farm-checks
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
||||||
index 2077cb5dcf2352c9d5b502744aeb9a66df256939..e5db5467863e7e408e3ca23dbaed3879d9b31110 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
|
|
||||||
@@ -81,28 +81,81 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
|
|
||||||
int i = this.getAge(state);
|
|
||||||
|
|
||||||
if (i < this.getMaxAge()) {
|
|
||||||
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
-
|
|
||||||
- // Spigot start
|
|
||||||
- int modifier;
|
|
||||||
- if (this == Blocks.BEETROOTS) {
|
|
||||||
- modifier = world.spigotConfig.beetrootModifier;
|
|
||||||
- } else if (this == Blocks.CARROTS) {
|
|
||||||
- modifier = world.spigotConfig.carrotModifier;
|
|
||||||
- } else if (this == Blocks.POTATOES) {
|
|
||||||
- modifier = world.spigotConfig.potatoModifier;
|
|
||||||
- // Paper start - Fix Spigot growth modifiers
|
|
||||||
- } else if (this == Blocks.TORCHFLOWER_CROP) {
|
|
||||||
- modifier = world.spigotConfig.torchFlowerModifier;
|
|
||||||
- // Paper end - Fix Spigot growth modifiers
|
|
||||||
+ // Plazma start - Blazingly simple farm checks
|
|
||||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) {
|
|
||||||
+ // These checks are similar to getGrowthSpeed, but we have "inlined" them because we want to access stuff like the farm block data later on
|
|
||||||
+ // Is the block below us moisturised?
|
|
||||||
+ BlockPos farmlandBelowTheCurrentBlock = pos.below();
|
|
||||||
+ BlockState farmlandBelowTheCurrentBlockData = world.getBlockState(farmlandBelowTheCurrentBlock);
|
|
||||||
+ double f = world.plazmaConfig().blazinglySimpleFarmChecks.defaultGrowthSpeed;
|
|
||||||
+ boolean isCurrentFarmlandStateMoist = false;
|
|
||||||
+ if (farmlandBelowTheCurrentBlockData.is(Blocks.FARMLAND)) {
|
|
||||||
+ if ((Integer) farmlandBelowTheCurrentBlockData.getValue(FarmBlock.MOISTURE) > 0) {
|
|
||||||
+ // If we are currently moist, increase the speed!
|
|
||||||
+ f = world.plazmaConfig().blazinglySimpleFarmChecks.moistGrowthSpeed;
|
|
||||||
+ isCurrentFarmlandStateMoist = true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ // If we are skipping the middle aging stages, we need to change the growth speed and the next stage accordingly
|
|
||||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.skipMiddleAgingStagesForCrops) {
|
|
||||||
+ f = f / getMaxAge();
|
|
||||||
+ i = getMaxAge() - 1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Spigot start
|
|
||||||
+ int modifier;
|
|
||||||
+ if (this == Blocks.BEETROOTS) {
|
|
||||||
+ modifier = world.spigotConfig.beetrootModifier;
|
|
||||||
+ } else if (this == Blocks.CARROTS) {
|
|
||||||
+ modifier = world.spigotConfig.carrotModifier;
|
|
||||||
+ } else if (this == Blocks.POTATOES) {
|
|
||||||
+ modifier = world.spigotConfig.potatoModifier;
|
|
||||||
+ // Paper start
|
|
||||||
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
|
|
||||||
+ modifier = world.spigotConfig.torchFlowerModifier;
|
|
||||||
+ // Paper end
|
|
||||||
+ } else {
|
|
||||||
+ modifier = world.spigotConfig.wheatModifier;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
+ // Spigot end
|
|
||||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2)) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist!
|
|
||||||
+ if (i + 1 == getMaxAge() && isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) {
|
|
||||||
+ // Whoops, farm land ain't moist!
|
|
||||||
+ // From FarmBlock, set the moisture to 0
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
} else {
|
|
||||||
- modifier = world.spigotConfig.wheatModifier;
|
|
||||||
- }
|
|
||||||
+ float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
+
|
|
||||||
+ // Spigot start
|
|
||||||
+ int modifier;
|
|
||||||
+ if (this == Blocks.BEETROOTS) {
|
|
||||||
+ modifier = world.spigotConfig.beetrootModifier;
|
|
||||||
+ } else if (this == Blocks.CARROTS) {
|
|
||||||
+ modifier = world.spigotConfig.carrotModifier;
|
|
||||||
+ } else if (this == Blocks.POTATOES) {
|
|
||||||
+ modifier = world.spigotConfig.potatoModifier;
|
|
||||||
+ // Paper start - Fix Spigot growth modifiers
|
|
||||||
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
|
|
||||||
+ modifier = world.spigotConfig.torchFlowerModifier;
|
|
||||||
+ // Paper end - Fix Spigot growth modifiers
|
|
||||||
+ } else {
|
|
||||||
+ modifier = world.spigotConfig.wheatModifier;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
- if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
- // Spigot end
|
|
||||||
- CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
|
||||||
+ if (random.nextFloat() < (modifier / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
+ // Spigot end
|
|
||||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, this.getStateForAge(i + 1), 2); // CraftBukkit
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
+ // Plazma end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
||||||
index 0c39126ce51439cce05747161aba43bce33a12d8..2016e3d7832ba75331697c46803f8e4142bf01ee 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
|
||||||
@@ -92,6 +92,19 @@ public class FarmBlock extends Block {
|
|
||||||
@Override
|
|
||||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
||||||
int i = (Integer) state.getValue(FarmBlock.MOISTURE);
|
|
||||||
+ // Plazma start - Blazingly simple farm checks
|
|
||||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) {
|
|
||||||
+ if (i == 0) { // We only care about non-moisturised farm blocks
|
|
||||||
+ if (FarmBlock.isNearWater(world, pos)) {
|
|
||||||
+ // Make it MOIST!
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, pos, (BlockState) state.setValue(FarmBlock.MOISTURE, 7), 2); // CraftBukkit
|
|
||||||
+ } else if (!FarmBlock.shouldMaintainFarmland(world, pos)) {
|
|
||||||
+ FarmBlock.turnToDirt((Entity) null, state, world, pos);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // Plazma end
|
|
||||||
if (i > 0 && world.paperConfig().tickRates.wetFarmland != 1 && (world.paperConfig().tickRates.wetFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.wetFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
|
||||||
if (i == 0 && world.paperConfig().tickRates.dryFarmland != 1 && (world.paperConfig().tickRates.dryFarmland < 1 || (net.minecraft.server.MinecraftServer.currentTick + pos.hashCode()) % world.paperConfig().tickRates.dryFarmland != 0)) { return; } // Paper - Configurable random tick rates for blocks
|
|
||||||
|
|
||||||
@@ -166,7 +179,7 @@ public class FarmBlock extends Block {
|
|
||||||
return world.getBlockState(pos.above()).is(BlockTags.MAINTAINS_FARMLAND);
|
|
||||||
}
|
|
||||||
|
|
||||||
- private static boolean isNearWater(LevelReader world, BlockPos pos) {
|
|
||||||
+ public static boolean isNearWater(LevelReader world, BlockPos pos) { // Plazma - Blazingly simple farm checks - private -> public
|
|
||||||
// Paper start - Perf: remove abstract block iteration
|
|
||||||
int xOff = pos.getX();
|
|
||||||
int yOff = pos.getY();
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/StemBlock.java b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
|
||||||
index 121a872cd750a87b779895687ae1abf5bb77b088..53e55b51c53995e2ec9314e1fc656dd5cd22dd67 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/StemBlock.java
|
|
||||||
@@ -73,36 +73,87 @@ public class StemBlock extends BushBlock implements BonemealableBlock {
|
|
||||||
@Override
|
|
||||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
||||||
if (world.getRawBrightness(pos, 0) >= 9) {
|
|
||||||
- float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
-
|
|
||||||
- if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
- int i = (Integer) state.getValue(StemBlock.AGE);
|
|
||||||
-
|
|
||||||
- if (i < 7) {
|
|
||||||
- state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
|
||||||
- CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
|
||||||
- } else {
|
|
||||||
- Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
|
||||||
- BlockPos blockposition1 = pos.relative(enumdirection);
|
|
||||||
- BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
|
||||||
-
|
|
||||||
- if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
|
||||||
- Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
|
||||||
- Optional<Block> optional = iregistry.getOptional(this.fruit);
|
|
||||||
- Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
|
||||||
-
|
|
||||||
- if (optional.isPresent() && optional1.isPresent()) {
|
|
||||||
- // CraftBukkit start
|
|
||||||
- if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
|
||||||
- return;
|
|
||||||
+ // Plazma start - Blazingly simple farm checks
|
|
||||||
+ if (world.plazmaConfig().blazinglySimpleFarmChecks.enabled) {
|
|
||||||
+ // These checks are similar to getGrowthSpeed, but we have "inlined" them because we want to access stuff like the farm block data later on
|
|
||||||
+ // Is the block below us moisturised?
|
|
||||||
+ BlockPos farmlandBelowTheCurrentBlock = pos.below();
|
|
||||||
+ BlockState farmlandBelowTheCurrentBlockData = world.getBlockState(farmlandBelowTheCurrentBlock);
|
|
||||||
+ double f = world.plazmaConfig().blazinglySimpleFarmChecks.defaultGrowthSpeed;
|
|
||||||
+ boolean isCurrentFarmlandStateMoist = false;
|
|
||||||
+ if (farmlandBelowTheCurrentBlockData.is(Blocks.FARMLAND)) {
|
|
||||||
+ if ((Integer) farmlandBelowTheCurrentBlockData.getValue(FarmBlock.MOISTURE) > 0) {
|
|
||||||
+ // If we are currently moist, increase the speed!
|
|
||||||
+ f = world.plazmaConfig().blazinglySimpleFarmChecks.moistGrowthSpeed;
|
|
||||||
+ isCurrentFarmlandStateMoist = true;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
+ int i = (Integer) state.getValue(StemBlock.AGE);
|
|
||||||
+
|
|
||||||
+ if (i < 7) {
|
|
||||||
+ state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
|
||||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
|
||||||
+ } else {
|
|
||||||
+ Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
|
||||||
+ BlockPos blockposition1 = pos.relative(enumdirection);
|
|
||||||
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
|
||||||
+
|
|
||||||
+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
|
||||||
+ Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
|
||||||
+ Optional<Block> optional = iregistry.getOptional(this.fruit);
|
|
||||||
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
|
||||||
+
|
|
||||||
+ if (optional.isPresent() && optional1.isPresent()) {
|
|
||||||
+ // CraftBukkit start
|
|
||||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
+ // Now that we know that the crop will grow... is the next stage the crop's max age? If yes, we are going to check if the farm land is moist!
|
|
||||||
+ if (isCurrentFarmlandStateMoist && !FarmBlock.isNearWater(world, farmlandBelowTheCurrentBlock)) {
|
|
||||||
+ // Whoops, farm land ain't moist!
|
|
||||||
+ // From FarmBlock, set the moisture to 0
|
|
||||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleMoistureChangeEvent(world, farmlandBelowTheCurrentBlock, (BlockState) farmlandBelowTheCurrentBlockData.setValue(FarmBlock.MOISTURE, 0), 2); // CraftBukkit
|
|
||||||
+ }
|
|
||||||
+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ } else {
|
|
||||||
+ float f = CropBlock.getGrowthSpeed(this, world, pos);
|
|
||||||
+
|
|
||||||
+ if (random.nextFloat() < ((this == Blocks.PUMPKIN_STEM ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) / (100.0f * (Math.floor((25.0F / f) + 1))))) { // Spigot - SPIGOT-7159: Better modifier resolution
|
|
||||||
+ int i = (Integer) state.getValue(StemBlock.AGE);
|
|
||||||
+
|
|
||||||
+ if (i < 7) {
|
|
||||||
+ state = (BlockState) state.setValue(StemBlock.AGE, i + 1);
|
|
||||||
+ CraftEventFactory.handleBlockGrowEvent(world, pos, state, 2); // CraftBukkit
|
|
||||||
+ } else {
|
|
||||||
+ Direction enumdirection = Direction.Plane.HORIZONTAL.getRandomDirection(random);
|
|
||||||
+ BlockPos blockposition1 = pos.relative(enumdirection);
|
|
||||||
+ BlockState iblockdata1 = world.getBlockState(blockposition1.below());
|
|
||||||
+
|
|
||||||
+ if (world.getBlockState(blockposition1).isAir() && (iblockdata1.is(Blocks.FARMLAND) || iblockdata1.is(BlockTags.DIRT))) {
|
|
||||||
+ Registry<Block> iregistry = world.registryAccess().registryOrThrow(Registries.BLOCK);
|
|
||||||
+ Optional<Block> optional = iregistry.getOptional(this.fruit);
|
|
||||||
+ Optional<Block> optional1 = iregistry.getOptional(this.attachedStem);
|
|
||||||
+
|
|
||||||
+ if (optional.isPresent() && optional1.isPresent()) {
|
|
||||||
+ // CraftBukkit start
|
|
||||||
+ if (!CraftEventFactory.handleBlockGrowEvent(world, blockposition1, ((Block) optional.get()).defaultBlockState())) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ // CraftBukkit end
|
|
||||||
+ world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
|
||||||
}
|
|
||||||
- // CraftBukkit end
|
|
||||||
- world.setBlockAndUpdate(pos, (BlockState) ((Block) optional1.get()).defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, enumdirection));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+ // Plazma end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
index 9d6d4400be8bf189308cbd0cb14afa1ff0191a57..f96305be3b6e7c33d553764bdf4d8f2635939f9d 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
|
|
||||||
@@ -102,4 +102,15 @@ public class WorldConfigurations extends ConfigurationPart {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public BlazinglySimpleFarmChecks blazinglySimpleFarmChecks;
|
|
||||||
+ public class BlazinglySimpleFarmChecks extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public boolean enabled = OPTIMIZE;ㅈ
|
|
||||||
+ public double defaultGrowthSpeed = 1.0;
|
|
||||||
+ public double moistGrowthSpeed = 5.0;
|
|
||||||
+ public boolean skipMiddleAgingStagesForCrops = false;
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
|
|
||||||
diff --git a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
|
||||||
index f164256d59b761264876ca0c85f812d101bfd5de..deaeb134c47da8710afa747bf980bd00aab846d6 100644
|
|
||||||
--- a/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
|
||||||
+++ b/src/main/java/io/papermc/paper/util/player/NearbyPlayers.java
|
|
||||||
@@ -106,6 +106,13 @@ public final class NearbyPlayers {
|
|
||||||
return chunk == null ? null : chunk.players[type.ordinal()];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ // Plazma start - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
|
||||||
+ public ReferenceList<ServerPlayer> getPlayers(final long nearbyCoordKey, final NearbyMapType type) {
|
|
||||||
+ final TrackedChunk chunk = this.byChunk.get(nearbyCoordKey);
|
|
||||||
+ return chunk == null ? null : chunk.players[type.ordinal()];
|
|
||||||
+ }
|
|
||||||
+ // Plazma end - Port SparklyPaper patches; Cache coordinate key used for nearby players when ticking chunks
|
|
||||||
+
|
|
||||||
public ReferenceList<ServerPlayer> getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) {
|
|
||||||
final TrackedChunk chunk = this.byChunk.get(CoordinateUtils.getChunkKey(chunkX, chunkZ));
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
||||||
index 5eb7bcf492ee354ef775cd8d09c7ca2bdfeb7ce2..697cb18bce2f2470a0a2347ba6709e1449b360fd 100644
|
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
||||||
@@ -615,7 +615,7 @@ public class ServerChunkCache extends ChunkSource {
|
|
||||||
|
|
||||||
// Paper start - optimise chunk tick iteration
|
|
||||||
com.destroystokyo.paper.util.maplist.ReferenceList<ServerPlayer> playersNearby
|
|
||||||
- = nearbyPlayers.getPlayers(chunkcoordintpair, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
|
||||||
+ = nearbyPlayers.getPlayers(chunk1.nearbyPlayersCoordinateKey, io.papermc.paper.util.player.NearbyPlayers.NearbyMapType.SPAWN_RANGE);
|
|
||||||
if (playersNearby == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: AlphaKR93 <dev@alpha93.kr>
|
|
||||||
Date: Wed, 15 May 2024 14:31:47 +0900
|
|
||||||
Subject: [PATCH] Improve biome temperature cache
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
|
||||||
index f9fbfb63f19decb3b15284306d7edda072e609af..81b996679f396f18a8f5948311f1069be0806756 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
|
||||||
@@ -118,7 +118,7 @@ public final class Biome {
|
|
||||||
public float getTemperature(BlockPos blockPos) {
|
|
||||||
long l = blockPos.asLong();
|
|
||||||
// Pufferfish start
|
|
||||||
- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get();
|
|
||||||
+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // Plazma - Improve biome temperature cache
|
|
||||||
float f = cache.getValue(l);
|
|
||||||
if (!Float.isNaN(f)) {
|
|
||||||
return f;
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: IPECTER <ipectert@gmail.com>
|
|
||||||
Date: Wed, 6 Sep 2023 15:40:34 +0900
|
|
||||||
Subject: [PATCH] CarpetFixes-Configuration
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
index 525fe30b6abba295709fca3d10f9b24679112571..49d5292697fdc6f23874557dd2db9d1fcda750f3 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
||||||
@@ -76,4 +76,12 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
||||||
public int timerTimeOut = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ public CarpetFixes carpetFixes;
|
|
||||||
+
|
|
||||||
+ public class CarpetFixes extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public boolean enabled = DO_OPTIMIZE;
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
|
||||||
index 7d5bfd3a5aa5135596f3f1ae7c504a51b02798ef..b0deec445b5ea3cd3e4802eca04e99818b539bd8 100644
|
|
||||||
--- a/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
|
||||||
+++ b/src/main/java/org/plazmamc/plazma/configurations/LevelConfigurations.java
|
|
||||||
@@ -131,4 +131,12 @@ public class LevelConfigurations extends ConfigurationPart {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ public CarpetFixes carpetFixes;
|
|
||||||
+
|
|
||||||
+ public class CarpetFixes extends ConfigurationPart {
|
|
||||||
+
|
|
||||||
+ public boolean enabled = DO_OPTIMIZE;
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user