Compare commits
212 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a76a54022 | ||
|
|
69f54abeb4 | ||
|
|
21c48c40ab | ||
|
|
da3ba44a68 | ||
|
|
c8fc7caebe | ||
|
|
636ce2bd23 | ||
|
|
6797bd8b78 | ||
|
|
ace91a0dc5 | ||
|
|
1e82b57cc4 | ||
|
|
7b70a98610 | ||
|
|
e6fc667805 | ||
|
|
d123188caf | ||
|
|
1abc34b454 | ||
|
|
91950ecff6 | ||
|
|
a33d418681 | ||
|
|
fc0a57dbe5 | ||
|
|
a3e66a0818 | ||
|
|
e62b92a5fe | ||
|
|
e495d7551a | ||
|
|
cfff357167 | ||
|
|
b5cd6676a5 | ||
|
|
c79e1e84cd | ||
|
|
9faf5a6bc3 | ||
|
|
c5918afc0c | ||
|
|
c2b3876dd8 | ||
|
|
fac18113ba | ||
|
|
7c9ac71cd7 | ||
|
|
39aadd4c43 | ||
|
|
4c65932eff | ||
|
|
846a8957d0 | ||
|
|
43b6291f3c | ||
|
|
9f6872b6c1 | ||
|
|
051ca3a78e | ||
|
|
08972709ed | ||
|
|
5204ca0b68 | ||
|
|
3278a7328f | ||
|
|
31c177db34 | ||
|
|
ffa605c911 | ||
|
|
1f37cf7180 | ||
|
|
5906936c59 | ||
|
|
442e8e0875 | ||
|
|
409797e02a | ||
|
|
25e4980031 | ||
|
|
117c56f3e1 | ||
|
|
761e837bc8 | ||
|
|
66c6a4d83c | ||
|
|
0bf1d06344 | ||
|
|
bcc0027c8f | ||
|
|
acc0ce346d | ||
|
|
2253da417d | ||
|
|
d047fef218 | ||
|
|
ec102f20d3 | ||
|
|
bc3711ebf3 | ||
|
|
f3b7b86532 | ||
|
|
47aeaffbdb | ||
|
|
d9b3b3a062 | ||
|
|
400162acc9 | ||
|
|
3ef1929507 | ||
|
|
357471c126 | ||
|
|
d23067e50d | ||
|
|
05dd78f0b8 | ||
|
|
1a2c9e0c5d | ||
|
|
423038f3dc | ||
|
|
7091e85fb9 | ||
|
|
6b0f7bcb46 | ||
|
|
490feb33c1 | ||
|
|
49f6ea378b | ||
|
|
fca8e2489e | ||
|
|
11e11dcbb2 | ||
|
|
aa5645b695 | ||
|
|
bf2e1a599f | ||
|
|
07104c8191 | ||
|
|
6fa36fbf36 | ||
|
|
383096325e | ||
|
|
22172ae225 | ||
|
|
bcadea3a13 | ||
|
|
e4b194d2d1 | ||
|
|
fdadeb897f | ||
|
|
37de50054d | ||
|
|
bcea4943f7 | ||
|
|
8080aa21e3 | ||
|
|
700708fcda | ||
|
|
e42a638149 | ||
|
|
182af09174 | ||
|
|
5920aced80 | ||
|
|
1734aa29a7 | ||
|
|
5dc2168275 | ||
|
|
4ddd0748f3 | ||
|
|
6e2bb01d85 | ||
|
|
8183b8084f | ||
|
|
c3b16a9220 | ||
|
|
dae8cb806d | ||
|
|
c46ddfb6f9 | ||
|
|
6c2091b610 | ||
|
|
550c12f16a | ||
|
|
5329f509c9 | ||
|
|
e4f61bf6ed | ||
|
|
2cac3f6a43 | ||
|
|
3544d87a45 | ||
|
|
caa9c93355 | ||
|
|
cb84a72508 | ||
|
|
87ec6b249e | ||
|
|
3241691aea | ||
|
|
42eb17973b | ||
|
|
003871482b | ||
|
|
0f11149b2d | ||
|
|
4b70830774 | ||
|
|
6cb20103b6 | ||
|
|
36ebcb0220 | ||
|
|
ee68309ac0 | ||
|
|
5c2253f82e | ||
|
|
00bd3e0d3c | ||
|
|
67fbb12ac6 | ||
|
|
c8fb92aa1c | ||
|
|
745ad5f5ec | ||
|
|
30cb112a1f | ||
|
|
f0af4c4a47 | ||
|
|
00d0546253 | ||
|
|
b2bd357fa1 | ||
|
|
4f38df3a86 | ||
|
|
b349445305 | ||
|
|
1c9c208630 | ||
|
|
c0339695f2 | ||
|
|
14575216df | ||
|
|
ac92226367 | ||
|
|
08b0b99099 | ||
|
|
ff5d7eeea5 | ||
|
|
a85661d795 | ||
|
|
19995071a3 | ||
|
|
7513492ac3 | ||
|
|
f2efa03460 | ||
|
|
128eaee010 | ||
|
|
13dcd67dab | ||
|
|
c7c48f43ce | ||
|
|
4ba9f92ee8 | ||
|
|
34e46f1f2e | ||
|
|
dd0cf087a7 | ||
|
|
af48f69929 | ||
|
|
27dfe607d0 | ||
|
|
27b6e63860 | ||
|
|
20eb06bf00 | ||
|
|
442bfbc106 | ||
|
|
62f0bf8fb1 | ||
|
|
7a00395624 | ||
|
|
11e4c346e0 | ||
|
|
f9ccfb334c | ||
|
|
11c497aaf3 | ||
|
|
404fc76d6a | ||
|
|
33a9f946c8 | ||
|
|
bc7c3c582b | ||
|
|
dbd451d716 | ||
|
|
233e2ad297 | ||
|
|
0f543491f8 | ||
|
|
25f895f7b4 | ||
|
|
8297dd7053 | ||
|
|
a58622c682 | ||
|
|
fbcc0c8d7e | ||
|
|
7079ea5c72 | ||
|
|
5a042b7890 | ||
|
|
5de00a857b | ||
|
|
4a4988c41c | ||
|
|
61ca246d3e | ||
|
|
5349f5efca | ||
|
|
1e49000508 | ||
|
|
c10c214be6 | ||
|
|
f56e62551a | ||
|
|
c86fdfed02 | ||
|
|
1e67babfd1 | ||
|
|
cc4707ca24 | ||
|
|
5f8b7c1634 | ||
|
|
cdbf9dd0c0 | ||
|
|
f543fd9c9e | ||
|
|
9badc96ea9 | ||
|
|
7a57b7161e | ||
|
|
032462c78b | ||
|
|
34286527e1 | ||
|
|
67d6c32cd7 | ||
|
|
f2fde3abbe | ||
|
|
433dac7ed2 | ||
|
|
ae9187f3ec | ||
|
|
3a846f9469 | ||
|
|
453e83da00 | ||
|
|
ac12b75cf0 | ||
|
|
c6c1bac6ff | ||
|
|
92ade31e1a | ||
|
|
b52c6cf4a1 | ||
|
|
c0390c4da4 | ||
|
|
69b45eb0d3 | ||
|
|
f367ca28fd | ||
|
|
fb955ce090 | ||
|
|
0f82d8a3ce | ||
|
|
5e77896e2b | ||
|
|
9ad8ed7904 | ||
|
|
5ac0f49670 | ||
|
|
f23535bc3b | ||
|
|
719f0e7e5f | ||
|
|
81965b216b | ||
|
|
493c4f73fb | ||
|
|
517a07fde4 | ||
|
|
85f6e901d2 | ||
|
|
cc53d330c9 | ||
|
|
341529dcfb | ||
|
|
582d2af78f | ||
|
|
1bc915e6d8 | ||
|
|
9ffb9a2959 | ||
|
|
976cf01c7d | ||
|
|
bb61118ebd | ||
|
|
59d80138c2 | ||
|
|
3a858c547c | ||
|
|
1b6c470981 | ||
|
|
f60832eac3 | ||
|
|
c1ab15d472 |
32
.github/workflows/build.yml
vendored
32
.github/workflows/build.yml
vendored
@@ -1,32 +0,0 @@
|
||||
name: Patch and Build
|
||||
on: [ push, pull_request ]
|
||||
jobs:
|
||||
build:
|
||||
# Only run on PRs if the source branch is on someone else's repo
|
||||
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Git Repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- name: Cache Gradle
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/gradle.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v2.3.0
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '16'
|
||||
- name: Configure Git User Details
|
||||
run: git config --global user.email "actions@github.com" && git config --global user.name "Github Actions"
|
||||
- name: Apply Patches
|
||||
run: ./gradlew applyPatches --stacktrace
|
||||
- name: Build
|
||||
run: ./gradlew build --stacktrace
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,5 +1,10 @@
|
||||
.gradle
|
||||
/build/
|
||||
.idea
|
||||
run
|
||||
slice-api
|
||||
slice-server
|
||||
paper-api-generator
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
@@ -12,3 +17,5 @@ gradle-app.setting
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
/commit.sh
|
||||
/publish.sh
|
||||
|
||||
@@ -8,3 +8,7 @@
|
||||
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
|
||||
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
|
||||
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
|
||||
# To import minecraft data files, like the default chat type, use `mc_data` as the prefix:
|
||||
# mc_data chat_type/chat.json
|
||||
# mc_data dimension_type/overworld.json
|
||||
#
|
||||
5
build-data/mappings-patch.tiny
Normal file
5
build-data/mappings-patch.tiny
Normal file
@@ -0,0 +1,5 @@
|
||||
tiny 2 0 spigot mojang+yarn
|
||||
|
||||
# Originally DistanceManager, which also implements DistanceManager, so clashes since the implemented class
|
||||
# is imported and not fully qualified. Easiest fix is to just change the name
|
||||
c net/minecraft/server/level/PlayerChunkMap$a net/minecraft/server/level/ChunkMap$ChunkDistanceManager
|
||||
18
build-data/paper.at
Normal file
18
build-data/paper.at
Normal file
@@ -0,0 +1,18 @@
|
||||
# You can use this file to change the access modifiers on a member
|
||||
# This line would make the field rollAmount public in Bee
|
||||
#public net.minecraft.world.entity.animal.Bee rollAmount
|
||||
# This line would make the field public and remove the final modifier
|
||||
#public-f net.minecraft.network.protocol.game.ClientboundChatPacket sender
|
||||
# Leave out the member and it will apply to the class itself
|
||||
# More info, see here https://mcforge.readthedocs.io/en/latest/advanced/accesstransformers/#access-modifiers
|
||||
|
||||
# Remap/Decompile fix (unclear why this is happening)
|
||||
public net.minecraft.server.MinecraftServer doRunTask(Lnet/minecraft/server/TickTask;)V
|
||||
|
||||
# AT remap issue? todo 1.18
|
||||
public net.minecraft.world.level.dimension.end.EndDragonFight findExitPortal()Lnet/minecraft/world/level/block/state/pattern/BlockPattern$BlockPatternMatch;
|
||||
public net.minecraft.nbt.TagParser readArrayTag()Lnet/minecraft/nbt/Tag;
|
||||
|
||||
# TODO 1.20 remapSpigotAt.at doesn't remap the return type for this method for some reason
|
||||
public net/minecraft/world/entity/Display$TextDisplay getText()Lnet/minecraft/network/chat/Component;
|
||||
public net/minecraft/world/entity/Display$BlockDisplay getBlockState()Lnet/minecraft/world/level/block/state/BlockState;
|
||||
28
build-data/reobf-mappings-patch.tiny
Normal file
28
build-data/reobf-mappings-patch.tiny
Normal file
@@ -0,0 +1,28 @@
|
||||
# We would like for paperweight to generate 100% perfect reobf mappings (and deobf mappings for that matter).
|
||||
# But unfortunately it's not quite there yet - and it may be some time before that happens. Generating perfect mappings
|
||||
# from Spigot's mappings is extremely difficult due to Spigot's bad tooling and bad mappings. To add insult to injury
|
||||
# we remap Spigot's _source code_ which is a lot more complex and error-prone than bytecode remapping. So with all that
|
||||
# said, this file exists to help fill in the gap.
|
||||
#
|
||||
# We will continue to improve paperweight and will work on fixing these issues so they don't come up in the first place,
|
||||
# but these mappings exist to prevent these issues from holding everything else in Paper up while we work through all
|
||||
# of these issues. Due to the complex nature of mappings generation and the debugging difficulty involved it may take
|
||||
# a significant amount of time for us to track down every possible issue, so this file will likely be around and in
|
||||
# use - at least in some capacity - for a long time.
|
||||
|
||||
tiny 2 0 mojang+yarn spigot
|
||||
|
||||
# CraftBukkit changes type
|
||||
c net/minecraft/server/level/ServerLevel net/minecraft/server/level/WorldServer
|
||||
f Lnet/minecraft/world/level/storage/PrimaryLevelData; serverLevelData K
|
||||
|
||||
c net/minecraft/world/level/chunk/LevelChunk net/minecraft/world/level/chunk/Chunk
|
||||
f Lnet/minecraft/server/level/ServerLevel; level r
|
||||
|
||||
# See mappings-patch.tiny
|
||||
c net/minecraft/server/level/ChunkMap net/minecraft/server/level/PlayerChunkMap
|
||||
f Lnet/minecraft/server/level/ChunkMap$ChunkDistanceManager; distanceManager F
|
||||
|
||||
# The method is made public by Spigot, which then causes accidental overrides
|
||||
c net/minecraft/world/entity/Entity net/minecraft/world/entity/Entity
|
||||
m ()Z isInRain isInRain0
|
||||
@@ -3,21 +3,23 @@ import io.papermc.paperweight.util.constants.*
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "7.1.0" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.2.0"
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.12"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://papermc.io/repo/repository/maven-public/"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
content { onlyForConfigurations(PAPERCLIP_CONFIG) }
|
||||
maven(paperMavenPublicUrl) {
|
||||
content { onlyForConfigurations(configurations.paperclip.name) }
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.6.0:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:1.5.498.12")
|
||||
paperclip("io.papermc:paperclip:2.0.1")
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.10:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -26,7 +28,7 @@ allprojects {
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(16))
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,7 +36,7 @@ allprojects {
|
||||
subprojects {
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(16)
|
||||
options.release.set(17)
|
||||
}
|
||||
tasks.withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
@@ -45,28 +47,32 @@ subprojects {
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven("https://oss.sonatype.org/content/groups/public/")
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://ci.emc.gs/nexus/content/groups/aikar/")
|
||||
maven("https://repo.aikar.co/content/groups/aikar")
|
||||
maven("https://repo.md-5.net/content/repositories/releases/")
|
||||
maven("https://hub.spigotmc.org/nexus/content/groups/public/")
|
||||
maven(paperMavenPublicUrl)
|
||||
}
|
||||
}
|
||||
|
||||
paperweight {
|
||||
serverProject.set(project(":Slice-Server"))
|
||||
serverProject.set(project(":slice-server"))
|
||||
|
||||
remapRepo.set("https://maven.fabricmc.net/")
|
||||
decompileRepo.set("https://files.minecraftforge.net/maven/")
|
||||
remapRepo.set(paperMavenPublicUrl)
|
||||
decompileRepo.set(paperMavenPublicUrl)
|
||||
|
||||
usePaperUpstream(providers.gradleProperty("paperRef")) {
|
||||
withPaperPatcher {
|
||||
apiPatchDir.set(layout.projectDirectory.dir("patches/api"))
|
||||
apiOutputDir.set(layout.projectDirectory.dir("Slice-API"))
|
||||
apiOutputDir.set(layout.projectDirectory.dir("slice-api"))
|
||||
|
||||
serverPatchDir.set(layout.projectDirectory.dir("patches/server"))
|
||||
serverOutputDir.set(layout.projectDirectory.dir("Slice-Server"))
|
||||
serverOutputDir.set(layout.projectDirectory.dir("slice-server"))
|
||||
}
|
||||
|
||||
patchTasks {
|
||||
register("generatedApi") {
|
||||
isBareDirectory.set(true)
|
||||
upstreamDirPath.set("paper-api-generator/generated")
|
||||
patchDir.set(layout.projectDirectory.dir("patches/generatedApi"))
|
||||
outputDir.set(layout.projectDirectory.dir("paper-api-generator/generated"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,33 +86,12 @@ tasks.generateDevelopmentBundle {
|
||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||
libraryRepositories.set(
|
||||
listOf(
|
||||
"https://libraries.minecraft.net/",
|
||||
"https://maven.quiltmc.org/repository/release/",
|
||||
"https://repo.aikar.co/content/groups/aikar",
|
||||
"https://ci.emc.gs/nexus/content/groups/aikar/",
|
||||
"https://papermc.io/repo/repository/maven-public/",
|
||||
"https://repo.velocitypowered.com/snapshots/",
|
||||
"https://ysera.dyndns.org:444/releases/"
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
paperMavenPublicUrl
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
// Publishing API:
|
||||
// ./gradlew :Slice-API:publish[ToMavenLocal]
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Ysera"
|
||||
url = uri("https://ysera.dyndns.org:444/releases")
|
||||
// See Gradle docs for how to provide credentials to PasswordCredentials
|
||||
// https://docs.gradle.org/current/samples/sample_publishing_credentials.html
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
// Publishing dev bundle:
|
||||
// ./gradlew publishDevBundlePublicationTo(MavenLocal|MyRepoSnapshotsRepository) -PpublishDevBundle
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=com.lokamc.slice
|
||||
version=1.17.1-R0.1-SNAPSHOT
|
||||
version=1.20.4-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.17.1
|
||||
paperRef=bf23668bc56a31ccf9ff7c7b290bb0442afebff6
|
||||
mcVersion=1.20.4
|
||||
paperRef=5436d44bf2509ff89129f8790ee4643f09c72871
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
249
gradlew
vendored
Executable file
249
gradlew
vendored
Executable file
@@ -0,0 +1,249 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (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
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
89
gradlew.bat
vendored
Normal file
89
gradlew.bat
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f0f3a57a0ce76b4736219c6ece52b8bc47a7a4ec
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
@@ -0,0 +1,50 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Thrown whenever a Player's shield is disabled
|
||||
+ */
|
||||
+public class PlayerShieldDisableEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity damager;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public PlayerShieldDisableEvent(@NotNull final Player player, @Nullable final Entity damager) {
|
||||
+ super(player);
|
||||
+ this.damager = damager;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity getDamager() {
|
||||
+ return damager;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 09:41:27 -0500
|
||||
Subject: [PATCH] Set BlockData without light update
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:29:11 -0500
|
||||
Subject: [PATCH] Set BlockData without light updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index ad8bce01ba459a036cd4ebbbe4fc974021924fe2..6ef43ae39a8ad4ed0e9a7bf68c17840576e235ea 100644
|
||||
index 49974558799830d827f9ccd65a8bafee3fb0376b..93fcb1562e58a3a613eccd28cae1e87e26a158c9 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -287,6 +287,28 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@@ -298,6 +298,28 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
*/
|
||||
void setBlockData(@NotNull BlockData data, boolean applyPhysics);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:00:51 -0500
|
||||
Date: Mon, 10 Apr 2023 07:30:30 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 15:20:16 -0500
|
||||
Subject: [PATCH] Multiple Entries with Scoreboards
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index d5b39fb4fc16a342b5661e08df1506858168d20d..9ec00b045fe85701ce29c0ad10eb9921733107b3 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.bukkit.scoreboard;
|
||||
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.Set;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@@ -317,6 +318,20 @@ public interface Team {
|
||||
*/
|
||||
void addEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * This puts a collection of entries onto this team for the scoreboard which results in one
|
||||
+ * packet for the updates rather than a packet-per-entry.
|
||||
+ * <p>
|
||||
+ * Entries on other teams will be removed from their respective teams.
|
||||
+ *
|
||||
+ * @param entries the entries to add
|
||||
+ * @throws IllegalArgumentException if entries are null
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ void addEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Removes the player from this team.
|
||||
*
|
||||
@@ -340,6 +355,19 @@ public interface Team {
|
||||
*/
|
||||
boolean removeEntry(@NotNull String entry) throws IllegalStateException, IllegalArgumentException;
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Removes a collection of entries from this team which results in one
|
||||
+ * packet for the updates rather than a packet-per-entry.
|
||||
+ *
|
||||
+ * @param entries the entries to remove
|
||||
+ * @return if any of the entries were a part of this team
|
||||
+ * @throws IllegalArgumentException if entry is null
|
||||
+ * @throws IllegalStateException if this team has been unregistered
|
||||
+ */
|
||||
+ boolean removeEntries(@NotNull Collection<String> entries) throws IllegalStateException, IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Unregisters this team from the Scoreboard
|
||||
*
|
||||
@@ -1,16 +1,16 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 29 Sep 2021 08:40:37 -0500
|
||||
Date: Mon, 10 Apr 2023 07:31:55 -0500
|
||||
Subject: [PATCH] Add provided Material to getDrops
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index cd63406809aadbcc53857aaef31053915278dfc0..ab4982d52185bbc80d506da2a961345d46710efa 100644
|
||||
index 4d817cdebb6d6b3823c3a62aa9a0147ab720c5e0..c5017cd1bc1bea603a2e0b4f4d1541abb8a33911 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -602,6 +602,20 @@ public interface Block extends Metadatable, net.kyori.adventure.translation.Tran
|
||||
@@ -675,6 +675,20 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
@NotNull
|
||||
Collection<ItemStack> getDrops(@NotNull ItemStack tool, @Nullable Entity entity);
|
||||
Collection<ItemStack> getDrops(@Nullable ItemStack tool, @Nullable Entity entity); // Paper
|
||||
|
||||
+ // Slice start
|
||||
+ /**
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 16:36:29 -0500
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:36:22 -0500
|
||||
Subject: [PATCH] Add Player to SpongeAbsorbEvent
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 08:52:40 -0500
|
||||
Subject: [PATCH] World Instance Flag
|
||||
Date: Mon, 10 Apr 2023 07:37:06 -0500
|
||||
Subject: [PATCH] Add World Instance flag
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 4f673e9123145dc78564dc3eef0edf75795dafc2..c840fccc7d5eab215886c3281be3a6257fa01aad 100644
|
||||
index 35fb5047dd8a8521586a9ca9f8d70881355fb7f5..cac1f89dcca7cb613dcd3db5d9287ba2c61905fc 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2606,6 +2606,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -2713,6 +2713,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
*/
|
||||
public void setAutoSave(boolean value);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 07:59:41 -0600
|
||||
Subject: [PATCH] Add player data saving events
|
||||
Date: Mon, 10 Apr 2023 07:38:40 -0500
|
||||
Subject: [PATCH] Add PlayerData Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
|
||||
65
patches/api/0007-Add-PlayerGetRespawnLocationEvent.patch
Normal file
65
patches/api/0007-Add-PlayerGetRespawnLocationEvent.patch
Normal file
@@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:46:19 -0500
|
||||
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3823a19c0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
|
||||
@@ -0,0 +1,53 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a respawn event tries to determine the location of a respawn
|
||||
+ */
|
||||
+public class PlayerGetRespawnLocationEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private Location respawnLocation;
|
||||
+
|
||||
+ public PlayerGetRespawnLocationEvent(@NotNull final Player respawnPlayer) {
|
||||
+ super(respawnPlayer);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current respawn location
|
||||
+ *
|
||||
+ * @return Location current respawn location
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Location getRespawnLocation() {
|
||||
+ return this.respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Sets the new respawn location
|
||||
+ *
|
||||
+ * @param respawnLocation new location for the respawn
|
||||
+ */
|
||||
+ public void setRespawnLocation(@NotNull Location respawnLocation) {
|
||||
+ Validate.notNull(respawnLocation, "Respawn location can not be null");
|
||||
+ Validate.notNull(respawnLocation.getWorld(), "Respawn world can not be null");
|
||||
+
|
||||
+ this.respawnLocation = respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,52 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 12:04:50 -0600
|
||||
Subject: [PATCH] PlayerTrackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0532a7986a8091e82f1fc64b9654be26d6c8ea5e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerTrackEntityEvent.java
|
||||
@@ -0,0 +1,40 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player tracks an entity.
|
||||
+ */
|
||||
+public class PlayerTrackEntityEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity tracked;
|
||||
+
|
||||
+ public PlayerTrackEntityEvent(@NotNull final Player player, @NotNull final Entity tracked) {
|
||||
+ super(player);
|
||||
+ this.tracked = tracked;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity newly tracked by the Player
|
||||
+ *
|
||||
+ * @return Entity the player is now tracking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getTracked() {
|
||||
+ return tracked;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
35
patches/api/0008-Set-multiple-team-settings-at-once.patch
Normal file
35
patches/api/0008-Set-multiple-team-settings-at-once.patch
Normal file
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:52:54 -0500
|
||||
Subject: [PATCH] Set multiple team settings at once
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index cacb58d25c249e2ecd6083ed0f30d5ffb345220a..b0ed2c57321dae0d00b47dd23e67866592249993 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -514,6 +514,24 @@ public interface Team extends net.kyori.adventure.audience.ForwardingAudience {
|
||||
boolean hasEntity(@NotNull org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException;
|
||||
// Paper end - improve scoreboard entries
|
||||
|
||||
+ //Slice start
|
||||
+ /**
|
||||
+ * Fully set all team options, combining all 5 options into one packet send, rather than one packet sent
|
||||
+ * for every single option change.
|
||||
+ * @param displayName New display name
|
||||
+ * @param prefix New prefix
|
||||
+ * @param suffix New suffix
|
||||
+ * @param color new color
|
||||
+ * @param options A Paired list of options
|
||||
+ * @throws IllegalStateException
|
||||
+ */
|
||||
+ void teamOptions(@Nullable net.kyori.adventure.text.Component displayName,
|
||||
+ @Nullable net.kyori.adventure.text.Component prefix,
|
||||
+ @Nullable net.kyori.adventure.text.Component suffix,
|
||||
+ @Nullable net.kyori.adventure.text.format.NamedTextColor color,
|
||||
+ @Nullable java.util.List<org.apache.commons.lang3.tuple.Pair<Option, OptionStatus>> options) throws IllegalStateException;
|
||||
+ //Slice end
|
||||
+
|
||||
/**
|
||||
* Represents an option which may be applied to this team.
|
||||
*/
|
||||
30
patches/api/0009-Smooth-Teleports.patch
Normal file
30
patches/api/0009-Smooth-Teleports.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:55:36 -0500
|
||||
Subject: [PATCH] Smooth Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index c6cb4f17469a8f2e60dd3e28d41402851ce5fb21..7548f66864cd797d3dc51b91c6cf4a99cede4d34 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3574,6 +3574,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
String getClientBrandName();
|
||||
// Paper end
|
||||
|
||||
+ /**
|
||||
+ * This abuses some of how Minecraft works and allows teleporting a player to another world without
|
||||
+ * triggering typical respawn packets. All of natural state of chunk resends, entity adds/removes, etc still
|
||||
+ * happen but the visual "refresh" of a world change is hidden. Depending on the destination location/world,
|
||||
+ * this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
|
||||
+ *
|
||||
+ * @param location New location to teleport this Player to
|
||||
+ */
|
||||
+ // Slice start
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
||||
+ void teleportWithoutRespawn(@NotNull Location location);
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start - Teleport API
|
||||
/**
|
||||
* Sets the player's rotation.
|
||||
21
patches/api/0010-AntiXray-Bypass.patch
Normal file
21
patches/api/0010-AntiXray-Bypass.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:46:54 -0500
|
||||
Subject: [PATCH] AntiXray Bypass
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7548f66864cd797d3dc51b91c6cf4a99cede4d34..d1920e61d3c9afb1d99379bfb9849adad2c8c06f 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3082,6 +3082,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra);
|
||||
|
||||
+ // Slice start
|
||||
+ void toggleAntiXrayBypass(boolean bypass);
|
||||
+ // Slice end
|
||||
+
|
||||
/**
|
||||
* Spawns the particle (the number of times specified by count)
|
||||
* at the target location. The position of each particle will be
|
||||
97
patches/api/0011-Add-PlayerPreChunkLoadEvent.patch
Normal file
97
patches/api/0011-Add-PlayerPreChunkLoadEvent.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:47:44 -0500
|
||||
Subject: [PATCH] Add PlayerPreChunkLoadEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java b/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..946af80dd54f602b5ceb61365ca98b06411f8177
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java
|
||||
@@ -0,0 +1,70 @@
|
||||
+package io.papermc.paper.event.packet;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.World;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Is called when a {@link Player} is about to receive a {@link Chunk}
|
||||
+ * <p>
|
||||
+ * Can be cancelled, but only use if you really really mean it.
|
||||
+ */
|
||||
+public class PlayerPreChunkLoadEvent extends Event implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final World world;
|
||||
+ private final int chunkX;
|
||||
+ private final int chunkZ;
|
||||
+ private final Player player;
|
||||
+ private boolean cancel;
|
||||
+
|
||||
+ public PlayerPreChunkLoadEvent(@NotNull World world, int chunkX, int chunkZ, @NotNull Player player) {
|
||||
+ this.world = world;
|
||||
+ this.chunkX = chunkX;
|
||||
+ this.chunkZ = chunkZ;
|
||||
+ this.player = player;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public World getWorld() {
|
||||
+ return world;
|
||||
+ }
|
||||
+
|
||||
+ public int getChunkX() {
|
||||
+ return chunkX;
|
||||
+ }
|
||||
+
|
||||
+ public int getChunkZ() {
|
||||
+ return chunkZ;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Player getPlayer() {
|
||||
+ return player;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 671321b77475f20ec1cf682a184d42497160dce3..2b9547dd059cb1e6dd224de813ba2193e2440135 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -527,6 +527,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
//@Deprecated // Paper
|
||||
public boolean refreshChunk(int x, int z);
|
||||
|
||||
+ @NotNull
|
||||
+ it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(@NotNull Player p); // Slice
|
||||
+
|
||||
/**
|
||||
* Gets whether the chunk at the specified chunk coordinates is force
|
||||
* loaded.
|
||||
151
patches/api/0012-Equipment-Packet-Caching.patch
Normal file
151
patches/api/0012-Equipment-Packet-Caching.patch
Normal file
@@ -0,0 +1,151 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 07:36:40 -0500
|
||||
Subject: [PATCH] Equipment Packet Caching
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 65112eae8b92344796850b1e4c89e75443eab2fe..b263b8620e1119baa519cc225ff7fcfd02b9fa54 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1445,4 +1445,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
void setBodyYaw(float bodyYaw);
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * @param p The player to send this entity's equipment packet to
|
||||
+ */
|
||||
+ void sendEquipment(@NotNull Player p);
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..48d2eb3bbb8dbcb6714ee47c4159c0604657a78c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package org.bukkit.event.entity;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.inventory.EquipmentSlot;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when requesting a cached equipment item lookup
|
||||
+ */
|
||||
+public class EntityEquipmentItemLookup extends EntityEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final String tag;
|
||||
+ private final EquipmentSlot equipmentSlot;
|
||||
+ private ItemStack itemStack;
|
||||
+
|
||||
+ public EntityEquipmentItemLookup(@NotNull final Entity entity, @NotNull String tag, @NotNull EquipmentSlot slot, @NotNull final ItemStack itemStack) {
|
||||
+ super(entity);
|
||||
+ this.tag = tag;
|
||||
+ this.equipmentSlot = slot;
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ public void setItemStack(@NotNull ItemStack itemStack) {
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public EquipmentSlot getEquipmentSlot() {
|
||||
+ return equipmentSlot;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public String getTag() {
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a8f83d19341c2f3024ba8113478ed482657b8589
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java
|
||||
@@ -0,0 +1,63 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player is about to receive an equipment packet about another player
|
||||
+ */
|
||||
+public class PlayerReceiveEquipmentEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Entity tracked;
|
||||
+ private boolean cancel;
|
||||
+ private String tag;
|
||||
+
|
||||
+ public PlayerReceiveEquipmentEvent(@NotNull final Player player, @NotNull final Entity tracked) {
|
||||
+ super(player);
|
||||
+ this.tracked = tracked;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the tracked entity
|
||||
+ *
|
||||
+ * @return Entity the player is now tracking
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public Entity getTracked() {
|
||||
+ return tracked;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public String getTag() {
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
+ public void setTag(@Nullable String tag) {
|
||||
+ this.tag = tag;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancel = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:16:51 -0500
|
||||
Subject: [PATCH] Add Force Crit to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
index 148f46f4572a778f090b461808b53cf9cad10e11..abb2c6f8035c81bd2cb43bf5aa9b3744c10e5e48 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -28,6 +28,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
private final boolean willAttack;
|
||||
|
||||
private boolean cancelled;
|
||||
+ private boolean forceCrit; // Slice
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PrePlayerAttackEntityEvent(@NotNull Player player, @NotNull Entity attacked, boolean willAttack) {
|
||||
@@ -60,6 +61,16 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
return this.willAttack;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public boolean isForceCrit() {
|
||||
+ return forceCrit;
|
||||
+ }
|
||||
+
|
||||
+ public void setForceCrit(boolean forceCrit) {
|
||||
+ this.forceCrit = forceCrit;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:17:39 -0500
|
||||
Subject: [PATCH] Add Preventing KB Bonus to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
index abb2c6f8035c81bd2cb43bf5aa9b3744c10e5e48..0ad3d64b0b0281a9afc998faff371bbdf000d864 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -29,6 +29,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
|
||||
private boolean cancelled;
|
||||
private boolean forceCrit; // Slice
|
||||
+ private boolean preventKnockbackBonus; // Slice
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PrePlayerAttackEntityEvent(@NotNull Player player, @NotNull Entity attacked, boolean willAttack) {
|
||||
@@ -69,6 +70,15 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
public void setForceCrit(boolean forceCrit) {
|
||||
this.forceCrit = forceCrit;
|
||||
}
|
||||
+
|
||||
+ public boolean isPreventKnockbackBonus() {
|
||||
+ return preventKnockbackBonus;
|
||||
+ }
|
||||
+
|
||||
+ public void setPreventKnockbackBonus(boolean preventKnockbackBonus) {
|
||||
+ this.preventKnockbackBonus = preventKnockbackBonus;
|
||||
+ }
|
||||
+
|
||||
// Slice end
|
||||
|
||||
@Override
|
||||
66
patches/api/0015-PlayerLoadStatsEvent.patch
Normal file
66
patches/api/0015-PlayerLoadStatsEvent.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:25:26 -0500
|
||||
Subject: [PATCH] PlayerLoadStatsEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..80b67d390152b114ad385f7eb6af5ef975b7ca20
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package com.destroystokyo.paper.event.player;
|
||||
+
|
||||
+import com.google.gson.JsonObject;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+/**
|
||||
+ * Calls an event in which player stats can be provided. If null, will load from disk, otherwise will use provided data
|
||||
+ */
|
||||
+public class PlayerLoadStatsEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final UUID playerId;
|
||||
+ private JsonObject statistics;
|
||||
+
|
||||
+ public PlayerLoadStatsEvent(@NotNull UUID playerId) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.playerId = playerId;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the player's unique ID.
|
||||
+ *
|
||||
+ * @return The unique ID
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public UUID getUniqueId() {
|
||||
+ return playerId;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public JsonObject getStatistics() {
|
||||
+ return statistics;
|
||||
+ }
|
||||
+
|
||||
+ public void setStatistics(@NotNull JsonObject statistics) {
|
||||
+ this.statistics = statistics;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
||||
19
patches/api/0016-Warden-setCanDespawn-API.patch
Normal file
19
patches/api/0016-Warden-setCanDespawn-API.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 23 Jun 2023 11:21:27 -0500
|
||||
Subject: [PATCH] Warden setCanDespawn API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java
|
||||
index efaa45f41bc1dc8df6665c55b4e5ade343d60d4c..36ea5429b9a18a857fd1fea30b52f69a182c7ede 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Warden.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Warden.java
|
||||
@@ -111,4 +111,6 @@ public interface Warden extends Monster {
|
||||
*/
|
||||
ANGRY;
|
||||
}
|
||||
-}
|
||||
+
|
||||
+ void setCanDespawn(boolean canDespawn); // Slice
|
||||
+}
|
||||
\ No newline at end of file
|
||||
@@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 22 Aug 2023 06:22:17 -0500
|
||||
Subject: [PATCH] Add reason to PlayerConnectionCloseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
index d0fb13adc140f1ca74d0c3448f92baa60684f3e2..3c69210c2d665794fb77b6ff23d632a02e626875 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
@@ -42,13 +42,19 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
@NotNull private final UUID playerUniqueId;
|
||||
@NotNull private final String playerName;
|
||||
@NotNull private final InetAddress ipAddress;
|
||||
+ @NotNull private final ConnectionCloseReason reason;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) {
|
||||
+ this(playerUniqueId, playerName, ipAddress, ConnectionCloseReason.NORMAL, async);
|
||||
+ }
|
||||
+
|
||||
+ public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, @NotNull ConnectionCloseReason reason, final boolean async) {
|
||||
super(async);
|
||||
this.playerUniqueId = playerUniqueId;
|
||||
this.playerName = playerName;
|
||||
this.ipAddress = ipAddress;
|
||||
+ this.reason = reason;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,4 +91,26 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the reason for the closed connection.
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ public ConnectionCloseReason getReason() {
|
||||
+ return this.reason;
|
||||
+ }
|
||||
+
|
||||
+ public enum ConnectionCloseReason {
|
||||
+ /**
|
||||
+ * Player disconnected normally
|
||||
+ */
|
||||
+ NORMAL,
|
||||
+
|
||||
+ /**
|
||||
+ * Player has invalid data for some reason.
|
||||
+ * <p>
|
||||
+ * One example of this is a player logging into an unloaded world.
|
||||
+ */
|
||||
+ INVALID_PLAYER_DATA,
|
||||
+ }
|
||||
}
|
||||
41
patches/api/0018-Add-timeDamaged-to-EntityDamageEvent.patch
Normal file
41
patches/api/0018-Add-timeDamaged-to-EntityDamageEvent.patch
Normal file
@@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 10 Sep 2023 07:41:26 -0500
|
||||
Subject: [PATCH] Add timeDamaged to EntityDamageEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
index 446b3ffd5caca5344be1c250475679834cd0d4a2..f2beba90acfd251817eb218c35dcf58309d808b1 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
@@ -30,6 +30,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final DamageCause cause;
|
||||
private final DamageSource damageSource;
|
||||
+ private long timeDamaged = System.currentTimeMillis(); // Slice
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public EntityDamageEvent(@NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
@@ -221,6 +222,22 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
return damageSource;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * @return Get the time the damage event happened.
|
||||
+ */
|
||||
+ public long getTimeDamaged() {
|
||||
+ return timeDamaged;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @param timeDamaged Set the time the damage event happened, if you so choose.
|
||||
+ */
|
||||
+ public void setTimeDamaged(long timeDamaged) {
|
||||
+ this.timeDamaged = timeDamaged;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
73
patches/api/0019-ChunkStatusChangeEvent.patch
Normal file
73
patches/api/0019-ChunkStatusChangeEvent.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 6 Nov 2023 08:19:46 -0600
|
||||
Subject: [PATCH] ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9154bc8a072d8e5f3fd9790606508af048a612eb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
+package com.destroystokyo.paper.event.chunk;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
+import org.bukkit.event.Event;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+/**
|
||||
+ * Called when the Full Status of a Chunk changes
|
||||
+ */
|
||||
+public class ChunkStatusChangeEvent extends Event {
|
||||
+
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final Chunk chunk;
|
||||
+ private final ChunkStatus currentState;
|
||||
+ private final ChunkStatus newState;
|
||||
+
|
||||
+ public ChunkStatusChangeEvent(@NotNull Chunk chunk, @NotNull ChunkStatus currentState, @NotNull ChunkStatus newState) {
|
||||
+ super();
|
||||
+ this.chunk = chunk;
|
||||
+ this.currentState = currentState;
|
||||
+ this.newState = newState;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public Chunk getChunk() {
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChunkStatus getCurrentState() {
|
||||
+ return currentState;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public ChunkStatus getNewState() {
|
||||
+ return newState;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isUpgrade() {
|
||||
+ return newState.ordinal() > currentState.ordinal();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public enum ChunkStatus {
|
||||
+ INACCESSIBLE,
|
||||
+ FULL,
|
||||
+ BLOCK_TICKING,
|
||||
+ ENTITY_TICKING;
|
||||
+ }
|
||||
+}
|
||||
30
patches/api/0020-Non-saveable-entities.patch
Normal file
30
patches/api/0020-Non-saveable-entities.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 28 Dec 2023 09:11:49 -0600
|
||||
Subject: [PATCH] Non-saveable-entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 23def071492ccd715693d534cc506936e18f0f46..a1484708c2af2be5c94a0dff1394e8bdf1f90e2e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1144,4 +1144,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull String getScoreboardEntryName();
|
||||
// Paper end - entity scoreboard name
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * Returns true if the entity can be saved. If false, the entity will never be serialized or saved.
|
||||
+ */
|
||||
+ boolean isSaveable();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the entity can be serialized and saved to disk.
|
||||
+ *
|
||||
+ * @param saveable the saveable status
|
||||
+ * @see #isSaveable()
|
||||
+ */
|
||||
+ void setSaveable(boolean saveable);
|
||||
+ // Slice end
|
||||
}
|
||||
30
patches/api/0021-Vanish.patch
Normal file
30
patches/api/0021-Vanish.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 7 Jan 2024 08:27:00 -0600
|
||||
Subject: [PATCH] Vanish
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index a1484708c2af2be5c94a0dff1394e8bdf1f90e2e..8172e1e32fc86389273f5c326ce600dd65427898 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1159,4 +1159,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
void setSaveable(boolean saveable);
|
||||
// Slice end
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * Returns true if the entity is vanished and cannot emit sounds, effects, etc.
|
||||
+ */
|
||||
+ boolean isVanished();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets whether the entity is vanished and cannot emit sounds, effects, etc.
|
||||
+ *
|
||||
+ * @param vanished the saveable status
|
||||
+ * @see #isVanished()
|
||||
+ */
|
||||
+ void setVanished(boolean vanished);
|
||||
+ // Slice end
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 24 Jan 2024 11:39:14 -0600
|
||||
Subject: [PATCH] Expose getBlockPosBelowThatAffectsMyMovement
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 04853c43b99951bf0d4c96ef73724625bdaf018f..504b1b57ba604d261f5f59dc204350f75d1777f8 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -56,6 +56,8 @@ dependencies {
|
||||
implementation("org.ow2.asm:asm-commons:9.7")
|
||||
// Paper end
|
||||
|
||||
+ implementation("org.mongodb:bson:4.11.1") // Slice - MongoDB Bson Library for ObjectIds
|
||||
+
|
||||
api("org.apache.maven:maven-resolver-provider:3.9.6") // Paper - make API dependency for Paper Plugins
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18")
|
||||
compileOnly("org.apache.maven.resolver:maven-resolver-transport-http:1.9.18")
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerResolveObjectIdEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerResolveObjectIdEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4c28994757812f9c7f59d9eb827908bb64e63118
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerResolveObjectIdEvent.java
|
||||
@@ -0,0 +1,44 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bson.types.ObjectId;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+import java.util.Objects;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a player trades with a standalone merchant GUI.
|
||||
+ */
|
||||
+public class PlayerResolveObjectIdEvent extends PlayerEvent {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private ObjectId objectId;
|
||||
+
|
||||
+ public PlayerResolveObjectIdEvent(@NotNull Player player) {
|
||||
+ super(player, !Bukkit.isPrimaryThread());
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public ObjectId getObjectId() {
|
||||
+ return this.objectId;
|
||||
+ }
|
||||
+
|
||||
+ public void setObjectId(@NotNull ObjectId objectId) {
|
||||
+ this.objectId = Objects.requireNonNull(objectId, "ObjectId cannot be null!");
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 8172e1e32fc86389273f5c326ce600dd65427898..e62e57a8dcd418683fdfb909a8ca22a2ff16dbf7 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1174,4 +1174,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
void setVanished(boolean vanished);
|
||||
// Slice end
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * Returns the Block that is currently supporting the player, particularly in the case of
|
||||
+ * crouching over the edge of a block.
|
||||
+ */
|
||||
+ org.bukkit.block.Block getBlockStandingOn();
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
index ee866f3497ed56708d4062685f5585ca06a03955..93d1ea4b4edb422e962d0b3d12a4a496c00d9df2 100644
|
||||
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
@@ -22,6 +22,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
|
||||
|
||||
+ // Slice start
|
||||
+ org.bson.types.@Nullable ObjectId getObjectId();
|
||||
+ void setObjectId(@Nullable org.bson.types.ObjectId objectId);
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start
|
||||
@Override
|
||||
org.bukkit.inventory.@NotNull EntityEquipment getEquipment();
|
||||
@@ -1,25 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:25:29 -0500
|
||||
From: MiniDigger <admin@minidigger.me>
|
||||
Date: Fri, 12 Aug 2022 08:07:34 -0500
|
||||
Subject: [PATCH] Build Changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index f442236efe30d7d9e0c6a8dfb0f040540dc62753..bcdeb5a1c3c10d86d116dbf4257eb7b9d12f4426 100644
|
||||
index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..8aaee003050df9bd20e9f3e0263a47350c9840b1 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -22,8 +22,8 @@ repositories {
|
||||
}
|
||||
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":Paper-API"))
|
||||
- implementation(project(":Paper-MojangAPI"))
|
||||
+ implementation(project(":Slice-API")) // Slice
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.17.1-R0.1-SNAPSHOT") // Slice
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // Slice start
|
||||
+ implementation(project(":slice-api"))
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.20.4-R0.1-SNAPSHOT") {
|
||||
+ exclude("io.papermc.paper", "paper-api")
|
||||
+ }
|
||||
+ // Slice end
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -75,7 +75,7 @@ tasks.jar {
|
||||
@@ -71,7 +75,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
@@ -28,33 +32,33 @@ index f442236efe30d7d9e0c6a8dfb0f040540dc62753..bcdeb5a1c3c10d86d116dbf4257eb7b9
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -202,7 +202,7 @@ tasks.test {
|
||||
fun TaskContainer.registerRunTask(
|
||||
name: String, block: JavaExec.() -> Unit
|
||||
@@ -150,7 +154,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "paperweight"
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory.dir(
|
||||
providers.gradleProperty("runWorkDir").forUseAtConfigurationTime().orElse("run")
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 5a4172faaf960d48939d6a485719041987df9242..402367f10b126c7d527e5a2b5319d331dce81857 100644
|
||||
index c8772c773f9933ed1d1debfe707af4373c458152..9ce9af857a5f2414658027ff5bb765cc4233899b 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1729,7 +1729,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
+ return "Slice"; //Slice - Slice > //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
- return "Paper"; // Paper
|
||||
+ return "Slice"; // Slice - Slice > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 99a94898316b0601f55b333c15a9926eae24f8a2..f20dc9edfa15fd7705570830955d1b82b4fd59e3 100644
|
||||
index c490a29bcf7410bc54959ee71375605964379ed5..93fde7271340d157ed12129930656aeedd95ea79 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -251,7 +251,7 @@ import javax.annotation.Nullable; // Paper
|
||||
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 08:33:45 -0500
|
||||
Subject: [PATCH] Add PlayerShieldDisableEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index 8a864238e154e2131834d013652746b7e7a78c97..806975b124bf91ae560dc3a0289f3a298373546d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -1588,6 +1588,7 @@ public abstract class Mob extends LivingEntity {
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (this.random.nextFloat() < f) {
|
||||
+ if (!new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) player.getBukkitEntity(), getBukkitEntity()).callEvent()) return; // Slice
|
||||
player.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
this.level.broadcastEntityEvent(player, (byte) 30);
|
||||
}
|
||||
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 cea92f1dc663bf0648b2bd877d86ca380a517bc9..a1d1d8b5fbb5d7f8e980b4c116b8fec34f8878d5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -936,7 +936,7 @@ public abstract class Player extends LivingEntity {
|
||||
protected void blockUsingShield(LivingEntity attacker) {
|
||||
super.blockUsingShield(attacker);
|
||||
if (attacker.getMainHandItem().getItem() instanceof AxeItem) {
|
||||
- this.disableShield(true);
|
||||
+ this.disableShield(true, attacker); // Slice
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1403,6 +1403,12 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
public void disableShield(boolean sprinting) {
|
||||
+ // Slice start
|
||||
+ disableShield(sprinting, null);
|
||||
+ }
|
||||
+
|
||||
+ public void disableShield(boolean sprinting, @Nullable LivingEntity attacker) {
|
||||
+ // Slice end
|
||||
float f = 0.25F + (float) EnchantmentHelper.getBlockEfficiency(this) * 0.05F;
|
||||
|
||||
if (sprinting) {
|
||||
@@ -1410,6 +1416,8 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
if (this.random.nextFloat() < f) {
|
||||
+ org.bukkit.entity.Entity finalAttacker = attacker != null ? attacker.getBukkitEntity() : null; // Slice
|
||||
+ if (!new io.papermc.paper.event.player.PlayerShieldDisableEvent((org.bukkit.entity.Player) getBukkitEntity(), finalAttacker).callEvent()) return; // Slice
|
||||
this.getCooldowns().addCooldown(Items.SHIELD, 100);
|
||||
this.stopUsingItem();
|
||||
this.level.broadcastEntityEvent(this, (byte) 30);
|
||||
230
patches/server/0002-Set-BlockData-without-light-updates.patch
Normal file
230
patches/server/0002-Set-BlockData-without-light-updates.patch
Normal file
@@ -0,0 +1,230 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:29:11 -0500
|
||||
Subject: [PATCH] Set BlockData without light updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 5ece375eaf6bcc61864997a389bb5e24625e4505..2d61315c9ab87a216e235f1586618b11511b2620 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -256,7 +256,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
Block.dropResources(iblockdata, this.level, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth);
|
||||
+ return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth, true); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) { // Slice
|
||||
if (!this.ensureCanWrite(pos)) {
|
||||
return false;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index bc89f9e90af3d69872a58c47a4c2545ba91b6ba5..a67bf805d7a078192987dbeb80af7d29df236d38 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -905,12 +905,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public final boolean setBlock(BlockPos pos, BlockState state, int flags) { // Paper - final for inline
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ public final boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) { // Paper - final for inline
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
// Paper start - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
@@ -1106,7 +1106,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
iblockdata.getBlock().popExperience((ServerLevel) this, pos, xp, breakingEntity); // Paper - Properly handle xp dropping; custom amount
|
||||
}
|
||||
|
||||
- boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
|
||||
+ boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth, true);
|
||||
|
||||
if (flag1) {
|
||||
this.gameEvent(GameEvent.BLOCK_DESTROY, pos, GameEvent.Context.of(breakingEntity, iblockdata));
|
||||
diff --git a/src/main/java/net/minecraft/world/level/LevelWriter.java b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
index 134e5ec79bf2dddd4e31930f8a7cb2c02fa29518..fd72d278a2719911a46b6bc9e7da2dc24bbe681e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
@@ -7,10 +7,14 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public interface LevelWriter {
|
||||
|
||||
- boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth);
|
||||
+ boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight);
|
||||
|
||||
default boolean setBlock(BlockPos pos, BlockState state, int flags) {
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ return this.setBlock(pos, state, flags, 512, true);
|
||||
+ }
|
||||
+
|
||||
+ default boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) {
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
|
||||
boolean removeBlock(BlockPos pos, boolean move);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 22036ed3ea0629bc12981a8d91a03e55cc2117d6..4dcbaddc99225e8cfe9b8dbbf2196bfca9d057f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -201,7 +201,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth);
|
||||
}
|
||||
} else {
|
||||
- world.setBlock(pos, newState, flags & -33, maxUpdateDepth);
|
||||
+ world.setBlock(pos, newState, flags & -33, maxUpdateDepth, true); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
index 35f7de6b50d3adae7bdd0da5f779f0a466d25522..e2aad3f47e0789f123e689bf2fcdee6bf207407e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -149,7 +149,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
net.minecraft.world.level.block.state.BlockState old = this.getHandle().getBlockState(pos);
|
||||
|
||||
- CraftBlock.setTypeAndData(world, pos, old, ((CraftBlockData) blockData).getState(), true);
|
||||
+ CraftBlock.setTypeAndData(world, pos, old, ((CraftBlockData) blockData).getState(), true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 4b42ef2a876ea210d948238e63fd7a2b7035bb5b..7cdd76f87a10529df5b9476bd2728eb8db9448b1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -183,15 +183,20 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData data, boolean applyPhysics) {
|
||||
+ setBlockData(data, applyPhysics, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBlockData(BlockData data, boolean applyPhysics, boolean checkLight) {
|
||||
Preconditions.checkArgument(data != null, "BlockData cannot be null");
|
||||
- this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
|
||||
+ this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics, checkLight);
|
||||
}
|
||||
|
||||
- boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics) {
|
||||
- return CraftBlock.setTypeAndData(this.world, this.position, this.getNMS(), blockData, applyPhysics);
|
||||
+ boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics, boolean checkLight) {
|
||||
+ return CraftBlock.setTypeAndData(this.world, this.position, this.getNMS(), blockData, applyPhysics, checkLight);
|
||||
}
|
||||
|
||||
- public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics) {
|
||||
+ public static boolean setTypeAndData(LevelAccessor world, BlockPos position, net.minecraft.world.level.block.state.BlockState old, net.minecraft.world.level.block.state.BlockState blockData, boolean applyPhysics, boolean checkLight) {
|
||||
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
|
||||
if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
// SPIGOT-4612: faster - just clear tile
|
||||
@@ -205,7 +210,7 @@ public class CraftBlock implements Block {
|
||||
if (applyPhysics) {
|
||||
return world.setBlock(position, blockData, 3);
|
||||
} else {
|
||||
- boolean success = world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
+ boolean success = world.setBlock(position, blockData, 2 | 16 | 1024, checkLight); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success && world instanceof net.minecraft.world.level.Level) {
|
||||
world.getMinecraftWorld().sendBlockUpdated(
|
||||
position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
index d11d854ae90b99aa2ce227994d07fe1fe9b4a60a..1989d8755b422095b3d1ff9a07adf1bc582d5abf 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
@@ -217,7 +217,7 @@ public class CraftBlockState implements BlockState {
|
||||
}
|
||||
|
||||
net.minecraft.world.level.block.state.BlockState newBlock = this.data;
|
||||
- block.setTypeAndData(newBlock, applyPhysics);
|
||||
+ block.setTypeAndData(newBlock, applyPhysics, true);
|
||||
if (access instanceof net.minecraft.world.level.Level) {
|
||||
this.world.getHandle().sendBlockUpdated(
|
||||
this.position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
|
||||
index 86a20c91beff6b27e6ec886e49ba902b216106f2..42cd06f0166755cbce19d2dd2d8dcbf297cbcfb1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java
|
||||
@@ -803,8 +803,8 @@ public abstract class DelegatedGeneratorAccess implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
- return this.handle.setBlock(pos, state, flags, maxUpdateDepth);
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
+ return this.handle.setBlock(pos, state, flags, maxUpdateDepth, checkLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
index 819a67aa19c6bd624f5ed28d09b35ff2c151749a..e33584c405beb97aac284e53020d1e9156e65e54 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
@@ -245,7 +245,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java
|
||||
index 7482dfe64458320d44089c0778591694202e9f70..2f4cde7a89fd47d5f4739bfda9b3033a57898928 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/TransformerGeneratorAccess.java
|
||||
@@ -57,14 +57,14 @@ public class TransformerGeneratorAccess extends DelegatedGeneratorAccess {
|
||||
// }
|
||||
// Paper end - Don't fire sync event during generation; don't override these methods
|
||||
|
||||
- public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i, int j) {
|
||||
+ public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i, int j, boolean checkLight) {
|
||||
if (this.structureTransformer != null) {
|
||||
craftBlockState = this.structureTransformer.transformCraftState(craftBlockState);
|
||||
}
|
||||
// This code is based on the method 'net.minecraft.world.level.levelgen.structure.StructurePiece#placeBlock'
|
||||
// It ensures that any kind of block is updated correctly upon placing it
|
||||
BlockState iblockdata = craftBlockState.getHandle();
|
||||
- boolean result = super.setBlock(position, iblockdata, i, j);
|
||||
+ boolean result = super.setBlock(position, iblockdata, i, j, checkLight);
|
||||
FluidState fluid = this.getFluidState(position);
|
||||
if (!fluid.isEmpty()) {
|
||||
this.scheduleTick(position, fluid.getType(), 0);
|
||||
@@ -80,19 +80,19 @@ public class TransformerGeneratorAccess extends DelegatedGeneratorAccess {
|
||||
}
|
||||
|
||||
public boolean setCraftBlock(BlockPos position, CraftBlockState craftBlockState, int i) {
|
||||
- return this.setCraftBlock(position, craftBlockState, i, 512);
|
||||
+ return this.setCraftBlock(position, craftBlockState, i, 512, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
if (this.structureTransformer == null || !this.structureTransformer.canTransformBlocks()) {
|
||||
- return super.setBlock(pos, state, flags, maxUpdateDepth);
|
||||
+ return super.setBlock(pos, state, flags, maxUpdateDepth, checkLight);
|
||||
}
|
||||
- return this.setCraftBlock(pos, (CraftBlockState) CraftBlockStates.getBlockState(pos, state, null), flags, maxUpdateDepth);
|
||||
+ return this.setCraftBlock(pos, (CraftBlockState) CraftBlockStates.getBlockState(pos, state, null), flags, maxUpdateDepth, checkLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags) {
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) {
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
}
|
||||
143
patches/server/0003-Add-BlockDestroyedByNeighborEvent.patch
Normal file
143
patches/server/0003-Add-BlockDestroyedByNeighborEvent.patch
Normal file
@@ -0,0 +1,143 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:30:29 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index a7b217ddbcbf92513bd38101fdfca2075505e267..92c8cb4fe9c82e32876fa75134a6009c874f6594 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -419,6 +419,7 @@ public class ServerPlayerGameMode {
|
||||
this.level.captureDrops = new ArrayList<>();
|
||||
// CraftBukkit end
|
||||
BlockState iblockdata1 = block.playerWillDestroy(this.level, pos, iblockdata, this.player);
|
||||
+ level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper
|
||||
boolean flag = this.level.removeBlock(pos, false);
|
||||
|
||||
if (flag) {
|
||||
@@ -446,6 +447,7 @@ public class ServerPlayerGameMode {
|
||||
// CraftBukkit start
|
||||
java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = this.level.captureDrops; // Paper - capture all item additions to the world
|
||||
this.level.captureDrops = null; // Paper - capture all item additions to the world; Remove this earlier so that we can actually drop stuff
|
||||
+ level.pendingPlayerBlockEvents.remove(pos); // Paper
|
||||
if (event.isDropItems()) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - capture all item additions to the world
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 1ad126d992d95062a3db08374db7a927f23a0cac..7648e43a77b06b9f4a31b216824cdd9c1d79788f 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -379,6 +379,7 @@ public final class ItemStack {
|
||||
CompoundTag oldData = this.getTagClone();
|
||||
int oldCount = this.getCount();
|
||||
ServerLevel world = (ServerLevel) context.getLevel();
|
||||
+ if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper
|
||||
|
||||
if (!(item instanceof BucketItem/* || item instanceof SolidBucketItem*/)) { // if not bucket // Paper - Fix cancelled powdered snow bucket placement
|
||||
world.captureBlockStates = true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index a67bf805d7a078192987dbeb80af7d29df236d38..5cdadd4cf103af239a46aeb82b7d56f37672ded3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -181,6 +181,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Faster redstone torch rapid clock removal; Move from Map in BlockRedstoneTorch to here
|
||||
|
||||
+ // Paper start - Holder class used to track what Player is responsible the last block event
|
||||
+ public static class PendingBlockEvent {
|
||||
+
|
||||
+ public final BlockPos block;
|
||||
+ public final Player player;
|
||||
+ public @Nullable BlockPos sourceBlock;
|
||||
+
|
||||
+ public PendingBlockEvent(BlockPos block, Player player) {
|
||||
+ this(block, player, null);
|
||||
+ }
|
||||
+
|
||||
+ public PendingBlockEvent(BlockPos block, Player player, @Nullable BlockPos sourceBlock) {
|
||||
+ this.block = block;
|
||||
+ this.player = player;
|
||||
+ this.sourceBlock = sourceBlock;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ public final Map<BlockPos, PendingBlockEvent> pendingPlayerBlockEvents = new HashMap<>();
|
||||
+ // Paper end
|
||||
+
|
||||
// Paper start - fix and optimise world upgrading
|
||||
// copied from below
|
||||
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {
|
||||
@@ -1055,6 +1076,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (!this.preventPoiUpdated) {
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
+ pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -1076,6 +1098,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
+ // Paper start
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null && blockEvent.sourceBlock != null) {
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock));
|
||||
+ event.callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
// Paper start - BlockDestroyEvent; while the above setAir method is named same and looks very similar
|
||||
// they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index 03b5ab8251497c0c94467f90e6663a0dc766babb..0be28c971bbd88268af4dfdd4489d4fb309ad03a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -112,6 +112,15 @@ public class DoublePlantBlock extends BushBlock {
|
||||
BlockPos blockposition1 = pos.below();
|
||||
BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||
|
||||
+ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos));
|
||||
+ if (!event.callEvent()) return;
|
||||
+ }
|
||||
+
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
BlockState iblockdata2 = iblockdata1.getFluidState().is((Fluid) Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
|
||||
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 2892e586146cbc560f0bcf4b9af6d0575cb0a82e..b665a8f932ddae519cdefade555f9ea31fe8f4ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -1242,11 +1242,22 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
Direction[] aenumdirection = BlockBehaviour.UPDATE_SHAPE_ORDER;
|
||||
int k = aenumdirection.length;
|
||||
+ BlockState blockState = world.getBlockState(pos); // Slice
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
Direction enumdirection = aenumdirection[l];
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(pos, enumdirection);
|
||||
+ // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block
|
||||
+ // if it will break (!canSurvive)
|
||||
+ if (blockState.getBukkitMaterial() == org.bukkit.Material.AIR && !world.getBlockState(blockposition_mutableblockposition).canSurvive(world, blockposition_mutableblockposition)) {
|
||||
+ Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ BlockPos blockPosCopy = blockposition_mutableblockposition.immutable();
|
||||
+ ((Level) world).pendingPlayerBlockEvents.put(blockPosCopy, new Level.PendingBlockEvent(blockPosCopy, blockEvent.player, pos));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.neighborShapeChanged(enumdirection.getOpposite(), this.asState(), blockposition_mutableblockposition, pos, flags, maxUpdateDepth);
|
||||
}
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 Sep 2021 15:20:15 -0500
|
||||
Subject: [PATCH] Multiple Entries with Scoreboards
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
index 4c9660176e783999301565790b8cf6f47b0d02a2..3f1b093ae766c6e219ee233a75c64f0c522cc6c2 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java
|
||||
@@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet<ClientGamePacketLi
|
||||
return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), ImmutableList.of(playerName));
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public static ClientboundSetPlayerTeamPacket createMultiplePlayerPacket(PlayerTeam team, Collection<String> players, ClientboundSetPlayerTeamPacket.Action operation) {
|
||||
+ return new ClientboundSetPlayerTeamPacket(team.getName(), operation == ClientboundSetPlayerTeamPacket.Action.ADD ? 3 : 4, Optional.empty(), players);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public ClientboundSetPlayerTeamPacket(FriendlyByteBuf buf) {
|
||||
this.name = buf.readUtf(16);
|
||||
this.method = buf.readByte();
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
index 130a928f156961bae9ca184b3ca31004dbba1012..5d42967b1d9cbceb004566c0c503df21d1bb5c51 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.server;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Iterator;
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -92,6 +93,19 @@ public class ServerScoreboard extends Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean addPlayersToTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ if (super.addPlayersToTeam(players, team)) {
|
||||
+ this.sendAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.ADD));
|
||||
+ this.setDirty();
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void removePlayerFromTeam(String playerName, PlayerTeam team) {
|
||||
super.removePlayerFromTeam(playerName, team);
|
||||
@@ -99,6 +113,19 @@ public class ServerScoreboard extends Scoreboard {
|
||||
this.setDirty();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean removePlayersFromTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ if (super.removePlayersFromTeam(players, team)) {
|
||||
+ this.sendAll(ClientboundSetPlayerTeamPacket.createMultiplePlayerPacket(team, players, ClientboundSetPlayerTeamPacket.Action.REMOVE));
|
||||
+ this.setDirty();
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void onObjectiveAdded(Objective objective) {
|
||||
super.onObjectiveAdded(objective);
|
||||
diff --git a/src/main/java/net/minecraft/world/scores/Scoreboard.java b/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
index 3e75ea4d5a6c83ca570b29e3c1a5d51fb132379a..246bb45d73c3948fae081662995ada7cdb49822d 100644
|
||||
--- a/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/world/scores/Scoreboard.java
|
||||
@@ -224,6 +224,28 @@ public class Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean addPlayersToTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ boolean anyAdded = false;
|
||||
+ for (String playerName : players) {
|
||||
+ if (playerName.length() > 40) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("The player name '" + playerName + "' is too long!");
|
||||
+ } else {
|
||||
+ if (this.getPlayersTeam(playerName) != null) {
|
||||
+ this.removePlayerFromTeam(playerName);
|
||||
+ }
|
||||
+
|
||||
+ this.teamsByPlayer.put(playerName, team);
|
||||
+ if (team.getPlayers().add(playerName)) {
|
||||
+ anyAdded = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return anyAdded;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public boolean removePlayerFromTeam(String playerName) {
|
||||
PlayerTeam playerTeam = this.getPlayersTeam(playerName);
|
||||
if (playerTeam != null) {
|
||||
@@ -243,6 +265,24 @@ public class Scoreboard {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public boolean removePlayersFromTeam(Collection<String> players, PlayerTeam team) {
|
||||
+ boolean anyRemoved = false;
|
||||
+ for (String playerName : players) {
|
||||
+ if (this.getPlayersTeam(playerName) != team) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.warn("Player " + playerName + " is either on another team or not on any team. Cannot remove from team '" + team.getName() + "'.");
|
||||
+ } else {
|
||||
+ this.teamsByPlayer.remove(playerName);
|
||||
+ if (team.getPlayers().remove(playerName)) {
|
||||
+ anyRemoved = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return anyRemoved;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
public Collection<String> getTeamNames() {
|
||||
return this.teamsByName.keySet();
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
index 2b87a652798cb632fe76bf20e9e7f8cb8bfb3b7b..f097e9fbdac1a572c12cc0299774455c75e373e9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.scoreboard;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
+import java.util.Collection; // Paper
|
||||
import java.util.Set;
|
||||
import net.minecraft.world.scores.PlayerTeam;
|
||||
import net.minecraft.world.scores.Team.Visibility;
|
||||
@@ -226,6 +227,16 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
scoreboard.board.addPlayerToTeam(entry, team);
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void addEntries(Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
+ Validate.notNull(entries, "Entries cannot be null");
|
||||
+ CraftScoreboard scoreboard = checkState();
|
||||
+
|
||||
+ scoreboard.board.addPlayersToTeam(entries, team);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean removePlayer(OfflinePlayer player) throws IllegalStateException, IllegalArgumentException {
|
||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
||||
@@ -245,6 +256,25 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public boolean removeEntries(Collection<String> entries) throws IllegalStateException, IllegalArgumentException {
|
||||
+ Validate.notNull(entries, "Entry cannot be null");
|
||||
+ CraftScoreboard scoreboard = this.checkState();
|
||||
+
|
||||
+ boolean anyRemoved = false;
|
||||
+ Collection<String> teamPlayers = this.team.getPlayers();
|
||||
+ for (String entry : entries) {
|
||||
+ if (teamPlayers.remove(entry)) {
|
||||
+ anyRemoved = true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ scoreboard.board.removePlayersFromTeam(entries, team);
|
||||
+ return anyRemoved;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public boolean hasPlayer(OfflinePlayer player) throws IllegalArgumentException, IllegalStateException {
|
||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 29 Sep 2021 08:40:37 -0500
|
||||
Date: Mon, 10 Apr 2023 07:31:54 -0500
|
||||
Subject: [PATCH] Add provided Material to getDrops
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index f374d5d6fc3ac9187236d141931c3c57ddd57865..9ed8586a3e973ba8da340b82440be8f7369ef8ca 100644
|
||||
index 7cdd76f87a10529df5b9476bd2728eb8db9448b1..88ac6604decf8711ffba07bec4851ba6b75084b3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -552,7 +552,18 @@ public class CraftBlock implements Block {
|
||||
@@ -591,7 +591,18 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrops(ItemStack item, Entity entity) {
|
||||
@@ -28,7 +28,7 @@ index f374d5d6fc3ac9187236d141931c3c57ddd57865..9ed8586a3e973ba8da340b82440be8f7
|
||||
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
@@ -563,6 +574,7 @@ public class CraftBlock implements Block {
|
||||
@@ -602,6 +613,7 @@ public class CraftBlock implements Block {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Wed, 22 Sep 2021 09:41:27 -0500
|
||||
Subject: [PATCH] Set BlockData without light update
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
index 21d1e0c9c471e9e556b5bd70166a769b46105c7a..d46dc12001bd46596c3bb2e24144bbe4d2d3a5e1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -241,7 +241,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
Block.dropResources(iblockdata, this.level, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth);
|
||||
+ return this.setBlock(pos, Blocks.AIR.defaultBlockState(), 3, maxUpdateDepth, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class WorldGenRegion implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
if (!this.ensureCanWrite(pos)) {
|
||||
return false;
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 9cafd000b3533ed9fd35df2ec880f55e262084fb..8420d615867faa717266d1edfa5a469df1b1e43f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -541,12 +541,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public final boolean setBlock(BlockPos pos, BlockState state, int flags) { // Paper - final for inline
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ public final boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) { // Paper - final for inline
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
// CraftBukkit start - tree generation
|
||||
if (this.captureTreeGeneration) {
|
||||
// Paper start
|
||||
@@ -593,7 +593,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
} else {
|
||||
BlockState iblockdata2 = this.getBlockState(pos);
|
||||
|
||||
- if ((flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock((BlockGetter) this, pos) != iblockdata1.getLightBlock((BlockGetter) this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
+ if (checkLight && (flags & 128) == 0 && iblockdata2 != iblockdata1 && (iblockdata2.getLightBlock((BlockGetter) this, pos) != iblockdata1.getLightBlock((BlockGetter) this, pos) || iblockdata2.getLightEmission() != iblockdata1.getLightEmission() || iblockdata2.useShapeForLightOcclusion() || iblockdata1.useShapeForLightOcclusion())) {
|
||||
this.getProfiler().push("queueCheckLight");
|
||||
this.getChunkSource().getLightEngine().checkBlock(pos);
|
||||
this.getProfiler().pop();
|
||||
@@ -740,7 +740,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
Block.dropResources(iblockdata, this, pos, tileentity, breakingEntity, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
- boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth);
|
||||
+ boolean flag1 = this.setBlock(pos, fluid.createLegacyBlock(), 3, maxUpdateDepth, true);
|
||||
|
||||
if (flag1) {
|
||||
this.gameEvent(breakingEntity, GameEvent.BLOCK_DESTROY, pos);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/LevelWriter.java b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
index b6825cd32033cac34c74af1f8c980ed7fb97a754..d2dfbfa0d58b94ce583992aa56f5b0e28d4b31f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/LevelWriter.java
|
||||
@@ -7,10 +7,14 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public interface LevelWriter {
|
||||
|
||||
- boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth);
|
||||
+ boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight);
|
||||
|
||||
default boolean setBlock(BlockPos pos, BlockState state, int flags) {
|
||||
- return this.setBlock(pos, state, flags, 512);
|
||||
+ return this.setBlock(pos, state, flags, 512, true);
|
||||
+ }
|
||||
+
|
||||
+ default boolean setBlock(BlockPos pos, BlockState state, int flags, boolean checkLight) {
|
||||
+ return this.setBlock(pos, state, flags, 512, checkLight);
|
||||
}
|
||||
|
||||
boolean removeBlock(BlockPos pos, boolean move);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index 8c30e28b97ac7e8b54322c903e0b75ee8135620b..64cc26d146afba7c6ecb0d3052776837a41a5618 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -197,7 +197,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
world.destroyBlock(pos, (flags & 32) == 0, (Entity) null, maxUpdateDepth);
|
||||
}
|
||||
} else {
|
||||
- world.setBlock(pos, newState, flags & -33, maxUpdateDepth);
|
||||
+ world.setBlock(pos, newState, flags & -33, maxUpdateDepth, true);
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
index 6f01af8cc3f9ed4d2eaa3304990ca33f8692a453..f374d5d6fc3ac9187236d141931c3c57ddd57865 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -178,11 +178,20 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public void setBlockData(BlockData data, boolean applyPhysics) {
|
||||
+ setBlockData(data, applyPhysics, true);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBlockData(BlockData data, boolean applyPhysics, boolean checkLight) {
|
||||
Preconditions.checkArgument(data != null, "BlockData cannot be null");
|
||||
- this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics);
|
||||
+ this.setTypeAndData(((CraftBlockData) data).getState(), applyPhysics, checkLight);
|
||||
}
|
||||
|
||||
public boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics) {
|
||||
+ return setTypeAndData(blockData, applyPhysics, true);
|
||||
+ }
|
||||
+
|
||||
+ public boolean setTypeAndData(final net.minecraft.world.level.block.state.BlockState blockData, final boolean applyPhysics, boolean checkLight) {
|
||||
net.minecraft.world.level.block.state.BlockState old = this.getNMS();
|
||||
// SPIGOT-611: need to do this to prevent glitchiness. Easier to handle this here (like /setblock) than to fix weirdness in tile entity cleanup
|
||||
if (old.hasBlockEntity() && blockData.getBlock() != old.getBlock()) { // SPIGOT-3725 remove old tile entity if block changes
|
||||
@@ -197,7 +206,7 @@ public class CraftBlock implements Block {
|
||||
if (applyPhysics) {
|
||||
return this.world.setBlock(position, blockData, 3);
|
||||
} else {
|
||||
- boolean success = this.world.setBlock(position, blockData, 2 | 16 | 1024); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
+ boolean success = this.world.setBlock(position, blockData, 2 | 16 | 1024, checkLight); // NOTIFY | NO_OBSERVER | NO_PLACE (custom)
|
||||
if (success && this.world instanceof net.minecraft.world.level.Level) {
|
||||
this.world.getMinecraftWorld().sendBlockUpdated(
|
||||
position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
index 950d4381459d31d02acf55c4aef4f5e33367748b..0b09b06b3d9fe2cce5c6cbf70a4b84ff8edc2085 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
@@ -231,7 +231,7 @@ public class DummyGeneratorAccess implements WorldGenLevel {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth) {
|
||||
+ public boolean setBlock(BlockPos pos, BlockState state, int flags, int maxUpdateDepth, boolean checkLight) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 16:36:29 -0500
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:36:21 -0500
|
||||
Subject: [PATCH] Add Player to SpongeAbsorbEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
index 1ef8eadd4e59f2e5d2bbd84f6f9bcf37b59db5bd..ea711757413e2580a5806e0063b3e4fa5d4eddbb 100644
|
||||
index c4667bea0708d12e228ec2a4c84fcee7e48ca08c..ad2a9c6d91ebeda5bd9cffdf5471e19353348f65 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -110,7 +110,8 @@ public class SpongeBlock extends Block {
|
||||
@@ -114,7 +114,8 @@ public class SpongeBlock extends Block {
|
||||
if (!blocks.isEmpty()) {
|
||||
final org.bukkit.block.Block bblock = world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:56:42 -0500
|
||||
Subject: [PATCH] Don't send equipment updates if only durability changed
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index cbdff14b26f67b5040c13659f9d64d9ec4c7eaed..bd054a883ecb15260aec27c81ad79e774fca69a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3007,7 +3007,7 @@ public abstract class LivingEntity extends Entity {
|
||||
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
|
||||
- if (!ItemStack.matches(itemstack1, itemstack)) {
|
||||
+ if (!ItemStack.isSameIgnoreDurability(itemstack1, itemstack)) {
|
||||
// Paper start - PlayerArmorChangeEvent
|
||||
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.ARMOR) {
|
||||
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack);
|
||||
@@ -1,27 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 18 Oct 2021 08:52:40 -0500
|
||||
Subject: [PATCH] World Instance Flag
|
||||
Date: Mon, 10 Apr 2023 07:37:05 -0500
|
||||
Subject: [PATCH] Add World Instance flag
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d40a367670ccea01978cabf7d45f3c1a690662fc..d9d7edebbdb65990ade0c8e3c0e8bddd80927c2e 100644
|
||||
index 502bdc726b7890b00ee36871d905dea44e8719e3..4653878c059a15491eb54d7211311db7e2fe570a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -200,6 +200,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -223,6 +223,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public final UUID uuid;
|
||||
public boolean hasPhysicsEvent = true; // Paper
|
||||
public boolean hasEntityMoveEvent = false; // Paper
|
||||
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
|
||||
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
||||
+ public boolean instance; // Slice
|
||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
return new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
}
|
||||
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
||||
|
||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 858e29ad77aee8a1b7797c2d82902abbfd662da2..135bb95bda500f24ceef664dc522dd02570822fe 100644
|
||||
index 01797d9791f19dfda4b168218eadeaae97f11eab..2e5fae21dcf511c18d309780fcc3204d3bfa7af2 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1197,6 +1197,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
world.noSave = !value;
|
||||
@@ -1333,6 +1333,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
this.world.noSave = !value;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
@@ -38,4 +38,4 @@ index 858e29ad77aee8a1b7797c2d82902abbfd662da2..135bb95bda500f24ceef664dc522dd02
|
||||
+
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
this.getHandle().serverLevelData.setDifficulty(net.minecraft.world.Difficulty.byId(difficulty.getValue()));
|
||||
this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - per level difficulty; don't skip other difficulty-changing logic
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Tue, 7 Dec 2021 07:59:41 -0600
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
Date: Mon, 10 Apr 2023 07:38:40 -0500
|
||||
Subject: [PATCH] Add PlayerData Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index b03eacbef3cf15b70ec012af0870975d3e8e8cba..d792f9ad494f01d6ca78704a9fadf445e0d4e65e 100644
|
||||
index 92c8cb4fe9c82e32876fa75134a6009c874f6594..9637ed39f3022a9d8d0b45a7bd5895657783bed5 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -606,6 +606,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.placeItem(itemactioncontext, hand);
|
||||
@@ -601,6 +601,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.useOn(itemactioncontext);
|
||||
}
|
||||
|
||||
+ world.pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
@@ -18,10 +18,10 @@ index b03eacbef3cf15b70ec012af0870975d3e8e8cba..d792f9ad494f01d6ca78704a9fadf445
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, blockposition, itemstack1);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009c29b463b 100644
|
||||
index f890738d3bb9fb5e70a9d323c6cec97f9948f9cf..0e02785ec35e635bef33cc89c54b146c8e7dac99 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -201,7 +201,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -204,7 +204,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
@@ -35,28 +35,28 @@ index 9f3355dbbbab1ab88cf2b7034130c2888e38d7a7..ec43aa3661bc891a17670aec54d3f009
|
||||
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
|
||||
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -227,7 +232,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -230,7 +235,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
jsonobject1.add("stats", jsonobject);
|
||||
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getWorldVersion());
|
||||
jsonobject1.addProperty("DataVersion", SharedConstants.getCurrentVersion().getDataVersion().getVersion());
|
||||
- return jsonobject1.toString();
|
||||
+ return jsonobject1; // Slice
|
||||
}
|
||||
|
||||
private static <T> ResourceLocation getKey(Stat<T> stat) {
|
||||
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 35c39aed9583275ef25d32c783715798b52bdb63..258813e65b521dccb19f4f3248588a7106a1e24b 100644
|
||||
index 63e187c65cb855031f286aad0d25ac4694f7a331..b0f3aa2b90e2dc5dd7b450cae9ce4eba3d04e568 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -33,6 +33,7 @@ public class PlayerDataStorage {
|
||||
@@ -36,6 +36,7 @@ public class PlayerDataStorage {
|
||||
|
||||
public void save(Player player) {
|
||||
if (org.spigotmc.SpigotConfig.disablePlayerDataSaving) return; // Spigot
|
||||
+ if (!new com.destroystokyo.paper.event.player.PlayerSaveDataEvent((org.bukkit.entity.Player) player.getBukkitEntity()).callEvent()) return; // Slice
|
||||
try {
|
||||
CompoundTag nbttagcompound = player.saveWithoutId(new CompoundTag());
|
||||
File file = File.createTempFile(player.getStringUUID() + "-", ".dat", this.playerDir);
|
||||
@@ -52,32 +53,40 @@ public class PlayerDataStorage {
|
||||
Path path = this.playerDir.toPath();
|
||||
@@ -56,33 +57,41 @@ public class PlayerDataStorage {
|
||||
public CompoundTag load(Player player) {
|
||||
CompoundTag nbttagcompound = null;
|
||||
|
||||
@@ -95,14 +95,14 @@ index 35c39aed9583275ef25d32c783715798b52bdb63..258813e65b521dccb19f4f3248588a71
|
||||
+ // Spigot End
|
||||
|
||||
- if (file.exists() && file.isFile()) {
|
||||
- nbttagcompound = NbtIo.readCompressed(file);
|
||||
- nbttagcompound = NbtIo.readCompressed(file.toPath(), NbtAccounter.unlimitedHeap());
|
||||
- }
|
||||
- // Spigot Start
|
||||
- if ( usingWrongFile )
|
||||
- {
|
||||
- file.renameTo( new File( file.getPath() + ".offline-read" ) );
|
||||
+ if (file.exists() && file.isFile()) {
|
||||
+ nbttagcompound = NbtIo.readCompressed(file);
|
||||
+ nbttagcompound = NbtIo.readCompressed(file.toPath(), NbtAccounter.unlimitedHeap());
|
||||
+ }
|
||||
+ // Spigot Start
|
||||
+ if (usingWrongFile) {
|
||||
@@ -115,7 +115,9 @@ index 35c39aed9583275ef25d32c783715798b52bdb63..258813e65b521dccb19f4f3248588a71
|
||||
- // Spigot End
|
||||
- } catch (Exception exception) {
|
||||
- PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
|
||||
+ // Slice end
|
||||
}
|
||||
- }
|
||||
+ } // Slice end
|
||||
+
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
// CraftBukkit start
|
||||
102
patches/server/0008-Add-PlayerGetRespawnLocationEvent.patch
Normal file
102
patches/server/0008-Add-PlayerGetRespawnLocationEvent.patch
Normal file
@@ -0,0 +1,102 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:46:18 -0500
|
||||
Subject: [PATCH] Add PlayerGetRespawnLocationEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 1e5f709115007ff19901c0a6c3cf884d9e4d3a6c..81c28b63e9dfe21d8f17f465468c40cf5ef84e9a 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -867,49 +867,57 @@ public abstract class PlayerList {
|
||||
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
if (location == null) {
|
||||
- // boolean isBedSpawn = false; // Paper - Add PlayerPostRespawnEvent; moved up
|
||||
- ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
- if (worldserver1 != null) {
|
||||
- Optional optional;
|
||||
+ // Slice start
|
||||
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
+ org.bukkit.event.player.PlayerGetRespawnLocationEvent preRespawnEvent = new org.bukkit.event.player.PlayerGetRespawnLocationEvent(respawnPlayer);
|
||||
+ preRespawnEvent.callEvent();
|
||||
+ location = preRespawnEvent.getRespawnLocation();
|
||||
|
||||
- if (blockposition != null) {
|
||||
- optional = net.minecraft.world.entity.player.Player.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
- }
|
||||
+ if (location == null) {
|
||||
+ // Slice end
|
||||
+ // boolean isBedSpawn = false; // Paper - Add PlayerPostRespawnEvent; moved up
|
||||
+ ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
+ if (worldserver1 != null) {
|
||||
+ Optional optional;
|
||||
+
|
||||
+ if (blockposition != null) {
|
||||
+ optional = net.minecraft.world.entity.player.Player.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989
|
||||
+ } else {
|
||||
+ optional = Optional.empty();
|
||||
+ }
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
- BlockState iblockdata = worldserver1.getBlockState(blockposition);
|
||||
- boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
- isAnchorSpawn = flag3; // Paper - Fix PlayerRespawnEvent
|
||||
- Vec3 vec3d = (Vec3) optional.get();
|
||||
- float f1;
|
||||
+ if (optional.isPresent()) {
|
||||
+ BlockState iblockdata = worldserver1.getBlockState(blockposition);
|
||||
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
+ isAnchorSpawn = flag3; // Paper - Fix PlayerRespawnEvent
|
||||
+ Vec3 vec3d = (Vec3) optional.get();
|
||||
+ float f1;
|
||||
|
||||
- if (!iblockdata.is(BlockTags.BEDS) && !flag3) {
|
||||
- f1 = f;
|
||||
- } else {
|
||||
- Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
+ if (!iblockdata.is(BlockTags.BEDS) && !flag3) {
|
||||
+ f1 = f;
|
||||
+ } else {
|
||||
+ Vec3 vec3d1 = Vec3.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
|
||||
- f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
- }
|
||||
+ f1 = (float) Mth.wrapDegrees(Mth.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
|
||||
- // entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false); // CraftBukkit - not required, just copies old location into reused entity
|
||||
- flag2 = !flag && flag3;
|
||||
- isBedSpawn = true;
|
||||
- location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F);
|
||||
- } else if (blockposition != null) {
|
||||
- entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
- entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - Add PlayerSetSpawnEvent
|
||||
+ // entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false); // CraftBukkit - not required, just copies old location into reused entity
|
||||
+ flag2 = !flag && flag3;
|
||||
+ isBedSpawn = true;
|
||||
+ location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F);
|
||||
+ } else if (blockposition != null) {
|
||||
+ entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, com.destroystokyo.paper.event.player.PlayerSetSpawnEvent.Cause.PLAYER_RESPAWN); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed // Paper - Add PlayerSetSpawnEvent
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
|
||||
- if (location == null) {
|
||||
- worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
- blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
- location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - Expose world spawn angle
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getLevel(Level.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld(), worldserver1.levelData.getSpawnAngle(), 0.0F).add(0.5F, 0.1F, 0.5F); // Paper - Expose world spawn angle
|
||||
+ }
|
||||
}
|
||||
|
||||
- Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !isAnchorSpawn, isAnchorSpawn, reason, com.google.common.collect.ImmutableSet.<org.bukkit.event.player.PlayerRespawnEvent.RespawnFlag>builder().add(respawnFlags)); // Paper - PlayerRespawnEvent changes
|
||||
this.cserver.getPluginManager().callEvent(respawnEvent);
|
||||
// Spigot Start
|
||||
@@ -1,139 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 08:27:21 -0500
|
||||
Subject: [PATCH] Track Player throughout entire block destroy
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index 12998d0e9ae0e148a155faa4468b0f78b8462cc9..b03eacbef3cf15b70ec012af0870975d3e8e8cba 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -441,6 +441,7 @@ public class ServerPlayerGameMode {
|
||||
org.bukkit.block.BlockState state = bblock.getState();
|
||||
level.captureDrops = new ArrayList<>();
|
||||
// CraftBukkit end
|
||||
+ level.pendingPlayerBlockEvents.put(pos, new Level.PendingBlockEvent(pos, this.player)); // Paper
|
||||
block.playerWillDestroy((Level) this.level, pos, iblockdata, (Player) this.player);
|
||||
boolean flag = this.level.removeBlock(pos, false);
|
||||
|
||||
@@ -465,6 +466,7 @@ public class ServerPlayerGameMode {
|
||||
// CraftBukkit start
|
||||
java.util.List<ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
||||
level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
||||
+ level.pendingPlayerBlockEvents.remove(pos); // Paper
|
||||
if (event.isDropItems()) {
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, itemsToDrop); // Paper - use stored ref
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 7695a5ec88023720d873f81fc36f78ad60fb9589..71d02915581326f5546b2f916259a1ec00e85961 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -323,6 +323,7 @@ public final class ItemStack {
|
||||
}
|
||||
}
|
||||
Item item = this.getItem();
|
||||
+ if (entityhuman != null) world.pendingPlayerBlockEvents.put(blockposition, new Level.PendingBlockEvent(blockposition, entityhuman)); // Paper
|
||||
InteractionResult enuminteractionresult = item.useOn(itemactioncontext);
|
||||
CompoundTag newData = this.getTagClone();
|
||||
int newCount = this.getCount();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 8420d615867faa717266d1edfa5a469df1b1e43f..71fca6c915f90a771e6139b985ebc51c7923778c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -176,6 +176,27 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
|
||||
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
|
||||
|
||||
+ // Paper start - Holder class used to track what Player is responsible the last block event
|
||||
+ public static class PendingBlockEvent {
|
||||
+
|
||||
+ public final BlockPos block;
|
||||
+ public final Player player;
|
||||
+ public @Nullable BlockPos sourceBlock;
|
||||
+
|
||||
+ public PendingBlockEvent(BlockPos block, Player player) {
|
||||
+ this(block, player, null);
|
||||
+ }
|
||||
+
|
||||
+ public PendingBlockEvent(BlockPos block, Player player, @Nullable BlockPos sourceBlock) {
|
||||
+ this.block = block;
|
||||
+ this.player = player;
|
||||
+ this.sourceBlock = sourceBlock;
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ public final Map<BlockPos, PendingBlockEvent> pendingPlayerBlockEvents = new HashMap<>();
|
||||
+ // Paper end
|
||||
+
|
||||
// Paper start - fix and optimise world upgrading
|
||||
// copied from below
|
||||
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {
|
||||
@@ -695,6 +716,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (!this.preventPoiUpdated) {
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
+ pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -800,8 +822,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) {
|
||||
if (!this.isClientSide) {
|
||||
BlockState iblockdata = this.getBlockState(pos);
|
||||
+ org.bukkit.block.Block blockAt = world.getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // Paper
|
||||
|
||||
try {
|
||||
+ // Paper start - If this is a non-air block being set to an air block, get (remove, if exists)
|
||||
+ // our PendingBlockEvent
|
||||
+ if (blockAt.getType() != org.bukkit.Material.AIR && iblockdata.getMaterial() == net.minecraft.world.level.material.Material.AIR) {
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
+ //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
// CraftBukkit start
|
||||
CraftWorld world = ((ServerLevel) this).getWorld();
|
||||
if (world != null && ((ServerLevel)this).hasPhysicsEvent) { // Paper
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index 65a163d93a293e1e0a12a300d6335a700099cac2..b1b6072ffff0e1cc2e9e1a585ad882bc70697d92 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -104,6 +104,12 @@ public class DoublePlantBlock extends BushBlock {
|
||||
BlockPos blockposition1 = pos.below();
|
||||
BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||
|
||||
+ Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
+ //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ }
|
||||
+
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
BlockState iblockdata2 = iblockdata1.hasProperty(BlockStateProperties.WATERLOGGED) && (Boolean) iblockdata1.getValue(BlockStateProperties.WATERLOGGED) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
|
||||
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 83d813025efca5846538e36508a5d4fe38b02108..e1eed33f75c3118826ccd0c994325b327e20f83f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
|
||||
@@ -890,6 +890,18 @@ public abstract class BlockBehaviour {
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, enumdirection);
|
||||
BlockState iblockdata = world.getBlockState(blockposition_mutableblockposition);
|
||||
+
|
||||
+ // Paper start - Propagate the PendingBlockEvent from the current blockPos to the next block
|
||||
+ // if it will break (!canSurvive)
|
||||
+ if (this.getMaterial() == Material.AIR && !iblockdata.canSurvive(world, blockposition_mutableblockposition)) {
|
||||
+ Level.PendingBlockEvent blockEvent = ((Level) world).pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null) {
|
||||
+ BlockPos blockPosCopy = blockposition_mutableblockposition.immutable();
|
||||
+ ((Level) world).pendingPlayerBlockEvents.put(blockPosCopy, new Level.PendingBlockEvent(blockPosCopy, blockEvent.player, pos));
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
BlockState iblockdata1 = iblockdata.updateShape(enumdirection.getOpposite(), this.asState(), world, blockposition_mutableblockposition, pos);
|
||||
|
||||
Block.updateOrDestroy(iblockdata, iblockdata1, world, blockposition_mutableblockposition, flags, maxUpdateDepth);
|
||||
@@ -1,46 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 26 Sep 2021 09:00:50 -0500
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 71fca6c915f90a771e6139b985ebc51c7923778c..96a7ae08649294062f856c67e49a793feb63ca37 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -738,6 +738,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
+ // Paper start
|
||||
+ PendingBlockEvent blockEvent = pendingPlayerBlockEvents.get(pos);
|
||||
+ if (blockEvent != null && blockEvent.sourceBlock != null) {
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this, pos),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(this, blockEvent.sourceBlock));
|
||||
+ event.callEvent();
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
// Paper start - while the above setAir method is named same and looks very similar
|
||||
// they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
index b1b6072ffff0e1cc2e9e1a585ad882bc70697d92..f2eb493d99c2eb826d8b85adbc3dc6799c575f31 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -106,8 +106,11 @@ public class DoublePlantBlock extends BushBlock {
|
||||
|
||||
Level.PendingBlockEvent blockEvent = world.pendingPlayerBlockEvents.remove(pos);
|
||||
if (blockEvent != null) {
|
||||
- //Would fire a future BlockDestroyedByNeighborEvent here, but must have this conditional block
|
||||
- //because it's important to remove from pendingPlayerBlockEvents
|
||||
+ io.papermc.paper.event.block.BlockDestroyedByNeighborEvent event =
|
||||
+ new io.papermc.paper.event.block.BlockDestroyedByNeighborEvent(org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition1),
|
||||
+ (org.bukkit.entity.Player) blockEvent.player.getBukkitEntity(),
|
||||
+ org.bukkit.craftbukkit.block.CraftBlock.at(world, pos));
|
||||
+ if (!event.callEvent()) return;
|
||||
}
|
||||
|
||||
if (iblockdata1.is(state.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
|
||||
149
patches/server/0009-Set-multiple-team-settings-at-once.patch
Normal file
149
patches/server/0009-Set-multiple-team-settings-at-once.patch
Normal file
@@ -0,0 +1,149 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:52:53 -0500
|
||||
Subject: [PATCH] Set multiple team settings at once
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/scores/PlayerTeam.java b/src/main/java/net/minecraft/world/scores/PlayerTeam.java
|
||||
index 9464054912e19fc78dd965b71fce20a18564b351..1624a0f8ea211a4c43fd01612674ca501c10d7e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/scores/PlayerTeam.java
|
||||
+++ b/src/main/java/net/minecraft/world/scores/PlayerTeam.java
|
||||
@@ -28,6 +28,7 @@ public class PlayerTeam extends Team {
|
||||
private ChatFormatting color = ChatFormatting.RESET;
|
||||
private Team.CollisionRule collisionRule = Team.CollisionRule.ALWAYS;
|
||||
private final Style displayNameStyle;
|
||||
+ private boolean updateTeamChangeInstantly = true; // Slice
|
||||
|
||||
public PlayerTeam(Scoreboard scoreboard, String name) {
|
||||
this.scoreboard = scoreboard;
|
||||
@@ -36,6 +37,12 @@ public class PlayerTeam extends Team {
|
||||
this.displayNameStyle = Style.EMPTY.withInsertion(name).withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(name)));
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void setUpdateTeamChangeInstantly(boolean updateTeamChangeInstantly) {
|
||||
+ this.updateTeamChangeInstantly = updateTeamChangeInstantly;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public Scoreboard getScoreboard() {
|
||||
return this.scoreboard;
|
||||
}
|
||||
@@ -64,13 +71,13 @@ public class PlayerTeam extends Team {
|
||||
throw new IllegalArgumentException("Name cannot be null");
|
||||
} else {
|
||||
this.displayName = displayName;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlayerPrefix(@Nullable Component prefix) {
|
||||
this.playerPrefix = prefix == null ? CommonComponents.EMPTY : prefix;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public Component getPlayerPrefix() {
|
||||
@@ -79,7 +86,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setPlayerSuffix(@Nullable Component suffix) {
|
||||
this.playerSuffix = suffix == null ? CommonComponents.EMPTY : suffix;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public Component getPlayerSuffix() {
|
||||
@@ -113,7 +120,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setAllowFriendlyFire(boolean friendlyFire) {
|
||||
this.allowFriendlyFire = friendlyFire;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -123,7 +130,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setSeeFriendlyInvisibles(boolean showFriendlyInvisible) {
|
||||
this.seeFriendlyInvisibles = showFriendlyInvisible;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,12 +145,12 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setNameTagVisibility(Team.Visibility nameTagVisibilityRule) {
|
||||
this.nameTagVisibility = nameTagVisibilityRule;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public void setDeathMessageVisibility(Team.Visibility deathMessageVisibilityRule) {
|
||||
this.deathMessageVisibility = deathMessageVisibilityRule;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,7 +160,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setCollisionRule(Team.CollisionRule collisionRule) {
|
||||
this.collisionRule = collisionRule;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
public int packOptions() {
|
||||
@@ -176,7 +183,7 @@ public class PlayerTeam extends Team {
|
||||
|
||||
public void setColor(ChatFormatting color) {
|
||||
this.color = color;
|
||||
- this.scoreboard.onTeamChanged(this);
|
||||
+ if (updateTeamChangeInstantly) this.scoreboard.onTeamChanged(this); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
index 2b335c750ce5f9ccc2651a8701497ca9b8f46704..c508b2003cb7980b41dce542e5c3053b2fb9d1d8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java
|
||||
@@ -341,6 +341,37 @@ final class CraftTeam extends CraftScoreboardComponent implements Team {
|
||||
}
|
||||
}
|
||||
|
||||
+ //Slice start
|
||||
+ @Override
|
||||
+ public void teamOptions(net.kyori.adventure.text.Component displayName,
|
||||
+ net.kyori.adventure.text.Component prefix,
|
||||
+ net.kyori.adventure.text.Component suffix,
|
||||
+ net.kyori.adventure.text.format.NamedTextColor color,
|
||||
+ java.util.List<org.apache.commons.lang3.tuple.Pair<Option, OptionStatus>> options) throws IllegalStateException {
|
||||
+ checkState();
|
||||
+ team.setUpdateTeamChangeInstantly(false);
|
||||
+
|
||||
+ if (displayName == null) displayName = net.kyori.adventure.text.Component.empty();
|
||||
+ team.setDisplayName(io.papermc.paper.adventure.PaperAdventure.asVanilla(displayName));
|
||||
+
|
||||
+ if (prefix == null) prefix = net.kyori.adventure.text.Component.empty();
|
||||
+ team.setPlayerPrefix(io.papermc.paper.adventure.PaperAdventure.asVanilla(prefix));
|
||||
+
|
||||
+ if (suffix == null) suffix = net.kyori.adventure.text.Component.empty();
|
||||
+ team.setPlayerSuffix(io.papermc.paper.adventure.PaperAdventure.asVanilla(suffix));
|
||||
+
|
||||
+ if (color == null) color = net.kyori.adventure.text.format.NamedTextColor.WHITE;
|
||||
+ team.setColor(io.papermc.paper.adventure.PaperAdventure.asVanilla(color));
|
||||
+
|
||||
+ for (org.apache.commons.lang3.tuple.Pair<Option, OptionStatus> pair : options) {
|
||||
+ setOption(pair.getLeft(), pair.getRight());
|
||||
+ }
|
||||
+
|
||||
+ team.setUpdateTeamChangeInstantly(true);
|
||||
+ team.getScoreboard().onTeamChanged(team);
|
||||
+ }
|
||||
+ //Slice end
|
||||
+
|
||||
// Paper start
|
||||
@Override
|
||||
public void addEntity(org.bukkit.entity.Entity entity) throws IllegalStateException, IllegalArgumentException {
|
||||
75
patches/server/0010-Smooth-Teleports.patch
Normal file
75
patches/server/0010-Smooth-Teleports.patch
Normal file
@@ -0,0 +1,75 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:55:35 -0500
|
||||
Subject: [PATCH] Smooth Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b3781efbd3edcf102fe1bda5d6149915dc1127c6..134792abe368cf92308ce34f7aea83fac6cd33b3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -281,6 +281,7 @@ public class ServerPlayer extends Player {
|
||||
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
+ public boolean smoothWorldTeleport; // Slice
|
||||
|
||||
// Paper start - replace player chunk loader
|
||||
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 81c28b63e9dfe21d8f17f465468c40cf5ef84e9a..f96e4e958d631c42d3538d35202d59c77ddf2467 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -953,12 +953,14 @@ public abstract class PlayerList {
|
||||
ServerLevel worldserver2 = entityplayer1.serverLevel();
|
||||
LevelData worlddata = worldserver2.getLevelData();
|
||||
|
||||
+ if (!entityplayer.smoothWorldTeleport) {
|
||||
entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i));
|
||||
entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getWorld().getSendViewDistance())); // Spigot // Paper - replace old player chunk management
|
||||
entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.getWorld().getSimulationDistance())); // Spigot // Paper - replace old player chunk management
|
||||
entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver2.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit
|
||||
entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
|
||||
entityplayer1.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
+ }
|
||||
entityplayer1.connection.send(new ClientboundSetExperiencePacket(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel));
|
||||
this.sendLevelInfo(entityplayer1, worldserver1);
|
||||
this.sendPlayerPermissionLevel(entityplayer1);
|
||||
@@ -1282,7 +1284,7 @@ public abstract class PlayerList {
|
||||
|
||||
player.connection.send(new ClientboundInitializeBorderPacket(worldborder));
|
||||
player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
- player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle()));
|
||||
+ if (!player.smoothWorldTeleport) player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle()));
|
||||
if (world.isRaining()) {
|
||||
// CraftBukkit start - handle player weather
|
||||
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||
@@ -1293,7 +1295,7 @@ public abstract class PlayerList {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
|
||||
+ if (!player.smoothWorldTeleport) player.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.LEVEL_CHUNKS_LOAD_START, 0.0F));
|
||||
this.server.tickRateManager().updateJoiningPlayer(player);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index e77bf7f432387bdfa7f69d31b014e8cd254fd4ca..bbafd70973b36fefe4f0228d6ca7b24f9771ead7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1255,6 +1255,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void teleportWithoutRespawn(Location location) {
|
||||
+ ServerPlayer serverPlayer = getHandle();
|
||||
+ serverPlayer.smoothWorldTeleport = true;
|
||||
+ teleport(location);
|
||||
+ serverPlayer.smoothWorldTeleport = false;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
|
||||
// Paper start - Teleport API
|
||||
32
patches/server/0011-Disable-Azalea-generation.patch
Normal file
32
patches/server/0011-Disable-Azalea-generation.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:45:12 -0500
|
||||
Subject: [PATCH] Disable Azalea generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
index b9b7d2e668d9f7f36ac3cf1e1716460c4ad5ed3a..9fdd765b65777a1a82b54326bc7ad152416c617e 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
@@ -162,7 +162,7 @@ public class BiomeDefaultFeatures {
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.CAVE_VINES);
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.LUSH_CAVES_CLAY);
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.LUSH_CAVES_VEGETATION);
|
||||
- builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.ROOTED_AZALEA_TREE);
|
||||
+// builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.ROOTED_AZALEA_TREE); // Slice
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.SPORE_BLOSSOM);
|
||||
builder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, CavePlacements.CLASSIC_VINES);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java b/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
|
||||
index c1f4a722b57bdc1ee516951c9341b146eb0fb34e..9d81f1e3e64edfcd5e8a2885dda3187386941cb8 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/features/CaveFeatures.java
|
||||
@@ -110,7 +110,7 @@ public class CaveFeatures {
|
||||
RandomizedIntStateProvider randomizedIntStateProvider = new RandomizedIntStateProvider(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.CAVE_VINES.defaultBlockState(), 4).add(Blocks.CAVE_VINES.defaultBlockState().setValue(CaveVines.BERRIES, Boolean.valueOf(true)), 1)), CaveVinesBlock.AGE, UniformInt.of(23, 25));
|
||||
FeatureUtils.register(featureRegisterable, CAVE_VINE, Feature.BLOCK_COLUMN, new BlockColumnConfiguration(List.of(BlockColumnConfiguration.layer(new WeightedListInt(SimpleWeightedRandomList.<IntProvider>builder().add(UniformInt.of(0, 19), 2).add(UniformInt.of(0, 2), 3).add(UniformInt.of(0, 6), 10).build()), weightedStateProvider), BlockColumnConfiguration.layer(ConstantInt.of(1), randomizedIntStateProvider)), Direction.DOWN, BlockPredicate.ONLY_IN_AIR_PREDICATE, true));
|
||||
FeatureUtils.register(featureRegisterable, CAVE_VINE_IN_MOSS, Feature.BLOCK_COLUMN, new BlockColumnConfiguration(List.of(BlockColumnConfiguration.layer(new WeightedListInt(SimpleWeightedRandomList.<IntProvider>builder().add(UniformInt.of(0, 3), 5).add(UniformInt.of(1, 7), 1).build()), weightedStateProvider), BlockColumnConfiguration.layer(ConstantInt.of(1), randomizedIntStateProvider)), Direction.DOWN, BlockPredicate.ONLY_IN_AIR_PREDICATE, true));
|
||||
- FeatureUtils.register(featureRegisterable, MOSS_VEGETATION, Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.FLOWERING_AZALEA.defaultBlockState(), 4).add(Blocks.AZALEA.defaultBlockState(), 7).add(Blocks.MOSS_CARPET.defaultBlockState(), 25).add(Blocks.SHORT_GRASS.defaultBlockState(), 50).add(Blocks.TALL_GRASS.defaultBlockState(), 10))));
|
||||
+ FeatureUtils.register(featureRegisterable, MOSS_VEGETATION, Feature.SIMPLE_BLOCK, new SimpleBlockConfiguration(new WeightedStateProvider(SimpleWeightedRandomList.<BlockState>builder().add(Blocks.MOSS_CARPET.defaultBlockState(), 25).add(Blocks.SHORT_GRASS.defaultBlockState(), 50).add(Blocks.TALL_GRASS.defaultBlockState(), 10))));
|
||||
FeatureUtils.register(featureRegisterable, MOSS_PATCH, Feature.VEGETATION_PATCH, new VegetationPatchConfiguration(BlockTags.MOSS_REPLACEABLE, BlockStateProvider.simple(Blocks.MOSS_BLOCK), PlacementUtils.inlinePlaced(holderGetter.getOrThrow(MOSS_VEGETATION)), CaveSurface.FLOOR, ConstantInt.of(1), 0.0F, 5, 0.8F, UniformInt.of(4, 7), 0.3F));
|
||||
FeatureUtils.register(featureRegisterable, MOSS_PATCH_BONEMEAL, Feature.VEGETATION_PATCH, new VegetationPatchConfiguration(BlockTags.MOSS_REPLACEABLE, BlockStateProvider.simple(Blocks.MOSS_BLOCK), PlacementUtils.inlinePlaced(holderGetter.getOrThrow(MOSS_VEGETATION)), CaveSurface.FLOOR, ConstantInt.of(1), 0.0F, 5, 0.6F, UniformInt.of(1, 2), 0.75F));
|
||||
FeatureUtils.register(featureRegisterable, DRIPLEAF, Feature.SIMPLE_RANDOM_SELECTOR, new SimpleRandomFeatureConfiguration(HolderSet.direct(makeSmallDripleaf(), makeDripleaf(Direction.EAST), makeDripleaf(Direction.WEST), makeDripleaf(Direction.SOUTH), makeDripleaf(Direction.NORTH))));
|
||||
48
patches/server/0012-AntiXray-Bypass.patch
Normal file
48
patches/server/0012-AntiXray-Bypass.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:46:54 -0500
|
||||
Subject: [PATCH] AntiXray Bypass
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
index e7fe98ea30ae6d0baea3ec1f9f98a89502a49a12..7e2651aa63cc9ddbe28fb9ecbc5188358d52e607 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
@@ -169,6 +169,7 @@ public final class ChunkPacketBlockControllerAntiXray extends ChunkPacketBlockCo
|
||||
|
||||
@Override
|
||||
public boolean shouldModify(ServerPlayer player, LevelChunk chunk) {
|
||||
+ if (player.getBukkitEntity().hasAntiXrayBypass()) return false; // Slice
|
||||
return !usePermission || !player.getBukkitEntity().hasPermission("paper.antixray.bypass");
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index bbafd70973b36fefe4f0228d6ca7b24f9771ead7..a86600e01572ee14f35ecf1b7e71dbac369632e1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -199,6 +199,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
|
||||
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
|
||||
private long lastSaveTime; // Paper - getLastPlayed replacement API
|
||||
+ private boolean antiXrayBypass; // Slice
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
@@ -2952,6 +2953,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Slice start
|
||||
+ public boolean hasAntiXrayBypass() {
|
||||
+ return this.antiXrayBypass;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void toggleAntiXrayBypass(boolean bypass) {
|
||||
+ this.antiXrayBypass = bypass;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public void updateCommands() {
|
||||
if (this.getHandle().connection == null) return;
|
||||
37
patches/server/0013-Add-PlayerPreChunkLoadEvent.patch
Normal file
37
patches/server/0013-Add-PlayerPreChunkLoadEvent.patch
Normal file
@@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:47:43 -0500
|
||||
Subject: [PATCH] Add PlayerPreChunkLoadEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
index 1b090f1e79b996e52097afc49c1cec85936653e6..5185bcbf5363fa2c7e2b0226706cc66d46fa16ee 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
@@ -410,7 +410,7 @@ public class RegionizedPlayerChunkLoader {
|
||||
private boolean canGenerateChunks = true;
|
||||
|
||||
private final ArrayDeque<ChunkHolderManager.TicketOperation<?, ?>> delayedTicketOps = new ArrayDeque<>();
|
||||
- private final LongOpenHashSet sentChunks = new LongOpenHashSet();
|
||||
+ public final LongOpenHashSet sentChunks = new LongOpenHashSet(); // Slice -> public
|
||||
|
||||
private static final byte CHUNK_TICKET_STAGE_NONE = 0;
|
||||
private static final byte CHUNK_TICKET_STAGE_LOADING = 1;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 2e5fae21dcf511c18d309780fcc3204d3bfa7af2..fd8c6a3aaba37bb7439e74b9fc765dd7332041d9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -547,6 +547,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ @NotNull
|
||||
+ public it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(@NotNull Player p) {
|
||||
+ ServerPlayer craftPlayer = ((CraftPlayer) p).getHandle();
|
||||
+ return craftPlayer.chunkLoader.sentChunks;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public boolean isChunkInUse(int x, int z) {
|
||||
return this.isChunkLoaded(x, z);
|
||||
@@ -1,213 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 6 Oct 2021 11:03:01 -0500
|
||||
Subject: [PATCH] Packet obfuscation and reduction
|
||||
|
||||
Minecraft is overzealous about packet updates for Entities. In Loka's case, we want to reduce as many unnecessary
|
||||
packet updates as possible. This patch is likely to be updated over and over in terms of reducing packet sends.
|
||||
|
||||
In summary, this patch creates the concept of a "foreignValue" of a packet's data. We treat packets in two ways:
|
||||
1) The packet sent to the player itself (the normal way). This always has all of the values as usual.
|
||||
2) The packet data as seen by any other (foreign) players.
|
||||
|
||||
This patch adds the ability to set a "foreignValue" for an entity value so as to obfuscate data received by other players.
|
||||
The current packets modified/obfuscated are the following:
|
||||
|
||||
# Health - Foreign Players will only receive packets that say the player is "alive or dead (max health or 0 health).
|
||||
# This reduces the amount of health packet updates as well which is great for players in combat.
|
||||
|
||||
# Air Level - Foreign players will only ever see a player as having full oxygen
|
||||
# Air level packets are sent PER-TICK, and as such a player with any change in air level will only spam themselves
|
||||
# with packets instead of every single player within tracking distance
|
||||
|
||||
# Score - Foreign players will only see a player's score as 0 and will not update due to gathering xp orbs, etc.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
index 3e17f6131bf590d7c4a16b79c1c145cb4f565bc9..e1233fa58d068448d0accef7a7f6725fcb902848 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEntityDataPacket.java
|
||||
@@ -22,6 +22,13 @@ public class ClientboundSetEntityDataPacket implements Packet<ClientGamePacketLi
|
||||
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public ClientboundSetEntityDataPacket(int id, List<SynchedEntityData.DataItem<?>> packedItems) {
|
||||
+ this.id = id;
|
||||
+ this.packedItems = packedItems;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public ClientboundSetEntityDataPacket(FriendlyByteBuf buf) {
|
||||
this.id = buf.readVarInt();
|
||||
this.packedItems = SynchedEntityData.unpack(buf);
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index 4df12454001f0de5f358c88d876e34c35a736c42..72c74d2369a36b14f1103aa74b096f50e7990f4d 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -136,6 +136,11 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value) {
|
||||
+ //Slice start
|
||||
+ set(key, value, null);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, @Nullable T foreignValue) { // Slice end
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
if (ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
@@ -145,6 +150,11 @@ public class SynchedEntityData {
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) {
|
||||
+ datawatcher_item.setForeignValue(foreignValue);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -200,6 +210,28 @@ public class SynchedEntityData {
|
||||
return list;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Nullable
|
||||
+ public List<SynchedEntityData.DataItem<?>> packForeignDirty(List<DataItem<?>> unpackedData) {
|
||||
+ List<SynchedEntityData.DataItem<?>> list = null;
|
||||
+
|
||||
+ for (DataItem<?> dataItem : unpackedData) {
|
||||
+ DataItem<?> item = itemsById.get(dataItem.accessor.getId());
|
||||
+ if (item.isDirty(true)) {
|
||||
+ item.setForeignDirty(false);
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ list = Lists.newArrayList();
|
||||
+ }
|
||||
+
|
||||
+ list.add(item.copy(true));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataItem<?>> getAll() {
|
||||
List<SynchedEntityData.DataItem<?>> list = null;
|
||||
@@ -313,11 +345,14 @@ public class SynchedEntityData {
|
||||
final EntityDataAccessor<T> accessor;
|
||||
T value;
|
||||
private boolean dirty;
|
||||
+ @Nullable T foreignValue = null; // Slice
|
||||
+ private boolean foreignDirty; // Slice
|
||||
|
||||
public DataItem(EntityDataAccessor<T> data, T value) {
|
||||
this.accessor = data;
|
||||
this.value = value;
|
||||
this.dirty = true;
|
||||
+ this.foreignDirty = true; // Slice
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -343,5 +378,34 @@ public class SynchedEntityData {
|
||||
public SynchedEntityData.DataItem<T> copy() {
|
||||
return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy(this.value));
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void setForeignValue(T foreignValue) {
|
||||
+ this.foreignValue = foreignValue;
|
||||
+ this.foreignDirty = true;
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable T getForeignValue() {
|
||||
+ return foreignValue;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isDirty(boolean foreign) {
|
||||
+ if (foreign) {
|
||||
+ //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal
|
||||
+ //value and check the normal dirty flag.
|
||||
+ return foreignValue == null || this.foreignDirty;
|
||||
+ }
|
||||
+
|
||||
+ return this.dirty;
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignDirty(boolean dirty) {
|
||||
+ this.foreignDirty = dirty;
|
||||
+ }
|
||||
+
|
||||
+ public SynchedEntityData.DataItem<T> copy(boolean foreign) {
|
||||
+ return new SynchedEntityData.DataItem<>(this.accessor, this.accessor.getSerializer().copy((foreign && this.foreignValue != null ? this.foreignValue : this.value)));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 1c6bf5a3014beaf5f9c1c38aed4cf3225e50b8bb..6e9c5e210270647205499801b235849d20776156 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -368,7 +368,19 @@ public class ServerEntity {
|
||||
SynchedEntityData datawatcher = this.entity.getEntityData();
|
||||
|
||||
if (datawatcher.isDirty()) {
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false));
|
||||
+ // Slice start
|
||||
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), datawatcher, false);
|
||||
+ if (this.entity instanceof ServerPlayer serverPlayer) {
|
||||
+ serverPlayer.connection.send(dataPacket);
|
||||
+ }
|
||||
+
|
||||
+ //Get the packedData that the original packet has, and then determine if any of those are changed in
|
||||
+ //the foreign version. If null, nothing to notify foreign trackers about.
|
||||
+ List<SynchedEntityData.DataItem<?>> dirtyItems = datawatcher.packForeignDirty(dataPacket.getUnpackedData());
|
||||
+ if (dirtyItems != null) {
|
||||
+ this.broadcast(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 78cb0786e741f8ef8611460dab64d0e2448fb6cf..587411322e75b08b7f6c2f18a22256ff9bf526ad 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2953,7 +2953,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
|
||||
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
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 51fd9bca61888861b58966a69cd1b63c742c44ca..3ed6e5d0c50c259c3df2b0cf84e2fb7ccf64def3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -633,7 +633,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
- this.entityData.set(Player.DATA_SCORE_ID, j + score);
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 4ff4143f3a7cd89ef92f4b8882fa3e5addfe0f06..83495f9a7d92cd42c2f367891a0a04870a4a1577 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2004,7 +2004,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
- this.getHandle().getEntityData().set(LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth());
|
||||
+ this.getHandle().getEntityData().set(LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice
|
||||
|
||||
this.getHandle().maxHealthCache = getMaxHealth();
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:08:06 -0500
|
||||
Date: Tue, 18 Apr 2023 07:49:59 -0500
|
||||
Subject: [PATCH] Allow opening covered chests
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ChestBlock.java b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
index 1891cfb8f7ebae5a95a55f706bb04f8206121d32..d24c22e0dd84344021a77d24926c2934e71d40ff 100644
|
||||
index 9804ee2020e5cef23d3f5174d153fc149e611503..8baeb4cb4a6e24e8099a0a98779dc50073d5d0b4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -356,9 +356,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
@@ -358,9 +358,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
}
|
||||
|
||||
private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
|
||||
@@ -23,10 +23,10 @@ index 1891cfb8f7ebae5a95a55f706bb04f8206121d32..d24c22e0dd84344021a77d24926c2934
|
||||
|
||||
private static boolean isCatSittingOnChest(LevelAccessor world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
index 7e45c97acce83a9fe8ada486e9fcdafe58769736..80e30b978455890506ef555773983dd4058185e3 100644
|
||||
index ddca14f1224327a738415fb8b37398d8df0aa9c8..cfd9bfd30d4b1787dacc95215e823603537131fd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
@@ -77,10 +77,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
@@ -83,10 +83,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory();
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (playerEnderChestContainer != null && blockEntity instanceof EnderChestBlockEntity) {
|
||||
@@ -1,36 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 10 Oct 2021 13:36:38 -0500
|
||||
Subject: [PATCH] Smooth World Teleports
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 11f46c1b8f4c8414e0667d1873542c17d6e01f2a..fda2fedb0a24800e2690bba13d44c1cbfc3fb867 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -263,6 +263,7 @@ public class ServerPlayer extends Player {
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public boolean needsChunkCenterUpdate; // Paper - no-tick view distance // Paper - public
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event
|
||||
+ public boolean smoothWorldTeleport; // Slice
|
||||
|
||||
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile) {
|
||||
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index eaa005c1c9b4386bcdbe1d6eb28c3eca7635066c..86d00fdee17bce31a5caf370ede8a2dbc42e440b 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -940,11 +940,11 @@ public abstract class PlayerList {
|
||||
}
|
||||
// CraftBukkit start
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
- entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionType(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag));
|
||||
entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.getChunkSource().chunkMap.playerChunkManager.getLoadDistance())); // Spigot // Paper - no-tick view distance// Paper - replace old player chunk management
|
||||
entityplayer1.setLevel(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
- entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
// entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
@@ -1,17 +1,17 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 09:29:09 -0500
|
||||
Subject: [PATCH] Don't send fire packets if player has Fire Resistance
|
||||
Date: Tue, 18 Apr 2023 07:50:34 -0500
|
||||
Subject: [PATCH] Don't send fire packets if player has FR
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..ea85fc39b77aece9c9544ec01348eafa233355d1 100644
|
||||
index 45439b0cc4ea69e409fd41d4684403c0e0feab12..007055909e4f11a6c2805b8118d092e8b6f0a982 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -760,7 +760,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
@@ -890,7 +890,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
|
||||
this.checkOutOfWorld();
|
||||
if (!this.level.isClientSide) {
|
||||
this.checkBelowWorld();
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setSharedFlagOnFire(this.remainingFireTicks > 0);
|
||||
+ if (this instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
|
||||
+ this.setSharedFlagOnFire(this.remainingFireTicks > 0 && !livingEntity.hasEffect(net.minecraft.world.effect.MobEffects.FIRE_RESISTANCE));
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 5 Oct 2021 09:05:10 -0500
|
||||
Date: Tue, 18 Apr 2023 07:52:19 -0500
|
||||
Subject: [PATCH] Allow access to LightEngine
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index b3c99c1678c3ee159861c8aac38e765d664c4d1d..b6e1459db7f03801073d39ead5cd08fda8c9b4ba 100644
|
||||
index 5637dcf1f6c76df33988c3279171aafbc1868a82..22ec85fb9e5313b94f1dc55c3cfbfe88eded0db6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -702,7 +702,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return Math.max(Math.abs(k), Math.abs(l));
|
||||
@@ -434,7 +434,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - rewrite player chunk loader
|
||||
}
|
||||
|
||||
- protected ThreadedLevelLightEngine getLightEngine() {
|
||||
@@ -1,94 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 29 Oct 2021 10:22:23 -0500
|
||||
Subject: [PATCH] Block Mob Spawns globally by EntityType
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 2509a170b8ddd812ad5be49e5345ec5a3c0cf2b8..6a0726ec0882a67d2cc6b652010e2b02a75b3833 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -665,4 +665,16 @@ public class PaperConfig {
|
||||
private static void sendFullPosForHardCollidingEntities() {
|
||||
sendFullPosForHardCollidingEntities = getBoolean("settings.send-full-pos-for-hard-colliding-entities", true);
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public static java.util.Set<net.minecraft.world.entity.EntityType<?>> globalBlockedMobSpawnTypes = new java.util.HashSet<>();
|
||||
+
|
||||
+ private static void globalBlockedMobSpawnTypes() {
|
||||
+ java.util.List<String> list = getList("settings.global-blocked-mobspawn-types", java.util.Collections.emptyList());
|
||||
+ for (String type : list) {
|
||||
+ java.util.Optional<net.minecraft.world.entity.EntityType<?>> entityType = net.minecraft.world.entity.EntityType.byString(type.toLowerCase());
|
||||
+ entityType.ifPresent(eType -> globalBlockedMobSpawnTypes.add(eType));
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
index 86528ff031014e788d72a8bf7c1c9443512096bb..f66e6f750136fc3903acbcb7502e98e21e75fe5a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java
|
||||
@@ -41,9 +41,10 @@ public class MobSpawnSettings {
|
||||
}), Codec.BOOL.fieldOf("player_spawn_friendly").orElse(false).forGetter(MobSpawnSettings::playerSpawnFriendly)).apply(instance, MobSpawnSettings::new);
|
||||
});
|
||||
private final float creatureGenerationProbability;
|
||||
- private final Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners;
|
||||
- private final Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts;
|
||||
+ private Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners; // Slice
|
||||
+ private Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> mobSpawnCosts; // Slice
|
||||
private final boolean playerSpawnFriendly;
|
||||
+ private boolean stripped; // Slice
|
||||
|
||||
MobSpawnSettings(float creatureSpawnProbability, Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawners, Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> spawnCosts, boolean playerSpawnFriendly) {
|
||||
this.creatureGenerationProbability = creatureSpawnProbability;
|
||||
@@ -52,12 +53,49 @@ public class MobSpawnSettings {
|
||||
this.playerSpawnFriendly = playerSpawnFriendly;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ // This very stupid thing is because Mob Spawning Biome data is statically registered before CraftServer
|
||||
+ // is even created. As a result, we need to lazily rebuild our spawning data here which is very cool and very
|
||||
+ // stupid. But it should only really happen once up front, so isn't the end of the world
|
||||
+ private void stripSpawnData() {
|
||||
+ if (com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.isEmpty()) {
|
||||
+ stripped = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> finalMobSpawnCosts = new java.util.HashMap<>();
|
||||
+ for (Entry<EntityType<?>, MobSpawnSettings.MobSpawnCost> entry : mobSpawnCosts.entrySet()) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.contains(entry.getKey())) {
|
||||
+ finalMobSpawnCosts.put(entry.getKey(), entry.getValue());
|
||||
+ }
|
||||
+ }
|
||||
+ this.mobSpawnCosts = ImmutableMap.copyOf(finalMobSpawnCosts);
|
||||
+
|
||||
+ Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> finalSpawners = new java.util.HashMap<>();
|
||||
+ for (Entry<MobCategory, WeightedRandomList<SpawnerData>> entry : spawners.entrySet()) {
|
||||
+ List<SpawnerData> finalSpawnerData = new java.util.ArrayList<>();
|
||||
+ for (SpawnerData spawnerData : entry.getValue().unwrap()) {
|
||||
+ if (!com.destroystokyo.paper.PaperConfig.globalBlockedMobSpawnTypes.contains(spawnerData.type)) {
|
||||
+ finalSpawnerData.add(spawnerData);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ finalSpawners.put(entry.getKey(), finalSpawnerData.isEmpty() ? EMPTY_MOB_LIST : WeightedRandomList.create(finalSpawnerData));
|
||||
+ }
|
||||
+
|
||||
+ this.spawners = ImmutableMap.copyOf(finalSpawners);
|
||||
+ stripped = true;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
public WeightedRandomList<MobSpawnSettings.SpawnerData> getMobs(MobCategory spawnGroup) {
|
||||
+ if (!stripped) stripSpawnData(); // Slice
|
||||
return this.spawners.getOrDefault(spawnGroup, EMPTY_MOB_LIST);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MobSpawnSettings.MobSpawnCost getMobSpawnCost(EntityType<?> entityType) {
|
||||
+ if (!stripped) stripSpawnData(); // Slice
|
||||
return this.mobSpawnCosts.get(entityType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 18 Apr 2023 07:56:32 -0500
|
||||
Subject: [PATCH] Disable geode and monsterspawners generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java b/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java
|
||||
index 84aa56cbcaa5539b556f42eb284d3dd2e200e358..a6d2ead225841192c2eb80b3b2e54ceeaa76546b 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/biome/OverworldBiomes.java
|
||||
@@ -54,8 +54,8 @@ public class OverworldBiomes {
|
||||
|
||||
private static void globalOverworldGeneration(BiomeGenerationSettings.Builder generationSettings) {
|
||||
BiomeDefaultFeatures.addDefaultCarversAndLakes(generationSettings);
|
||||
- BiomeDefaultFeatures.addDefaultCrystalFormations(generationSettings);
|
||||
- BiomeDefaultFeatures.addDefaultMonsterRoom(generationSettings);
|
||||
+// BiomeDefaultFeatures.addDefaultCrystalFormations(generationSettings); // Slice - Don't generate Geodes in our chunk generation
|
||||
+// BiomeDefaultFeatures.addDefaultMonsterRoom(generationSettings);
|
||||
BiomeDefaultFeatures.addDefaultUndergroundVariety(generationSettings);
|
||||
BiomeDefaultFeatures.addDefaultSprings(generationSettings);
|
||||
BiomeDefaultFeatures.addSurfaceFreezing(generationSettings);
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 29 Oct 2021 17:06:43 -0500
|
||||
Subject: [PATCH] Very far tracking range
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 9f32296ca4afaa7f2c0dd920a4c994af7a815ec3..2b2fb92cbfeed75276f054e6f04e21b37d28b49b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1994,8 +1994,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end
|
||||
if (!(entity instanceof EnderDragonPart)) {
|
||||
EntityType<?> entitytypes = entity.getType();
|
||||
- int i = entitytypes.clientTrackingRange() * 16;
|
||||
- i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
+ // Slice
|
||||
+ int i;
|
||||
+ if (entity.visibleFromVeryFar) {
|
||||
+ i = 128;
|
||||
+ } else {
|
||||
+ i = entitytypes.clientTrackingRange() * 16;
|
||||
+ i = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, i); // Spigot
|
||||
+ }
|
||||
+ // Slice end
|
||||
|
||||
if (i != 0) {
|
||||
int j = entitytypes.updateInterval();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 7c3cd4d613489e5ad68a15f59b076668cbc82c5e..b9f85c52ee8af7349b3600a7a45f37c593ed761d 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -339,6 +339,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
|
||||
+ public boolean visibleFromVeryFar; // Slice
|
||||
+
|
||||
public float getBukkitYaw() {
|
||||
return this.yRot;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 986f045a2e6a040c6e2aab7420c8cb2d4ac3a726..eb18db47313ebefb4e66a92f072931186245e968 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1067,6 +1067,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.getHandle().setSilent(flag);
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public void setVisibleFromVeryFar(boolean flag) {
|
||||
+ this.getHandle().visibleFromVeryFar = flag;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public boolean hasGravity() {
|
||||
return !this.getHandle().isNoGravity();
|
||||
@@ -1,18 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 30 Nov 2021 12:04:50 -0600
|
||||
Subject: [PATCH] PlayerTrackEntityEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 6e9c5e210270647205499801b235849d20776156..bae3f9447d9dbb6cc48fe4878ac2d57c4d28b9d7 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -362,6 +362,7 @@ public class ServerEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ this.entity.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerTrackEntityEvent(entityplayer.getBukkitEntity().getPlayer(), this.entity.getBukkitEntity())); // Slice
|
||||
}
|
||||
|
||||
private void sendDirtyEntityData() {
|
||||
19
patches/server/0018-Set-Mutton-nutrition-equal-to-beef.patch
Normal file
19
patches/server/0018-Set-Mutton-nutrition-equal-to-beef.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 18 Apr 2023 07:58:01 -0500
|
||||
Subject: [PATCH] Set Mutton nutrition equal to beef
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
index b16d9e2eaa589f19c563ee70b1a56d67dbcdecb0..c6ff08efc7f0c0e782f8e78e01b9d9cea5cdcaed 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/Foods.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
@@ -17,7 +17,7 @@ public class Foods {
|
||||
public static final FoodProperties COOKED_BEEF = (new FoodProperties.Builder()).nutrition(8).saturationMod(0.8F).meat().build();
|
||||
public static final FoodProperties COOKED_CHICKEN = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.6F).meat().build();
|
||||
public static final FoodProperties COOKED_COD = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).build();
|
||||
- public static final FoodProperties COOKED_MUTTON = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.8F).meat().build();
|
||||
+ public static final FoodProperties COOKED_MUTTON = (new FoodProperties.Builder()).nutrition(8).saturationMod(0.8F).meat().build();
|
||||
public static final FoodProperties COOKED_PORKCHOP = (new FoodProperties.Builder()).nutrition(8).saturationMod(0.8F).meat().build();
|
||||
public static final FoodProperties COOKED_RABBIT = (new FoodProperties.Builder()).nutrition(5).saturationMod(0.6F).meat().build();
|
||||
public static final FoodProperties COOKED_SALMON = (new FoodProperties.Builder()).nutrition(6).saturationMod(0.8F).build();
|
||||
140
patches/server/0019-PlayerLoadStatsEvent.patch
Normal file
140
patches/server/0019-PlayerLoadStatsEvent.patch
Normal file
@@ -0,0 +1,140 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:15:23 -0500
|
||||
Subject: [PATCH] PlayerLoadStatsEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index f96e4e958d631c42d3538d35202d59c77ddf2467..670e69b8728d47739083d087c35628c16441453f 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1497,7 +1497,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
}
|
||||
|
||||
- serverstatisticmanager = new ServerStatsCounter(this.server, file1);
|
||||
+ serverstatisticmanager = new ServerStatsCounter(this.server, file1, uuid); // Slice
|
||||
// this.stats.put(uuid, serverstatisticmanager); // CraftBukkit
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 0e02785ec35e635bef33cc89c54b146c8e7dac99..5f13740dbf354291bca33fe91ba581562531f6fe 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -45,10 +45,16 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
private final File file;
|
||||
private final Set<Stat<?>> dirty = Sets.newHashSet();
|
||||
|
||||
- public ServerStatsCounter(MinecraftServer server, File file) {
|
||||
+ public ServerStatsCounter(MinecraftServer server, File file, java.util.UUID uuid) { // Slice
|
||||
this.server = server;
|
||||
this.file = file;
|
||||
- if (file.isFile()) {
|
||||
+ // Slice start - If event supplies stats, use it. Otherwise just load from disk as usual
|
||||
+ com.destroystokyo.paper.event.player.PlayerLoadStatsEvent event = new com.destroystokyo.paper.event.player.PlayerLoadStatsEvent(uuid);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ JsonObject providedStats = event.getStatistics();
|
||||
+ if (providedStats != null) {
|
||||
+ readStats(server.getFixerUpper(), fromJson(providedStats));
|
||||
+ } else if (file.isFile()) { // Slice end
|
||||
try {
|
||||
this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file));
|
||||
} catch (IOException ioexception) {
|
||||
@@ -109,46 +115,8 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
if (!jsonelement.isJsonNull()) {
|
||||
CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonelement.getAsJsonObject());
|
||||
-
|
||||
- nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343));
|
||||
- if (!nbttagcompound.contains("stats", 10)) {
|
||||
- break label48;
|
||||
- }
|
||||
-
|
||||
- CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats");
|
||||
- Iterator iterator = nbttagcompound1.getAllKeys().iterator();
|
||||
-
|
||||
- while (true) {
|
||||
- if (!iterator.hasNext()) {
|
||||
- break label48;
|
||||
- }
|
||||
-
|
||||
- String s1 = (String) iterator.next();
|
||||
-
|
||||
- if (nbttagcompound1.contains(s1, 10)) {
|
||||
- Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(new ResourceLocation(s1)), (statisticwrapper) -> {
|
||||
- CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1);
|
||||
- Iterator iterator1 = nbttagcompound2.getAllKeys().iterator();
|
||||
-
|
||||
- while (iterator1.hasNext()) {
|
||||
- String s2 = (String) iterator1.next();
|
||||
-
|
||||
- if (nbttagcompound2.contains(s2, 99)) {
|
||||
- Util.ifElse(this.getStat(statisticwrapper, s2), (statistic) -> {
|
||||
- this.stats.put(statistic, nbttagcompound2.getInt(s2));
|
||||
- }, () -> {
|
||||
- ServerStatsCounter.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, s2);
|
||||
- });
|
||||
- } else {
|
||||
- ServerStatsCounter.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", new Object[]{this.file, nbttagcompound2.get(s2), s2});
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- }, () -> {
|
||||
- ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1);
|
||||
- });
|
||||
- }
|
||||
- }
|
||||
+ readStats(dataFixer, nbttagcompound);
|
||||
+ break label48;
|
||||
}
|
||||
|
||||
ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file);
|
||||
@@ -173,6 +141,48 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
}
|
||||
|
||||
+ private void readStats(DataFixer dataFixer, CompoundTag nbttagcompound) {
|
||||
+ nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343));
|
||||
+ if (!nbttagcompound.contains("stats", 10)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats");
|
||||
+ Iterator iterator = nbttagcompound1.getAllKeys().iterator();
|
||||
+
|
||||
+ while (true) {
|
||||
+ if (!iterator.hasNext()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ String s1 = (String) iterator.next();
|
||||
+
|
||||
+ if (nbttagcompound1.contains(s1, 10)) {
|
||||
+ Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(new ResourceLocation(s1)), (statisticwrapper) -> {
|
||||
+ CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1);
|
||||
+ Iterator iterator1 = nbttagcompound2.getAllKeys().iterator();
|
||||
+
|
||||
+ while (iterator1.hasNext()) {
|
||||
+ String s2 = (String) iterator1.next();
|
||||
+
|
||||
+ if (nbttagcompound2.contains(s2, 99)) {
|
||||
+ Util.ifElse(this.getStat(statisticwrapper, s2), (statistic) -> {
|
||||
+ this.stats.put(statistic, nbttagcompound2.getInt(s2));
|
||||
+ }, () -> {
|
||||
+ ServerStatsCounter.LOGGER.warn("Invalid statistic in {}: Don't know what {} is", this.file, s2);
|
||||
+ });
|
||||
+ } else {
|
||||
+ ServerStatsCounter.LOGGER.warn("Invalid statistic value in {}: Don't know what {} is for key {}", new Object[]{this.file, nbttagcompound2.get(s2), s2});
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }, () -> {
|
||||
+ ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
private <T> Optional<Stat<T>> getStat(StatType<T> type, String id) {
|
||||
// CraftBukkit - decompile error start
|
||||
Optional<ResourceLocation> optional = Optional.ofNullable(ResourceLocation.tryParse(id));
|
||||
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:16:50 -0500
|
||||
Subject: [PATCH] Add Force Crit to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
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 567704f61034363e48ef2a5b5566ebdc91682297..7c80c0a4a6ab953d4d2aaf44b8d38b7f4839ebc7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1280,10 +1280,11 @@ public abstract class Player extends LivingEntity {
|
||||
flag1 = true;
|
||||
}
|
||||
|
||||
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; // Paper - Add critical damage API; diff on change
|
||||
+ boolean forceCrit = playerAttackEntityEvent.isForceCrit();
|
||||
+ boolean flag2 = forceCrit || (flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity); // Paper - Add critical damage API; diff on change
|
||||
|
||||
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
- flag2 = flag2 && !this.isSprinting();
|
||||
+ flag2 = forceCrit || (flag2 && !this.isSprinting()); // Slice
|
||||
if (flag2) {
|
||||
f *= 1.5F;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:17:39 -0500
|
||||
Subject: [PATCH] Add Preventing KB Bonus to PlayerPreAttackEntityEvent
|
||||
|
||||
|
||||
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 7c80c0a4a6ab953d4d2aaf44b8d38b7f4839ebc7..de8b794575dfad2ced1b44fab8dffc248ba47d19 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1272,7 +1272,11 @@ public abstract class Player extends LivingEntity {
|
||||
boolean flag = f2 > 0.9F;
|
||||
boolean flag1 = false;
|
||||
byte b0 = 0;
|
||||
- int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
|
||||
+ int i = b0; // Slice start
|
||||
+ if (!playerAttackEntityEvent.isPreventKnockbackBonus()) {
|
||||
+ i += EnchantmentHelper.getKnockbackBonus(this);
|
||||
+ }
|
||||
+ // Slice end
|
||||
|
||||
if (this.isSprinting() && flag) {
|
||||
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
|
||||
31
patches/server/0022-noEntityCollisions-for-Entity.patch
Normal file
31
patches/server/0022-noEntityCollisions-for-Entity.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:21:03 -0500
|
||||
Subject: [PATCH] noEntityCollisions for Entity
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
index ee0331a6bc40cdde08d926fd8eb1dc642630c2e5..d1094f6a61976a81f400ab5b2b604f9608209b28 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
@@ -1753,7 +1753,7 @@ public final class CollisionUtil {
|
||||
public static boolean getEntityHardCollisions(final CollisionGetter getter, final Entity entity, AABB aabb,
|
||||
final List<AABB> into, final int collisionFlags, final Predicate<Entity> predicate) {
|
||||
final boolean checkOnly = (collisionFlags & COLLISION_FLAG_CHECK_ONLY) != 0;
|
||||
- if (!(getter instanceof EntityGetter entityGetter)) {
|
||||
+ if ((entity != null && entity.noEntityCollisions) || !(getter instanceof EntityGetter entityGetter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 007055909e4f11a6c2805b8118d092e8b6f0a982..20f8e96110a3a6401e71dc9b61fb5678e17fc428 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -521,6 +521,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
* Overriding this field will cause memory leaks.
|
||||
*/
|
||||
private final boolean hardCollides;
|
||||
+ public boolean noEntityCollisions; // Slice
|
||||
|
||||
private static final java.util.Map<Class<? extends Entity>, Boolean> cachedOverrides = java.util.Collections.synchronizedMap(new java.util.WeakHashMap<>());
|
||||
{
|
||||
42
patches/server/0023-Do-not-freeze-MappedRegistry.patch
Normal file
42
patches/server/0023-Do-not-freeze-MappedRegistry.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 09:05:16 -0500
|
||||
Subject: [PATCH] Do not freeze MappedRegistry
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
index 742af4feb3986ca7d8f5ed136b556a41cbe0722f..d8fd0627b781e4b66ad0882304ec417fbb5c9b20 100644
|
||||
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
@@ -334,7 +334,7 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
if (this.frozen) {
|
||||
return this;
|
||||
} else {
|
||||
- this.frozen = true;
|
||||
+// this.frozen = true; // Slice
|
||||
this.byValue.forEach((value, entry) -> {
|
||||
entry.bindValue(value);
|
||||
});
|
||||
@@ -361,14 +361,16 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
||||
|
||||
@Override
|
||||
public Holder.Reference<T> createIntrusiveHolder(T value) {
|
||||
+ // Slice start
|
||||
if (this.unregisteredIntrusiveHolders == null) {
|
||||
- throw new IllegalStateException("This registry can't create intrusive holders");
|
||||
- } else {
|
||||
- this.validateWrite();
|
||||
- return this.unregisteredIntrusiveHolders.computeIfAbsent(value, (valuex) -> {
|
||||
- return Holder.Reference.createIntrusive(this.asLookup(), valuex);
|
||||
- });
|
||||
+ this.unregisteredIntrusiveHolders = new HashMap<>();
|
||||
}
|
||||
+ // Slice end
|
||||
+
|
||||
+ this.validateWrite();
|
||||
+ return this.unregisteredIntrusiveHolders.computeIfAbsent(value, (valuex) -> {
|
||||
+ return Holder.Reference.createIntrusive(this.asLookup(), valuex);
|
||||
+ });
|
||||
}
|
||||
|
||||
@Override
|
||||
24
patches/server/0024-Add-jackson.patch
Normal file
24
patches/server/0024-Add-jackson.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 2 May 2023 07:54:02 -0500
|
||||
Subject: [PATCH] Add jackson
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index c9868e781ce212285a9621236efa65788c7a1cca..223e80ea0ede575cf8f73191ef2799ae0ee41ba7 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -19,6 +19,13 @@ dependencies {
|
||||
exclude("io.papermc.paper", "paper-api")
|
||||
}
|
||||
// Slice end
|
||||
+
|
||||
+ // Slice start - JSON logging for DataDog ingestion
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-core:2.13.0")
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-databind:2.13.0")
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.0")
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 22 May 2023 08:21:18 -0500
|
||||
Subject: [PATCH] Allow inventory clicks in Spectator
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index a7e40f72a3b56916620a7f089410ec3a6db0cffc..de421ee333ab796a7b9c077045c16e994f72bb4f 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -2872,7 +2872,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit
|
||||
- boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if
|
||||
+ boolean cancelled = false; //Slice - allow spectator inv management this.player.isSpectator(); // CraftBukkit - see below if
|
||||
if (false/*this.player.isSpectator()*/) { // CraftBukkit
|
||||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
184
patches/server/0026-Packet-obfuscation-and-reduction.patch
Normal file
184
patches/server/0026-Packet-obfuscation-and-reduction.patch
Normal file
@@ -0,0 +1,184 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 6 Jun 2023 07:51:32 -0500
|
||||
Subject: [PATCH] Packet obfuscation and reduction
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
index 58b602e550258c1062ee940bc46538dac95d8979..3ad5950d05fed7ff8810a8a7969fcb58547b1021 100644
|
||||
--- a/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/network/syncher/SynchedEntityData.java
|
||||
@@ -165,15 +165,29 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value, boolean force) {
|
||||
+ // Slice start
|
||||
+ this.set(key, value, force, null);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, @Nullable T foreignValue) {
|
||||
+ this.set(key, value, false, foreignValue);
|
||||
+ }
|
||||
+
|
||||
+ public <T> void set(EntityDataAccessor<T> key, T value, boolean force, @Nullable T foreignValue) { // Slice end
|
||||
SynchedEntityData.DataItem<T> datawatcher_item = this.getItem(key);
|
||||
|
||||
+ // Slice start
|
||||
+ if (foreignValue != null && ObjectUtils.notEqual(foreignValue, datawatcher_item.getForeignValue())) {
|
||||
+ datawatcher_item.setForeignValue(foreignValue);
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
if (force || ObjectUtils.notEqual(value, datawatcher_item.getValue())) {
|
||||
datawatcher_item.setValue(value);
|
||||
this.entity.onSyncedDataUpdated(key);
|
||||
datawatcher_item.setDirty(true);
|
||||
this.isDirty = true;
|
||||
}
|
||||
-
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -215,6 +229,26 @@ public class SynchedEntityData {
|
||||
return list;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Nullable
|
||||
+ public List<SynchedEntityData.DataValue<?>> packForeignDirty() {
|
||||
+ List<SynchedEntityData.DataValue<?>> list = null;
|
||||
+
|
||||
+ for (DataItem<?> dataItem : this.itemsById.values()) {
|
||||
+ if (dataItem.isDirty(true)) {
|
||||
+ dataItem.setForeignDirty(false);
|
||||
+ if (list == null) {
|
||||
+ list = new ArrayList();
|
||||
+ }
|
||||
+
|
||||
+ list.add(dataItem.foreignValue != null ? dataItem.foreignValue() : dataItem.value());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return list;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataValue<?>> getNonDefaultValues() {
|
||||
List<SynchedEntityData.DataValue<?>> list = null;
|
||||
@@ -339,11 +373,14 @@ public class SynchedEntityData {
|
||||
T value;
|
||||
private final T initialValue;
|
||||
private boolean dirty;
|
||||
+ private @Nullable T foreignValue = null; // Slice
|
||||
+ private boolean foreignDirty; // Slice
|
||||
|
||||
public DataItem(EntityDataAccessor<T> data, T value) {
|
||||
this.accessor = data;
|
||||
this.initialValue = value;
|
||||
this.value = value;
|
||||
+ this.foreignDirty = true; //Slice
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -373,6 +410,35 @@ public class SynchedEntityData {
|
||||
public SynchedEntityData.DataValue<T> value() {
|
||||
return SynchedEntityData.DataValue.create(this.accessor, this.value);
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public SynchedEntityData.DataValue<T> foreignValue() {
|
||||
+ return SynchedEntityData.DataValue.create(this.accessor, this.foreignValue);
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignValue(T foreignValue) {
|
||||
+ this.foreignValue = foreignValue;
|
||||
+ this.foreignDirty = true;
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable T getForeignValue() {
|
||||
+ return foreignValue;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isDirty(boolean foreign) {
|
||||
+ if (foreign) {
|
||||
+ //There must be a foreign value in order for this to be dirty, otherwise we consider this a normal
|
||||
+ //value and check the normal dirty flag.
|
||||
+ return foreignValue == null || this.foreignDirty;
|
||||
+ }
|
||||
+
|
||||
+ return this.dirty;
|
||||
+ }
|
||||
+
|
||||
+ public void setForeignDirty(boolean dirty) {
|
||||
+ this.foreignDirty = dirty;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
public static record DataValue<T>(int id, EntityDataSerializer<T> serializer, T value) { // CraftBukkit - decompile error
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 529ab44baaf573b97cf7e89560c548642733188f..e3e0f306ebed31ce4742e7d2f15ab102b93a9dff 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -380,7 +380,20 @@ public class ServerEntity {
|
||||
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
- this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+// this.broadcastAndSend(new ClientboundSetEntityDataPacket(this.entity.getId(), list));
|
||||
+ // Slice start
|
||||
+ ClientboundSetEntityDataPacket dataPacket = new ClientboundSetEntityDataPacket(this.entity.getId(), list);
|
||||
+ if (this.entity instanceof ServerPlayer serverPlayer) {
|
||||
+ serverPlayer.connection.send(dataPacket);
|
||||
+ }
|
||||
+
|
||||
+ //Get the packedData that the original packet has, and then determine if any of those are changed in
|
||||
+ //the foreign version. If null, nothing to notify foreign trackers about.
|
||||
+ List<SynchedEntityData.DataValue<?>> dirtyItems = datawatcher.packForeignDirty();
|
||||
+ if (dirtyItems != null) {
|
||||
+ this.broadcast.accept(new ClientboundSetEntityDataPacket(this.entity.getId(), dirtyItems));
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a2aa1f3f52b165e8815e5d5ba58453e02f3ed330..a23c584ce1f9abcc911aa6a39715b8eeca4ff0af 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3405,7 +3405,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
|
||||
return;
|
||||
}
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
|
||||
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount(), getMaxAirSupply()); // Slice
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
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 de8b794575dfad2ced1b44fab8dffc248ba47d19..7e2fa586ae255cb94e302c14d0811e36e860f188 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -646,7 +646,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
- this.entityData.set(Player.DATA_SCORE_ID, j + score);
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
public void startAutoSpinAttack(int riptideTicks) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index a86600e01572ee14f35ecf1b7e71dbac369632e1..83b3f00d0570d7909931434cb425cb9baff513b6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2755,7 +2755,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.sendHealthUpdate();
|
||||
}
|
||||
}
|
||||
- this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth());
|
||||
+ this.getHandle().getEntityData().set(net.minecraft.world.entity.LivingEntity.DATA_HEALTH_ID, (float) this.getScaledHealth(), isDead() ? 0f : 20f); // Slice
|
||||
|
||||
this.getHandle().maxHealthCache = this.getMaxHealth();
|
||||
}
|
||||
85
patches/server/0027-Long-distance-tracking.patch
Normal file
85
patches/server/0027-Long-distance-tracking.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 6 Jun 2023 08:14:08 -0500
|
||||
Subject: [PATCH] Long distance tracking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 6b755f07ca62a8bb9ad3b1a2aee5fa07bacb134c..94d2f22d374f899d29576c927798a6de66120a41 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1411,6 +1411,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - remove allocation of Vec3D here
|
||||
int i = ChunkMap.this.getPlayerViewDistance(player);
|
||||
double d0 = (double) Math.min(this.getEffectiveRange(), i * 16);
|
||||
+ if (this.entity instanceof ServerPlayer serverPlayer && player.canSeeFromLongDistance(serverPlayer)) d0 = Math.min(level.spigotConfig.flyingPlayerTrackingRange, d0); // Slice
|
||||
double d1 = vec3d_dx * vec3d_dx + vec3d_dz * vec3d_dz; // Paper
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index d9b9dd6023532a26f5d8173fb1fccf10a9dfec8c..dec8e20a8132e601ed0db3352d22fad968ed555a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -282,6 +282,7 @@ public class ServerPlayer extends Player {
|
||||
public @Nullable String clientBrandName = null; // Paper - Brand support
|
||||
public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
|
||||
public boolean smoothWorldTeleport; // Slice
|
||||
+ public boolean hasLongDistanceTracking; // Slice
|
||||
|
||||
// Paper start - replace player chunk loader
|
||||
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
|
||||
@@ -2758,4 +2759,18 @@ public class ServerPlayer extends Player {
|
||||
return (CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
+
|
||||
+ // Slice start
|
||||
+ public boolean canSeeFromLongDistance(ServerPlayer other) {
|
||||
+ if (hasLongDistanceTracking) return true;
|
||||
+
|
||||
+ CraftPlayer bukkitEntity = other.getBukkitEntity();
|
||||
+ return bukkitEntity.isGliding() || bukkitEntity.isFlying();
|
||||
+ }
|
||||
+
|
||||
+ public boolean canBeSeenLongDistance() {
|
||||
+ CraftPlayer bukkitEntity = getBukkitEntity();
|
||||
+ return bukkitEntity.isGliding() || bukkitEntity.isFlying();
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
index 1cf6d4f854d89c515e48e1fb365eb95ff9340765..6dab8b76bef3c97936fc337e813bcb60c7f2026d 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
||||
@@ -271,6 +271,7 @@ public class SpigotWorldConfig
|
||||
}
|
||||
|
||||
public int playerTrackingRange = 48;
|
||||
+ public int flyingPlayerTrackingRange = 64; // Slice
|
||||
public int animalTrackingRange = 48;
|
||||
public int monsterTrackingRange = 48;
|
||||
public int miscTrackingRange = 32;
|
||||
@@ -279,6 +280,7 @@ public class SpigotWorldConfig
|
||||
private void trackingRange()
|
||||
{
|
||||
this.playerTrackingRange = this.getInt( "entity-tracking-range.players", this.playerTrackingRange );
|
||||
+ this.flyingPlayerTrackingRange = this.getInt( "entity-tracking-range.flying-players", this.flyingPlayerTrackingRange ); // Slice
|
||||
this.animalTrackingRange = this.getInt( "entity-tracking-range.animals", this.animalTrackingRange );
|
||||
this.monsterTrackingRange = this.getInt( "entity-tracking-range.monsters", this.monsterTrackingRange );
|
||||
this.miscTrackingRange = this.getInt( "entity-tracking-range.misc", this.miscTrackingRange );
|
||||
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
index e4425b242fe73d1fd2bd10c313aa16925432329f..b3252aa5bb4ce9fac0b914e0b2fe74d2c7ac3bce 100644
|
||||
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
@@ -26,9 +26,9 @@ public class TrackingRange
|
||||
return defaultRange;
|
||||
}
|
||||
SpigotWorldConfig config = entity.level().spigotConfig;
|
||||
- if ( entity instanceof ServerPlayer )
|
||||
+ if ( entity instanceof ServerPlayer serverPlayer)
|
||||
{
|
||||
- return config.playerTrackingRange;
|
||||
+ return serverPlayer.canBeSeenLongDistance() ? config.flyingPlayerTrackingRange : config.playerTrackingRange;
|
||||
// Paper start - Simplify and set water mobs to animal tracking range
|
||||
}
|
||||
switch (entity.activationType) {
|
||||
232
patches/server/0028-Equipment-Packet-Caching.patch
Normal file
232
patches/server/0028-Equipment-Packet-Caching.patch
Normal file
@@ -0,0 +1,232 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 12 Jun 2023 14:14:48 -0500
|
||||
Subject: [PATCH] Equipment Packet Caching
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||
index 5a8f850b447fc3a4bd0eb0c505bbdfc8be7115e8..34d74735b7a7d258c6bd14bb7e5406934a208a31 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetEquipmentPacket.java
|
||||
@@ -18,6 +18,15 @@ public class ClientboundSetEquipmentPacket implements Packet<ClientGamePacketLis
|
||||
this.slots = equipmentList;
|
||||
}
|
||||
|
||||
+ public ClientboundSetEquipmentPacket(int id, List<Pair<EquipmentSlot, ItemStack>> equipmentList, net.minecraft.world.entity.LivingEntity entity, String tag) {
|
||||
+ this.entity = id;
|
||||
+ slots = new java.util.ArrayList<>(equipmentList.size());
|
||||
+ for (Pair<EquipmentSlot, ItemStack> pair : equipmentList) {
|
||||
+ EquipmentSlot slot = pair.getFirst();
|
||||
+ slots.add(Pair.of(slot, entity.getOrCreateCachedEquipmentItem(tag, slot, pair.getSecond())));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public ClientboundSetEquipmentPacket(FriendlyByteBuf buf) {
|
||||
this.entity = buf.readVarInt();
|
||||
EquipmentSlot[] equipmentSlots = EquipmentSlot.values();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index e3e0f306ebed31ce4742e7d2f15ab102b93a9dff..4f4ea6dcef4e1960ac69271fbd771dd3ad6af275 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -331,27 +331,8 @@ public class ServerEntity {
|
||||
sender.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
|
||||
}
|
||||
|
||||
- if (this.entity instanceof LivingEntity) {
|
||||
- List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
- int i = aenumitemslot.length;
|
||||
-
|
||||
- for (int j = 0; j < i; ++j) {
|
||||
- EquipmentSlot enumitemslot = aenumitemslot[j];
|
||||
- ItemStack itemstack = ((LivingEntity) this.entity).getItemBySlot(enumitemslot);
|
||||
-
|
||||
- if (!itemstack.isEmpty()) {
|
||||
- // Paper start - prevent oversized data
|
||||
- final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
|
||||
- list.add(Pair.of(enumitemslot, ((LivingEntity) this.entity).stripMeta(sanitized, false))); // Paper - Hide unnecessary item meta
|
||||
- // Paper end - prevent oversized data
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!list.isEmpty()) {
|
||||
- sender.accept(new ClientboundSetEquipmentPacket(this.entity.getId(), list));
|
||||
- }
|
||||
- ((LivingEntity) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ if (this.entity instanceof LivingEntity livingEntity) {
|
||||
+ livingEntity.sendEquipment(sender, player); // Slice
|
||||
}
|
||||
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index e9bb7feb591032904516d1b9374f486d8a7d066c..d6c23f52fdbcf55cb69b75ed95e7e83d0136eb87 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.minecraft.world.entity;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
+import com.google.common.cache.Cache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -143,7 +144,6 @@ import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
-import co.aikar.timings.MinecraftTimings; // Paper
|
||||
|
||||
public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
@@ -264,6 +264,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event
|
||||
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
|
||||
|
||||
+ // Slice start
|
||||
+ private static final java.util.Map<String, com.google.common.cache.Cache<Integer, ItemStack>> equipmentPacketCache = new java.util.HashMap<>();
|
||||
+ protected final java.util.Map<String, net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket> cachedEquipmentPacket = new java.util.HashMap<>();
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public float getBukkitYaw() {
|
||||
return this.getYHeadRot();
|
||||
@@ -3133,6 +3138,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (map != null) {
|
||||
this.handleHandSwap(map);
|
||||
if (!map.isEmpty()) {
|
||||
+ cachedEquipmentPacket.clear(); // Slice - Must invalidate cached equipment map if we have changes
|
||||
this.handleEquipmentChanges(map);
|
||||
}
|
||||
}
|
||||
@@ -3225,7 +3231,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
});
|
||||
- ((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
|
||||
+
|
||||
+ // Slice start
|
||||
+ net.minecraft.server.level.ChunkMap.TrackedEntity entityTracker = ((ServerLevel) this.level()).getChunkSource().chunkMap.entityMap.get(getId());
|
||||
+ if (entityTracker != null) {
|
||||
+ ClientboundSetEquipmentPacket packet = new ClientboundSetEquipmentPacket(this.getId(), list);
|
||||
+ for (net.minecraft.server.network.ServerPlayerConnection playerConnection : entityTracker.seenBy) {
|
||||
+ ServerPlayer player = playerConnection.getPlayer();
|
||||
+ org.bukkit.event.player.PlayerReceiveEquipmentEvent event = new org.bukkit.event.player.PlayerReceiveEquipmentEvent(player.getBukkitEntity(), getBukkitEntity());
|
||||
+ level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ String tag = event.getTag();
|
||||
+ if (tag != null) {
|
||||
+ playerConnection.send(new ClientboundSetEquipmentPacket(this.getId(), list, this, tag));
|
||||
+ } else {
|
||||
+ playerConnection.send(packet);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// Paper start - Hide unnecessary item meta
|
||||
@@ -4565,4 +4589,85 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public static record Fallsounds(SoundEvent small, SoundEvent big) {
|
||||
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public static void invalidateCachedEquipment(String tag) {
|
||||
+ Cache<Integer, ItemStack> removedCache = equipmentPacketCache.remove(tag);
|
||||
+ if (removedCache != null) {
|
||||
+ removedCache.asMap().clear();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getOrCreateCachedEquipmentItem(String tag, EquipmentSlot slot, ItemStack itemStack) {
|
||||
+ return equipmentPacketCache.computeIfAbsent(tag, s -> com.google.common.cache.CacheBuilder.newBuilder()
|
||||
+ .expireAfterAccess(10, java.util.concurrent.TimeUnit.MINUTES)
|
||||
+ .build())
|
||||
+ .asMap()
|
||||
+ .computeIfAbsent(itemStack.hashCode(), i -> {
|
||||
+ String name = slot.name();
|
||||
+
|
||||
+ //How neat is this.
|
||||
+ if (name.equals("MAINHAND")) {
|
||||
+ name = "HAND";
|
||||
+ } else if (name.equals("OFFHAND")) {
|
||||
+ name = "OFF_HAND";
|
||||
+ }
|
||||
+
|
||||
+ org.bukkit.event.entity.EntityEquipmentItemLookup event = new org.bukkit.event.entity.EntityEquipmentItemLookup(getBukkitEntity(), tag, org.bukkit.inventory.EquipmentSlot.valueOf(name), CraftItemStack.asBukkitCopy(itemStack));
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.inventory.ItemStack eventItem = event.getItemStack();
|
||||
+ return CraftItemStack.asNMSCopy(eventItem);
|
||||
+ });
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
+ // Slice start
|
||||
+ public void sendEquipment(java.util.function.Consumer<net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>> consumer, ServerPlayer p) {
|
||||
+ org.bukkit.event.player.PlayerReceiveEquipmentEvent event = new org.bukkit.event.player.PlayerReceiveEquipmentEvent(p.getBukkitEntity(), getBukkitEntity());
|
||||
+ level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ boolean sendEquipment = !event.isCancelled();
|
||||
+ String tag = event.getTag();
|
||||
+ if (sendEquipment && this instanceof ServerPlayer player && tag != null) {
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = player.cachedEquipmentPacket.get(tag);
|
||||
+ if (equipmentPacket != null) {
|
||||
+ //Event says use a tag, and our tag exists; so we simply used our entire cached packet
|
||||
+ consumer.accept(equipmentPacket);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (sendEquipment) {
|
||||
+ EquipmentSlot[] equipmentSlots = EquipmentSlot.values();
|
||||
+ List<Pair<EquipmentSlot, ItemStack>> list = new ArrayList<>(equipmentSlots.length);
|
||||
+
|
||||
+ for (EquipmentSlot enumitemslot : equipmentSlots) {
|
||||
+ ItemStack itemstack = getItemBySlot(enumitemslot);
|
||||
+
|
||||
+ if (!itemstack.isEmpty()) {
|
||||
+ // Paper start - prevent oversized data
|
||||
+ final ItemStack sanitized = LivingEntity.sanitizeItemStack(itemstack.copy(), false);
|
||||
+ ItemStack strippedItem = stripMeta(sanitized, false);
|
||||
+
|
||||
+ if (tag != null) {
|
||||
+ strippedItem = getOrCreateCachedEquipmentItem(tag, enumitemslot, strippedItem);
|
||||
+ }
|
||||
+
|
||||
+ list.add(Pair.of(enumitemslot, strippedItem)); // Paper - remove unnecessary item meta
|
||||
+ // Paper end - prevent oversized data
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!list.isEmpty()) {
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(getId(), list);
|
||||
+ if (tag != null) {
|
||||
+ cachedEquipmentPacket.put(tag, equipmentPacket);
|
||||
+ }
|
||||
+ consumer.accept(equipmentPacket);
|
||||
+ }
|
||||
+
|
||||
+ detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index c4a166a0c226c6083c25c58145d9631d4296e615..187cea96bbe0f1c157484ad42e74951bc714d199 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1210,4 +1210,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.getHandle().setYBodyRot(bodyYaw);
|
||||
}
|
||||
// Paper end - body yaw API
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public void sendEquipment(Player p) {
|
||||
+ if (entity instanceof net.minecraft.world.entity.LivingEntity livingEntity) {
|
||||
+ net.minecraft.server.level.ServerPlayer serverPlayer = ((CraftPlayer) p).getHandle();
|
||||
+ livingEntity.sendEquipment(packet -> serverPlayer.connection.send(packet), serverPlayer);
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
66
patches/server/0029-Add-canDespawn-to-Warden.patch
Normal file
66
patches/server/0029-Add-canDespawn-to-Warden.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 23 Jun 2023 08:22:19 -0500
|
||||
Subject: [PATCH] Add canDespawn to Warden
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..a6ef7eda2cecaca50c63801b58ec59d43e1f306a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -595,7 +595,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
if (generation) entity.generation = true; // Paper - Don't fire sync event during generation
|
||||
entity.load(nbt);
|
||||
}, () -> {
|
||||
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
|
||||
+ //EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.toString());
|
||||
});
|
||||
}
|
||||
|
||||
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 937f81a859953498abe73bea560c86e6560e1c33..b925176496639524d80de33c2b4e7a42877c4bca 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
|
||||
@@ -112,6 +112,7 @@ public class Warden extends Monster implements VibrationSystem {
|
||||
private final VibrationSystem.User vibrationUser = new Warden.VibrationUser();
|
||||
private VibrationSystem.Data vibrationData = new VibrationSystem.Data();
|
||||
AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList());
|
||||
+ public boolean canDespawn; // Slice
|
||||
|
||||
public Warden(EntityType<? extends Monster> type, Level world) {
|
||||
super(type, world);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java b/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java
|
||||
index 03f16a5541de6bc95407aaa24741570c1993dc9e..07600fdd32a058d0e3f9828efdc18f5e76448663 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/warden/WardenAi.java
|
||||
@@ -139,7 +139,13 @@ public class WardenAi {
|
||||
|
||||
public static void setDigCooldown(LivingEntity warden) {
|
||||
if (warden.getBrain().hasMemoryValue(MemoryModuleType.DIG_COOLDOWN)) {
|
||||
- warden.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 1200L);
|
||||
+ // Slice start
|
||||
+ if (warden instanceof Warden nmsWarden && !nmsWarden.canDespawn) {
|
||||
+ warden.getBrain().setMemory(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE);
|
||||
+ } else {
|
||||
+ warden.getBrain().setMemoryWithExpiry(MemoryModuleType.DIG_COOLDOWN, Unit.INSTANCE, 1200L);
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
||||
index c284eb96a1e330078076cbe61f0f6e2ff4ed89bd..b9ffe3d49f0253353fb2b726f974effe18e521ec 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWarden.java
|
||||
@@ -86,4 +86,11 @@ public class CraftWarden extends CraftMonster implements org.bukkit.entity.Warde
|
||||
case ANGRY -> AngerLevel.ANGRY;
|
||||
};
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public void setCanDespawn(boolean canDespawn) {
|
||||
+ this.getHandle().canDespawn = canDespawn;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 22 Aug 2023 06:22:16 -0500
|
||||
Subject: [PATCH] Add reason to PlayerConnectionCloseEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
index 87c5690774363edc1b7ebff10b041e48c0a6d56d..cf018b276c674f49c2aaa0084ecdcdc4dc6edbd4 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -142,6 +142,7 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||
// Paper end - Debugging
|
||||
this.connection.send(new ClientboundDisconnectPacket(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA));
|
||||
this.connection.disconnect(ServerConfigurationPacketListenerImpl.DISCONNECT_REASON_INVALID_DATA);
|
||||
+ new com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent(this.gameProfile.getId(), this.gameProfile.getName(), ((java.net.InetSocketAddress)this.connection.address).getAddress(), com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent.ConnectionCloseReason.INVALID_PLAYER_DATA, false).callEvent(); // Slice
|
||||
}
|
||||
|
||||
}
|
||||
314
patches/server/0031-Disable-feature-generation.patch
Normal file
314
patches/server/0031-Disable-feature-generation.patch
Normal file
@@ -0,0 +1,314 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 26 Aug 2023 07:39:46 -0500
|
||||
Subject: [PATCH] Disable feature generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java
|
||||
index f945fae50983424091b58f83ed14f2e8f2621619..b4c16e355ebadf06b9405c06e2b598e7a478f6ab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java
|
||||
@@ -33,139 +33,5 @@ public class GeodeFeature extends Feature<GeodeConfiguration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean place(FeaturePlaceContext<GeodeConfiguration> context) {
|
||||
- GeodeConfiguration geodeConfiguration = context.config();
|
||||
- RandomSource randomSource = context.random();
|
||||
- BlockPos blockPos = context.origin();
|
||||
- WorldGenLevel worldGenLevel = context.level();
|
||||
- int i = geodeConfiguration.minGenOffset;
|
||||
- int j = geodeConfiguration.maxGenOffset;
|
||||
- List<Pair<BlockPos, Integer>> list = Lists.newLinkedList();
|
||||
- int k = geodeConfiguration.distributionPoints.sample(randomSource);
|
||||
- WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(worldGenLevel.getSeed()));
|
||||
- NormalNoise normalNoise = NormalNoise.create(worldgenRandom, -4, 1.0D);
|
||||
- List<BlockPos> list2 = Lists.newLinkedList();
|
||||
- double d = (double)k / (double)geodeConfiguration.outerWallDistance.getMaxValue();
|
||||
- GeodeLayerSettings geodeLayerSettings = geodeConfiguration.geodeLayerSettings;
|
||||
- GeodeBlockSettings geodeBlockSettings = geodeConfiguration.geodeBlockSettings;
|
||||
- GeodeCrackSettings geodeCrackSettings = geodeConfiguration.geodeCrackSettings;
|
||||
- double e = 1.0D / Math.sqrt(geodeLayerSettings.filling);
|
||||
- double f = 1.0D / Math.sqrt(geodeLayerSettings.innerLayer + d);
|
||||
- double g = 1.0D / Math.sqrt(geodeLayerSettings.middleLayer + d);
|
||||
- double h = 1.0D / Math.sqrt(geodeLayerSettings.outerLayer + d);
|
||||
- double l = 1.0D / Math.sqrt(geodeCrackSettings.baseCrackSize + randomSource.nextDouble() / 2.0D + (k > 3 ? d : 0.0D));
|
||||
- boolean bl = (double)randomSource.nextFloat() < geodeCrackSettings.generateCrackChance;
|
||||
- int m = 0;
|
||||
-
|
||||
- for(int n = 0; n < k; ++n) {
|
||||
- int o = geodeConfiguration.outerWallDistance.sample(randomSource);
|
||||
- int p = geodeConfiguration.outerWallDistance.sample(randomSource);
|
||||
- int q = geodeConfiguration.outerWallDistance.sample(randomSource);
|
||||
- BlockPos blockPos2 = blockPos.offset(o, p, q);
|
||||
- BlockState blockState = worldGenLevel.getBlockState(blockPos2);
|
||||
- if (blockState.isAir() || blockState.is(BlockTags.GEODE_INVALID_BLOCKS)) {
|
||||
- ++m;
|
||||
- if (m > geodeConfiguration.invalidBlocksThreshold) {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- list.add(Pair.of(blockPos2, geodeConfiguration.pointOffset.sample(randomSource)));
|
||||
- }
|
||||
-
|
||||
- if (bl) {
|
||||
- int r = randomSource.nextInt(4);
|
||||
- int s = k * 2 + 1;
|
||||
- if (r == 0) {
|
||||
- list2.add(blockPos.offset(s, 7, 0));
|
||||
- list2.add(blockPos.offset(s, 5, 0));
|
||||
- list2.add(blockPos.offset(s, 1, 0));
|
||||
- } else if (r == 1) {
|
||||
- list2.add(blockPos.offset(0, 7, s));
|
||||
- list2.add(blockPos.offset(0, 5, s));
|
||||
- list2.add(blockPos.offset(0, 1, s));
|
||||
- } else if (r == 2) {
|
||||
- list2.add(blockPos.offset(s, 7, s));
|
||||
- list2.add(blockPos.offset(s, 5, s));
|
||||
- list2.add(blockPos.offset(s, 1, s));
|
||||
- } else {
|
||||
- list2.add(blockPos.offset(0, 7, 0));
|
||||
- list2.add(blockPos.offset(0, 5, 0));
|
||||
- list2.add(blockPos.offset(0, 1, 0));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- List<BlockPos> list3 = Lists.newArrayList();
|
||||
- Predicate<BlockState> predicate = isReplaceable(geodeConfiguration.geodeBlockSettings.cannotReplace);
|
||||
-
|
||||
- for(BlockPos blockPos3 : BlockPos.betweenClosed(blockPos.offset(i, i, i), blockPos.offset(j, j, j))) {
|
||||
- double t = normalNoise.getValue((double)blockPos3.getX(), (double)blockPos3.getY(), (double)blockPos3.getZ()) * geodeConfiguration.noiseMultiplier;
|
||||
- double u = 0.0D;
|
||||
- double v = 0.0D;
|
||||
-
|
||||
- for(Pair<BlockPos, Integer> pair : list) {
|
||||
- u += Mth.invSqrt(blockPos3.distSqr(pair.getFirst()) + (double)pair.getSecond().intValue()) + t;
|
||||
- }
|
||||
-
|
||||
- for(BlockPos blockPos4 : list2) {
|
||||
- v += Mth.invSqrt(blockPos3.distSqr(blockPos4) + (double)geodeCrackSettings.crackPointOffset) + t;
|
||||
- }
|
||||
-
|
||||
- if (!(u < h)) {
|
||||
- if (bl && v >= l && u < e) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, Blocks.AIR.defaultBlockState(), predicate);
|
||||
-
|
||||
- for(Direction direction : DIRECTIONS) {
|
||||
- BlockPos blockPos5 = blockPos3.relative(direction);
|
||||
- FluidState fluidState = worldGenLevel.getFluidState(blockPos5);
|
||||
- if (!fluidState.isEmpty()) {
|
||||
- worldGenLevel.scheduleTick(blockPos5, fluidState.getType(), 0);
|
||||
- }
|
||||
- }
|
||||
- } else if (u >= e) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.fillingProvider.getState(randomSource, blockPos3), predicate);
|
||||
- } else if (u >= f) {
|
||||
- boolean bl2 = (double)randomSource.nextFloat() < geodeConfiguration.useAlternateLayer0Chance;
|
||||
- if (bl2) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.alternateInnerLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- } else {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.innerLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- }
|
||||
-
|
||||
- if ((!geodeConfiguration.placementsRequireLayer0Alternate || bl2) && (double)randomSource.nextFloat() < geodeConfiguration.usePotentialPlacementsChance) {
|
||||
- list3.add(blockPos3.immutable());
|
||||
- }
|
||||
- } else if (u >= g) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.middleLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- } else if (u >= h) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, geodeBlockSettings.outerLayerProvider.getState(randomSource, blockPos3), predicate);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- List<BlockState> list4 = geodeBlockSettings.innerPlacements;
|
||||
-
|
||||
- for(BlockPos blockPos6 : list3) {
|
||||
- BlockState blockState2 = Util.getRandom(list4, randomSource);
|
||||
-
|
||||
- for(Direction direction2 : DIRECTIONS) {
|
||||
- if (blockState2.hasProperty(BlockStateProperties.FACING)) {
|
||||
- blockState2 = blockState2.setValue(BlockStateProperties.FACING, direction2);
|
||||
- }
|
||||
-
|
||||
- BlockPos blockPos7 = blockPos6.relative(direction2);
|
||||
- BlockState blockState3 = worldGenLevel.getBlockState(blockPos7);
|
||||
- if (blockState2.hasProperty(BlockStateProperties.WATERLOGGED)) {
|
||||
- blockState2 = blockState2.setValue(BlockStateProperties.WATERLOGGED, Boolean.valueOf(blockState3.getFluidState().isSource()));
|
||||
- }
|
||||
-
|
||||
- if (BuddingAmethystBlock.canClusterGrowAtState(blockState3)) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos7, blockState2, predicate);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
+ public boolean place(FeaturePlaceContext<GeodeConfiguration> context) {return false;}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
|
||||
index 7c252dd2bd314f06703ac9356410c52b21198d12..7a34e16db1b51f4283112c8c99a84322213823fa 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/MonsterRoomFeature.java
|
||||
@@ -30,103 +30,7 @@ public class MonsterRoomFeature extends Feature<NoneFeatureConfiguration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> context) {
|
||||
- Predicate<BlockState> predicate = Feature.isReplaceable(BlockTags.FEATURES_CANNOT_REPLACE);
|
||||
- BlockPos blockPos = context.origin();
|
||||
- RandomSource randomSource = context.random();
|
||||
- WorldGenLevel worldGenLevel = context.level();
|
||||
- int i = 3;
|
||||
- int j = randomSource.nextInt(2) + 2;
|
||||
- int k = -j - 1;
|
||||
- int l = j + 1;
|
||||
- int m = -1;
|
||||
- int n = 4;
|
||||
- int o = randomSource.nextInt(2) + 2;
|
||||
- int p = -o - 1;
|
||||
- int q = o + 1;
|
||||
- int r = 0;
|
||||
-
|
||||
- for(int s = k; s <= l; ++s) {
|
||||
- for(int t = -1; t <= 4; ++t) {
|
||||
- for(int u = p; u <= q; ++u) {
|
||||
- BlockPos blockPos2 = blockPos.offset(s, t, u);
|
||||
- boolean bl = worldGenLevel.getBlockState(blockPos2).isSolid();
|
||||
- if (t == -1 && !bl) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if (t == 4 && !bl) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- if ((s == k || s == l || u == p || u == q) && t == 0 && worldGenLevel.isEmptyBlock(blockPos2) && worldGenLevel.isEmptyBlock(blockPos2.above())) {
|
||||
- ++r;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (r >= 1 && r <= 5) {
|
||||
- for(int v = k; v <= l; ++v) {
|
||||
- for(int w = 3; w >= -1; --w) {
|
||||
- for(int x = p; x <= q; ++x) {
|
||||
- BlockPos blockPos3 = blockPos.offset(v, w, x);
|
||||
- BlockState blockState = worldGenLevel.getBlockState(blockPos3);
|
||||
- if (v != k && w != -1 && x != p && v != l && w != 4 && x != q) {
|
||||
- if (!blockState.is(Blocks.CHEST) && !blockState.is(Blocks.SPAWNER)) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, AIR, predicate);
|
||||
- }
|
||||
- } else if (blockPos3.getY() >= worldGenLevel.getMinBuildHeight() && !worldGenLevel.getBlockState(blockPos3.below()).isSolid()) {
|
||||
- worldGenLevel.setBlock(blockPos3, AIR, 2);
|
||||
- } else if (blockState.isSolid() && !blockState.is(Blocks.CHEST)) {
|
||||
- if (w == -1 && randomSource.nextInt(4) != 0) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, Blocks.MOSSY_COBBLESTONE.defaultBlockState(), predicate);
|
||||
- } else {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos3, Blocks.COBBLESTONE.defaultBlockState(), predicate);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- for(int y = 0; y < 2; ++y) {
|
||||
- for(int z = 0; z < 3; ++z) {
|
||||
- int aa = blockPos.getX() + randomSource.nextInt(j * 2 + 1) - j;
|
||||
- int ab = blockPos.getY();
|
||||
- int ac = blockPos.getZ() + randomSource.nextInt(o * 2 + 1) - o;
|
||||
- BlockPos blockPos4 = new BlockPos(aa, ab, ac);
|
||||
- if (worldGenLevel.isEmptyBlock(blockPos4)) {
|
||||
- int ad = 0;
|
||||
-
|
||||
- for(Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
- if (worldGenLevel.getBlockState(blockPos4.relative(direction)).isSolid()) {
|
||||
- ++ad;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (ad == 1) {
|
||||
- this.safeSetBlock(worldGenLevel, blockPos4, StructurePiece.reorient(worldGenLevel, blockPos4, Blocks.CHEST.defaultBlockState()), predicate);
|
||||
- RandomizableContainer.setBlockEntityLootTable(worldGenLevel, randomSource, blockPos4, BuiltInLootTables.SIMPLE_DUNGEON);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- this.safeSetBlock(worldGenLevel, blockPos, Blocks.SPAWNER.defaultBlockState(), predicate);
|
||||
- BlockEntity blockEntity = worldGenLevel.getBlockEntity(blockPos);
|
||||
- if (blockEntity instanceof SpawnerBlockEntity) {
|
||||
- SpawnerBlockEntity spawnerBlockEntity = (SpawnerBlockEntity)blockEntity;
|
||||
- spawnerBlockEntity.setEntityId(this.randomEntityId(randomSource), randomSource);
|
||||
- } else {
|
||||
- LOGGER.error("Failed to fetch mob spawner entity at ({}, {}, {})", blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- } else {
|
||||
- return false;
|
||||
- }
|
||||
- }
|
||||
+ public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> context) {return false;}
|
||||
|
||||
private EntityType<?> randomEntityId(RandomSource random) {
|
||||
return Util.getRandom(MOBS, random);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java
|
||||
index f5aea54f81dcd3072e36ddf3c4c6ded848c2c540..1539a644d89b2fee67a5534870ca177b4992409d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SculkPatchFeature.java
|
||||
@@ -19,48 +19,7 @@ public class SculkPatchFeature extends Feature<SculkPatchConfiguration> {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public boolean place(FeaturePlaceContext<SculkPatchConfiguration> context) {
|
||||
- WorldGenLevel worldGenLevel = context.level();
|
||||
- BlockPos blockPos = context.origin();
|
||||
- if (!this.canSpreadFrom(worldGenLevel, blockPos)) {
|
||||
- return false;
|
||||
- } else {
|
||||
- SculkPatchConfiguration sculkPatchConfiguration = context.config();
|
||||
- RandomSource randomSource = context.random();
|
||||
- SculkSpreader sculkSpreader = SculkSpreader.createWorldGenSpreader();
|
||||
- int i = sculkPatchConfiguration.spreadRounds() + sculkPatchConfiguration.growthRounds();
|
||||
-
|
||||
- for(int j = 0; j < i; ++j) {
|
||||
- for(int k = 0; k < sculkPatchConfiguration.chargeCount(); ++k) {
|
||||
- sculkSpreader.addCursors(blockPos, sculkPatchConfiguration.amountPerCharge());
|
||||
- }
|
||||
-
|
||||
- boolean bl = j < sculkPatchConfiguration.spreadRounds();
|
||||
-
|
||||
- for(int l = 0; l < sculkPatchConfiguration.spreadAttempts(); ++l) {
|
||||
- sculkSpreader.updateCursors(worldGenLevel, blockPos, randomSource, bl);
|
||||
- }
|
||||
-
|
||||
- sculkSpreader.clear();
|
||||
- }
|
||||
-
|
||||
- BlockPos blockPos2 = blockPos.below();
|
||||
- if (randomSource.nextFloat() <= sculkPatchConfiguration.catalystChance() && worldGenLevel.getBlockState(blockPos2).isCollisionShapeFullBlock(worldGenLevel, blockPos2)) {
|
||||
- worldGenLevel.setBlock(blockPos, Blocks.SCULK_CATALYST.defaultBlockState(), 3);
|
||||
- }
|
||||
-
|
||||
- int m = sculkPatchConfiguration.extraRareGrowths().sample(randomSource);
|
||||
-
|
||||
- for(int n = 0; n < m; ++n) {
|
||||
- BlockPos blockPos3 = blockPos.offset(randomSource.nextInt(5) - 2, 0, randomSource.nextInt(5) - 2);
|
||||
- if (worldGenLevel.getBlockState(blockPos3).isAir() && worldGenLevel.getBlockState(blockPos3.below()).isFaceSturdy(worldGenLevel, blockPos3.below(), Direction.UP)) {
|
||||
- worldGenLevel.setBlock(blockPos3, Blocks.SCULK_SHRIEKER.defaultBlockState().setValue(SculkShriekerBlock.CAN_SUMMON, Boolean.valueOf(true)), 3);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
+ public boolean place(FeaturePlaceContext<SculkPatchConfiguration> context) { return false; }
|
||||
|
||||
private boolean canSpreadFrom(LevelAccessor world, BlockPos pos) {
|
||||
BlockState blockState = world.getBlockState(pos);
|
||||
27
patches/server/0032-Biome-freeze-override.patch
Normal file
27
patches/server/0032-Biome-freeze-override.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 29 Aug 2023 09:23:11 -0500
|
||||
Subject: [PATCH] Biome freeze override
|
||||
|
||||
|
||||
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 4f9187d9d640618c40a2fa528f36b845017b4777..86372a10ab41bf0f5b7b88dc4d71c6802cd93b7d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java
|
||||
@@ -76,6 +76,7 @@ public final class Biome {
|
||||
return long2FloatLinkedOpenHashMap;
|
||||
});
|
||||
});
|
||||
+ public Boolean canFreeze = null; // Slice
|
||||
|
||||
Biome(Biome.ClimateSettings weather, BiomeSpecialEffects effects, BiomeGenerationSettings generationSettings, MobSpawnSettings spawnSettings) {
|
||||
this.climateSettings = weather;
|
||||
@@ -138,6 +139,8 @@ public final class Biome {
|
||||
}
|
||||
|
||||
public boolean shouldFreeze(LevelReader world, BlockPos pos, boolean doWaterCheck) {
|
||||
+ if (canFreeze != null) return canFreeze; // Slice
|
||||
+
|
||||
if (this.warmEnoughToRain(pos)) {
|
||||
return false;
|
||||
} else {
|
||||
19
patches/server/0033-Change-KeepAlive-interval.patch
Normal file
19
patches/server/0033-Change-KeepAlive-interval.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 3 Oct 2023 09:18:59 -0500
|
||||
Subject: [PATCH] Change KeepAlive interval
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 0306771b8f90dcdd77f151c19c6c2d75c41f8feb..4563117ce775d6c73a604f512ab595b87a10ddb3 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -215,7 +215,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
}
|
||||
} else {
|
||||
- if (elapsedTime >= 15000L) { // 15 seconds
|
||||
+ if (elapsedTime >= 5000L) { // 15 seconds // Slice -> 5s
|
||||
this.keepAlivePending = true;
|
||||
this.keepAliveTime = currentTime;
|
||||
this.keepAliveChallenge = currentTime;
|
||||
61
patches/server/0034-Non-saveable-entities.patch
Normal file
61
patches/server/0034-Non-saveable-entities.patch
Normal file
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 21 Oct 2023 11:27:52 -0500
|
||||
Subject: [PATCH] Non-saveable entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index c78cbec447032de9fe69748591bef6be300160ed..bb3f14d00a8894fc4dfa12b29c27ef56cc44848d 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -119,7 +119,7 @@ public final class ChunkEntitySlices {
|
||||
// removed by us below
|
||||
continue;
|
||||
}
|
||||
- if (entity.shouldBeSaved()) {
|
||||
+ if (entity.shouldBeSaved() || !entity.saveable) { // Slice
|
||||
entity.setRemoved(Entity.RemovalReason.UNLOADED_TO_CHUNK, EntityRemoveEvent.Cause.UNLOAD);
|
||||
if (entity.isVehicle()) {
|
||||
// we cannot assume that these entities are contained within this chunk, because entities can
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a23c584ce1f9abcc911aa6a39715b8eeca4ff0af..e25ca5a3f2b7c4573fefba976bc0e79d7a491b62 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -424,6 +424,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
private UUID originWorld;
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
+ public boolean saveable = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -4844,7 +4845,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
|
||||
@Override
|
||||
public boolean shouldBeSaved() {
|
||||
- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers
|
||||
+ return this.saveable && this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers // Slice - add saveable check
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index e8e4489bcd64fde1b3226bdc7a7cc612508bda3f..56044646165af2abefc6ab1b73feda4a8778de87 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1270,4 +1270,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return this.getHandle().getScoreboardName();
|
||||
}
|
||||
// Paper end - entity scoreboard name
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public boolean isSaveable() {
|
||||
+ return this.entity.saveable;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSaveable(boolean saveable) {
|
||||
+ this.entity.saveable = saveable;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
24
patches/server/0035-ChunkStatusChangeEvent.patch
Normal file
24
patches/server/0035-ChunkStatusChangeEvent.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 22 Oct 2023 08:41:08 -0500
|
||||
Subject: [PATCH] ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
index b66a7d4aab887309579154815a0d4abf9de506b0..050a667d79df28570f95fe616696d0915257cc89 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/scheduling/NewChunkHolder.java
|
||||
@@ -1324,6 +1324,13 @@ public final class NewChunkHolder {
|
||||
// chunks cannot downgrade state while status is pending a change
|
||||
final LevelChunk chunk = (LevelChunk)this.currentChunk;
|
||||
|
||||
+ // Slice start
|
||||
+ new com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent(new org.bukkit.craftbukkit.CraftChunk(chunk),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(currState.name()),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(nextState.name()))
|
||||
+ .callEvent();
|
||||
+ // Slice end
|
||||
+
|
||||
// Note: we assume that only load/unload contain plugin logic
|
||||
// plugin logic is anything stupid enough to possibly change the chunk status while it is already
|
||||
// being changed (i.e during load it is possible it will try to set to full ticking)
|
||||
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 25 Oct 2023 17:05:29 -0500
|
||||
Subject: [PATCH] Disable sending Entity Movement Packets
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 4f4ea6dcef4e1960ac69271fbd771dd3ad6af275..81371980e0eaa362ea1fff9813f632db93021bda 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -151,7 +151,7 @@ public class ServerEntity {
|
||||
boolean flag = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
|
||||
|
||||
if (flag) {
|
||||
- this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround()));
|
||||
+ if (entity.sendMovementPackets) this.broadcast.accept(new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround())); // Slice
|
||||
this.yRotp = i;
|
||||
this.xRotp = j;
|
||||
}
|
||||
@@ -186,14 +186,14 @@ public class ServerEntity {
|
||||
if (!flag6 && this.teleportDelay <= 400 && !this.wasRiding && this.wasOnGround == this.entity.onGround()&& !(io.papermc.paper.configuration.GlobalConfiguration.get().collisions.sendFullPosForHardCollidingEntities && this.entity.hardCollides())) { // Paper - send full pos for hard colliding entities to prevent collision problems due to desync
|
||||
if ((!flag2 || !flag3) && !(this.entity instanceof AbstractArrow)) {
|
||||
if (flag2) {
|
||||
- packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround());
|
||||
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.Pos(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), this.entity.onGround()); // Slice
|
||||
flag4 = true;
|
||||
} else if (flag3) {
|
||||
- packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround());
|
||||
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.Rot(this.entity.getId(), (byte) i, (byte) j, this.entity.onGround()); // Slice
|
||||
flag5 = true;
|
||||
}
|
||||
} else {
|
||||
- packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.onGround());
|
||||
+ if (entity.sendMovementPackets) packet1 = new ClientboundMoveEntityPacket.PosRot(this.entity.getId(), (short) ((int) k), (short) ((int) l), (short) ((int) i1), (byte) i, (byte) j, this.entity.onGround()); // Slice
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 1d35db213e7ac7518c587cc0dd0c80c3f99a0c41..297e2b8438dde1c1903505e8e7bbc94c3340d2d1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -425,6 +425,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
public boolean saveable = true; // Slice
|
||||
+ public boolean sendMovementPackets = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
66
patches/server/0037-Player-spawnsOwnMobs.patch
Normal file
66
patches/server/0037-Player-spawnsOwnMobs.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 7 Dec 2023 08:48:41 -0600
|
||||
Subject: [PATCH] Player spawnsOwnMobs
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index 366c0c9b45a819f7f94ebe3e49b8ab7f9edf9ce7..55281d6dc09ebdd262e05973e4d9c1e82681e05d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -549,7 +549,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
// Paper start - optimise chunk tick iteration
|
||||
ChunkMap playerChunkMap = this.chunkMap;
|
||||
for (ServerPlayer player : this.level.players) {
|
||||
- if (!player.affectsSpawning || player.isSpectator()) {
|
||||
+ if (!player.affectsSpawning || player.isSpectator() || player.spawnsOwnMobs) {
|
||||
playerChunkMap.playerMobSpawnMap.remove(player);
|
||||
player.playerNaturallySpawnedEvent = null;
|
||||
player.lastEntitySpawnRadiusSquared = -1.0;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
index 4e2c23ccdf4e4a4d65b291dbe20952bae1838bff..b7c6ec93244da6ebba116ab5d17179f291314b29 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/EatBlockGoal.java
|
||||
@@ -2,7 +2,12 @@ package net.minecraft.world.entity.ai.goal;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.function.Predicate;
|
||||
+
|
||||
+import com.destroystokyo.paper.util.maplist.ReferenceList;
|
||||
+import io.papermc.paper.util.player.NearbyPlayers;
|
||||
import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -31,11 +36,12 @@ public class EatBlockGoal extends Goal {
|
||||
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
- // Paper start - Fix MC-210802
|
||||
- if (!((net.minecraft.server.level.ServerLevel) this.level).chunkSource.chunkMap.anyPlayerCloseEnoughForSpawning(this.mob.chunkPosition())) {
|
||||
+ // Paper start - Fix MC-210802 // Slice start - adjust due to our spawnsOwnMobs logic
|
||||
+ NearbyPlayers nearbyPlayers = ((ServerLevel) this.level).chunkSource.chunkMap.getNearbyPlayers();
|
||||
+ ReferenceList<ServerPlayer> generalNearbyPlayers = nearbyPlayers.getPlayers(this.mob.chunkPosition(), NearbyPlayers.NearbyMapType.GENERAL);
|
||||
+ if (generalNearbyPlayers == null || generalNearbyPlayers.size() == 0) {
|
||||
return false;
|
||||
- }
|
||||
- // Paper end
|
||||
+ } // Slice end
|
||||
if (this.mob.getRandom().nextInt(this.mob.isBaby() ? 50 : 1000) != 0) {
|
||||
return false;
|
||||
} else {
|
||||
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 7e2fa586ae255cb94e302c14d0811e36e860f188..55791ab44fd7c11ceedb4bdcc2c9c45cbe916a98 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -184,6 +184,8 @@ public abstract class Player extends LivingEntity {
|
||||
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
|
||||
+ public boolean spawnsOwnMobs = false; // Slice
|
||||
+
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
public int oldLevel = -1;
|
||||
42
patches/server/0038-Set-location-on-a-Custom-Inventory.patch
Normal file
42
patches/server/0038-Set-location-on-a-Custom-Inventory.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 8 Dec 2023 08:02:07 -0600
|
||||
Subject: [PATCH] Set location on a Custom Inventory
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
index da1c1fe0faf6819b15a81d6ad53370948e5f984f..84eff85e98484c9701e203bb1fa61435ee88bab4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||
@@ -69,6 +69,14 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
+ // Slice start
|
||||
+ public void setLocation(Location location) {
|
||||
+ if (this.inventory instanceof MinecraftInventory minecraftInventory) {
|
||||
+ minecraftInventory.location = location;
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
static class MinecraftInventory implements Container {
|
||||
private final NonNullList<ItemStack> items;
|
||||
private int maxStack = MAX_STACK;
|
||||
@@ -77,6 +85,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
private final net.kyori.adventure.text.Component adventure$title; // Paper
|
||||
private InventoryType type;
|
||||
private final InventoryHolder owner;
|
||||
+ private Location location; // Slice
|
||||
|
||||
// Paper start
|
||||
public MinecraftInventory(InventoryHolder owner, InventoryType type, net.kyori.adventure.text.Component title) {
|
||||
@@ -239,7 +248,7 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||
|
||||
@Override
|
||||
public Location getLocation() {
|
||||
- return null;
|
||||
+ return location;
|
||||
}
|
||||
|
||||
// Paper start
|
||||
122
patches/server/0039-Shared-Data-Storage.patch
Normal file
122
patches/server/0039-Shared-Data-Storage.patch
Normal file
@@ -0,0 +1,122 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 3 Jan 2024 11:03:33 -0600
|
||||
Subject: [PATCH] Shared Data Storage
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
index 0cc2307636279915c1f8529e62174cc696e185ee..220e5ede5752a4b9ab7e35c3ee4f0b4a26b2986c 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -336,6 +336,7 @@ public class GlobalConfiguration extends ConfigurationPart {
|
||||
public boolean useDimensionTypeForCustomSpawners = false;
|
||||
public boolean strictAdvancementDimensionCheck = false;
|
||||
public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT;
|
||||
+ public String sharedDataFolder = ""; // Slice
|
||||
}
|
||||
|
||||
public BlockUpdates blockUpdates;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 9ce9af857a5f2414658027ff5bb765cc4233899b..b8a43a2833b9f014067681277edad3b96a6d63cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2,6 +2,7 @@ package net.minecraft.server;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Splitter;
|
||||
+import com.google.common.base.Strings;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import co.aikar.timings.Timings;
|
||||
import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
|
||||
@@ -313,6 +314,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
|
||||
+ @Nullable DimensionDataStorage sharedDataStorage; // Slice
|
||||
+
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
@@ -414,6 +417,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ public DimensionDataStorage getMapDataStorage() {
|
||||
+ return sharedDataStorage != null ? sharedDataStorage : overworld().getDataStorage();
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
private void readScoreboard(DimensionDataStorage persistentStateManager) {
|
||||
persistentStateManager.computeIfAbsent(this.getScoreboard().dataFactory(), "scoreboard");
|
||||
}
|
||||
@@ -917,6 +926,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.isSaving = true;
|
||||
this.getPlayerList().saveAll(); // Paper - Incremental chunk and player saving; diff on change
|
||||
flag3 = this.saveAllChunks(suppressLogs, flush, force);
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save(true); // Slice
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
@@ -1132,6 +1142,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
throw new IllegalStateException("Failed to initialize server");
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ String sharedDataFolder = io.papermc.paper.configuration.GlobalConfiguration.get().misc.sharedDataFolder;
|
||||
+ if (!Strings.isNullOrEmpty(sharedDataFolder)) {
|
||||
+ File sharedDir = new File(sharedDataFolder);
|
||||
+ sharedDir.mkdirs();
|
||||
+ this.sharedDataStorage = new DimensionDataStorage(sharedDir, fixerUpper);
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
this.nextTickTimeNanos = Util.getNanos();
|
||||
this.statusIcon = (ServerStatus.Favicon) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
|
||||
this.status = this.buildServerStatus();
|
||||
@@ -1546,6 +1565,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
level.saveIncrementally(fullSave);
|
||||
}
|
||||
}
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save(true); // Slice
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4653878c059a15491eb54d7211311db7e2fe570a..d60d1fe0261c79d77df982b76bfe96b91f6970de 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2127,7 +2127,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@Override
|
||||
public MapItemSavedData getMapData(String id) {
|
||||
// Paper start - Call missing map initialize event and set id
|
||||
- final DimensionDataStorage storage = this.getServer().overworld().getDataStorage();
|
||||
+ final DimensionDataStorage storage = this.getServer().getMapDataStorage(); // Slice
|
||||
|
||||
final net.minecraft.world.level.saveddata.SavedData existing = storage.cache.get(id);
|
||||
if (existing == null && !storage.cache.containsKey(id)) {
|
||||
@@ -2154,12 +2154,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
MapInitializeEvent event = new MapInitializeEvent(state.mapView);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
// CraftBukkit end
|
||||
- this.getServer().overworld().getDataStorage().set(id, state);
|
||||
+ this.getServer().getMapDataStorage().set(id, state); // Slice
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFreeMapId() {
|
||||
- return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap();
|
||||
+ // Slice start
|
||||
+ DimensionDataStorage storage = this.getServer().getMapDataStorage();
|
||||
+ MapIndex mapIndex = storage.readSavedData(MapIndex::load, MapItemSavedData.factory().type(), "idcounts");
|
||||
+ if (mapIndex == null) {
|
||||
+ mapIndex = new MapIndex();
|
||||
+ }
|
||||
+ int newId = mapIndex.getFreeAuxValueForMap();
|
||||
+ storage.set("idcounts", mapIndex);
|
||||
+ storage.save(true);
|
||||
+ return newId;
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// Paper start - Configurable Keep Spawn Loaded range per world
|
||||
48
patches/server/0040-Vanish.patch
Normal file
48
patches/server/0040-Vanish.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 7 Jan 2024 08:26:59 -0600
|
||||
Subject: [PATCH] Vanish
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 3a520677dce5cba5a348ec295ea07cd090e541f9..e858d24061ce8fad612c12adac205c7ad59b8767 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -426,6 +426,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
public boolean saveable = true; // Slice
|
||||
public boolean sendMovementPackets = true; // Slice
|
||||
+ public boolean vanished; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -1325,7 +1326,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
}
|
||||
|
||||
private boolean vibrationAndSoundEffectsFromBlock(BlockPos pos, BlockState state, boolean playSound, boolean emitEvent, Vec3 movement) {
|
||||
- if (state.isAir()) {
|
||||
+ if (vanished || state.isAir()) { // Slice
|
||||
return false;
|
||||
} else {
|
||||
boolean flag2 = this.isStateClimbable(state);
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 56044646165af2abefc6ab1b73feda4a8778de87..8af60900f5e385546bb452cd0bc0c702d5df0a46 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1282,4 +1282,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.entity.saveable = saveable;
|
||||
}
|
||||
// Slice end
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public boolean isVanished() {
|
||||
+ return this.entity.vanished;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setVanished(boolean vanished) {
|
||||
+ this.entity.vanished = vanished;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
95
patches/server/0041-PlayerResolveObjectIdEvent.patch
Normal file
95
patches/server/0041-PlayerResolveObjectIdEvent.patch
Normal file
@@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 24 Jan 2024 11:39:13 -0600
|
||||
Subject: [PATCH] PlayerResolveObjectIdEvent
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 85c077a53422e1c2dc1ff550ac117016c3d8e3f0..46980b062980be8c564a215a2ae67e0d1fe5251e 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -26,6 +26,8 @@ dependencies {
|
||||
implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.0")
|
||||
// Slice end
|
||||
|
||||
+ implementation("org.mongodb:bson:4.11.1") // Slice - MongoDB Bson Library for ObjectIds
|
||||
+
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e858d24061ce8fad612c12adac205c7ad59b8767..ad2567133405744abcf20d8572d6c7afc37581af 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -252,7 +252,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
// Paper start - Folia schedulers
|
||||
synchronized (this) {
|
||||
if (this.bukkitEntity == null) {
|
||||
- return this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this);
|
||||
+ this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this);
|
||||
+
|
||||
+ // Slice start - resolve ObjectId
|
||||
+ if (this.bukkitEntity instanceof org.bukkit.craftbukkit.entity.CraftHumanEntity craftHumanEntity) {
|
||||
+ io.papermc.paper.event.player.PlayerResolveObjectIdEvent event = new io.papermc.paper.event.player.PlayerResolveObjectIdEvent((org.bukkit.entity.Player) bukkitEntity);
|
||||
+ event.callEvent();
|
||||
+ craftHumanEntity.setObjectId(event.getObjectId());
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
+ return this.bukkitEntity;
|
||||
}
|
||||
}
|
||||
// Paper end - Folia schedulers
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index 7984365c8290ac9e526a413b56e1c8c0841e330c..933fc8295b3b697c9f8cd8516ccac13348dcb843 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -7,6 +7,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
+
|
||||
+import io.papermc.paper.event.player.PlayerResolveObjectIdEvent;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -31,10 +33,8 @@ import net.minecraft.world.level.block.CraftingTableBlock;
|
||||
import net.minecraft.world.level.block.EnchantmentTableBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
-import org.bukkit.GameMode;
|
||||
-import org.bukkit.Location;
|
||||
-import org.bukkit.Material;
|
||||
-import org.bukkit.NamespacedKey;
|
||||
+import org.bson.types.ObjectId;
|
||||
+import org.bukkit.*;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.entity.memory.CraftMemoryMapper;
|
||||
@@ -75,6 +75,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
protected final PermissibleBase perm = new PermissibleBase(this);
|
||||
private boolean op;
|
||||
private GameMode mode;
|
||||
+ private org.bson.types.ObjectId objectId;
|
||||
|
||||
public CraftHumanEntity(final CraftServer server, final Player entity) {
|
||||
super(server, entity);
|
||||
@@ -83,6 +84,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
this.enderChest = new CraftInventory(entity.getEnderChestInventory());
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public ObjectId getObjectId() {
|
||||
+ return objectId;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setObjectId(ObjectId objectId) {
|
||||
+ this.objectId = objectId;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public PlayerInventory getInventory() {
|
||||
return this.inventory;
|
||||
@@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 29 Feb 2024 08:34:20 -0600
|
||||
Subject: [PATCH] Make AdvancementProgress Map ctor public
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/advancements/AdvancementProgress.java b/src/main/java/net/minecraft/advancements/AdvancementProgress.java
|
||||
index 2adba57cb01fc95d414570ef86777228247fae53..9c040d0ecc7a53761856ecf1e9dd35b2b06fd5f1 100644
|
||||
--- a/src/main/java/net/minecraft/advancements/AdvancementProgress.java
|
||||
+++ b/src/main/java/net/minecraft/advancements/AdvancementProgress.java
|
||||
@@ -46,9 +46,9 @@ public class AdvancementProgress implements Comparable<AdvancementProgress> {
|
||||
private final Map<String, CriterionProgress> criteria;
|
||||
private AdvancementRequirements requirements = AdvancementRequirements.EMPTY;
|
||||
|
||||
- private AdvancementProgress(Map<String, CriterionProgress> criteriaProgresses) {
|
||||
+ public AdvancementProgress(Map<String, CriterionProgress> criteriaProgresses) {
|
||||
this.criteria = criteriaProgresses;
|
||||
- }
|
||||
+ } // Slice
|
||||
|
||||
public AdvancementProgress() {
|
||||
this.criteria = Maps.newHashMap();
|
||||
19
patches/server/0043-Improve-map-saving-performance.patch
Normal file
19
patches/server/0043-Improve-map-saving-performance.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 15 Mar 2024 08:51:06 -0500
|
||||
Subject: [PATCH] Improve map-saving performance
|
||||
|
||||
|
||||
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 45269115e63cfc3bd7dc740a5694e2cc7c35bcb1..c09e6d89b1595ce26c3489ca9e84a7c2bdf80286 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
|
||||
@@ -331,7 +331,7 @@ public class MapItemSavedData extends SavedData {
|
||||
--this.trackedDecorationCount;
|
||||
}
|
||||
|
||||
- this.setDecorationsDirty();
|
||||
+ if (mapicon != null) this.setDecorationsDirty(); // Paper - We should not be dirtying this over unless there was mutation.
|
||||
}
|
||||
|
||||
public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, MapDecoration.Type type) {
|
||||
28
patches/server/0044-Set-LevelChunkSections.patch
Normal file
28
patches/server/0044-Set-LevelChunkSections.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 2 May 2024 08:51:50 -0500
|
||||
Subject: [PATCH] Set LevelChunkSections
|
||||
|
||||
|
||||
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 f7e5e016a7028a9196e689e950805b0d5b31fe38..9ca07bf5bf68749970258d611013bec425a3c48c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
|
||||
@@ -80,7 +80,7 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
protected final Map<BlockPos, CompoundTag> pendingBlockEntities = Maps.newHashMap();
|
||||
public final Map<BlockPos, BlockEntity> blockEntities = Maps.newHashMap();
|
||||
protected final LevelHeightAccessor levelHeightAccessor;
|
||||
- protected final LevelChunkSection[] sections;
|
||||
+ protected LevelChunkSection[] sections; // Slice - Remove final
|
||||
|
||||
// CraftBukkit start - SPIGOT-6814: move to IChunkAccess to account for 1.17 to 1.18 chunk upgrading.
|
||||
private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
|
||||
@@ -217,6 +217,8 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
|
||||
return this.getSections()[yIndex];
|
||||
}
|
||||
|
||||
+ public void setSections(LevelChunkSection[] sections) { this.sections = sections; } // Slice
|
||||
+
|
||||
public Collection<Entry<Heightmap.Types, Heightmap>> getHeightmaps() {
|
||||
return Collections.unmodifiableSet(this.heightmaps.entrySet());
|
||||
}
|
||||
30
patches/server/0045-Freeze-Chunk-Loading.patch
Normal file
30
patches/server/0045-Freeze-Chunk-Loading.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 3 May 2024 08:27:49 -0500
|
||||
Subject: [PATCH] Freeze Chunk Loading
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index d60d1fe0261c79d77df982b76bfe96b91f6970de..d48f4a8db6fffd84f9a68c7da2c06c0730678b71 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -224,6 +224,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
|
||||
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
||||
public boolean instance; // Slice
|
||||
+ public boolean freezeChunkLoading = true; // Slice
|
||||
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
||||
|
||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index fd8c6a3aaba37bb7439e74b9fc765dd7332041d9..e2947f1dbf2ccb8aeade513b79232506ab7c3706 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -561,6 +561,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public boolean loadChunk(int x, int z, boolean generate) {
|
||||
+ if (world.freezeChunkLoading) return false; // Slice
|
||||
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot
|
||||
warnUnsafeChunk("loading a faraway chunk", x, z); // Paper
|
||||
// Paper start - Optimize this method
|
||||
@@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 21 May 2024 08:11:40 -0500
|
||||
Subject: [PATCH] Expose getBlockPosBelowThatAffectsMyMovement Fix patch
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index ad2567133405744abcf20d8572d6c7afc37581af..afde18e38484f7f3d6041cef54168d5ae7a1d901 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1401,7 +1401,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||
return this.getOnPos(0.2F);
|
||||
}
|
||||
|
||||
- protected BlockPos getBlockPosBelowThatAffectsMyMovement() {
|
||||
+ public BlockPos getBlockPosBelowThatAffectsMyMovement() {
|
||||
return this.getOnPos(0.500001F);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
index 36422fb394a158f36c84ba0ee03cc704956c91b2..78dbed58541c33749a2fbd12b6f521e31d7eb907 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
||||
@@ -192,7 +192,7 @@ public class ExperienceOrb extends Entity {
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected BlockPos getBlockPosBelowThatAffectsMyMovement() {
|
||||
+ public BlockPos getBlockPosBelowThatAffectsMyMovement() {
|
||||
return this.getOnPos(0.999999F);
|
||||
}
|
||||
|
||||
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 29ce703a79f7893ac990ad80e0f1c1cf63546e6c..0033125e504df35e907cab8acd7d0d7f7ff982a4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -257,7 +257,7 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
// Spigot end
|
||||
|
||||
@Override
|
||||
- protected BlockPos getBlockPosBelowThatAffectsMyMovement() {
|
||||
+ public BlockPos getBlockPosBelowThatAffectsMyMovement() {
|
||||
return this.getOnPos(0.999999F);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 8af60900f5e385546bb452cd0bc0c702d5df0a46..25e721d069f350b93559a0bb8841415d51bc09b7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -25,6 +25,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
+import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.PistonMoveReaction;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
@@ -1294,4 +1295,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.entity.vanished = vanished;
|
||||
}
|
||||
// Slice end
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public Block getBlockStandingOn() {
|
||||
+ net.minecraft.core.BlockPos pos = this.entity.getBlockPosBelowThatAffectsMyMovement();
|
||||
+ return this.entity.level().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
81
patches/server/0047-Affinity-Locks.patch
Normal file
81
patches/server/0047-Affinity-Locks.patch
Normal file
@@ -0,0 +1,81 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 5 Aug 2024 15:07:31 -0500
|
||||
Subject: [PATCH] Affinity Locks
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 46980b062980be8c564a215a2ae67e0d1fe5251e..2b1fd2cd7046f283510cd6e801abd8f49b0e8870 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -24,6 +24,9 @@ dependencies {
|
||||
implementation("com.fasterxml.jackson.core:jackson-core:2.13.0")
|
||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.13.0")
|
||||
implementation("com.fasterxml.jackson.core:jackson-annotations:2.13.0")
|
||||
+
|
||||
+ // https://mvnrepository.com/artifact/net.openhft/Java-Thread-Affinity
|
||||
+ implementation("net.openhft:affinity:3.26ea5")
|
||||
// Slice end
|
||||
|
||||
implementation("org.mongodb:bson:4.11.1") // Slice - MongoDB Bson Library for ObjectIds
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index bc391d27399d8c22e78735ca39aa8ab45efb6413..fc1002b11f38ab31ff4148dbb8398f41389a3980 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -342,7 +342,7 @@ public class Main {
|
||||
}
|
||||
|
||||
return dedicatedserver1;
|
||||
- });
|
||||
+ }, dedicatedserversettings.getProperties().pinnedCPU);
|
||||
/* CraftBukkit start
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index b8a43a2833b9f014067681277edad3b96a6d63cd..5c874b36dc8fd2c31192888bead8bc685d391ea0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -316,10 +316,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@Nullable DimensionDataStorage sharedDataStorage; // Slice
|
||||
|
||||
- public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
+ public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory, int pinnedCPU) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
- ((MinecraftServer) atomicreference.get()).runServer();
|
||||
+ ((MinecraftServer) atomicreference.get()).runServer(pinnedCPU);
|
||||
}, "Server thread");
|
||||
|
||||
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
||||
@@ -1135,8 +1135,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
public static volatile RuntimeException chunkSystemCrash; // Paper - rewrite chunk system
|
||||
|
||||
- protected void runServer() {
|
||||
- try {
|
||||
+ protected void runServer(int pinnedCPU) {
|
||||
+ try (net.openhft.affinity.AffinityLock al = net.openhft.affinity.AffinityLock.acquireLock(pinnedCPU)) {
|
||||
long serverStartTime = Util.getNanos(); // Paper
|
||||
if (!this.initServer()) {
|
||||
throw new IllegalStateException("Failed to initialize server");
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
index bab2471616404821671264ccefd729cab8d0bf58..ae69751c8ae5a288337b750f400e4af24506838d 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -107,6 +107,7 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||
public final boolean logIPs;
|
||||
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
|
||||
public final WorldOptions worldOptions;
|
||||
+ public final int pinnedCPU;
|
||||
|
||||
public final String rconIp; // Paper - Configurable rcon ip
|
||||
|
||||
@@ -172,6 +173,7 @@ 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
|
||||
+ this.pinnedCPU = this.get("pinned-cpu", -1);
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@@ -1,10 +1,10 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "Slice"
|
||||
rootProject.name = "slice"
|
||||
|
||||
include("Slice-API", "Slice-Server")
|
||||
include("slice-api", "slice-server")
|
||||
|
||||
Reference in New Issue
Block a user