mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
1.21.3 (#382)
--------- Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
@@ -54,6 +56,7 @@ ij_java_blank_lines_after_package = 1
|
||||
ij_java_blank_lines_around_class = 1
|
||||
ij_java_blank_lines_around_field = 0
|
||||
ij_java_blank_lines_around_field_in_interface = 0
|
||||
ij_java_blank_lines_around_field_with_annotations = 0
|
||||
ij_java_blank_lines_around_initializer = 1
|
||||
ij_java_blank_lines_around_method = 1
|
||||
ij_java_blank_lines_around_method_in_interface = 1
|
||||
@@ -131,6 +134,7 @@ ij_java_for_statement_right_paren_on_new_line = false
|
||||
ij_java_for_statement_wrap = off
|
||||
ij_java_generate_final_locals = false
|
||||
ij_java_generate_final_parameters = false
|
||||
ij_java_generate_use_type_annotation_before_type = true
|
||||
ij_java_if_brace_force = never
|
||||
ij_java_imports_layout = *, |, javax.**, java.**, |, $*
|
||||
ij_java_indent_case_from_switch = true
|
||||
@@ -276,6 +280,7 @@ ij_java_spaces_around_relational_operators = true
|
||||
ij_java_spaces_around_shift_operators = true
|
||||
ij_java_spaces_around_type_bounds_in_type_parameters = true
|
||||
ij_java_spaces_around_unary_operator = false
|
||||
ij_java_spaces_inside_block_braces_when_body_is_present = false
|
||||
ij_java_spaces_within_angle_brackets = false
|
||||
ij_java_spaces_within_annotation_parentheses = false
|
||||
ij_java_spaces_within_array_initializer_braces = false
|
||||
@@ -307,7 +312,7 @@ ij_java_test_name_suffix = Test
|
||||
ij_java_throws_keyword_wrap = off
|
||||
ij_java_throws_list_wrap = off
|
||||
ij_java_use_external_annotations = false
|
||||
ij_java_use_fq_class_names = false
|
||||
ij_java_use_fq_class_names = true
|
||||
ij_java_use_relative_indents = false
|
||||
ij_java_use_single_class_imports = true
|
||||
ij_java_variable_annotation_wrap = off
|
||||
@@ -393,6 +398,7 @@ ij_kotlin_finally_on_new_line = false
|
||||
ij_kotlin_if_rparen_on_new_line = true
|
||||
ij_kotlin_import_nested_classes = false
|
||||
ij_kotlin_imports_layout = *, java.**, javax.**, kotlin.**, ^
|
||||
ij_kotlin_indent_before_arrow_on_new_line = true
|
||||
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
|
||||
ij_kotlin_keep_blank_lines_before_right_brace = 2
|
||||
ij_kotlin_keep_blank_lines_in_code = 2
|
||||
@@ -428,6 +434,7 @@ ij_kotlin_space_before_when_parentheses = true
|
||||
ij_kotlin_space_before_while_parentheses = true
|
||||
ij_kotlin_spaces_around_additive_operators = true
|
||||
ij_kotlin_spaces_around_assignment_operators = true
|
||||
ij_kotlin_spaces_around_elvis = true
|
||||
ij_kotlin_spaces_around_equality_operators = true
|
||||
ij_kotlin_spaces_around_function_type_arrow = true
|
||||
ij_kotlin_spaces_around_logical_operators = true
|
||||
@@ -521,6 +528,9 @@ ij_yaml_block_mapping_on_new_line = false
|
||||
ij_yaml_indent_sequence_value = true
|
||||
ij_yaml_keep_indents_on_empty_lines = false
|
||||
ij_yaml_keep_line_breaks = true
|
||||
ij_yaml_line_comment_add_space = false
|
||||
ij_yaml_line_comment_add_space_on_reformat = false
|
||||
ij_yaml_line_comment_at_first_column = true
|
||||
ij_yaml_sequence_on_new_line = false
|
||||
ij_yaml_space_before_colon = false
|
||||
ij_yaml_spaces_within_braces = true
|
||||
|
||||
@@ -30,7 +30,7 @@ maven {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.leavesmc.leaves:leaves-api:1.21.1-R0.1-SNAPSHOT")
|
||||
compileOnly("org.leavesmc.leaves:leaves-api:1.21.3-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -40,7 +40,7 @@ Each time you want to update your dependency, you must re-build Leaves.
|
||||
Leaves-Server:
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("org.leavesmc.leaves:leaves:1.21.1-R0.1-SNAPSHOT")
|
||||
compileOnly("org.leavesmc.leaves:leaves:1.21.3-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ maven {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.leavesmc.leaves:leaves-api:1.21.1-R0.1-SNAPSHOT")
|
||||
compileOnly("org.leavesmc.leaves:leaves-api:1.21.3-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
@@ -39,7 +39,7 @@ dependencies {
|
||||
Leaves-Server:
|
||||
```kotlin
|
||||
dependencies {
|
||||
compileOnly("org.leavesmc.leaves:leaves:1.21.1-R0.1-SNAPSHOT")
|
||||
compileOnly("org.leavesmc.leaves:leaves:1.21.3-R0.1-SNAPSHOT")
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
plugins {
|
||||
java
|
||||
`maven-publish`
|
||||
id("org.leavesmc.leavesweight.patcher") version "1.0.0-SNAPSHOT"
|
||||
id("org.leavesmc.leavesweight.patcher") version "1.0.1-SNAPSHOT"
|
||||
}
|
||||
|
||||
allprojects {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
group=org.leavesmc.leaves
|
||||
version=1.21.1-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.1
|
||||
paperRef=84281ceeefb9d294758a9a292ba6c01da40e8409
|
||||
preVersion=false
|
||||
updatingMinecraft=false
|
||||
version=1.21.3-R0.1-SNAPSHOT
|
||||
mcVersion=1.21.3
|
||||
paperRef=27e4ddcd067d4825eb01cb05d6975c46252eeafa
|
||||
preVersion=true
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
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.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
7
gradlew
vendored
7
gradlew
vendored
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,8 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
2
gradlew.bat
vendored
2
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Leaves Server Config
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 6246251caf2c6f025c824b8e7a944b8d48751fa1..80949894308e597676745e312474fe0c9672a23e 100644
|
||||
index 0b78564256ebc647ebac402e549d86ab6e307c8d..cbe69a0267981173fe8f7d715764d982bd9dcc8d 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2264,6 +2264,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2282,6 +2282,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add fakeplayer api
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index e20e4239a5a1f952e1c70e899549989d5e42f73c..5f6078bc80e20c9482a96d2bf1095bb32fbfc28c 100644
|
||||
index 5ce98e09e9bfcae45896401c69578aa879222893..cb7e06ad207239a5626fc475c46d991fabb48293 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2917,6 +2917,17 @@ public final class Bukkit {
|
||||
@@ -2964,6 +2964,17 @@ public final class Bukkit {
|
||||
}
|
||||
// Paper end - Folia region threading API
|
||||
|
||||
@@ -27,7 +27,7 @@ index e20e4239a5a1f952e1c70e899549989d5e42f73c..5f6078bc80e20c9482a96d2bf1095bb3
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 80949894308e597676745e312474fe0c9672a23e..133ae299ba12e0da9c5fa252a06bbf4f2b7b9016 100644
|
||||
index 0bae85d3489b628d2a2542f3c7b6f91f4a7c4af5..967bb7ba476f494ac8bfebb599f260017176f3e3 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -62,6 +62,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -38,10 +38,10 @@ index 80949894308e597676745e312474fe0c9672a23e..133ae299ba12e0da9c5fa252a06bbf4f
|
||||
|
||||
/**
|
||||
* Represents a server implementation.
|
||||
@@ -2562,4 +2563,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2615,4 +2616,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
boolean isOwnedByCurrentRegion(@NotNull Entity entity);
|
||||
// Paper end - Folia region threading API
|
||||
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||
// Paper end - API to check if the server is sleeping
|
||||
+
|
||||
+ // Leaves start - Bot API
|
||||
+ /**
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Hide irrelevant compilation warnings
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index ab84a1405acc1f0d5f267892243b82b8dab03e21..beee863333fa8ebb31cd83d6a1451b51c770bf2d 100644
|
||||
index e29e5024fa693baae469d47fe77b57118f14627c..7a60cd45449950cfb116b1cb29bc3da4ba074e7d 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -131,6 +131,15 @@ val generateApiVersioningFile by tasks.registering {
|
||||
@@ -148,6 +148,15 @@ val generateApiVersioningFile by tasks.registering {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ index ab84a1405acc1f0d5f267892243b82b8dab03e21..beee863333fa8ebb31cd83d6a1451b51
|
||||
tasks.jar {
|
||||
from(generateApiVersioningFile.map { it.outputs.files.singleFile }) {
|
||||
into("META-INF/maven/${project.group}/${project.name}")
|
||||
@@ -190,6 +199,8 @@ tasks.withType<Javadoc> {
|
||||
@@ -207,6 +216,8 @@ tasks.withType<Javadoc> {
|
||||
into("build/docs/javadoc")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] SIMD support
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index beee863333fa8ebb31cd83d6a1451b51c770bf2d..1491188671ce741afbbc4006c03510a328e92dbd 100644
|
||||
index 7a60cd45449950cfb116b1cb29bc3da4ba074e7d..caaffd1d0a323a2b292fb9c8ceeac271ba9dd635 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -137,6 +137,7 @@ tasks.withType<JavaCompile> {
|
||||
@@ -154,6 +154,7 @@ tasks.withType<JavaCompile> {
|
||||
compilerArgs.add("-Xlint:-module")
|
||||
compilerArgs.add("-Xlint:-removal")
|
||||
compilerArgs.add("-Xlint:-dep-ann")
|
||||
@@ -16,7 +16,7 @@ index beee863333fa8ebb31cd83d6a1451b51c770bf2d..1491188671ce741afbbc4006c03510a3
|
||||
}
|
||||
// Leaves end - hide irrelevant compilation warnings
|
||||
|
||||
@@ -201,6 +202,7 @@ tasks.withType<Javadoc> {
|
||||
@@ -218,6 +219,7 @@ tasks.withType<Javadoc> {
|
||||
}
|
||||
|
||||
options.addStringOption("Xdoclint:none", "-quiet") // Leaves - hide irrelevant compilation warnings
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Delete Timings
|
||||
|
||||
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
deleted file mode 100644
|
||||
index 3e747abde6fefae90f1c15cb00158bc5303cbe50..0000000000000000000000000000000000000000
|
||||
index 73b125979e2f2dfd13cbf689a90b29cc68a36e09..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java
|
||||
+++ /dev/null
|
||||
@@ -1,89 +0,0 @@
|
||||
@@ -92,7 +92,7 @@ index 3e747abde6fefae90f1c15cb00158bc5303cbe50..00000000000000000000000000000000
|
||||
- TimingsManager.HISTORY.add(new TimingHistory());
|
||||
- TimingsManager.resetTimings();
|
||||
- }
|
||||
- Bukkit.getUnsafe().reportTimings();
|
||||
- //Bukkit.getUnsafe().reportTimings();
|
||||
- }
|
||||
-
|
||||
- boolean isViolated() {
|
||||
@@ -1279,10 +1279,10 @@ index df142a89b8c43acb81eb383eac0ef048a1f49a6e..00000000000000000000000000000000
|
||||
-}
|
||||
diff --git a/src/main/java/co/aikar/timings/Timings.java b/src/main/java/co/aikar/timings/Timings.java
|
||||
deleted file mode 100644
|
||||
index e81d0bc309de877ed2b5da6122f55c162e9b5f10..0000000000000000000000000000000000000000
|
||||
index 95b7cdf0677ef71e6885fa78aa5c75bb500f5f53..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/Timings.java
|
||||
+++ /dev/null
|
||||
@@ -1,331 +0,0 @@
|
||||
@@ -1,325 +0,0 @@
|
||||
-/*
|
||||
- * This file is licensed under the MIT License (MIT).
|
||||
- *
|
||||
@@ -1430,14 +1430,8 @@ index e81d0bc309de877ed2b5da6122f55c162e9b5f10..00000000000000000000000000000000
|
||||
- * @param enabled Should timings be reported
|
||||
- */
|
||||
- public static void setTimingsEnabled(boolean enabled) {
|
||||
- timingsEnabled = enabled;
|
||||
- warnAboutDeprecationOnEnable();
|
||||
- reset();
|
||||
- }
|
||||
-
|
||||
- private static void warnAboutDeprecationOnEnable() {
|
||||
- if (timingsEnabled && !warnedAboutDeprecationOnEnable) {
|
||||
- Bukkit.getLogger().warning(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||
- if (enabled && !warnedAboutDeprecationOnEnable) {
|
||||
- Bukkit.getLogger().severe(PlainTextComponentSerializer.plainText().serialize(deprecationMessage()));
|
||||
- warnedAboutDeprecationOnEnable = true;
|
||||
- }
|
||||
- }
|
||||
@@ -1445,7 +1439,7 @@ index e81d0bc309de877ed2b5da6122f55c162e9b5f10..00000000000000000000000000000000
|
||||
- public static Component deprecationMessage() {
|
||||
- return Component.text()
|
||||
- .color(TextColor.color(0xffc93a))
|
||||
- .append(Component.text("[!] The timings profiler has been enabled but has been scheduled for removal from Paper in the future."))
|
||||
- .append(Component.text("[!] The timings profiler is in no-op mode and will be fully removed in a later update."))
|
||||
- .append(Component.newline())
|
||||
- .append(Component.text(" We recommend migrating to the spark profiler."))
|
||||
- .append(Component.newline())
|
||||
@@ -1616,10 +1610,10 @@ index e81d0bc309de877ed2b5da6122f55c162e9b5f10..00000000000000000000000000000000
|
||||
-
|
||||
diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
deleted file mode 100644
|
||||
index 95d87c9dbf2b237787294dfbe7fed87a36e6dedf..0000000000000000000000000000000000000000
|
||||
index b83e5ff7ada8771fdf27ba9807c77ba6a4ce12da..0000000000000000000000000000000000000000
|
||||
--- a/src/main/java/co/aikar/timings/TimingsCommand.java
|
||||
+++ /dev/null
|
||||
@@ -1,126 +0,0 @@
|
||||
@@ -1,127 +0,0 @@
|
||||
-/*
|
||||
- * This file is licensed under the MIT License (MIT).
|
||||
- *
|
||||
@@ -1678,8 +1672,9 @@ index 95d87c9dbf2b237787294dfbe7fed87a36e6dedf..00000000000000000000000000000000
|
||||
- if (!testPermission(sender)) {
|
||||
- return true;
|
||||
- }
|
||||
- if (false) {
|
||||
- if (true) {
|
||||
- sender.sendMessage(Timings.deprecationMessage());
|
||||
- return true;
|
||||
- }
|
||||
- if (args.length < 1) {
|
||||
- sender.sendMessage(text("Usage: " + this.usageMessage, NamedTextColor.RED));
|
||||
@@ -2182,7 +2177,7 @@ index 5df19bd701c67506689fc7f49d91f99ebfbc83f0..940565704d0e8914a76cf25daf7d1f5e
|
||||
server.getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerCommandException(ex, target, sender, args))); // Paper
|
||||
//target.timings.stopTiming(); // Spigot // Paper
|
||||
diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
index 003bece642b682985625db93cad93026352bfc66..308245714a0a830d92568f7bb1f4bb9c45828345 100644
|
||||
index b878e7167cfcdea0e224c182b40abeadd339d3b3..fc0239bca93e3dfb740af3239c1276b004607643 100644
|
||||
--- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
+++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java
|
||||
@@ -720,12 +720,7 @@ public final class SimplePluginManager implements PluginManager {
|
||||
@@ -2209,9 +2204,9 @@ index 003bece642b682985625db93cad93026352bfc66..308245714a0a830d92568f7bb1f4bb9c
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -965,7 +959,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
* @param use True if per event timing code should be used
|
||||
@@ -966,7 +960,6 @@ public final class SimplePluginManager implements PluginManager {
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public void useTimings(boolean use) {
|
||||
- co.aikar.timings.Timings.setTimingsEnabled(use); // Paper
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Force peaceful mode switch
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index ef32a937e6faf1e8a5d6b1207986715bae5a246c..29343b0f5c5b91e66e13c2d8d5e1952762af8526 100644
|
||||
index 7a439c99fc4c5ee17d674460c8e58a9fe0c64e02..3d5893c4cb6fc914ff2dbbb2267420ec8653dac3 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -4277,6 +4277,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
@@ -4314,6 +4314,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
void setSendViewDistance(int viewDistance);
|
||||
// Paper end - view distance api
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Replay Mod API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 5f6078bc80e20c9482a96d2bf1095bb32fbfc28c..d0a9b96f4ab200892d589a68b27585a08780f7ac 100644
|
||||
index cb7e06ad207239a5626fc475c46d991fabb48293..e37015328e3e53ae5f960c8235ef827b7abe329d 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2927,6 +2927,11 @@ public final class Bukkit {
|
||||
@@ -2974,6 +2974,11 @@ public final class Bukkit {
|
||||
return server.getBotManager();
|
||||
}
|
||||
// Leaves end - Bot API
|
||||
@@ -21,7 +21,7 @@ index 5f6078bc80e20c9482a96d2bf1095bb32fbfc28c..d0a9b96f4ab200892d589a68b27585a0
|
||||
@NotNull
|
||||
public static Server.Spigot spigot() {
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 133ae299ba12e0da9c5fa252a06bbf4f2b7b9016..f752dbd0ed8a62cb2b7c812925dde645c3ecb85c 100644
|
||||
index 967bb7ba476f494ac8bfebb599f260017176f3e3..cc86476f68e6934a3f8e6a5404876a39b943a926 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -63,6 +63,7 @@ import org.jetbrains.annotations.Contract;
|
||||
@@ -32,7 +32,7 @@ index 133ae299ba12e0da9c5fa252a06bbf4f2b7b9016..f752dbd0ed8a62cb2b7c812925dde645
|
||||
|
||||
/**
|
||||
* Represents a server implementation.
|
||||
@@ -2572,4 +2573,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2625,4 +2626,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull BotManager getBotManager();
|
||||
// Leaves end - Bot API
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Bytebuf API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index d0a9b96f4ab200892d589a68b27585a08780f7ac..7fbd9d2b533e8791132ba6ac21fad83d704922a0 100644
|
||||
index e37015328e3e53ae5f960c8235ef827b7abe329d..d4d30b4da5e05d1f60f9fbb41a7a11b98d7cf6a0 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -2933,6 +2933,12 @@ public final class Bukkit {
|
||||
@@ -2980,6 +2980,12 @@ public final class Bukkit {
|
||||
}
|
||||
// Leaves end - Photographer API
|
||||
|
||||
@@ -22,10 +22,10 @@ index d0a9b96f4ab200892d589a68b27585a08780f7ac..7fbd9d2b533e8791132ba6ac21fad83d
|
||||
public static Server.Spigot spigot() {
|
||||
return server.spigot();
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index f752dbd0ed8a62cb2b7c812925dde645c3ecb85c..90fbc5fb7b8936af365e8f4cbbd7bff6d1b4cf68 100644
|
||||
index cc86476f68e6934a3f8e6a5404876a39b943a926..6a5afc818073989b6d3a108261aeff285409cfc0 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2576,4 +2576,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2629,4 +2629,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
// Leaves start - Photographer API
|
||||
@NotNull PhotographerManager getPhotographerManager();
|
||||
// Leaves end - Photographer API
|
||||
@@ -35,10 +35,10 @@ index f752dbd0ed8a62cb2b7c812925dde645c3ecb85c..90fbc5fb7b8936af365e8f4cbbd7bff6
|
||||
+ // Leaves end - Bytebuf API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7c56182acaf827f4b1a986a61cea8e9960604c98..45f820485e6f6e3a6a37a30a30c1c6a65b4615bb 100644
|
||||
index 95f0b3186e313c7fbd5c8531d52b82a69e525f94..ec2a5f77c135706a544a870808241ea1d6b6e814 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3855,6 +3855,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -3895,6 +3895,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
boolean isChunkSent(long chunkKey);
|
||||
// Paper end
|
||||
|
||||
@@ -53,10 +53,10 @@ index 7c56182acaf827f4b1a986a61cea8e9960604c98..45f820485e6f6e3a6a37a30a30c1c6a6
|
||||
Spigot spigot();
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bytebuf/Bytebuf.java b/src/main/java/org/leavesmc/leaves/bytebuf/Bytebuf.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..657eee1d4a18f765480135ef50f5ef65fdc3ed28
|
||||
index 0000000000000000000000000000000000000000..7038b2a5090154fe8d75ba9c9413952d834bb609
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bytebuf/Bytebuf.java
|
||||
@@ -0,0 +1,102 @@
|
||||
@@ -0,0 +1,107 @@
|
||||
+package org.leavesmc.leaves.bytebuf;
|
||||
+
|
||||
+import com.google.gson.JsonElement;
|
||||
@@ -64,6 +64,7 @@ index 0000000000000000000000000000000000000000..657eee1d4a18f765480135ef50f5ef65
|
||||
+import org.bukkit.inventory.ItemStack;
|
||||
+
|
||||
+import java.util.UUID;
|
||||
+import java.util.List;
|
||||
+
|
||||
+public interface Bytebuf {
|
||||
+
|
||||
@@ -155,6 +156,10 @@ index 0000000000000000000000000000000000000000..657eee1d4a18f765480135ef50f5ef65
|
||||
+
|
||||
+ ItemStack readItemStack();
|
||||
+
|
||||
+ Bytebuf writeItemStackList(List<ItemStack> itemStacks);
|
||||
+
|
||||
+ List<ItemStack> readItemStackList();
|
||||
+
|
||||
+ Bytebuf copy();
|
||||
+
|
||||
+ boolean release();
|
||||
@@ -210,10 +215,10 @@ index 0000000000000000000000000000000000000000..e246c0a8725fa3b2be065433652a19a5
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bytebuf/packet/PacketType.java b/src/main/java/org/leavesmc/leaves/bytebuf/packet/PacketType.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..4f8ea5c78df6429358dbbc75042521b657d50d3c
|
||||
index 0000000000000000000000000000000000000000..ceebd752f4c3e50943b22902e01eaf9648941785
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bytebuf/packet/PacketType.java
|
||||
@@ -0,0 +1,185 @@
|
||||
@@ -0,0 +1,191 @@
|
||||
+package org.leavesmc.leaves.bytebuf.packet;
|
||||
+
|
||||
+public enum PacketType {
|
||||
@@ -382,6 +387,12 @@ index 0000000000000000000000000000000000000000..4f8ea5c78df6429358dbbc75042521b6
|
||||
+ ClientboundTickingStep,
|
||||
+ ClientboundCustomPayload,
|
||||
+ ClientboundCustomDetails,
|
||||
+ ClientboundRecipeBookAdd,
|
||||
+ ServerboundClientTickEnd,
|
||||
+ ClientboundSetHeldSlot,
|
||||
+ ServerboundSelectBundleItem,
|
||||
+ ClientboundSetPlayerInventory,
|
||||
+ ClientboundSetCursorItem,
|
||||
+ ClientboundDisconnect,
|
||||
+ ClientboundKeepAlive,
|
||||
+ ClientboundPing,
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sun, 14 Aug 2022 08:17:28 +0800
|
||||
Subject: [PATCH] Optimize entity coordinate key
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 1beefbd05c13181214e188f50e88fb67f6712a45..a95fd8164ddd2992525e1f453df2094ed2108cf7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -315,7 +315,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public double yo;
|
||||
public double zo;
|
||||
private Vec3 position;
|
||||
- private BlockPos blockPosition;
|
||||
+ public BlockPos blockPosition; // Leaves - private -> public
|
||||
private ChunkPos chunkPosition;
|
||||
private Vec3 deltaMovement;
|
||||
private float yRot;
|
||||
@@ -1,218 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sat, 20 Aug 2022 22:52:31 +0800
|
||||
Subject: [PATCH] Reduce entity fluid lookups if no fluids
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2563e077ceaf6c21e20f00c59341abcca39c91eb..decc1d6be70eb501ebf75dd5907fabfbc2584928 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4455,16 +4455,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
|
||||
- if (this.touchingUnloadedChunk()) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.reduceEntityFluidLookup && this.touchingUnloadedChunk()) { // Leaves - cost of a lookup here is the same cost as below, so skip
|
||||
return false;
|
||||
} else {
|
||||
AABB axisalignedbb = this.getBoundingBox().deflate(0.001D);
|
||||
- int i = Mth.floor(axisalignedbb.minX);
|
||||
- int j = Mth.ceil(axisalignedbb.maxX);
|
||||
- int k = Mth.floor(axisalignedbb.minY);
|
||||
- int l = Mth.ceil(axisalignedbb.maxY);
|
||||
- int i1 = Mth.floor(axisalignedbb.minZ);
|
||||
- int j1 = Mth.ceil(axisalignedbb.maxZ);
|
||||
+ // Leaves start - rename
|
||||
+ int minBlockX = Mth.floor(axisalignedbb.minX);
|
||||
+ int maxBlockX = Mth.ceil(axisalignedbb.maxX);
|
||||
+ int minBlockY = Mth.floor(axisalignedbb.minY);
|
||||
+ int maxBlockY = Mth.ceil(axisalignedbb.maxY);
|
||||
+ int minBlockZ = Mth.floor(axisalignedbb.minZ);
|
||||
+ int maxBlockZ = Mth.ceil(axisalignedbb.maxZ);
|
||||
+ // Leaves end
|
||||
double d1 = 0.0D;
|
||||
boolean flag = this.isPushedByFluid();
|
||||
boolean flag1 = false;
|
||||
@@ -4472,38 +4474,123 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
int k1 = 0;
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
|
||||
- for (int l1 = i; l1 < j; ++l1) {
|
||||
- for (int i2 = k; i2 < l; ++i2) {
|
||||
- for (int j2 = i1; j2 < j1; ++j2) {
|
||||
- blockposition_mutableblockposition.set(l1, i2, j2);
|
||||
- FluidState fluid = this.level().getFluidState(blockposition_mutableblockposition);
|
||||
+ // Leaves start - based off CollisionUtil.getCollisionsForBlocksOrWorldBorder
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.reduceEntityFluidLookup) {
|
||||
+ final int minSection = this.level.getMinSection() - 1;
|
||||
+ final int maxSection = this.level.getMaxSection() - 1;
|
||||
+ final int minBlock = minSection << 4;
|
||||
+ final int maxBlock = (maxSection << 4) | 15;
|
||||
|
||||
- if (fluid.is(tag)) {
|
||||
- double d2 = (double) ((float) i2 + fluid.getHeight(this.level(), blockposition_mutableblockposition));
|
||||
+ // special cases:
|
||||
+ if (minBlockY > maxBlock || maxBlockY < minBlock) {
|
||||
+ // no point in checking
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
- if (d2 >= axisalignedbb.minY) {
|
||||
- flag1 = true;
|
||||
- d1 = Math.max(d2 - axisalignedbb.minY, d1);
|
||||
- if (flag) {
|
||||
- Vec3 vec3d1 = fluid.getFlow(this.level(), blockposition_mutableblockposition);
|
||||
+ int minYIterate = Math.max(minBlock, minBlockY);
|
||||
+ int maxYIterate = Math.min(maxBlock, maxBlockY);
|
||||
|
||||
- if (d1 < 0.4D) {
|
||||
- vec3d1 = vec3d1.scale(d1);
|
||||
- }
|
||||
+ int minChunkX = minBlockX >> 4;
|
||||
+ int maxChunkX = maxBlockX >> 4;
|
||||
+
|
||||
+ int minChunkZ = minBlockZ >> 4;
|
||||
+ int maxChunkZ = maxBlockZ >> 4;
|
||||
+
|
||||
+ for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) {
|
||||
+ int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk
|
||||
+ int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 16; // coordinate in chunk
|
||||
+
|
||||
+ for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) {
|
||||
+ int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk
|
||||
+ int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 16; // coordinate in chunk
|
||||
+
|
||||
+ net.minecraft.world.level.chunk.ChunkAccess chunk = this.level.getChunkIfLoadedImmediately(currChunkX, currChunkZ);
|
||||
+ if (chunk == null) {
|
||||
+ return false; // if we're touching an unloaded chunk then it's false
|
||||
+ }
|
||||
+
|
||||
+ net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections();
|
||||
+
|
||||
+ for (int currY = minYIterate; currY < maxYIterate; ++currY) {
|
||||
+ net.minecraft.world.level.chunk.LevelChunkSection section = sections[(currY >> 4) - minSection];
|
||||
|
||||
- vec3d = vec3d.add(vec3d1);
|
||||
- ++k1;
|
||||
+ if (section == null || section.hasOnlyAir() || section.fluidStateCount == 0) { // if no fluids, nothing in this section
|
||||
+ // empty
|
||||
+ // skip to next section
|
||||
+ currY = (currY & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ net.minecraft.world.level.chunk.PalettedContainer<BlockState> blocks = section.states;
|
||||
+
|
||||
+ for (int currZ = minZ; currZ < maxZ; ++currZ) {
|
||||
+ for (int currX = minX; currX < maxX; ++currX) {
|
||||
+ FluidState fluid = blocks.get(currX & 15, currY & 15, currZ & 15).getFluidState();
|
||||
+
|
||||
+ if (fluid.is(tag)) {
|
||||
+ blockposition_mutableblockposition.set((currChunkX << 4) + currX, currY, (currChunkZ << 4) + currZ);
|
||||
+ double d2 = (double) ((float) currY + fluid.getHeight(this.level, blockposition_mutableblockposition));
|
||||
+
|
||||
+ if (d2 >= axisalignedbb.minY) {
|
||||
+ flag1 = true;
|
||||
+ d1 = Math.max(d2 - axisalignedbb.minY, d1);
|
||||
+ if (flag) {
|
||||
+ Vec3 vec3d1 = fluid.getFlow(this.level, blockposition_mutableblockposition);
|
||||
+
|
||||
+ if (d1 < 0.4D) {
|
||||
+ vec3d1 = vec3d1.scale(d1);
|
||||
+ }
|
||||
+
|
||||
+ vec3d = vec3d.add(vec3d1);
|
||||
+ ++k1;
|
||||
+ }
|
||||
+ // CraftBukkit start - store last lava contact location
|
||||
+ if (tag == FluidTags.LAVA) {
|
||||
+ this.lastLavaContact = blockposition_mutableblockposition.immutable();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
- // CraftBukkit start - store last lava contact location
|
||||
- if (tag == FluidTags.LAVA) {
|
||||
- this.lastLavaContact = blockposition_mutableblockposition.immutable();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (int l1 = minBlockX; l1 < maxBlockX; ++l1) {
|
||||
+ for (int i2 = minBlockY; i2 < maxBlockY; ++i2) {
|
||||
+ for (int j2 = minBlockZ; j2 < maxBlockZ; ++j2) {
|
||||
+ blockposition_mutableblockposition.set(l1, i2, j2);
|
||||
+ FluidState fluid = this.level().getFluidState(blockposition_mutableblockposition);
|
||||
+
|
||||
+ if (fluid.is(tag)) {
|
||||
+ double d2 = (double) ((float) i2 + fluid.getHeight(this.level(), blockposition_mutableblockposition));
|
||||
+
|
||||
+ if (d2 >= axisalignedbb.minY) {
|
||||
+ flag1 = true;
|
||||
+ d1 = Math.max(d2 - axisalignedbb.minY, d1);
|
||||
+ if (flag) {
|
||||
+ Vec3 vec3d1 = fluid.getFlow(this.level(), blockposition_mutableblockposition);
|
||||
+
|
||||
+ if (d1 < 0.4D) {
|
||||
+ vec3d1 = vec3d1.scale(d1);
|
||||
+ }
|
||||
+
|
||||
+ vec3d = vec3d.add(vec3d1);
|
||||
+ ++k1;
|
||||
+ }
|
||||
+ // CraftBukkit start - store last lava contact location
|
||||
+ if (tag == FluidTags.LAVA) {
|
||||
+ this.lastLavaContact = blockposition_mutableblockposition.immutable();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
- // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // Leaves end
|
||||
|
||||
if (vec3d.length() > 0.0D) {
|
||||
if (k1 > 0) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index c3b1caa352b988ec44fa2b2eb0536517711f5460..95921cc65ebb0d41a52a662130e0e265b4f5afa6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -25,6 +25,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
public final PalettedContainer<BlockState> states;
|
||||
// CraftBukkit start - read/write
|
||||
private PalettedContainer<Holder<Biome>> biomes;
|
||||
+ public short fluidStateCount; // Leaves
|
||||
|
||||
// Paper start - block counting
|
||||
private static final it.unimi.dsi.fastutil.ints.IntArrayList FULL_LIST = new it.unimi.dsi.fastutil.ints.IntArrayList(16*16*16);
|
||||
@@ -104,6 +105,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
|
||||
if (!fluid.isEmpty()) {
|
||||
--this.tickingFluidCount;
|
||||
+ --this.fluidStateCount; // Leaves
|
||||
}
|
||||
|
||||
if (!state.isAir()) {
|
||||
@@ -115,6 +117,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
|
||||
if (!fluid1.isEmpty()) {
|
||||
++this.tickingFluidCount;
|
||||
+ --this.fluidStateCount; // Leaves
|
||||
}
|
||||
|
||||
// Paper start - block counting
|
||||
@@ -208,6 +211,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_
|
||||
if (fluid.isRandomlyTicking()) {
|
||||
this.tickingFluidCount += paletteCount;
|
||||
}
|
||||
+ LevelChunkSection.this.fluidStateCount++; // Leaves
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Tue, 18 Jul 2023 14:43:18 +0800
|
||||
Subject: [PATCH] Cache CubeVoxelShape shape array
|
||||
|
||||
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
index d812949c7329ae2696b38dc792fa011ba87decb9..17781089b96a8ba54e06a4c8ead58cc31151be47 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
|
||||
@@ -5,13 +5,28 @@ import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public final class CubeVoxelShape extends VoxelShape {
|
||||
+
|
||||
+ private DoubleList[] list = null; // Leaves - cache CubeVoxelShape shape array
|
||||
+
|
||||
protected CubeVoxelShape(DiscreteVoxelShape voxels) {
|
||||
super(voxels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleList getCoords(Direction.Axis axis) {
|
||||
- return new CubePointRange(this.shape.getSize(axis));
|
||||
+ // Leaves start - cache CubeVoxelShape shape array
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.cacheCubeVoxelShapeShapeArray) {
|
||||
+ return new CubePointRange(this.shape.getSize(axis));
|
||||
+ } else {
|
||||
+ if (this.list == null) {
|
||||
+ this.list = new DoubleList[Direction.Axis.VALUES.length];
|
||||
+ for (Direction.Axis existingAxis : Direction.Axis.VALUES) {
|
||||
+ this.list[existingAxis.ordinal()] = new CubePointRange(this.shape.getSize(axis));
|
||||
+ }
|
||||
+ }
|
||||
+ return this.list[axis.ordinal()];
|
||||
+ }
|
||||
+ // Leaves end - cache CubeVoxelShape shape array
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable moved wrongly threshold
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 2e08a927f9c3c4a4cfcad16b7a835b80efefdfca..614907d64362ae51b3f19a6d5652e23be28f795c 100644
|
||||
index a0b0bee8c2c0452d41872722875dbb131ccceacf..fd05c29b888f7979e208e51cfc8a4110f3324eb9 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -569,7 +569,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -574,7 +574,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
// Paper end - Prevent moving into unloaded chunks
|
||||
|
||||
@@ -17,7 +17,7 @@ index 2e08a927f9c3c4a4cfcad16b7a835b80efefdfca..614907d64362ae51b3f19a6d5652e23b
|
||||
// CraftBukkit end
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.send(new ClientboundMoveVehiclePacket(entity));
|
||||
@@ -605,7 +605,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -610,7 +610,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
boolean flag2 = false;
|
||||
|
||||
@@ -26,7 +26,7 @@ index 2e08a927f9c3c4a4cfcad16b7a835b80efefdfca..614907d64362ae51b3f19a6d5652e23b
|
||||
flag2 = true; // Paper - diff on change, this should be moved wrongly
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", new Object[]{entity.getName().getString(), this.player.getName().getString(), Math.sqrt(d10)});
|
||||
}
|
||||
@@ -1414,7 +1414,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -1426,7 +1426,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY,
|
||||
toX, toY, toZ, toYaw, toPitch, true);
|
||||
if (!event.isAllowed()) {
|
||||
@@ -35,7 +35,7 @@ index 2e08a927f9c3c4a4cfcad16b7a835b80efefdfca..614907d64362ae51b3f19a6d5652e23b
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -1484,7 +1484,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -1496,7 +1496,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
boolean movedWrongly = false; // Paper - Add fail move event; rename
|
||||
|
||||
@@ -5,20 +5,20 @@ Subject: [PATCH] Build changes
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index de0474b8dce58cb419c00b7614d7dd66be832a02..0c537cd70a1b8a7d7ccd78ba212de0cae8cb6bbc 100644
|
||||
index faf3e3fd72e8c915e7a4803dacbe1bb576c6663e..d88a9d1908373ba44143013cda1ae51477a835cf 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
|
||||
val alsoShade: Configuration by configurations.creating
|
||||
@@ -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(":leaves-api")) // Leaves - build change
|
||||
// Paper start
|
||||
implementation("org.jline:jline-terminal-jansi:3.21.0")
|
||||
implementation("net.minecrell:terminalconsoleappender:1.3.0")
|
||||
@@ -72,6 +72,15 @@ paperweight {
|
||||
craftBukkitPackageVersion.set("v1_21_R1") // also needs to be updated in MappingEnvironment
|
||||
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
|
||||
@@ -86,6 +86,15 @@ paperweight {
|
||||
craftBukkitPackageVersion.set("v1_21_R2") // also needs to be updated in MappingEnvironment
|
||||
}
|
||||
|
||||
+// Leaves start - hide irrelevant compilation warnings
|
||||
@@ -33,7 +33,7 @@ index de0474b8dce58cb419c00b7614d7dd66be832a02..0c537cd70a1b8a7d7ccd78ba212de0ca
|
||||
tasks.jar {
|
||||
archiveClassifier.set("dev")
|
||||
|
||||
@@ -85,14 +94,14 @@ tasks.jar {
|
||||
@@ -99,14 +108,14 @@ tasks.jar {
|
||||
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
|
||||
attributes(
|
||||
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
||||
@@ -53,7 +53,7 @@ index de0474b8dce58cb419c00b7614d7dd66be832a02..0c537cd70a1b8a7d7ccd78ba212de0ca
|
||||
"Build-Number" to (build ?: ""),
|
||||
"Build-Time" to Instant.now().toString(),
|
||||
"Git-Branch" to gitBranch, // Paper
|
||||
@@ -153,7 +162,7 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -172,7 +181,7 @@ fun TaskContainer.registerRunTask(
|
||||
name: String,
|
||||
block: JavaExec.() -> Unit
|
||||
): TaskProvider<JavaExec> = register<JavaExec>(name) {
|
||||
@@ -62,7 +62,7 @@ index de0474b8dce58cb419c00b7614d7dd66be832a02..0c537cd70a1b8a7d7ccd78ba212de0ca
|
||||
mainClass.set("org.bukkit.craftbukkit.Main")
|
||||
standardInput = System.`in`
|
||||
workingDir = rootProject.layout.projectDirectory
|
||||
@@ -222,13 +231,13 @@ tasks.registerRunTask("runReobfBundler") {
|
||||
@@ -241,13 +250,13 @@ tasks.registerRunTask("runReobfBundler") {
|
||||
classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreateBundlerJar>("createReobfBundlerJar").flatMap { it.outputZip })
|
||||
mainClass.set(null as String?)
|
||||
}
|
||||
@@ -82,8 +82,21 @@ index de0474b8dce58cb419c00b7614d7dd66be832a02..0c537cd70a1b8a7d7ccd78ba212de0ca
|
||||
+ classpath(rootProject.tasks.named<io.papermc.paperweight.tasks.CreatePaperclipJar>("createReobfLeavesclipJar").flatMap { it.outputZip })
|
||||
mainClass.set(null as String?)
|
||||
}
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java b/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java
|
||||
index ca8b6a926dfff3fdd6b04228809a4480366120b2..f77f04f7312a528d3f898c6c4b8603ab295c14fd 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/paper/PaperHooks.java
|
||||
@@ -25,7 +25,7 @@ import net.minecraft.world.phys.AABB;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
-public final class PaperHooks implements PlatformHooks {
|
||||
+public class PaperHooks implements PlatformHooks { // Leaves - not final
|
||||
|
||||
@Override
|
||||
public String getBrand() {
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..03373e5a37a5f90d31434aab921ec8c6b6efef70 100644
|
||||
index 4b002e8b75d117b726b0de274a76d3596fce015b..f6b362894bbd0f0f09f0f51a931529d708ca9b9e 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java
|
||||
@@ -593,7 +593,8 @@ public class Metrics {
|
||||
@@ -109,7 +122,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..03373e5a37a5f90d31434aab921ec8c6
|
||||
+ return "unknown";
|
||||
+ }));
|
||||
+
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.bstatsPrivacyMode) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.mics.bstatsPrivacyMode) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -184,10 +197,10 @@ index 790bad0494454ca12ee152e3de6da3da634d9b20..c060857cb0551fff8f5033553b887f3a
|
||||
private static final String BUILD_DEV = "DEV";
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 696d075ca2883f3c37e35f983c4d020e5db89d16..f1b28f4f383c682a52b6aa44dfbdf30944537ecf 100644
|
||||
index 780582ebaa8deb0c0b0c8de17de5abcebafa4bd3..5201b1aaedabdf6021ea9ac3f84be70a6d03aa8f 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1243,7 +1243,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1263,7 +1263,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
LOGGER.info("*************************************************************************************");
|
||||
LOGGER.info("This is the first time you're starting this server.");
|
||||
LOGGER.info("It's recommended you read our 'Getting Started' documentation for guidance.");
|
||||
@@ -196,20 +209,20 @@ index 696d075ca2883f3c37e35f983c4d020e5db89d16..f1b28f4f383c682a52b6aa44dfbdf309
|
||||
LOGGER.info("*************************************************************************************");
|
||||
}
|
||||
// Paper end - Add onboarding message for initial server start
|
||||
@@ -1940,7 +1940,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -2010,7 +2010,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return io.papermc.paper.ServerBuildInfo.buildInfo().brandName(); // Paper
|
||||
+ return org.leavesmc.leaves.LeavesConfig.serverModName; // Leaves - Custom // Paper
|
||||
+ return org.leavesmc.leaves.LeavesConfig.mics.serverModName; // Leaves - Custom // Paper
|
||||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport details) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index dd56c8e041116ef3602a9f89c998c8208ab89b51..0b4a70ebd312038d5b128c9e1f990666d1642a1a 100644
|
||||
index 17a158ff6ce6520b69a5a0032ba4c05449dd0cf8..faeb700647522379046f3cb3abcf478ff5aae95d 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -237,9 +237,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -234,9 +234,10 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
thread.start(); // Paper - Enhance console tab completions for brigadier commands; start console thread after MinecraftServer.console & PaperConfig are initialized
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||||
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
|
||||
@@ -235,7 +248,7 @@ index 759062d219ff490a3cb19e710c4d18e3e08288e0..3952428c02fe87477f4139f4fa983815
|
||||
|
||||
javax.swing.JLabel jLabel = new javax.swing.JLabel("If you need help setting up your server you can visit:");
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index b3ba6bccdbb08af27916f0c611c60b2595b90164..3f81f87def8e591938618c3ade8daaf5ab0f84a7 100644
|
||||
index be0d38544395a9b3befb898bb961f34e32fe9509..a41e6f5dc2d5516f081d7340e2dacffaf5663485 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -267,7 +267,7 @@ public class Main {
|
||||
@@ -260,6 +273,40 @@ index 774556a62eb240da42e84db4502e2ed43495be17..fdef98a7796d84c7b0ee61241859e10c
|
||||
Properties properties = new Properties();
|
||||
|
||||
if (stream != null) {
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/.editorconfig b/src/main/java/org/leavesmc/leaves/.editorconfig
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6f086600baf9c98d681c4f5be5bb29c0e2086e6a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/.editorconfig
|
||||
@@ -0,0 +1,2 @@
|
||||
+[*.java]
|
||||
+ij_java_use_fq_class_names = false
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/region/LeavesHooks.java b/src/main/java/org/leavesmc/leaves/region/LeavesHooks.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..47b6241ba0a23a0579b8b046f1e45832117b6581
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/region/LeavesHooks.java
|
||||
@@ -0,0 +1,19 @@
|
||||
+package org.leavesmc.leaves.region;
|
||||
+
|
||||
+import ca.spottedleaf.moonrise.paper.PaperHooks;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.level.chunk.LevelChunk;
|
||||
+
|
||||
+public final class LeavesHooks extends PaperHooks {
|
||||
+
|
||||
+ @Override
|
||||
+ public String getBrand() {
|
||||
+ return "Leaves";
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void onChunkWatch(ServerLevel world, LevelChunk chunk, ServerPlayer player) {
|
||||
+ super.onChunkWatch(world, chunk, player);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
index f7a4fee9bb25ff256dc2e5ea26bfbceca6a49167..f2087df445acca525aac789a5234bdd851890f35 100644
|
||||
--- a/src/main/java/org/spigotmc/WatchdogThread.java
|
||||
@@ -306,6 +353,13 @@ index f7a4fee9bb25ff256dc2e5ea26bfbceca6a49167..f2087df445acca525aac789a5234bdd8
|
||||
}
|
||||
|
||||
log.log( Level.SEVERE, "------------------------------" );
|
||||
diff --git a/src/main/resources/META-INF/services/ca.spottedleaf.moonrise.common.PlatformHooks b/src/main/resources/META-INF/services/ca.spottedleaf.moonrise.common.PlatformHooks
|
||||
index e57c3ca79677b1dfe7cf3db36f0406de7ea5bd0a..86edd824ec42e550dd1419fd57d93a21fe2d648d 100644
|
||||
--- a/src/main/resources/META-INF/services/ca.spottedleaf.moonrise.common.PlatformHooks
|
||||
+++ b/src/main/resources/META-INF/services/ca.spottedleaf.moonrise.common.PlatformHooks
|
||||
@@ -1 +1 @@
|
||||
-ca.spottedleaf.moonrise.paper.PaperHooks
|
||||
+org.leavesmc.leaves.region.LeavesHooks
|
||||
diff --git a/src/main/resources/logo.png b/src/main/resources/logo.png
|
||||
index 8b924977b7886df9ab8790b1e4ff9b1c04a2af45..e6a7ee1232cb34840f454187f50f44d17300ad9c 100644
|
||||
GIT binary patch
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,18 +5,18 @@ Subject: [PATCH] Leaves Server Utils
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 4b54d0ea31062972e68ee8fafe3cfaf68f65a5cd..b5283b7a59c76e75ba9a822f315ba0d813df8cfb 100644
|
||||
index a15546e433ebba6c0de01bdaaef201a3d99a87b5..922996adcf2b85e55a934191e90a12c42f169b0f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -429,6 +429,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private UUID originWorld;
|
||||
@@ -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
|
||||
+ private CompoundTag leavesData = new CompoundTag(); // Leaves - Leaves ex data
|
||||
|
||||
public void setOrigin(@javax.annotation.Nonnull Location location) {
|
||||
this.origin = location.toVector();
|
||||
@@ -2558,6 +2559,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2690,6 +2691,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
nbttagcompound.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
@@ -24,7 +24,7 @@ index 4b54d0ea31062972e68ee8fafe3cfaf68f65a5cd..b5283b7a59c76e75ba9a822f315ba0d8
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2705,6 +2707,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2838,6 +2840,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
|
||||
}
|
||||
// Paper end
|
||||
@@ -36,8 +36,8 @@ index 4b54d0ea31062972e68ee8fafe3cfaf68f65a5cd..b5283b7a59c76e75ba9a822f315ba0d8
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
@@ -4992,4 +4999,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
|
||||
@@ -5325,4 +5332,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return ((net.minecraft.server.level.ServerLevel) this.level).isPositionEntityTicking(this.blockPosition());
|
||||
}
|
||||
// Paper end - Expose entity id counter
|
||||
+
|
||||
@@ -49,7 +49,7 @@ index 4b54d0ea31062972e68ee8fafe3cfaf68f65a5cd..b5283b7a59c76e75ba9a822f315ba0d8
|
||||
}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/LeavesLogger.java b/src/main/java/org/leavesmc/leaves/LeavesLogger.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..47347a3bdab2ff9818bf8198291d2dabec7da8c6
|
||||
index 0000000000000000000000000000000000000000..bc45935c96553c9bd9d9b6ab3a64e28f52862198
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/LeavesLogger.java
|
||||
@@ -0,0 +1,24 @@
|
||||
@@ -70,11 +70,11 @@ index 0000000000000000000000000000000000000000..47347a3bdab2ff9818bf8198291d2dab
|
||||
+ }
|
||||
+
|
||||
+ public void severe(String msg, Exception exception) {
|
||||
+ this.severe(msg + ", " + exception.getCause() + ": " + exception.getMessage());
|
||||
+ this.log(Level.SEVERE, msg, exception);
|
||||
+ }
|
||||
+
|
||||
+ public void warning(String msg, Exception exception) {
|
||||
+ this.warning(msg + ", " + exception.getCause() + ": " + exception.getMessage());
|
||||
+ this.log(Level.WARNING, msg, exception);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/command/LeavesCommandUtil.java b/src/main/java/org/leavesmc/leaves/command/LeavesCommandUtil.java
|
||||
@@ -324,24 +324,19 @@ index 0000000000000000000000000000000000000000..440c4d903e145229bc54eb5b6f3578fd
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/MathUtils.java b/src/main/java/org/leavesmc/leaves/util/MathUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a6a4fd61644815a7fb01ab1a5844a34f39e57e6d
|
||||
index 0000000000000000000000000000000000000000..56050158a7e2217f4fdad11067cc377dda9ca770
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/MathUtils.java
|
||||
@@ -0,0 +1,100 @@
|
||||
@@ -0,0 +1,96 @@
|
||||
+package org.leavesmc.leaves.util;
|
||||
+
|
||||
+import org.bukkit.util.NumberConversions;
|
||||
+import org.bukkit.util.Vector;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.regex.Pattern;
|
||||
+
|
||||
+public class MathUtils {
|
||||
+ // Lag ?
|
||||
+ public static void clean(Vector vector) {
|
||||
+ if (!NumberConversions.isFinite(vector.getX())) vector.setX(0);
|
||||
+ if (!NumberConversions.isFinite(vector.getY())) vector.setY(0);
|
||||
+ if (!NumberConversions.isFinite(vector.getZ())) vector.setZ(0);
|
||||
+ }
|
||||
+
|
||||
+ private static final Pattern numericPattern = Pattern.compile("^-?[1-9]\\d*$|^0$");
|
||||
+
|
||||
@@ -349,7 +344,7 @@ index 0000000000000000000000000000000000000000..a6a4fd61644815a7fb01ab1a5844a34f
|
||||
+ return numericPattern.matcher(str).matches();
|
||||
+ }
|
||||
+
|
||||
+ public static float[] fetchYawPitch(Vector dir) {
|
||||
+ public static float @NotNull [] fetchYawPitch(@NotNull Vector dir) {
|
||||
+ double x = dir.getX();
|
||||
+ double z = dir.getZ();
|
||||
+
|
||||
@@ -370,7 +365,7 @@ index 0000000000000000000000000000000000000000..a6a4fd61644815a7fb01ab1a5844a34f
|
||||
+ return out;
|
||||
+ }
|
||||
+
|
||||
+ public static float fetchPitch(Vector dir) {
|
||||
+ public static float fetchPitch(@NotNull Vector dir) {
|
||||
+ double x = dir.getX();
|
||||
+ double z = dir.getZ();
|
||||
+
|
||||
@@ -388,6 +383,7 @@ index 0000000000000000000000000000000000000000..a6a4fd61644815a7fb01ab1a5844a34f
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static Vector getDirection(double rotX, double rotY) {
|
||||
+ Vector vector = new Vector();
|
||||
+
|
||||
|
||||
@@ -27,11 +27,11 @@ index 532306cacd52579cdf37e4aca25887b1ed3ba6a1..917ffaae401f3374d07d7fb7c024234a
|
||||
if (data == null) {
|
||||
return null;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 0d8a128b0506b903e2cc200d6e684fd570217aec..cf30f051272b7548b5674a3d059bbcacabec963c 100644
|
||||
index 83020837e29ee627b1081daddb4bdee147b95af3..b0f9010e28d865f059675954cd1db575c61d675e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -488,7 +488,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
|
||||
@@ -505,7 +505,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
// Paper start
|
||||
@Override
|
||||
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
|
||||
- return new com.destroystokyo.paper.PaperVersionFetcher();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -47,12 +47,12 @@ index 1967c43ee3a12e63365cc40ee6565307e2fd73cf..6e376d0db5321d8e9b6e0b54617ffd17
|
||||
|
||||
assert isValidPath(path);
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 4464ce6ff4fd8eb9570205c7326c9a47b67d634d..7baa336edec37d8ca1d63f71b25d0daf035cdaf5 100644
|
||||
index ec5f7e652a05f35c2e6cbe31a63a980a2a476fb6..7518f8d633a6d348f9b86a12033eca3a9dad922c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1806,6 +1806,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1893,6 +1893,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.profiler.popPush("server gui refresh");
|
||||
gameprofilerfiller.popPush("server gui refresh");
|
||||
|
||||
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
|
||||
+
|
||||
@@ -60,10 +60,10 @@ index 4464ce6ff4fd8eb9570205c7326c9a47b67d634d..7baa336edec37d8ca1d63f71b25d0daf
|
||||
((Runnable) this.tickables.get(i)).run();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 7174f8c89a7cdcf40ff28f6636ecfb23b13ccdaa..7adef76ecc246b131cee35cf00c3c05bd75d5504 100644
|
||||
index b0bc66dc7248aae691dcab68b925b52a1695e63f..8344c7f953fc465ee9f43e1f81e2eb062fd3c432 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -150,6 +150,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -157,6 +157,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
|
||||
@@ -75,7 +75,7 @@ index 7174f8c89a7cdcf40ff28f6636ecfb23b13ccdaa..7adef76ecc246b131cee35cf00c3c05b
|
||||
// Paper start - Brand support
|
||||
if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.BrandPayload brandPayload) {
|
||||
this.player.clientBrandName = brandPayload.brand();
|
||||
@@ -167,6 +172,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -174,6 +179,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
String channels = payload.toString(com.google.common.base.Charsets.UTF_8);
|
||||
for (String channel : channels.split("\0")) {
|
||||
this.getCraftPlayer().addChannel(channel);
|
||||
@@ -84,10 +84,10 @@ index 7174f8c89a7cdcf40ff28f6636ecfb23b13ccdaa..7adef76ecc246b131cee35cf00c3c05b
|
||||
} catch (Exception ex) {
|
||||
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 79237a490d7572eae95384f32e0ebc1a0a005c00..d0190f633e99e2a5b5dc130def10c562ffc4e52e 100644
|
||||
index 30de3d1a7792c38ae946f19cb0e14637919b5001..9b1645cf1fa47b8d7592c7eda4a4497ad9d6bbf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -349,6 +349,8 @@ public abstract class PlayerList {
|
||||
@@ -353,6 +353,8 @@ public abstract class PlayerList {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ index 79237a490d7572eae95384f32e0ebc1a0a005c00..d0190f633e99e2a5b5dc130def10c562
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
@@ -589,6 +591,7 @@ public abstract class PlayerList {
|
||||
@@ -539,6 +541,7 @@ public abstract class PlayerList {
|
||||
return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName())));
|
||||
}
|
||||
public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer, net.kyori.adventure.text.Component leaveMessage) {
|
||||
@@ -105,10 +105,10 @@ index 79237a490d7572eae95384f32e0ebc1a0a005c00..d0190f633e99e2a5b5dc130def10c562
|
||||
ServerLevel worldserver = entityplayer.serverLevel();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 25e8b14e79edcf0ad2bcd224e049e0c04f8a5e5c..e79af523a49aaa6558b690383cb29649e6ae40c8 100644
|
||||
index 3d18ffbf3604705d8b99f69df156392dfed1863b..3435629606def598ca998fb41ef303677c4cbea4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -477,6 +477,7 @@ public final class CraftServer implements Server {
|
||||
@@ -491,6 +491,7 @@ public final class CraftServer implements Server {
|
||||
this.potionBrewer = new io.papermc.paper.potion.PaperPotionBrewer(console); // Paper - custom potion mixes
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
this.spark = new io.papermc.paper.SparksFly(this); // Paper - spark
|
||||
@@ -116,7 +116,7 @@ index 25e8b14e79edcf0ad2bcd224e049e0c04f8a5e5c..e79af523a49aaa6558b690383cb29649
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1107,6 +1108,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1121,6 +1122,7 @@ public final class CraftServer implements Server {
|
||||
this.spark.registerCommandBeforePlugins(this); // Paper - spark
|
||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
@@ -179,10 +179,10 @@ index 0000000000000000000000000000000000000000..986d2a6641ff8017dddf3e5f2655adfc
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..e5eb67c0bbdf4953ed0ccc3281f06eda26a7956e
|
||||
index 0000000000000000000000000000000000000000..ea94da3a2332cf23fc8753129e546a6f5a5af395
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java
|
||||
@@ -0,0 +1,435 @@
|
||||
@@ -0,0 +1,434 @@
|
||||
+package org.leavesmc.leaves.protocol.core;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableSet;
|
||||
@@ -470,10 +470,9 @@ index 0000000000000000000000000000000000000000..e5eb67c0bbdf4953ed0ccc3281f06eda
|
||||
+
|
||||
+ Map<ProtocolHandler.MinecraftRegister, Method> map = MINECRAFT_REGISTER.get(protocol);
|
||||
+ for (ProtocolHandler.MinecraftRegister register : map.keySet()) {
|
||||
+ if (register.ignoreId() || register.channelId().equals(channel[1]) ||
|
||||
+ ArrayUtils.contains(register.channelIds(), channel[1])) {
|
||||
+ if (register.ignoreId() || ArrayUtils.contains(register.channelId(), channel[1])) {
|
||||
+ try {
|
||||
+ map.get(register).invoke(null, player);
|
||||
+ map.get(register).invoke(null, player, channel[1]);
|
||||
+ } catch (InvocationTargetException | IllegalAccessException exception) {
|
||||
+ LOGGER.warning("Failed to handle minecraft register, " + exception.getCause() + ": " + exception.getMessage());
|
||||
+ }
|
||||
@@ -620,10 +619,10 @@ index 0000000000000000000000000000000000000000..e5eb67c0bbdf4953ed0ccc3281f06eda
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java b/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9d71f8e6af24301bedf60f5c87e0bb3c1697d5e3
|
||||
index 0000000000000000000000000000000000000000..202fb0717734aa8948ff8307420bf9aaf77d63ca
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolHandler.java
|
||||
@@ -0,0 +1,63 @@
|
||||
@@ -0,0 +1,55 @@
|
||||
+package org.leavesmc.leaves.protocol.core;
|
||||
+
|
||||
+import java.lang.annotation.ElementType;
|
||||
@@ -636,13 +635,11 @@ index 0000000000000000000000000000000000000000..9d71f8e6af24301bedf60f5c87e0bb3c
|
||||
+ @Target(ElementType.METHOD)
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ public @interface Init {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Target(ElementType.METHOD)
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ public @interface PayloadReceiver {
|
||||
+
|
||||
+ Class<? extends LeavesCustomPayload<?>> payload();
|
||||
+
|
||||
+ String[] payloadId() default "";
|
||||
@@ -661,28 +658,22 @@ index 0000000000000000000000000000000000000000..9d71f8e6af24301bedf60f5c87e0bb3c
|
||||
+ @Target(ElementType.METHOD)
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ public @interface PlayerJoin {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Target(ElementType.METHOD)
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ public @interface PlayerLeave {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Target(ElementType.METHOD)
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ public @interface ReloadServer {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ @Target(ElementType.METHOD)
|
||||
+ @Retention(RetentionPolicy.RUNTIME)
|
||||
+ public @interface MinecraftRegister {
|
||||
+
|
||||
+ String channelId() default "";
|
||||
+
|
||||
+ String[] channelIds() default {};
|
||||
+ String[] channelId() default "";
|
||||
+
|
||||
+ boolean ignoreId() default false;
|
||||
+ }
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix trading with the void
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 14e9140c9a18906c249e8cef39988ed7f81738f7..f30848556e677973c913ae481b268f51be90832a 100644
|
||||
index b4027f5cf90935a1fe3ab2c28b0bcbb55a7b541b..1d3f8b2c040b64e0f8548409a731d7f47d127f2c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2565,11 +2565,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2753,11 +2753,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
// Spigot end
|
||||
// Spigot Start
|
||||
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Make snowball and egg can knockback player
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
index 2b4d206c0d31ba38d7b2af654bd420e85145d441..f1070a44cd51b8d611f64e7e30691de372d9567f 100644
|
||||
index 70961e151666a0ecf5b791853f4581eaebbdcc8b..5d9834ce6a8f892339438a4fe262c9f5d52484fb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java
|
||||
@@ -61,6 +61,13 @@ public class Snowball extends ThrowableItemProjectile {
|
||||
@@ -14,7 +14,7 @@ index 2b4d206c0d31ba38d7b2af654bd420e85145d441..f1070a44cd51b8d611f64e7e30691de3
|
||||
entity.hurt(this.damageSources().thrown(this, this.getOwner()), (float) i);
|
||||
+
|
||||
+ // Leaves start - make snowball can knockback player
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entity instanceof net.minecraft.server.level.ServerPlayer player) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.snowballAndEggCanKnockback && entity instanceof net.minecraft.server.level.ServerPlayer player) {
|
||||
+ player.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
|
||||
+ player.knockback(0.4000000059604645D, this.getX() - player.getX(), this.getZ() - player.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE);
|
||||
+ }
|
||||
@@ -23,15 +23,15 @@ index 2b4d206c0d31ba38d7b2af654bd420e85145d441..f1070a44cd51b8d611f64e7e30691de3
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
index dbd60cc8c39f5d2d4c77e2de4f2567e7fa456cd2..2b8c8d0e813cd673f593dab49ecd4ee2d04dc6fa 100644
|
||||
index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..26696c09a2ce5c483dc2f723689ed985445663b8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java
|
||||
@@ -50,6 +50,12 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
||||
@@ -52,6 +52,12 @@ public class ThrownEgg extends ThrowableItemProjectile {
|
||||
protected void onHitEntity(EntityHitResult entityHitResult) {
|
||||
super.onHitEntity(entityHitResult);
|
||||
entityHitResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F);
|
||||
+ // Leaves start - make egg can knockback player
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.snowballAndEggCanKnockback && entityHitResult.getEntity() instanceof ServerPlayer player) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.snowballAndEggCanKnockback && entityHitResult.getEntity() instanceof ServerPlayer player) {
|
||||
+ player.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0000001F);
|
||||
+ player.knockback(0.4000000059604645D, this.getX() - player.getX(), this.getZ() - player.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE);
|
||||
+ }
|
||||
|
||||
@@ -34,7 +34,7 @@ index 35772110e9318df46a2729dbc0b5879b290011b7..f26989a44cdda9baabf337d573436c6c
|
||||
Set<CriterionTrigger.Listener<T>> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak
|
||||
if (set != null && !set.isEmpty()) {
|
||||
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
|
||||
index 4a8356a714ed50d4a32bcf046a2e16491bef014b..b19298aeaa0dacfe1afb1e672bd30b0c069ec968 100644
|
||||
index e693a003ea8f022eef8b49e4332025b769333b30..49e03ba7c04381e263aaee5cda9ed6c042bf6c0e 100644
|
||||
--- a/src/main/java/net/minecraft/network/Connection.java
|
||||
+++ b/src/main/java/net/minecraft/network/Connection.java
|
||||
@@ -104,7 +104,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
|
||||
@@ -47,19 +47,19 @@ index 4a8356a714ed50d4a32bcf046a2e16491bef014b..b19298aeaa0dacfe1afb1e672bd30b0c
|
||||
private DisconnectionDetails disconnectionDetails;
|
||||
private boolean encrypted;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 7baa336edec37d8ca1d63f71b25d0daf035cdaf5..cb863f07d00e96b92e73dc312606110c259b4d5c 100644
|
||||
index 7518f8d633a6d348f9b86a12033eca3a9dad922c..f0d2c8bc40b36e6d638ad418963289ac2737f5a0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -318,6 +318,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public volatile boolean abnormalExit = false; // Paper
|
||||
@@ -331,6 +331,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
|
||||
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
|
||||
|
||||
+ private org.leavesmc.leaves.bot.BotList botList; // Leaves - fakeplayer
|
||||
+
|
||||
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new ca.spottedleaf.moonrise.common.util.TickThread(() -> { // Paper - rewrite chunk system
|
||||
@@ -745,6 +747,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -762,6 +764,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// Paper end - Configurable player collision
|
||||
|
||||
@@ -68,24 +68,24 @@ index 7baa336edec37d8ca1d63f71b25d0daf035cdaf5..cb863f07d00e96b92e73dc312606110c
|
||||
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
this.server.spark.registerCommandBeforePlugins(this.server); // Paper - spark
|
||||
this.server.spark.enableAfterPlugins(this.server); // Paper - spark
|
||||
@@ -1033,6 +1037,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1050,6 +1054,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
MinecraftServer.LOGGER.info("Stopping server");
|
||||
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||
+ this.getBotList().removeAll(); // Leaves - save or remove bot
|
||||
this.server.spark.disable(); // Paper - spark
|
||||
// CraftBukkit start
|
||||
if (this.server != null) {
|
||||
@@ -1798,6 +1803,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.server.spark.disable(); // Paper - spark
|
||||
@@ -1914,6 +1919,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
this.profiler.popPush("connection");
|
||||
public void tickConnection() {
|
||||
this.getConnection().tick();
|
||||
+ this.botList.networkTick(); // Leaves - fakeplayer
|
||||
this.profiler.popPush("players");
|
||||
this.playerList.tick();
|
||||
if (SharedConstants.IS_RUNNING_IN_IDE && this.tickRateManager.runsNormally()) {
|
||||
@@ -3002,6 +3008,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return ServerLinks.EMPTY;
|
||||
}
|
||||
|
||||
private void synchronizeTime(ServerLevel world) {
|
||||
@@ -3101,6 +3107,16 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ // Leaves start - fakeplayer
|
||||
@@ -102,7 +102,7 @@ index 7baa336edec37d8ca1d63f71b25d0daf035cdaf5..cb863f07d00e96b92e73dc312606110c
|
||||
|
||||
public void close() {
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index 862a4bf003b7f810fb57dbcd150a1417c902b633..d872455c590062ac6c98bd17783c7466a90178e5 100644
|
||||
index 8e2eb7b61421ceb063654826941f1a81f6f50bdf..b9ed92cd8a12f648eeaa02427d95d75468534420 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -221,6 +221,11 @@ public class PlayerAdvancements {
|
||||
@@ -118,10 +118,10 @@ index 862a4bf003b7f810fb57dbcd150a1417c902b633..d872455c590062ac6c98bd17783c7466
|
||||
AdvancementProgress advancementprogress = this.getOrStartProgress(advancement);
|
||||
boolean flag1 = advancementprogress.isDone();
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index f97b2cb3ea855e6e250cabf357a050cd52be8f70..4ac40259f31f3deef6b5fe4456576bbd44cc2569 100644
|
||||
index a8c5fa172b01b85df51fa3b4d20b6c4f734dfdda..9b1e6effb8bf852957dba92a54688932ddb0d565 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -216,6 +216,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -214,6 +214,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
this.setLocalIp(dedicatedserverproperties.serverIp);
|
||||
}
|
||||
// Spigot start
|
||||
@@ -130,10 +130,10 @@ index f97b2cb3ea855e6e250cabf357a050cd52be8f70..4ac40259f31f3deef6b5fe4456576bbd
|
||||
org.spigotmc.SpigotConfig.init((java.io.File) this.options.valueOf("spigot-settings"));
|
||||
org.spigotmc.SpigotConfig.registerCommands();
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 50e79870db5424e47c9cb5f3866557008f580071..0451f7499121a53ce1bd13130581548f60b61996 100644
|
||||
index 52a6a4badace15a983f0acb431036bd704d9cebd..9a226396b4c38768574d5785744f22e61d6913f3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1268,6 +1268,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1304,6 +1304,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
} else if (this.seenBy.remove(player.connection)) {
|
||||
this.serverEntity.removePairing(player);
|
||||
@@ -148,10 +148,10 @@ index 50e79870db5424e47c9cb5f3866557008f580071..0451f7499121a53ce1bd13130581548f
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index f30848556e677973c913ae481b268f51be90832a..82fe09e3ac6388611a168946f0c457f6fdf0d674 100644
|
||||
index 1d3f8b2c040b64e0f8548409a731d7f47d127f2c..1b1350485ba333e9bda048b01273de9744ce16a9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -228,6 +228,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -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)
|
||||
@@ -159,15 +159,15 @@ index f30848556e677973c913ae481b268f51be90832a..82fe09e3ac6388611a168946f0c457f6
|
||||
|
||||
public LevelChunk getChunkIfLoaded(int x, int z) {
|
||||
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
|
||||
@@ -589,6 +590,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this, ca.spottedleaf.moonrise.common.util.MoonriseCommon.WORKER_POOL);
|
||||
@@ -676,6 +677,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
|
||||
// Paper end - rewrite chunk system
|
||||
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
+ this.realPlayers = Lists.newArrayList(); // Leaves - skip
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -2026,6 +2028,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2179,6 +2181,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
return this.players;
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ index f30848556e677973c913ae481b268f51be90832a..82fe09e3ac6388611a168946f0c457f6
|
||||
@Override
|
||||
public void onBlockStateChange(BlockPos pos, BlockState oldBlock, BlockState newBlock) {
|
||||
Optional<Holder<PoiType>> optional = PoiTypes.forState(oldBlock);
|
||||
@@ -2497,6 +2505,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2685,6 +2693,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
// ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server; moved down below valid=true
|
||||
if (entity instanceof ServerPlayer entityplayer) {
|
||||
ServerLevel.this.players.add(entityplayer);
|
||||
@@ -192,7 +192,7 @@ index f30848556e677973c913ae481b268f51be90832a..82fe09e3ac6388611a168946f0c457f6
|
||||
ServerLevel.this.updateSleepingPlayerList();
|
||||
}
|
||||
|
||||
@@ -2574,6 +2587,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2762,6 +2775,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
ServerLevel.this.getChunkSource().removeEntity(entity);
|
||||
if (entity instanceof ServerPlayer entityplayer) {
|
||||
ServerLevel.this.players.remove(entityplayer);
|
||||
@@ -205,10 +205,10 @@ index f30848556e677973c913ae481b268f51be90832a..82fe09e3ac6388611a168946f0c457f6
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c396580a9cfd86ff261bed439bb4662ae88010b5..c2263ef7fb67db7c01bac7aecf218ee8cb7369cb 100644
|
||||
index 5a8f396d47577f087abb415c972fd4f51e50faba..ebae6c704844755c75aa0c6f460603c5d909b5cf 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -212,7 +212,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -234,7 +234,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
private static final AttributeModifier CREATIVE_ENTITY_INTERACTION_RANGE_MODIFIER = new AttributeModifier(ResourceLocation.withDefaultNamespace("creative_mode_entity_range"), 2.0D, AttributeModifier.Operation.ADD_VALUE);
|
||||
public ServerGamePacketListenerImpl connection;
|
||||
public final MinecraftServer server;
|
||||
@@ -217,7 +217,7 @@ index c396580a9cfd86ff261bed439bb4662ae88010b5..c2263ef7fb67db7c01bac7aecf218ee8
|
||||
private final PlayerAdvancements advancements;
|
||||
private final ServerStatsCounter stats;
|
||||
private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE;
|
||||
@@ -770,16 +770,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -998,16 +998,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
--this.invulnerableTime;
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ index c396580a9cfd86ff261bed439bb4662ae88010b5..c2263ef7fb67db7c01bac7aecf218ee8
|
||||
|
||||
Entity entity = this.getCamera();
|
||||
|
||||
@@ -795,7 +799,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1023,7 +1027,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,12 +256,12 @@ index c396580a9cfd86ff261bed439bb4662ae88010b5..c2263ef7fb67db7c01bac7aecf218ee8
|
||||
if (this.levitationStartPos != null) {
|
||||
CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
|
||||
}
|
||||
@@ -1416,6 +1420,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1680,6 +1684,12 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
||||
+ // Leaves start - bot support
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.fakeplayerSupport) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.fakeplayer.enable) {
|
||||
+ this.server.getBotList().bots.forEach(bot -> bot.sendFakeDataIfNeed(this, true)); // Leaves - render bot
|
||||
+ }
|
||||
+ // Leaves end - bot support
|
||||
@@ -270,10 +270,10 @@ index c396580a9cfd86ff261bed439bb4662ae88010b5..c2263ef7fb67db7c01bac7aecf218ee8
|
||||
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3db3de2433 100644
|
||||
index 9b1645cf1fa47b8d7592c7eda4a4497ad9d6bbf8..9b3fbc13779ded07c696e151772d834ff8d61a7d 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -123,6 +123,8 @@ import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason;
|
||||
@@ -124,6 +124,8 @@ import org.bukkit.event.player.PlayerRespawnEvent.RespawnReason;
|
||||
import org.bukkit.event.player.PlayerSpawnChangeEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -282,12 +282,12 @@ index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3d
|
||||
public abstract class PlayerList {
|
||||
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -351,6 +353,19 @@ public abstract class PlayerList {
|
||||
@@ -355,6 +357,19 @@ public abstract class PlayerList {
|
||||
|
||||
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerJoin(player); // Leaves - protocol
|
||||
|
||||
+ // Leaves start - bot support
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.fakeplayerSupport) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.fakeplayer.enable) {
|
||||
+ ServerBot bot = this.server.getBotList().getBotByName(player.getScoreboardName());
|
||||
+ if (bot != null) {
|
||||
+ this.server.getBotList().removeBot(bot, org.leavesmc.leaves.event.bot.BotRemoveEvent.RemoveReason.INTERNAL, player.getBukkitEntity(), false);
|
||||
@@ -302,12 +302,12 @@ index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3d
|
||||
final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage();
|
||||
|
||||
if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure
|
||||
@@ -941,6 +956,12 @@ public abstract class PlayerList {
|
||||
@@ -907,6 +922,12 @@ public abstract class PlayerList {
|
||||
}
|
||||
// Paper end - Add PlayerPostRespawnEvent
|
||||
|
||||
+ // Leaves start - bot support
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.fakeplayerSupport) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.fakeplayer.enable) {
|
||||
+ this.server.getBotList().bots.forEach(bot -> bot.sendFakeDataIfNeed(entityplayer1, true)); // Leaves - render bot
|
||||
+ }
|
||||
+ // Leaves end - bot support
|
||||
@@ -315,7 +315,7 @@ index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3d
|
||||
// CraftBukkit end
|
||||
|
||||
return entityplayer1;
|
||||
@@ -1078,11 +1099,16 @@ public abstract class PlayerList {
|
||||
@@ -1044,11 +1065,16 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public String[] getPlayerNamesArray() {
|
||||
@@ -333,7 +333,7 @@ index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3d
|
||||
|
||||
return astring;
|
||||
}
|
||||
@@ -1169,7 +1195,13 @@ public abstract class PlayerList {
|
||||
@@ -1135,7 +1161,13 @@ public abstract class PlayerList {
|
||||
|
||||
@Nullable
|
||||
public ServerPlayer getPlayerByName(String name) {
|
||||
@@ -348,7 +348,7 @@ index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3d
|
||||
}
|
||||
|
||||
public void broadcast(@Nullable net.minecraft.world.entity.player.Player player, double x, double y, double z, double distance, ResourceKey<Level> worldKey, Packet<?> packet) {
|
||||
@@ -1509,7 +1541,13 @@ public abstract class PlayerList {
|
||||
@@ -1476,7 +1508,13 @@ public abstract class PlayerList {
|
||||
|
||||
@Nullable
|
||||
public ServerPlayer getPlayer(UUID uuid) {
|
||||
@@ -364,10 +364,10 @@ index 6bc129a8a71e8936d596fa2e585a259282d11622..ba5fd079be52e8d179029925777dad3d
|
||||
|
||||
public boolean canBypassPlayerLimit(GameProfile profile) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b5283b7a59c76e75ba9a822f315ba0d813df8cfb..35eafbfa719c9ac3e235df0728650e1ed1c23fcd 100644
|
||||
index 922996adcf2b85e55a934191e90a12c42f169b0f..7e61b008c9429f6ef60fcef4887bb50db4face91 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1457,7 +1457,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1522,7 +1522,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return offsetFactor;
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ index b5283b7a59c76e75ba9a822f315ba0d813df8cfb..35eafbfa719c9ac3e235df0728650e1e
|
||||
final boolean xZero = movement.x == 0.0;
|
||||
final boolean yZero = movement.y == 0.0;
|
||||
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 09bcbc0ae36e4e69fee87a7e0c49acf496117a39..65b002f2ae062327f48df0e157aa35721478c5fd 100644
|
||||
index 61d412c4f1ebd55661cc3f0260468e3ac0efe0bb..c7bc8f493305cca9bac60c79e4e35cf5e369d355 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -183,7 +183,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -389,7 +389,7 @@ index 09bcbc0ae36e4e69fee87a7e0c49acf496117a39..65b002f2ae062327f48df0e157aa3572
|
||||
private final ItemCooldowns cooldowns;
|
||||
private Optional<GlobalPos> lastDeathLocation;
|
||||
@Nullable
|
||||
@@ -337,6 +337,12 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -340,6 +340,12 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ index 09bcbc0ae36e4e69fee87a7e0c49acf496117a39..65b002f2ae062327f48df0e157aa3572
|
||||
@Override
|
||||
protected float getMaxHeadRotationRelativeToBody() {
|
||||
return this.isBlocking() ? 15.0F : super.getMaxHeadRotationRelativeToBody();
|
||||
@@ -635,7 +641,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -661,7 +667,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
}
|
||||
|
||||
@@ -412,7 +412,7 @@ index 09bcbc0ae36e4e69fee87a7e0c49acf496117a39..65b002f2ae062327f48df0e157aa3572
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 1223c5d23d0ea6aed068bdf0f5725e2ad49fc82c..0e00f59a8962dd6356d483ef5be3209a3a410008 100644
|
||||
index 4daa69c6be6d48563e30343a7e40e4da9ec7e5ad..d5cb0d8ad7f7ed18ce38b39f245f5ec2c67042d5 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -63,7 +63,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -425,10 +425,10 @@ index 1223c5d23d0ea6aed068bdf0f5725e2ad49fc82c..0e00f59a8962dd6356d483ef5be3209a
|
||||
public int timeUntilHooked;
|
||||
public float fishAngle;
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index dd4218e108f87f3305b76fbc8d88f488b447c609..9bb703f2af1f201772b5309a4d80b3fbe23a7201 100644
|
||||
index 4680f77a275d8d2b226018db89a571ac25998dd8..a21c658343ab6e1eb3a98ff10369b490bd7d52da 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -406,6 +406,8 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -443,6 +443,8 @@ public abstract class AbstractContainerMenu {
|
||||
ItemStack itemstack1;
|
||||
int l;
|
||||
|
||||
@@ -437,7 +437,7 @@ index dd4218e108f87f3305b76fbc8d88f488b447c609..9bb703f2af1f201772b5309a4d80b3fb
|
||||
if (actionType == ClickType.QUICK_CRAFT) {
|
||||
int i1 = this.quickcraftStatus;
|
||||
|
||||
@@ -680,6 +682,22 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -733,6 +735,22 @@ public abstract class AbstractContainerMenu {
|
||||
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ index dd4218e108f87f3305b76fbc8d88f488b447c609..9bb703f2af1f201772b5309a4d80b3fb
|
||||
FeatureFlagSet featureflagset = player.level().enabledFeatures();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
index 1b1b475ca27e799e251d6f8a8c9fe1a4fd8bae83..22f8e7d62df86a12c5b9ad709538d6ac564d3338 100644
|
||||
index 021221da5d0315f6e371380a705ac6b3f6ac18d3..9c13b31e3a0ce6542ef2b2dd2361b906fdb359b8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
@@ -67,6 +67,11 @@ public class PhantomSpawner implements CustomSpawner {
|
||||
@@ -503,22 +503,22 @@ index b148cf247acdd36f856d0495cde4cc5ad32b5a2f..011d6c813781251c7f4041ad3a8396fb
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final File playerDir;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
index c9ecec5da937bc5458f69736b68ff6ae50aa5ebc..decaea842c557adecb9d2d6e654376f0508721bd 100644
|
||||
index adc6741e0e017660fbd39a62b69be1e67e0e143f..9bc40b07b8eebded4f748fd053b45571df6286a5 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -428,6 +428,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||
@@ -434,6 +434,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends Entity> T addEntity(T entity) {
|
||||
Preconditions.checkArgument(!entity.isInWorld(), "Entity has already been added to a world");
|
||||
+ Preconditions.checkState(!(entity instanceof org.leavesmc.leaves.entity.CraftBot), "[Leaves] Fakeplayers do not support changing world, Please use leaves fakeplayer-api instead!");
|
||||
net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||
if (nmsEntity.level() != this.getHandle().getLevel()) {
|
||||
nmsEntity = nmsEntity.changeDimension(new DimensionTransition(this.getHandle().getLevel(), nmsEntity, DimensionTransition.DO_NOTHING));
|
||||
nmsEntity = nmsEntity.teleport(new TeleportTransition(this.getHandle().getLevel(), nmsEntity, TeleportTransition.DO_NOTHING));
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index e79af523a49aaa6558b690383cb29649e6ae40c8..61dd71c2d5efbcb5dd363e2ac16757011b454082 100644
|
||||
index 3435629606def598ca998fb41ef303677c4cbea4..26ef09c86315c1125167af044323dbd3dbcfc6f0 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -310,6 +310,7 @@ public final class CraftServer implements Server {
|
||||
@@ -313,6 +313,7 @@ public final class CraftServer implements Server {
|
||||
private final io.papermc.paper.logging.SysoutCatcher sysoutCatcher = new io.papermc.paper.logging.SysoutCatcher(); // Paper
|
||||
private final io.papermc.paper.potion.PaperPotionBrewer potionBrewer; // Paper - Custom Potion Mixes
|
||||
public final io.papermc.paper.SparksFly spark; // Paper - spark
|
||||
@@ -526,7 +526,7 @@ index e79af523a49aaa6558b690383cb29649e6ae40c8..61dd71c2d5efbcb5dd363e2ac1675701
|
||||
|
||||
// Paper start - Folia region threading API
|
||||
private final io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler regionizedScheduler = new io.papermc.paper.threadedregions.scheduler.FallbackRegionScheduler();
|
||||
@@ -478,6 +479,7 @@ public final class CraftServer implements Server {
|
||||
@@ -492,6 +493,7 @@ public final class CraftServer implements Server {
|
||||
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
|
||||
this.spark = new io.papermc.paper.SparksFly(this); // Paper - spark
|
||||
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.init(); // Leaves - protocol
|
||||
@@ -534,7 +534,7 @@ index e79af523a49aaa6558b690383cb29649e6ae40c8..61dd71c2d5efbcb5dd363e2ac1675701
|
||||
}
|
||||
|
||||
public boolean getCommandBlockOverride(String command) {
|
||||
@@ -1465,7 +1467,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1479,7 +1481,7 @@ public final class CraftServer implements Server {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -543,10 +543,10 @@ index e79af523a49aaa6558b690383cb29649e6ae40c8..61dd71c2d5efbcb5dd363e2ac1675701
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3228,4 +3230,11 @@ public final class CraftServer implements Server {
|
||||
return this.potionBrewer;
|
||||
@@ -3281,4 +3283,11 @@ public final class CraftServer implements Server {
|
||||
this.console.addPluginAllowingSleep(plugin.getName(), value);
|
||||
}
|
||||
// Paper end
|
||||
// Paper end - API to check if the server is sleeping
|
||||
+
|
||||
+ // Leaves start - Bot API
|
||||
+ @Override
|
||||
@@ -556,10 +556,10 @@ index e79af523a49aaa6558b690383cb29649e6ae40c8..61dd71c2d5efbcb5dd363e2ac1675701
|
||||
+ // Leaves end - Bot API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index e76186d580a2d7f1a83af4600b0bdd435b67eba3..ce3d2a893729a95c6a74a373849dd42e04f7d68b 100644
|
||||
index 8f234b46c24a0ae08aa5f8190c5b27e1f62dfbab..df51d6d7909d407d8dcdbe1bfc5ca3a423005d5c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -245,7 +245,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -241,7 +241,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public int getPlayerCount() {
|
||||
@@ -568,7 +568,7 @@ index e76186d580a2d7f1a83af4600b0bdd435b67eba3..ce3d2a893729a95c6a74a373849dd42e
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1295,9 +1295,9 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1285,9 +1285,9 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
|
||||
@Override
|
||||
public List<Player> getPlayers() {
|
||||
@@ -580,7 +580,7 @@ index e76186d580a2d7f1a83af4600b0bdd435b67eba3..ce3d2a893729a95c6a74a373849dd42e
|
||||
HumanEntity bukkitEntity = human.getBukkitEntity();
|
||||
|
||||
if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) {
|
||||
@@ -1982,7 +1982,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1960,7 +1960,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
public void playSound(final net.kyori.adventure.sound.Sound sound) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("play sound"); // Paper
|
||||
final long seed = sound.seed().orElseGet(this.world.getRandom()::nextLong);
|
||||
@@ -589,7 +589,7 @@ index e76186d580a2d7f1a83af4600b0bdd435b67eba3..ce3d2a893729a95c6a74a373849dd42e
|
||||
player.connection.send(io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, player.getX(), player.getY(), player.getZ(), seed, null));
|
||||
}
|
||||
}
|
||||
@@ -1998,7 +1998,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -1988,7 +1988,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
org.spigotmc.AsyncCatcher.catchOp("play sound"); // Paper
|
||||
final long seed = sound.seed().orElseGet(this.getHandle().getRandom()::nextLong);
|
||||
if (emitter == net.kyori.adventure.sound.Sound.Emitter.self()) {
|
||||
@@ -598,7 +598,7 @@ index e76186d580a2d7f1a83af4600b0bdd435b67eba3..ce3d2a893729a95c6a74a373849dd42e
|
||||
player.connection.send(io.papermc.paper.adventure.PaperAdventure.asSoundPacket(sound, player, seed, null));
|
||||
}
|
||||
} else if (emitter instanceof CraftEntity craftEntity) {
|
||||
@@ -2219,7 +2219,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -2212,7 +2212,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
Preconditions.checkArgument(particle.getDataType().isInstance(data), "data (%s) should be %s", data.getClass(), particle.getDataType());
|
||||
}
|
||||
this.getHandle().sendParticles(
|
||||
@@ -608,10 +608,10 @@ index e76186d580a2d7f1a83af4600b0bdd435b67eba3..ce3d2a893729a95c6a74a373849dd42e
|
||||
CraftParticle.createParticleParam(particle, data), // Particle
|
||||
x, y, z, // Position
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 89c8713d2c2206d1b0d8c0a392c9d13b3e736f0c..48d3e8c718fb0d2926f6b2f26855bbbe115ccf7a 100644
|
||||
index ddabaed899c755925ad8618b78c33dacaf2126ac..dea387f418cd173980be2e6e24797b55f9f58409 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -94,6 +94,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -95,6 +95,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return new CraftHumanEntity(server, (net.minecraft.world.entity.player.Player) entity);
|
||||
}
|
||||
|
||||
@@ -621,10 +621,10 @@ index 89c8713d2c2206d1b0d8c0a392c9d13b3e736f0c..48d3e8c718fb0d2926f6b2f26855bbbe
|
||||
if (entity instanceof EnderDragonPart complexPart) {
|
||||
if (complexPart.parentMob instanceof EnderDragon) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 4632eb883e9f5efde520ee543bcad25827c0da2c..d710803137a325f34e0628405d5ddfd0bce16a95 100644
|
||||
index e37aaf77f94b97b736cc20ef070cefdff0400188..efc92e321bb78702388fb572197b7e442c463170 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -1027,7 +1027,10 @@ public class CraftEventFactory {
|
||||
@@ -1025,7 +1025,10 @@ public class CraftEventFactory {
|
||||
event.setKeepInventory(keepInventory);
|
||||
event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel
|
||||
populateFields(victim, event); // Paper - make cancellable
|
||||
@@ -638,7 +638,7 @@ index 4632eb883e9f5efde520ee543bcad25827c0da2c..d710803137a325f34e0628405d5ddfd0
|
||||
return event;
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/BotCommand.java b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5fbc27a190
|
||||
index 0000000000000000000000000000000000000000..4bf25cb267a8d01c2d04a2a9e34b9fc6a433cade
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/BotCommand.java
|
||||
@@ -0,0 +1,544 @@
|
||||
@@ -703,13 +703,13 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ if (args.length <= 1) {
|
||||
+ list.add("create");
|
||||
+ list.add("remove");
|
||||
+ if (LeavesConfig.fakeplayerUseAction) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.canUseAction) {
|
||||
+ list.add("action");
|
||||
+ }
|
||||
+ if (LeavesConfig.fakeplayerModifyConfig) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.canModifyConfig) {
|
||||
+ list.add("config");
|
||||
+ }
|
||||
+ if (LeavesConfig.fakeplayerManualSaveAndLoad) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.canManualSaveAndLoad) {
|
||||
+ list.add("save");
|
||||
+ list.add("load");
|
||||
+ }
|
||||
@@ -779,7 +779,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLabel, String[] args) {
|
||||
+ if (!testPermission(sender) || !LeavesConfig.fakeplayerSupport) return true;
|
||||
+ if (!testPermission(sender) || !LeavesConfig.modify.fakeplayer.enable) return true;
|
||||
+
|
||||
+ if (args.length == 0) {
|
||||
+ sender.sendMessage(unknownMessage);
|
||||
@@ -851,12 +851,12 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.unableFakeplayerNames.contains(name)) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.unableNames.contains(name)) {
|
||||
+ sender.sendMessage(text("This name is not allowed", NamedTextColor.RED));
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (botList.bots.size() >= org.leavesmc.leaves.LeavesConfig.fakeplayerLimit) {
|
||||
+ if (botList.bots.size() >= LeavesConfig.modify.fakeplayer.limit) {
|
||||
+ sender.sendMessage(text("Fakeplayer limit is full", NamedTextColor.RED));
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -939,7 +939,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ }
|
||||
+
|
||||
+ private void onAction(CommandSender sender, String @NotNull [] args) {
|
||||
+ if (!LeavesConfig.fakeplayerUseAction) {
|
||||
+ if (!LeavesConfig.modify.fakeplayer.canUseAction) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -1051,7 +1051,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ private static final List<String> acceptConfig = Configs.getConfigs().stream().map(config -> config.config.getName()).toList();
|
||||
+
|
||||
+ private void onConfig(CommandSender sender, String @NotNull [] args) {
|
||||
+ if (!LeavesConfig.fakeplayerModifyConfig) {
|
||||
+ if (!LeavesConfig.modify.fakeplayer.canModifyConfig) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -1096,7 +1096,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ }
|
||||
+
|
||||
+ private void onSave(CommandSender sender, String @NotNull [] args) {
|
||||
+ if (!LeavesConfig.fakeplayerManualSaveAndLoad) {
|
||||
+ if (!LeavesConfig.modify.fakeplayer.canManualSaveAndLoad) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -1119,7 +1119,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ }
|
||||
+
|
||||
+ private void onLoad(CommandSender sender, String @NotNull [] args) {
|
||||
+ if (!LeavesConfig.fakeplayerManualSaveAndLoad) {
|
||||
+ if (!LeavesConfig.modify.fakeplayer.canManualSaveAndLoad) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -1153,7 +1153,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+ botMap.get(bukkitBot.getWorld()).add(bukkitBot.getName());
|
||||
+ }
|
||||
+
|
||||
+ sender.sendMessage("Total number: (" + botList.bots.size() + "/" + org.leavesmc.leaves.LeavesConfig.fakeplayerLimit + ")");
|
||||
+ sender.sendMessage("Total number: (" + botList.bots.size() + "/" + LeavesConfig.modify.fakeplayer.limit + ")");
|
||||
+ for (World world : botMap.keySet()) {
|
||||
+ sender.sendMessage(world.getName() + "(" + botMap.get(world).size() + "): " + formatPlayerNameList(botMap.get(world)));
|
||||
+ }
|
||||
@@ -1188,7 +1188,7 @@ index 0000000000000000000000000000000000000000..527f01b206dcf0e677ac7ec8c27ebf5f
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/BotCreateState.java b/src/main/java/org/leavesmc/leaves/bot/BotCreateState.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..ebb3aa94718382e8fac2a8fa617c796a9387709b
|
||||
index 0000000000000000000000000000000000000000..bc09bb05fdccc7e6e51f441b0c23237145317e89
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/BotCreateState.java
|
||||
@@ -0,0 +1,120 @@
|
||||
@@ -1242,7 +1242,7 @@ index 0000000000000000000000000000000000000000..ebb3aa94718382e8fac2a8fa617c796a
|
||||
+ this.realName = realName;
|
||||
+ this.location = location;
|
||||
+
|
||||
+ this.name = LeavesConfig.fakeplayerPrefix + realName + LeavesConfig.fakeplayerSuffix;
|
||||
+ this.name = LeavesConfig.modify.fakeplayer.prefix + realName + LeavesConfig.modify.fakeplayer.suffix;
|
||||
+ this.skinName = this.realName;
|
||||
+ this.skin = null;
|
||||
+ this.createReason = BotCreateEvent.CreateReason.UNKNOWN;
|
||||
@@ -1638,10 +1638,10 @@ index 0000000000000000000000000000000000000000..4f5e6e5c1b9d8bd38c98e97fd31b3833
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/BotList.java b/src/main/java/org/leavesmc/leaves/bot/BotList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256391085c0
|
||||
index 0000000000000000000000000000000000000000..3881aa5c5bd18a8859715ad31624dbd5e92e5721
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/BotList.java
|
||||
@@ -0,0 +1,340 @@
|
||||
@@ -0,0 +1,297 @@
|
||||
+package org.leavesmc.leaves.bot;
|
||||
+
|
||||
+import com.google.common.collect.Maps;
|
||||
@@ -1659,7 +1659,6 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.EntityType;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
@@ -1675,7 +1674,6 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+import org.leavesmc.leaves.event.bot.BotSpawnLocationEvent;
|
||||
+import org.slf4j.Logger;
|
||||
+
|
||||
+import java.util.Iterator;
|
||||
+import java.util.List;
|
||||
+import java.util.Locale;
|
||||
+import java.util.Map;
|
||||
@@ -1762,7 +1760,10 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+ }
|
||||
+
|
||||
+ public ServerBot placeNewBot(ServerBot bot, ServerLevel world, Location location, @Nullable CompoundTag nbt) {
|
||||
+ Optional<CompoundTag> optional = Optional.ofNullable(nbt);
|
||||
+
|
||||
+ bot.isRealPlayer = true;
|
||||
+ bot.loginTime = System.currentTimeMillis();
|
||||
+ bot.connection = new ServerBotPacketListenerImpl(this.server, bot);
|
||||
+ bot.setServerLevel(world);
|
||||
+
|
||||
@@ -1771,18 +1772,21 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+ location = event.getSpawnLocation();
|
||||
+
|
||||
+ bot.spawnIn(world);
|
||||
+ bot.gameMode.setLevel((ServerLevel) bot.level());
|
||||
+ bot.gameMode.setLevel(bot.serverLevel());
|
||||
+
|
||||
+ bot.setPosRaw(location.getX(), location.getY(), location.getZ());
|
||||
+ bot.setRot(location.getYaw(), location.getPitch());
|
||||
+
|
||||
+ bot.connection.teleport(bot.getX(), bot.getY(), bot.getZ(), bot.getYRot(), bot.getXRot());
|
||||
+
|
||||
+ this.bots.add(bot);
|
||||
+ this.botsByName.put(bot.getScoreboardName().toLowerCase(Locale.ROOT), bot);
|
||||
+ this.botsByUUID.put(bot.getUUID(), bot);
|
||||
+
|
||||
+ bot.supressTrackerForLogin = true;
|
||||
+ world.addNewPlayer(bot);
|
||||
+ this.mountSavedVehicle(bot, world, nbt);
|
||||
+ bot.loadAndSpawnEnderpearls(optional);
|
||||
+ bot.loadAndSpawnParentVehicle(optional);
|
||||
+
|
||||
+ BotJoinEvent event1 = new BotJoinEvent(bot.getBukkitEntity(), PaperAdventure.asAdventure(Component.translatable("multiplayer.player.joined", bot.getDisplayName())).style(Style.style(NamedTextColor.YELLOW)));
|
||||
+ this.server.server.getPluginManager().callEvent(event1);
|
||||
@@ -1794,59 +1798,12 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+
|
||||
+ bot.renderAll();
|
||||
+ bot.supressTrackerForLogin = false;
|
||||
+
|
||||
+ bot.serverLevel().getChunkSource().chunkMap.addEntity(bot);
|
||||
+ BotList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", bot.getName().getString(), "Local", bot.getId(), bot.serverLevel().serverLevelData.getLevelName(), bot.getX(), bot.getY(), bot.getZ());
|
||||
+ return bot;
|
||||
+ }
|
||||
+
|
||||
+ private void mountSavedVehicle(ServerPlayer player, ServerLevel worldserver1, @Nullable CompoundTag nbt) {
|
||||
+ Optional<CompoundTag> optional = Optional.ofNullable(nbt);
|
||||
+ if (optional.isPresent() && optional.get().contains("RootVehicle", 10)) {
|
||||
+ CompoundTag nbttagcompound = optional.get().getCompound("RootVehicle");
|
||||
+ Entity entity = EntityType.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver1, (entity1) -> {
|
||||
+ return !worldserver1.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1;
|
||||
+ });
|
||||
+
|
||||
+ if (entity != null) {
|
||||
+ UUID uuid;
|
||||
+
|
||||
+ if (nbttagcompound.hasUUID("Attach")) {
|
||||
+ uuid = nbttagcompound.getUUID("Attach");
|
||||
+ } else {
|
||||
+ uuid = null;
|
||||
+ }
|
||||
+
|
||||
+ Iterator<Entity> iterator;
|
||||
+ Entity entity1;
|
||||
+
|
||||
+ if (entity.getUUID().equals(uuid)) {
|
||||
+ player.startRiding(entity, true);
|
||||
+ } else {
|
||||
+ iterator = entity.getIndirectPassengers().iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ entity1 = iterator.next();
|
||||
+ if (entity1.getUUID().equals(uuid)) {
|
||||
+ player.startRiding(entity1, true);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!player.isPassenger()) {
|
||||
+ BotList.LOGGER.warn("Couldn't reattach entity to fakeplayer");
|
||||
+ entity.discard();
|
||||
+ iterator = entity.getIndirectPassengers().iterator();
|
||||
+
|
||||
+ while (iterator.hasNext()) {
|
||||
+ entity1 = iterator.next();
|
||||
+ entity1.discard();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean removeBot(@NotNull ServerBot bot, @NotNull BotRemoveEvent.RemoveReason reason, @Nullable CommandSender remover, boolean saved) {
|
||||
+ return this.removeBot(bot, reason, remover, saved, this.dataStorage);
|
||||
+ }
|
||||
@@ -1917,13 +1874,13 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+
|
||||
+ public void removeAll() {
|
||||
+ for (ServerBot bot : this.bots) {
|
||||
+ bot.resume = LeavesConfig.fakeplayerResident;
|
||||
+ this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, LeavesConfig.fakeplayerResident);
|
||||
+ bot.resume = LeavesConfig.modify.fakeplayer.canResident;
|
||||
+ this.removeBot(bot, BotRemoveEvent.RemoveReason.INTERNAL, null, LeavesConfig.modify.fakeplayer.canResident);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void loadResume() {
|
||||
+ if (LeavesConfig.fakeplayerSupport && LeavesConfig.fakeplayerResident) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.enable && LeavesConfig.modify.fakeplayer.canResident) {
|
||||
+ CompoundTag savedBotList = this.getSavedBotList().copy();
|
||||
+ for (String realName : savedBotList.getAllKeys()) {
|
||||
+ CompoundTag nbt = savedBotList.getCompound(realName);
|
||||
@@ -1961,11 +1918,11 @@ index 0000000000000000000000000000000000000000..bb33cad06036f188bd9228556fff6256
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (LeavesConfig.unableFakeplayerNames.contains(name)) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.unableNames.contains(name)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ return this.bots.size() < LeavesConfig.fakeplayerLimit;
|
||||
+ return this.bots.size() < LeavesConfig.modify.fakeplayer.limit;
|
||||
+ }
|
||||
+
|
||||
+ public static class CustomGameProfile extends GameProfile {
|
||||
@@ -2124,7 +2081,7 @@ index 0000000000000000000000000000000000000000..7ebe4d6c71e90be92387a585ea581c6b
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/MojangAPI.java b/src/main/java/org/leavesmc/leaves/bot/MojangAPI.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..517e3321b866abe9d17a6fe9e919528b50bb130a
|
||||
index 0000000000000000000000000000000000000000..4162df8802b1af73d9a0a76f846ab9ad953a1921
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/MojangAPI.java
|
||||
@@ -0,0 +1,39 @@
|
||||
@@ -2145,7 +2102,7 @@ index 0000000000000000000000000000000000000000..517e3321b866abe9d17a6fe9e919528b
|
||||
+ private static final Map<String, String[]> CACHE = new HashMap<>();
|
||||
+
|
||||
+ public static String[] getSkin(String name) {
|
||||
+ if (LeavesConfig.fakeplayerCacheSkin && CACHE.containsKey(name)) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.useSkinCache && CACHE.containsKey(name)) {
|
||||
+ return CACHE.get(name);
|
||||
+ }
|
||||
+
|
||||
@@ -2169,10 +2126,10 @@ index 0000000000000000000000000000000000000000..517e3321b866abe9d17a6fe9e919528b
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/ServerBot.java b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a79a459dee
|
||||
index 0000000000000000000000000000000000000000..f83b787a6827bdcf3927dbf2a0a0fa6e998959ac
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/ServerBot.java
|
||||
@@ -0,0 +1,548 @@
|
||||
@@ -0,0 +1,556 @@
|
||||
+package org.leavesmc.leaves.bot;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableMap;
|
||||
@@ -2204,6 +2161,7 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+import net.minecraft.world.damagesource.DamageSource;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.entity.EquipmentSlot;
|
||||
+import net.minecraft.world.entity.PositionMoveRotation;
|
||||
+import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
+import net.minecraft.world.entity.item.ItemEntity;
|
||||
+import net.minecraft.world.entity.player.Player;
|
||||
@@ -2212,7 +2170,7 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+import net.minecraft.world.level.GameRules;
|
||||
+import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.gameevent.GameEvent;
|
||||
+import net.minecraft.world.level.portal.DimensionTransition;
|
||||
+import net.minecraft.world.level.portal.TeleportTransition;
|
||||
+import net.minecraft.world.phys.EntityHitResult;
|
||||
+import net.minecraft.world.phys.Vec3;
|
||||
+import org.bukkit.Bukkit;
|
||||
@@ -2282,7 +2240,7 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+ this.tracingRange = world.spigotConfig.playerTrackingRange * world.spigotConfig.playerTrackingRange;
|
||||
+
|
||||
+ this.notSleepTicks = 0;
|
||||
+ this.fauxSleeping = LeavesConfig.fakeplayerSkipSleep;
|
||||
+ this.fauxSleeping = LeavesConfig.modify.fakeplayer.canSkipSleep;
|
||||
+ }
|
||||
+
|
||||
+ public void sendPlayerInfo(ServerPlayer player) {
|
||||
@@ -2330,7 +2288,7 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+
|
||||
+ @Override
|
||||
+ public void die(@NotNull DamageSource damageSource) {
|
||||
+ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
+ boolean flag = this.serverLevel().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
+ Component defaultMessage = this.getCombatTracker().getDeathMessage();
|
||||
+
|
||||
+ BotDeathEvent event = new BotDeathEvent(this.getBukkitEntity(), PaperAdventure.asAdventure(defaultMessage), flag);
|
||||
@@ -2357,10 +2315,23 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+ this.sendPacket(new ClientboundPlayerInfoRemovePacket(List.of(this.getUUID())));
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public Entity changeDimension(@NotNull DimensionTransition teleportTarget) {
|
||||
+ return this; // disable dimension change
|
||||
+ public @Nullable ServerBot teleport(@NotNull TeleportTransition teleportTarget) {
|
||||
+ if (this.isSleeping() || this.isRemoved()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ if (teleportTarget.newLevel().dimension() != this.serverLevel().dimension()) {
|
||||
+ return null;
|
||||
+ } else {
|
||||
+ if (!teleportTarget.asPassenger()) {
|
||||
+ this.stopRiding();
|
||||
+ }
|
||||
+
|
||||
+ this.connection.internalTeleport(PositionMoveRotation.of(teleportTarget), teleportTarget.relatives());
|
||||
+ this.connection.resetPosition();
|
||||
+ teleportTarget.postTeleportTransition().onTransition(this);
|
||||
+ return this;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -2378,10 +2349,10 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+ notSleepTicks++;
|
||||
+ }
|
||||
+
|
||||
+ if (LeavesConfig.fakeplayerRegenAmount > 0.0 && server.getTickCount() % 20 == 0) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.regenAmount > 0.0 && server.getTickCount() % 20 == 0) {
|
||||
+ float health = getHealth();
|
||||
+ float maxHealth = getMaxHealth();
|
||||
+ float regenAmount = (float) (LeavesConfig.fakeplayerRegenAmount * 20);
|
||||
+ float regenAmount = (float) (LeavesConfig.modify.fakeplayer.regenAmount * 20);
|
||||
+ float amount;
|
||||
+
|
||||
+ if (health < maxHealth - regenAmount) {
|
||||
@@ -2414,13 +2385,12 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+
|
||||
+ @Override
|
||||
+ public @NotNull InteractionResult interact(@NotNull Player player, @NotNull InteractionHand hand) {
|
||||
+ if (LeavesConfig.openFakeplayerInventory) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.canOpenInventory) {
|
||||
+ if (player instanceof ServerPlayer player1 && player.getMainHandItem().isEmpty()) {
|
||||
+ BotInventoryOpenEvent event = new BotInventoryOpenEvent(this.getBukkitEntity(), player1.getBukkitEntity());
|
||||
+ this.server.server.getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ Component menuName = this.getDisplayName() != null ? this.getDisplayName() : Component.literal(this.createState.name());
|
||||
+ player.openMenu(new SimpleMenuProvider((i, inventory, p) -> ChestMenu.sixRows(i, inventory, this.container), menuName));
|
||||
+ player.openMenu(new SimpleMenuProvider((i, inventory, p) -> ChestMenu.sixRows(i, inventory, this.container), this.getDisplayName()));
|
||||
+ return InteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
@@ -2501,7 +2471,7 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+ this.addDeltaMovement(knockback);
|
||||
+ this.knockback = Vec3.ZERO;
|
||||
+
|
||||
+ this.server.tell(this.server.wrapRunnable(this::runAction));
|
||||
+ this.server.scheduleOnMain(this::runAction);
|
||||
+
|
||||
+ this.livingEntityTick();
|
||||
+
|
||||
@@ -2537,11 +2507,6 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setRot(float yaw, float pitch) {
|
||||
+ this.getBukkitEntity().setRotation(yaw, pitch);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void attack(@NotNull Entity target) {
|
||||
+ super.attack(target);
|
||||
+ this.swing(InteractionHand.MAIN_HAND);
|
||||
@@ -2677,14 +2642,14 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+ }
|
||||
+
|
||||
+ private void runAction() {
|
||||
+ if (LeavesConfig.fakeplayerUseAction) {
|
||||
+ if (LeavesConfig.modify.fakeplayer.canUseAction) {
|
||||
+ this.actions.forEach(action -> action.tryTick(this));
|
||||
+ this.actions.removeIf(BotAction::isCancelled);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public boolean addBotAction(BotAction<?> action, CommandSender sender) {
|
||||
+ if (!LeavesConfig.fakeplayerUseAction) {
|
||||
+ if (!LeavesConfig.modify.fakeplayer.canUseAction) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
@@ -2723,10 +2688,10 @@ index 0000000000000000000000000000000000000000..1a50c4efbec7ff4000e23a477c2f60a7
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/ServerBotGameMode.java b/src/main/java/org/leavesmc/leaves/bot/ServerBotGameMode.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..bc1e29f6080c4783940848456620be8c06c32cce
|
||||
index 0000000000000000000000000000000000000000..87ea98ab920a604bdd51281e0656c65160d30118
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/ServerBotGameMode.java
|
||||
@@ -0,0 +1,138 @@
|
||||
@@ -0,0 +1,137 @@
|
||||
+package org.leavesmc.leaves.bot;
|
||||
+
|
||||
+import net.kyori.adventure.text.Component;
|
||||
@@ -2736,7 +2701,6 @@ index 0000000000000000000000000000000000000000..bc1e29f6080c4783940848456620be8c
|
||||
+import net.minecraft.server.level.ServerPlayerGameMode;
|
||||
+import net.minecraft.world.InteractionHand;
|
||||
+import net.minecraft.world.InteractionResult;
|
||||
+import net.minecraft.world.ItemInteractionResult;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.item.context.UseOnContext;
|
||||
+import net.minecraft.world.level.GameType;
|
||||
@@ -2826,7 +2790,7 @@ index 0000000000000000000000000000000000000000..bc1e29f6080c4783940848456620be8c
|
||||
+ return InteractionResult.FAIL;
|
||||
+ }
|
||||
+
|
||||
+ if (player.getCooldowns().isOnCooldown(stack.getItem())) {
|
||||
+ if (player.getCooldowns().isOnCooldown(stack)) {
|
||||
+ return InteractionResult.PASS;
|
||||
+ }
|
||||
+
|
||||
@@ -2840,13 +2804,13 @@ index 0000000000000000000000000000000000000000..bc1e29f6080c4783940848456620be8c
|
||||
+ boolean flag1 = player.isSecondaryUseActive() && flag;
|
||||
+
|
||||
+ if (!flag1) {
|
||||
+ ItemInteractionResult iteminteractionresult = iblockdata.useItemOn(player.getItemInHand(hand), world, player, hand, hitResult);
|
||||
+ InteractionResult iteminteractionresult = iblockdata.useItemOn(player.getItemInHand(hand), world, player, hand, hitResult);
|
||||
+
|
||||
+ if (iteminteractionresult.consumesAction()) {
|
||||
+ return iteminteractionresult.result();
|
||||
+ return iteminteractionresult;
|
||||
+ }
|
||||
+
|
||||
+ if (iteminteractionresult == ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION && hand == InteractionHand.MAIN_HAND) {
|
||||
+ if (iteminteractionresult == InteractionResult.PASS && hand == InteractionHand.MAIN_HAND) {
|
||||
+ enuminteractionresult = iblockdata.useWithoutItem(world, player, hitResult);
|
||||
+ if (enuminteractionresult.consumesAction()) {
|
||||
+ return enuminteractionresult;
|
||||
@@ -3349,7 +3313,7 @@ index 0000000000000000000000000000000000000000..be55a3085a53542c08e7f0209883a4f3
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/agent/actions/AttackAction.java b/src/main/java/org/leavesmc/leaves/bot/agent/actions/AttackAction.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..03e9baf9b7c2da0fd1d7d9b0058b70daddedeeaa
|
||||
index 0000000000000000000000000000000000000000..6c66ef29e702a49d1b8569aa0942e22e40843343
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/agent/actions/AttackAction.java
|
||||
@@ -0,0 +1,22 @@
|
||||
@@ -3367,7 +3331,7 @@ index 0000000000000000000000000000000000000000..03e9baf9b7c2da0fd1d7d9b0058b70da
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean doTick(@NotNull ServerBot bot) {
|
||||
+ Entity entity = bot.getTargetEntity(3, Entity::isAttackable);
|
||||
+ Entity entity = bot.getTargetEntity(3, target -> target.isAttackable() && !target.skipAttackInteraction(bot));
|
||||
+ if (entity != null) {
|
||||
+ bot.attack(entity);
|
||||
+ return true;
|
||||
@@ -4208,7 +4172,7 @@ index 0000000000000000000000000000000000000000..f8334858a7a0572d1c3dcf5f04696fbb
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/agent/configs/AlwaysSendDataConfig.java b/src/main/java/org/leavesmc/leaves/bot/agent/configs/AlwaysSendDataConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..9a584603edbbe4ccd8a88c90ef3e9125480635f1
|
||||
index 0000000000000000000000000000000000000000..31f68872652b3ac217d3b4f56e3bdd778314c27a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/agent/configs/AlwaysSendDataConfig.java
|
||||
@@ -0,0 +1,45 @@
|
||||
@@ -4231,7 +4195,7 @@ index 0000000000000000000000000000000000000000..9a584603edbbe4ccd8a88c90ef3e9125
|
||||
+
|
||||
+ public AlwaysSendDataConfig() {
|
||||
+ super("always_send_data", CommandArgument.of(CommandArgumentType.BOOLEAN).setTabComplete(0, List.of("ture", "false")), AlwaysSendDataConfig::new);
|
||||
+ this.value = LeavesConfig.alwaysSendFakeplayerData;
|
||||
+ this.value = LeavesConfig.modify.fakeplayer.canSendDataAlways;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -4360,7 +4324,7 @@ index 0000000000000000000000000000000000000000..0d934910cff745ea9a53d651e2007963
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/bot/agent/configs/SpawnPhantomConfig.java b/src/main/java/org/leavesmc/leaves/bot/agent/configs/SpawnPhantomConfig.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a3f978318a67c3c5e147a50eb2b6c01c3f549dc2
|
||||
index 0000000000000000000000000000000000000000..983b358a5cc03f07d36a3924d55275294b9a727e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/bot/agent/configs/SpawnPhantomConfig.java
|
||||
@@ -0,0 +1,51 @@
|
||||
@@ -4382,7 +4346,7 @@ index 0000000000000000000000000000000000000000..a3f978318a67c3c5e147a50eb2b6c01c
|
||||
+
|
||||
+ public SpawnPhantomConfig() {
|
||||
+ super("spawn_phantom", CommandArgument.of(CommandArgumentType.BOOLEAN).setTabComplete(0, List.of("ture", "false")), SpawnPhantomConfig::new);
|
||||
+ this.value = LeavesConfig.fakeplayerSpawnPhantom;
|
||||
+ this.value = LeavesConfig.modify.fakeplayer.canSpawnPhantom;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@@ -4429,22 +4393,16 @@ index f50c3871e3ab435abc6de5bfb67b85b09d235733..d110bf39788503ec662d6f0c737ce9aa
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/entity/CraftBot.java b/src/main/java/org/leavesmc/leaves/entity/CraftBot.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b33a3ca0e2b6a06668252048ce064dd294c28bee
|
||||
index 0000000000000000000000000000000000000000..aaa5f8a3a70cac4483003c4a4a7ac2db72791ef9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/entity/CraftBot.java
|
||||
@@ -0,0 +1,102 @@
|
||||
@@ -0,0 +1,94 @@
|
||||
+package org.leavesmc.leaves.entity;
|
||||
+
|
||||
+import com.google.common.base.Preconditions;
|
||||
+import io.papermc.paper.entity.TeleportFlag;
|
||||
+import net.minecraft.world.level.portal.DimensionTransition;
|
||||
+import net.minecraft.world.phys.Vec3;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
@@ -4456,7 +4414,6 @@ index 0000000000000000000000000000000000000000..b33a3ca0e2b6a06668252048ce064dd2
|
||||
+import org.leavesmc.leaves.event.bot.BotActionStopEvent;
|
||||
+import org.leavesmc.leaves.event.bot.BotRemoveEvent;
|
||||
+
|
||||
+import java.util.Set;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+public class CraftBot extends CraftPlayer implements Bot {
|
||||
@@ -4515,7 +4472,6 @@ index 0000000000000000000000000000000000000000..b33a3ca0e2b6a06668252048ce064dd2
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause, io.papermc.paper.entity.TeleportFlag... flags) {
|
||||
+ // Paper end
|
||||
+ Preconditions.checkArgument(location != null, "location cannot be null");
|
||||
+ Preconditions.checkState(location.getWorld().equals(this.getWorld()), "[Leaves] Fakeplayers do not support changing world, Please use leaves fakeplayer-api instead!");
|
||||
+ return super.teleport(location, cause, flags);
|
||||
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Make shears in dispenser can unlimited use
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
index 44b79a7c2f8b95a484d1999fa2167ce588f7985b..67c1aaf2fce72da77e74748d3a8855f0e2b02efb 100644
|
||||
index 65ed3d77a51b8299517e0c165403b0c5ac413475..4708560d4c749f3c1039beaa2779c0036fb3d42e 100644
|
||||
--- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java
|
||||
@@ -64,7 +64,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior {
|
||||
BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING));
|
||||
|
||||
this.setSuccess(ShearsDispenseItemBehavior.tryShearBeehive(worldserver, blockposition) || ShearsDispenseItemBehavior.tryShearLivingEntity(worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
this.setSuccess(ShearsDispenseItemBehavior.tryShearBeehive(worldserver, blockposition) || ShearsDispenseItemBehavior.tryShearLivingEntity(worldserver, blockposition, stack, bukkitBlock, craftItem)); // CraftBukkit
|
||||
- if (this.isSuccess()) {
|
||||
+ if (this.isSuccess() && !org.leavesmc.leaves.LeavesConfig.shearsInDispenserCanZeroAmount) { // Leaves - Make shears in dispenser can unlimited use
|
||||
+ if (this.isSuccess() && !org.leavesmc.leaves.LeavesConfig.modify.oldMC.shearsInDispenserCanZeroAmount) { // Leaves - Make shears in dispenser can unlimited use
|
||||
stack.hurtAndBreak(1, worldserver, (ServerPlayer) null, (item) -> {
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Redstone Shears Wrench
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ShearsItem.java b/src/main/java/net/minecraft/world/item/ShearsItem.java
|
||||
index cb809796372a4658aa617404f9fddffff9b45cb7..6ec6f786fda5a6d3f28e4e3d29a9754edb0356d0 100644
|
||||
index 374d51da03ce47ff744b64b8cfe98ad6d72ebdb4..5ae43ecff45239086ab8aad3b5c2e0774b999544 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ShearsItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ShearsItem.java
|
||||
@@ -19,6 +19,23 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock;
|
||||
@@ -23,6 +23,23 @@ import net.minecraft.world.level.block.GrowingPlantHeadBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
@@ -32,13 +32,13 @@ index cb809796372a4658aa617404f9fddffff9b45cb7..6ec6f786fda5a6d3f28e4e3d29a9754e
|
||||
public class ShearsItem extends Item {
|
||||
public ShearsItem(Item.Properties settings) {
|
||||
super(settings);
|
||||
@@ -77,6 +94,67 @@ public class ShearsItem extends Item {
|
||||
return InteractionResult.sidedSuccess(level.isClientSide);
|
||||
@@ -82,6 +99,67 @@ public class ShearsItem extends Item {
|
||||
return InteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
+ // Leaves start - shears wrench
|
||||
+ Block block = blockState.getBlock();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.redstoneShearsWrench && block instanceof ObserverBlock || block instanceof DispenserBlock ||
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.redstoneShearsWrench && block instanceof ObserverBlock || block instanceof DispenserBlock ||
|
||||
+ block instanceof PistonBaseBlock || block instanceof HopperBlock || block instanceof RepeaterBlock || block instanceof ComparatorBlock ||
|
||||
+ block instanceof CrafterBlock || block instanceof LeverBlock || block instanceof CocoaBlock) {
|
||||
+ StateDefinition<Block, BlockState> blockstatelist = block.getStateDefinition();
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add isShrink to EntityResurrectEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index a0f6d383b430c8e320f041fe2221943830b021eb..98df8261434739e3648b4b1e473606921c9a27c6 100644
|
||||
index f36a075dbee2b96d01899e02460b1d8443e91749..d487bf7c9d425e5bc82c7efd7b901752ef915f16 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1662,12 +1662,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1703,12 +1703,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
|
||||
@@ -22,8 +22,8 @@ index a0f6d383b430c8e320f041fe2221943830b021eb..98df8261434739e3648b4b1e47360692
|
||||
+ if (!itemstack1.isEmpty() && itemstack != null && event.isShrink()) { // Paper - only reduce item if actual totem was found // Leaves - can dont shrink
|
||||
itemstack1.shrink(1);
|
||||
}
|
||||
if (itemstack != null && this instanceof ServerPlayer) {
|
||||
@@ -4666,3 +4666,4 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
// Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled
|
||||
@@ -4804,3 +4804,4 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,43 +5,45 @@ Subject: [PATCH] Budding Amethyst can push by piston
|
||||
|
||||
|
||||
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 ae86e1edde015e2ff6cd10c31e0a6065708241af..7130209f48c488e2d184f31335f0511735963c55 100644
|
||||
index b6d6c2cb9b227a17fb4ce42bc75f92206fbea043..b3a3388ef62b0622906b2470056cb41f0deb0391 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -588,6 +588,12 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -583,6 +583,13 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
+ // Leaves start - reset push reaction
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ public net.minecraft.world.level.material.PushReaction getResetPushReaction() {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // Leaves end - reset push reaction
|
||||
+
|
||||
public static final class BlockStatePairKey {
|
||||
private static record ShapePairKey(VoxelShape first, VoxelShape second) {
|
||||
|
||||
private final BlockState first;
|
||||
public boolean equals(Object object) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
index 8920855b07a31715327b8102c7faafc9f916825d..32d926a1b952b8069c5bf48c88e3c108b08b4ab1 100644
|
||||
index 8920855b07a31715327b8102c7faafc9f916825d..e6cc94e9c1b2388b8e42821e6bfaa2e22d44f9d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
|
||||
@@ -60,4 +60,11 @@ public class BuddingAmethystBlock extends AmethystBlock {
|
||||
@@ -60,4 +60,12 @@ public class BuddingAmethystBlock extends AmethystBlock {
|
||||
public static boolean canClusterGrowAtState(BlockState state) {
|
||||
return state.isAir() || state.is(Blocks.WATER) && state.getFluidState().getAmount() == 8;
|
||||
}
|
||||
+
|
||||
+ // Leaves start - budding amethyst can push by piston
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ @Override
|
||||
+ public net.minecraft.world.level.material.PushReaction getResetPushReaction() {
|
||||
+ return org.leavesmc.leaves.LeavesConfig.buddingAmethystCanPushByPiston ? net.minecraft.world.level.material.PushReaction.PUSH_ONLY : null;
|
||||
+ return org.leavesmc.leaves.LeavesConfig.modify.buddingAmethystCanPushByPiston ? net.minecraft.world.level.material.PushReaction.PUSH_ONLY : null;
|
||||
+ }
|
||||
+ // Leaves end - budding amethyst can push by piston
|
||||
}
|
||||
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 d0109633e8bdf109cfc9178963d7b6cf92f8b189..e9b4e88caeb57cc67bfd027bb15585eff9a13e04 100644
|
||||
index 99fd67a78539133adf78d65e2c520ff3dd260301..4c1ec8de5aa2edde1dbcff350a65b7fc4a4b5e74 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
|
||||
@@ -1099,7 +1099,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
@@ -1159,7 +1159,7 @@ public abstract class BlockBehaviour implements FeatureElement {
|
||||
}
|
||||
|
||||
public PushReaction getPistonPushReaction() {
|
||||
@@ -49,4 +51,4 @@ index d0109633e8bdf109cfc9178963d7b6cf92f8b189..e9b4e88caeb57cc67bfd027bb15585ef
|
||||
+ return !this.isDestroyable() ? PushReaction.BLOCK : this.getBlock().getResetPushReaction() == null ? this.pushReaction : this.getBlock().getResetPushReaction(); // Paper - Protect Bedrock and End Portal/Frames from being destroyed // Leaves - can reset
|
||||
}
|
||||
|
||||
public boolean isSolidRender(BlockGetter world, BlockPos pos) {
|
||||
public boolean isSolidRender() {
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Spectator dont get Advancement
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
index b5f18a0115b629930de84a9d086505adaa6087dd..ece0aa3bf18e864a261d4d4edf0a98a40e7f6bb3 100644
|
||||
index b9ed92cd8a12f648eeaa02427d95d75468534420..7f8eaf4590a29b147aa8c05cec919fd7744e74ba 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
|
||||
@@ -221,6 +221,11 @@ public class PlayerAdvancements {
|
||||
@@ -13,7 +13,7 @@ index b5f18a0115b629930de84a9d086505adaa6087dd..ece0aa3bf18e864a261d4d4edf0a98a4
|
||||
|
||||
public boolean award(AdvancementHolder advancement, String criterionName) {
|
||||
+ // Leaves start - spectator don't get advancement
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.spectatorDontGetAdvancement && player.gameMode.getGameModeForPlayer() == net.minecraft.world.level.GameType.SPECTATOR) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.spectatorDontGetAdvancement && player.gameMode.getGameModeForPlayer() == net.minecraft.world.level.GameType.SPECTATOR) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Leaves end - spectator don't get advancement
|
||||
|
||||
@@ -5,16 +5,16 @@ Subject: [PATCH] Stick can change ArmorStand arm status
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
index 2f398750bfee5758ad8b1367b6fc14364e4de776..df29a54063ee957c2b88a12ef228c7d8541a2f2c 100644
|
||||
index 70b8023c3badc745f342d5b0ab54699e3923826a..49e8a9d5df9b20bced385019f5e7fb622536213a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
|
||||
@@ -392,6 +392,12 @@ public class ArmorStand extends LivingEntity {
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -397,6 +397,12 @@ public class ArmorStand extends LivingEntity {
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
}
|
||||
} else {
|
||||
+ // Leaves start - stick can change ArmorStand arm status
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.stickChangeArmorStandArmStatus && itemstack.is(Items.STICK) && player.isShiftKeyDown()) {
|
||||
+ setShowArms(!isShowArms());
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.stickChangeArmorStandArmStatus && itemstack.is(Items.STICK) && player.isShiftKeyDown()) {
|
||||
+ setShowArms(!showArms());
|
||||
+ }
|
||||
+ // Leaves end - stick can change ArmorStand arm status
|
||||
+
|
||||
|
||||
42
patches/server/0017-Configurable-MC-59471.patch
Normal file
42
patches/server/0017-Configurable-MC-59471.patch
Normal file
@@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sat, 30 Jul 2022 01:11:30 +0800
|
||||
Subject: [PATCH] Configurable MC-59471
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index c2589f42c467ca672417c24076313da51bb2dcbb..99caf34456385565d8a985409690c656ab3d3c3d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -191,7 +191,7 @@ public class TripWireHookBlock extends Block {
|
||||
|
||||
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
|
||||
if (!flag) {
|
||||
- if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update
|
||||
+ // if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update // Leaves - vanilla lol
|
||||
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
|
||||
if (flag1) {
|
||||
TripWireHookBlock.notifyNeighbors(block, world, pos, enumdirection);
|
||||
@@ -204,11 +204,18 @@ public class TripWireHookBlock extends Block {
|
||||
BlockState iblockdata4 = aiblockdata[l];
|
||||
|
||||
if (iblockdata4 != null) {
|
||||
- BlockState iblockdata5 = world.getBlockState(blockposition2);
|
||||
-
|
||||
- if (iblockdata5.is(Blocks.TRIPWIRE) || iblockdata5.is(Blocks.TRIPWIRE_HOOK)) {
|
||||
- world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
+ // Leaves start - MC-59471
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.stringTripwireHookDuplicate) {
|
||||
+ world.setBlock(blockposition2, iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
+ world.getBlockState(blockposition2);
|
||||
+ } else {
|
||||
+ BlockState iblockdata5 = world.getBlockState(blockposition2);
|
||||
+
|
||||
+ if (iblockdata5.is(Blocks.TRIPWIRE) || iblockdata5.is(Blocks.TRIPWIRE_HOOK)) {
|
||||
+ world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
+ }
|
||||
}
|
||||
+ // Leaves end - MC-59471
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Sat, 30 Jul 2022 01:11:30 +0800
|
||||
Subject: [PATCH] Fix tripwire update
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
index 76aca266d3f3222502ff4c196228f08fcd88c5f8..6b921c459e24c509b3962837b4c966d012940c08 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TripWireHookBlock.java
|
||||
@@ -189,7 +189,7 @@ public class TripWireHookBlock extends Block {
|
||||
|
||||
TripWireHookBlock.emitState(world, pos, flag4, flag5, flag2, flag3);
|
||||
if (!flag) {
|
||||
- if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update
|
||||
+ // if (world.getBlockState(pos).getBlock() == Blocks.TRIPWIRE_HOOK) // Paper - Validate tripwire hook placement before update // Leaves - vanilla lol
|
||||
world.setBlock(pos, (BlockState) iblockdata3.setValue(TripWireHookBlock.FACING, enumdirection), 3);
|
||||
if (flag1) {
|
||||
TripWireHookBlock.notifyNeighbors(block, world, pos, enumdirection);
|
||||
@@ -202,8 +202,9 @@ public class TripWireHookBlock extends Block {
|
||||
BlockState iblockdata4 = aiblockdata[l];
|
||||
|
||||
if (iblockdata4 != null) {
|
||||
- if (world.getBlockState(blockposition2).is(Blocks.TRIPWIRE) || io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowTripwireDisarmingExploits) { // Paper - Fix tripwire disarming not working as intended
|
||||
world.setBlock(blockposition2, (BlockState) iblockdata4.trySetValue(TripWireHookBlock.ATTACHED, flag4), 3);
|
||||
+ if (!world.getBlockState(blockposition2).isAir()) {
|
||||
+ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] No chat sign
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
index 14e412ebf75b0e06ab53a1c8f9dd1be6ad1e2680..8fe9a0bf5a6c27d8a505afc2f51b3dccc905423b 100644
|
||||
index 14e412ebf75b0e06ab53a1c8f9dd1be6ad1e2680..73d239536b373e292ee2883edac0049541b59ba0 100644
|
||||
--- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
+++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java
|
||||
@@ -317,7 +317,7 @@ public final class ChatProcessor {
|
||||
@@ -13,12 +13,12 @@ index 14e412ebf75b0e06ab53a1c8f9dd1be6ad1e2680..8fe9a0bf5a6c27d8a505afc2f51b3dcc
|
||||
private void sendToServer(final ChatType.Bound chatType, final @Nullable Function<Audience, net.minecraft.network.chat.Component> msgFunction) {
|
||||
final PlayerChatMessage toConsoleMessage = msgFunction == null ? ChatProcessor.this.message : ChatProcessor.this.message.withUnsignedContent(msgFunction.apply(ChatProcessor.this.server.console));
|
||||
- ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) ? null : "Not Secure");
|
||||
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) || org.leavesmc.leaves.LeavesConfig.noChatSign ? null : "Not Secure"); // Leaves - No Not Secure
|
||||
+ ChatProcessor.this.server.logChatMessage(toConsoleMessage.decoratedContent(), chatType, ChatProcessor.this.server.getPlayerList().verifyChatTrusted(toConsoleMessage) || org.leavesmc.leaves.LeavesConfig.mics.noChatSign ? null : "Not Secure"); // Leaves - No Not Secure
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||
index 479e6e2aa88a22ef7f8fccb06add6806f5b71d9d..e6a6d09a64414ae6932e9bac338ce36043bd4b26 100644
|
||||
index 479e6e2aa88a22ef7f8fccb06add6806f5b71d9d..5a103b7c4d2566d93b18a2e8db32a3444ba44e36 100644
|
||||
--- a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||
+++ b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
|
||||
@@ -13,10 +13,17 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
|
||||
@@ -33,7 +33,7 @@ index 479e6e2aa88a22ef7f8fccb06add6806f5b71d9d..e6a6d09a64414ae6932e9bac338ce360
|
||||
|
||||
+ private static List<ArgumentSignatures.Entry> readSign(FriendlyByteBuf buf) {
|
||||
+ var entries = buf.readCollection(FriendlyByteBuf.limitValue(ArrayList::new, 8), Entry::new);
|
||||
+ return org.leavesmc.leaves.LeavesConfig.noChatSign ? List.of() : entries;
|
||||
+ return org.leavesmc.leaves.LeavesConfig.mics.noChatSign ? List.of() : entries;
|
||||
+ }
|
||||
+ // Leaves end - no chat sign
|
||||
+
|
||||
@@ -41,7 +41,7 @@ index 479e6e2aa88a22ef7f8fccb06add6806f5b71d9d..e6a6d09a64414ae6932e9bac338ce360
|
||||
buf.writeCollection(this.entries, (buf2, entry) -> entry.write(buf2));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 0cd6a50837efce87ca052a0e1e24db2b75761196..8212aaf92f028ea560b357771cdf5810d84aed43 100644
|
||||
index a523a83aec3a6ecbec4d60a187edc0c0167d15b4..e4ac9fac52cec522d679a1ffe8b3263a204f5d7f 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -129,6 +129,16 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
@@ -51,7 +51,7 @@ index 0cd6a50837efce87ca052a0e1e24db2b75761196..8212aaf92f028ea560b357771cdf5810
|
||||
+ // Leaves start - no chat sign
|
||||
+ if (codec == net.minecraft.network.protocol.status.ServerStatus.CODEC) {
|
||||
+ JsonElement element = dataresult.getOrThrow(string -> new EncoderException("Failed to encode: " + string + " " + value));
|
||||
+ element.getAsJsonObject().addProperty("preventsChatReports", org.leavesmc.leaves.LeavesConfig.noChatSign);
|
||||
+ element.getAsJsonObject().addProperty("preventsChatReports", org.leavesmc.leaves.LeavesConfig.mics.noChatSign);
|
||||
+
|
||||
+ this.writeUtf(GSON.toJson(element));
|
||||
+ return;
|
||||
@@ -62,7 +62,7 @@ index 0cd6a50837efce87ca052a0e1e24db2b75761196..8212aaf92f028ea560b357771cdf5810
|
||||
return new EncoderException("Failed to encode: " + s + " " + String.valueOf(value));
|
||||
})), maxLength); // Paper - Adventure; add max length parameter
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
index 07df3299f1d1aa5506e1f6f146347d53e0278d9c..fb441424c03d547cdf4dcfcde5e60d8e4d6a4f59 100644
|
||||
index 07df3299f1d1aa5506e1f6f146347d53e0278d9c..342f23250f22771d8b395cece087d277fd99eaae 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
|
||||
@@ -15,8 +15,9 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt
|
||||
@@ -83,7 +83,7 @@ index 07df3299f1d1aa5506e1f6f146347d53e0278d9c..fb441424c03d547cdf4dcfcde5e60d8e
|
||||
+ private static MessageSignature readSign(FriendlyByteBuf buf) {
|
||||
+ byte[] bs = new byte[256];
|
||||
+ buf.readBytes(bs);
|
||||
+ return org.leavesmc.leaves.LeavesConfig.noChatSign ? null : new MessageSignature(bs);
|
||||
+ return org.leavesmc.leaves.LeavesConfig.mics.noChatSign ? null : new MessageSignature(bs);
|
||||
+ }
|
||||
+ // Leaves end - no chat sign
|
||||
+
|
||||
@@ -91,7 +91,7 @@ index 07df3299f1d1aa5506e1f6f146347d53e0278d9c..fb441424c03d547cdf4dcfcde5e60d8e
|
||||
public PacketType<ServerboundChatPacket> type() {
|
||||
return GamePacketTypes.SERVERBOUND_CHAT;
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
||||
index 5705cb920084b775cce4b361683b32c6b6e003ed..cbff868303d751d09b68f431c78bb13b4734f48f 100644
|
||||
index 5705cb920084b775cce4b361683b32c6b6e003ed..eb0caad2613e8fdd7dbcc2a295cc9201a225f3f2 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatSessionUpdatePacket.java
|
||||
@@ -26,6 +26,11 @@ public record ServerboundChatSessionUpdatePacket(RemoteChatSession.Data chatSess
|
||||
@@ -99,7 +99,7 @@ index 5705cb920084b775cce4b361683b32c6b6e003ed..cbff868303d751d09b68f431c78bb13b
|
||||
@Override
|
||||
public void handle(ServerGamePacketListener listener) {
|
||||
+ // Leaves start - no chat report
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.noChatSign) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.mics.noChatSign) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - no chat report
|
||||
@@ -107,28 +107,28 @@ index 5705cb920084b775cce4b361683b32c6b6e003ed..cbff868303d751d09b68f431c78bb13b
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index 4ac40259f31f3deef6b5fe4456576bbd44cc2569..e45acea31d61462c877c902b238209f14f2c8ad1 100644
|
||||
index 9b1e6effb8bf852957dba92a54688932ddb0d565..679a40aeedc7e259401a6c244ed54136d6c75a40 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -669,7 +669,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -650,7 +650,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
// Paper start - Add setting for proxy online mode status
|
||||
return dedicatedserverproperties.enforceSecureProfile
|
||||
&& io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
||||
- && this.services.canValidateProfileKeys();
|
||||
+ && this.services.canValidateProfileKeys() && !org.leavesmc.leaves.LeavesConfig.noChatSign; // Leaves - no chat sign
|
||||
+ && this.services.canValidateProfileKeys() && !org.leavesmc.leaves.LeavesConfig.mics.noChatSign; // Leaves - no chat sign
|
||||
// Paper end - Add setting for proxy online mode status
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 7adef76ecc246b131cee35cf00c3c05bd75d5504..7bc847d7475de6cca22e587fdb9999563bbce14d 100644
|
||||
index 8344c7f953fc465ee9f43e1f81e2eb062fd3c432..93404b7e1aaf74d6acc7031116dc8f63fc70f964 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -297,10 +297,24 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -304,10 +304,24 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet) {
|
||||
+ // Leaves start - rebuild ClientboundPlayerChatPacket
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.noChatSign) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.mics.noChatSign) {
|
||||
+ if (this instanceof ServerGamePacketListenerImpl && packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat) {
|
||||
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(chat.chatType().decorate(chat.unsignedContent() != null ? chat.unsignedContent() : Component.literal(chat.body().content())), false);
|
||||
+ }
|
||||
@@ -139,7 +139,7 @@ index 7adef76ecc246b131cee35cf00c3c05bd75d5504..7bc847d7475de6cca22e587fdb999956
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener callbacks) {
|
||||
+ // Leaves start - no ClientboundPlayerChatHeaderPacket and rebuild ClientboundPlayerChatPacket
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.noChatSign) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.mics.noChatSign) {
|
||||
+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && callbacks != null) {
|
||||
+ callbacks = null;
|
||||
+ }
|
||||
@@ -149,15 +149,15 @@ index 7adef76ecc246b131cee35cf00c3c05bd75d5504..7bc847d7475de6cca22e587fdb999956
|
||||
if (packet == null || this.processedDisconnect) { // Spigot
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 31a55145bf2ed0e5a23fd07d1c14e93572d5ef5a..5221ab490fcbc11434c1209f654e5731fa15487e 100644
|
||||
index 9b3fbc13779ded07c696e151772d834ff8d61a7d..b83b903381ca6c426d2f26f9459e769083eb5876 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1456,7 +1456,7 @@ public abstract class PlayerList {
|
||||
@@ -1423,7 +1423,7 @@ public abstract class PlayerList {
|
||||
}
|
||||
|
||||
public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public
|
||||
- return message.hasSignature() && !message.hasExpiredServer(Instant.now());
|
||||
+ return org.leavesmc.leaves.LeavesConfig.noChatSign || (message.hasSignature() && !message.hasExpiredServer(Instant.now())); // Leaves - No Not Secure
|
||||
+ return org.leavesmc.leaves.LeavesConfig.mics.noChatSign || (message.hasSignature() && !message.hasExpiredServer(Instant.now())); // Leaves - No Not Secure
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
|
||||
@@ -6,22 +6,22 @@ Subject: [PATCH] Dont send useless entity packets
|
||||
This patch is Powered by Purpur(https://github.com/PurpurMC/Purpur)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index 8ea2f24695f5dad55e21f238b69442513e7a90c6..0846e11c82295ccf93683f877962ec7804dad677 100644
|
||||
index 90eb4927fa51ce3df86aa7b6c71f49150a03e337..1e1e5ade09d368f0fdc6533f26281bd7d6d31751 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -212,6 +212,11 @@ public class ServerEntity {
|
||||
packet1 = new ClientboundTeleportEntityPacket(this.entity);
|
||||
@@ -226,6 +226,11 @@ public class ServerEntity {
|
||||
packet1 = ClientboundEntityPositionSyncPacket.of(this.entity);
|
||||
flag3 = true;
|
||||
flag4 = true;
|
||||
flag5 = true;
|
||||
+ // Leaves start - dont send useless entity packets
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.dontSendUselessEntityPackets && isUselessPacket(packet1)) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.dontSendUselessEntityPackets && isUselessPacket(packet1)) {
|
||||
+ packet1 = null;
|
||||
+ }
|
||||
+ // Leaves end - dont send useless entity packets
|
||||
}
|
||||
|
||||
if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) {
|
||||
@@ -294,6 +299,21 @@ public class ServerEntity {
|
||||
@@ -332,6 +337,21 @@ public class ServerEntity {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,19 +6,19 @@ Subject: [PATCH] Optimize suffocation
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 15386ed5c4304f85ff3edd9bbf95db9144c28523..0556500fde799583a65a82d00a6b2c65a1757d5e 100644
|
||||
index 7610b2961d59af006440476f7c91038b9b1c5432..8c34c7f74779774e8627c2eb9d5230ed1980df36 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -448,7 +448,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
|
||||
@@ -467,7 +467,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
if (world1 instanceof ServerLevel) {
|
||||
worldserver1 = (ServerLevel) world1;
|
||||
- if (this.isInWall()) {
|
||||
+ if ((!org.leavesmc.leaves.LeavesConfig.enableSuffocationOptimization || this instanceof WitherBoss || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { // Leaves - optimize suffocation
|
||||
this.hurt(this.damageSources().inWall(), 1.0F);
|
||||
+ if ((!org.leavesmc.leaves.LeavesConfig.performance.enableSuffocationOptimization || this instanceof WitherBoss || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { // Leaves - optimize suffocation
|
||||
this.hurtServer(worldserver1, this.damageSources().inWall(), 1.0F);
|
||||
} else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) {
|
||||
double d0 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1408,6 +1408,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
double d1 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
|
||||
@@ -1437,6 +1437,15 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.getHealth() <= 0.0F;
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ index 15386ed5c4304f85ff3edd9bbf95db9144c28523..0556500fde799583a65a82d00a6b2c65
|
||||
+ // Leaves end - optimize suffocation
|
||||
+
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(source)) {
|
||||
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(world, source)) {
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Only check for spooky season once an hour
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ambient/Bat.java b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..601072324b54d062bd4cceb821ae187d904ad49b 100644
|
||||
index 60c2868f255d372226e0c1389caaa5477bbef41e..d432e00ec084d1c7a23f10be6c457681ae66db37 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ambient/Bat.java
|
||||
@@ -239,13 +239,30 @@ public class Bat extends AmbientCreature {
|
||||
@@ -242,13 +242,30 @@ public class Bat extends AmbientCreature {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ index dc27ddf5131e7398a5390a5187261d4c7fb6ccaa..601072324b54d062bd4cceb821ae187d
|
||||
- LocalDate localdate = LocalDate.now();
|
||||
- int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
- int j = localdate.get(ChronoField.MONTH_OF_YEAR);
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.checkSpookySeasonOnceAnHour) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.checkSpookySeasonOnceAnHour) {
|
||||
+ if (net.minecraft.server.MinecraftServer.currentTick - lastSpookyCheck > ONE_HOUR) {
|
||||
+ LocalDate localdate = LocalDate.now();
|
||||
+ int i = localdate.get(ChronoField.DAY_OF_MONTH);
|
||||
|
||||
32
patches/server/0022-Config-to-disable-method-profiler.patch
Normal file
32
patches/server/0022-Config-to-disable-method-profiler.patch
Normal file
@@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Mon, 15 Aug 2022 10:18:36 +0800
|
||||
Subject: [PATCH] Config to disable method profiler
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index f0d2c8bc40b36e6d638ad418963289ac2737f5a0..feaf9b26c12f4da94aedfdab7362c8d94c7a72eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1321,7 +1321,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.nextTickTimeNanos += i;
|
||||
|
||||
try {
|
||||
- Profiler.Scope profiler_a = Profiler.use(this.createProfiler());
|
||||
+ Profiler.Scope profiler_a = org.leavesmc.leaves.LeavesConfig.mics.disableMethodProfiler ? null : Profiler.use(this.createProfiler()); // Leaves - disable profiler
|
||||
|
||||
try {
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
diff --git a/src/main/java/net/minecraft/util/profiling/Profiler.java b/src/main/java/net/minecraft/util/profiling/Profiler.java
|
||||
index fe8a8ee1f88c58a9fe730c4c0cc5fc4e3651e9f8..cf57aea63c8aeec8aeffe320f6ffef9f24025653 100644
|
||||
--- a/src/main/java/net/minecraft/util/profiling/Profiler.java
|
||||
+++ b/src/main/java/net/minecraft/util/profiling/Profiler.java
|
||||
@@ -44,6 +44,7 @@ public final class Profiler {
|
||||
}
|
||||
|
||||
public static ProfilerFiller get() {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.mics.disableMethodProfiler) return InactiveProfiler.INSTANCE; // Leaves - disable profiler
|
||||
return ACTIVE_COUNT.get() == 0 ? getDefaultFiller() : Objects.requireNonNullElseGet(ACTIVE.get(), Profiler::getDefaultFiller);
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Mon, 15 Aug 2022 10:18:36 +0800
|
||||
Subject: [PATCH] Config to disable method profiler
|
||||
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index cb863f07d00e96b92e73dc312606110c259b4d5c..4c8cf72e44e991920ed6a6110d811530c77adbbe 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -2557,6 +2557,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
|
||||
public ProfilerFiller getProfiler() {
|
||||
+ // Leaves start - disable method profiler
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.disableMethodProfiler) {
|
||||
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
|
||||
+ }
|
||||
+ // Leaves end - disable method profiler
|
||||
return this.profiler;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 73b1b5b8b3723f068e45874eb251f08ef0a93017..7a15e89bd5bf19cbd5dd115b83a0d3fc63faaa2d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1954,6 +1954,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
}
|
||||
|
||||
public ProfilerFiller getProfiler() {
|
||||
+ // Leaves start - disable method profiler
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.disableMethodProfiler) {
|
||||
+ return net.minecraft.util.profiling.InactiveProfiler.INSTANCE;
|
||||
+ }
|
||||
+ // Leaves end - disable method profiler
|
||||
return (ProfilerFiller) this.profiler.get();
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Throttle goal selector during inactive ticking
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index bd7c6ce15698aed70376c109ba36f52d6794a2f8..9f2ef5ea9f380e78d4a150df9f16ff6bfc398b75 100644
|
||||
index dbd321f3dc3cc80737830db63aed47a6935e8e89..c80976958ad8f51aadf0dab5d49a3e11c77010d4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -232,11 +232,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
@@ -235,11 +235,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
return this.lookControl;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ index bd7c6ce15698aed70376c109ba36f52d6794a2f8..9f2ef5ea9f380e78d4a150df9f16ff6b
|
||||
public void inactiveTick() {
|
||||
super.inactiveTick();
|
||||
- if (this.goalSelector.inactiveTick()) {
|
||||
+ boolean isThrottled = org.leavesmc.leaves.LeavesConfig.throttleInactiveGoalSelectorTick && (inactiveTickDisableCounter++ % 20 != 0); // Leaves - throttle inactive goal selector ticking
|
||||
+ boolean isThrottled = org.leavesmc.leaves.LeavesConfig.performance.throttleInactiveGoalSelectorTick && (inactiveTickDisableCounter++ % 20 != 0); // Leaves - throttle inactive goal selector ticking
|
||||
+ if (this.goalSelector.inactiveTick() && !isThrottled) { // Leaves - throttle inactive goal selector ticking
|
||||
this.goalSelector.tick();
|
||||
}
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Reduce entity allocations
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
index 69992ebc999ea3ff9e47e4e049bcc514c01150ca..2118ad41e94e8f5e5fac50286ceb24ab70db88f2 100644
|
||||
index 94d04a20f97405e02d7cccaabadc7a7e86e336f7..6b5fd2f97b0d4bdf14a9e9059153b1ccc92ffd58 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
|
||||
@@ -23,9 +23,11 @@ public class AttributeMap {
|
||||
@@ -27,7 +27,7 @@ index 69992ebc999ea3ff9e47e4e049bcc514c01150ca..2118ad41e94e8f5e5fac50286ceb24ab
|
||||
public AttributeInstance getInstance(Holder<Attribute> attribute) {
|
||||
- return this.attributes.computeIfAbsent(attribute, attributex -> this.supplier.createInstance(this::onAttributeModified, attributex));
|
||||
+ // Leaves start - cache lambda, as for some reason java allocates it anyways
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.reduceEntityAllocations) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.reduceEntityAllocations) {
|
||||
+ return this.attributes.computeIfAbsent(attribute, this.createInstance);
|
||||
+ } else {
|
||||
+ return this.attributes.computeIfAbsent(attribute, attributex -> this.supplier.createInstance(this::onAttributeModified, attributex));
|
||||
@@ -6,16 +6,16 @@ Subject: [PATCH] Remove lambda from ticking guard
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 49e7d9bc75e029a8800f7369681e43efd14cd322..5a97f8a853664a3ced63215a386286873a6c7a95 100644
|
||||
index 1b1350485ba333e9bda048b01273de9744ce16a9..1b2ba3ff09b27ea74afc96735e48a474cf6ebddd 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -725,7 +725,23 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -811,7 +811,23 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
}
|
||||
|
||||
gameprofilerfiller.push("tick");
|
||||
- this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
+ // Leaves start - copied from this.guardEntityTick
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.removeTickGuardLambda) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.remove.tickGuardLambda) {
|
||||
+ try {
|
||||
+ this.tickNonPassenger(entity); // Leaves - changed
|
||||
+ } catch (Throwable throwable) {
|
||||
@@ -6,16 +6,16 @@ Subject: [PATCH] Remove iterators from inventory contains
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index 6e66141dca61f777b354854b5d0bac2570b8bf3b..eb11482f48c9f330b7fa62a278fd6f07d3a642e1 100644
|
||||
index 0e214d502998e9eb959952b257844529992df0df..9506c4cf1c757219f9f01c06cf61ad3e40ee0979 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -643,17 +643,31 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -649,17 +649,31 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
- Iterator iterator = this.compartments.iterator();
|
||||
+ // Leaves start - don't allocate iterators
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.remove.inventoryContainsIterators) {
|
||||
+ for (int i = 0; i < this.compartments.size(); i++) {
|
||||
+ List<ItemStack> list = this.compartments.get(i);
|
||||
+ for (int j = 0; j < list.size(); j++) {
|
||||
@@ -49,12 +49,12 @@ index 6e66141dca61f777b354854b5d0bac2570b8bf3b..eb11482f48c9f330b7fa62a278fd6f07
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -662,17 +676,30 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -668,17 +682,30 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(TagKey<Item> tag) {
|
||||
- Iterator iterator = this.compartments.iterator();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.remove.inventoryContainsIterators) {
|
||||
+ for (int i = 0; i < this.compartments.size(); i++) {
|
||||
+ List<ItemStack> list = this.compartments.get(i);
|
||||
+ for (int j = 0; j < list.size(); j++) {
|
||||
@@ -88,12 +88,12 @@ index 6e66141dca61f777b354854b5d0bac2570b8bf3b..eb11482f48c9f330b7fa62a278fd6f07
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -681,21 +708,34 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -687,21 +714,34 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
public boolean contains(Predicate<ItemStack> predicate) {
|
||||
- Iterator iterator = this.compartments.iterator();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.removeInventoryContainsIterators) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.remove.inventoryContainsIterators) {
|
||||
+ for (int i = 0; i < this.compartments.size(); i++) {
|
||||
+ List<ItemStack> list = this.compartments.get(i);
|
||||
+ for (int j = 0; j < list.size(); j++) {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Cache climbing check for activation
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0556500fde799583a65a82d00a6b2c65a1757d5e..408700b2236b4e04baebe23b47e72722006e3e23 100644
|
||||
index d5614e702137b52700873a8301d9ec3c87f47040..44180a5fddaafec623875676ab54cbd62b1268a8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2073,6 +2073,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2129,6 +2129,22 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ index 0556500fde799583a65a82d00a6b2c65a1757d5e..408700b2236b4e04baebe23b47e72722
|
||||
+ private BlockPos lastClimbingPosition = null;
|
||||
+
|
||||
+ public boolean onClimableCached() {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.cacheClimbCheck) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.performance.cacheClimbCheck) {
|
||||
+ return this.onClimbable();
|
||||
+ }
|
||||
+ if (!this.blockPosition().equals(this.lastClimbingPosition)) {
|
||||
@@ -33,7 +33,7 @@ index 0556500fde799583a65a82d00a6b2c65a1757d5e..408700b2236b4e04baebe23b47e72722
|
||||
if (this.isSpectator()) {
|
||||
return false;
|
||||
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
index 621bda8248e35f5a5730f89a4bcfbe6615ed969c..47c30ebb3ea6fab0a0d51211905217a1d2a0c770 100644
|
||||
index 1d438ef44cbe4d1eedfba36d8fe5d2ad53464921..4f6f42fb965d76c8360eb7c67936d2c3d104a700 100644
|
||||
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
||||
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
||||
@@ -295,7 +295,7 @@ public class ActivationRange
|
||||
@@ -6,30 +6,30 @@ Subject: [PATCH] Reduce chunk loading & lookups
|
||||
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 828c51477cd8f35d591367b30bf4feef6a250292..17a71bb3b65cc1030b70c931b1dc998d06713231 100644
|
||||
index 48dcd2bc12ce1d08cc5195bff5460dc0dd9902d3..2b8e1a8e233071821411eb1f95c705efb4a6e816 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -320,11 +320,28 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@@ -307,11 +307,28 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
private boolean teleport(double x, double y, double z) {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(x, y, z);
|
||||
|
||||
- while (blockposition_mutableblockposition.getY() > this.level().getMinBuildHeight() && !this.level().getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
- while (blockposition_mutableblockposition.getY() > this.level().getMinY() && !this.level().getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
- blockposition_mutableblockposition.move(Direction.DOWN);
|
||||
+ // Leaves start - single chunk lookup
|
||||
+ BlockState iblockdata;
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.reduceChuckLoadAndLookup) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.reduceChuckLoadAndLookup) {
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk = this.level().getChunkIfLoaded(blockposition_mutableblockposition);
|
||||
+ if (chunk == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ while (blockposition_mutableblockposition.getY() > this.level().getMinBuildHeight() && !chunk.getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
+ while (blockposition_mutableblockposition.getY() > this.level().getMinY() && !chunk.getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
+ blockposition_mutableblockposition.move(Direction.DOWN);
|
||||
+ }
|
||||
+
|
||||
+ iblockdata = chunk.getBlockState(blockposition_mutableblockposition);
|
||||
+ } else {
|
||||
+ while (blockposition_mutableblockposition.getY() > this.level().getMinBuildHeight() && !this.level().getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
+ while (blockposition_mutableblockposition.getY() > this.level().getMinY() && !this.level().getBlockState(blockposition_mutableblockposition).blocksMotion()) {
|
||||
+ blockposition_mutableblockposition.move(Direction.DOWN);
|
||||
+ }
|
||||
+
|
||||
@@ -6,16 +6,16 @@ Subject: [PATCH] InstantBlockUpdater Reintroduced
|
||||
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index e935903d918f12e5e1617ebf2d74399b9cd4f79c..1f6e6bba0f6d16091f4c6a5fdb4bac4579ba525f 100644
|
||||
index 022de445bbbb869c38be4972c98dcf1c665539ec..1187453b7d961a0605af636cb6b5ed0c1f6b4be3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -723,7 +723,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
@@ -878,7 +878,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
this.thread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, i);
|
||||
this.isDebug = flag1;
|
||||
- this.neighborUpdater = new CollectingNeighborUpdater(this, j);
|
||||
+ // Leaves start - instantBlockUpdaterReintroduced
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.instantBlockUpdaterReintroduced) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.updater.instantBlockUpdaterReintroduced) {
|
||||
+ this.neighborUpdater = new net.minecraft.world.level.redstone.InstantNeighborUpdater(this);
|
||||
+ } else {
|
||||
+ this.neighborUpdater = new CollectingNeighborUpdater(this, j);
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Random flatten triangular distribution
|
||||
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java
|
||||
index 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..50dc6530e6191f2a00025d4610e335041bc858a4 100644
|
||||
index 252aef3ffe0fecd47ebea1ed7df48e14fa873eb9..bbfe68a7e860fff5c43feb2dc02c3c664a29bd09 100644
|
||||
--- a/src/main/java/net/minecraft/util/RandomSource.java
|
||||
+++ b/src/main/java/net/minecraft/util/RandomSource.java
|
||||
@@ -53,7 +53,14 @@ public interface RandomSource {
|
||||
@@ -15,7 +15,7 @@ index 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..50dc6530e6191f2a00025d4610e33504
|
||||
default double triangle(double mode, double deviation) {
|
||||
- return mode + deviation * (this.nextDouble() - this.nextDouble());
|
||||
+ // Leaves start - flattenTriangularDistribution
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.flattenTriangularDistribution) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.flattenTriangularDistribution) {
|
||||
+ this.nextDouble();
|
||||
+ return mode + deviation * (-1 + this.nextDouble() * 2);
|
||||
+ } else {
|
||||
@@ -24,4 +24,4 @@ index 9c6f5b55b1f1376fa75e216cd366ee47c79fafc4..50dc6530e6191f2a00025d4610e33504
|
||||
+ // Leaves end - flattenTriangularDistribution
|
||||
}
|
||||
|
||||
default void consumeCount(int count) {
|
||||
default float triangle(float mode, float deviation) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] BBOR Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 5221ab490fcbc11434c1209f654e5731fa15487e..7ba6579cfe925ef40940cce29ebc0abb6458f13d 100644
|
||||
index b83b903381ca6c426d2f26f9459e769083eb5876..7a741442ee2373f1a400214047bbf5844efecce6 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1596,6 +1596,7 @@ public abstract class PlayerList {
|
||||
@@ -1566,6 +1566,7 @@ public abstract class PlayerList {
|
||||
entityplayer.getRecipeBook().sendInitialRecipeBook(entityplayer);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ index 5221ab490fcbc11434c1209f654e5731fa15487e..7ba6579cfe925ef40940cce29ebc0abb
|
||||
|
||||
public boolean isAllowCommandsForAllPlayers() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index c0ce5d4c3189337b06476c16558e12d3f8127797..382ca565fe1a680ab49b14ac90e4ec3bd903450d 100644
|
||||
index 4640baec5bed6c2d53cc0f8ca1d273cc115abe9b..2fea5a46bba27578366c36f594472c3e38395bee 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -784,6 +784,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -813,6 +813,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
|
||||
public void setLoaded(boolean loadedToWorld) {
|
||||
this.loaded = loadedToWorld;
|
||||
@@ -34,7 +34,7 @@ index c0ce5d4c3189337b06476c16558e12d3f8127797..382ca565fe1a680ab49b14ac90e4ec3b
|
||||
public Level getLevel() {
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/BBORProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/BBORProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85d6d145fd
|
||||
index 0000000000000000000000000000000000000000..c4ba09a998966fd8563f592920774cba2ea61c31
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/BBORProtocol.java
|
||||
@@ -0,0 +1,227 @@
|
||||
@@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85
|
||||
+
|
||||
+ @ProtocolHandler.Ticker
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ for (var playerEntry : players.entrySet()) {
|
||||
+ sendBoundingToPlayer(playerEntry.getKey(), playerEntry.getValue());
|
||||
+ }
|
||||
@@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85
|
||||
+
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ public static void onServerReload() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ initAllPlayer();
|
||||
+ } else {
|
||||
+ loggedOutAllPlayer();
|
||||
@@ -108,7 +108,7 @@ index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ ServerLevel overworld = MinecraftServer.getServer().overworld();
|
||||
+ ProtocolUtils.sendPayloadPacket(player, INITIALIZE_CLIENT, buf -> {
|
||||
+ buf.writeLong(overworld.getSeed());
|
||||
@@ -121,7 +121,7 @@ index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ players.remove(player.getId());
|
||||
+ playerBoundingBoxesCache.remove(player.getId());
|
||||
+ }
|
||||
@@ -129,22 +129,22 @@ index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = EmptyPayload.class, payloadId = "subscribe")
|
||||
+ public static void onPlayerSubscribed(@NotNull ServerPlayer player, EmptyPayload payload) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ players.put(player.getId(), player);
|
||||
+ sendBoundingToPlayer(player.getId(), player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onDataPackReload() {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ players.values().forEach(BBORProtocol::sendStructureList);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void onChunkLoaded(@NotNull LevelChunk chunk) {
|
||||
+ if (LeavesConfig.bborProtocol) {
|
||||
+ if (LeavesConfig.protocol.bborProtocol) {
|
||||
+ Map<String, StructureStart> structures = new HashMap<>();
|
||||
+ final Registry<Structure> structureFeatureRegistry = chunk.getLevel().registryAccess().registryOrThrow(Registries.STRUCTURE);
|
||||
+ final Registry<Structure> structureFeatureRegistry = chunk.getLevel().registryAccess().lookupOrThrow(Registries.STRUCTURE);
|
||||
+ for (var es : chunk.getAllStarts().entrySet()) {
|
||||
+ final var optional = structureFeatureRegistry.getResourceKey(es.getKey());
|
||||
+ optional.ifPresent(key -> structures.put(key.location().toString(), es.getValue()));
|
||||
@@ -184,8 +184,8 @@ index 0000000000000000000000000000000000000000..16ef00dde5a1c502449378829b1b6b85
|
||||
+ return new BBoundingBox(type, min, max);
|
||||
+ }
|
||||
+
|
||||
+ private static void sendStructureList(ServerPlayer player) {
|
||||
+ final Registry<Structure> structureRegistry = player.server.registryAccess().registryOrThrow(Registries.STRUCTURE);
|
||||
+ private static void sendStructureList(@NotNull ServerPlayer player) {
|
||||
+ final Registry<Structure> structureRegistry = player.server.registryAccess().lookupOrThrow(Registries.STRUCTURE);
|
||||
+ final Set<String> structureIds = structureRegistry.entrySet().stream()
|
||||
+ .map(e -> e.getKey().location().toString()).collect(Collectors.toSet());
|
||||
+ ProtocolUtils.sendPayloadPacket(player, STRUCTURE_LIST_SYNC, buf -> {
|
||||
@@ -6,15 +6,15 @@ Subject: [PATCH] PCA sync protocol
|
||||
This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
index 1f5ed236fb7c0c1b0181675747d25d233f534284..08559ff5409d362bc674f63d6e46ced6c0474601 100644
|
||||
index 8aed30cdbbfdd42c20dcd4c8773c8a0ee21a980d..b2c83534446f95503b9fd8bd09be90575622c395 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
|
||||
@@ -436,6 +436,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
@@ -449,6 +449,11 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
|
||||
|
||||
@Override
|
||||
public void containerChanged(Container sender) {
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncEntityToClient(this);
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
@@ -22,7 +22,7 @@ index 1f5ed236fb7c0c1b0181675747d25d233f534284..08559ff5409d362bc674f63d6e46ced6
|
||||
|
||||
this.syncSaddleToClients();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
index d28ebcae036168dd65a5f3236d12ee416308c23f..ebdb1546fb057bf4881d53538f8e44c14fe88b74 100644
|
||||
index 5f656fc726a1dc5f42657095a2f2b7cf85b92d7c..6c0cece094d36ddb2ae8d67d3c847a2c8faa3da8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
|
||||
@@ -69,6 +69,15 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
|
||||
@@ -32,7 +32,7 @@ index d28ebcae036168dd65a5f3236d12ee416308c23f..ebdb1546fb057bf4881d53538f8e44c1
|
||||
+ // Leaves start - pca
|
||||
+ if (!this.level().isClientSide()) {
|
||||
+ this.inventory.addListener(inventory -> {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncEntityToClient(this);
|
||||
+ }
|
||||
+ });
|
||||
@@ -42,17 +42,17 @@ index d28ebcae036168dd65a5f3236d12ee416308c23f..ebdb1546fb057bf4881d53538f8e44c1
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
index 9549eee0d92f322bd5232abd7e695213660c2e22..6044de3b76e236e22d4d00f80dae0380ba82d354 100644
|
||||
index d528e8e4aea266c495377365f01e314001eb1970..2472eb9f8f0b6872f7b98cb2da511c6a2527b8fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
||||
@@ -126,7 +126,13 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
@@ -122,7 +122,13 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void setChanged() {}
|
||||
+ public void setChanged() {
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncEntityToClient(this);
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
@@ -61,18 +61,18 @@ index 9549eee0d92f322bd5232abd7e695213660c2e22..6044de3b76e236e22d4d00f80dae0380
|
||||
@Override
|
||||
public boolean stillValid(Player player) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 730aca233f6e7564d4cb85b5b628d23c4f01d2f4..9ad4600ebee09d81b1785103ad17de47cf1f2ede 100644
|
||||
index 15e0861486a2bda3e2f4049b1b5a299c870acd31..82e93a63ea64adbf648ea7b8a844a376bbe63597 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -558,6 +558,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
|
||||
@@ -440,6 +440,16 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
}
|
||||
}
|
||||
|
||||
+ // Leaves start - pca
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -82,7 +82,7 @@ index 730aca233f6e7564d4cb85b5b628d23c4f01d2f4..9ad4600ebee09d81b1785103ad17de47
|
||||
public boolean canPlaceItem(int slot, ItemStack stack) {
|
||||
if (slot == 2) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
index 6186e55014bbb9d5bedaa0e9d196879c55339d42..956c39ab508c2d8a7b9156aa53d655624db91f3d 100644
|
||||
index 618552afbdacc919c33b30a6bf4834fb71ab3d5b..c14e7805e849e56912d50b61d5f2f3d802ac9bde 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
|
||||
@@ -132,6 +132,16 @@ public class BarrelBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -93,7 +93,7 @@ index 6186e55014bbb9d5bedaa0e9d196879c55339d42..956c39ab508c2d8a7b9156aa53d65562
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -103,27 +103,27 @@ index 6186e55014bbb9d5bedaa0e9d196879c55339d42..956c39ab508c2d8a7b9156aa53d65562
|
||||
protected Component getDefaultName() {
|
||||
return Component.translatable("container.barrel");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
index f933fa419a4b55b0096ff42caf1b071d027b8e7e..c8891f72d3353faf4afe5b49e1759ee0fe475cc3 100644
|
||||
index 83ad45aed0894e90825d22e078632352c3a06816..58319df10af098db7cb74f08651880dab64ae4e1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
|
||||
@@ -143,6 +143,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -144,6 +144,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
super.setChanged();
|
||||
}
|
||||
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -197,6 +202,12 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -198,6 +203,12 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
this.level.gameEvent((Holder) GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(entity, this.getBlockState()));
|
||||
}
|
||||
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
@@ -131,24 +131,24 @@ index f933fa419a4b55b0096ff42caf1b071d027b8e7e..c8891f72d3353faf4afe5b49e1759ee0
|
||||
entity.discard(EntityRemoveEvent.Cause.ENTER_BLOCK); // CraftBukkit - add Bukkit remove cause
|
||||
super.setChanged();
|
||||
}
|
||||
@@ -312,6 +323,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -313,6 +324,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
if (BeehiveBlockEntity.releaseOccupant(world, pos, state, tileentitybeehive_hivebee.toOccupant(), (List) null, tileentitybeehive_releasestatus, flowerPos)) {
|
||||
flag = true;
|
||||
iterator.remove();
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(Objects.requireNonNull(world.getBlockEntity(pos)));
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
// CraftBukkit start
|
||||
} else {
|
||||
tileentitybeehive_hivebee.exitTickCounter = tileentitybeehive_hivebee.occupant.minTicksInHive / 2; // Not strictly Vanilla behaviour in cases where bees cannot spawn but still reasonable // Paper - Fix bees aging inside hives; use exitTickCounter to keep actual bee life
|
||||
@@ -357,6 +373,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
@@ -358,6 +374,11 @@ public class BeehiveBlockEntity extends BlockEntity {
|
||||
this.maxBees = nbt.getInt("Bukkit.MaxEntities");
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
@@ -156,10 +156,10 @@ index f933fa419a4b55b0096ff42caf1b071d027b8e7e..c8891f72d3353faf4afe5b49e1759ee0
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||
index 0a93bacd62249bae1800ff306b8a7c765b0e5a8b..9561d804ef47d11a492531f8e8a419f905b48c17 100644
|
||||
index 02fc9ce21c7d367055da350d21be4870d4242f3a..974a7fbec9ec347ea16a07d7c857a27e3b25f76d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
||||
@@ -344,6 +344,16 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||
@@ -345,6 +345,16 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
||||
return this.canPlaceItem(slot, stack);
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ index 0a93bacd62249bae1800ff306b8a7c765b0e5a8b..9561d804ef47d11a492531f8e8a419f9
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -177,7 +177,7 @@ index 0a93bacd62249bae1800ff306b8a7c765b0e5a8b..9561d804ef47d11a492531f8e8a419f9
|
||||
public boolean canTakeItemThroughFace(int slot, ItemStack stack, Direction dir) {
|
||||
return slot == 3 ? stack.is(Items.GLASS_BOTTLE) : true;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
index b88aa184cd06a0485146f58a5b61a56a50911209..4d4485f1007341a5303374b3facd033c87b887b3 100644
|
||||
index 8847617f6a23e6d2fe9bf7444a2072dc53f741b8..ef91101fb9e44b5db58272e4c2fdada1fa9e1686 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
||||
@@ -191,6 +191,16 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
||||
@@ -188,7 +188,7 @@ index b88aa184cd06a0485146f58a5b61a56a50911209..4d4485f1007341a5303374b3facd033c
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -198,7 +198,7 @@ index b88aa184cd06a0485146f58a5b61a56a50911209..4d4485f1007341a5303374b3facd033c
|
||||
public float getOpenNess(float tickDelta) {
|
||||
return this.chestLidController.getOpenness(tickDelta);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java
|
||||
index 7ea490a61321830c41dfa1bbd5480217dc62f478..d037adbe784d1b9e620d3c0798bc8b86061c5701 100644
|
||||
index 9db5826420d693628ad74614f4cee79e1ebd88d9..0e14b15b262f1ca5e12e31d2f18bc90bb94baf79 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ComparatorBlockEntity.java
|
||||
@@ -24,6 +24,16 @@ public class ComparatorBlockEntity extends BlockEntity {
|
||||
@@ -209,7 +209,7 @@ index 7ea490a61321830c41dfa1bbd5480217dc62f478..d037adbe784d1b9e620d3c0798bc8b86
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -219,7 +219,7 @@ index 7ea490a61321830c41dfa1bbd5480217dc62f478..d037adbe784d1b9e620d3c0798bc8b86
|
||||
return this.output;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
index 431fb6a658c6aac43b6f9dbd1f578b83f261a4e3..138c045dc694c596083bc2f23831ca22e9484297 100644
|
||||
index c7f1937b0f171eee967388ab4699703dcdcfbd2b..c3d41360b2c5dab04f519459bd855045e8bec7c1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
@@ -109,6 +109,16 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -230,7 +230,7 @@ index 431fb6a658c6aac43b6f9dbd1f578b83f261a4e3..138c045dc694c596083bc2f23831ca22
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -240,7 +240,7 @@ index 431fb6a658c6aac43b6f9dbd1f578b83f261a4e3..138c045dc694c596083bc2f23831ca22
|
||||
protected Component getDefaultName() {
|
||||
return Component.translatable("container.dispenser");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index cab403efd471bb61835224eea4e99570d34dcaaa..f7a6296773defc95215bdf36d8ea105cf9590a9e 100644
|
||||
index 5ebbdb94d9b91c442ff60eb6872f740ebd790fa0..02bda85189fd57bd3f6d18cfd573553b2e607300 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -134,6 +134,16 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -251,7 +251,7 @@ index cab403efd471bb61835224eea4e99570d34dcaaa..f7a6296773defc95215bdf36d8ea105c
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -265,7 +265,7 @@ index cab403efd471bb61835224eea4e99570d34dcaaa..f7a6296773defc95215bdf36d8ea105c
|
||||
blockEntity.setCooldown(world.spigotConfig.hopperTransfer); // Spigot
|
||||
setChanged(world, pos, state);
|
||||
+ // Leaves start - pca
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(blockEntity);
|
||||
+ }
|
||||
+ // Leaves end - pca
|
||||
@@ -273,7 +273,7 @@ index cab403efd471bb61835224eea4e99570d34dcaaa..f7a6296773defc95215bdf36d8ea105c
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
index 0d68db20f5fbe5e834f12c1e8fd429099a44e4b6..5b62860cd64b5e6dc02dadb4651824ac04b00024 100644
|
||||
index 6291ebf3426bddb0e6d13159ce20936b6e9ba6bd..3784e4c14bb59073f941b966f616ddac3f80a497 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
@@ -270,6 +270,16 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
@@ -284,7 +284,7 @@ index 0d68db20f5fbe5e834f12c1e8fd429099a44e4b6..5b62860cd64b5e6dc02dadb4651824ac
|
||||
+ @Override
|
||||
+ public void setChanged() {
|
||||
+ super.setChanged();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.protocol.pca.enable) {
|
||||
+ org.leavesmc.leaves.protocol.PcaSyncProtocol.syncBlockEntityToClient(this);
|
||||
+ }
|
||||
+ }
|
||||
@@ -295,7 +295,7 @@ index 0d68db20f5fbe5e834f12c1e8fd429099a44e4b6..5b62860cd64b5e6dc02dadb4651824ac
|
||||
return ShulkerBoxBlockEntity.SLOTS;
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/PcaSyncProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7126ec4b6e0a1bfa16d97fd21d7ae8955a66565c
|
||||
index 0000000000000000000000000000000000000000..a38318506aeb1632ba7903671bcfad1e871c8fc7
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/PcaSyncProtocol.java
|
||||
@@ -0,0 +1,432 @@
|
||||
@@ -363,14 +363,14 @@ index 0000000000000000000000000000000000000000..7126ec4b6e0a1bfa16d97fd21d7ae895
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ private static void onJoin(ServerPlayer player) {
|
||||
+ if (LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (LeavesConfig.protocol.pca.enable) {
|
||||
+ enablePcaSyncProtocol(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = EmptyPayload.class, payloadId = "cancel_sync_block_entity")
|
||||
+ private static void cancelSyncBlockEntityHandler(ServerPlayer player, EmptyPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (!LeavesConfig.protocol.pca.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+ PcaSyncProtocol.clearPlayerWatchBlock(player);
|
||||
@@ -378,7 +378,7 @@ index 0000000000000000000000000000000000000000..7126ec4b6e0a1bfa16d97fd21d7ae895
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = EmptyPayload.class, payloadId = "cancel_sync_entity")
|
||||
+ private static void cancelSyncEntityHandler(ServerPlayer player, EmptyPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (!LeavesConfig.protocol.pca.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+ PcaSyncProtocol.clearPlayerWatchEntity(player);
|
||||
@@ -386,7 +386,7 @@ index 0000000000000000000000000000000000000000..7126ec4b6e0a1bfa16d97fd21d7ae895
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = SyncBlockEntityPayload.class, payloadId = "sync_block_entity")
|
||||
+ private static void syncBlockEntityHandler(ServerPlayer player, SyncBlockEntityPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (!LeavesConfig.protocol.pca.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -430,7 +430,7 @@ index 0000000000000000000000000000000000000000..7126ec4b6e0a1bfa16d97fd21d7ae895
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = SyncEntityPayload.class, payloadId = "sync_entity")
|
||||
+ private static void syncEntityHandler(ServerPlayer player, SyncEntityPayload payload) {
|
||||
+ if (!LeavesConfig.pcaSyncProtocol) {
|
||||
+ if (!LeavesConfig.protocol.pca.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -445,7 +445,7 @@ index 0000000000000000000000000000000000000000..7126ec4b6e0a1bfa16d97fd21d7ae895
|
||||
+ clearPlayerWatchData(player);
|
||||
+
|
||||
+ if (entity instanceof Player) {
|
||||
+ switch (LeavesConfig.pcaSyncPlayerEntity) {
|
||||
+ switch (LeavesConfig.protocol.pca.syncPlayerEntity) {
|
||||
+ case NOBODY -> {
|
||||
+ return;
|
||||
+ }
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Jade Protocol
|
||||
This patch is Powered by Jade(https://github.com/Snownee/Jade)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
index 729fd2d52dd48e25ee7a077a3ffafc80ecef7c9f..28d6b1d49045c125214c40895efd484e4ae20c2b 100644
|
||||
index c1ef714096159608752d744b98f615cd45fe459a..142bc508f5b816407d219944b9354db649a10ce0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -63,7 +63,7 @@ public class Armadillo extends Animal {
|
||||
@@ -19,10 +19,10 @@ index 729fd2d52dd48e25ee7a077a3ffafc80ecef7c9f..28d6b1d49045c125214c40895efd484e
|
||||
|
||||
public Armadillo(EntityType<? extends Animal> type, Level world) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
index 43046f4a0cff620834ac4647efdcde227185b2ff..a08cd692e332a6caed33cd3db2373e847621ad6a 100644
|
||||
index 48ac8c3f6e00c3c2dc67b6c994be7c0ac6dfcf81..ac306874dc94ec59427b353beec273f9f7d54432 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java
|
||||
@@ -256,7 +256,7 @@ public class Tadpole extends AbstractFish {
|
||||
@@ -246,7 +246,7 @@ public class Tadpole extends AbstractFish {
|
||||
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@ index 43046f4a0cff620834ac4647efdcde227185b2ff..a08cd692e332a6caed33cd3db2373e84
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
index 6684ded7135f943f8cea954b417f596369215357..0621c6c026678cb4ac3626342d73290c0f2803d9 100644
|
||||
index a49f83784f85f5420091692aae588ef067aa5fcd..137f777d324d0a0addc2e43913e196bc9f09e004 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerData.java
|
||||
@@ -72,7 +72,7 @@ public class TrialSpawnerData {
|
||||
@@ -73,7 +73,7 @@ public class TrialSpawnerData {
|
||||
});
|
||||
public final Set<UUID> detectedPlayers;
|
||||
public final Set<UUID> currentMobs;
|
||||
@@ -58,12 +58,12 @@ index 38078c44b35e917d1d243a5f8599aa858d8611de..13dbadfb50278b79b33d9dce10413c93
|
||||
private final Predicate<LootContext> compositeCondition;
|
||||
private final List<LootItemFunction> functions;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
index edaf7f1692ae059581f3abc24bb228874e6d114b..f09cfc472d4dbdc8cb0b6a45ef240b25a865ffba 100644
|
||||
index c2bded5094097f5615a2ddb0718942486ede93b5..78fd2b33174a0c8b1dec99009bc2c8d41f6cbfe0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java
|
||||
@@ -58,7 +58,7 @@ public class LootTable {
|
||||
public static final Codec<Holder<LootTable>> CODEC = RegistryFileCodec.create(Registries.LOOT_TABLE, LootTable.DIRECT_CODEC);
|
||||
private final LootContextParamSet paramSet;
|
||||
private final ContextKeySet paramSet;
|
||||
private final Optional<ResourceLocation> randomSequence;
|
||||
- private final List<LootPool> pools;
|
||||
+ public final List<LootPool> pools; // Leaves - private -> public
|
||||
@@ -97,7 +97,7 @@ index 1d2f2bb352abf6772cd20293575fc79e8e64ce3b..b157dfaf1efffebd3f2ae8cb8fcf0972
|
||||
|
||||
protected LootPoolEntryContainer(List<LootItemCondition> conditions) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java
|
||||
index 71989359192c8f30a1a8d343a2c6cb5b92330491..ec273bd4d0e61f54532df599f00695e8b9d44800 100644
|
||||
index 61d47a1e86a26bdee49d0ae931aeb92417ab02c2..1116f194b457ef736bf9e836c190817610008ef6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/NestedLootTable.java
|
||||
@@ -25,7 +25,7 @@ public class NestedLootTable extends LootPoolSingletonContainer {
|
||||
@@ -124,10 +124,10 @@ index 30d0133a42ce990352f5c492fcf9beb105364848..1ab2eab686b3a89d406f127a6036c0e2
|
||||
protected CompositeLootItemCondition(List<LootItemCondition> terms, Predicate<LootContext> predicate) {
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..438dfee78f7114e7c8d3d57c5dcc90e1fcc75a4c
|
||||
index 0000000000000000000000000000000000000000..ccce630f67cd6329033d65156231e749eaf0c448
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java
|
||||
@@ -0,0 +1,311 @@
|
||||
@@ -0,0 +1,312 @@
|
||||
+package org.leavesmc.leaves.protocol.jade;
|
||||
+
|
||||
+import com.google.common.base.Suppliers;
|
||||
@@ -290,8 +290,9 @@ index 0000000000000000000000000000000000000000..438dfee78f7114e7c8d3d57c5dcc90e1
|
||||
+
|
||||
+ try {
|
||||
+ shearableBlocks = Collections.unmodifiableList(LootTableMineableCollector.execute(
|
||||
+ MinecraftServer.getServer().reloadableRegistries().get().registryOrThrow(Registries.LOOT_TABLE),
|
||||
+ Items.SHEARS.getDefaultInstance()));
|
||||
+ MinecraftServer.getServer().reloadableRegistries().lookup().lookupOrThrow(Registries.LOOT_TABLE),
|
||||
+ Items.SHEARS.getDefaultInstance()
|
||||
+ ));
|
||||
+ } catch (Throwable ignore) {
|
||||
+ shearableBlocks = List.of();
|
||||
+ LeavesLogger.LOGGER.severe("Failed to collect shearable blocks");
|
||||
@@ -300,7 +301,7 @@ index 0000000000000000000000000000000000000000..438dfee78f7114e7c8d3d57c5dcc90e1
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (!LeavesConfig.jadeProtocol) {
|
||||
+ if (!LeavesConfig.protocol.jadeProtocol) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -309,7 +310,7 @@ index 0000000000000000000000000000000000000000..438dfee78f7114e7c8d3d57c5dcc90e1
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = RequestEntityPayload.class, payloadId = "request_entity")
|
||||
+ public static void requestEntityData(ServerPlayer player, RequestEntityPayload payload) {
|
||||
+ if (!LeavesConfig.jadeProtocol) {
|
||||
+ if (!LeavesConfig.protocol.jadeProtocol) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -361,7 +362,7 @@ index 0000000000000000000000000000000000000000..438dfee78f7114e7c8d3d57c5dcc90e1
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = RequestBlockPayload.class, payloadId = "request_block")
|
||||
+ public static void requestBlockData(ServerPlayer player, RequestBlockPayload payload) {
|
||||
+ if (!LeavesConfig.jadeProtocol) {
|
||||
+ if (!LeavesConfig.protocol.jadeProtocol) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@@ -424,7 +425,7 @@ index 0000000000000000000000000000000000000000..438dfee78f7114e7c8d3d57c5dcc90e1
|
||||
+
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ public static void onServerReload() {
|
||||
+ if (LeavesConfig.jadeProtocol) {
|
||||
+ if (LeavesConfig.protocol.jadeProtocol) {
|
||||
+ enableAllPlayer();
|
||||
+ }
|
||||
+ }
|
||||
@@ -1231,7 +1232,7 @@ index 0000000000000000000000000000000000000000..6e32eed15f028020223e2500849b4db3
|
||||
\ No newline at end of file
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java b/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..797558f3804a1a8143eafafd5dc46cc72ea19a42
|
||||
index 0000000000000000000000000000000000000000..3efa3ceb9654bc53adb61ded96c0ad08eb9b083d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageExtensionProvider.java
|
||||
@@ -0,0 +1,138 @@
|
||||
@@ -1285,7 +1286,7 @@ index 0000000000000000000000000000000000000000..797558f3804a1a8143eafafd5dc46cc7
|
||||
+ case RandomizableContainer te when te.getLootTable() != null -> {
|
||||
+ return List.of();
|
||||
+ }
|
||||
+ case ContainerEntity containerEntity when containerEntity.getLootTable() != null -> {
|
||||
+ case ContainerEntity containerEntity when containerEntity.getContainerLootTable() != null -> {
|
||||
+ return List.of();
|
||||
+ }
|
||||
+ default -> {
|
||||
@@ -3097,15 +3098,16 @@ index 0000000000000000000000000000000000000000..a046ae4e542efcadd0001b7225440c30
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java b/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..63f4d0a31232525db3620095fc662f0225c5f306
|
||||
index 0000000000000000000000000000000000000000..81575cfa4c5a6f1a1aadbf9ea7743cd1d053f925
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/jade/util/LootTableMineableCollector.java
|
||||
@@ -0,0 +1,105 @@
|
||||
@@ -0,0 +1,109 @@
|
||||
+package org.leavesmc.leaves.protocol.jade.util;
|
||||
+
|
||||
+import com.google.common.collect.Lists;
|
||||
+import net.minecraft.advancements.critereon.ItemPredicate;
|
||||
+import net.minecraft.core.Registry;
|
||||
+import net.minecraft.core.Holder;
|
||||
+import net.minecraft.core.HolderGetter;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.world.item.ItemStack;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
@@ -3121,19 +3123,20 @@ index 0000000000000000000000000000000000000000..63f4d0a31232525db3620095fc662f02
|
||||
+import org.leavesmc.leaves.protocol.jade.tool.ShearsToolHandler;
|
||||
+
|
||||
+import java.util.List;
|
||||
+import java.util.Optional;
|
||||
+import java.util.function.Function;
|
||||
+
|
||||
+public class LootTableMineableCollector {
|
||||
+
|
||||
+ private final Registry<LootTable> lootRegistry;
|
||||
+ private final HolderGetter<LootTable> lootRegistry;
|
||||
+ private final ItemStack toolItem;
|
||||
+
|
||||
+ public LootTableMineableCollector(Registry<LootTable> lootRegistry, ItemStack toolItem) {
|
||||
+ public LootTableMineableCollector(HolderGetter<LootTable> lootRegistry, ItemStack toolItem) {
|
||||
+ this.lootRegistry = lootRegistry;
|
||||
+ this.toolItem = toolItem;
|
||||
+ }
|
||||
+
|
||||
+ public static @NotNull List<Block> execute(Registry<LootTable> lootRegistry, ItemStack toolItem) {
|
||||
+ public static @NotNull List<Block> execute(HolderGetter<LootTable> lootRegistry, ItemStack toolItem) {
|
||||
+ LootTableMineableCollector collector = new LootTableMineableCollector(lootRegistry, toolItem);
|
||||
+ List<Block> list = Lists.newArrayList();
|
||||
+ for (Block block : BuiltInRegistries.BLOCK) {
|
||||
@@ -3141,11 +3144,13 @@ index 0000000000000000000000000000000000000000..63f4d0a31232525db3620095fc662f02
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ LootTable lootTable = lootRegistry.get(block.getLootTable());
|
||||
+ if (block.getLootTable().isPresent()) {
|
||||
+ LootTable lootTable = lootRegistry.get(block.getLootTable().get()).map(Holder::value).orElse(null);
|
||||
+ if (collector.doLootTable(lootTable)) {
|
||||
+ list.add(block);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return list;
|
||||
+ }
|
||||
+
|
||||
@@ -3179,7 +3184,7 @@ index 0000000000000000000000000000000000000000..63f4d0a31232525db3620095fc662f02
|
||||
+ }
|
||||
+ }
|
||||
+ } else if (entry instanceof NestedLootTable nestedLootTable) {
|
||||
+ LootTable lootTable = nestedLootTable.contents.map(lootRegistry::get, Function.identity());
|
||||
+ LootTable lootTable = nestedLootTable.contents.map($ -> lootRegistry.get($).map(Holder::value).orElse(null), Function.identity());
|
||||
+ return doLootTable(lootTable);
|
||||
+ } else {
|
||||
+ return isCorrectConditions(entry.conditions, toolItem);
|
||||
@@ -3193,8 +3198,8 @@ index 0000000000000000000000000000000000000000..63f4d0a31232525db3620095fc662f02
|
||||
+ }
|
||||
+
|
||||
+ LootItemCondition condition = conditions.getFirst();
|
||||
+ if (condition instanceof MatchTool matchTool) {
|
||||
+ ItemPredicate itemPredicate = matchTool.predicate().orElse(null);
|
||||
+ if (condition instanceof MatchTool(Optional<ItemPredicate> predicate)) {
|
||||
+ ItemPredicate itemPredicate = predicate.orElse(null);
|
||||
+ return itemPredicate != null && itemPredicate.test(toolItem);
|
||||
+ } else if (condition instanceof AnyOfCondition anyOfCondition) {
|
||||
+ for (LootItemCondition child : anyOfCondition.terms) {
|
||||
@@ -9,15 +9,15 @@ MasaGadget(https://github.com/plusls/MasaGadget)
|
||||
litematica(https://github.com/maruohon/litematica)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..29f38a0a87cb7e27ac18c09dd59e774cfd874592 100644
|
||||
index c816c935ecc74a811ffdffbe6ded73c06e92324a..dba8ee20f9fed3adf26885471897ade154ec1d4d 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -163,6 +163,27 @@ public class BlockItem extends Item {
|
||||
@@ -157,6 +157,27 @@ public class BlockItem extends Item {
|
||||
@Nullable
|
||||
protected BlockState getPlacementState(BlockPlaceContext context) {
|
||||
BlockState iblockdata = this.getBlock().getStateForPlacement(context);
|
||||
+ // Leaves start - alternativeBlockPlacement
|
||||
+ switch (org.leavesmc.leaves.LeavesConfig.alternativeBlockPlacement) {
|
||||
+ switch (org.leavesmc.leaves.LeavesConfig.protocol.alternativeBlockPlacement) {
|
||||
+ case CARPET -> {
|
||||
+ BlockState tryState = org.leavesmc.leaves.protocol.CarpetAlternativeBlockPlacement.alternativeBlockPlacement(getBlock(), context);
|
||||
+ if (tryState != null) {
|
||||
@@ -41,7 +41,7 @@ index 96fb69ec6db2e7c8c728435f0c537b076259b2fb..29f38a0a87cb7e27ac18c09dd59e774c
|
||||
return iblockdata != null && this.canPlace(context, iblockdata) ? iblockdata : null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
index f8f909ebdad5e96379e8bd8c610164ef0697368e..0b761f3ae15ad4a3b8152f497a60403212109534 100644
|
||||
index 1451b25cedb7a8f01c046c8e1f8c6853aca42283..4390adf843b395db688017eb9034b56a40971473 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
@@ -34,7 +34,7 @@ public class StandingAndWallBlockItem extends BlockItem {
|
||||
@@ -63,10 +63,10 @@ index f8f909ebdad5e96379e8bd8c610164ef0697368e..0b761f3ae15ad4a3b8152f497a604032
|
||||
if (iblockdata2 != null && this.canPlace(world, iblockdata2, blockposition)) {
|
||||
iblockdata1 = iblockdata2;
|
||||
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 7130209f48c488e2d184f31335f0511735963c55..0c31c53b1512f0c47a525eff04c1b783cb782fd3 100644
|
||||
index b3a3388ef62b0622906b2470056cb41f0deb0391..1c9b9f27179f2bd3f24709a763ff264e97cb1dca 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -411,6 +411,33 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -414,6 +414,33 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
|
||||
public void stepOn(Level world, BlockPos pos, BlockState state, Entity entity) {}
|
||||
|
||||
@@ -74,7 +74,7 @@ index 7130209f48c488e2d184f31335f0511735963c55..0c31c53b1512f0c47a525eff04c1b783
|
||||
+ @Nullable
|
||||
+ public BlockState getRealStateForPlacement(BlockPlaceContext ctx) {
|
||||
+ BlockState vanillaState = getStateForPlacement(ctx);
|
||||
+ switch (org.leavesmc.leaves.LeavesConfig.alternativeBlockPlacement) {
|
||||
+ switch (org.leavesmc.leaves.LeavesConfig.protocol.alternativeBlockPlacement) {
|
||||
+ case CARPET -> {
|
||||
+ BlockState tryState = org.leavesmc.leaves.protocol.CarpetAlternativeBlockPlacement.alternativeBlockPlacement(this, ctx);
|
||||
+ if (tryState != null) {
|
||||
@@ -102,10 +102,10 @@ index 7130209f48c488e2d184f31335f0511735963c55..0c31c53b1512f0c47a525eff04c1b783
|
||||
return this.defaultBlockState();
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java b/src/main/java/org/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..03978356d2716296f8c5e4173d10862db57a3193
|
||||
index 0000000000000000000000000000000000000000..e5c5bee2518ff2843270979d36d264f17a5cf0a6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/CarpetAlternativeBlockPlacement.java
|
||||
@@ -0,0 +1,162 @@
|
||||
@@ -0,0 +1,167 @@
|
||||
+package org.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import net.minecraft.core.BlockPos;
|
||||
@@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..03978356d2716296f8c5e4173d10862d
|
||||
+import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
+import net.minecraft.world.level.block.state.properties.ComparatorMode;
|
||||
+import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
+import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
+import net.minecraft.world.level.block.state.properties.Half;
|
||||
+import net.minecraft.world.level.block.state.properties.Property;
|
||||
+import net.minecraft.world.level.block.state.properties.SlabType;
|
||||
@@ -152,7 +152,7 @@ index 0000000000000000000000000000000000000000..03978356d2716296f8c5e4173d10862d
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ DirectionProperty directionProp = getFirstDirectionProperty(state);
|
||||
+ EnumProperty<Direction> directionProp = getFirstDirectionProperty(state);
|
||||
+ int protocolValue = ((int) relativeHitX - 2) / 2;
|
||||
+
|
||||
+ if (directionProp != null) {
|
||||
@@ -209,7 +209,8 @@ index 0000000000000000000000000000000000000000..03978356d2716296f8c5e4173d10862d
|
||||
+ return state;
|
||||
+ }
|
||||
+
|
||||
+ public static BlockState alternativeBlockPlacementFix(Block block, BlockPlaceContext context) {
|
||||
+ @Nullable
|
||||
+ public static BlockState alternativeBlockPlacementFix(Block block, @NotNull BlockPlaceContext context) {
|
||||
+ Direction facing;
|
||||
+ Vec3 vec3d = context.getClickLocation();
|
||||
+ BlockPos pos = context.getClickedPos();
|
||||
@@ -258,22 +259,26 @@ index 0000000000000000000000000000000000000000..03978356d2716296f8c5e4173d10862d
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ @Nullable
|
||||
+ public static DirectionProperty getFirstDirectionProperty(@NotNull BlockState state) {
|
||||
+ public static EnumProperty<Direction> getFirstDirectionProperty(@NotNull BlockState state) {
|
||||
+ for (Property<?> prop : state.getProperties()) {
|
||||
+ if (prop instanceof DirectionProperty) {
|
||||
+ return (DirectionProperty) prop;
|
||||
+ if (prop instanceof EnumProperty<?> enumProperty) {
|
||||
+ if (enumProperty.getValueClass().equals(Direction.class)) {
|
||||
+ return (EnumProperty<Direction>) enumProperty;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return null;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/LitematicaEasyPlaceProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/LitematicaEasyPlaceProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a4688f9eb
|
||||
index 0000000000000000000000000000000000000000..eceb1b8322fa50809990636e6caed491828e2fd6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/LitematicaEasyPlaceProtocol.java
|
||||
@@ -0,0 +1,209 @@
|
||||
@@ -0,0 +1,214 @@
|
||||
+package org.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import com.google.common.collect.ImmutableSet;
|
||||
@@ -287,10 +292,11 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+import net.minecraft.world.level.block.BedBlock;
|
||||
+import net.minecraft.world.level.block.state.BlockState;
|
||||
+import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
+import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||
+import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||
+import net.minecraft.world.level.block.state.properties.Property;
|
||||
+import net.minecraft.world.level.block.state.properties.SlabType;
|
||||
+import net.minecraft.world.phys.Vec3;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.leavesmc.leaves.LeavesLogger;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
@@ -311,6 +317,8 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+ BlockStateProperties.CHEST_TYPE,
|
||||
+ BlockStateProperties.MODE_COMPARATOR,
|
||||
+ BlockStateProperties.DOOR_HINGE,
|
||||
+ BlockStateProperties.FACING_HOPPER,
|
||||
+ BlockStateProperties.HORIZONTAL_FACING,
|
||||
+ BlockStateProperties.ORIENTATION,
|
||||
+ BlockStateProperties.RAIL_SHAPE,
|
||||
+ BlockStateProperties.RAIL_SHAPE_STRAIGHT,
|
||||
@@ -326,14 +334,15 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+ return applyPlacementProtocolV3(state, UseContext.from(context, context.getHand()));
|
||||
+ }
|
||||
+
|
||||
+ private static <T extends Comparable<T>> BlockState applyPlacementProtocolV3(BlockState state, UseContext context) {
|
||||
+ @Nullable
|
||||
+ private static <T extends Comparable<T>> BlockState applyPlacementProtocolV3(BlockState state, @NotNull UseContext context) {
|
||||
+ int protocolValue = (int) (context.getHitVec().x - (double) context.getPos().getX()) - 2;
|
||||
+ BlockState oldState = state;
|
||||
+ if (protocolValue < 0) {
|
||||
+ return oldState;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable DirectionProperty property = CarpetAlternativeBlockPlacement.getFirstDirectionProperty(state);
|
||||
+ EnumProperty<Direction> property = CarpetAlternativeBlockPlacement.getFirstDirectionProperty(state);
|
||||
+
|
||||
+ if (property != null && property != BlockStateProperties.VERTICAL_DIRECTION) {
|
||||
+ state = applyDirectionProperty(state, context, property, protocolValue);
|
||||
@@ -358,7 +367,7 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+
|
||||
+ try {
|
||||
+ for (Property<?> p : propList) {
|
||||
+ if (!(p instanceof DirectionProperty) && WHITELISTED_PROPERTIES.contains(p)) {
|
||||
+ if (((p instanceof EnumProperty<?> ep) && !ep.getValueClass().equals(Direction.class)) && WHITELISTED_PROPERTIES.contains(p)) {
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ Property<T> prop = (Property<T>) p;
|
||||
+ List<T> list = new ArrayList<>(prop.getPossibleValues());
|
||||
@@ -386,7 +395,7 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (Exception e) {
|
||||
+ LeavesLogger.LOGGER.warning("Exception trying to apply placement protocol value");
|
||||
+ LeavesLogger.LOGGER.warning("Exception trying to apply placement protocol value", e);
|
||||
+ }
|
||||
+
|
||||
+ if (state.canSurvive(context.getWorld(), context.getPos())) {
|
||||
@@ -396,7 +405,7 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static BlockState applyDirectionProperty(BlockState state, UseContext context, DirectionProperty property, int protocolValue) {
|
||||
+ private static BlockState applyDirectionProperty(BlockState state, UseContext context, EnumProperty<Direction> property, int protocolValue) {
|
||||
+ Direction facingOrig = state.getValue(property);
|
||||
+ Direction facing = facingOrig;
|
||||
+ int decodedFacingIndex = (protocolValue & 0xF) >> 1;
|
||||
@@ -448,7 +457,8 @@ index 0000000000000000000000000000000000000000..92f90ebf04f00341360e9e0ba1da5e0a
|
||||
+ this.itemPlacementContext = itemPlacementContext;
|
||||
+ }
|
||||
+
|
||||
+ public static UseContext from(BlockPlaceContext ctx, InteractionHand hand) {
|
||||
+ @NotNull
|
||||
+ public static UseContext from(@NotNull BlockPlaceContext ctx, InteractionHand hand) {
|
||||
+ Vec3 pos = ctx.getClickLocation();
|
||||
+ return new UseContext(ctx.getLevel(), ctx.getClickedPos(), ctx.getClickedFace(), new Vec3(pos.x, pos.y, pos.z), ctx.getPlayer(), hand, ctx);
|
||||
+ }
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Player operation limiter
|
||||
This patch is Powered by plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index c2263ef7fb67db7c01bac7aecf218ee8cb7369cb..b4ddddc0bf56ef1993d5db5727287cbeb19e6e53 100644
|
||||
index ebae6c704844755c75aa0c6f460603c5d909b5cf..d02f0123a830c77056e978bbef8d454d110d0589 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -302,6 +302,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -329,6 +329,10 @@ 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
|
||||
@@ -20,7 +20,7 @@ index c2263ef7fb67db7c01bac7aecf218ee8cb7369cb..b4ddddc0bf56ef1993d5db5727287cbe
|
||||
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
|
||||
@@ -763,6 +767,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -991,6 +995,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
this.joining = false;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -28,7 +28,7 @@ index c2263ef7fb67db7c01bac7aecf218ee8cb7369cb..b4ddddc0bf56ef1993d5db5727287cbe
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -2955,5 +2960,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -3314,5 +3319,32 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
public CraftPlayer getBukkitEntity() {
|
||||
return (CraftPlayer) super.getBukkitEntity();
|
||||
}
|
||||
@@ -62,15 +62,15 @@ index c2263ef7fb67db7c01bac7aecf218ee8cb7369cb..b4ddddc0bf56ef1993d5db5727287cbe
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
index ee9e4521079137d7b72194e8789810e7a89b8e75..171c2c2fe69e48a3b73348ee73e47417b80dec23 100644
|
||||
index a96f859a5d0c6ec692d4627a69f3c9ee49199dbc..31ff81ca6a89fc3ce59c4b53a6a547eb4f2e812a 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
||||
@@ -339,6 +339,19 @@ public class ServerPlayerGameMode {
|
||||
@@ -337,6 +337,19 @@ public class ServerPlayerGameMode {
|
||||
}
|
||||
|
||||
public void destroyAndAck(BlockPos pos, int sequence, String reason) {
|
||||
+ // Leaves start - player operation limiter
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.playerOperationLimiter) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.playerOperationLimiter) {
|
||||
+ if (reason.equals("insta mine")) {
|
||||
+ player.addInstaBreakCountPerTick();
|
||||
+ if (!player.allowOperation()) {
|
||||
@@ -86,15 +86,15 @@ index ee9e4521079137d7b72194e8789810e7a89b8e75..171c2c2fe69e48a3b73348ee73e47417
|
||||
this.debugLogging(pos, true, sequence, reason);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 29f38a0a87cb7e27ac18c09dd59e774cfd874592..2759a9eeef85b323b7e1ea78090f4f9d637c938a 100644
|
||||
index dba8ee20f9fed3adf26885471897ade154ec1d4d..77309808abd4ab476e815d60015ad828102a1f6b 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -80,6 +80,20 @@ public class BlockItem extends Item {
|
||||
@@ -74,6 +74,20 @@ public class BlockItem extends Item {
|
||||
final org.bukkit.block.BlockState oldBlockstate = blockstate != null ? blockstate : org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(blockactioncontext1.getLevel(), blockactioncontext1.getClickedPos()); // Paper - Reset placed block on exception
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Leaves start - player operation limiter
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.playerOperationLimiter && !context.getLevel().isClientSide()) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.playerOperationLimiter && !context.getLevel().isClientSide()) {
|
||||
+ ServerPlayer player = (ServerPlayer) context.getPlayer();
|
||||
+ if (player != null && iblockdata != null) {
|
||||
+ player.addPlaceBlockCountPerTick();
|
||||
@@ -6,22 +6,22 @@ Subject: [PATCH] Renewable Elytra
|
||||
This patch is Powered by Carpet-TIS-Addition(https://github.com/plusls/Carpet-TIS-Addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
index c277dac448a64809e93dd7a447ee3dc2a86c860e..5641da81d6f00e153d847b9284251084d545e726 100644
|
||||
index 150fd890ac65097b5434fd88e8d2b24a89dca79a..e47de71f7c120cf7f1a7cdb5e49b1d89163e5722 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
||||
@@ -233,6 +233,20 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
return entitysize.scale(1.0F + 0.15F * (float) i);
|
||||
return predicate.test(world, this, target);
|
||||
}
|
||||
|
||||
+ // Leaves start - renewable elytra
|
||||
+ @Override
|
||||
+ protected void dropFromLootTable(DamageSource source, boolean causedByPlayer) {
|
||||
+ super.dropFromLootTable(source, causedByPlayer);
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.renewableElytra > 0.0D) {
|
||||
+ if (source.getEntity() instanceof Shulker && this.random.nextDouble() < org.leavesmc.leaves.LeavesConfig.renewableElytra) {
|
||||
+ protected void dropFromLootTable(ServerLevel level, DamageSource source, boolean causedByPlayer) {
|
||||
+ super.dropFromLootTable(level, source, causedByPlayer);
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.renewableElytra > 0.0D) {
|
||||
+ if (source.getEntity() instanceof Shulker && this.random.nextDouble() < org.leavesmc.leaves.LeavesConfig.modify.renewableElytra) {
|
||||
+ net.minecraft.world.item.ItemStack item = new net.minecraft.world.item.ItemStack(net.minecraft.world.item.Items.ELYTRA);
|
||||
+ item.setDamageValue(432);
|
||||
+ this.spawnAtLocation(item);
|
||||
+ this.spawnAtLocation(level, item);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Stackable ShulkerBoxes
|
||||
This patch is Powered by fabric-carpet(https://github.com/gnembon/fabric-carpet) and plusls-carpet-addition(https://github.com/plusls/plusls-carpet-addition)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
||||
index 8cca2ac616a2c80268c96b9f95e33f834a0fc8fd..bcca3fa530fd52238bc9444244b1f26a567f6fc4 100644
|
||||
index 8d5939e03a065197af125d95a10134abbccd07ec..f6b703a7c46da64b7d789dc85b0973e894ced6de 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
||||
@@ -23,7 +23,7 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
|
||||
@@ -19,10 +19,10 @@ index 8cca2ac616a2c80268c96b9f95e33f834a0fc8fd..bcca3fa530fd52238bc9444244b1f26a
|
||||
|
||||
this.carriedItem = cursorStack.copy();
|
||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||
index 63f6a2437da9363786b55af0a7cbc5373232d35b..a56c59815b8d970d31a71edf3bf1a9962b0a983c 100644
|
||||
index 97b6605ba56584a44cfc4361af7389e876496ef2..4f73f392da9f32a1825f161a3777053df8e69600 100644
|
||||
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
||||
@@ -21,7 +21,7 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
||||
@@ -19,7 +19,7 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
||||
this.containerId = syncId;
|
||||
this.stateId = revision;
|
||||
this.slot = slot;
|
||||
@@ -32,10 +32,10 @@ index 63f6a2437da9363786b55af0a7cbc5373232d35b..a56c59815b8d970d31a71edf3bf1a996
|
||||
|
||||
private ClientboundContainerSetSlotPacket(RegistryFriendlyByteBuf buf) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 064d52d4479727c6a32bf357be8da32d1760e7fc..a90fc38ed741f19540e872ba3ac997f41608036f 100644
|
||||
index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..43cfe5e00285bf88d0724d27e55d28c2f825f741 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3415,7 +3415,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -3465,7 +3465,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
}
|
||||
|
||||
boolean flag1 = packet.slotNum() >= 1 && packet.slotNum() <= 45;
|
||||
@@ -62,7 +62,7 @@ index 5db5ba026462ca642dcee718af732f80fadabef5..bca47bc78a444011b7e549aba949fea7
|
||||
|
||||
boolean stillValid(Player player);
|
||||
diff --git a/src/main/java/net/minecraft/world/SimpleContainer.java b/src/main/java/net/minecraft/world/SimpleContainer.java
|
||||
index d04bf7d06855022c973073fb84c5d3d65f2553e1..9bedd76330e71ca7f3feecf0b90ec960c35d1a6f 100644
|
||||
index 7ed52b887c4d766c23220a8809914d5d80f12ea4..8f8ae3f27be586de1413013db3ffca254f93f4eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/SimpleContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/SimpleContainer.java
|
||||
@@ -222,7 +222,7 @@ public class SimpleContainer implements Container, StackedContentsCompatible {
|
||||
@@ -84,31 +84,32 @@ index d04bf7d06855022c973073fb84c5d3d65f2553e1..9bedd76330e71ca7f3feecf0b90ec960
|
||||
|
||||
if (j > 0) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 4423973d4d9a2c3879d98d1d4c8b8c117c677ac5..4259852e2387c87cb692e44b2d1a3f5d1cfcd616 100644
|
||||
index 0f086af57a5ff08c264dcbf89a8c3931ec73a609..8f2ca7211d4ebf494beae85caea5876fad4723eb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -22,10 +22,12 @@ import net.minecraft.world.entity.EntityType;
|
||||
@@ -12,11 +12,13 @@ import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.SlotAccess;
|
||||
import net.minecraft.world.entity.TraceableEntity;
|
||||
+import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.level.block.ShulkerBoxBlock;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.level.portal.TeleportTransition;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -36,6 +38,7 @@ import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.stats.Stats;
|
||||
@@ -36,6 +38,7 @@ import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.entity.Player;
|
||||
+import org.bukkit.block.ShulkerBox;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
@@ -314,10 +317,49 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -317,10 +320,49 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
private boolean isMergable() {
|
||||
ItemStack itemstack = this.getItem();
|
||||
|
||||
@@ -119,7 +120,7 @@ index 4423973d4d9a2c3879d98d1d4c8b8c117c677ac5..4259852e2387c87cb692e44b2d1a3f5d
|
||||
+ // Leaves end - stackable shulker boxes
|
||||
+ private boolean tryStackShulkerBoxes(ItemEntity other) {
|
||||
+ ItemStack selfStack = this.getItem();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.shulkerBoxStackSize == 1 || !(selfStack.getItem() instanceof BlockItem bi) || !(bi.getBlock() instanceof ShulkerBoxBlock)) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.shulkerBoxStackSize == 1 || !(selfStack.getItem() instanceof BlockItem bi) || !(bi.getBlock() instanceof ShulkerBoxBlock)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
@@ -128,8 +129,8 @@ index 4423973d4d9a2c3879d98d1d4c8b8c117c677ac5..4259852e2387c87cb692e44b2d1a3f5d
|
||||
+ && org.leavesmc.leaves.util.ShulkerBoxUtils.shulkerBoxNoItem(selfStack)
|
||||
+ && org.leavesmc.leaves.util.ShulkerBoxUtils.shulkerBoxNoItem(otherStack)
|
||||
+ && Objects.equals(selfStack.getComponents(), otherStack.getComponents()) // empty block entity tags are cleaned up when spawning
|
||||
+ && selfStack.getCount() != org.leavesmc.leaves.LeavesConfig.shulkerBoxStackSize) {
|
||||
+ int amount = Math.min(otherStack.getCount(), org.leavesmc.leaves.LeavesConfig.shulkerBoxStackSize - selfStack.getCount());
|
||||
+ && selfStack.getCount() != org.leavesmc.leaves.LeavesConfig.modify.shulkerBoxStackSize) {
|
||||
+ int amount = Math.min(otherStack.getCount(), org.leavesmc.leaves.LeavesConfig.modify.shulkerBoxStackSize - selfStack.getCount());
|
||||
+
|
||||
+ selfStack.grow(amount);
|
||||
+ this.setItem(selfStack);
|
||||
@@ -160,10 +161,10 @@ index 4423973d4d9a2c3879d98d1d4c8b8c117c677ac5..4259852e2387c87cb692e44b2d1a3f5d
|
||||
ItemStack itemstack1 = other.getItem();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..62b4aeabbde9561cd7e78fe14b751bd377ba129a 100644
|
||||
index d2bd4c5b2a7a9689680f4b021368f25356c58ac7..c07dae6cf6cd60a1f100415977dd9fe2ce639d72 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -111,7 +111,7 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -110,7 +110,7 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
private boolean hasRemainingSpaceForItem(ItemStack existingStack, ItemStack stack) {
|
||||
@@ -172,7 +173,7 @@ index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..62b4aeabbde9561cd7e78fe14b751bd3
|
||||
}
|
||||
|
||||
// CraftBukkit start - Watch method above! :D
|
||||
@@ -122,13 +122,13 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -121,13 +121,13 @@ public class Inventory implements Container, Nameable {
|
||||
if (itemstack1.isEmpty()) return itemstack.getCount();
|
||||
|
||||
if (this.hasRemainingSpaceForItem(itemstack1, itemstack)) {
|
||||
@@ -188,7 +189,7 @@ index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..62b4aeabbde9561cd7e78fe14b751bd3
|
||||
}
|
||||
if (remains <= 0) return itemstack.getCount();
|
||||
|
||||
@@ -279,7 +279,9 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -273,7 +273,9 @@ public class Inventory implements Container, Nameable {
|
||||
this.setItem(slot, itemstack1);
|
||||
}
|
||||
|
||||
@@ -199,20 +200,20 @@ index eb11482f48c9f330b7fa62a278fd6f07d3a642e1..62b4aeabbde9561cd7e78fe14b751bd3
|
||||
int l = Math.min(j, k);
|
||||
|
||||
if (l == 0) {
|
||||
@@ -394,7 +396,7 @@ public class Inventory implements Container, Nameable {
|
||||
@@ -388,7 +390,7 @@ public class Inventory implements Container, Nameable {
|
||||
}
|
||||
|
||||
if (i != -1) {
|
||||
- int j = stack.getMaxStackSize() - this.getItem(i).getCount();
|
||||
+ int j = org.leavesmc.leaves.util.ShulkerBoxUtils.getItemStackMaxCount(stack) - this.getItem(i).getCount(); // Leaves - stackable shulker boxes
|
||||
|
||||
if (this.add(i, stack.split(j)) && notifiesClient && this.player instanceof ServerPlayer) {
|
||||
((ServerPlayer) this.player).connection.send(new ClientboundContainerSetSlotPacket(-2, 0, i, this.getItem(i)));
|
||||
if (!this.add(i, stack.split(j)) || !notifiesClient) {
|
||||
continue;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
index 9fdeaaa67a39b7b4bd2ac8f58dd38b87c6540e3e..a0cb30bb04742a8ae4a9c4c8e17707e4530b40ed 100644
|
||||
index 45f6191cc8e2ecdacbc2df0ddb5ea7cc6a546812..02cfa01c85089c3aeee5288bff56cb4fa842dab6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java
|
||||
@@ -166,7 +166,7 @@ public interface ContainerEntity extends Container, MenuProvider {
|
||||
@@ -165,7 +165,7 @@ public interface ContainerEntity extends Container, MenuProvider {
|
||||
default void setChestVehicleItem(int slot, ItemStack stack) {
|
||||
this.unpackChestVehicleLootTable(null);
|
||||
this.getItemStacks().set(slot, stack);
|
||||
@@ -222,10 +223,10 @@ index 9fdeaaa67a39b7b4bd2ac8f58dd38b87c6540e3e..a0cb30bb04742a8ae4a9c4c8e17707e4
|
||||
|
||||
default SlotAccess getChestVehicleSlot(int slot) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78203d9102 100644
|
||||
index a21c658343ab6e1eb3a98ff10369b490bd7d52da..8d9bcffdfe722dbe0fb4503cc2c2ead47d338acb 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
|
||||
@@ -456,7 +456,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -493,7 +493,7 @@ public abstract class AbstractContainerMenu {
|
||||
|
||||
if (slot1 != null && AbstractContainerMenu.canItemQuickReplace(slot1, itemstack2, true) && slot1.mayPlace(itemstack2) && (this.quickcraftType == 2 || itemstack2.getCount() >= this.quickcraftSlots.size()) && this.canDragTo(slot1)) {
|
||||
int j1 = slot1.hasItem() ? slot1.getItem().getCount() : 0;
|
||||
@@ -234,7 +235,7 @@ index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78
|
||||
int l1 = Math.min(AbstractContainerMenu.getQuickCraftPlaceCount(this.quickcraftSlots, this.quickcraftType, itemstack1) + j1, k1);
|
||||
|
||||
l -= l1 - j1;
|
||||
@@ -575,7 +575,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -612,7 +612,7 @@ public abstract class AbstractContainerMenu {
|
||||
slot.setByPlayer(itemstack3);
|
||||
}
|
||||
} else if (ItemStack.isSameItemSameComponents(itemstack, itemstack3)) {
|
||||
@@ -243,7 +244,7 @@ index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78
|
||||
|
||||
optional1.ifPresent((itemstack4) -> {
|
||||
itemstack3.grow(itemstack4.getCount());
|
||||
@@ -645,7 +645,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -682,7 +682,7 @@ public abstract class AbstractContainerMenu {
|
||||
slot2 = (Slot) this.slots.get(slotIndex);
|
||||
if (slot2.hasItem()) {
|
||||
itemstack1 = slot2.getItem();
|
||||
@@ -252,7 +253,7 @@ index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78
|
||||
}
|
||||
} else if (actionType == ClickType.THROW && this.getCarried().isEmpty() && slotIndex >= 0) {
|
||||
slot2 = (Slot) this.slots.get(slotIndex);
|
||||
@@ -660,13 +660,13 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -713,13 +713,13 @@ public abstract class AbstractContainerMenu {
|
||||
j2 = button == 0 ? 1 : -1;
|
||||
|
||||
for (i2 = 0; i2 < 2; ++i2) {
|
||||
@@ -268,7 +269,7 @@ index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78
|
||||
ItemStack itemstack6 = slot3.safeTake(itemstack5.getCount(), itemstack1.getMaxStackSize() - itemstack1.getCount(), player);
|
||||
|
||||
itemstack1.grow(itemstack6.getCount());
|
||||
@@ -805,7 +805,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -868,7 +868,7 @@ public abstract class AbstractContainerMenu {
|
||||
ItemStack itemstack1;
|
||||
int l;
|
||||
|
||||
@@ -277,7 +278,7 @@ index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78
|
||||
while (!stack.isEmpty()) {
|
||||
if (fromLast) {
|
||||
if (k < startIndex) {
|
||||
@@ -824,6 +824,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -887,6 +887,7 @@ public abstract class AbstractContainerMenu {
|
||||
// Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
|
||||
if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(stack, itemstack1)) {
|
||||
l = itemstack1.getCount() + stack.getCount();
|
||||
@@ -285,7 +286,7 @@ index 9bb703f2af1f201772b5309a4d80b3fbe23a7201..ac9f80727e973b5303e4494310fbcb78
|
||||
int i1 = slot.getMaxStackSize(itemstack1);
|
||||
|
||||
if (l <= i1) {
|
||||
@@ -875,6 +876,7 @@ public abstract class AbstractContainerMenu {
|
||||
@@ -938,6 +939,7 @@ public abstract class AbstractContainerMenu {
|
||||
}
|
||||
// Paper end - Add PlayerTradeEvent and PlayerPurchaseEvent
|
||||
if (itemstack1.isEmpty() && slot.mayPlace(stack)) {
|
||||
@@ -307,7 +308,7 @@ index 9140fab07aab32065f7a3b5d13dd17d61dc6d646..210b88b5d87fad641188cf5907c54824
|
||||
this.updateSellItem();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/Slot.java b/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
index c39c773112fb8b534b926f2f2b47fe6fbb69fcb2..ae9338b8a5598e7a257b469adae72858fed95c39 100644
|
||||
index 0bdbd192f9eb2d6d529dc5b2baee9b4f20885b9c..7851247575321784aa13b707a7d6b945b4f24587 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/Slot.java
|
||||
@@ -76,7 +76,7 @@ public class Slot {
|
||||
@@ -320,10 +321,10 @@ index c39c773112fb8b534b926f2f2b47fe6fbb69fcb2..ae9338b8a5598e7a257b469adae72858
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 522b817f23f08eb720fe9d05eec7f548d2761603..a0879f03e8f1477d2c45bd4754f4d9171774a8a1 100644
|
||||
index 33e7d2884195677c4d6340d8b84c1dd85c636ec1..f38487562422ebaf59a679f493f956b90cc18ff1 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -225,7 +225,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@@ -224,7 +224,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@Deprecated
|
||||
@Nullable
|
||||
private Item item;
|
||||
@@ -333,25 +334,25 @@ index 522b817f23f08eb720fe9d05eec7f548d2761603..a0879f03e8f1477d2c45bd4754f4d917
|
||||
private Entity entityRepresentation;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
||||
index 4fdef6d7bcea0cf6b7d90324398af597660c80e3..b84d03bc51d081775207abd9ce1f4da80c0588eb 100644
|
||||
index e00ab1ed8088a1970249313ed63e09070fc6192d..89cfabda335d27d3657299c69837e29057617052 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/AbstractCauldronBlock.java
|
||||
@@ -58,9 +58,27 @@ public abstract class AbstractCauldronBlock extends Block {
|
||||
ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit
|
||||
) {
|
||||
@@ -56,9 +56,27 @@ public abstract class AbstractCauldronBlock extends Block {
|
||||
@Override
|
||||
protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
CauldronInteraction cauldronInteraction = this.interactions.map().get(stack.getItem());
|
||||
- return cauldronInteraction.interact(state, world, pos, player, hand, stack, hit.getDirection()); // Paper - pass hit direction
|
||||
+ return wrapInteractor(cauldronInteraction, state, world, pos, player, hand, stack, hit.getDirection()); // Paper - pass hit direction // Leaves - stackable shulker boxes
|
||||
}
|
||||
|
||||
+ // Leaves start - stackable shulker boxes
|
||||
+ private ItemInteractionResult wrapInteractor(CauldronInteraction cauldronBehavior, BlockState blockState, Level world, BlockPos blockPos, Player playerEntity, InteractionHand hand, ItemStack itemStack, net.minecraft.core.Direction hitDirection) {
|
||||
+ private InteractionResult wrapInteractor(CauldronInteraction cauldronBehavior, BlockState blockState, Level world, BlockPos blockPos, Player playerEntity, InteractionHand hand, ItemStack itemStack, net.minecraft.core.Direction hitDirection) {
|
||||
+ int count = -1;
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.shulkerBoxStackSize > 1 && itemStack.getItem() instanceof net.minecraft.world.item.BlockItem bi &&
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.shulkerBoxStackSize > 1 && itemStack.getItem() instanceof net.minecraft.world.item.BlockItem bi &&
|
||||
+ bi.getBlock() instanceof ShulkerBoxBlock) {
|
||||
+ count = itemStack.getCount();
|
||||
+ }
|
||||
+ ItemInteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack, hitDirection);
|
||||
+ InteractionResult result = cauldronBehavior.interact(blockState, world, blockPos, playerEntity, hand, itemStack, hitDirection);
|
||||
+ if (count > 0 && result.consumesAction()) {
|
||||
+ ItemStack current = playerEntity.getItemInHand(hand);
|
||||
+ if (current.getItem() instanceof net.minecraft.world.item.BlockItem bi && bi.getBlock() instanceof ShulkerBoxBlock) {
|
||||
@@ -366,20 +367,20 @@ index 4fdef6d7bcea0cf6b7d90324398af597660c80e3..b84d03bc51d081775207abd9ce1f4da8
|
||||
protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
|
||||
return SHAPE;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
index 9ad4600ebee09d81b1785103ad17de47cf1f2ede..7092a4d4a583f4e01cc02bca17f3bd1bd32677a0 100644
|
||||
index 82e93a63ea64adbf648ea7b8a844a376bbe63597..46bdb85f18077c77c445ce0bc3cfe32468c75306 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||
@@ -549,7 +549,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
@@ -426,7 +426,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||
boolean flag = !stack.isEmpty() && ItemStack.isSameItemSameComponents(itemstack1, stack);
|
||||
|
||||
this.items.set(slot, stack);
|
||||
- stack.limitSize(this.getMaxStackSize(stack));
|
||||
+ stack.limitSize(this.getMaxStackLeaves(stack)); // Leaves - stackable shulker boxes
|
||||
if (slot == 0 && !flag) {
|
||||
this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper - cook speed multiplier API
|
||||
this.cookingProgress = 0;
|
||||
Level world = this.level;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||
index 2ddf349fde5b310ec3f74baee1f3d33e09d5286c..76d85d7a34888731c083d33be906205576fed840 100644
|
||||
index 1f29b2419914ca9257db6553f01b7e7ec49bfc18..9d9a7c972119b224089f062d9c64c689e3d47bcc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java
|
||||
@@ -158,7 +158,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co
|
||||
@@ -392,7 +393,7 @@ index 2ddf349fde5b310ec3f74baee1f3d33e09d5286c..76d85d7a34888731c083d33be9062055
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index f7a6296773defc95215bdf36d8ea105cf9590a9e..5f394cda052271b6ecfafc325733e5ae0524822f 100644
|
||||
index 02bda85189fd57bd3f6d18cfd573553b2e607300..ad5a971a4de217aa93601db8364f2cad1aab4c38 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -125,7 +125,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -418,7 +419,7 @@ index f7a6296773defc95215bdf36d8ea105cf9590a9e..5f394cda052271b6ecfafc325733e5ae
|
||||
ignoreTileUpdates = true; // Paper - Perf: Optimize Hoppers
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/ShulkerBoxUtils.java b/src/main/java/org/leavesmc/leaves/util/ShulkerBoxUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..64344eb9310690dd31e7fadcfb29ed8dda559716
|
||||
index 0000000000000000000000000000000000000000..07ed58fba9f8eb0f66c5aa6bd216fc02bbc5a5b3
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/ShulkerBoxUtils.java
|
||||
@@ -0,0 +1,39 @@
|
||||
@@ -440,9 +441,9 @@ index 0000000000000000000000000000000000000000..64344eb9310690dd31e7fadcfb29ed8d
|
||||
+ }
|
||||
+
|
||||
+ public static int getItemStackMaxCount(ItemStack stack) {
|
||||
+ if (LeavesConfig.shulkerBoxStackSize > 1 && stack.getItem() instanceof BlockItem bi &&
|
||||
+ if (LeavesConfig.modify.shulkerBoxStackSize > 1 && stack.getItem() instanceof BlockItem bi &&
|
||||
+ bi.getBlock() instanceof ShulkerBoxBlock && shulkerBoxNoItem(stack)) {
|
||||
+ return LeavesConfig.shulkerBoxStackSize;
|
||||
+ return LeavesConfig.modify.shulkerBoxStackSize;
|
||||
+ }
|
||||
+ return stack.getMaxStackSize();
|
||||
+ }
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] MC Technical Survival Mode
|
||||
Will automatically overwrite some configuration after startup
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
index 1029b6de6f36b08bf634b4056ef5701383f6f258..64bb056d409c19eca724caa8512e6a597623170e 100644
|
||||
index c5644d8d64f12073e39bc6ed79c8714f4560ff89..e2e5fdf539f69629d13e50ab08b3fc38474e3384 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
|
||||
@@ -318,6 +318,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
@@ -321,6 +321,7 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
|
||||
for (ServerLevel level : server.getAllLevels()) {
|
||||
this.createWorldConfig(createWorldContextMap(level), reloader(this.worldConfigClass, level.paperConfig()));
|
||||
}
|
||||
@@ -17,34 +17,21 @@ index 1029b6de6f36b08bf634b4056ef5701383f6f258..64bb056d409c19eca724caa8512e6a59
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Could not reload paper configuration files", ex);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 2eb2f244ff8a69c606b49f208c934afe4ee5f59f..e8fa04e83aa80d8284aa58bf3899f5c81e4a2ef6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2509,7 +2509,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
public void onTickingEnd(Entity entity) {
|
||||
ServerLevel.this.entityTickList.remove(entity);
|
||||
// Paper start - Reset pearls when they stop being ticked
|
||||
- if (paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.mcTechnicalMode && paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && entity instanceof net.minecraft.world.entity.projectile.ThrownEnderpearl pearl) { // Leaves - mc technical mode
|
||||
pearl.cachedOwner = null;
|
||||
pearl.ownerUUID = null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b4ddddc0bf56ef1993d5db5727287cbeb19e6e53..b70ee2d80756e90c495c578ceb1c9235c6861a6e 100644
|
||||
index d02f0123a830c77056e978bbef8d454d110d0589..5e64ae27854a06d90c51682d905866f9fe667a36 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1632,7 +1632,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1901,7 +1901,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerableTo(DamageSource damageSource) {
|
||||
- return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming
|
||||
+ return super.isInvulnerableTo(damageSource) || this.isChangingDimension() || !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode && !this.level().paperConfig().collisions.allowPlayerCrammingDamage && damageSource == damageSources().cramming(); // Paper - disable player cramming // Leaves - mc technical survival mode
|
||||
public boolean isInvulnerableTo(ServerLevel world, DamageSource source) {
|
||||
- return super.isInvulnerableTo(world, source) || (this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL)) || (!this.level().paperConfig().collisions.allowPlayerCrammingDamage && source.is(DamageTypes.CRAMMING)); // Paper - disable player cramming;
|
||||
+ return super.isInvulnerableTo(world, source) || (this.isChangingDimension() && !source.is(DamageTypes.ENDER_PEARL)) || (!org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode && !this.level().paperConfig().collisions.allowPlayerCrammingDamage && source.is(DamageTypes.CRAMMING)); // Paper - disable player cramming; // Leaves - mc technical survival mode
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
index a33d89fe9ca9e343edab8bb1cc88c54130ddb4a7..5efedc1cadf31f2b944ca5401ce0c21131a4ab94 100644
|
||||
index 7cb3d69a69e0e3ef4b7f9f9c8b1eb67edb5d116d..f3350eb5a866f2890dbe0fb6e46cda090c6ab8f2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EndCrystal.java
|
||||
@@ -70,7 +70,7 @@ public class EndCrystal extends Entity {
|
||||
@@ -52,51 +39,38 @@ index a33d89fe9ca9e343edab8bb1cc88c54130ddb4a7..5efedc1cadf31f2b944ca5401ce0c211
|
||||
}
|
||||
// Paper start - Fix invulnerable end crystals
|
||||
- if (this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.mcTechnicalMode && this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { // Leaves - mc technical survival mode
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode && this.level().paperConfig().unsupportedSettings.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { // Leaves - mc technical survival mode
|
||||
if (!java.util.Objects.equals(((ServerLevel) this.level()).uuid, this.getOriginWorld())
|
||||
|| ((ServerLevel) this.level()).getDragonFight() == null
|
||||
|| ((ServerLevel) this.level()).getDragonFight().respawnStage == null
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 42bd2d9a1528b6210e4dfb56233062fd97c9743b..8d494b549abb452bb554220060cc9c5beec5edf6 100644
|
||||
index de87483600e55d88176fe25db621bbd3e464729f..34b9384c0f852d28dc8b834a40785ede74b33cfd 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -95,7 +95,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -101,7 +101,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
- if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
||||
+ if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > (org.leavesmc.leaves.LeavesConfig.mcTechnicalMode ? 2000 : this.level().spigotConfig.maxTntTicksPerTick)) { return; } // Spigot // Leaves - mc technical survival mode
|
||||
+ if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > (org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode ? 2000 : this.level().spigotConfig.maxTntTicksPerTick)) { return; } // Spigot // Leaves - mc technical survival mode
|
||||
this.handlePortal();
|
||||
this.applyGravity();
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 10ade433c083851d9ea4797c6ec618db122229f9..dff461c78e3a613391601b4a948fe49e62332439 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -126,7 +126,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
if (nbt.hasUUID("Owner")) {
|
||||
this.ownerUUID = nbt.getUUID("Owner");
|
||||
this.cachedOwner = null;
|
||||
- if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit
|
||||
+ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { this.ownerUUID = null; } // Paper - Reset pearls when they stop being ticked; Don't store shooter name for pearls to block enderpearl travel exploit // Leaves - mc technical mode
|
||||
}
|
||||
|
||||
this.leftOwner = nbt.getBoolean("LeftOwner");
|
||||
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
index 8205d34ed80781b2aab1fb2ef59986b9370f0198..c5b26fdb173a59280e790a5d5a687e0c0114bb74 100644
|
||||
index c1b76a1ebc1eea7ab70cf61d8175a31794dd122a..f817fd922ffcf857e8a5fc803b10421f640a8cd1 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -90,7 +90,7 @@ public final class NaturalSpawner {
|
||||
@@ -94,7 +94,7 @@ public final class NaturalSpawner {
|
||||
|
||||
if (enumcreaturetype != MobCategory.MISC) {
|
||||
// Paper start - Only count natural spawns
|
||||
- if (!entity.level().paperConfig().entities.spawning.countAllMobsForSpawning &&
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.mcTechnicalMode && !entity.level().paperConfig().entities.spawning.countAllMobsForSpawning && // Leaves - mc technical survival mode
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode && !entity.level().paperConfig().entities.spawning.countAllMobsForSpawning && // Leaves - mc technical survival mode
|
||||
!(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL ||
|
||||
entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) {
|
||||
continue;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
index 5f394cda052271b6ecfafc325733e5ae0524822f..cee74a6c47cd56a17a8faf68405fee09d6fd4655 100644
|
||||
index ad5a971a4de217aa93601db8364f2cad1aab4c38..7280d2216dcbe09278a2447eb994c4bd2aa98576 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||
@@ -295,7 +295,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||
@@ -104,7 +78,7 @@ index 5f394cda052271b6ecfafc325733e5ae0524822f..cee74a6c47cd56a17a8faf68405fee09
|
||||
}
|
||||
}
|
||||
- if (foundItem && level.paperConfig().hopper.cooldownWhenFull) { // Inventory was full - cooldown
|
||||
+ if (foundItem && level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { // Inventory was full - cooldown // Leaves
|
||||
+ if (foundItem && level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode) { // Inventory was full - cooldown // Leaves
|
||||
hopper.setCooldown(level.spigotConfig.hopperTransfer);
|
||||
}
|
||||
return false;
|
||||
@@ -113,13 +87,13 @@ index 5f394cda052271b6ecfafc325733e5ae0524822f..cee74a6c47cd56a17a8faf68405fee09
|
||||
origItemStack.setCount(originalItemCount);
|
||||
|
||||
- if (level.paperConfig().hopper.cooldownWhenFull) {
|
||||
+ if (level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.mcTechnicalMode) { // Leaves
|
||||
+ if (level.paperConfig().hopper.cooldownWhenFull && !org.leavesmc.leaves.LeavesConfig.modify.mcTechnicalMode) { // Leaves
|
||||
cooldownHopper(hopper);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java b/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..2fdcb75a1fb85ab2fc6759050b2e7ffa601dcfa0
|
||||
index 0000000000000000000000000000000000000000..0d8e5bf5f37357f2ed619e5574a8ce01589fe63e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/McTechnicalModeHelper.java
|
||||
@@ -0,0 +1,27 @@
|
||||
@@ -133,7 +107,7 @@ index 0000000000000000000000000000000000000000..2fdcb75a1fb85ab2fc6759050b2e7ffa
|
||||
+public class McTechnicalModeHelper {
|
||||
+
|
||||
+ public static void doMcTechnicalModeIf() {
|
||||
+ if (LeavesConfig.mcTechnicalMode) {
|
||||
+ if (LeavesConfig.modify.mcTechnicalMode) {
|
||||
+ doMcTechnicalMode();
|
||||
+ }
|
||||
+ }
|
||||
@@ -6,15 +6,15 @@ Subject: [PATCH] Return nether portal fix
|
||||
This patch is powered by NetherPortalFix(https://github.com/TwelveIterationMods/NetherPortalFix)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index b70ee2d80756e90c495c578ceb1c9235c6861a6e..5a044eb18e598e8c9f860e899631633342d39350 100644
|
||||
index b0c1cc7196dae695b73eb766c5acbffeffd306b3..f80911edce05c7440ead01a2332452e20ed734c1 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -1435,6 +1435,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
@@ -1699,6 +1699,21 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
// CraftBukkit end
|
||||
+ // Leaves start - nether portal fix
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.netherPortalFix) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.netherPortalFix) {
|
||||
+ final ResourceKey<Level> fromDim = worldserver1.dimension();
|
||||
+ final ResourceKey<Level> toDim = level().dimension();
|
||||
+ final ResourceKey<Level> OVERWORLD = Level.OVERWORLD;
|
||||
@@ -32,15 +32,15 @@ index b70ee2d80756e90c495c578ceb1c9235c6861a6e..5a044eb18e598e8c9f860e8996316333
|
||||
if (this.isBlocking()) {
|
||||
this.stopUsingItem();
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 2fc4d42619611a2724aff9bc114c9118212ad974..8bcb3ceab7089224d93b73ab5dbafb0b77c4c317 100644
|
||||
index 7a741442ee2373f1a400214047bbf5844efecce6..eb43b1fcda50326f086999a6e134c9807b837045 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -943,6 +943,24 @@ public abstract class PlayerList {
|
||||
@@ -909,6 +909,24 @@ public abstract class PlayerList {
|
||||
if (fromWorld != worldserver) {
|
||||
PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld.getWorld());
|
||||
this.server.server.getPluginManager().callEvent(event);
|
||||
+ // Leaves start - nether portal fix
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.netherPortalFix) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.netherPortalFix) {
|
||||
+ final ResourceKey<Level> fromDim = entityplayer.level().dimension();
|
||||
+ final ResourceKey<Level> toDim = entityplayer1.level().dimension();
|
||||
+ final ResourceKey<Level> OVERWORLD = Level.OVERWORLD;
|
||||
@@ -61,10 +61,10 @@ index 2fc4d42619611a2724aff9bc114c9118212ad974..8bcb3ceab7089224d93b73ab5dbafb0b
|
||||
|
||||
// Save player file again if they were disconnected
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d06f3080bf24b37a79519562825aba582a3f881a..ec5ac957bd463496a1d82e22db10be7d1b2de2dd 100644
|
||||
index 3002879d96916ce24400159792b48e5f9b8e2e3e..bc0eeb8274a7248dca7f01ddd89c9a7e481da75b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -260,7 +260,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -272,7 +272,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected ItemStack useItem;
|
||||
public int useItemRemaining;
|
||||
protected int fallFlyTicks;
|
||||
@@ -74,17 +74,17 @@ index d06f3080bf24b37a79519562825aba582a3f881a..ec5ac957bd463496a1d82e22db10be7d
|
||||
@Nullable
|
||||
private DamageSource lastDamageSource;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
index 0fdbcab175b51a8b77646e0e4a267d987b133a35..d61354349c3d0eea71b0a8ef8013ad418a639686 100644
|
||||
index 2b31bf586c1c0bd393d2aa8d0b6635dd9f22f21c..0a9ce12e958ac25a4d789254e1fec9ec2c2a33ca 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -172,7 +172,18 @@ public class NetherPortalBlock extends Block implements Portal {
|
||||
@@ -180,7 +180,18 @@ public class NetherPortalBlock extends Block implements Portal {
|
||||
|
||||
@Nullable
|
||||
private DimensionTransition getExitPortal(ServerLevel worldserver, Entity entity, BlockPos blockposition, BlockPos blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
private TeleportTransition getExitPortal(ServerLevel worldserver, Entity entity, BlockPos blockposition, BlockPos blockposition1, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
- Optional<BlockPos> optional = worldserver.getPortalForcer().findClosestPortalPosition(blockposition1, worldborder, searchRadius);
|
||||
+ // Leaves start - fix return portal
|
||||
+ Optional<BlockPos> optional = Optional.empty();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.netherPortalFix && entity instanceof net.minecraft.server.level.ServerPlayer player) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.netherPortalFix && entity instanceof net.minecraft.server.level.ServerPlayer player) {
|
||||
+ org.leavesmc.leaves.util.ReturnPortalManager.ReturnPortal portal = org.leavesmc.leaves.util.ReturnPortalManager.findReturnPortal(player, entity.level().dimension(), entity.blockPosition());
|
||||
+ if (portal != null && worldserver.getBlockState(portal.pos()).is(Blocks.NETHER_PORTAL)) {
|
||||
+ optional = Optional.of(portal.pos());
|
||||
@@ -95,7 +95,7 @@ index 0fdbcab175b51a8b77646e0e4a267d987b133a35..d61354349c3d0eea71b0a8ef8013ad41
|
||||
+ }
|
||||
+ // Leaves end - fix return portal
|
||||
BlockUtil.FoundRectangle blockutil_rectangle;
|
||||
DimensionTransition.PostDimensionTransition dimensiontransition_a;
|
||||
TeleportTransition.PostTeleportTransition teleporttransition_a;
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/ReturnPortalManager.java b/src/main/java/org/leavesmc/leaves/util/ReturnPortalManager.java
|
||||
new file mode 100644
|
||||
139
patches/server/0040-Appleskin-Protocol.patch
Normal file
139
patches/server/0040-Appleskin-Protocol.patch
Normal file
@@ -0,0 +1,139 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Wed, 25 Jan 2023 11:03:53 +0800
|
||||
Subject: [PATCH] Appleskin Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..dd8afa5a47e62829788c4d49d18e4436daa242dd
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
@@ -0,0 +1,127 @@
|
||||
+package org.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.food.FoodData;
|
||||
+import net.minecraft.world.level.GameRules;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.leavesmc.leaves.LeavesConfig;
|
||||
+import org.leavesmc.leaves.protocol.core.LeavesProtocol;
|
||||
+import org.leavesmc.leaves.protocol.core.ProtocolHandler;
|
||||
+import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "appleskin")
|
||||
+public class AppleSkinProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "appleskin";
|
||||
+
|
||||
+ private static final ResourceLocation SATURATION_KEY = id("saturation");
|
||||
+ private static final ResourceLocation EXHAUSTION_KEY = id("exhaustion");
|
||||
+ private static final ResourceLocation NATURAL_REGENERATION_KEY = id("natural_regeneration");
|
||||
+
|
||||
+ private static final float MINIMUM_EXHAUSTION_CHANGE_THRESHOLD = 0.01F;
|
||||
+
|
||||
+ private static final Map<ServerPlayer, Float> previousSaturationLevels = new HashMap<>();
|
||||
+ private static final Map<ServerPlayer, Float> previousExhaustionLevels = new HashMap<>();
|
||||
+ private static final Map<ServerPlayer, Boolean> previousNaturalRegeneration = new HashMap<>();
|
||||
+
|
||||
+ private static final Map<ServerPlayer, Set<String>> subscribedChannels = new HashMap<>();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.protocol.appleskin.enable) {
|
||||
+ resetPlayerData(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.protocol.appleskin.enable) {
|
||||
+ subscribedChannels.remove(player);
|
||||
+ resetPlayerData(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.MinecraftRegister(ignoreId = true)
|
||||
+ public static void onPlayerSubscribed(@NotNull ServerPlayer player, String channel) {
|
||||
+ if (LeavesConfig.protocol.appleskin.enable) {
|
||||
+ subscribedChannels.computeIfAbsent(player, k -> new HashSet<>()).add(channel);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.Ticker
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.protocol.appleskin.enable) {
|
||||
+ if (MinecraftServer.getServer().getTickCount() % LeavesConfig.protocol.appleskin.syncTickInterval != 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ for (Map.Entry<ServerPlayer, Set<String>> entry : subscribedChannels.entrySet()) {
|
||||
+ ServerPlayer player = entry.getKey();
|
||||
+ FoodData data = player.getFoodData();
|
||||
+
|
||||
+ for (String channel : entry.getValue()) {
|
||||
+ switch (channel) {
|
||||
+ case "saturation" -> {
|
||||
+ float saturation = data.getSaturationLevel();
|
||||
+ Float previousSaturation = previousSaturationLevels.get(player);
|
||||
+ if (previousSaturation == null || saturation != previousSaturation) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf -> buf.writeFloat(saturation));
|
||||
+ previousSaturationLevels.put(player, saturation);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ case "exhaustion" -> {
|
||||
+ float exhaustion = data.exhaustionLevel;
|
||||
+ Float previousExhaustion = previousExhaustionLevels.get(player);
|
||||
+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> buf.writeFloat(exhaustion));
|
||||
+ previousExhaustionLevels.put(player, exhaustion);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ case "natural_regeneration" -> {
|
||||
+ boolean regeneration = player.serverLevel().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);
|
||||
+ Boolean previousRegeneration = previousNaturalRegeneration.get(player);
|
||||
+ if (previousRegeneration == null || regeneration != previousRegeneration) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, NATURAL_REGENERATION_KEY, buf -> buf.writeBoolean(regeneration));
|
||||
+ previousNaturalRegeneration.put(player, regeneration);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ public static void onServerReload() {
|
||||
+ if (!LeavesConfig.protocol.appleskin.enable) {
|
||||
+ disableAllPlayer();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void disableAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedOut(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void resetPlayerData(@NotNull ServerPlayer player) {
|
||||
+ previousExhaustionLevels.remove(player);
|
||||
+ previousSaturationLevels.remove(player);
|
||||
+ previousNaturalRegeneration.remove(player);
|
||||
+ }
|
||||
+}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Xaero Map Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
index 69323d0889a0c9cd243441c42c8f454457421cfe..e62a27431bb2872bdf7dcc34366249dbfe8add17 100644
|
||||
index eb43b1fcda50326f086999a6e134c9807b837045..7a80d3e7d46a9c2a729ca50e2bd265fe5711a23f 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||
@@ -1289,6 +1289,7 @@ public abstract class PlayerList {
|
||||
@@ -1256,6 +1256,7 @@ public abstract class PlayerList {
|
||||
player.connection.send(new ClientboundInitializeBorderPacket(worldborder));
|
||||
player.connection.send(new ClientboundSetTimePacket(world.getGameTime(), world.getDayTime(), world.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
player.connection.send(new ClientboundSetDefaultSpawnPositionPacket(world.getSharedSpawnPos(), world.getSharedSpawnAngle()));
|
||||
@@ -18,7 +18,7 @@ index 69323d0889a0c9cd243441c42c8f454457421cfe..e62a27431bb2872bdf7dcc34366249db
|
||||
// entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..14e66b8eb6f2d768e03439df7f4dedc9ba8624dd
|
||||
index 0000000000000000000000000000000000000000..a94b5174282e0cb520c99a93cae7d3f439cd9cc8
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java
|
||||
@@ -0,0 +1,42 @@
|
||||
@@ -52,14 +52,14 @@ index 0000000000000000000000000000000000000000..14e66b8eb6f2d768e03439df7f4dedc9
|
||||
+ }
|
||||
+
|
||||
+ public static void onSendWorldInfo(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.xaeroMapProtocol) {
|
||||
+ if (LeavesConfig.protocol.xaeroMapProtocol) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, MINIMAP_KEY, buf -> {
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeInt(LeavesConfig.xaeroMapServerID);
|
||||
+ buf.writeInt(LeavesConfig.protocol.xaeroMapServerID);
|
||||
+ });
|
||||
+ ProtocolUtils.sendPayloadPacket(player, WORLDMAP_KEY, buf -> {
|
||||
+ buf.writeByte(0);
|
||||
+ buf.writeInt(LeavesConfig.xaeroMapServerID);
|
||||
+ buf.writeInt(LeavesConfig.protocol.xaeroMapServerID);
|
||||
+ });
|
||||
+ }
|
||||
+ }
|
||||
@@ -18,7 +18,7 @@ index 48e774677edf17d4a99ae9ed23d1b371dab41abb..21409ff86db65c00d92bff9eae8bdeb3
|
||||
public PaperAuthenticationService(Proxy proxy) {
|
||||
super(proxy);
|
||||
diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java
|
||||
index bfc1e27c37689c1fbb927404a7176780a439a057..bc8ab50ef1390a2c51110a89dc43db58215396a9 100644
|
||||
index 8c3151c25c172b846f0d028b5100718ada2d09d7..d59d05f8894481fb5ebe1aeb8ee7a162b3dc6f1c 100644
|
||||
--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java
|
||||
+++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilMinecraftSessionService.java
|
||||
@@ -46,7 +46,7 @@ import java.util.stream.Collectors;
|
||||
@@ -31,7 +31,7 @@ index bfc1e27c37689c1fbb927404a7176780a439a057..bc8ab50ef1390a2c51110a89dc43db58
|
||||
private final String baseUrl;
|
||||
private final URL joinUrl;
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index 581bd217304e0f9e0b2113c335694805dfb4e2a1..be579118fe33215016b25b144b405d10c7a36fbf 100644
|
||||
index 90ca25c4aaf92a5639839a7cdaee2ffcdb75efa7..f0c265a171590bafaed7c87c4f2e64e8e631ea41 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -191,7 +191,7 @@ public class Main {
|
||||
@@ -44,10 +44,10 @@ index 581bd217304e0f9e0b2113c335694805dfb4e2a1..be579118fe33215016b25b144b405d10
|
||||
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 0f07ee9d947235fc91f7d450d746f056a9b9e13a..375f4c7fc502902df9defd37409c4b54e643acfe 100644
|
||||
index ee43310ce1cd051e45486c4587c5e2aa1d000338..afe3cda698c415079d9f038b452cf594579b4eaf 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -265,7 +265,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -272,7 +272,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private boolean isDemo;
|
||||
private volatile boolean isReady;
|
||||
private long lastOverloadWarningNanos;
|
||||
@@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..6f14a66d78709fae9fecbefc80e3489b
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/profile/LeavesMinecraftSessionService.java b/src/main/java/org/leavesmc/leaves/profile/LeavesMinecraftSessionService.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..b15ee80ac1aea751594cd3321928f26d3cbf243e
|
||||
index 0000000000000000000000000000000000000000..133c7619e3e7546a51879acbb0a29154e9bc9659
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/profile/LeavesMinecraftSessionService.java
|
||||
@@ -0,0 +1,102 @@
|
||||
@@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..b15ee80ac1aea751594cd3321928f26d
|
||||
+ return null; // if it has same name, return null
|
||||
+ }
|
||||
+
|
||||
+ if (LeavesConfig.extraYggdrasilService && result == null) {
|
||||
+ if (LeavesConfig.mics.yggdrasil.enable && result == null) {
|
||||
+ final Map<String, Object> arguments = new HashMap<>();
|
||||
+ arguments.put("username", profileName);
|
||||
+ arguments.put("serverId", serverId);
|
||||
@@ -152,7 +152,7 @@ index 0000000000000000000000000000000000000000..b15ee80ac1aea751594cd3321928f26d
|
||||
+ }
|
||||
+
|
||||
+ GameProfile cache = null;
|
||||
+ if (LeavesConfig.extraYggdrasilLoginProtect) {
|
||||
+ if (LeavesConfig.mics.yggdrasil.loginProtect) {
|
||||
+ cache = MinecraftServer.getServer().services.profileCache().getProfileIfCached(profileName);
|
||||
+ }
|
||||
+
|
||||
@@ -161,7 +161,7 @@ index 0000000000000000000000000000000000000000..b15ee80ac1aea751594cd3321928f26d
|
||||
+ try {
|
||||
+ final HasJoinedMinecraftServerResponse response = client.get(url, HasJoinedMinecraftServerResponse.class);
|
||||
+ if (response != null && response.id() != null) {
|
||||
+ if (LeavesConfig.extraYggdrasilLoginProtect && cache != null) {
|
||||
+ if (LeavesConfig.mics.yggdrasil.loginProtect && cache != null) {
|
||||
+ if (response.id() != cache.getId()) {
|
||||
+ continue;
|
||||
+ }
|
||||
@@ -5,46 +5,46 @@ Subject: [PATCH] Use vanilla random config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 1beefbd05c13181214e188f50e88fb67f6712a45..012c638335ac54ffe1f780d2cd1e3a50243e33e9 100644
|
||||
index 7e61b008c9429f6ef60fcef4887bb50db4face91..b7d5a1f56067c6fec74d653b0da48e9610def283 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -558,7 +558,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -578,7 +578,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
- this.random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
|
||||
+ this.random = org.leavesmc.leaves.LeavesConfig.useVanillaRandom ? RandomSource.create() : SHARED_RANDOM; // Paper - Share random for entities to make them more random // Leaves - vanilla plz
|
||||
+ this.random = org.leavesmc.leaves.LeavesConfig.modify.useVanillaRandom ? RandomSource.create() : SHARED_RANDOM; // Paper - Share random for entities to make them more random // Leaves - vanilla plz
|
||||
this.remainingFireTicks = -this.getFireImmuneTicks();
|
||||
this.fluidHeight = new Object2DoubleArrayMap(2);
|
||||
this.fluidOnEyes = new HashSet();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
index 1b3978f4ea7e8491e0c0cb6de23c141f44fab414..024ca6a445e5a29fdf5636ff1b4770d4c62f8615 100644
|
||||
index 42276acfeadec6e7aa9a91d3f446f4fedb04829d..c2f178d74e61c6d169ccea15ce8d3d0568dbcbe8 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -1029,7 +1029,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
@@ -1088,7 +1088,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
|
||||
BeeGoToHiveGoal() {
|
||||
super();
|
||||
- this.travellingTicks = Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
|
||||
+ this.travellingTicks = org.leavesmc.leaves.LeavesConfig.useVanillaRandom ? Bee.this.level().random.nextInt(10) : Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues // Leaves - why no vanilla
|
||||
+ this.travellingTicks = org.leavesmc.leaves.LeavesConfig.modify.useVanillaRandom ? Bee.this.level().random.nextInt(10) : Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues // Leaves - why no vanilla
|
||||
this.blacklistedTargets = Lists.newArrayList();
|
||||
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
index 42f4e544fe7fbc342f15eacb5e38d40849e3c419..0bd9ee3d0b546564a069f4aaf7a33e35bfa13ad8 100644
|
||||
index f9fdc600dc680c55219fcbf9bc8f151a733a093c..ff9e8f501a537d005aba63737303177ca6882760 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -41,7 +41,7 @@ public class Squid extends WaterAnimal {
|
||||
@@ -46,7 +46,7 @@ public class Squid extends AgeableWaterCreature {
|
||||
|
||||
public Squid(EntityType<? extends Squid> type, Level world) {
|
||||
super(type, world);
|
||||
- //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.useVanillaRandom) this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random // Leaves - vanilla plz
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.useVanillaRandom) this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random // Leaves - vanilla plz
|
||||
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 929a9bee808e8216dacb74dc58dbeee612126afe..9205d565f375a8177c6bc0c19e1f594d1d8cd0ed 100644
|
||||
index 8f2ca7211d4ebf494beae85caea5876fad4723eb..9e8a40f51337822ac55b5020778076c7466f5ef3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -79,7 +79,13 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -53,7 +53,7 @@ index 929a9bee808e8216dacb74dc58dbeee612126afe..9205d565f375a8177c6bc0c19e1f594d
|
||||
this.setPos(x, y, z);
|
||||
- this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D);
|
||||
+ // Leaves start - vanilla yes, paper no
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.useVanillaRandom) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.useVanillaRandom) {
|
||||
+ this.setDeltaMovement(world.random.nextDouble() * 0.2D - 0.1D, 0.2D, world.random.nextDouble() * 0.2D - 0.1D);
|
||||
+ } else {
|
||||
+ this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D);
|
||||
@@ -63,15 +63,15 @@ index 929a9bee808e8216dacb74dc58dbeee612126afe..9205d565f375a8177c6bc0c19e1f594d
|
||||
// Paper end - Don't use level random in entity constructors
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 8d494b549abb452bb554220060cc9c5beec5edf6..ac05fe9a17f67a4cb12cdb9c381896d7bb0b3f6a 100644
|
||||
index 34b9384c0f852d28dc8b834a40785ede74b33cfd..aa4179781fc67e7e4194cfac795aa2a84abe616b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -62,7 +62,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -68,7 +68,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
public PrimedTnt(Level world, double x, double y, double z, @Nullable LivingEntity igniter) {
|
||||
this(EntityType.TNT, world);
|
||||
this.setPos(x, y, z);
|
||||
- double d3 = this.random.nextDouble() * 6.2831854820251465D; // Paper - Don't use level random in entity constructors
|
||||
+ double d3 = (org.leavesmc.leaves.LeavesConfig.useVanillaRandom ? world.random.nextDouble() : this.random.nextDouble()) * 6.2831854820251465D; // Paper - Don't use level random in entity constructors // Leaves - why?
|
||||
+ double d3 = (org.leavesmc.leaves.LeavesConfig.modify.useVanillaRandom ? world.random.nextDouble() : this.random.nextDouble()) * 6.2831854820251465D; // Paper - Don't use level random in entity constructors // Leaves - why?
|
||||
|
||||
this.setDeltaMovement(-Math.sin(d3) * 0.02D, 0.20000000298023224D, -Math.cos(d3) * 0.02D);
|
||||
this.setFuse(80);
|
||||
@@ -1,118 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Wed, 25 Jan 2023 11:03:53 +0800
|
||||
Subject: [PATCH] Appleskin Protocol
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..6662ecf8a9342db2e0ded507d7420319388f9974
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java
|
||||
@@ -0,0 +1,106 @@
|
||||
+package org.leavesmc.leaves.protocol;
|
||||
+
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import net.minecraft.world.food.FoodData;
|
||||
+import org.jetbrains.annotations.Contract;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.leavesmc.leaves.LeavesConfig;
|
||||
+import org.leavesmc.leaves.protocol.core.LeavesProtocol;
|
||||
+import org.leavesmc.leaves.protocol.core.ProtocolHandler;
|
||||
+import org.leavesmc.leaves.protocol.core.ProtocolUtils;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Map;
|
||||
+import java.util.Set;
|
||||
+import java.util.UUID;
|
||||
+
|
||||
+@LeavesProtocol(namespace = "appleskin")
|
||||
+public class AppleSkinProtocol {
|
||||
+
|
||||
+ public static final String PROTOCOL_ID = "appleskin";
|
||||
+
|
||||
+ private static final ResourceLocation SATURATION_KEY = id("saturation_sync");
|
||||
+ private static final ResourceLocation EXHAUSTION_KEY = id("exhaustion_sync");
|
||||
+
|
||||
+ private static final Map<UUID, Float> previousSaturationLevels = new HashMap<>();
|
||||
+ private static final Map<UUID, Float> previousExhaustionLevels = new HashMap<>();
|
||||
+
|
||||
+ private static final float MINIMUM_EXHAUSTION_CHANGE_THRESHOLD = 0.01F;
|
||||
+
|
||||
+ private static final Set<ServerPlayer> players = new HashSet<>();
|
||||
+
|
||||
+ @Contract("_ -> new")
|
||||
+ public static @NotNull ResourceLocation id(String path) {
|
||||
+ return new ResourceLocation(PROTOCOL_ID, path);
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerLoggedIn(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ resetPlayerData(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLoggedOut(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ players.remove(player);
|
||||
+ resetPlayerData(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.MinecraftRegister(ignoreId = true)
|
||||
+ public static void onPlayerSubscribed(@NotNull ServerPlayer player) {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ players.add(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.Ticker
|
||||
+ public static void tick() {
|
||||
+ if (LeavesConfig.appleskinProtocol) {
|
||||
+ for (ServerPlayer player : players) {
|
||||
+ FoodData data = player.getFoodData();
|
||||
+
|
||||
+ float saturation = data.getSaturationLevel();
|
||||
+ Float previousSaturation = previousSaturationLevels.get(player.getUUID());
|
||||
+ if (previousSaturation == null || saturation != previousSaturation) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, SATURATION_KEY, buf -> {
|
||||
+ buf.writeFloat(saturation);
|
||||
+ });
|
||||
+ previousSaturationLevels.put(player.getUUID(), saturation);
|
||||
+ }
|
||||
+
|
||||
+ float exhaustion = data.getExhaustionLevel();
|
||||
+ Float previousExhaustion = previousExhaustionLevels.get(player.getUUID());
|
||||
+ if (previousExhaustion == null || Math.abs(exhaustion - previousExhaustion) >= MINIMUM_EXHAUSTION_CHANGE_THRESHOLD) {
|
||||
+ ProtocolUtils.sendPayloadPacket(player, EXHAUSTION_KEY, buf -> {
|
||||
+ buf.writeFloat(exhaustion);
|
||||
+ });
|
||||
+ previousExhaustionLevels.put(player.getUUID(), exhaustion);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @ProtocolHandler.ReloadServer
|
||||
+ public static void onServerReload() {
|
||||
+ if (!LeavesConfig.appleskinProtocol) {
|
||||
+ disableAllPlayer();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void disableAllPlayer() {
|
||||
+ for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().getPlayers()) {
|
||||
+ onPlayerLoggedOut(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static void resetPlayerData(@NotNull ServerPlayer player) {
|
||||
+ previousExhaustionLevels.remove(player.getUUID());
|
||||
+ previousSaturationLevels.remove(player.getUUID());
|
||||
+ }
|
||||
+}
|
||||
@@ -20,11 +20,11 @@ index 1f7f68aad97ee73763c042837f239bdc7167db55..1e8025ecb14acc7c24917793c97f5435
|
||||
if (exception instanceof ReportedException) {
|
||||
ReportedException reportedexception = (ReportedException) exception;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index bf1bb8fa681360c3b634bcd6d8979cc2c5137957..236ad5ac3f4665ff940c6505ca1d01c6ace7f316 100644
|
||||
index 10108b66622128c90be01d5fa83c8dca6647c354..0badf81ac6c141b8736758eef1e93af9baf66d33 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1787,7 +1787,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.push("tick");
|
||||
@@ -1874,7 +1874,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
gameprofilerfiller.push("tick");
|
||||
|
||||
try {
|
||||
- worldserver.tick(shouldKeepTicking);
|
||||
@@ -39,20 +39,20 @@ index bf1bb8fa681360c3b634bcd6d8979cc2c5137957..236ad5ac3f4665ff940c6505ca1d01c6
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
index 6b2c3afa04a3564e435633b521d918ed795f9f65..8e899549f09b8429cd63bd5c895253325f65ccab 100644
|
||||
index 155c7240b1112729333e6968122568c707d8f66b..b7c1050dfafa79f3ed86524ce37cd06651cbbdd9 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
||||
@@ -243,7 +243,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
||||
@@ -239,7 +239,17 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
||||
|
||||
@Override
|
||||
protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
|
||||
- return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
+ // Leaves start - fix update suppression crash
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.updateSuppressionCrashFix) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.updateSuppressionCrashFix) {
|
||||
+ try {
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
+ } catch (ClassCastException ex) {
|
||||
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(null, pos);
|
||||
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, this);
|
||||
+ }
|
||||
+ } else {
|
||||
+ return AbstractContainerMenu.getRedstoneSignalFromBlockEntity(world.getBlockEntity(pos));
|
||||
@@ -62,22 +62,22 @@ index 6b2c3afa04a3564e435633b521d918ed795f9f65..8e899549f09b8429cd63bd5c89525332
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
index e679b40b9628b0eb7152978ef641f9c918c4c8b2..02fa557a129cd85abae0e57be5edc6241943a488 100644
|
||||
index e414da8a51bb9b49c28a74eca166046cbee44835..255f04bd24aaf40d0975e3f18ec6d6277cc4441b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/NeighborUpdater.java
|
||||
@@ -66,9 +66,17 @@ public interface NeighborUpdater {
|
||||
state.handleNeighborChanged(world, pos, sourceBlock, sourcePos, notify);
|
||||
@@ -76,9 +76,17 @@ public interface NeighborUpdater {
|
||||
state.handleNeighborChanged(world, pos, sourceBlock, orientation, notify);
|
||||
// Spigot Start
|
||||
} catch (StackOverflowError ex) {
|
||||
+ // Leaves start - fix update suppression crash
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.updateSuppressionCrashFix) {
|
||||
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, sourcePos);
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.updateSuppressionCrashFix) {
|
||||
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, sourceBlock);
|
||||
+ }
|
||||
world.lastPhysicsProblem = new BlockPos(pos);
|
||||
// Spigot End
|
||||
} catch (Throwable throwable) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.updateSuppressionCrashFix) {
|
||||
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, sourcePos);
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.updateSuppressionCrashFix) {
|
||||
+ throw new org.leavesmc.leaves.util.UpdateSuppressionException(pos, sourceBlock);
|
||||
+ }
|
||||
+ // Leaves end - fix update suppression crash
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception while updating neighbours");
|
||||
@@ -85,20 +85,21 @@ index e679b40b9628b0eb7152978ef641f9c918c4c8b2..02fa557a129cd85abae0e57be5edc624
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/UpdateSuppressionException.java b/src/main/java/org/leavesmc/leaves/util/UpdateSuppressionException.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..77fd58a309b5d3c45f963c4bd1f47d7fc212898e
|
||||
index 0000000000000000000000000000000000000000..150a0813b775a863d8c5c744f299dd248a600a47
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/UpdateSuppressionException.java
|
||||
@@ -0,0 +1,33 @@
|
||||
@@ -0,0 +1,32 @@
|
||||
+package org.leavesmc.leaves.util;
|
||||
+
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+
|
||||
+public class UpdateSuppressionException extends RuntimeException {
|
||||
+
|
||||
+ private final BlockPos pos;
|
||||
+ private final BlockPos source;
|
||||
+ private final Block source;
|
||||
+
|
||||
+ public UpdateSuppressionException(BlockPos pos, BlockPos source) {
|
||||
+ public UpdateSuppressionException(BlockPos pos, Block source) {
|
||||
+ super("Update suppression");
|
||||
+ this.pos = pos;
|
||||
+ this.source = source;
|
||||
@@ -108,17 +109,15 @@ index 0000000000000000000000000000000000000000..77fd58a309b5d3c45f963c4bd1f47d7f
|
||||
+ return pos;
|
||||
+ }
|
||||
+
|
||||
+ public BlockPos getSource() {
|
||||
+ public Block getSource() {
|
||||
+ return source;
|
||||
+ }
|
||||
+
|
||||
+ public String getMessage() {
|
||||
+ if (pos != null) {
|
||||
+ return "An update suppression processed, form [x:%d,y:%d,z:%d] to [x:%d,y:%d,z:%d]"
|
||||
+ .formatted(source.getX(), source.getY(), source.getZ(), pos.getX(), pos.getY(), pos.getZ());
|
||||
+ return "An update suppression processed, form [%s] to [x:%d,y:%d,z:%d]".formatted(source.getName(), pos.getX(), pos.getY(), pos.getZ());
|
||||
+ } else {
|
||||
+ return "An update suppression processed, form [x:%d,y:%d,z:%d]"
|
||||
+ .formatted(source.getX(), source.getY(), source.getZ());
|
||||
+ return "An update suppression processed, form [%s]".formatted(source.getName());
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Bedrock break list
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 236ad5ac3f4665ff940c6505ca1d01c6ace7f316..53c97644f30e61d7e2ccab2024714b8aa135287f 100644
|
||||
index 0badf81ac6c141b8736758eef1e93af9baf66d33..98d1e4c934e25e5c0dfe844e6aa3dd236d411da0 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1820,6 +1820,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1906,6 +1906,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
|
||||
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // Leaves - protocol
|
||||
|
||||
@@ -18,7 +18,7 @@ index 236ad5ac3f4665ff940c6505ca1d01c6ace7f316..53c97644f30e61d7e2ccab2024714b8a
|
||||
((Runnable) this.tickables.get(i)).run();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ServerScoreboard.java b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
index f180001493146ef0d54079a8b2b47ad7decc24ca..fa63d9d13505794742721ca5fa673ff25acde463 100644
|
||||
index 8fd4d8ffcc9e1a0fcf83730d26c3bb9bef0f73f2..ca6752f938eaeebd40e5a889cb36b4b8df3a8f01 100644
|
||||
--- a/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
+++ b/src/main/java/net/minecraft/server/ServerScoreboard.java
|
||||
@@ -146,6 +146,7 @@ public class ServerScoreboard extends Scoreboard {
|
||||
@@ -38,10 +38,10 @@ index f180001493146ef0d54079a8b2b47ad7decc24ca..fa63d9d13505794742721ca5fa673ff2
|
||||
this.stopTrackingObjective(objective);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
index e0c62227b279a5fe0f3868fbf9ce8c78c515a09c..933d7a7fcf2520fc81d465bc346e461e1ab9b74e 100644
|
||||
index 4b51472502d08ea357da437afeb4b581979e9cff..79bb7ff91f67fa49f34f2714b3ee2bc238c40e19 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
|
||||
@@ -106,6 +106,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -109,6 +109,11 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@Override
|
||||
public void setPlacedBy(Level world, BlockPos pos, BlockState state, LivingEntity placer, ItemStack itemStack) {
|
||||
if (!world.isClientSide) {
|
||||
@@ -53,7 +53,7 @@ index e0c62227b279a5fe0f3868fbf9ce8c78c515a09c..933d7a7fcf2520fc81d465bc346e461e
|
||||
this.checkIfExtend(world, pos, state);
|
||||
}
|
||||
|
||||
@@ -291,13 +296,24 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
@@ -294,13 +299,24 @@ public class PistonBaseBlock extends DirectionalBlock {
|
||||
}
|
||||
}
|
||||
// Paper end - Fix sticky pistons and BlockPistonRetractEvent
|
||||
@@ -81,7 +81,7 @@ index e0c62227b279a5fe0f3868fbf9ce8c78c515a09c..933d7a7fcf2520fc81d465bc346e461e
|
||||
((ServerLevel) world).getChunkSource().blockChanged(headPos); // ... fix client desync
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/BreakBedrockList.java b/src/main/java/org/leavesmc/leaves/util/BreakBedrockList.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a2185d0279e
|
||||
index 0000000000000000000000000000000000000000..fb10e783e5971f3e1e222e1e3423883f3dd3d3af
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/BreakBedrockList.java
|
||||
@@ -0,0 +1,114 @@
|
||||
@@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
|
||||
+ }
|
||||
+
|
||||
+ public static void onPlayerPlacePiston(Level level, Player player, BlockPos pos) {
|
||||
+ if (LeavesConfig.bedrockBreakList) {
|
||||
+ if (LeavesConfig.modify.bedrockBreakList) {
|
||||
+ Direction pistonFacing = level.getBlockState(pos).getValue(DirectionalBlock.FACING);
|
||||
+ BlockPos bedrockPos = pos.relative(pistonFacing);
|
||||
+ if (level.getBlockState(bedrockPos).getBlock() == Blocks.BEDROCK) {
|
||||
@@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
|
||||
+ }
|
||||
+
|
||||
+ public static void onPistonBreakBedrock(Level level, BlockPos bedrock) {
|
||||
+ if (LeavesConfig.bedrockBreakList) {
|
||||
+ if (LeavesConfig.modify.bedrockBreakList) {
|
||||
+ Map<BlockPos, Player> map = pistonCache.get(level);
|
||||
+
|
||||
+ boolean flag = map != null && map.get(bedrock) != null;
|
||||
@@ -164,7 +164,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
|
||||
+ }
|
||||
+
|
||||
+ public static void onScoreboardAdd(@NotNull Objective objective) {
|
||||
+ if (LeavesConfig.bedrockBreakList) {
|
||||
+ if (LeavesConfig.modify.bedrockBreakList) {
|
||||
+ if (objective.getCriteria() == ObjectiveCriteria.DUMMY) {
|
||||
+ String name = objective.getName();
|
||||
+
|
||||
@@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..1c5992f1480a25dbd5967218be2a3a21
|
||||
+ }
|
||||
+
|
||||
+ public static void onScoreboardRemove(@NotNull Objective objective) {
|
||||
+ if (LeavesConfig.bedrockBreakList) {
|
||||
+ if (LeavesConfig.modify.bedrockBreakList) {
|
||||
+ if (objective.getCriteria() == ObjectiveCriteria.DUMMY) {
|
||||
+ String name = objective.getName();
|
||||
+
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Fix trapdoor feature
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||
index 336fcf4af0ffb416b5595a9e65172f36cc36aaa3..b6c8c4af91f9ca2288e97b9402ec88d56385e75d 100644
|
||||
index 872e52e13293a99d45f93d90d8fa7f6aa99d1f3a..2b57a82eeb98fffc47f37d073f7934e26a1a6221 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/TrapDoorBlock.java
|
||||
@@ -153,6 +153,8 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||
@@ -157,6 +157,8 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||
flag1 = eventRedstone.getNewCurrent() > 0;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -17,7 +17,7 @@ index 336fcf4af0ffb416b5595a9e65172f36cc36aaa3..b6c8c4af91f9ca2288e97b9402ec88d5
|
||||
// Paper start - break redstone on trapdoors early
|
||||
boolean open = (Boolean) state.getValue(TrapDoorBlock.OPEN) != flag1;
|
||||
// note: this must run before any state for this block/its neighborus are written to the world
|
||||
@@ -173,6 +175,9 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||
@@ -177,6 +179,9 @@ public class TrapDoorBlock extends HorizontalDirectionalBlock implements SimpleW
|
||||
}
|
||||
if (open) {
|
||||
// Paper end - break redstone on trapdoors early
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Disable distance check for UseItemOnPacket
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index af8a2b3b37aba58cb402040e178c46f53aa3e93d..faa8309eb3eed72cdd459a22f69046d06c0060ba 100644
|
||||
index 43cfe5e00285bf88d0724d27e55d28c2f825f741..c88cb9c1c7f588b2617a71ecd6acbcf98ade5687 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -1931,7 +1931,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -1945,7 +1945,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
Vec3 vec3d1 = vec3d.subtract(Vec3.atCenterOf(blockposition));
|
||||
double d0 = 1.0000001D;
|
||||
|
||||
- if (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.disableDistanceCheckForUseItem || (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D)) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.disableDistanceCheckForUseItem || (Math.abs(vec3d1.x()) < 1.0000001D && Math.abs(vec3d1.y()) < 1.0000001D && Math.abs(vec3d1.z()) < 1.0000001D)) {
|
||||
Direction enumdirection = movingobjectpositionblock.getDirection();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
24
patches/server/0048-No-feather-falling-trample.patch
Normal file
24
patches/server/0048-No-feather-falling-trample.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 25 May 2023 16:37:06 +0800
|
||||
Subject: [PATCH] No feather falling trample
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index c3dba0c2c94f3804338f86621dc42405e380a6b3..b3de7e10a5514100712998519a7e9303b347d6a8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -113,6 +113,13 @@ public class FarmBlock extends Block {
|
||||
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (world instanceof ServerLevel worldserver) {
|
||||
if (world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || worldserver.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
|
||||
+ // Leaves start - noFeatherFallingTrample
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.noFeatherFallingTrample) {
|
||||
+ if (net.minecraft.world.item.enchantment.EnchantmentHelper.getEnchantmentLevel(world.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT).getOrThrow(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING), (LivingEntity) entity) > 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaves end - noFeatherFallingTrample
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof Player) {
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Syncmatica Protocol
|
||||
This patch is Powered by Syncmatica(https://github.com/End-Tech/syncmatica)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 1e71c352529afaa73cef3b9ea08098d9a86f6589..f893f841509017d61b496e712c12b578d4d69345 100644
|
||||
index c88cb9c1c7f588b2617a71ecd6acbcf98ade5687..58b260c37393eebc9fe838ab801287573c04cfde 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -314,6 +314,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -324,6 +324,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
Objects.requireNonNull(server);
|
||||
this.signedMessageDecoder = SignedMessageChain.Decoder.unsigned(uuid, server::enforceSecureProfile);
|
||||
this.chatMessageChain = new FutureChain(server.chatExecutor); // CraftBukkit - async chat
|
||||
@@ -17,7 +17,7 @@ index 1e71c352529afaa73cef3b9ea08098d9a86f6589..f893f841509017d61b496e712c12b578
|
||||
}
|
||||
|
||||
// CraftBukkit start - add fields and methods
|
||||
@@ -332,6 +333,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -342,6 +343,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
private boolean justTeleported = false;
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -28,7 +28,7 @@ index 1e71c352529afaa73cef3b9ea08098d9a86f6589..f893f841509017d61b496e712c12b578
|
||||
if (this.ackBlockChangesUpTo > -1) {
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977b35ae2ef
|
||||
index 0000000000000000000000000000000000000000..365b07d8d9741d07bf4505d121394dd053825c76
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/CommunicationManager.java
|
||||
@@ -0,0 +1,396 @@
|
||||
@@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (!LeavesConfig.syncmaticaProtocol) {
|
||||
+ if (!LeavesConfig.protocol.syncmatica.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+ final ExchangeTarget newPlayer = player.connection.exchangeTarget;
|
||||
@@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977
|
||||
+
|
||||
+ @ProtocolHandler.PlayerLeave
|
||||
+ public static void onPlayerLeave(ServerPlayer player) {
|
||||
+ if (!LeavesConfig.syncmaticaProtocol) {
|
||||
+ if (!LeavesConfig.protocol.syncmatica.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+ final ExchangeTarget oldPlayer = player.connection.exchangeTarget;
|
||||
@@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..c452bb80f8a51a11b9d4eca53fc6d977
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = SyncmaticaPayload.class, payloadId = "main")
|
||||
+ public static void onPacketGet(ServerPlayer player, SyncmaticaPayload payload) {
|
||||
+ if (!LeavesConfig.syncmaticaProtocol) {
|
||||
+ if (!LeavesConfig.protocol.syncmatica.enable) {
|
||||
+ return;
|
||||
+ }
|
||||
+ onPacket(player.connection.exchangeTarget, payload.packetType(), payload.data());
|
||||
@@ -1335,7 +1335,7 @@ index 0000000000000000000000000000000000000000..d7a3c85df0f5950f3f0c69c33fa5d809
|
||||
+}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0d93792de3a12a450f5da1705cff95274360a9c4
|
||||
index 0000000000000000000000000000000000000000..055da1928daddedaa72e8d805193f81e4aaafdea
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/syncmatica/SyncmaticaProtocol.java
|
||||
@@ -0,0 +1,127 @@
|
||||
@@ -1438,7 +1438,7 @@ index 0000000000000000000000000000000000000000..0d93792de3a12a450f5da1705cff9527
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isOverQuota(int sent) {
|
||||
+ return LeavesConfig.syncmaticaQuota && sent > LeavesConfig.syncmaticaQuotaLimit;
|
||||
+ return LeavesConfig.protocol.syncmatica.useQuota && sent > LeavesConfig.protocol.syncmatica.quotaLimit;
|
||||
+ }
|
||||
+
|
||||
+ public static void backupAndReplace(final Path backup, final Path current, final Path incoming) {
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Shared villager discounts
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
index c7f012674361a323c1efeca4660cd3f46d308ee1..cea09319941f39dbb958ea7ee78c52c7f34fad9e 100644
|
||||
index c7f012674361a323c1efeca4660cd3f46d308ee1..c211b62fd753adad649c084fe791918c8c620c04 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java
|
||||
@@ -115,6 +115,16 @@ public class GossipContainer {
|
||||
@@ -13,7 +13,7 @@ index c7f012674361a323c1efeca4660cd3f46d308ee1..cea09319941f39dbb958ea7ee78c52c7
|
||||
public int getReputation(UUID target, Predicate<GossipType> gossipTypeFilter) {
|
||||
GossipContainer.EntityGossips entityGossips = this.gossips.get(target);
|
||||
+ // Leaves start - sharedVillagerDiscounts
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.sharedVillagerDiscounts && gossipTypeFilter.test(GossipType.MAJOR_POSITIVE)) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.sharedVillagerDiscounts && gossipTypeFilter.test(GossipType.MAJOR_POSITIVE)) {
|
||||
+ int otherRep = 0;
|
||||
+ if (entityGossips != null) {
|
||||
+ otherRep = entityGossips.weightedValue(v -> gossipTypeFilter.test(v) && !v.equals(GossipType.MAJOR_POSITIVE));
|
||||
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Wed, 14 Jun 2023 12:07:07 +0800
|
||||
Subject: [PATCH] Redstone wire dont connect if on trapdoor
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 09b8f5335cb7651d90f4d1ca61b2ec5aa324e443..22b4abfdda9df1003dc57696d0b7524db442de88 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -204,7 +204,7 @@ public class RedStoneWireBlock extends Block {
|
||||
RandomSource random
|
||||
) {
|
||||
if (direction == Direction.DOWN) {
|
||||
- return !this.canSurviveOn(world, neighborPos, neighborState) ? Blocks.AIR.defaultBlockState() : state;
|
||||
+ return org.leavesmc.leaves.LeavesConfig.modify.oldMC.updater.redstoneDontCantOnTrapDoor ? state : !this.canSurviveOn(world, neighborPos, neighborState) ? Blocks.AIR.defaultBlockState() : state; // Leaves - behavior to 1.19
|
||||
} else if (direction == Direction.UP) {
|
||||
return this.getConnectionState(world, state, pos);
|
||||
} else {
|
||||
@@ -263,7 +263,7 @@ public class RedStoneWireBlock extends Block {
|
||||
BlockPos blockPos = pos.relative(direction);
|
||||
BlockState blockState = world.getBlockState(blockPos);
|
||||
if (bl) {
|
||||
- boolean bl2 = blockState.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(world, blockPos, blockState);
|
||||
+ boolean bl2 = (!org.leavesmc.leaves.LeavesConfig.modify.oldMC.updater.redstoneDontCantOnTrapDoor && blockState.getBlock() instanceof TrapDoorBlock) || this.canSurviveOn(world, blockPos, blockState); // Leaves - behavior to 1.19
|
||||
if (bl2 && shouldConnectTo(world.getBlockState(blockPos.above()))) {
|
||||
if (blockState.isFaceSturdy(world, blockPos, direction.getOpposite())) {
|
||||
return RedstoneSide.UP;
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Disable check out-of-order command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
index 300929a406905f5ff1ede664d5b99fb0938d4d2e..82d7c376a0a71075f7a013518e284bfe3789f329 100644
|
||||
index 300929a406905f5ff1ede664d5b99fb0938d4d2e..48ffdcc799999f1d5f76e0bf124efc44c1aec3f8 100644
|
||||
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
|
||||
@@ -45,7 +45,7 @@ public class SignedMessageChain {
|
||||
@@ -13,7 +13,7 @@ index 300929a406905f5ff1ede664d5b99fb0938d4d2e..82d7c376a0a71075f7a013518e284bfe
|
||||
if (signedMessageLink == null) {
|
||||
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.CHAIN_BROKEN);
|
||||
- } else if (body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) {
|
||||
+ } else if (!org.leavesmc.leaves.LeavesConfig.disableCheckOutOfOrderCommand && body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) { // Leaves - disable check to support Velocity
|
||||
+ } else if (!org.leavesmc.leaves.LeavesConfig.modify.disableCheckOutOfOrderCommand && body.timeStamp().isBefore(SignedMessageChain.this.lastTimeStamp)) { // Leaves - disable check to support Velocity
|
||||
this.setChainBroken();
|
||||
throw new SignedMessageChain.DecodeException(SignedMessageChain.DecodeException.OUT_OF_ORDER_CHAT, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes
|
||||
} else {
|
||||
@@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 25 May 2023 16:37:06 +0800
|
||||
Subject: [PATCH] No feather falling trample
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
index d59e33e7326489c6d55d316d0130f22235f4c63c..e48b1b7dbfb5d6914420bce0565108c34342922b 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java
|
||||
@@ -112,6 +112,13 @@ public class FarmBlock extends Block {
|
||||
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) {
|
||||
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage.
|
||||
if (!world.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) {
|
||||
+ // Leaves start - noFeatherFallingTrample
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.noFeatherFallingTrample) {
|
||||
+ if (net.minecraft.world.item.enchantment.EnchantmentHelper.getEnchantmentLevel(world.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT).getHolder(net.minecraft.world.item.enchantment.Enchantments.FEATHER_FALLING).get(), (LivingEntity) entity) > 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaves end - noFeatherFallingTrample
|
||||
// CraftBukkit start - Interact soil
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
if (entity instanceof Player) {
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Despawn enderman with block
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
index 17a71bb3b65cc1030b70c931b1dc998d06713231..2a26fb795ca8d71f02d7d991dd28c34118266f02 100644
|
||||
index 2b8e1a8e233071821411eb1f95c705efb4a6e816..e7a004ab26bd73a264bc7c911f99107c57661367 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
|
||||
@@ -471,7 +471,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
@@ -458,7 +458,7 @@ public class EnderMan extends Monster implements NeutralMob {
|
||||
|
||||
@Override
|
||||
public boolean requiresCustomPersistence() {
|
||||
- return super.requiresCustomPersistence() || this.getCarriedBlock() != null;
|
||||
+ return super.requiresCustomPersistence() || (!org.leavesmc.leaves.LeavesConfig.despawnEndermanWithBlock && this.getCarriedBlock() != null); // Leaves - despawn enderman with block
|
||||
+ return super.requiresCustomPersistence() || (!org.leavesmc.leaves.LeavesConfig.modify.despawnEndermanWithBlock && this.getCarriedBlock() != null); // Leaves - despawn enderman with block
|
||||
}
|
||||
|
||||
private static class EndermanFreezeWhenLookedAt extends Goal {
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Leaves carpet support
|
||||
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java b/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3b6801435790fd892ece3ba7d89499eec29626ff
|
||||
index 0000000000000000000000000000000000000000..b68179532ceace257968b8fd7776608ab0bb798d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/protocol/CarpetServerProtocol.java
|
||||
@@ -0,0 +1,120 @@
|
||||
@@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..3b6801435790fd892ece3ba7d89499ee
|
||||
+
|
||||
+ @ProtocolHandler.PlayerJoin
|
||||
+ public static void onPlayerJoin(ServerPlayer player) {
|
||||
+ if (LeavesConfig.leavesCarpetSupport) {
|
||||
+ if (LeavesConfig.protocol.leavesCarpetSupport) {
|
||||
+ CompoundTag data = new CompoundTag();
|
||||
+ data.putString(HI, VERSION);
|
||||
+ ProtocolUtils.sendPayloadPacket(player, new CarpetPayload(data));
|
||||
@@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..3b6801435790fd892ece3ba7d89499ee
|
||||
+
|
||||
+ @ProtocolHandler.PayloadReceiver(payload = CarpetPayload.class, payloadId = "hello")
|
||||
+ private static void handleHello(@NotNull ServerPlayer player, @NotNull CarpetServerProtocol.CarpetPayload payload) {
|
||||
+ if (LeavesConfig.leavesCarpetSupport) {
|
||||
+ if (LeavesConfig.protocol.leavesCarpetSupport) {
|
||||
+ if (payload.nbt.contains(HELLO)) {
|
||||
+ LeavesLogger.LOGGER.info("Player " + player.getScoreboardName() + " joined with carpet " + payload.nbt.getString(HELLO));
|
||||
+ CompoundTag data = new CompoundTag();
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Creative fly no clip
|
||||
|
||||
|
||||
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 65b002f2ae062327f48df0e157aa35721478c5fd..a570e9ef4b2b767af3ebb2b33230eb7877553a85 100644
|
||||
index c7bc8f493305cca9bac60c79e4e35cf5e369d355..e4bb0b2eb8512f75042dab77bb79b4f51742ab4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -252,8 +252,8 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -19,7 +19,7 @@ index 65b002f2ae062327f48df0e157aa35721478c5fd..a570e9ef4b2b767af3ebb2b33230eb78
|
||||
this.setOnGround(false);
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -476,7 +476,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
Pose entitypose1;
|
||||
|
||||
@@ -28,7 +28,7 @@ index 65b002f2ae062327f48df0e157aa35721478c5fd..a570e9ef4b2b767af3ebb2b33230eb78
|
||||
if (this.canPlayerFitWithinBlocksAndEntitiesWhen(Pose.CROUCHING)) {
|
||||
entitypose1 = Pose.CROUCHING;
|
||||
} else {
|
||||
@@ -588,7 +588,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -612,7 +612,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
this.bob += (f - this.bob) * 0.4F;
|
||||
@@ -37,13 +37,13 @@ index 65b002f2ae062327f48df0e157aa35721478c5fd..a570e9ef4b2b767af3ebb2b33230eb78
|
||||
AABB axisalignedbb;
|
||||
|
||||
if (this.isPassenger() && !this.getVehicle().isRemoved()) {
|
||||
@@ -2119,6 +2119,21 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2058,6 +2058,21 @@ public abstract class Player extends LivingEntity {
|
||||
@Override
|
||||
public abstract boolean isSpectator();
|
||||
|
||||
+ // Leaves start - creative no clip
|
||||
+ public boolean isCreativeFlyOrSpectator() {
|
||||
+ return isSpectator() || (org.leavesmc.leaves.LeavesConfig.creativeNoClip && isCreative() && getAbilities().flying);
|
||||
+ return isSpectator() || (org.leavesmc.leaves.LeavesConfig.modify.creativeNoClip && isCreative() && getAbilities().flying);
|
||||
+ }
|
||||
+
|
||||
+ public boolean canSpectatingPlace(Level world, BlockState state, BlockPos pos, net.minecraft.world.phys.shapes.CollisionContext context) {
|
||||
@@ -60,20 +60,20 @@ index 65b002f2ae062327f48df0e157aa35721478c5fd..a570e9ef4b2b767af3ebb2b33230eb78
|
||||
public boolean canBeHitByProjectile() {
|
||||
return !this.isSpectator() && super.canBeHitByProjectile();
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
index 2759a9eeef85b323b7e1ea78090f4f9d637c938a..4b044d76e803027bfc2df7dab9878eca01e62f5a 100644
|
||||
index 77309808abd4ab476e815d60015ad828102a1f6b..b101113c67bee1fb1732c49a32a813736f4c7c18 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
|
||||
@@ -223,7 +223,7 @@ public class BlockItem extends Item {
|
||||
@@ -217,7 +217,7 @@ public class BlockItem extends Item {
|
||||
CollisionContext voxelshapecollision = entityhuman == null ? CollisionContext.empty() : CollisionContext.of(entityhuman);
|
||||
// CraftBukkit start - store default return
|
||||
Level world = context.getLevel(); // Paper - Cancel hit for vanished players
|
||||
- boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true); // Paper - Cancel hit for vanished players
|
||||
+ boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && (org.leavesmc.leaves.LeavesConfig.creativeNoClip && context.getPlayer() != null ? context.getPlayer().canSpectatingPlace(world, state, context.getClickedPos(), voxelshapecollision) : world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true)); // Paper - Cancel hit for vanished players // Leaves - creative no clip
|
||||
+ boolean defaultReturn = (!this.mustSurvive() || state.canSurvive(context.getLevel(), context.getClickedPos())) && (org.leavesmc.leaves.LeavesConfig.modify.creativeNoClip && context.getPlayer() != null ? context.getPlayer().canSpectatingPlace(world, state, context.getClickedPos(), voxelshapecollision) : world.checkEntityCollision(state, entityhuman, voxelshapecollision, context.getClickedPos(), true)); // Paper - Cancel hit for vanished players // Leaves - creative no clip
|
||||
org.bukkit.entity.Player player = (context.getPlayer() instanceof ServerPlayer) ? (org.bukkit.entity.Player) context.getPlayer().getBukkitEntity() : null;
|
||||
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getLevel(), context.getClickedPos()), player, CraftBlockData.fromData(state), defaultReturn, org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(context.getHand())); // Paper - Expose hand in BlockCanBuildEvent
|
||||
diff --git a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
index 0b761f3ae15ad4a3b8152f497a60403212109534..fdb2bb8a5e6c5d69692804adb086a2d476d558cd 100644
|
||||
index 4390adf843b395db688017eb9034b56a40971473..5527ebdffb09d2d75275c73481f2f2af702222f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/StandingAndWallBlockItem.java
|
||||
@@ -56,7 +56,7 @@ public class StandingAndWallBlockItem extends BlockItem {
|
||||
@@ -86,7 +86,7 @@ index 0b761f3ae15ad4a3b8152f497a60403212109534..fdb2bb8a5e6c5d69692804adb086a2d4
|
||||
|
||||
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(world, blockposition), player, CraftBlockData.fromData(iblockdata1), defaultReturn, org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(context.getHand())); // Paper - Expose hand in BlockCanBuildEvent
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
index 5b62860cd64b5e6dc02dadb4651824ac04b00024..6c23de5ebcfaf378b1ab97689e50add07d37ff03 100644
|
||||
index 3784e4c14bb59073f941b966f616ddac3f80a497..afd84141d1d6dcdba307cfd9663657c09c0728bd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||
@@ -163,7 +163,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
|
||||
@@ -99,10 +99,10 @@ index 5b62860cd64b5e6dc02dadb4651824ac04b00024..6c23de5ebcfaf378b1ab97689e50add0
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
index b35f476e26a020cf75e53a5eb488717d996a6935..73651a8ae9341807ec96300914d49329fb8a4e90 100644
|
||||
index e1c9a961064887070b29207efd7af47884f8dc29..13f0a27f493754e707e8008ebed5ca14c68e31fc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
|
||||
@@ -147,7 +147,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -148,7 +148,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
h = (double)direction.getStepZ();
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ index b35f476e26a020cf75e53a5eb488717d996a6935..73651a8ae9341807ec96300914d49329
|
||||
// Paper - EAR items stuck in in slime pushed by a piston
|
||||
entity.activatedTick = Math.max(entity.activatedTick, net.minecraft.server.MinecraftServer.currentTick + 10);
|
||||
entity.activatedImmunityTick = Math.max(entity.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 10);
|
||||
@@ -183,6 +183,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
@@ -184,6 +184,7 @@ public class PistonMovingBlockEntity extends BlockEntity {
|
||||
}
|
||||
|
||||
private static void moveEntityByPiston(Direction direction, Entity entity, double distance, Direction movementDirection) {
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Wed, 14 Jun 2023 12:07:07 +0800
|
||||
Subject: [PATCH] Redstone wire dont connect if on trapdoor
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index c131734cad123a35456d18f8a161f77a4ac9ac99..067aaa8cea1534f8b87159ad161917e81a258dac 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -173,7 +173,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@Override
|
||||
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||
if (direction == Direction.DOWN) {
|
||||
- return !this.canSurviveOn(world, neighborPos, neighborState) ? Blocks.AIR.defaultBlockState() : state;
|
||||
+ return org.leavesmc.leaves.LeavesConfig.redstoneDontCantOnTrapDoor ? state : !this.canSurviveOn(world, neighborPos, neighborState) ? Blocks.AIR.defaultBlockState() : state; // Leaves - behavior to 1.19
|
||||
} else if (direction == Direction.UP) {
|
||||
return this.getConnectionState(world, state, pos);
|
||||
} else {
|
||||
@@ -232,7 +232,7 @@ public class RedStoneWireBlock extends Block {
|
||||
BlockState iblockdata = world.getBlockState(blockposition1);
|
||||
|
||||
if (flag) {
|
||||
- boolean flag1 = iblockdata.getBlock() instanceof TrapDoorBlock || this.canSurviveOn(world, blockposition1, iblockdata);
|
||||
+ boolean flag1 = (!org.leavesmc.leaves.LeavesConfig.redstoneDontCantOnTrapDoor && iblockdata.getBlock() instanceof TrapDoorBlock) || this.canSurviveOn(world, blockposition1, iblockdata); // Leaves - behavior to 1.19
|
||||
|
||||
if (flag1 && RedStoneWireBlock.shouldConnectTo(world.getBlockState(blockposition1.above()))) {
|
||||
if (iblockdata.isFaceSturdy(world, blockposition1, direction.getOpposite())) {
|
||||
@@ -18,10 +18,10 @@ index ee99519ebd46b1db3e76e7eb86e5cc121c867dc4..63f6f1328c4e39cc1f35480166ae5e22
|
||||
for (int j = 0; j < this.height; j++) {
|
||||
for (int k = 0; k < this.depth; k++) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
index 84300f2f7b7be4f5281edd8e263646dbcbb3ba07..6f867139ef83ca6d1fc26f98c4d9e4b7ce689580 100644
|
||||
index b331c93c82c27f9456fec208a0c008c5bedfa8c4..e944a730503a9c50bcde819515a1d7e7f1ec59fd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
|
||||
@@ -291,8 +291,67 @@ public class EndDragonFight {
|
||||
@@ -292,8 +292,67 @@ public class EndDragonFight {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ index 84300f2f7b7be4f5281edd8e263646dbcbb3ba07..6f867139ef83ca6d1fc26f98c4d9e4b7
|
||||
+
|
||||
@Nullable
|
||||
public BlockPattern.BlockPatternMatch findExitPortal() {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.optimizedDragonRespawn) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.performance.optimizedDragonRespawn) {
|
||||
+ int i, j;
|
||||
+ for (i = cachePortalChunkIteratorX; i <= 8; ++i) {
|
||||
+ for (j = cachePortalChunkIteratorZ; j <= 8; ++j) {
|
||||
@@ -89,7 +89,7 @@ index 84300f2f7b7be4f5281edd8e263646dbcbb3ba07..6f867139ef83ca6d1fc26f98c4d9e4b7
|
||||
ChunkPos chunkcoordintpair = new ChunkPos(this.origin);
|
||||
|
||||
int i;
|
||||
@@ -621,6 +680,11 @@ public class EndDragonFight {
|
||||
@@ -624,6 +683,11 @@ public class EndDragonFight {
|
||||
}
|
||||
|
||||
public boolean respawnDragon(List<EndCrystal> list) { // CraftBukkit - return boolean
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Shave snow layers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..97c3a9281ef10c88947febf152a005b0cd05cc64 100644
|
||||
index 55c18f182166f4905d623d6f5e909eefd5ed2483..80de1b720abc98d8abdda4d6ef356e7cc3dda631 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ShovelItem.java
|
||||
@@ -44,6 +44,26 @@ public class ShovelItem extends DiggerItem {
|
||||
@@ -13,10 +13,10 @@ index 24f6a158e4759aac3be8da4cf5e0d40bd295355b..97c3a9281ef10c88947febf152a005b0
|
||||
} else {
|
||||
Player player = context.getPlayer();
|
||||
+ // Leaves start - shaveSnowLayers
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.shaveSnowLayers && blockState.is(Blocks.SNOW)) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.shaveSnowLayers && blockState.is(Blocks.SNOW)) {
|
||||
+ int layers = blockState.getValue(net.minecraft.world.level.block.SnowLayerBlock.LAYERS);
|
||||
+ ItemStack tool = context.getItemInHand();
|
||||
+ boolean hasSilkTouch = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(level.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT).getHolder(net.minecraft.world.item.enchantment.Enchantments.SILK_TOUCH).get(), tool) > 0;
|
||||
+ boolean hasSilkTouch = net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(level.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT).getOrThrow(net.minecraft.world.item.enchantment.Enchantments.SILK_TOUCH), tool) > 0;
|
||||
+ BlockState shavedBlockState = layers > 1 ? blockState.setValue(net.minecraft.world.level.block.SnowLayerBlock.LAYERS, layers - 1) : Blocks.AIR.defaultBlockState();
|
||||
+
|
||||
+ level.setBlock(blockPos, shavedBlockState, Block.UPDATE_ALL_IMMEDIATE);
|
||||
@@ -5,20 +5,20 @@ Subject: [PATCH] Elytra aeronautics no chunk load
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index e0650881a3f90532fc446607cf5ae34da4a2a1dc..07d75d8d518456387393ecf371bc1947e1ea4bb5 100644
|
||||
index 9a226396b4c38768574d5785744f22e61d6913f3..9a5488df906a0a3dd07f94942750fe9b646a96d9 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -749,7 +749,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -791,7 +791,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
private boolean skipPlayer(ServerPlayer player) {
|
||||
- return player.isSpectator() && !this.level.getGameRules().getBoolean(GameRules.RULE_SPECTATORSGENERATECHUNKS);
|
||||
+ return (player.isSpectator() && !this.level.getGameRules().getBoolean(GameRules.RULE_SPECTATORSGENERATECHUNKS))
|
||||
+ || (org.leavesmc.leaves.LeavesConfig.elytraAeronauticsNoChunk && player.elytraAeronauticsNoChunk); // Leaves - Elytra aeronautics
|
||||
+ || (org.leavesmc.leaves.LeavesConfig.modify.elytraAeronautics.noChunk && player.elytraAeronauticsNoChunk); // Leaves - Elytra aeronautics
|
||||
}
|
||||
|
||||
void updatePlayerStatus(ServerPlayer player, boolean added) {
|
||||
@@ -787,6 +788,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -829,6 +830,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void move(ServerPlayer player) {
|
||||
@@ -27,10 +27,10 @@ index e0650881a3f90532fc446607cf5ae34da4a2a1dc..07d75d8d518456387393ecf371bc1947
|
||||
|
||||
SectionPos sectionposition = player.getLastSectionPos();
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 88e15a2a90485e461df242a1071ecb5b567c46aa..1e4364e4dbc35064fe06a92b7c2c3baae07b0326 100644
|
||||
index c5427e40ff55f90aca61866837311d30a74f0f08..4c3a4d6021fe3d02a5c8283eb86293a64b762da5 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -559,7 +559,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -564,7 +564,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
|
||||
|
||||
// Paper start - Prevent moving into unloaded chunks
|
||||
@@ -40,25 +40,25 @@ index 88e15a2a90485e461df242a1071ecb5b567c46aa..1e4364e4dbc35064fe06a92b7c2c3baa
|
||||
!worldserver.areChunksLoadedForMove(entity.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(entity.position())))
|
||||
)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6d97b1be9192d237e5ed2cef94ec9bd72881e156..c7e3772a031c997d43120c3ec95b30093b3ea7eb 100644
|
||||
index b7d5a1f56067c6fec74d653b0da48e9610def283..13956aa8210d0234176a9d7450afdf42a2311f11 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1138,7 +1138,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1186,7 +1186,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return;
|
||||
}
|
||||
}
|
||||
-
|
||||
+ // Leaves start - elytra aeronautics
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.elytraAeronauticsNoChunk && this instanceof Player player) {
|
||||
+ if (movementType == MoverType.PLAYER && player.isFallFlying()) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.elytraAeronautics.noChunk && this instanceof Player player) {
|
||||
+ if (type == MoverType.PLAYER && player.isFallFlying()) {
|
||||
+ org.leavesmc.leaves.util.ElytraAeronauticsHelper.flightBehaviour(player, movement);
|
||||
+ }
|
||||
+ }
|
||||
+ // Leaves end - elytra aeronautics
|
||||
this.level().getProfiler().push("move");
|
||||
if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7D) {
|
||||
movement = movement.multiply(this.stuckSpeedMultiplier);
|
||||
@@ -2098,6 +2104,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
ProfilerFiller gameprofilerfiller = Profiler.get();
|
||||
|
||||
gameprofilerfiller.push("move");
|
||||
@@ -2184,6 +2190,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.yo = y;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, y, d4);
|
||||
@@ -67,7 +67,7 @@ index 6d97b1be9192d237e5ed2cef94ec9bd72881e156..c7e3772a031c997d43120c3ec95b3009
|
||||
}
|
||||
|
||||
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 a570e9ef4b2b767af3ebb2b33230eb7877553a85..b737848442843b4d7decc140f51f77ed6f7c5f4b 100644
|
||||
index e4bb0b2eb8512f75042dab77bb79b4f51742ab4e..b36d67774cf34cf95bcfbaa2fc8cb4f56b1e7557 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -197,6 +197,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -80,7 +80,7 @@ index a570e9ef4b2b767af3ebb2b33230eb7877553a85..b737848442843b4d7decc140f51f77ed
|
||||
public boolean fauxSleeping;
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/util/ElytraAeronauticsHelper.java b/src/main/java/org/leavesmc/leaves/util/ElytraAeronauticsHelper.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0a9cde390476a728dd43f017e3eac3c923709b72
|
||||
index 0000000000000000000000000000000000000000..96282f07cbb4609741e66b53ec639de0cc33f6b6
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/util/ElytraAeronauticsHelper.java
|
||||
@@ -0,0 +1,40 @@
|
||||
@@ -98,14 +98,14 @@ index 0000000000000000000000000000000000000000..0a9cde390476a728dd43f017e3eac3c9
|
||||
+public class ElytraAeronauticsHelper {
|
||||
+
|
||||
+ public static void flightBehaviour(Player player, Vec3 velocity) {
|
||||
+ if (LeavesConfig.elytraAeronauticsNoChunk) {
|
||||
+ if ((LeavesConfig.elytraAeronauticsNoChunkSpeed <= 0.0D || velocity.horizontalDistanceSqr() >= LeavesConfig.elytraAeronauticsNoChunkSpeed)
|
||||
+ && (LeavesConfig.elytraAeronauticsNoChunkHeight <= 0.0D || player.getY() >= LeavesConfig.elytraAeronauticsNoChunkHeight)) {
|
||||
+ if (LeavesConfig.modify.elytraAeronautics.noChunk) {
|
||||
+ if ((LeavesConfig.modify.elytraAeronautics.noChunkSpeed <= 0.0D || velocity.horizontalDistanceSqr() >= LeavesConfig.modify.elytraAeronautics.noChunkSpeed)
|
||||
+ && (LeavesConfig.modify.elytraAeronautics.noChunkHeight <= 0.0D || player.getY() >= LeavesConfig.modify.elytraAeronautics.noChunkHeight)) {
|
||||
+ if (!player.elytraAeronauticsNoChunk) {
|
||||
+ player.elytraAeronauticsNoChunk = true;
|
||||
+ ServerPlayer serverPlayer = (ServerPlayer) player;
|
||||
+ if (LeavesConfig.elytraAeronauticsNoChunkMes) {
|
||||
+ serverPlayer.sendSystemMessage(Component.literal(LeavesConfig.elytraAeronauticsNoChunkStartMes), true);
|
||||
+ if (LeavesConfig.modify.elytraAeronautics.noChunkMes) {
|
||||
+ serverPlayer.sendSystemMessage(Component.literal(LeavesConfig.modify.elytraAeronautics.noChunkStartMes), true);
|
||||
+ }
|
||||
+ ChunkSystem.removePlayerFromDistanceMaps((ServerLevel) serverPlayer.level(), serverPlayer);
|
||||
+ ((ServerLevel) serverPlayer.level()).chunkSource.chunkMap.getDistanceManager().removePlayer(serverPlayer.getLastSectionPos(), serverPlayer);
|
||||
@@ -114,8 +114,8 @@ index 0000000000000000000000000000000000000000..0a9cde390476a728dd43f017e3eac3c9
|
||||
+ if (player.elytraAeronauticsNoChunk) {
|
||||
+ player.elytraAeronauticsNoChunk = false;
|
||||
+ ServerPlayer serverPlayer = (ServerPlayer) player;
|
||||
+ if (LeavesConfig.elytraAeronauticsNoChunkMes) {
|
||||
+ serverPlayer.sendSystemMessage(Component.literal(LeavesConfig.elytraAeronauticsNoChunkEndMes), true);
|
||||
+ if (LeavesConfig.modify.elytraAeronautics.noChunkMes) {
|
||||
+ serverPlayer.sendSystemMessage(Component.literal(LeavesConfig.modify.elytraAeronautics.noChunkEndMes), true);
|
||||
+ }
|
||||
+ ChunkSystem.addPlayerToDistanceMaps((ServerLevel) serverPlayer.level(), serverPlayer);
|
||||
+ ((ServerLevel) serverPlayer.level()).chunkSource.chunkMap.getDistanceManager().addPlayer(SectionPos.of(serverPlayer), serverPlayer);
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Cache ignite odds
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
index 0a77a470d78f68e8397f29f298e7f52fbd7ba9a2..3f82dd92c41519bd21b481f2303f03a12bb8f973 100644
|
||||
index 0e5a47ab235d99e6cb1468905f791c2c59ac0082..f2b5ae54fbe5a98bf464d85a7dafcef6d6cacd42 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
@@ -220,6 +220,7 @@ public class FireBlock extends BaseFireBlock {
|
||||
@@ -21,7 +21,7 @@ index 0a77a470d78f68e8397f29f298e7f52fbd7ba9a2..3f82dd92c41519bd21b481f2303f03a1
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(pos, l, j1, i1);
|
||||
- int l1 = this.getIgniteOdds(world, blockposition_mutableblockposition);
|
||||
+ int l1 = this.getIgniteOdds(world, blockposition_mutableblockposition, org.leavesmc.leaves.LeavesConfig.cacheIgniteOdds ? blockPositionIgniteCache : null); // Leaves - cache ignite odds
|
||||
+ int l1 = this.getIgniteOdds(world, blockposition_mutableblockposition, org.leavesmc.leaves.LeavesConfig.performance.cacheIgniteOdds ? blockPositionIgniteCache : null); // Leaves - cache ignite odds
|
||||
|
||||
if (l1 > 0) {
|
||||
int i2 = (l1 + 40 + world.getDifficulty().getId() * 7) / (i + 30);
|
||||
28
patches/server/0060-Lava-riptide.patch
Normal file
28
patches/server/0060-Lava-riptide.patch
Normal file
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Fri, 7 Jul 2023 16:53:32 +0800
|
||||
Subject: [PATCH] Lava riptide
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
index 8b9a93ef71164cce8a616735b71d96d37e83b1a8..98b10cca7e583da08f43e312d387e37a95fa7686 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
@@ -75,7 +75,7 @@ public class TridentItem extends Item implements ProjectileItem {
|
||||
} else {
|
||||
float f = EnchantmentHelper.getTridentSpinAttackStrength(stack, entityhuman);
|
||||
|
||||
- if (f > 0.0F && !entityhuman.isInWaterOrRain()) {
|
||||
+ if (f > 0.0F && !entityhuman.isInWaterOrRain() || (org.leavesmc.leaves.LeavesConfig.modify.lavaRiptide && entityhuman.isInLava())) { // Leaves - lava riptide
|
||||
return false;
|
||||
} else if (stack.nextDamageWillBreak()) {
|
||||
return false;
|
||||
@@ -158,7 +158,7 @@ public class TridentItem extends Item implements ProjectileItem {
|
||||
|
||||
if (itemstack.nextDamageWillBreak()) {
|
||||
return InteractionResult.FAIL;
|
||||
- } else if (EnchantmentHelper.getTridentSpinAttackStrength(itemstack, user) > 0.0F && !user.isInWaterOrRain()) {
|
||||
+ } else if (EnchantmentHelper.getTridentSpinAttackStrength(itemstack, user) > 0.0F && !user.isInWaterOrRain() && !(org.leavesmc.leaves.LeavesConfig.modify.lavaRiptide && user.isInLava())) { // Leaves - lava riptide
|
||||
return InteractionResult.FAIL;
|
||||
} else {
|
||||
user.startUsingItem(hand);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] No block update command
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index e8fa04e83aa80d8284aa58bf3899f5c81e4a2ef6..f494ea2671f219ce02c53ad725cc41646558a4c4 100644
|
||||
index 1b2ba3ff09b27ea74afc96735e48a474cf6ebddd..e52c490540319db13a2b23f839f7fd88aeadda64 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -2300,6 +2300,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
@@ -2453,6 +2453,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
||||
|
||||
@Override
|
||||
public void blockUpdated(BlockPos pos, Block block) {
|
||||
@@ -17,10 +17,10 @@ index e8fa04e83aa80d8284aa58bf3899f5c81e4a2ef6..f494ea2671f219ce02c53ad725cc4164
|
||||
// CraftBukkit start
|
||||
if (this.populating) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 2a2b9631a16c16f41261b7e042acd14d600df230..952be4dde6518e1459b1a4262b6c5aa13b17ace5 100644
|
||||
index f38487562422ebaf59a679f493f956b90cc18ff1..b6b3189f15c9e56f104a788716bb134b352cc83c 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@@ -527,7 +527,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
@@ -533,7 +533,7 @@ public final class ItemStack implements DataComponentHolder {
|
||||
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
|
||||
|
||||
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
|
||||
@@ -30,10 +30,10 @@ index 2a2b9631a16c16f41261b7e042acd14d600df230..952be4dde6518e1459b1a4262b6c5aa1
|
||||
|
||||
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 382ca565fe1a680ab49b14ac90e4ec3bd903450d..ce5964c1a53b362bcc5fb735684b78c96609cb86 100644
|
||||
index 2fea5a46bba27578366c36f594472c3e38395bee..80c71d08ea7588ba95416296531c5629097d9257 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -403,7 +403,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
@@ -427,7 +427,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
} else {
|
||||
// CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled.
|
||||
if (!this.level.isClientSide && doPlace && (!this.level.captureBlockStates || block instanceof net.minecraft.world.level.block.BaseEntityBlock)) {
|
||||
@@ -43,22 +43,22 @@ index 382ca565fe1a680ab49b14ac90e4ec3bd903450d..ce5964c1a53b362bcc5fb735684b78c9
|
||||
|
||||
if (iblockdata.hasBlockEntity()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 1687ab4965433459219bb5d8aaf5ec8e5baeb605..36d49bd355b9c061b1663bcac7c9f590173f34df 100644
|
||||
index f4fbcbb8ff6d2677af1a02a0801a323c06dce9b1..dd9e7b030b64b10d61481e744fe3e53ff80087f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -506,6 +506,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
@@ -516,6 +516,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
|
||||
@Override
|
||||
public void tick(Level world, BlockPos pos, FluidState state) {
|
||||
public void tick(ServerLevel world, BlockPos pos, BlockState blockState, FluidState fluidState) {
|
||||
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
||||
if (!state.isSource()) {
|
||||
if (!fluidState.isSource()) {
|
||||
FluidState fluid1 = this.getNewLiquid(world, pos, world.getBlockState(pos));
|
||||
int i = this.getSpreadDelay(world, pos, state, fluid1);
|
||||
int i = this.getSpreadDelay(world, pos, fluidState, fluid1);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..ef9f2552367dfa8b708f18d66a4526fea8c24807 100644
|
||||
index 3a95e3236eafd14baed035e53503b58c2e21b68a..717d9042a9a67aea771b0b544776a9956eb52eab 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
|
||||
@@ -48,6 +48,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
||||
@@ -49,6 +49,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
|
||||
}
|
||||
|
||||
private void addAndRun(BlockPos pos, CollectingNeighborUpdater.NeighborUpdates entry) {
|
||||
@@ -67,33 +67,33 @@ index 106af2b2c7ff72c7549975aef75cdcff8d9a7d97..ef9f2552367dfa8b708f18d66a4526fe
|
||||
boolean bl2 = this.maxChainedNeighborUpdates >= 0 && this.count >= this.maxChainedNeighborUpdates;
|
||||
this.count++;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/redstone/InstantNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/InstantNeighborUpdater.java
|
||||
index 2708251ebc1995e71fb0e5dca9e158a3005f8a8a..2c39d07e5612b3d435fb782d7861448c470950b4 100644
|
||||
index e1c3dbd74a009ca8adc6269fd22f9547ee03f347..efb9cc019e804aa4f88d77cbee6d05cb9f65de29 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/redstone/InstantNeighborUpdater.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/redstone/InstantNeighborUpdater.java
|
||||
@@ -15,17 +15,20 @@ public class InstantNeighborUpdater implements NeighborUpdater {
|
||||
@@ -16,17 +16,20 @@ public class InstantNeighborUpdater implements NeighborUpdater {
|
||||
|
||||
@Override
|
||||
public void shapeUpdate(Direction direction, BlockState neighborState, BlockPos pos, BlockPos neighborPos, int flags, int maxUpdateDepth) {
|
||||
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
||||
NeighborUpdater.executeShapeUpdate(this.level, direction, neighborState, pos, neighborPos, flags, maxUpdateDepth - 1);
|
||||
NeighborUpdater.executeShapeUpdate(this.level, direction, pos, neighborPos, neighborState, flags, maxUpdateDepth - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos sourcePos) {
|
||||
public void neighborChanged(BlockPos pos, Block sourceBlock, @Nullable Orientation orientation) {
|
||||
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
||||
BlockState blockState = this.level.getBlockState(pos);
|
||||
this.neighborChanged(blockState, pos, sourceBlock, sourcePos, false);
|
||||
this.neighborChanged(blockState, pos, sourceBlock, orientation, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
||||
public void neighborChanged(BlockState state, BlockPos pos, Block sourceBlock, @Nullable Orientation orientation, boolean notify) {
|
||||
+ if (org.leavesmc.leaves.command.NoBlockUpdateCommand.isNoBlockUpdate()) return; // Leaves - no block update
|
||||
NeighborUpdater.executeUpdate(this.level, state, pos, sourceBlock, sourcePos, notify);
|
||||
NeighborUpdater.executeUpdate(this.level, state, pos, sourceBlock, orientation, notify);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/command/NoBlockUpdateCommand.java b/src/main/java/org/leavesmc/leaves/command/NoBlockUpdateCommand.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f60f3409aeb72f8f0195e667ccb139a7f81729b6
|
||||
index 0000000000000000000000000000000000000000..8f25ce0145341d363bb42183a9e64622159663ff
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/command/NoBlockUpdateCommand.java
|
||||
@@ -0,0 +1,52 @@
|
||||
@@ -146,6 +146,6 @@ index 0000000000000000000000000000000000000000..f60f3409aeb72f8f0195e667ccb139a7
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isNoBlockUpdate() {
|
||||
+ return LeavesConfig.noBlockUpdateCommand && noBlockUpdate;
|
||||
+ return LeavesConfig.modify.noBlockUpdateCommand && noBlockUpdate;
|
||||
+ }
|
||||
+}
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Raider die skip self raid check
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
index bbf21ea433f9e3963aac0ede597ed8d3c8e50ed8..6e68f8fa8280a106b1a262d86aa130e89d4f5cce 100644
|
||||
index ab132041982df2a701e4baea8195873f31b4a5fb..9b911254b24bc77930c518a9c61916983ba72e3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
|
||||
@@ -121,7 +121,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
@@ -124,7 +124,7 @@ public abstract class Raider extends PatrollingMonster {
|
||||
Raid raid = this.getCurrentRaid();
|
||||
|
||||
if (raid != null) {
|
||||
- if (this.isPatrolLeader()) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.skipSelfRaidCheck && this.isPatrolLeader()) { // Leaves - skip self raid check
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.modify.skipSelfRaidCheck && this.isPatrolLeader()) { // Leaves - skip self raid check
|
||||
raid.removeLeader(this.getWave());
|
||||
}
|
||||
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Container open passthrough
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/SignBlock.java b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
index 73874cd18a5b335e895ea0b2fefbd521209afe08..0f560a03676571e1ebf3811a7caa4faba0e7ef95 100644
|
||||
index b212fe323f048dab40c0ccbb9327c9fc73b9e03a..ccfa890b1c83fe9492cb4f5863911008536b46f0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/SignBlock.java
|
||||
@@ -110,6 +110,18 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
||||
@@ -111,6 +111,18 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
||||
} else {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
+ // Leaves start - signContainerPassthrough
|
||||
+ } else if (org.leavesmc.leaves.LeavesConfig.containerPassthrough) {
|
||||
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.containerPassthrough) {
|
||||
+ BlockPos pos1 = pos.relative(hit.getDirection().getOpposite());
|
||||
+ if (this instanceof WallSignBlock || this instanceof WallHangingSignBlock) {
|
||||
+ pos1 = pos.relative(state.getValue(HorizontalDirectionalBlock.FACING).getOpposite());
|
||||
@@ -22,17 +22,17 @@ index 73874cd18a5b335e895ea0b2fefbd521209afe08..0f560a03676571e1ebf3811a7caa4fab
|
||||
+ BlockState state1 = world.getBlockState(pos1);
|
||||
+ return state1.useItemOn(stack, world, player, hand, hit.withPosition(pos1));
|
||||
+ }
|
||||
+ return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
+ return InteractionResult.PASS;
|
||||
+ // Leaves end - signContainerPassthrough
|
||||
} else {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
return InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||
}
|
||||
@@ -138,6 +150,25 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
||||
return InteractionResult.SUCCESS;
|
||||
@@ -139,6 +151,25 @@ public abstract class SignBlock extends BaseEntityBlock implements SimpleWaterlo
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
} else if (flag1) {
|
||||
return InteractionResult.SUCCESS;
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
+ // Leaves start - signContainerPassthrough
|
||||
+ } else if (org.leavesmc.leaves.LeavesConfig.containerPassthrough) {
|
||||
+ } else if (org.leavesmc.leaves.LeavesConfig.modify.containerPassthrough) {
|
||||
+ if (player.isShiftKeyDown()) {
|
||||
+ if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag1)) {
|
||||
+ this.openTextEdit(player, tileentitysign, flag1);
|
||||
@@ -52,4 +52,4 @@ index 73874cd18a5b335e895ea0b2fefbd521209afe08..0f560a03676571e1ebf3811a7caa4fab
|
||||
+ // Leaves end - signContainerPassthrough
|
||||
} else if (!this.otherPlayerIsEditingSign(player, tileentitysign) && player.mayBuild() && this.hasEditableText(player, tileentitysign, flag)) {
|
||||
this.openTextEdit(player, tileentitysign, flag, io.papermc.paper.event.player.PlayerOpenSignEvent.Cause.INTERACT); // Paper - Add PlayerOpenSignEvent
|
||||
return InteractionResult.SUCCESS;
|
||||
return InteractionResult.SUCCESS_SERVER;
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] SIMD support
|
||||
|
||||
|
||||
diff --git a/build.gradle.kts b/build.gradle.kts
|
||||
index d3bc2ed92763b701d91a8c705818e7f4e12e45f0..51bf5df7bca5b32e171e452d62f6843a7a10fee1 100644
|
||||
index b8132401ddaedf13bc9ddc74524166d0e0dcf419..0add94373b7b38f271893b1c44a448051b845e8b 100644
|
||||
--- a/build.gradle.kts
|
||||
+++ b/build.gradle.kts
|
||||
@@ -78,6 +78,7 @@ tasks.withType<JavaCompile> {
|
||||
@@ -92,6 +92,7 @@ tasks.withType<JavaCompile> {
|
||||
compilerArgs.add("-Xlint:-module")
|
||||
compilerArgs.add("-Xlint:-removal")
|
||||
compilerArgs.add("-Xlint:-dep-ann")
|
||||
@@ -16,7 +16,7 @@ index d3bc2ed92763b701d91a8c705818e7f4e12e45f0..51bf5df7bca5b32e171e452d62f6843a
|
||||
}
|
||||
// Leaves end - hide irrelevant compilation warnings
|
||||
|
||||
@@ -191,6 +192,8 @@ fun TaskContainer.registerRunTask(
|
||||
@@ -210,6 +211,8 @@ fun TaskContainer.registerRunTask(
|
||||
minHeapSize = "${memoryGb}G"
|
||||
maxHeapSize = "${memoryGb}G"
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Dont respond ping before start fully
|
||||
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
index 532f09089b8d6798999cf3f83e852df7479e450e..85f8acea5923494d3a079387ddceae38419d9847 100644
|
||||
index 532f09089b8d6798999cf3f83e852df7479e450e..e4751b27607f33b25623e2c593840323c4f0242c 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerStatusPacketListenerImpl.java
|
||||
@@ -154,6 +154,12 @@ public class ServerStatusPacketListenerImpl implements ServerStatusPacketListene
|
||||
@@ -15,7 +15,7 @@ index 532f09089b8d6798999cf3f83e852df7479e450e..85f8acea5923494d3a079387ddceae38
|
||||
*/
|
||||
+ // Leaves start - dont respond it before start full
|
||||
+ var status = MinecraftServer.getServer().getStatus();
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.dontRespondPingBeforeStart && (status == null || status.version() == null || status.version().isEmpty())) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.mics.dontRespondPingBeforeStart && (status == null || status.version() == null || status.version().isEmpty())) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaves end - dont respond it before start full
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Fri, 7 Jul 2023 16:53:32 +0800
|
||||
Subject: [PATCH] Lava riptide
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
index f1b2d388a1a40a1d909a2e726f32d6c15e1eb0eb..da3887eec5b1e2b8151d71ddb759d083993d54bb 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/TridentItem.java
|
||||
@@ -72,7 +72,7 @@ public class TridentItem extends Item implements ProjectileItem {
|
||||
if (j >= 10) {
|
||||
float f = EnchantmentHelper.getTridentSpinAttackStrength(stack, entityhuman);
|
||||
|
||||
- if (f <= 0.0F || entityhuman.isInWaterOrRain()) {
|
||||
+ if (f <= 0.0F || entityhuman.isInWaterOrRain() || (org.leavesmc.leaves.LeavesConfig.lavaRiptide && entityhuman.isInLava())) { // Leaves - lava riptide
|
||||
if (!TridentItem.isTooDamagedToUse(stack)) {
|
||||
Holder<SoundEvent> holder = (Holder) EnchantmentHelper.pickHighestLevel(stack, EnchantmentEffectComponents.TRIDENT_SOUND).orElse(SoundEvents.TRIDENT_THROW);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class TridentItem extends Item implements ProjectileItem {
|
||||
|
||||
if (TridentItem.isTooDamagedToUse(itemstack)) {
|
||||
return InteractionResultHolder.fail(itemstack);
|
||||
- } else if (EnchantmentHelper.getTridentSpinAttackStrength(itemstack, user) > 0.0F && !user.isInWaterOrRain()) {
|
||||
+ } else if (EnchantmentHelper.getTridentSpinAttackStrength(itemstack, user) > 0.0F && !user.isInWaterOrRain() && !(org.leavesmc.leaves.LeavesConfig.lavaRiptide && user.isInLava())) { // Leaves - lava riptide
|
||||
return InteractionResultHolder.fail(itemstack);
|
||||
} else {
|
||||
user.startUsingItem(hand);
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Faster chunk serialization
|
||||
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
index 19661e106612b8e4e152085fb398db7bd06acc23..b0eebd6f35bcf5dac99b9efe13ae6b2c03fce4a1 100644
|
||||
index e4e153cb8899e70273aa150b8ea26907cf68b15c..cf5adffc17da35067c75e6432eae038762bd36f1 100644
|
||||
--- a/src/main/java/net/minecraft/util/BitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/BitStorage.java
|
||||
@@ -1,5 +1,7 @@
|
||||
@@ -27,7 +27,7 @@ index 19661e106612b8e4e152085fb398db7bd06acc23..b0eebd6f35bcf5dac99b9efe13ae6b2c
|
||||
// provide default impl in case mods implement this...
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
index 8acf2f2491a8d9d13392c5e89b2bd5c9918285e1..eccef53172ed8cd7d7903c7e128908e2cb87fd08 100644
|
||||
index d99ec470b4653beab630999a5b2c1a6428b20c38..404d1cc8467505cf1ca81c3d845b880033e03dbf 100644
|
||||
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.util;
|
||||
@@ -38,7 +38,7 @@ index 8acf2f2491a8d9d13392c5e89b2bd5c9918285e1..eccef53172ed8cd7d7903c7e128908e2
|
||||
|
||||
public class SimpleBitStorage implements BitStorage {
|
||||
private static final int[] MAGIC = new int[]{
|
||||
@@ -401,4 +402,44 @@ public class SimpleBitStorage implements BitStorage {
|
||||
@@ -472,4 +473,44 @@ public class SimpleBitStorage implements BitStorage {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ index 8acf2f2491a8d9d13392c5e89b2bd5c9918285e1..eccef53172ed8cd7d7903c7e128908e2
|
||||
+ // Leaves end - faster chunk serialization
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
index 15c5164d0ef41a978c16ee317fa73e97f2480207..93d1416cf2eaeb10e24c69a28a1d9e576ca7dbdc 100644
|
||||
index 1f9c436a632e4f110be61cf76fcfc3b7eb80334e..87393a181c64af6a02ebddfccae674c4fbcb3903 100644
|
||||
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
|
||||
@@ -3,6 +3,7 @@ package net.minecraft.util;
|
||||
@@ -103,7 +103,7 @@ index 15c5164d0ef41a978c16ee317fa73e97f2480207..93d1416cf2eaeb10e24c69a28a1d9e57
|
||||
+
|
||||
// Paper start - block counting
|
||||
@Override
|
||||
public final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.ints.IntArrayList> moonrise$countEntries() {
|
||||
public final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<it.unimi.dsi.fastutil.shorts.ShortArrayList> moonrise$countEntries() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java b/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
index acae3eb30e0689048937f479dc3070f0688abdad..029b62acf1d9f8479ab64a55c12f00ba467249e3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PaletteResize.java
|
||||
@@ -116,7 +116,7 @@ index acae3eb30e0689048937f479dc3070f0688abdad..029b62acf1d9f8479ab64a55c12f00ba
|
||||
int onResize(int newBits, T object);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 13d3c877b006a4975e7370713e3919c661e7890f..fd8dc6395f6a307971f781c40768845b6e10e22e 100644
|
||||
index 8b84bf2272556ac3321cbf16361d7f48a1cc6873..404cb8e85c1983346c9e4de5b5d5a0c040915eff 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -23,8 +23,25 @@ import net.minecraft.util.Mth;
|
||||
@@ -145,7 +145,7 @@ index 13d3c877b006a4975e7370713e3919c661e7890f..fd8dc6395f6a307971f781c40768845b
|
||||
private static final int MIN_PALETTE_BITS = 0;
|
||||
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> 0;
|
||||
public final IdMap<T> registry;
|
||||
@@ -304,28 +321,78 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
@@ -348,28 +365,78 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // Paper - synchronize
|
||||
this.acquire();
|
||||
|
||||
@@ -164,7 +164,7 @@ index 13d3c877b006a4975e7370713e3919c661e7890f..fd8dc6395f6a307971f781c40768845b
|
||||
- } else {
|
||||
- optional = Optional.empty();
|
||||
+ // Leaves start - faster chunk serialization
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.fasterChunkSerialization) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.performance.fasterChunkSerialization) {
|
||||
+ PalettedContainerRO.PackedData var12;
|
||||
+ try {
|
||||
+ HashMapPalette<T> hashMapPalette = new HashMapPalette<>(idList, this.data.storage.getBits(), this.dummyPaletteResize);
|
||||
@@ -243,14 +243,14 @@ index 13d3c877b006a4975e7370713e3919c661e7890f..fd8dc6395f6a307971f781c40768845b
|
||||
}
|
||||
|
||||
private static <T> void swapPalette(int[] is, IntUnaryOperator applier) {
|
||||
@@ -364,13 +431,47 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
@@ -409,13 +476,47 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
|
||||
|
||||
@Override
|
||||
public void count(PalettedContainer.CountConsumer<T> counter) {
|
||||
- if (this.data.palette.getSize() == 1) {
|
||||
- counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
+ // Leaves start - faster chunk serialization
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.fasterChunkSerialization) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.performance.fasterChunkSerialization) {
|
||||
+ if (this.data.palette.getSize() == 1) {
|
||||
+ counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
|
||||
+ } else {
|
||||
@@ -298,7 +298,7 @@ index 13d3c877b006a4975e7370713e3919c661e7890f..fd8dc6395f6a307971f781c40768845b
|
||||
static record Configuration<T>(Palette.Factory factory, int bits) {
|
||||
diff --git a/src/main/java/org/leavesmc/leaves/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/org/leavesmc/leaves/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..3a110e892dafa965274597018265fc5b9d9a9640
|
||||
index 0000000000000000000000000000000000000000..da32fdd8bbb9a966bd17c7457d94bb676f28c60d
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/leavesmc/leaves/lithium/common/world/chunk/LithiumHashPalette.java
|
||||
@@ -0,0 +1,197 @@
|
||||
@@ -474,8 +474,8 @@ index 0000000000000000000000000000000000000000..3a110e892dafa965274597018265fc5b
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public Palette<T> copy() {
|
||||
+ return new LithiumHashPalette<>(this.idList, this.resizeHandler, this.indexBits, this.entries.clone(), new Reference2IntOpenHashMap<>(this.table), this.size);
|
||||
+ public Palette<T> copy(@NotNull PaletteResize<T> resizeListener) {
|
||||
+ return new LithiumHashPalette<>(this.idList, resizeHandler, this.indexBits, this.entries.clone(), new Reference2IntOpenHashMap<>(this.table), this.size);
|
||||
+ }
|
||||
+
|
||||
+ private void clear() {
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Cache world generator sea level
|
||||
This patch is Powered by Gale(https://github.com/GaleMC/Gale)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
index 68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8..4adac668fb3d02ed43a89da446a71503d0380c73 100644
|
||||
index 3f39d6c786d9dfdd9ad591e08ff05fcbb41a1df6..be411653a89e4c3585db95509e3a93d140a05fba 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
|
||||
@@ -61,12 +61,17 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
|
||||
@@ -34,7 +34,7 @@ index 68be0d51aa64b5d917fb53dbbbdf8966d4f4abd8..4adac668fb3d02ed43a89da446a71503
|
||||
public int getSeaLevel() {
|
||||
- return ((NoiseGeneratorSettings) this.settings.value()).seaLevel();
|
||||
+ // Leaves start - cache world generator sea level
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.cacheWorldGeneratorSeaLevel) {
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.performance.cacheWorldGeneratorSeaLevel) {
|
||||
+ return ((NoiseGeneratorSettings) this.settings.value()).seaLevel();
|
||||
+ } else {
|
||||
+ return cachedSeaLevel;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user