Compare commits
80 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3c907b800 | ||
|
|
385449edaf | ||
|
|
c948431efc | ||
|
|
e33bdce8f0 | ||
|
|
bc724627a2 | ||
|
|
6b75d74aa1 | ||
|
|
0ad79c9e7e | ||
|
|
039dc701e2 | ||
|
|
e421cf78bb | ||
|
|
e966e72d22 | ||
|
|
7552296532 | ||
|
|
813f82c0f2 | ||
|
|
4a0b8016db | ||
|
|
1136255465 | ||
|
|
be464d39ee | ||
|
|
edd4afb8af | ||
|
|
33b007c39f | ||
|
|
70a25ecb12 | ||
|
|
f5931d678d | ||
|
|
6254668721 | ||
|
|
3962fb1ade | ||
|
|
4ebbb37af9 | ||
|
|
d37d9e5d24 | ||
|
|
f29020b967 | ||
|
|
c9c0c20bee | ||
|
|
0aa6cbb696 | ||
|
|
4c84898b11 | ||
|
|
295b6a8d4c | ||
|
|
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 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -4,6 +4,7 @@
|
||||
run
|
||||
slice-api
|
||||
slice-server
|
||||
paper-api-generator
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
@@ -18,3 +19,6 @@ gradle-app.setting
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
/commit.sh
|
||||
/publish.sh
|
||||
/slice-api/
|
||||
/slice-server/
|
||||
/generated/
|
||||
|
||||
@@ -7,4 +7,8 @@
|
||||
# datafixerupper com/mojang/datafixers/util/Either.java
|
||||
# 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
|
||||
# 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
|
||||
#
|
||||
@@ -1,18 +0,0 @@
|
||||
# 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.
|
||||
#
|
||||
# If you are adding mappings patches which are correcting for issues in paperweight's reobf mappings generation,
|
||||
# unrelated to any changes in your patches, we ask that you PR the mapping to Paper so more users can benefit rather
|
||||
# than keep the fix for your own fork. If the mappings patch is there to correct reobf for changes made in your patches,
|
||||
# then obviously it doesn't make any sense to PR them upstream.
|
||||
|
||||
tiny 2 0 mojang+yarn spigot
|
||||
@@ -4,10 +4,10 @@ plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("io.papermc.paperweight.patcher") version "1.5.8"
|
||||
id("io.papermc.paperweight.patcher") version "1.7.4"
|
||||
}
|
||||
|
||||
val paperMavenPublicUrl = "https://papermc.io/repo/repository/maven-public/"
|
||||
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -17,9 +17,9 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.8.6:fat")
|
||||
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.3:fat") // Must be kept in sync with upstream
|
||||
decompiler("org.vineflower:vineflower:1.10.1") // Must be kept in sync with upstream
|
||||
paperclip("io.papermc:paperclip:3.0.3") // You probably want this to be kept in sync with upstream
|
||||
}
|
||||
|
||||
allprojects {
|
||||
@@ -28,7 +28,7 @@ allprojects {
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ allprojects {
|
||||
subprojects {
|
||||
tasks.withType<JavaCompile> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
options.release.set(17)
|
||||
options.release.set(21)
|
||||
}
|
||||
tasks.withType<Javadoc> {
|
||||
options.encoding = Charsets.UTF_8.name()
|
||||
@@ -65,6 +65,15 @@ paperweight {
|
||||
serverPatchDir.set(layout.projectDirectory.dir("patches/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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +83,6 @@ paperweight {
|
||||
|
||||
tasks.generateDevelopmentBundle {
|
||||
apiCoordinates.set("com.lokamc.slice:slice-api")
|
||||
mojangApiCoordinates.set("io.papermc.paper:paper-mojangapi")
|
||||
libraryRepositories.set(
|
||||
listOf(
|
||||
"https://repo.maven.apache.org/maven2/",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=com.lokamc.slice
|
||||
version=1.20.1-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.20.1
|
||||
paperRef=29d1c7b60244bb002d29a5dcfc9c995019f550ab
|
||||
version=1.21.3-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.3
|
||||
paperRef=da7138233f6392e791d790d1c3407414c855f9c2
|
||||
updatingMinecraft=false
|
||||
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
43
gradlew
vendored
43
gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# 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/.
|
||||
@@ -80,13 +80,11 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# 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"'
|
||||
# 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
|
||||
@@ -133,22 +131,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
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
|
||||
@@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# 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" \
|
||||
@@ -205,6 +214,12 @@ set -- \
|
||||
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.
|
||||
@@ -231,4 +246,4 @@ eval "set -- $(
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:30:30 -0500
|
||||
Date: Sat, 9 Nov 2024 09:48:21 -0600
|
||||
Subject: [PATCH] Add BlockDestroyedByNeighborEvent
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 12 Aug 2022 08:16:16 -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..d4bda54582228377c902e4743168e084e1bf8b2d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerShieldDisableEvent.java
|
||||
@@ -0,0 +1,60 @@
|
||||
+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 int cooldown;
|
||||
+ private boolean cancelled = false;
|
||||
+
|
||||
+ public PlayerShieldDisableEvent(@NotNull final Player player, @Nullable final Entity damager, int cooldown) {
|
||||
+ super(player);
|
||||
+ this.damager = damager;
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity getDamager() {
|
||||
+ return damager;
|
||||
+ }
|
||||
+
|
||||
+ public int getCooldown() {
|
||||
+ return cooldown;
|
||||
+ }
|
||||
+
|
||||
+ public void setCooldown(int cooldown) {
|
||||
+ this.cooldown = cooldown;
|
||||
+ }
|
||||
+
|
||||
+ @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,16 +1,16 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:31:55 -0500
|
||||
Date: Sat, 9 Nov 2024 09:54:36 -0600
|
||||
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 384e5700b6899850d91a34e1d13d1ca0678cfaaa..9c1aef68b1b6f4fddfa171f7189dda5619e758d6 100644
|
||||
index 0efd8bb70ebdb86372022c9e12ec89f229ab3b52..be4f8fc7e7d9b6fb3ef0f557c9f591431c902837 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -666,6 +666,20 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
@@ -677,6 +677,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,39 +0,0 @@
|
||||
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/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java
|
||||
index 390a2a2611df35a9ea6f1eb996b47e2aa4597ff0..384e5700b6899850d91a34e1d13d1ca0678cfaaa 100644
|
||||
--- a/src/main/java/org/bukkit/block/Block.java
|
||||
+++ b/src/main/java/org/bukkit/block/Block.java
|
||||
@@ -298,6 +298,28 @@ public interface Block extends Metadatable, Translatable, net.kyori.adventure.tr
|
||||
*/
|
||||
void setBlockData(@NotNull BlockData data, boolean applyPhysics);
|
||||
|
||||
+ /**
|
||||
+ * Sets the complete data for this block
|
||||
+ *
|
||||
+ * <br>
|
||||
+ * Note that applyPhysics = false is not in general safe. It should only be
|
||||
+ * used when you need to avoid triggering a physics update of neighboring
|
||||
+ * blocks, for example when creating a {@link Bisected} block. If you are
|
||||
+ * using a custom populator, then this parameter may also be required to
|
||||
+ * prevent triggering infinite chunk loads on border blocks. This method
|
||||
+ * should NOT be used to "hack" physics by placing blocks in impossible
|
||||
+ * locations. Such blocks are liable to be removed on various events such as
|
||||
+ * world upgrades. Furthermore setting large amounts of such blocks in close
|
||||
+ * proximity may overload the server physics engine if an update is
|
||||
+ * triggered at a later point. If this occurs, the resulting behavior is
|
||||
+ * undefined.
|
||||
+ *
|
||||
+ * @param data new block specific data
|
||||
+ * @param applyPhysics false to cancel physics from the changed block
|
||||
+ * @param checkLight false to prevent a light-check update
|
||||
+ */
|
||||
+ void setBlockData(@NotNull BlockData data, boolean applyPhysics, boolean checkLight);
|
||||
+
|
||||
/**
|
||||
* Sets the type of this block
|
||||
*
|
||||
@@ -1,6 +1,6 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:36:22 -0500
|
||||
Date: Sat, 9 Nov 2024 09:55:18 -0600
|
||||
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, 10 Apr 2023 07:37:06 -0500
|
||||
Date: Sat, 9 Nov 2024 09:56:09 -0600
|
||||
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 6917931966377c51db88a3364997a110dd987970..792b1b4ea3330b282961844d48b2dc56e0201c7e 100644
|
||||
index 7a439c99fc4c5ee17d674460c8e58a9fe0c64e02..411e2153538f63f1ce3b3a10bb2829d1737d0597 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -2573,6 +2573,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -2776,6 +2776,11 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
*/
|
||||
public void setAutoSave(boolean value);
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:55:36 -0500
|
||||
Date: Sun, 10 Nov 2024 09:34:07 -0600
|
||||
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 f9dd00210c1762a40259f823aeb8d8a5ddc78e3e..bb0c49ed971d71904b9172cac2e724133754f32c 100644
|
||||
index 95f0b3186e313c7fbd5c8531d52b82a69e525f94..f542265036bde4031c834e379a031d2821f32173 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3153,6 +3153,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -3721,6 +3721,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
String getClientBrandName();
|
||||
// Paper end
|
||||
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * 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
|
||||
@@ -20,9 +21,8 @@ index f9dd00210c1762a40259f823aeb8d8a5ddc78e3e..bb0c49ed971d71904b9172cac2e72413
|
||||
+ *
|
||||
+ * @param location New location to teleport this Player to
|
||||
+ */
|
||||
+ // Slice start
|
||||
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
||||
+ void teleportWithoutRespawn(Location location);
|
||||
+ void teleportWithoutRespawn(@NotNull Location location);
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start - Teleport API
|
||||
@@ -1,22 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 08:16:51 -0500
|
||||
Date: Wed, 13 Nov 2024 07:49:32 -0600
|
||||
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 d49999ea597ef247bbf2298e6bf5600bfe003c3e..4ed53b14f94154043e3043f4fef540b45b2b272d 100644
|
||||
index a6c5818bcdd8de5f2d0e9bf72d1e3816652e0199..196d790d766548a2e4afc31820658ba493a1fe83 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -26,6 +26,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
private final Entity attacked;
|
||||
private boolean cancelled;
|
||||
@@ -28,6 +28,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
private final boolean willAttack;
|
||||
|
||||
private boolean cancelled;
|
||||
+ private boolean forceCrit; // Slice
|
||||
|
||||
public PrePlayerAttackEntityEvent(@NotNull Player who, @NotNull Entity attacked, boolean willAttack) {
|
||||
super(who);
|
||||
@@ -55,6 +56,16 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
@ApiStatus.Internal
|
||||
public PrePlayerAttackEntityEvent(final Player player, final Entity attacked, final boolean willAttack) {
|
||||
@@ -59,6 +60,16 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
return this.willAttack;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ index d49999ea597ef247bbf2298e6bf5600bfe003c3e..4ed53b14f94154043e3043f4fef540b4
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
@@ -1,20 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 22 Aug 2023 06:22:17 -0500
|
||||
Date: Wed, 13 Nov 2024 08:04:09 -0600
|
||||
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 12c1c6fe9dc8dc5f5faf6dcf99f6857219ef22b8..42954466c13a926e735754949cc9d78fa1ad7b10 100644
|
||||
index 5f5afcdb3c9e669ed0e730c720ad91d16b95602c..9447c571a514155cebc47a3bd9f6d0d79bdc8c97 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerConnectionCloseEvent.java
|
||||
@@ -50,12 +50,18 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
@NotNull private final UUID playerUniqueId;
|
||||
@NotNull private final String playerName;
|
||||
@NotNull private final InetAddress ipAddress;
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
/**
|
||||
@@ -42,13 +43,19 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
private final UUID playerUniqueId;
|
||||
private final String playerName;
|
||||
private final InetAddress ipAddress;
|
||||
+ @NotNull private final ConnectionCloseReason reason;
|
||||
|
||||
public PlayerConnectionCloseEvent(@NotNull final UUID playerUniqueId, @NotNull final String playerName, @NotNull final InetAddress ipAddress, final boolean async) {
|
||||
@ApiStatus.Internal
|
||||
public PlayerConnectionCloseEvent(final UUID playerUniqueId, final String playerName, final InetAddress ipAddress, final boolean async) {
|
||||
+ this(playerUniqueId, playerName, ipAddress, ConnectionCloseReason.NORMAL, async);
|
||||
+ }
|
||||
+
|
||||
@@ -27,11 +36,12 @@ index 12c1c6fe9dc8dc5f5faf6dcf99f6857219ef22b8..42954466c13a926e735754949cc9d78f
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,4 +98,26 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
@@ -80,4 +87,27 @@ public class PlayerConnectionCloseEvent extends Event {
|
||||
public static HandlerList getHandlerList() {
|
||||
return HANDLERS;
|
||||
return HANDLER_LIST;
|
||||
}
|
||||
+
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the reason for the closed connection.
|
||||
+ */
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 22 Oct 2023 08:41:09 -0500
|
||||
Date: Wed, 13 Nov 2024 08:07:59 -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..512664d4a7a6821b8d79d0aabf5c31a61fcae6b9
|
||||
index 0000000000000000000000000000000000000000..9154bc8a072d8e5f3fd9790606508af048a612eb
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/chunk/ChunkStatusChangeEvent.java
|
||||
@@ -0,0 +1,58 @@
|
||||
@@ -0,0 +1,61 @@
|
||||
+package com.destroystokyo.paper.event.chunk;
|
||||
+
|
||||
+import org.bukkit.Chunk;
|
||||
@@ -27,21 +27,24 @@ index 0000000000000000000000000000000000000000..512664d4a7a6821b8d79d0aabf5c31a6
|
||||
+ private final ChunkStatus currentState;
|
||||
+ private final ChunkStatus newState;
|
||||
+
|
||||
+ public ChunkStatusChangeEvent(Chunk chunk, ChunkStatus currentState, 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;
|
||||
+ }
|
||||
@@ -1,28 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 25 Apr 2023 07:36:40 -0500
|
||||
Date: Wed, 13 Nov 2024 08:29:41 -0600
|
||||
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 19e58e62ae442ef9be02ca7fa2f55e370a54afa4..94aafbc3a08dec7c66cef89de7a5283049a4bf05 100644
|
||||
index 68c08e7a212bc3e3885f9b5a4d9aef85fcb3b029..5395ec5d6ec33495516e792bdbbc97a7cef3038d 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -1192,4 +1192,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
*/
|
||||
@@ -1458,6 +1458,14 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
void setBodyYaw(float bodyYaw);
|
||||
// Paper end
|
||||
// Paper end - body yaw API
|
||||
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
+ * @param p The player to send this entity's equipment packet to
|
||||
+ */
|
||||
+ void sendEquipment(Player p);
|
||||
+ void sendEquipment(@NotNull Player p);
|
||||
+ // Slice end
|
||||
}
|
||||
+
|
||||
// Paper start - Expose canUseSlot
|
||||
/**
|
||||
* Checks whether this entity can use the equipment slot.
|
||||
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..6c329ca3c22d1fd712041334c5c1e7bd7e7201ac
|
||||
index 0000000000000000000000000000000000000000..48d2eb3bbb8dbcb6714ee47c4159c0604657a78c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityEquipmentItemLookup.java
|
||||
@@ -0,0 +1,54 @@
|
||||
@@ -55,7 +58,7 @@ index 0000000000000000000000000000000000000000..6c329ca3c22d1fd712041334c5c1e7bd
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ public void setItemStack(ItemStack itemStack) {
|
||||
+ public void setItemStack(@NotNull ItemStack itemStack) {
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
@@ -82,10 +85,10 @@ index 0000000000000000000000000000000000000000..6c329ca3c22d1fd712041334c5c1e7bd
|
||||
+}
|
||||
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..513d62342d8e29e8d3c92fe932d0d77f659cf2f1
|
||||
index 0000000000000000000000000000000000000000..a8f83d19341c2f3024ba8113478ed482657b8589
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerReceiveEquipmentEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
@@ -0,0 +1,63 @@
|
||||
+package org.bukkit.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Entity;
|
||||
@@ -93,6 +96,7 @@ index 0000000000000000000000000000000000000000..513d62342d8e29e8d3c92fe932d0d77f
|
||||
+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
|
||||
@@ -118,11 +122,12 @@ index 0000000000000000000000000000000000000000..513d62342d8e29e8d3c92fe932d0d77f
|
||||
+ return tracked;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public String getTag() {
|
||||
+ return tag;
|
||||
+ }
|
||||
+
|
||||
+ public void setTag(String tag) {
|
||||
+ public void setTag(@Nullable String tag) {
|
||||
+ this.tag = tag;
|
||||
+ }
|
||||
+
|
||||
@@ -1,35 +0,0 @@
|
||||
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 8424fdac153f6dea76acce89f4726408d9726c41..6effaeaf885d70f8aeb11b5c44e7f3ab42cf2a90 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 {
|
||||
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(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;
|
||||
+ //Slice end
|
||||
+
|
||||
/**
|
||||
* Represents an option which may be applied to this team.
|
||||
*/
|
||||
30
patches/api/0010-Add-Vanish.patch
Normal file
30
patches/api/0010-Add-Vanish.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 16 Nov 2024 09:10:35 -0600
|
||||
Subject: [PATCH] Add Vanish
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index d0ae8a94db20281d3664d74718c65234eb2e5f83..6324e8f11a382288fc0a6c30f47760ea50e231d5 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1172,4 +1172,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
void broadcastHurtAnimation(@NotNull java.util.Collection<Player> players);
|
||||
// Paper end - broadcast hurt animation
|
||||
+
|
||||
+ // 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
|
||||
}
|
||||
85
patches/api/0011-Add-ObjectId.patch
Normal file
85
patches/api/0011-Add-ObjectId.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 16 Nov 2024 09:22:24 -0600
|
||||
Subject: [PATCH] Add ObjectId
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index e29e5024fa693baae469d47fe77b57118f14627c..5770f7c756d033076e0fb629d6aa11fb97ccb0f2 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -69,6 +69,8 @@ dependencies {
|
||||
implementation("org.ow2.asm:asm-commons:9.7.1")
|
||||
// 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/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
|
||||
index 488604ba1a516b477693877c74712e4a45624a8b..2a3e40b0b7f058713634d99f61755b368e05fa74 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,21 +0,0 @@
|
||||
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 bb0c49ed971d71904b9172cac2e724133754f32c..8fc53e32d09f1678d59da0d01f28b6ef96527011 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2950,6 +2950,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
*/
|
||||
boolean hasResourcePack();
|
||||
|
||||
+ // Slice start
|
||||
+ void toggleAntiXrayBypass(boolean bypass);
|
||||
+ // Slice end
|
||||
+
|
||||
/**
|
||||
* Gets a copy of this players profile
|
||||
* @return The players profile object
|
||||
@@ -1,12 +1,12 @@
|
||||
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
|
||||
Date: Sat, 16 Nov 2024 09:34:15 -0600
|
||||
Subject: [PATCH] Add PlayerLoadStatsEvent Fix patch
|
||||
|
||||
|
||||
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
|
||||
index 0000000000000000000000000000000000000000..13c627b73520d862f864834732f0cad35532298b
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadStatsEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
@@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..80b67d390152b114ad385f7eb6af5ef9
|
||||
+public class PlayerLoadStatsEvent extends Event {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final UUID playerId;
|
||||
+ private JsonObject statistics;
|
||||
+ private JsonObject json;
|
||||
+
|
||||
+ public PlayerLoadStatsEvent(@NotNull UUID playerId) {
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
@@ -46,11 +46,11 @@ index 0000000000000000000000000000000000000000..80b67d390152b114ad385f7eb6af5ef9
|
||||
+
|
||||
+ @Nullable
|
||||
+ public JsonObject getStatistics() {
|
||||
+ return statistics;
|
||||
+ return json;
|
||||
+ }
|
||||
+
|
||||
+ public void setStatistics(@NotNull JsonObject statistics) {
|
||||
+ this.statistics = statistics;
|
||||
+ public void setStatistics(@NotNull JsonObject json) {
|
||||
+ this.json = json;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
@@ -1,95 +0,0 @@
|
||||
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..b5cc9538a70c7ce0b494d4878d51b52134c2fd75
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/packet/PlayerPreChunkLoadEvent.java
|
||||
@@ -0,0 +1,69 @@
|
||||
+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(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;
|
||||
+ }
|
||||
+
|
||||
+ 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 792b1b4ea3330b282961844d48b2dc56e0201c7e..a2b42e723fd7989b410e8c90f235ce38bd1bae45 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -500,6 +500,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
//@Deprecated // Paper
|
||||
public boolean refreshChunk(int x, int z);
|
||||
|
||||
+ it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(Player p); // Slice
|
||||
+
|
||||
/**
|
||||
* Gets whether the chunk at the specified chunk coordinates is force
|
||||
* loaded.
|
||||
@@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 17 Nov 2024 08:24:22 -0600
|
||||
Subject: [PATCH] Expose getBlockPosBelowThatAffectsMyMovement
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||
index 6324e8f11a382288fc0a6c30f47760ea50e231d5..8188b3a27fddac18cf49db5a8049149e784f4cbc 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1187,4 +1187,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
|
||||
}
|
||||
140
patches/api/0014-Add-DimensionDataStorageEvents.patch
Normal file
140
patches/api/0014-Add-DimensionDataStorageEvents.patch
Normal file
@@ -0,0 +1,140 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 17 Nov 2024 09:19:41 -0600
|
||||
Subject: [PATCH] Add DimensionDataStorageEvents
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/server/DimensionDataStorageLoadEvent.java b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageLoadEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f85074ae3bb7eb558fc07a4e1877f130aec33d39
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageLoadEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
+package io.papermc.paper.event.server;
|
||||
+
|
||||
+import com.google.gson.JsonElement;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+import java.nio.file.Path;
|
||||
+
|
||||
+/**
|
||||
+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload)
|
||||
+ * <p>
|
||||
+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class DimensionDataStorageLoadEvent extends ServerEvent implements Cancellable {
|
||||
+ public static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final Path path;
|
||||
+ private final JsonElement json;
|
||||
+ private boolean cancelled;
|
||||
+ @ApiStatus.Internal
|
||||
+ public DimensionDataStorageLoadEvent(final Path path, final JsonElement json) {
|
||||
+ this.path = path;
|
||||
+ this.json = json;
|
||||
+ }
|
||||
+
|
||||
+ public Path getPath() {
|
||||
+ return path;
|
||||
+ }
|
||||
+
|
||||
+ public JsonElement getJson() {
|
||||
+ return json;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ PLUGIN,
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/server/DimensionDataStorageSaveEvent.java b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageSaveEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2b29981621c959dd6027a072dab06339ebf315bf
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/server/DimensionDataStorageSaveEvent.java
|
||||
@@ -0,0 +1,61 @@
|
||||
+package io.papermc.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+import java.io.ByteArrayOutputStream;
|
||||
+import java.nio.file.Path;
|
||||
+
|
||||
+/**
|
||||
+ * Called when resources such as datapacks are reloaded (e.g. /minecraft:reload)
|
||||
+ * <p>
|
||||
+ * Intended for use to re-register custom recipes, advancements that may be lost during a reload like this.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class DimensionDataStorageSaveEvent extends ServerEvent implements Cancellable {
|
||||
+ public static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final String id;
|
||||
+ private final ByteArrayOutputStream output;
|
||||
+ private boolean cancelled;
|
||||
+ @ApiStatus.Internal
|
||||
+ public DimensionDataStorageSaveEvent(final String id, final ByteArrayOutputStream output) {
|
||||
+ this.id = id;
|
||||
+ this.output = output;
|
||||
+ }
|
||||
+
|
||||
+ public String getId() {
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ public ByteArrayOutputStream getOutput() {
|
||||
+ return output;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ PLUGIN,
|
||||
+ }
|
||||
+}
|
||||
@@ -1,18 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:38:40 -0500
|
||||
Date: Mon, 18 Nov 2024 08:34:27 -0600
|
||||
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
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ae0132d9c7ae17b478d1d504961e1fd6b479f6d0
|
||||
index 0000000000000000000000000000000000000000..2501922ea0fe84ed07e33503d84dd74a423e39e3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLoadDataEvent.java
|
||||
@@ -0,0 +1,63 @@
|
||||
@@ -0,0 +1,64 @@
|
||||
+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;
|
||||
@@ -30,7 +31,7 @@ index 0000000000000000000000000000000000000000..ae0132d9c7ae17b478d1d504961e1fd6
|
||||
+ private JsonObject statistics;
|
||||
+
|
||||
+ public PlayerLoadDataEvent(@NotNull UUID playerId) {
|
||||
+ super();
|
||||
+ super(!Bukkit.isPrimaryThread());
|
||||
+ this.playerId = playerId;
|
||||
+ }
|
||||
+
|
||||
@@ -1,34 +0,0 @@
|
||||
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 4ed53b14f94154043e3043f4fef540b45b2b272d..608df52360df66390fce3070e52e4ecd4cd5fb64 100644
|
||||
--- a/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PrePlayerAttackEntityEvent.java
|
||||
@@ -27,6 +27,7 @@ public class PrePlayerAttackEntityEvent extends PlayerEvent implements Cancellab
|
||||
private boolean cancelled;
|
||||
private final boolean willAttack;
|
||||
private boolean forceCrit; // Slice
|
||||
+ private boolean preventKnockbackBonus; // Slice
|
||||
|
||||
public PrePlayerAttackEntityEvent(@NotNull Player who, @NotNull Entity attacked, boolean willAttack) {
|
||||
super(who);
|
||||
@@ -64,6 +65,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
|
||||
|
||||
@NotNull
|
||||
@@ -1,17 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 21 Oct 2023 11:27:53 -0500
|
||||
Subject: [PATCH] Non-saveable entities
|
||||
Date: Mon, 18 Nov 2024 11:20:07 -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 762cb07861ca8ff058ce8d57ea6c15df1e588bf3..234ad94cf73caaac64d0917cf0d761c1d4c5d6b5 100644
|
||||
index 8188b3a27fddac18cf49db5a8049149e784f4cbc..a189034515b4361c39b60915e38f35d808a503d0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -1049,4 +1049,19 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
@@ -1195,4 +1195,20 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
|
||||
*/
|
||||
@NotNull String getScoreboardEntryName();
|
||||
// Paper end - entity scoreboard name
|
||||
org.bukkit.block.Block getBlockStandingOn();
|
||||
// Slice end
|
||||
+
|
||||
+
|
||||
+ // Slice start
|
||||
+ /**
|
||||
114
patches/api/0017-Map-Events.patch
Normal file
114
patches/api/0017-Map-Events.patch
Normal file
@@ -0,0 +1,114 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 2 Dec 2024 11:52:34 -0600
|
||||
Subject: [PATCH] Map Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/server/MapGetFreeIndexEvent.java b/src/main/java/io/papermc/paper/event/server/MapGetFreeIndexEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..25999adb10ed0f3514332d64f27ea118bfccbfb4
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/server/MapGetFreeIndexEvent.java
|
||||
@@ -0,0 +1,41 @@
|
||||
+package io.papermc.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when we try to fetch a new index for a newly-created map.
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class MapGetFreeIndexEvent extends ServerEvent {
|
||||
+ public static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private int index = -1;
|
||||
+ @ApiStatus.Internal
|
||||
+ public MapGetFreeIndexEvent() {
|
||||
+ }
|
||||
+
|
||||
+ public int getIndex() {
|
||||
+ return index;
|
||||
+ }
|
||||
+
|
||||
+ public void setIndex(int index) {
|
||||
+ this.index = index;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ PLUGIN,
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/io/papermc/paper/event/server/MapLoadEvent.java b/src/main/java/io/papermc/paper/event/server/MapLoadEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0dfab37f18b797003b932a8a8b16943c1dd7677c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/server/MapLoadEvent.java
|
||||
@@ -0,0 +1,55 @@
|
||||
+package io.papermc.paper.event.server;
|
||||
+
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.server.ServerEvent;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+import org.jspecify.annotations.Nullable;
|
||||
+
|
||||
+import java.io.ByteArrayInputStream;
|
||||
+import java.io.ByteArrayOutputStream;
|
||||
+
|
||||
+/**
|
||||
+ * Called when we want to load a Map from disk
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class MapLoadEvent extends ServerEvent {
|
||||
+ public static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private int id;
|
||||
+ private ByteArrayInputStream buf;
|
||||
+ @ApiStatus.Internal
|
||||
+ public MapLoadEvent(int id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+
|
||||
+ public int getIndex() {
|
||||
+ return id;
|
||||
+ }
|
||||
+
|
||||
+ public void setIndex(int index) {
|
||||
+ this.id = index;
|
||||
+ }
|
||||
+
|
||||
+ public @Nullable ByteArrayInputStream getBuf() {
|
||||
+ return buf;
|
||||
+ }
|
||||
+
|
||||
+ public void setBuf(ByteArrayInputStream buf) {
|
||||
+ this.buf = buf;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public enum Cause {
|
||||
+ COMMAND,
|
||||
+ PLUGIN,
|
||||
+ }
|
||||
+}
|
||||
@@ -1,19 +0,0 @@
|
||||
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
|
||||
66
patches/api/0018-PlayerInsertBundleItemEvent.patch
Normal file
66
patches/api/0018-PlayerInsertBundleItemEvent.patch
Normal file
@@ -0,0 +1,66 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 15 Dec 2024 17:55:31 -0600
|
||||
Subject: [PATCH] PlayerInsertBundleItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerInsertBundleItemEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerInsertBundleItemEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f715b36826591c5b19408c96119892a935eca27f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerInsertBundleItemEvent.java
|
||||
@@ -0,0 +1,54 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+import org.jetbrains.annotations.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+@NullMarked
|
||||
+public class PlayerInsertBundleItemEvent extends PlayerEvent implements Cancellable {
|
||||
+
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private ItemStack bundle;
|
||||
+ private ItemStack itemStack;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public PlayerInsertBundleItemEvent(final Player player, final ItemStack bundle, final ItemStack itemStack) {
|
||||
+ super(player);
|
||||
+ this.bundle = bundle;
|
||||
+ this.itemStack = itemStack;
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getItemStack() {
|
||||
+ return itemStack;
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getBundle() {
|
||||
+ return bundle;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(final boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return HANDLER_LIST;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,33 +1,39 @@
|
||||
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
|
||||
Date: Sat, 28 Dec 2024 07:59:54 -0600
|
||||
Subject: [PATCH] Add PlayerPreRespawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
|
||||
diff --git a/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3823a19c0
|
||||
index 0000000000000000000000000000000000000000..53b830c7a349d58b1bb8b242b3edd144c6dcbdb0
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerGetRespawnLocationEvent.java
|
||||
@@ -0,0 +1,53 @@
|
||||
+package org.bukkit.event.player;
|
||||
+++ b/src/main/java/io/papermc/paper/event/player/PlayerPreRespawnEvent.java
|
||||
@@ -0,0 +1,76 @@
|
||||
+package io.papermc.paper.event.player;
|
||||
+
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.player.PlayerEvent;
|
||||
+import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a respawn event tries to determine the location of a respawn
|
||||
+ * Called before a player's respawn location is determined.
|
||||
+ */
|
||||
+public class PlayerGetRespawnLocationEvent extends PlayerEvent {
|
||||
+public class PlayerPreRespawnEvent extends PlayerEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final PlayerRespawnEvent.RespawnReason respawnReason;
|
||||
+ private Location respawnLocation;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ public PlayerGetRespawnLocationEvent(@NotNull final Player respawnPlayer) {
|
||||
+ public PlayerPreRespawnEvent(@NotNull final Player respawnPlayer, PlayerRespawnEvent.RespawnReason respawnReason) {
|
||||
+ super(respawnPlayer);
|
||||
+ this.respawnReason = respawnReason;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@@ -52,6 +58,13 @@ index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3
|
||||
+ this.respawnLocation = respawnLocation;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * @return Returns the reason the player was respawned.
|
||||
+ */
|
||||
+ public PlayerRespawnEvent.RespawnReason getRespawnReason() {
|
||||
+ return respawnReason;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
@@ -62,4 +75,14 @@ index 0000000000000000000000000000000000000000..7eca4d6929fc7a75974d182c1ea692d3
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
@@ -1,41 +0,0 @@
|
||||
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 4773f537dec20d6ebd82e4b145a1cdea0077fe90..f7a6346bc7eecc57fa7d69c801afa15230496f3c 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/EntityDamageEvent.java
|
||||
@@ -27,6 +27,7 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
private final Map<DamageModifier, Double> originals;
|
||||
private boolean cancelled;
|
||||
private final DamageCause cause;
|
||||
+ private long timeDamaged = System.currentTimeMillis(); // Slice
|
||||
|
||||
public EntityDamageEvent(@NotNull final Entity damagee, @NotNull final DamageCause cause, final double damage) {
|
||||
this(damagee, cause, new EnumMap<DamageModifier, Double>(ImmutableMap.of(DamageModifier.BASE, damage)), new EnumMap<DamageModifier, Function<? super Double, Double>>(ImmutableMap.of(DamageModifier.BASE, ZERO)));
|
||||
@@ -193,6 +194,22 @@ public class EntityDamageEvent extends EntityEvent implements Cancellable {
|
||||
return cause;
|
||||
}
|
||||
|
||||
+ // 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() {
|
||||
@@ -1,82 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
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 fb98936bb8a5488db75d676c5bcb4060597fbbf8..2e1cea360bb6ff85eb8da54237bc407653eb91f6 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":paper-api"))
|
||||
- implementation(project(":paper-mojangapi"))
|
||||
+ // Slice start
|
||||
+ implementation(project(":slice-api"))
|
||||
+ implementation("io.papermc.paper:paper-mojangapi:1.19.2-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")
|
||||
@@ -72,7 +76,7 @@ tasks.jar {
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
"Implementation-Title" to "CraftBukkit",
|
||||
- "Implementation-Version" to "git-Paper-$implementationVersion",
|
||||
+ "Implementation-Version" to "git-Slice-$implementationVersion", // Slice
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
"Specification-Title" to "Bukkit",
|
||||
"Specification-Version" to project.version,
|
||||
@@ -149,7 +153,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
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 67ee3a4ca8a6cdeb275653d492a1fea8037c51fb..915340fedc6c0b3d70ee065482dbe621b7c0b0a8 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1692,7 +1692,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!
|
||||
}
|
||||
|
||||
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 ec4b73321205b472f19fa5bd4ad95893020d1340..2fdc3bcea74b82d7155617d77100b100d8e56047 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -265,7 +265,7 @@ import javax.annotation.Nullable; // Paper
|
||||
import javax.annotation.Nonnull; // Paper
|
||||
|
||||
public final class CraftServer implements Server {
|
||||
- private final String serverName = "Paper"; // Paper
|
||||
+ private final String serverName = "Slice"; // Slice // Paper
|
||||
private final String serverVersion;
|
||||
private final String bukkitVersion = Versioning.getBukkitVersion();
|
||||
private final Logger logger = Logger.getLogger("Minecraft");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..fdd8fa9ec021b4846b59e1693e32d4d02a712efe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.lokamc.slice/slice-api/pom.properties"); // Slice
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
91
patches/server/0001-Build-changes.patch
Normal file
91
patches/server/0001-Build-changes.patch
Normal file
@@ -0,0 +1,91 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 9 Nov 2024 09:30:20 -0600
|
||||
Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index faf3e3fd72e8c915e7a4803dacbe1bb576c6663e..63aa7a91dad0903383405c2cccf894d23a2ede54 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||
// Paper end - configure mockito agent that is needed in newer java versions
|
||||
|
||||
dependencies {
|
||||
- implementation(project(":paper-api"))
|
||||
+ implementation(project(":slice-api"))
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||
@@ -99,14 +99,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
- "Implementation-Title" to "Paper",
|
||||
+ "Implementation-Title" to "Slice",
|
||||
"Implementation-Version" to implementationVersion,
|
||||
"Implementation-Vendor" to date, // Paper
|
||||
- "Specification-Title" to "Paper",
|
||||
+ "Specification-Title" to "Slice",
|
||||
"Specification-Version" to project.version,
|
||||
- "Specification-Vendor" to "Paper Team",
|
||||
+ "Specification-Vendor" to "Loka",
|
||||
"Brand-Id" to "papermc:paper",
|
||||
- "Brand-Name" to "Paper",
|
||||
+ "Brand-Name" to "Slice",
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
@@ -172,7 +172,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
- group = "paper"
|
||||
+ group = "slice"
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
index 790bad0494454ca12ee152e3de6da3da634d9b20..f4099ed9f6076d4fc216730878134c5e194fc017 100644
|
||||
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
|
||||
@@ -30,7 +30,7 @@ public record ServerBuildInfoImpl(
|
||||
private static final String ATTRIBUTE_GIT_BRANCH = "Git-Branch";
|
||||
private static final String ATTRIBUTE_GIT_COMMIT = "Git-Commit";
|
||||
|
||||
- private static final String BRAND_PAPER_NAME = "Paper";
|
||||
+ private static final String BRAND_SLICE_NAME = "Slice";
|
||||
|
||||
private static final String BUILD_DEV = "DEV";
|
||||
|
||||
@@ -44,7 +44,7 @@ public record ServerBuildInfoImpl(
|
||||
.map(Key::key)
|
||||
.orElse(BRAND_PAPER_ID),
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BRAND_NAME)
|
||||
- .orElse(BRAND_PAPER_NAME),
|
||||
+ .orElse(BRAND_SLICE_NAME),
|
||||
SharedConstants.getCurrentVersion().getId(),
|
||||
SharedConstants.getCurrentVersion().getName(),
|
||||
getManifestAttribute(manifest, ATTRIBUTE_BUILD_NUMBER)
|
||||
@@ -61,7 +61,7 @@ public record ServerBuildInfoImpl(
|
||||
|
||||
@Override
|
||||
public boolean isBrandCompatible(final @NotNull Key brandId) {
|
||||
- return brandId.equals(this.brandId);
|
||||
+ return brandId.equals(this.brandId) || brandId.equals(BRAND_PAPER_ID);
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
index 774556a62eb240da42e84db4502e2ed43495be17..7cf4712a774ff73818991c5fd7fe067ff2b83d35 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java
|
||||
@@ -11,7 +11,7 @@ public final class Versioning {
|
||||
public static String getBukkitVersion() {
|
||||
String result = "Unknown-Version";
|
||||
|
||||
- InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/io.papermc.paper/paper-api/pom.properties");
|
||||
+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.lokamc.slice/slice-api/pom.properties");
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
@@ -1,48 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:30:29 -0500
|
||||
Date: Sat, 9 Nov 2024 09:48:21 -0600
|
||||
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 618ab9a2903f6d4139acd4aaa2e6db0a26e88ba9..ec94d787f227c373637e6bb5f38260d978fe14df 100644
|
||||
index a96f859a5d0c6ec692d4627a69f3c9ee49199dbc..7fe358dac8740ac6338a942f4189bca300d1f1be 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 {
|
||||
org.bukkit.block.BlockState state = bblock.getState();
|
||||
level.captureDrops = new ArrayList<>();
|
||||
@@ -425,6 +425,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
|
||||
block.playerWillDestroy(this.level, pos, iblockdata, this.player);
|
||||
boolean flag = this.level.removeBlock(pos, false);
|
||||
|
||||
@@ -447,6 +448,7 @@ public class ServerPlayerGameMode {
|
||||
if (flag) {
|
||||
@@ -452,6 +453,7 @@ public class ServerPlayerGameMode {
|
||||
// CraftBukkit start
|
||||
java.util.List<net.minecraft.world.entity.item.ItemEntity> itemsToDrop = level.captureDrops; // Paper - store current list
|
||||
level.captureDrops = null; // Paper - Remove this earlier so that we can actually drop stuff
|
||||
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 - use stored ref
|
||||
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 879cc823d56625867eb73bb621db6a13f40ad81c..2b3b1c5ccdf58ee9b46d404cfa3790d0fdc2df3d 100644
|
||||
index 33e7d2884195677c4d6340d8b84c1dd85c636ec1..04f8269abe339610795237652edcd54ba31bc5fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -352,6 +352,7 @@ public final class ItemStack {
|
||||
CompoundTag oldData = this.getTagClone();
|
||||
@@ -424,6 +424,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
DataComponentPatch oldData = this.components.asPatch();
|
||||
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 - capture block states for snow buckets
|
||||
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 c7ee934d4f890bc86596d36079ffed5050133b47..1d17c6471449fe4f4fd2bae6bc8a9c500fb0c96f 100644
|
||||
index 022de445bbbb869c38be4972c98dcf1c665539ec..abdbfb6bc3989bdc9332712be3c71b2afbf43c48 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -184,6 +184,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
|
||||
@@ -181,6 +181,28 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
public final Map<ServerExplosion.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 {
|
||||
@@ -65,10 +65,11 @@ index c7ee934d4f890bc86596d36079ffed5050133b47..1d17c6471449fe4f4fd2bae6bc8a9c50
|
||||
+ 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) {
|
||||
@@ -748,6 +769,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
+
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
@@ -1225,6 +1247,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
if (!this.preventPoiUpdated) {
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@@ -76,7 +77,7 @@ index c7ee934d4f890bc86596d36079ffed5050133b47..1d17c6471449fe4f4fd2bae6bc8a9c50
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
@@ -769,6 +791,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1246,6 +1269,17 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -92,13 +93,13 @@ index c7ee934d4f890bc86596d36079ffed5050133b47..1d17c6471449fe4f4fd2bae6bc8a9c50
|
||||
+ // Paper end
|
||||
+
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
// Paper start - while the above setAir method is named same and looks very similar
|
||||
// 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 030b38d5d5d2578d6ef482a239ef58787efa3b08..329053cf5c342747985f9079e87edc6f883bfa1e 100644
|
||||
index 4fe83bd0f355549847b66afb7e61f6f2a6d97016..be6e6247d1a94271926544b128a52f501bc2cad5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/DoublePlantBlock.java
|
||||
@@ -105,6 +105,15 @@ public class DoublePlantBlock extends BushBlock {
|
||||
@@ -114,6 +114,15 @@ public class DoublePlantBlock extends BushBlock {
|
||||
BlockPos blockposition1 = pos.below();
|
||||
BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||
|
||||
@@ -115,10 +116,10 @@ index 030b38d5d5d2578d6ef482a239ef58787efa3b08..329053cf5c342747985f9079e87edc6f
|
||||
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 de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..4beb56de55d5584ce7f6e04ae30f7c3cffc1440e 100644
|
||||
index 99fd67a78539133adf78d65e2c520ff3dd260301..12d9c6769c8cb705d232bc01b50b04df503e4c3a 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
|
||||
@@ -1127,11 +1127,22 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -1237,11 +1237,22 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
Direction[] aenumdirection = BlockBehaviour.UPDATE_SHAPE_ORDER;
|
||||
int k = aenumdirection.length;
|
||||
@@ -138,6 +139,6 @@ index de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..4beb56de55d5584ce7f6e04ae30f7c3c
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
world.neighborShapeChanged(enumdirection.getOpposite(), this.asState(), blockposition_mutableblockposition, pos, flags, maxUpdateDepth);
|
||||
world.neighborShapeChanged(enumdirection.getOpposite(), blockposition_mutableblockposition, pos, this.asState(), flags, maxUpdateDepth);
|
||||
}
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
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 877498729c66de9aa6a27c9148f7494d7895615c..63959d7f15c682c2935f872d50de03fdacf95db4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java
|
||||
@@ -235,7 +235,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,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 773bfdd3ed457a352b5329f280c0d10297d579ba..c7ee934d4f890bc86596d36079ffed5050133b47 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -598,12 +598,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
|
||||
@@ -794,7 +794,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(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 fdd9c61b7248e92dbcbec91cd6fe4c6310bba237..2f2197236d9ba64b62510df923378b0256629d02 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -194,7 +194,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 bf2cd1eb04c10b8422ddca8efd397290bf58ea4d..30dcafc3ebcb5ab230a5622a0108aa3d7e3c4ead 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -286,7 +286,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 f3ac362b7b65a5273ff5fdad1d8065c5f654a53a..2c60ae8b5adb60c49712327bda3c2666778fd729 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -187,15 +187,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
|
||||
@@ -209,7 +214,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 b1abb332eca597b23888bca42d21d5b587f61b13..7286394d1de13247870aac7c3110964bf01a7078 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java
|
||||
@@ -208,7 +208,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(
|
||||
position,
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java
|
||||
index 0b7d882551bcb8be149754209aad5fe4142f0fac..db3a7b550b1fa0654ba76f522a8163135f222281 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;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:31:54 -0500
|
||||
Date: Sat, 9 Nov 2024 09:54:36 -0600
|
||||
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 243b5823ea99eefd812134b5c80d4d3c9f008499..ee97b4352fcdb3fd55eeb5a4a57981b2f0aed28b 100644
|
||||
index 5cb69d0b822e11a99a96aef4f59986d083b079f4..632f9d98eb0a7a641ce879afcf838b6a96077ef6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
|
||||
@@ -616,7 +616,18 @@ public class CraftBlock implements Block {
|
||||
@@ -592,7 +592,18 @@ public class CraftBlock implements Block {
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getDrops(ItemStack item, Entity entity) {
|
||||
@@ -28,7 +28,7 @@ index 243b5823ea99eefd812134b5c80d4d3c9f008499..ee97b4352fcdb3fd55eeb5a4a57981b2
|
||||
net.minecraft.world.item.ItemStack nms = CraftItemStack.asNMSCopy(item);
|
||||
|
||||
// Modelled off EntityHuman#hasBlock
|
||||
@@ -627,6 +638,7 @@ public class CraftBlock implements Block {
|
||||
@@ -603,6 +614,7 @@ public class CraftBlock implements Block {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:36:21 -0500
|
||||
Date: Sat, 9 Nov 2024 09:55:18 -0600
|
||||
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 4bce895268542531598a01a1bccd8ac1ed703b7d..8b552fc58a2909bced07eb743dd5d76c0357f9ab 100644
|
||||
index 59cf905b1b5686f6f4f2bad94730ffa69d3a2834..7a8c80fe0df7a758751e2109e69934d5abfa0060 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
|
||||
@@ -104,7 +104,8 @@ public class SpongeBlock extends Block {
|
||||
@@ -117,7 +117,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,27 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 07:37:05 -0500
|
||||
Date: Sat, 9 Nov 2024 09:56:09 -0600
|
||||
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 18aac3da3c88f33b1a71a5920a8daa27e9723913..af0720fb8bd334aac5493121c6373d87421204b4 100644
|
||||
index 585e2b43a0326f0b81597fa1234d3c67c76af550..e256e5ff5c167c6cff5b9e985cdc80d5c9203708 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -222,6 +222,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
public final UUID uuid;
|
||||
public boolean hasPhysicsEvent = true; // Paper
|
||||
public boolean hasEntityMoveEvent = false; // Paper
|
||||
+ public boolean instance; // Slice
|
||||
@@ -231,6 +231,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
|
||||
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
|
||||
private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current)
|
||||
public static Throwable getAddToWorldStackTrace(Entity entity) {
|
||||
final Throwable thr = new Throwable(entity + " Added to world at " + new java.util.Date());
|
||||
+ public boolean instance; // Slice
|
||||
|
||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 1a481fb4f4228f0fea8a7dc6132248c98b727c90..836bdbf4a4742f0cce0f9612d694db03305c7a00 100644
|
||||
index 57da11c0da7322e74810e7108e9c8000b0c36520..68e3dee346fe013f8e69900a0911583f851d2782 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -1268,6 +1268,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
world.noSave = !value;
|
||||
@@ -1330,6 +1330,18 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
this.world.noSave = !value;
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
@@ -38,4 +38,4 @@ index 1a481fb4f4228f0fea8a7dc6132248c98b727c90..836bdbf4a4742f0cce0f9612d694db03
|
||||
+
|
||||
@Override
|
||||
public void setDifficulty(Difficulty difficulty) {
|
||||
this.getHandle().getServer().setDifficulty(this.getHandle(), net.minecraft.world.Difficulty.byId(difficulty.getValue()), true); // Paper - don't skip other difficulty-changing logic
|
||||
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
|
||||
61
patches/server/0006-Smooth-Teleports.patch
Normal file
61
patches/server/0006-Smooth-Teleports.patch
Normal file
@@ -0,0 +1,61 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 10 Nov 2024 09:34:07 -0600
|
||||
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 5a8f396d47577f087abb415c972fd4f51e50faba..69c9cec8b397832340d683fc38d04c7ecd469a05 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -329,6 +329,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
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 = false; // Slice
|
||||
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 30de3d1a7792c38ae946f19cb0e14637919b5001..b775de1732238954e9bbbd072277254d2dc91b18 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -844,8 +844,7 @@ public abstract class PlayerList {
|
||||
ServerLevel worldserver1 = entityplayer1.serverLevel();
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
|
||||
- entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver1), (byte) i));
|
||||
- entityplayer1.connection.send(new ClientboundSetChunkCacheRadiusPacket(worldserver1.spigotConfig.viewDistance)); // Spigot
|
||||
+ if (!entityplayer1.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(entityplayer1.createCommonSpawnInfo(worldserver1), (byte) i)); // Slice
|
||||
entityplayer1.connection.send(new ClientboundSetSimulationDistancePacket(worldserver1.spigotConfig.simulationDistance)); // Spigot
|
||||
entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit
|
||||
entityplayer1.connection.send(new ClientboundSetDefaultSpawnPositionPacket(worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle()));
|
||||
@@ -1213,7 +1212,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)); // Slice
|
||||
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 554714e449d1d2439b05d7e15f72afccd17d4df5..adf8f0ddde16f08b10cd733eeabf9d40db77001b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1361,6 +1361,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
// Paper end - Teleportation API
|
||||
}
|
||||
|
||||
+ // 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
|
||||
@@ -1,121 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
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 df2a4449bdc00eb936bf219807d401fc99663926..939d29db3c535c45866fe67cabbe9304601230b0 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -602,6 +602,8 @@ public class ServerPlayerGameMode {
|
||||
enuminteractionresult1 = stack.useOn(itemactioncontext);
|
||||
}
|
||||
|
||||
+ world.pendingPlayerBlockEvents.remove(blockposition); // Paper
|
||||
+
|
||||
if (enuminteractionresult1.consumesAction()) {
|
||||
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 9501e5f25f5c4d3069e554d4dc82b0e094156682..8afd9b785fb8734255e3ea926b8375bb9cae60be 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -198,7 +198,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
- protected String toJson() {
|
||||
+ // Slice start - OBFHELPER
|
||||
+ public String toJson() {
|
||||
+ return serialize().toString();
|
||||
+ }
|
||||
+
|
||||
+ public JsonObject serialize() { // Slice end
|
||||
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
|
||||
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -224,7 +229,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
jsonobject1.add("stats", jsonobject);
|
||||
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 36af81f0957d17e170d229059c66f4eb4539dfeb..e8d324a32838b69255ce48b1c03e47cd9e201da6 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 {
|
||||
|
||||
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 {
|
||||
public CompoundTag load(Player player) {
|
||||
CompoundTag nbttagcompound = null;
|
||||
|
||||
- try {
|
||||
- File file = new File(this.playerDir, player.getStringUUID() + ".dat");
|
||||
- // Spigot Start
|
||||
- boolean usingWrongFile = false;
|
||||
- if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first
|
||||
- {
|
||||
- file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + player.getScoreboardName() ).getBytes( "UTF-8" ) ).toString() + ".dat");
|
||||
- if ( file.exists() )
|
||||
+ // Slice start - If event supplies playerdata, use it. Otherwise just load from disk as usual
|
||||
+ com.destroystokyo.paper.event.player.PlayerLoadDataEvent event = new com.destroystokyo.paper.event.player.PlayerLoadDataEvent(player.getUUID());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ Object playerData = event.getPlayerData();
|
||||
+ if (playerData != null) {
|
||||
+ nbttagcompound = (CompoundTag) playerData;
|
||||
+ } else {
|
||||
+ try {
|
||||
+ File file = new File(this.playerDir, player.getStringUUID() + ".dat");
|
||||
+ // Spigot Start
|
||||
+ boolean usingWrongFile = false;
|
||||
+ if (org.bukkit.Bukkit.getOnlineMode() && !file.exists()) // Paper - Check online mode first
|
||||
{
|
||||
- usingWrongFile = true;
|
||||
- org.bukkit.Bukkit.getServer().getLogger().warning( "Using offline mode UUID file for player " + player.getScoreboardName() + " as it is the only copy we can find." );
|
||||
+ file = new File(this.playerDir, java.util.UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getScoreboardName()).getBytes("UTF-8")).toString() + ".dat");
|
||||
+ if (file.exists()) {
|
||||
+ usingWrongFile = true;
|
||||
+ org.bukkit.Bukkit.getServer().getLogger().warning("Using offline mode UUID file for player " + player.getScoreboardName() + " as it is the only copy we can find.");
|
||||
+ }
|
||||
}
|
||||
- }
|
||||
- // Spigot End
|
||||
+ // Spigot End
|
||||
|
||||
- if (file.exists() && file.isFile()) {
|
||||
- nbttagcompound = NbtIo.readCompressed(file);
|
||||
- }
|
||||
- // Spigot Start
|
||||
- if ( usingWrongFile )
|
||||
- {
|
||||
- file.renameTo( new File( file.getPath() + ".offline-read" ) );
|
||||
+ if (file.exists() && file.isFile()) {
|
||||
+ nbttagcompound = NbtIo.readCompressed(file);
|
||||
+ }
|
||||
+ // Spigot Start
|
||||
+ if (usingWrongFile) {
|
||||
+ file.renameTo(new File(file.getPath() + ".offline-read"));
|
||||
+ }
|
||||
+ // Spigot End
|
||||
+ } catch (Exception exception) {
|
||||
+ PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
|
||||
}
|
||||
- // Spigot End
|
||||
- } catch (Exception exception) {
|
||||
- PlayerDataStorage.LOGGER.warn("Failed to load player data for {}", player.getName().getString());
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
49
patches/server/0007-Allow-opening-covered-chests.patch
Normal file
49
patches/server/0007-Allow-opening-covered-chests.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 13 Nov 2024 07:44:28 -0600
|
||||
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 edef8fc62f8dba1b57214d8d7d805ff0d83f4114..c948eb36db7f902ce65523e19651057e39a1a8ad 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -341,9 +341,7 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
}
|
||||
|
||||
public static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
|
||||
- BlockPos blockposition1 = pos.above();
|
||||
-
|
||||
- return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
|
||||
+ return false; // Slice
|
||||
}
|
||||
|
||||
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 2a207fb2e1c26b562de42240e11c856bd2a23458..601746d00c1afd85ca8a0c5578ef587e6a231bcf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
@@ -83,7 +83,7 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory();
|
||||
if (playerEnderChestContainer != null && world.getBlockEntity(pos) instanceof EnderChestBlockEntity enderChestBlockEntity) {
|
||||
BlockPos blockPos = pos.above();
|
||||
- if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic
|
||||
+ if (false) { // Slice - allow block on top to not block opening // world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) { // Paper - diff on change; make sure that EnderChest#isBlocked uses the same logic
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
// Paper start - Fix InventoryOpenEvent cancellation - moved up;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
|
||||
index f45ee675a10729845bf376fa95e648b23b9aac12..bb59827851262051bc832f32bf54877b6a896990 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnderChest.java
|
||||
@@ -62,9 +62,7 @@ public class CraftEnderChest extends CraftBlockEntityState<EnderChestBlockEntity
|
||||
// Paper start - More Chest Block API
|
||||
@Override
|
||||
public boolean isBlocked() {
|
||||
- // Uses the same logic as EnderChestBlock's check for opening container
|
||||
- final net.minecraft.core.BlockPos abovePos = this.getPosition().above();
|
||||
- return this.isPlaced() && this.getWorldHandle().getBlockState(abovePos).isRedstoneConductor(this.getWorldHandle(), abovePos);
|
||||
+ return false; // Slice
|
||||
}
|
||||
// Paper end - More Chest Block API
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 13 Nov 2024 07:49:32 -0600
|
||||
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 61d412c4f1ebd55661cc3f0260468e3ac0efe0bb..551da84c834132d106457c123e1b195e4be904b8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1269,7 +1269,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource);
|
||||
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();
|
||||
+ boolean flag2 = playerAttackEntityEvent.isForceCrit() || (flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting()); // Slice
|
||||
|
||||
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
if (flag2) {
|
||||
@@ -1,102 +0,0 @@
|
||||
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 f097ec5b4e3ad6b1a7c464a8cff4f8b2568fcf4f..20a0b9835c47ca153a6f77dacf4b775de32e4ef2 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -853,49 +853,57 @@ public abstract class PlayerList {
|
||||
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
if (location == null) {
|
||||
- // boolean isBedSpawn = false; // Paper - 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 - 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 anchor respawn acting as a bed respawn from the end portal
|
||||
- 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 anchor respawn acting as a bed respawn from the end portal
|
||||
+ 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 - 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 - 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 - use 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 - use 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 - Fix anchor respawn acting as a bed respawn from the end portal
|
||||
this.cserver.getPluginManager().callEvent(respawnEvent);
|
||||
// Spigot Start
|
||||
@@ -1,15 +1,15 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 18 Apr 2023 07:52:19 -0500
|
||||
Date: Wed, 13 Nov 2024 07:54:14 -0600
|
||||
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 65d947df910d60f478e7a449eb161e5105e2c0c9..e08b72010f22ce680e88f443782bdfe6a46285f9 100644
|
||||
index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..50a5514c9109f71926594d3f4786bd0995fc2d84 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -524,7 +524,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return !ChunkMap.isChunkInRange(x1, z1, x2, z2, distance) ? false : !ChunkMap.isChunkInRange(x1 + 1, z1 + 1, x2, z2, distance) || !ChunkMap.isChunkInRange(x1 - 1, z1 + 1, x2, z2, distance) || !ChunkMap.isChunkInRange(x1 + 1, z1 - 1, x2, z2, distance) || !ChunkMap.isChunkInRange(x1 - 1, z1 - 1, x2, z2, distance);
|
||||
@@ -298,7 +298,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getPlayerChunkLoader().isChunkSent(player, chunkX, chunkZ, true); // Paper - rewrite chunk system
|
||||
}
|
||||
|
||||
- protected ThreadedLevelLightEngine getLightEngine() {
|
||||
@@ -1,149 +0,0 @@
|
||||
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 9c3520524cfb903da6a5401760394ec1b49a1825..a6809c3104d4a8fce89eb5056b445ae0517bf9a0 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 {
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 18 Apr 2023 07:50:34 -0500
|
||||
Date: Wed, 13 Nov 2024 07:55:27 -0600
|
||||
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 e8485fb900b25e911a858678a833852731cb2ace..a0f8740c93fe86d4c49b9e43f1044ef03d8e3de7 100644
|
||||
index a15546e433ebba6c0de01bdaaef201a3d99a87b5..55b9b33ce85cdff75de8753e6294c99bb1b1f7ee 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -868,7 +868,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -949,7 +949,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
this.checkBelowWorld();
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -1,57 +0,0 @@
|
||||
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 161c40692e8d469fad4169908b9353be0f85d0d8..2b93a37ee1f711c14140eb96f29dfdd3290641ad 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -278,6 +278,7 @@ public class ServerPlayer extends Player {
|
||||
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
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
|
||||
|
||||
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));
|
||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 20a0b9835c47ca153a6f77dacf4b775de32e4ef2..97c6f1c622af02b3761b23a4d3a67b385e45ea84 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -935,12 +935,12 @@ public abstract class PlayerList {
|
||||
int i = flag ? 1 : 0;
|
||||
// CraftBukkit start
|
||||
LevelData worlddata = worldserver1.getLevelData();
|
||||
- entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation(), entityplayer1.getPortalCooldown()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.send(new ClientboundRespawnPacket(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation(), entityplayer1.getPortalCooldown()));
|
||||
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.spawnIn(worldserver1);
|
||||
entityplayer1.unsetRemoved();
|
||||
- entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ if (!entityplayer.smoothWorldTeleport) entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
// entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 4e6fea7cf11b1e29ae7c7098a6f5d06bb5f93cc2..767a33cdce4b438164bf4101ff39cd7b1e8f929e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -1254,6 +1254,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
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 22 May 2023 08:21:18 -0500
|
||||
Date: Wed, 13 Nov 2024 07:58:14 -0600
|
||||
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 3c0651fa5a5db880202c9a3805a6455269c5f16d..42e61e55ef45935e1f690eefa56bc36842cdd974 100644
|
||||
index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..7644dfe30a51295ac3fa59384153c839fa781c01 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3030,7 +3030,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
@@ -2991,7 +2991,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
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 10 Apr 2023 08:40:20 -0500
|
||||
Subject: [PATCH] Ignore durability changes for equipment updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index e11d7283662834047b2ff81a2fd25a4263792deb..d0e49ae973a91344f3973dc6e00e7e6c649e87cb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3127,7 +3127,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public boolean equipmentHasChanged(ItemStack stack, ItemStack stack2) {
|
||||
- return !ItemStack.matches(stack2, stack);
|
||||
+ return !ItemStack.isSame(stack2, stack);
|
||||
}
|
||||
|
||||
private void handleHandSwap(Map<EquipmentSlot, ItemStack> equipmentChanges) {
|
||||
@@ -0,0 +1,18 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Wed, 13 Nov 2024 08:04:09 -0600
|
||||
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 880e5c52746e9e3a9a1f42ec6461be54e3ee136c..e8eeb1aaeec6d87af949e249d0ffd0856bfd71b1 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -180,6 +180,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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
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 8f5178e934b5f9bc48beacd082e479fd9fb80fa6..d580238d733ba2dbbbbaa2659d1a7834c8cf7dac 100644
|
||||
--- a/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
+++ b/src/main/java/net/minecraft/data/worldgen/BiomeDefaultFeatures.java
|
||||
@@ -161,7 +161,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 3d899e4dbb96f64279485bbd5b708df88ddbfe8f..89f33b92dc8cfa22d1e1edbda1a31179743979e8 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.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.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))));
|
||||
@@ -1,48 +0,0 @@
|
||||
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 42fdce97d99618a53f2e9c51804ff2205b574f69..7e8d58e3481be2d7ebbe5fe388d61932479e7721 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java
|
||||
@@ -165,6 +165,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 767a33cdce4b438164bf4101ff39cd7b1e8f929e..0af1801085701437f06c9ecaf8864fe875e90509 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -196,6 +196,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
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 end
|
||||
+ private boolean antiXrayBypass; // Slice
|
||||
|
||||
public CraftPlayer(CraftServer server, ServerPlayer entity) {
|
||||
super(server, entity);
|
||||
@@ -2827,6 +2828,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;
|
||||
19
patches/server/0013-Change-KeepAlive-interval.patch
Normal file
19
patches/server/0013-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: Wed, 13 Nov 2024 08:04:58 -0600
|
||||
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 b0bc66dc7248aae691dcab68b925b52a1695e63f..7096cbc201cd18e71b5da6b825fca83201ada1a3 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -261,7 +261,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
long currentTime = Util.getMillis();
|
||||
long elapsedTime = currentTime - this.keepAliveTime;
|
||||
|
||||
- if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // Paper - use vanilla's 15000L between keep alive packets
|
||||
+ if (!this.isSingleplayerOwner() && elapsedTime >= 5000L) { // Paper - use vanilla's 15000L between keep alive packets // Slice -> 5s
|
||||
if (this.keepAlivePending && !this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // Paper - check keepalive limit, don't fire if already disconnected
|
||||
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE, PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
|
||||
} else if (this.checkIfClosed(currentTime)) { // Paper
|
||||
@@ -1,36 +0,0 @@
|
||||
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 924539d4ac50c70178ba220424ffacd6ff277c8b..f9b30f2904d06f2a7de6fa03287bc2e40e879e2d 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
|
||||
@@ -411,7 +411,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 836bdbf4a4742f0cce0f9612d694db03305c7a00..fb79e3ee663709538d6e322fd8401564dcbbe5a7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -530,6 +530,12 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public it.unimi.dsi.fastutil.longs.LongOpenHashSet getSentChunks(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,19 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 12 Jun 2023 14:14:48 -0500
|
||||
Date: Wed, 13 Nov 2024 08:07:59 -0600
|
||||
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
|
||||
index 830bd76916e26a3a54954d3cf7b7520af52a2258..dc9c7a844c2aee1dae80006eafe085c6fa126ae1 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
|
||||
@@ -30,6 +30,16 @@ 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) {
|
||||
+ public ClientboundSetEquipmentPacket(int id, List<Pair<EquipmentSlot, ItemStack>> equipmentList, net.minecraft.world.entity.LivingEntity entity, boolean sanitize, String tag) {
|
||||
+ this.entity = id;
|
||||
+ this.sanitize = sanitize;
|
||||
+ slots = new java.util.ArrayList<>(equipmentList.size());
|
||||
+ for (Pair<EquipmentSlot, ItemStack> pair : equipmentList) {
|
||||
+ EquipmentSlot slot = pair.getFirst();
|
||||
@@ -21,69 +22,66 @@ index 5a8f850b447fc3a4bd0eb0c505bbdfc8be7115e8..34d74735b7a7d258c6bd14bb7e540693
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public ClientboundSetEquipmentPacket(FriendlyByteBuf buf) {
|
||||
private ClientboundSetEquipmentPacket(RegistryFriendlyByteBuf buf) {
|
||||
this.entity = buf.readVarInt();
|
||||
EquipmentSlot[] equipmentSlots = EquipmentSlot.values();
|
||||
this.slots = Lists.newArrayList();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index a514a1f26e439b5959093488ec9905fec327a404..0ac580f3cf8f95025992420702d67ad56db2ba05 100644
|
||||
index 90eb4927fa51ce3df86aa7b6c71f49150a03e337..a6c3beb9d5ab87fca882e1761983ebe385011296 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -328,27 +328,8 @@ public class ServerEntity {
|
||||
sender.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.ap));
|
||||
}
|
||||
@@ -388,22 +388,7 @@ public class ServerEntity {
|
||||
Entity entity = this.entity;
|
||||
|
||||
- if (this.entity instanceof LivingEntity) {
|
||||
if (entity instanceof LivingEntity entityliving) {
|
||||
- List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
|
||||
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
|
||||
- int i = aenumitemslot.length;
|
||||
- Iterator iterator = EquipmentSlot.VALUES.iterator();
|
||||
-
|
||||
- for (int j = 0; j < i; ++j) {
|
||||
- EquipmentSlot enumitemslot = aenumitemslot[j];
|
||||
- ItemStack itemstack = ((LivingEntity) this.entity).getItemBySlot(enumitemslot);
|
||||
- while (iterator.hasNext()) {
|
||||
- EquipmentSlot enumitemslot = (EquipmentSlot) iterator.next();
|
||||
- ItemStack itemstack = entityliving.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 - remove unnecessary item meta
|
||||
- // Paper end
|
||||
- list.add(Pair.of(enumitemslot, itemstack.copy()));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!list.isEmpty()) {
|
||||
- sender.accept(new ClientboundSetEquipmentPacket(this.entity.getId(), list));
|
||||
- sender.accept(new ClientboundSetEquipmentPacket(this.entity.getId(), list, true)); // Paper - data sanitization
|
||||
- }
|
||||
- ((LivingEntity) this.entity).detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ if (this.entity instanceof LivingEntity livingEntity) {
|
||||
+ livingEntity.sendEquipment(sender, player); // Slice
|
||||
- ((LivingEntity) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ entityliving.sendEquipment(sender, player);
|
||||
}
|
||||
|
||||
// CraftBukkit start - MC-109346: Fix for nonsensical head yaw
|
||||
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 836c007db96b115a0f7a869649e9ed4738920093..b6c320554693d1b55a385c45784feb45d7cac757 100644
|
||||
index f36a075dbee2b96d01899e02460b1d8443e91749..0634626d4a0bda9ac58f1fd16265ca866ee9f5c3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -263,6 +263,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper
|
||||
@@ -298,6 +298,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
|
||||
+ private final com.google.common.collect.Table<String, ItemStack, ItemStack> equipmentPacketCache = com.google.common.collect.HashBasedTable.create(); // Slice
|
||||
+ public java.util.Map<String, net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket> cachedEquipmentMap = new java.util.HashMap<>(); // Slice
|
||||
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() {
|
||||
@@ -3071,6 +3073,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.getYHeadRot();
|
||||
@@ -3383,6 +3388,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
if (map != null) {
|
||||
this.handleHandSwap(map);
|
||||
if (!map.isEmpty()) {
|
||||
+ cachedEquipmentMap.clear(); // Slice - Must invalidate cached equipment map if we have changes
|
||||
+ cachedEquipmentPacket.clear(); // Slice - Must invalidate cached equipment map if we have changes
|
||||
this.handleEquipmentChanges(map);
|
||||
}
|
||||
}
|
||||
@@ -3163,7 +3166,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3507,7 +3513,25 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
});
|
||||
- ((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
|
||||
- ((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list, true)); // Paper - data sanitization
|
||||
+
|
||||
+ // Slice start
|
||||
+ net.minecraft.server.level.ChunkMap.TrackedEntity entityTracker = ((ServerLevel) this.level()).getChunkSource().chunkMap.entityMap.get(getId());
|
||||
@@ -96,7 +94,7 @@ index 836c007db96b115a0f7a869649e9ed4738920093..b6c320554693d1b55a385c45784feb45
|
||||
+
|
||||
+ String tag = event.getTag();
|
||||
+ if (tag != null) {
|
||||
+ playerConnection.send(new ClientboundSetEquipmentPacket(this.getId(), list, this, tag));
|
||||
+ playerConnection.send(new ClientboundSetEquipmentPacket(this.getId(), list, this, false, tag));
|
||||
+ } else {
|
||||
+ playerConnection.send(packet);
|
||||
+ }
|
||||
@@ -105,29 +103,40 @@ index 836c007db96b115a0f7a869649e9ed4738920093..b6c320554693d1b55a385c45784feb45
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// Paper start - hide unnecessary item meta
|
||||
@@ -4450,4 +4471,74 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
private ItemStack getLastArmorItem(EquipmentSlot slot) {
|
||||
@@ -4803,4 +4827,84 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
public static record Fallsounds(SoundEvent small, SoundEvent big) {
|
||||
|
||||
}
|
||||
+
|
||||
+ // Slice start
|
||||
+ public static void invalidateCachedEquipment(String tag) {
|
||||
+ com.google.common.cache.Cache<Integer, ItemStack> removedCache = equipmentPacketCache.remove(tag);
|
||||
+ if (removedCache != null) {
|
||||
+ removedCache.asMap().clear();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getOrCreateCachedEquipmentItem(String tag, EquipmentSlot slot, ItemStack itemStack) {
|
||||
+ return equipmentPacketCache.row(tag).computeIfAbsent(itemStack, i -> {
|
||||
+ String name = slot.name();
|
||||
+ 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";
|
||||
+ }
|
||||
+ //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(i));
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.inventory.ItemStack eventItem = event.getItemStack();
|
||||
+ return CraftItemStack.asNMSCopy(eventItem);
|
||||
+ });
|
||||
+ 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
|
||||
+
|
||||
@@ -139,57 +148,55 @@ index 836c007db96b115a0f7a869649e9ed4738920093..b6c320554693d1b55a385c45784feb45
|
||||
+ boolean sendEquipment = !event.isCancelled();
|
||||
+ String tag = event.getTag();
|
||||
+ if (sendEquipment && this instanceof ServerPlayer player && tag != null) {
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = player.cachedEquipmentMap.get(tag);
|
||||
+ 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);
|
||||
+ sendEquipment = false;
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (sendEquipment) {
|
||||
+ EquipmentSlot[] equipmentSlots = EquipmentSlot.values();
|
||||
+ List<Pair<EquipmentSlot, ItemStack>> list = new ArrayList<>(equipmentSlots.length);
|
||||
+ List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
|
||||
+ Iterator iterator = EquipmentSlot.VALUES.iterator();
|
||||
+
|
||||
+ for (EquipmentSlot enumitemslot : equipmentSlots) {
|
||||
+ while (iterator.hasNext()) {
|
||||
+ EquipmentSlot enumitemslot = (EquipmentSlot) iterator.next();
|
||||
+ 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);
|
||||
+
|
||||
+ ItemStack finalItemStack;
|
||||
+ if (tag != null) {
|
||||
+ strippedItem = getOrCreateCachedEquipmentItem(tag, enumitemslot, strippedItem);
|
||||
+ finalItemStack = getOrCreateCachedEquipmentItem(tag, enumitemslot, itemstack);
|
||||
+ } else {
|
||||
+ finalItemStack = itemstack.copy();
|
||||
+ }
|
||||
+
|
||||
+ list.add(Pair.of(enumitemslot, strippedItem)); // Paper - remove unnecessary item meta
|
||||
+ // Paper end
|
||||
+ list.add(Pair.of(enumitemslot, finalItemStack));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!list.isEmpty()) {
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(getId(), list);
|
||||
+ ClientboundSetEquipmentPacket equipmentPacket = new ClientboundSetEquipmentPacket(getId(), list, true);
|
||||
+ if (tag != null) {
|
||||
+ cachedEquipmentMap.put(tag, equipmentPacket);
|
||||
+ cachedEquipmentPacket.put(tag, equipmentPacket);
|
||||
+ }
|
||||
+ consumer.accept(equipmentPacket);
|
||||
+ }
|
||||
+
|
||||
+ detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ 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 b25f5931f836fd4d8695120f0bcb7c52deff8583..68507518df679a354534a82f32a011727ae7cea0 100644
|
||||
index d0c409f4efad289e3e325f44b500fc72589d89d4..baecf1c7bb459786bdbe6f7381ef148e0dad0ef5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -1099,4 +1099,14 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
getHandle().knockback(strength, directionX, directionZ);
|
||||
};
|
||||
// Paper end
|
||||
+
|
||||
@@ -1205,6 +1205,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
// Paper end - body yaw API
|
||||
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public void sendEquipment(Player p) {
|
||||
@@ -199,4 +206,7 @@ index b25f5931f836fd4d8695120f0bcb7c52deff8583..68507518df679a354534a82f32a01172
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
+
|
||||
// Paper start - Expose canUseSlot
|
||||
@Override
|
||||
public boolean canUseEquipmentSlot(org.bukkit.inventory.EquipmentSlot slot) {
|
||||
24
patches/server/0015-Add-ChunkStatusChangeEvent.patch
Normal file
24
patches/server/0015-Add-ChunkStatusChangeEvent.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 16 Nov 2024 08:48:20 -0600
|
||||
Subject: [PATCH] Add ChunkStatusChangeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
|
||||
index eafa4e6d55cd0f9314ac0f2b96a7f48fbb5e1a4c..ee5f51bc5f31f269bdac239cb48265ae355db1ff 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/NewChunkHolder.java
|
||||
@@ -1261,6 +1261,13 @@ public final class NewChunkHolder {
|
||||
// note: currentChunk must be LevelChunk, as current != pending which means that at least one is not ACCESSIBLE
|
||||
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(current.name()),
|
||||
+ com.destroystokyo.paper.event.chunk.ChunkStatusChangeEvent.ChunkStatus.valueOf(current.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)
|
||||
@@ -1,43 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
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 5e22d175b1048a58802cdf64ac70a8b56329e915..0f15e574b5c0cc8648bc1c0a12f1c72aa8653724 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ChestBlock.java
|
||||
@@ -355,9 +355,10 @@ public class ChestBlock extends AbstractChestBlock<ChestBlockEntity> implements
|
||||
}
|
||||
|
||||
private static boolean isBlockedChestByBlock(BlockGetter world, BlockPos pos) {
|
||||
- BlockPos blockposition1 = pos.above();
|
||||
-
|
||||
- return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
|
||||
+ return false;
|
||||
+// BlockPos blockposition1 = pos.above();
|
||||
+//
|
||||
+// return world.getBlockState(blockposition1).isRedstoneConductor(world, blockposition1);
|
||||
}
|
||||
|
||||
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 7385e91f32f070e86a4e0fd3d214f55d832c7979..4911b099f865b9202286f51087e5c00ffeaa95a5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/EnderChestBlock.java
|
||||
@@ -76,10 +76,10 @@ public class EnderChestBlock extends AbstractChestBlock<EnderChestBlockEntity> i
|
||||
PlayerEnderChestContainer playerEnderChestContainer = player.getEnderChestInventory();
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (playerEnderChestContainer != null && blockEntity instanceof EnderChestBlockEntity) {
|
||||
- BlockPos blockPos = pos.above();
|
||||
- if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
|
||||
- return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
- } else if (world.isClientSide) {
|
||||
+// BlockPos blockPos = pos.above();
|
||||
+// if (world.getBlockState(blockPos).isRedstoneConductor(world, blockPos)) {
|
||||
+// return InteractionResult.sidedSuccess(world.isClientSide);
|
||||
+ if (world.isClientSide) {
|
||||
return InteractionResult.SUCCESS;
|
||||
} else {
|
||||
EnderChestBlockEntity enderChestBlockEntity = (EnderChestBlockEntity)blockEntity;
|
||||
@@ -1,27 +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
|
||||
Date: Sat, 16 Nov 2024 08:58:56 -0600
|
||||
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 65012a12e1430956ef55ced56773e6354ac26444..0178017cb2d871dd344e3da910ee724cac05d7e5 100644
|
||||
index b725eea9d3ca81d2ef7802f5d0346d924aa1f808..1d903fa83432ed971f784b8cb244b0c5b163830e 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 {
|
||||
@@ -71,6 +71,7 @@ public final class Biome {
|
||||
long2FloatLinkedOpenHashMap.defaultReturnValue(Float.NaN);
|
||||
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 {
|
||||
@@ -120,6 +121,8 @@ public final class Biome {
|
||||
}
|
||||
|
||||
public boolean shouldFreeze(LevelReader world, BlockPos pos, boolean doWaterCheck) {
|
||||
+ if (canFreeze != null) return canFreeze; // Slice
|
||||
+
|
||||
if (this.warmEnoughToRain(pos)) {
|
||||
if (this.warmEnoughToRain(pos, world.getSeaLevel())) {
|
||||
return false;
|
||||
} else {
|
||||
84
patches/server/0017-Add-Vanish.patch
Normal file
84
patches/server/0017-Add-Vanish.patch
Normal file
@@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 16 Nov 2024 09:10:35 -0600
|
||||
Subject: [PATCH] Add Vanish
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 55b9b33ce85cdff75de8753e6294c99bb1b1f7ee..9bb19124498370c5b5ecaff10f523ee6e391b767 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -389,6 +389,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
private final int despawnTime; // Paper - entity despawn time limit
|
||||
+ public boolean vanished; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -1389,7 +1390,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
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 ddabaed899c755925ad8618b78c33dacaf2126ac..aefa94ffd630e2dd6aefd547664ae25d2a81420c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1306,4 +1306,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
}
|
||||
// Paper end - broadcast hurt animation
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public boolean isVanished() {
|
||||
+ return this.entity.vanished;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setVanished(boolean vanished) {
|
||||
+ this.entity.vanished = vanished;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
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
|
||||
@@ -1,17 +1,17 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 2 May 2023 07:54:02 -0500
|
||||
Date: Sat, 16 Nov 2024 09:14:26 -0600
|
||||
Subject: [PATCH] Add jackson
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index 2e1cea360bb6ff85eb8da54237bc407653eb91f6..475cbb6120655419fc7dc51292e6beedfe778656 100644
|
||||
index 63aa7a91dad0903383405c2cccf894d23a2ede54..fcc93b891c04d8b340b29a8b96e939df9b58839a 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -19,6 +19,13 @@ dependencies {
|
||||
exclude("io.papermc.paper", "paper-api")
|
||||
}
|
||||
// Slice end
|
||||
@@ -26,6 +26,13 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
|
||||
|
||||
dependencies {
|
||||
implementation(project(":slice-api"))
|
||||
+
|
||||
+ // Slice start - JSON logging for DataDog ingestion
|
||||
+ implementation("com.fasterxml.jackson.core:jackson-core:2.13.0")
|
||||
@@ -20,5 +20,5 @@ index 2e1cea360bb6ff85eb8da54237bc407653eb91f6..475cbb6120655419fc7dc51292e6beed
|
||||
+ // Slice end
|
||||
+
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
|
||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||
@@ -1,21 +0,0 @@
|
||||
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);
|
||||
73
patches/server/0019-Add-ObjectId.patch
Normal file
73
patches/server/0019-Add-ObjectId.patch
Normal file
@@ -0,0 +1,73 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 16 Nov 2024 09:22:24 -0600
|
||||
Subject: [PATCH] Add ObjectId
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index fcc93b891c04d8b340b29a8b96e939df9b58839a..4893e10810583c12f6b34ec63d96bc8477264415 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -33,6 +33,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-ffm:3.27.1") // use ffm on java 22+
|
||||
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9bb19124498370c5b5ecaff10f523ee6e391b767..77cc9ae3f5d71454c3b75c44cf53bcfbc5f3eb84 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -223,7 +223,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// 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 e345cdbfab44a0f5da80d738798dbb4424b7ab5c..ba1280382f2b95ea2cb412d3a15789affc65bb12 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -73,6 +73,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);
|
||||
@@ -81,6 +82,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
this.enderChest = new CraftInventory(entity.getEnderChestInventory());
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public org.bson.types.ObjectId getObjectId() {
|
||||
+ return objectId;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setObjectId(org.bson.types.ObjectId objectId) {
|
||||
+ this.objectId = objectId;
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
@Override
|
||||
public PlayerInventory getInventory() {
|
||||
return this.inventory;
|
||||
@@ -1,19 +0,0 @@
|
||||
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();
|
||||
@@ -1,14 +1,14 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 6 Jun 2023 07:51:32 -0500
|
||||
Date: Sat, 16 Nov 2024 09:26:55 -0600
|
||||
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 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac23f4570f 100644
|
||||
index 0f99733660f91280e4c6262cf75b3c9cae86f65a..8845497071ca3be0e439b454f1f2d14f0f74e842 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 {
|
||||
@@ -63,15 +63,29 @@ public class SynchedEntityData {
|
||||
}
|
||||
|
||||
public <T> void set(EntityDataAccessor<T> key, T value, boolean force) {
|
||||
@@ -39,8 +39,8 @@ index 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac
|
||||
}
|
||||
|
||||
// CraftBukkit start - add method from above
|
||||
@@ -215,6 +229,26 @@ public class SynchedEntityData {
|
||||
return list;
|
||||
@@ -108,6 +122,26 @@ public class SynchedEntityData {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Slice start
|
||||
@@ -48,7 +48,7 @@ index 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac
|
||||
+ public List<SynchedEntityData.DataValue<?>> packForeignDirty() {
|
||||
+ List<SynchedEntityData.DataValue<?>> list = null;
|
||||
+
|
||||
+ for (DataItem<?> dataItem : this.itemsById.values()) {
|
||||
+ for (DataItem<?> dataItem : this.itemsById) {
|
||||
+ if (dataItem.isDirty(true)) {
|
||||
+ dataItem.setForeignDirty(false);
|
||||
+ if (list == null) {
|
||||
@@ -66,7 +66,7 @@ index 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac
|
||||
@Nullable
|
||||
public List<SynchedEntityData.DataValue<?>> getNonDefaultValues() {
|
||||
List<SynchedEntityData.DataValue<?>> list = null;
|
||||
@@ -336,11 +370,14 @@ public class SynchedEntityData {
|
||||
@@ -171,11 +205,14 @@ public class SynchedEntityData {
|
||||
T value;
|
||||
private final T initialValue;
|
||||
private boolean dirty;
|
||||
@@ -81,11 +81,12 @@ index 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac
|
||||
}
|
||||
|
||||
public EntityDataAccessor<T> getAccessor() {
|
||||
@@ -370,6 +407,35 @@ public class SynchedEntityData {
|
||||
@@ -205,6 +242,36 @@ 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);
|
||||
@@ -116,12 +117,12 @@ index 5dfb35117c285e0b202dc9c088ad5848beb8d054..b3d2cbf9f60c4a4b34df20bfe45a80ac
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
public static record DataValue<T>(int id, EntityDataSerializer<T> serializer, T value) { // CraftBukkit - decompile error
|
||||
public static record DataValue<T>(int id, EntityDataSerializer<T> serializer, T value) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 196280f54e397c69d32bd4d1f6ae666efdd93773..a514a1f26e439b5959093488ec9905fec327a404 100644
|
||||
index a6c3beb9d5ab87fca882e1761983ebe385011296..112a8c0840ded4156782a6bab7550d4696b02c6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -381,7 +381,20 @@ public class ServerEntity {
|
||||
@@ -434,7 +434,20 @@ public class ServerEntity {
|
||||
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
@@ -144,10 +145,10 @@ index 196280f54e397c69d32bd4d1f6ae666efdd93773..a514a1f26e439b5959093488ec9905fe
|
||||
|
||||
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 6d6baa82bb7a67c3f6de4bdb0987e4d1f68b6ec8..b23b6be85496d031b81b2d3abb9690322c340a80 100644
|
||||
index 77cc9ae3f5d71454c3b75c44cf53bcfbc5f3eb84..a46df2ccbae85cdbdb7a19825a89c1797337d270 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3272,7 +3272,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3670,7 +3670,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
|
||||
return;
|
||||
}
|
||||
@@ -156,24 +157,11 @@ index 6d6baa82bb7a67c3f6de4bdb0987e4d1f68b6ec8..b23b6be85496d031b81b2d3abb969032
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d0e49ae973a91344f3973dc6e00e7e6c649e87cb..b7c9876eaff4365d136a9af20c1a5845b3094336 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3127,7 +3127,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public boolean equipmentHasChanged(ItemStack stack, ItemStack stack2) {
|
||||
- return !ItemStack.isSame(stack2, stack);
|
||||
+ return !ItemStack.isSameItem(stack2, stack);
|
||||
}
|
||||
|
||||
private void handleHandSwap(Map<EquipmentSlot, ItemStack> equipmentChanges) {
|
||||
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 38e110a226aac27d86dfe89bc0e9ecaada6ff268..15515e871c89498ec936ab24871741f883f18a3b 100644
|
||||
index 551da84c834132d106457c123e1b195e4be904b8..e4041c58a23d3eaefd01402635f714404f3c82cf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -643,7 +643,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -676,7 +676,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
@@ -181,17 +169,17 @@ index 38e110a226aac27d86dfe89bc0e9ecaada6ff268..15515e871c89498ec936ab24871741f8
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
public void startAutoSpinAttack(int riptideTicks) {
|
||||
public void startAutoSpinAttack(int riptideTicks, float riptideAttackDamage, ItemStack stack) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 0af1801085701437f06c9ecaf8864fe875e90509..48402f6be39ca1fe65453ca3ab3b995ad33051b0 100644
|
||||
index 973726a3429498b19bf36915b2e84ff29a203704..b4d72cbcbb9caa10e07fc07278d85fdc87f40102 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -2593,7 +2593,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -2864,7 +2864,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 = getMaxHealth();
|
||||
this.getHandle().maxHealthCache = this.getMaxHealth();
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
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 58152160d609d0e9d105153aeb166a56a7955603..5d52d8821edc8dd2cac3391081a223811297faf8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1277,10 +1277,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 - conflict 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 - conflict on change // Slice
|
||||
|
||||
- flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper
|
||||
- flag2 = flag2 && !this.isSprinting();
|
||||
+ flag2 = flag2 && !level().paperConfig().entities.behavior.disablePlayerCrits; // Paper
|
||||
+ flag2 = forceCrit || (flag2 && !this.isSprinting()); // Slice
|
||||
if (flag2) {
|
||||
f *= 1.5F;
|
||||
}
|
||||
@@ -2411,27 +2412,6 @@ public abstract class Player extends LivingEntity {
|
||||
this.lastDeathLocation = lastDeathPos;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public float getHurtDir() {
|
||||
- return this.hurtDir;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void animateHurt(float yaw) {
|
||||
- super.animateHurt(yaw);
|
||||
- this.hurtDir = yaw;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public boolean canSprint() {
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- protected float getFlyingSpeed() {
|
||||
- return this.abilities.flying && !this.isPassenger() ? (this.isSprinting() ? this.abilities.getFlyingSpeed() * 2.0F : this.abilities.getFlyingSpeed()) : (this.isSprinting() ? 0.025999999F : 0.02F);
|
||||
- }
|
||||
-
|
||||
public static enum BedSleepingProblem {
|
||||
|
||||
NOT_POSSIBLE_HERE, NOT_POSSIBLE_NOW(Component.translatable("block.minecraft.bed.no_sleep")), TOO_FAR_AWAY(Component.translatable("block.minecraft.bed.too_far_away")), OBSTRUCTED(Component.translatable("block.minecraft.bed.obstructed")), OTHER_PROBLEM, NOT_SAFE(Component.translatable("block.minecraft.bed.not_safe"));
|
||||
@@ -1,14 +1,14 @@
|
||||
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
|
||||
Date: Sat, 16 Nov 2024 09:34:15 -0600
|
||||
Subject: [PATCH] Add PlayerLoadStatsEvent Fix patch
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 97c6f1c622af02b3761b23a4d3a67b385e45ea84..7f059a71d25170e8e3215c7d91ab7927394cfeb5 100644
|
||||
index 2c1781a45828ef8018e976a445984197f0df1445..46f060f33fcbc6a4568a7fcfba29e83a4d192578 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1474,7 +1474,7 @@ public abstract class PlayerList {
|
||||
@@ -1414,7 +1414,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ index 97c6f1c622af02b3761b23a4d3a67b385e45ea84..7f059a71d25170e8e3215c7d91ab7927
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 8afd9b785fb8734255e3ea926b8375bb9cae60be..9bd42eac43f068df8f7f49249bb47840d87d799a 100644
|
||||
index da7e1a69ecb4e6b3be2d8544ac406aa519bd196e..6947650f299f99402a4a8d9c8384eb9f71a8e3a6 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -45,7 +45,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -45,10 +45,16 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
private final File file;
|
||||
private final Set<Stat<?>> dirty = Sets.newHashSet();
|
||||
|
||||
@@ -29,26 +29,29 @@ index 8afd9b785fb8734255e3ea926b8375bb9cae60be..9bd42eac43f068df8f7f49249bb47840
|
||||
+ public ServerStatsCounter(MinecraftServer server, File file, java.util.UUID uuid) { // Slice
|
||||
this.server = server;
|
||||
this.file = file;
|
||||
// Spigot start
|
||||
@@ -55,7 +55,13 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
this.stats.put( wrapper, entry.getValue().intValue() );
|
||||
}
|
||||
// Spigot end
|
||||
- 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));
|
||||
+ JsonObject providedJson = event.getStatistics();
|
||||
+ if (providedJson != null) {
|
||||
+ parseLocal(server.getFixerUpper(), providedJson);
|
||||
+ } else if (file.isFile()) { // Slice end
|
||||
try {
|
||||
this.parseLocal(server.getFixerUpper(), FileUtils.readFileToString(file));
|
||||
} catch (IOException ioexception) {
|
||||
@@ -103,46 +109,8 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
@@ -101,77 +107,59 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
try {
|
||||
JsonReader jsonreader = new JsonReader(new StringReader(json));
|
||||
|
||||
if (!jsonelement.isJsonNull()) {
|
||||
CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonelement.getAsJsonObject());
|
||||
- label48:
|
||||
- {
|
||||
- try {
|
||||
- jsonreader.setLenient(false);
|
||||
- JsonElement jsonelement = Streams.parse(jsonreader);
|
||||
-
|
||||
- if (!jsonelement.isJsonNull()) {
|
||||
- CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonelement.getAsJsonObject());
|
||||
-
|
||||
- nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343));
|
||||
- if (!nbttagcompound.contains("stats", 10)) {
|
||||
@@ -66,7 +69,7 @@ index 8afd9b785fb8734255e3ea926b8375bb9cae60be..9bd42eac43f068df8f7f49249bb47840
|
||||
- String s1 = (String) iterator.next();
|
||||
-
|
||||
- if (nbttagcompound1.contains(s1, 10)) {
|
||||
- Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(new ResourceLocation(s1)), (statisticwrapper) -> {
|
||||
- Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(ResourceLocation.parse(s1)), (statisticwrapper) -> {
|
||||
- CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1);
|
||||
- Iterator iterator1 = nbttagcompound2.getAllKeys().iterator();
|
||||
-
|
||||
@@ -89,57 +92,71 @@ index 8afd9b785fb8734255e3ea926b8375bb9cae60be..9bd42eac43f068df8f7f49249bb47840
|
||||
- });
|
||||
- }
|
||||
- }
|
||||
+ readStats(dataFixer, nbttagcompound);
|
||||
+ break label48;
|
||||
}
|
||||
- }
|
||||
-
|
||||
- ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file);
|
||||
- } catch (Throwable throwable) {
|
||||
- try {
|
||||
- jsonreader.close();
|
||||
- } catch (Throwable throwable1) {
|
||||
- throwable.addSuppressed(throwable1);
|
||||
- }
|
||||
+ // Slice start
|
||||
+ try {
|
||||
+ jsonreader.setLenient(false);
|
||||
+ JsonElement jsonelement = Streams.parse(jsonreader);
|
||||
|
||||
ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file);
|
||||
@@ -167,6 +135,48 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
- throw throwable;
|
||||
+ if (!jsonelement.isJsonNull()) {
|
||||
+ parseLocal(dataFixer, jsonelement.getAsJsonObject()); // Slice
|
||||
+ }
|
||||
+ } catch (Throwable throwable) {
|
||||
+ try {
|
||||
+ jsonreader.close();
|
||||
+ } catch (Throwable throwable1) {
|
||||
+ throwable.addSuppressed(throwable1);
|
||||
}
|
||||
|
||||
}
|
||||
- jsonreader.close();
|
||||
- return;
|
||||
+ throw throwable;
|
||||
}
|
||||
|
||||
+ private void readStats(DataFixer dataFixer, CompoundTag nbttagcompound) {
|
||||
jsonreader.close();
|
||||
} catch (IOException | JsonParseException jsonparseexception) {
|
||||
ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", this.file, jsonparseexception);
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ public void parseLocal(DataFixer dataFixer, JsonObject jsonObject) {
|
||||
+ CompoundTag nbttagcompound = ServerStatsCounter.fromJson(jsonObject);
|
||||
+ nbttagcompound = DataFixTypes.STATS.updateToCurrentVersion(dataFixer, nbttagcompound, NbtUtils.getDataVersion(nbttagcompound, 1343));
|
||||
+ if (!nbttagcompound.contains("stats", 10)) {
|
||||
+ ServerStatsCounter.LOGGER.error("Unable to parse Stat data from {}", jsonObject);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
||||
+ CompoundTag nbttagcompound1 = nbttagcompound.getCompound("stats");
|
||||
+ Iterator iterator = nbttagcompound1.getAllKeys().iterator();
|
||||
+
|
||||
+ while (true) {
|
||||
+ if (!iterator.hasNext()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ String s1 = (String) iterator.next();
|
||||
+
|
||||
+ for (String s1 : nbttagcompound1.getAllKeys()) {
|
||||
+ if (nbttagcompound1.contains(s1, 10)) {
|
||||
+ Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(new ResourceLocation(s1)), (statisticwrapper) -> {
|
||||
+ Util.ifElse(BuiltInRegistries.STAT_TYPE.getOptional(ResourceLocation.parse(s1)), (statisticwrapper) -> {
|
||||
+ CompoundTag nbttagcompound2 = nbttagcompound1.getCompound(s1);
|
||||
+ Iterator iterator1 = nbttagcompound2.getAllKeys().iterator();
|
||||
+
|
||||
+ while (iterator1.hasNext()) {
|
||||
+ String s2 = (String) iterator1.next();
|
||||
+
|
||||
+ for (String s2 : nbttagcompound2.getAllKeys()) {
|
||||
+ 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);
|
||||
+ });
|
||||
+ 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);
|
||||
+ });
|
||||
+ }, () -> ServerStatsCounter.LOGGER.warn("Invalid statistic type in {}: Don't know what {} is", this.file, s1));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
}
|
||||
+ // Slice end
|
||||
|
||||
private <T> Optional<Stat<T>> getStat(StatType<T> type, String id) {
|
||||
// CraftBukkit - decompile error start
|
||||
Optional<ResourceLocation> optional = Optional.ofNullable(ResourceLocation.tryParse(id));
|
||||
@@ -1,23 +0,0 @@
|
||||
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 5d52d8821edc8dd2cac3391081a223811297faf8..38e110a226aac27d86dfe89bc0e9ecaada6ff268 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1269,7 +1269,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
|
||||
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 17 Nov 2024 08:24:22 -0600
|
||||
Subject: [PATCH] Expose getBlockPosBelowThatAffectsMyMovement
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index aefa94ffd630e2dd6aefd547664ae25d2a81420c..0a34c8fb259ac9d3bfba518521d9137495509b96 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -28,6 +28,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;
|
||||
@@ -1318,4 +1319,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
|
||||
}
|
||||
68
patches/server/0023-Add-DimensionDataStorageEvents.patch
Normal file
68
patches/server/0023-Add-DimensionDataStorageEvents.patch
Normal file
@@ -0,0 +1,68 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 17 Nov 2024 09:19:41 -0600
|
||||
Subject: [PATCH] Add DimensionDataStorageEvents
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index d16f124e0371ce943298c8d7d9bfac21e98cf885..74de7e040ebccb000aa258238ed0bc41dec3754f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -1,12 +1,12 @@
|
||||
package net.minecraft.world.level.storage;
|
||||
|
||||
+import ca.spottedleaf.dataconverter.minecraft.converters.custom.V3818_Commands;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import com.mojang.logging.LogUtils;
|
||||
+import io.papermc.paper.event.server.DimensionDataStorageSaveEvent;
|
||||
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
|
||||
-import java.io.DataInputStream;
|
||||
-import java.io.IOException;
|
||||
-import java.io.InputStream;
|
||||
-import java.io.PushbackInputStream;
|
||||
+
|
||||
+import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashMap;
|
||||
@@ -128,29 +128,34 @@ public class DimensionDataStorage implements AutoCloseable {
|
||||
}
|
||||
|
||||
public CompletableFuture<?> scheduleSave() {
|
||||
- Map<Path, CompoundTag> map = this.collectDirtyTagsToSave();
|
||||
+ Map<String, CompoundTag> map = this.collectDirtyTagsToSave();
|
||||
if (map.isEmpty()) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
} else {
|
||||
this.pendingWriteFuture = this.pendingWriteFuture
|
||||
.thenCompose(
|
||||
v -> CompletableFuture.allOf(
|
||||
- map.entrySet().stream().map(entry -> tryWriteAsync(entry.getKey(), entry.getValue())).toArray(CompletableFuture[]::new)
|
||||
+ map.entrySet().stream().map(entry -> tryWriteAsync(entry.getKey(), this.getDataFile(entry.getKey()), entry.getValue())).toArray(CompletableFuture[]::new)
|
||||
)
|
||||
);
|
||||
return this.pendingWriteFuture;
|
||||
}
|
||||
}
|
||||
|
||||
- private Map<Path, CompoundTag> collectDirtyTagsToSave() {
|
||||
- Map<Path, CompoundTag> map = new Object2ObjectArrayMap<>();
|
||||
- this.cache.forEach((id, state) -> state.filter(SavedData::isDirty).ifPresent(state2 -> map.put(this.getDataFile(id), state2.save(this.registries))));
|
||||
+ private Map<String, CompoundTag> collectDirtyTagsToSave() {
|
||||
+ Map<String, CompoundTag> map = new Object2ObjectArrayMap<>();
|
||||
+ this.cache.forEach((id, state) -> state.filter(SavedData::isDirty).ifPresent(state2 -> map.put(id, state2.save(this.registries))));
|
||||
return map;
|
||||
}
|
||||
|
||||
- private static CompletableFuture<Void> tryWriteAsync(Path path, CompoundTag nbt) {
|
||||
+ private static CompletableFuture<Void> tryWriteAsync(String id, Path path, CompoundTag nbt) {
|
||||
return CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
+ ByteArrayOutputStream buf = new ByteArrayOutputStream();
|
||||
+ NbtIo.writeCompressed(nbt, buf);
|
||||
+ DimensionDataStorageSaveEvent event = new DimensionDataStorageSaveEvent(id, buf);
|
||||
+ if (!event.callEvent()) return;
|
||||
+
|
||||
NbtIo.writeCompressed(nbt, path);
|
||||
} catch (IOException var3) {
|
||||
LOGGER.error("Could not save data to {}", path.getFileName(), var3);
|
||||
@@ -1,31 +0,0 @@
|
||||
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 a87f6380b2c387fb0cdd40d5087b5c93492e3c88..cd35c2136a638c07fed683a2f92e70aa57bcfa8e 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
@@ -809,7 +809,7 @@ public final class CollisionUtil {
|
||||
|
||||
public static boolean getEntityHardCollisions(final CollisionGetter getter, final Entity entity, AABB aabb,
|
||||
final List<AABB> into, final boolean checkOnly, final Predicate<Entity> predicate) {
|
||||
- if (isEmpty(aabb) || !(getter instanceof EntityGetter entityGetter)) {
|
||||
+ if ((entity != null && entity.noEntityCollisions) || isEmpty(aabb) || !(getter instanceof EntityGetter entityGetter)) { // Slice
|
||||
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 a0f8740c93fe86d4c49b9e43f1044ef03d8e3de7..6d6baa82bb7a67c3f6de4bdb0987e4d1f68b6ec8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -453,6 +453,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
* 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<>());
|
||||
{
|
||||
67
patches/server/0024-Add-PlayerData-Events.patch
Normal file
67
patches/server/0024-Add-PlayerData-Events.patch
Normal file
@@ -0,0 +1,67 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom <cryptite@gmail.com>
|
||||
Date: Mon, 18 Nov 2024 08:34:27 -0600
|
||||
Subject: [PATCH] Add PlayerData Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/stats/ServerStatsCounter.java b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
index 6947650f299f99402a4a8d9c8384eb9f71a8e3a6..299fcc2ecb17f8d42ff3480ec9868127faa9b0fc 100644
|
||||
--- a/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
+++ b/src/main/java/net/minecraft/stats/ServerStatsCounter.java
|
||||
@@ -192,7 +192,12 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
- protected String toJson() {
|
||||
+ // Slice start - OBFHELPER
|
||||
+ public String toJson() {
|
||||
+ return serialize().toString();
|
||||
+ }
|
||||
+
|
||||
+ public JsonObject serialize() { // Slice end
|
||||
Map<StatType<?>, JsonObject> map = Maps.newHashMap();
|
||||
ObjectIterator objectiterator = this.stats.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -218,7 +223,7 @@ public class ServerStatsCounter extends StatsCounter {
|
||||
|
||||
jsonobject1.add("stats", jsonobject);
|
||||
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 b148cf247acdd36f856d0495cde4cc5ad32b5a2f..f9403d73ae2400e148a76bf79661e2e96fe7a6cc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
|
||||
@@ -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());
|
||||
Path path = this.playerDir.toPath();
|
||||
@@ -108,6 +109,21 @@ public class PlayerDataStorage {
|
||||
}
|
||||
|
||||
public Optional<CompoundTag> load(Player player) {
|
||||
+ // Slice start - If event supplies playerdata, use it. Otherwise just load from disk as usual
|
||||
+ com.destroystokyo.paper.event.player.PlayerLoadDataEvent event = new com.destroystokyo.paper.event.player.PlayerLoadDataEvent(player.getUUID());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ Object playerData = event.getPlayerData();
|
||||
+ if (playerData instanceof CompoundTag data) {
|
||||
+ data = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.PLAYER,
|
||||
+ data,
|
||||
+ NbtUtils.getDataVersion(data, -1),
|
||||
+ net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion()); // Paper - rewrite data conversion system
|
||||
+ player.load(data);
|
||||
+ return Optional.of(data);
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
// CraftBukkit start
|
||||
return this.load(player.getName().getString(), player.getStringUUID()).map((nbttagcompound) -> {
|
||||
if (player instanceof ServerPlayer) {
|
||||
@@ -1,42 +0,0 @@
|
||||
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 1e33434f9f361542e03da3e4812bc6d76768a202..828d9472bf90fe098825c15bc55949497a40ae39 100644
|
||||
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
||||
@@ -338,7 +338,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);
|
||||
});
|
||||
@@ -365,14 +365,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
|
||||
61
patches/server/0025-Non-saveable-entities.patch
Normal file
61
patches/server/0025-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: Mon, 18 Nov 2024 11:20:07 -0600
|
||||
Subject: [PATCH] Non-saveable-entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
index b3c993a790fc3fab6a408c731deb297f74c959ce..7c1d4b08cbd41b70e712a636321ff9d73541ed8c 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
@@ -161,7 +161,7 @@ public final class ChunkEntitySlices {
|
||||
// removed by us below
|
||||
continue;
|
||||
}
|
||||
- if (entity.shouldBeSaved()) {
|
||||
+ if (entity.shouldBeSaved() || !entity.saveable) { // Slice
|
||||
PlatformHooks.get().unloadEntity(entity);
|
||||
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 a46df2ccbae85cdbdb7a19825a89c1797337d270..b878b2559d3957055702d8281846196732909ebd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -400,6 +400,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public boolean fixedPose = false; // Paper - Expand Pose API
|
||||
private final int despawnTime; // Paper - entity despawn time limit
|
||||
public boolean vanished; // Slice
|
||||
+ public boolean saveable = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -5210,6 +5211,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
@Override
|
||||
public boolean shouldBeSaved() {
|
||||
+ if (!this.saveable) return false; // Slice
|
||||
return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity)this).moonrise$hasAnyPlayerPassengers()); // Paper - rewrite chunk system
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 0a34c8fb259ac9d3bfba518521d9137495509b96..1f0a4a89815bf8110e7c02d2d3325e47fc9c2abe 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1327,4 +1327,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return this.entity.level().getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
// Slice end
|
||||
+
|
||||
+
|
||||
+ // Slice start
|
||||
+ @Override
|
||||
+ public boolean isSaveable() {
|
||||
+ return this.entity.saveable;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setSaveable(boolean saveable) {
|
||||
+ this.entity.saveable = saveable;
|
||||
+ }
|
||||
+ // Slice end
|
||||
}
|
||||
53
patches/server/0026-Map-Events.patch
Normal file
53
patches/server/0026-Map-Events.patch
Normal file
@@ -0,0 +1,53 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 2 Dec 2024 11:52:34 -0600
|
||||
Subject: [PATCH] Map Events
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index e256e5ff5c167c6cff5b9e985cdc80d5c9203708..5f0439860468283dcdcce17fefc22c5e088b8dc4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2119,6 +2119,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
|
||||
@Override
|
||||
public MapId getFreeMapId() {
|
||||
+ // Slice start
|
||||
+ io.papermc.paper.event.server.MapGetFreeIndexEvent event = new io.papermc.paper.event.server.MapGetFreeIndexEvent();
|
||||
+ event.callEvent();
|
||||
+ int newIndex = event.getIndex();
|
||||
+ if (newIndex != -1) {
|
||||
+ return new MapId(newIndex);
|
||||
+ }
|
||||
+ // Slice end
|
||||
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex.factory(), "idcounts")).getFreeAuxValueForMap();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index 4f256e61f858020f32e7a66664375ba05a57826b..f1eefed0282c2f5af125c6579fd5311d6e7f78b9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -70,6 +70,23 @@ public class DimensionDataStorage implements AutoCloseable {
|
||||
@Nullable
|
||||
private <T extends SavedData> T readSavedData(BiFunction<CompoundTag, HolderLookup.Provider, T> readFunction, DataFixTypes dataFixTypes, String id) {
|
||||
try {
|
||||
+ // Slice start
|
||||
+ if (id.startsWith("map_")) {
|
||||
+ int mapId = Integer.parseInt(id.split("map_")[1]);
|
||||
+ io.papermc.paper.event.server.MapLoadEvent event = new io.papermc.paper.event.server.MapLoadEvent(mapId);
|
||||
+ event.callEvent();
|
||||
+ ByteArrayInputStream buf = event.getBuf();
|
||||
+ if (buf != null) {
|
||||
+ try {
|
||||
+ CompoundTag tag = NbtIo.readCompressed(buf, NbtAccounter.unlimitedHeap());
|
||||
+ return readFunction.apply(tag.getCompound("data"), this.registries);
|
||||
+ } catch (IOException e) {
|
||||
+ LOGGER.error("Error loading saved data: {}", id, e);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
Path path = this.getDataFile(id);
|
||||
if (Files.exists(path)) {
|
||||
CompoundTag compoundTag = this.readTagFromDisk(id, dataFixTypes, SharedConstants.getCurrentVersion().getDataVersion().getVersion());
|
||||
@@ -1,37 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 6 May 2023 18:14:26 -0500
|
||||
Subject: [PATCH] Maybe can't tostring?
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
index 7e94ebe06fc62293e665d6db19e42d947e7eb30f..158c012b8a6808ca0f820c2997af282529148c7c 100644
|
||||
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
@@ -466,6 +466,9 @@ public class CompoundTag implements Tag {
|
||||
@Override
|
||||
public CompoundTag copy() {
|
||||
// Paper start - reduce memory footprint of NBTTagCompound
|
||||
+ if (this.tags.size() < 0) {
|
||||
+ net.minecraft.server.MinecraftServer.LOGGER.debug("Tried to copy an invalid item with negative tags: {}, {}, {}, {}", this.tags, this.tags.getClass().getName());
|
||||
+ }
|
||||
it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, Tag> ret = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(this.tags.size(), 0.8f);
|
||||
java.util.Iterator<java.util.Map.Entry<String, Tag>> iterator = (this.tags instanceof it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap) ? ((it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap)this.tags).object2ObjectEntrySet().fastIterator() : this.tags.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 2b3b1c5ccdf58ee9b46d404cfa3790d0fdc2df3d..b31f21e2d9faa00174bbcbbd1e0cf1b22c8b69d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -736,7 +736,11 @@ public final class ItemStack {
|
||||
|
||||
itemstack.setPopTime(this.getPopTime());
|
||||
if (this.tag != null) {
|
||||
- itemstack.tag = this.tag.copy();
|
||||
+ if (this.tag.tags.size() < 0) {
|
||||
+ ItemStack.LOGGER.debug("Tried to copy an invalid item with negative tags: {}, {}, {}, {}", this.tag, this.tag.tags, this.tag.tags.getClass().getName());
|
||||
+ } else {
|
||||
+ itemstack.tag = this.tag.copy();
|
||||
+ }
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
51
patches/server/0027-PlayerInsertBundleItemEvent.patch
Normal file
51
patches/server/0027-PlayerInsertBundleItemEvent.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Thu, 12 Dec 2024 15:20:17 -0600
|
||||
Subject: [PATCH] PlayerInsertBundleItemEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index d021cd5b6136f0125076513977f430c6d4dd4f9f..e134cdebde3e3afa6ddce177c949b4fb7a3ed277 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -582,6 +582,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
if (flag && (this.spawnEnemies || this.spawnFriendlies)) {
|
||||
// Paper start - PlayerNaturallySpawnCreaturesEvent
|
||||
for (ServerPlayer entityPlayer : this.level.players()) {
|
||||
+ if (entityPlayer.spawnsOwnMobs) continue; // Slice
|
||||
int chunkRange = Math.min(level.spigotConfig.mobSpawnRange, entityPlayer.getBukkitEntity().getViewDistance());
|
||||
chunkRange = Math.min(chunkRange, 8);
|
||||
entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
|
||||
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 e4041c58a23d3eaefd01402635f714404f3c82cf..6eb9155c3227ae2a69bb7a379af94d6a73cdc6c7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -198,6 +198,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;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java
|
||||
index f1999d904ac66f5349346ad8157f5401fb395e11..56159a23d231028ba671f441fed0f601eedec7be 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BundleItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BundleItem.java
|
||||
@@ -67,6 +67,7 @@ public class BundleItem extends Item {
|
||||
ItemStack itemStack = slot.getItem();
|
||||
BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents);
|
||||
if (clickType == ClickAction.PRIMARY && !itemStack.isEmpty()) {
|
||||
+ if (!new io.papermc.paper.event.player.PlayerInsertBundleItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), stack.getBukkitStack(), itemStack.getBukkitStack()).callEvent()) return false; // Slice
|
||||
if (mutable.tryTransfer(slot, player) > 0) {
|
||||
playInsertSound(player);
|
||||
} else {
|
||||
@@ -110,6 +111,7 @@ public class BundleItem extends Item {
|
||||
} else {
|
||||
BundleContents.Mutable mutable = new BundleContents.Mutable(bundleContents);
|
||||
if (clickType == ClickAction.PRIMARY && !otherStack.isEmpty()) {
|
||||
+ if (!new io.papermc.paper.event.player.PlayerInsertBundleItemEvent((org.bukkit.entity.Player) player.getBukkitEntity(), stack.getBukkitStack(), otherStack.getBukkitStack()).callEvent()) return false; // Slice
|
||||
if (slot.allowModification(player) && mutable.tryInsert(otherStack) > 0) {
|
||||
playInsertSound(player);
|
||||
} else {
|
||||
19
patches/server/0028-Mute-bee-logger-warn.patch
Normal file
19
patches/server/0028-Mute-bee-logger-warn.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Fri, 20 Dec 2024 07:17:20 -0600
|
||||
Subject: [PATCH] Mute bee logger warn
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index c8c2394558952d7ca57d29874485251b8f2b3400..4317275aeb5b3519b6b9a7195e3d997f386349ce 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -660,7 +660,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.getString("id")); // Slice - something about bees
|
||||
});
|
||||
}
|
||||
|
||||
49
patches/server/0029-Add-PlayerPreRespawnEvent.patch
Normal file
49
patches/server/0029-Add-PlayerPreRespawnEvent.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sat, 28 Dec 2024 07:59:54 -0600
|
||||
Subject: [PATCH] Add PlayerPreRespawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 46f060f33fcbc6a4568a7fcfba29e83a4d192578..28b1ec198970b88515b37ef651c90916f3aef347 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -808,19 +808,31 @@ public abstract class PlayerList {
|
||||
// Paper end - Add PlayerPostRespawnEvent
|
||||
|
||||
// CraftBukkit start - fire PlayerRespawnEvent
|
||||
- TeleportTransition teleporttransition;
|
||||
+ TeleportTransition teleporttransition = null;
|
||||
if (location == null) {
|
||||
- teleporttransition = entityplayer.findRespawnPositionAndUseSpawnBlock(!flag, TeleportTransition.DO_NOTHING, reason);
|
||||
+ // Slice start
|
||||
+ io.papermc.paper.event.player.PlayerPreRespawnEvent preRespawnEvent = new io.papermc.paper.event.player.PlayerPreRespawnEvent(entityplayer.getBukkitEntity(), reason);
|
||||
+ if (!preRespawnEvent.callEvent()) return entityplayer;
|
||||
+
|
||||
+ Location respawnLocation = preRespawnEvent.getRespawnLocation();
|
||||
+ if (respawnLocation != null) {
|
||||
+ location = respawnLocation;
|
||||
+ teleporttransition = new TeleportTransition(((CraftWorld) respawnLocation.getWorld()).getHandle(), CraftLocation.toVec3D(respawnLocation), Vec3.ZERO, respawnLocation.getYaw(), respawnLocation.getPitch(), TeleportTransition.DO_NOTHING);
|
||||
+ } else {
|
||||
+ teleporttransition = entityplayer.findRespawnPositionAndUseSpawnBlock(!flag, TeleportTransition.DO_NOTHING, reason);
|
||||
+ }
|
||||
+ // Slice end
|
||||
|
||||
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||
- // Paper start - Add PlayerPostRespawnEvent
|
||||
- if (teleporttransition == null) return entityplayer; // Early exit, mirrors belows early return for disconnected players in respawn event
|
||||
- isRespawn = true;
|
||||
- location = CraftLocation.toBukkit(teleporttransition.position(), teleporttransition.newLevel().getWorld(), teleporttransition.yRot(), teleporttransition.xRot());
|
||||
- // Paper end - Add PlayerPostRespawnEvent
|
||||
+ // Paper start - Add PlayerPostRespawnEvent
|
||||
+ if (teleporttransition == null || entityplayer.connection.isDisconnected()) return entityplayer; // Early exit, mirrors belows early return for disconnected players in respawn event
|
||||
+ isRespawn = true;
|
||||
+ location = CraftLocation.toBukkit(teleporttransition.position(), teleporttransition.newLevel().getWorld(), teleporttransition.yRot(), teleporttransition.xRot());
|
||||
+ // Paper end - Add PlayerPostRespawnEvent
|
||||
} else {
|
||||
teleporttransition = new TeleportTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING);
|
||||
}
|
||||
+
|
||||
// Spigot Start
|
||||
if (teleporttransition == null) { // Paper - Add PlayerPostRespawnEvent - diff on change - spigot early returns if respawn pos is null, that is how they handle disconnected player in respawn event
|
||||
return entityplayer;
|
||||
@@ -1,85 +0,0 @@
|
||||
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 e08b72010f22ce680e88f443782bdfe6a46285f9..3809b2125254424d4939794961a9f08254af54c8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1551,6 +1551,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper end - remove allocation of Vec3D here
|
||||
Vec3 vec3d = player.position().subtract(this.entity.position());
|
||||
double d0 = (double) Math.min(this.getEffectiveRange(), io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player) * 16); // Paper - per player view distance
|
||||
+ 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);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c610111cde3d1cecac661549511742231e1e47c3..069665c210f2c3f8aec8c13c1c0c2ab5c50d3e24 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -279,6 +279,7 @@ public class ServerPlayer extends Player {
|
||||
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper
|
||||
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 boolean hasLongDistanceTracking; // Slice
|
||||
|
||||
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));
|
||||
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
@@ -2656,4 +2657,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 5b5109e942b18418b3a3a0e2109fe4ef15045fe5..507519c75fabe8991cddbc1aa7813cec25dee01b 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 8fca15099952626ee537f5ce3eefdfaa6518dc1b..1ddf149ce3d962905bec8c4562e4d86fbbe6e570 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) {
|
||||
34
patches/server/0030-Fix-authorless-book-loading.patch
Normal file
34
patches/server/0030-Fix-authorless-book-loading.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Sun, 29 Dec 2024 09:09:41 -0600
|
||||
Subject: [PATCH] Fix authorless book loading
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 507f908916cbeb592496f963b46e4c2121a7b5e3..429eea868c749c5aece3e1afb96da760c154cfe1 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.item.ItemParser;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
+import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
@@ -524,6 +525,15 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data);
|
||||
final int dataVersion = compound.getInt("DataVersion");
|
||||
compound = ca.spottedleaf.dataconverter.minecraft.MCDataConverter.convertTag(ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.ITEM_STACK, compound, dataVersion, this.getDataVersion()); // Paper - replace data conversion system
|
||||
+
|
||||
+ CompoundTag components = compound.getCompound("components");
|
||||
+ if (!components.isEmpty()) {
|
||||
+ CompoundTag bookContent = components.getCompound("minecraft:written_book_content");
|
||||
+ if (!bookContent.isEmpty() && !bookContent.getAllKeys().contains("author")) {
|
||||
+ bookContent.putString("author", "");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow());
|
||||
}
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 12 Jun 2023 14:09:36 -0500
|
||||
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 3bc7230ca62ebe3426da293e436a962bb0134f85..a812bd61e0352023cfd44e62a9cf722616ba4358 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
|
||||
@@ -318,6 +318,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 915340fedc6c0b3d70ee065482dbe621b7c0b0a8..fc6fa65dae66d695b5fd732cc495d3649a28862c 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;
|
||||
@@ -310,6 +311,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public volatile Thread shutdownThread; // Paper
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
public boolean isIteratingOverLevels = false; // Paper
|
||||
+ public @Nullable DimensionDataStorage sharedDataStorage; // Slice
|
||||
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
@@ -410,6 +412,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Slice start
|
||||
+ public DimensionDataStorage getMapDataStorage() {
|
||||
+ return sharedDataStorage != null ? sharedDataStorage : overworld().getDataStorage();
|
||||
+ }
|
||||
+ // Slice end
|
||||
+
|
||||
private void readScoreboard(DimensionDataStorage persistentStateManager) {
|
||||
ServerScoreboard scoreboardserver = this.getScoreboard();
|
||||
|
||||
@@ -885,6 +893,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.isSaving = true;
|
||||
this.getPlayerList().saveAll(); // Diff on change
|
||||
flag3 = this.saveAllChunks(suppressLogs, flush, force);
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save(); // Slice
|
||||
} finally {
|
||||
this.isSaving = false;
|
||||
}
|
||||
@@ -1101,6 +1110,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.nextTickTime = Util.getMillis();
|
||||
this.statusIcon = (ServerStatus.Favicon) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
|
||||
this.status = this.buildServerStatus();
|
||||
@@ -1413,6 +1431,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
level.saveIncrementally(fullSave);
|
||||
}
|
||||
}
|
||||
+ if (sharedDataStorage != null) sharedDataStorage.save(); // 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 af0720fb8bd334aac5493121c6373d87421204b4..564591e9f18dd6bb0f76ae4f153adcc0a228d4fa 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2068,7 +2068,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@Override
|
||||
public MapItemSavedData getMapData(String id) {
|
||||
// CraftBukkit start
|
||||
- return (MapItemSavedData) this.getServer().overworld().getDataStorage().get((nbttagcompound) -> {
|
||||
+ return (MapItemSavedData) this.getServer().getMapDataStorage().get((nbttagcompound) -> { // Slice
|
||||
// We only get here when the data file exists, but is not a valid map
|
||||
MapItemSavedData newMap = MapItemSavedData.load(nbttagcompound);
|
||||
newMap.id = id;
|
||||
@@ -2082,12 +2082,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@Override
|
||||
public void setMapData(String id, MapItemSavedData state) {
|
||||
state.id = id; // CraftBukkit
|
||||
- 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::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
|
||||
+ // Slice start
|
||||
+ DimensionDataStorage storage = this.getServer().getMapDataStorage();
|
||||
+ MapIndex mapIndex = storage.readSavedData(MapIndex::load, "idcounts");
|
||||
+ if (mapIndex == null) {
|
||||
+ mapIndex = new MapIndex();
|
||||
+ }
|
||||
+ int newId = mapIndex.getFreeAuxValueForMap();
|
||||
+ storage.set("idcounts", mapIndex);
|
||||
+ storage.save();
|
||||
+ return newId;
|
||||
+ // Slice end
|
||||
}
|
||||
|
||||
// Paper start - helper function for configurable spawn radius
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index defe31a5d3aa89a3d18b94f2ff005594e38754b3..637a86e74d633901fdd2f2f1ba6aa4ed49780ead 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -58,7 +58,7 @@ public class DimensionDataStorage {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- private <T extends SavedData> T readSavedData(Function<CompoundTag, T> readFunction, String id) {
|
||||
+ public <T extends SavedData> T readSavedData(Function<CompoundTag, T> readFunction, String id) { // Slice private -> public
|
||||
try {
|
||||
File file = this.getDataFile(id);
|
||||
if (file.exists()) {
|
||||
30
patches/server/0031-noEntityCollisions-for-Entity.patch
Normal file
30
patches/server/0031-noEntityCollisions-for-Entity.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Tue, 31 Dec 2024 15:21:45 -0600
|
||||
Subject: [PATCH] noEntityCollisions for Entity
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
index fb251665cdbafab90c6ff5e1bcb34fc17124d4d9..0fa6c37eae00d8921d885eae2b777e21bdb4cad2 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
|
||||
@@ -2099,6 +2099,7 @@ public final class CollisionUtil {
|
||||
|
||||
public static boolean getEntityHardCollisions(final Level world, final Entity entity, AABB aabb,
|
||||
final List<AABB> into, final int collisionFlags, final Predicate<Entity> predicate) {
|
||||
+ if (entity != null && entity.noEntityCollisions) return false; // Slice
|
||||
final boolean checkOnly = (collisionFlags & COLLISION_FLAG_CHECK_ONLY) != 0;
|
||||
|
||||
boolean ret = false;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b878b2559d3957055702d8281846196732909ebd..5497e03bf49d87ce1d3418c4815f107c3d194800 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -438,6 +438,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private int sectionY = Integer.MIN_VALUE;
|
||||
private int sectionZ = Integer.MIN_VALUE;
|
||||
private boolean updatingSectionStatus;
|
||||
+ public boolean noEntityCollisions; // Slice
|
||||
|
||||
@Override
|
||||
public final boolean moonrise$isHardColliding() {
|
||||
@@ -1,66 +0,0 @@
|
||||
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 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..286e2ad0887379b5b16ca3ca89a8f0d62be258e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -588,7 +588,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
||||
}), (entity) -> {
|
||||
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 97b763431bc5015448ee7a26a340635a932c950b..e8b748eb16d7409a69dbd364a59dcf217ce701ec 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
|
||||
@@ -110,6 +110,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 46e3cc146a4b109c4baaf94f42d825646abade68..b248150c047890f45fae75716e40e495752f3732 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
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cryptite <cryptite@gmail.com>
|
||||
Date: Mon, 26 Jun 2023 16:45:00 -0500
|
||||
Subject: [PATCH] Save DimensionDataStorage async
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
index 637a86e74d633901fdd2f2f1ba6aa4ed49780ead..8cf3880d9168b5ba6b383ec921bfb490ea51ac38 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java
|
||||
@@ -9,6 +9,8 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PushbackInputStream;
|
||||
import java.util.Map;
|
||||
+import java.util.concurrent.CompletableFuture;
|
||||
+import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -18,11 +20,12 @@ import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.nbt.NbtUtils;
|
||||
import net.minecraft.util.datafix.DataFixTypes;
|
||||
import net.minecraft.world.level.saveddata.SavedData;
|
||||
+import org.bukkit.Bukkit;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class DimensionDataStorage {
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- public final Map<String, SavedData> cache = Maps.newHashMap();
|
||||
+ public final Map<String, SavedData> cache = new ConcurrentHashMap<>();
|
||||
private final DataFixer fixerUpper;
|
||||
private final File dataFolder;
|
||||
|
||||
@@ -51,7 +54,7 @@ public class DimensionDataStorage {
|
||||
SavedData savedData = this.cache.get(id);
|
||||
if (savedData == null && !this.cache.containsKey(id)) {
|
||||
savedData = this.readSavedData(readFunction, id);
|
||||
- this.cache.put(id, savedData);
|
||||
+ if (savedData != null) this.cache.put(id, savedData);
|
||||
}
|
||||
|
||||
return (T)savedData;
|
||||
@@ -119,11 +122,12 @@ public class DimensionDataStorage {
|
||||
}
|
||||
|
||||
public void save() {
|
||||
- this.cache.forEach((id, state) -> {
|
||||
+ // Slice start - run async
|
||||
+ CompletableFuture.runAsync(() -> this.cache.forEach((id, state) -> {
|
||||
if (state != null) {
|
||||
state.save(this.getDataFile(id));
|
||||
}
|
||||
-
|
||||
- });
|
||||
+ }));
|
||||
+ // Slice end
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
index 2ff578e4a953ffcf5176815ba8e3f06f73499989..f9a1b0e3be862cc00370c130621a07be5deebf0c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -193,6 +193,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
||||
|
||||
this.connection.send(new ClientboundDisconnectPacket(ichatmutablecomponent));
|
||||
this.connection.disconnect(ichatmutablecomponent);
|
||||
+ 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,314 +0,0 @@
|
||||
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 3c474c8fc937df5aebfb063be8109053a91e8bb4..2a36bba04d584fdccbb06dc4991064a245082991 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);
|
||||
- RandomizableContainerBlockEntity.setLootTable(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);
|
||||
@@ -1,19 +0,0 @@
|
||||
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/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 42e61e55ef45935e1f690eefa56bc36842cdd974..049c1417968d89ba7b6208339e4a812bc72e007b 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -409,7 +409,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
|
||||
this.disconnect(Component.translatable("disconnect.timeout", new Object[0]), 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;
|
||||
@@ -1,61 +0,0 @@
|
||||
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 7e8dc9e8f381abfdcce2746edc93122d623622d1..303e5ed4d5cf2a64b998656bfd189f19f8c8fcde 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -118,7 +118,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);
|
||||
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 b23b6be85496d031b81b2d3abb9690322c340a80..eb2ef004860c89fba346c8025ae3c645106a21e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -418,6 +418,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
|
||||
public boolean collidingWithWorldBorder; // Paper
|
||||
public boolean fixedPose = false; // Paper
|
||||
+ public boolean saveable = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -4703,7 +4704,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@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 2dbe8b870fd39b4d22e9725912f443757ae70761..0cc2d78c68c87c7dce3fbd40f5ba946d7776daa0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1507,4 +1507,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
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
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 51304c5cf4b0ac7646693ef97ef4a3847d3342b5..21976eeda150d3d7e396ebabdf6416dd65560dbd 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)
|
||||
@@ -1,49 +0,0 @@
|
||||
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 0ac580f3cf8f95025992420702d67ad56db2ba05..676427c69ab445cef3a81628ed34cb6d4f018e8e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -148,7 +148,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;
|
||||
}
|
||||
@@ -183,14 +183,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 eb2ef004860c89fba346c8025ae3c645106a21e6..c955bbc0348dad7ffd4bcc3a5fa17f0de6f1aed6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -419,6 +419,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public boolean collidingWithWorldBorder; // Paper
|
||||
public boolean fixedPose = false; // Paper
|
||||
public boolean saveable = true; // Slice
|
||||
+ public boolean sendMovementPackets = true; // Slice
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -1,45 +0,0 @@
|
||||
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 acbcdc8cb1523044b1657e03a141fae6389a3686..000a2c8d30d7d72a460e2fc6205088b81a8bfe3a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -521,7 +521,7 @@ public class ServerChunkCache extends ChunkSource {
|
||||
// Paper start - optimize isOutisdeRange
|
||||
ChunkMap playerChunkMap = this.chunkMap;
|
||||
for (ServerPlayer player : this.level.players) {
|
||||
- if (!player.affectsSpawning || player.isSpectator()) {
|
||||
+ if (!player.affectsSpawning || player.isSpectator() || player.spawnsOwnMobs) { // Slice
|
||||
playerChunkMap.playerMobSpawnMap.remove(player);
|
||||
continue;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 564591e9f18dd6bb0f76ae4f153adcc0a228d4fa..578535732d442b524536bdd76d6a4badeed84fbd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -770,7 +770,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
// Paper start - optimise checkDespawn
|
||||
this.playersAffectingSpawning.clear();
|
||||
for (ServerPlayer player : this.players) {
|
||||
- if (net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) {
|
||||
+ if (!player.spawnsOwnMobs && net.minecraft.world.entity.EntitySelector.PLAYER_AFFECTS_SPAWNING.test(player)) { // Slice
|
||||
this.playersAffectingSpawning.add(player);
|
||||
}
|
||||
}
|
||||
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 15515e871c89498ec936ab24871741f883f18a3b..16fbdbe12d54fbc8d54403979ee2a89322a14dd2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -188,6 +188,8 @@ public abstract class Player extends LivingEntity {
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
|
||||
// Paper end
|
||||
|
||||
+ public boolean spawnsOwnMobs = false; // Slice
|
||||
+
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
public int oldLevel = -1;
|
||||
@@ -1,42 +0,0 @@
|
||||
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
|
||||
@@ -1,10 +1,59 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
import java.util.Locale
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://repo.papermc.io/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
||||
|
||||
if (!file(".git").exists()) {
|
||||
val errorText = """
|
||||
|
||||
=====================[ ERROR ]=====================
|
||||
The Paper project directory is not a properly cloned Git repository.
|
||||
|
||||
In order to build Paper from source you must clone
|
||||
the Paper repository using Git, not download a code
|
||||
zip from GitHub.
|
||||
|
||||
Built Paper jars are available for download at
|
||||
https://papermc.io/downloads/paper
|
||||
|
||||
See https://github.com/PaperMC/Paper/blob/master/CONTRIBUTING.md
|
||||
for further information on building and modifying Paper.
|
||||
===================================================
|
||||
""".trimIndent()
|
||||
error(errorText)
|
||||
}
|
||||
|
||||
rootProject.name = "slice"
|
||||
|
||||
include("slice-api", "slice-server")
|
||||
for (name in listOf("slice-api", "slice-server")) {
|
||||
val projName = name.lowercase(Locale.ENGLISH)
|
||||
include(projName)
|
||||
findProject(":$projName")!!.projectDir = file(name)
|
||||
}
|
||||
|
||||
optionalInclude("test-plugin")
|
||||
optionalInclude("paper-api-generator")
|
||||
|
||||
fun optionalInclude(name: String, op: (ProjectDescriptor.() -> Unit)? = null) {
|
||||
val settingsFile = file("$name.settings.gradle.kts")
|
||||
if (settingsFile.exists()) {
|
||||
apply(from = settingsFile)
|
||||
findProject(":$name")?.let { op?.invoke(it) }
|
||||
} else {
|
||||
settingsFile.writeText(
|
||||
"""
|
||||
// Uncomment to enable the '$name' project
|
||||
// include(":$name")
|
||||
|
||||
""".trimIndent()
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user