52 Commits

Author SHA1 Message Date
30341c1148 Fix build issues 2023-12-10 13:18:16 -06:00
3271c24791 Update Paper 2023-12-03 22:21:20 -06:00
6dbfcd0704 Update Paper 2023-11-29 19:38:59 -06:00
0179964845 Update Paper 2023-11-25 23:26:48 -06:00
b817ef863d Update Paper 2023-11-22 20:26:22 -06:00
f678e6140b Update Paper 2023-11-20 16:15:27 -06:00
f12f438481 Update Paper 2023-11-12 19:30:17 -06:00
4c5d35e901 Java 21 support 2023-11-05 14:12:13 -06:00
437e40a2f8 Update Paper 2023-11-04 21:46:48 -05:00
9e874fb21f Update 0001-AdvancedSlimePaper-Server-Changes.patch 2023-10-29 23:40:57 -05:00
0ef1c4d8a8 Update Paper 2023-10-29 23:23:41 -05:00
291a7fa852 Update Paper 2023-10-23 20:25:24 -05:00
1283dcdd4c Update Paper 2023-10-22 21:24:14 -05:00
6b3e59b039 oops 2023-10-20 22:47:01 -05:00
acfd3e1814 Revise compiling instructions 2023-10-20 22:45:56 -05:00
e393f9b057 Add compiling instructions for Windows and update Metrics class 2023-10-20 22:36:42 -05:00
7ceedf9453 Update 0001-AdvancedSlimePaper-Server-Changes.patch 2023-10-19 19:16:53 -05:00
574452466d update urls 2023-10-19 02:54:47 -05:00
a394fb44d8 Update 0002-Build-changes.patch 2023-10-19 02:26:39 -05:00
763df5c337 Update AdvancedSlimePaper 2023-10-19 02:15:30 -05:00
f70596845b oops 2023-10-19 02:05:14 -05:00
58a5036119 changes 2023-10-19 02:03:56 -05:00
e0f91f7178 Fix ASWM server patch 2023-10-19 00:03:42 -05:00
c9e9ae9573 Begin work on slime 1.20.2 2023-10-18 17:49:54 -05:00
3ce7bbf9ca Merge branch '1.20.1' of https://github.com/AtlasMediaGroup/Scissors into slime/1.20.1 2023-09-23 14:26:13 -05:00
3acfa3fa80 Rebuild patches 2023-09-23 12:46:35 -05:00
f8898d0e1c Update AdvancedSlimePaper 2023-09-23 12:40:43 -05:00
d5b68d8f5c Merge branch '1.20.1' of https://github.com/AtlasMediaGroup/Scissors into slime/1.20.1 2023-09-23 12:38:22 -05:00
fb3550ad44 Update Paper 2023-09-12 18:28:31 -05:00
612fc104c3 Update Paper 2023-09-07 11:38:25 -05:00
a40d598ab1 Update ASP 2023-08-30 19:19:11 -05:00
182525b22b Rebuild patches 2023-08-30 18:59:11 -05:00
a5af796395 Merge branch '1.20.1' of https://github.com/AtlasMediaGroup/Scissors into slime/1.20.1 2023-08-30 18:55:35 -05:00
30b69bc059 Merge branch 'slime/1.20.1' of https://github.com/AtlasMediaGroup/Scissors into slime/1.20.1 2023-08-26 18:39:16 -05:00
9fc9c36cb3 Update Paper 2023-08-26 18:34:07 -05:00
b2bc2c2152 Update Jenkinsfile 2023-08-26 18:34:07 -05:00
c39661c11a Update Jenkinsfile 2023-08-26 18:34:07 -05:00
dc0a3610ec try this 2023-08-26 18:34:07 -05:00
185c5ee1a6 Update Jenkinsfile 2023-08-26 18:34:07 -05:00
76822727f6 Jenkins fix (#139)
* Update Jenkinsfile

* Update Jenkinsfile
2023-08-26 18:34:07 -05:00
Luna
511733b8d5 Fix Github actions (#138) 2023-08-26 18:34:07 -05:00
Luna
40a91ca05e Slime (#136)
* Slime

* Add proper credits. Thanks ASP!

* Cleanup
2023-08-26 18:34:07 -05:00
ff6a9c5ff6 Update Paper 2023-08-26 18:29:50 -05:00
Taahh
8226a3b03a Update slime branch (#142)
* Update Paper

* Add length limit to note block sound (#141)

Reported by @NekosAreKawaii

---------

Co-authored-by: Telesphoreo <me@telesphoreo.me>
Co-authored-by: allinkdev <44676012+allinkdev@users.noreply.github.com>
2023-08-26 14:38:40 +01:00
d6432c162f Update Paper 2023-08-24 16:35:32 -05:00
79705ff262 Update Jenkinsfile 2023-08-23 16:44:58 -05:00
d013cfde88 Update Jenkinsfile 2023-08-23 16:43:37 -05:00
1bbbb18b2e try this 2023-08-23 16:37:40 -05:00
8bc2c95edb Update Jenkinsfile 2023-08-23 16:35:23 -05:00
cbd52d38d9 Jenkins fix (#139)
* Update Jenkinsfile

* Update Jenkinsfile
2023-08-22 23:07:02 -05:00
Luna
8f2be500b5 Fix Github actions (#138) 2023-08-22 20:11:53 -05:00
Luna
3f889f5040 Slime (#136)
* Slime

* Add proper credits. Thanks ASP!

* Cleanup
2023-08-22 19:15:48 -05:00
80 changed files with 3844 additions and 723 deletions

View File

@@ -13,6 +13,8 @@ jobs:
steps: steps:
- name: Checkout Git Repository - name: Checkout Git Repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
submodules: 'true'
- name: Validate Gradle wrapper - name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Setup Gradle - name: Setup Gradle

3
.gitignore vendored
View File

@@ -51,4 +51,7 @@ Scissors-API
!gradle/wrapper/gradle-wrapper.jar !gradle/wrapper/gradle-wrapper.jar
aswm-api/src
aswm-core/src
paper-api-generator paper-api-generator

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "submodules/AdvancedSlimePaper"]
path = submodules/AdvancedSlimePaper
url = https://github.com/InfernalSuite/AdvancedSlimePaper.git
branch = main

6
Jenkinsfile vendored
View File

@@ -1,9 +1,15 @@
pipeline { pipeline {
options { skipDefaultCheckout() }
agent any agent any
environment { environment {
GITHUB_BRANCH = "${BRANCH_NAME}" GITHUB_BRANCH = "${BRANCH_NAME}"
} }
stages { stages {
stage('checkout') {
steps {
checkout scmGit(branches: [[name: '*/slime/1.20.2']], extensions: [submodule(parentCredentials: true, recursiveSubmodules: true, reference: 'https://github.com/InfernalSuite/AdvancedSlimePaper')], userRemoteConfigs: [[url: 'https://github.com/AtlasMediaGroup/Scissors']])
}
}
stage('applyPatches') { stage('applyPatches') {
steps { steps {
withGradle { withGradle {

View File

@@ -1,11 +1,21 @@
# Scissors [![Build Status](https://ci.scissors.gg/job/Scissors/job/1.20.4/badge/icon)](https://ci.scissors.gg/job/Scissors/job/1.20.4/) # Scissors [![Build Status](https://ci.plex.us.org/job/Scissors/job/slime%252F1.20.2/badge/icon)](https://ci.plex.us.org/job/Scissors/job/slime%252F1.20.2/)
Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that Scissors is a fork of Paper that aims to fix exploits possible in Creative Mode. Many of these exploits are ones that
Paper's own team has either refused to fix or would have. Paper's own team has either refused to fix or would have.
All SWM patches/SWM API belongs to [AdvancedSlimePaper and InfernalSuite](https://github.com/InfernalSuite/AdvancedSlimePaper)
Note: This will not compile on Windows by default. To make it compile, you need to delete the `aswm-core/src`
and `aswm-api/src` files. Then open up Command Prompt as an administrator and run the following for the api project:
```mklink /D C:\full\path\to\project\aswm-api\src C:\full\path\to\project\submodules\AdvancedSlimePaper\api\src```. Now,
run the same thing again for the core
project: ```mklink /D C:\full\path\to\project\aswm-core\src C:\full\path\to\project\submodules\AdvancedSlimePaper\core\src```
Make sure you replace the placeholder `C:\full\path\to\project` with the actual full path to the root project on your
local machine. You do not need to do this if you are compiling on macOS or Linux.
## Links ## Links
### [Scissors Download](https://ci.plex.us.org/job/Scissors) ### [Scissors Download](https://ci.plex.us.org/job/Scissors)
### [Scissors Javadoc](https://javadoc.scissors.gg/1.20.4) ### [Scissors Javadoc](https://javadoc.scissors.gg/1.20.2)
### [Scissors Announcements](https://totalfreedom.tf/forums/scissors-announcements.55) ### [Scissors Announcements](https://totalfreedom.tf/forums/scissors-announcements.55)
### [Scissors General Discussion](https://totalfreedom.tf/forums/scissors-discussion.56/) ### [Scissors General Discussion](https://totalfreedom.tf/forums/scissors-discussion.56/)

17
aswm-api/build.gradle.kts Normal file
View File

@@ -0,0 +1,17 @@
plugins {
`java-library`
`maven-publish`
signing
}
dependencies {
api("com.flowpowered:flow-nbt:2.0.2")
api("org.jetbrains:annotations:23.0.0")
compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT")
}
java {
withSourcesJar()
withJavadocJar()
}

1
aswm-api/src Symbolic link
View File

@@ -0,0 +1 @@
../submodules/AdvancedSlimePaper/api/src

View File

@@ -0,0 +1,7 @@
plugins {
}
dependencies {
compileOnly(project(":aswm-api"))
implementation("com.github.luben:zstd-jni:1.5.2-2")
}

1
aswm-core/src Symbolic link
View File

@@ -0,0 +1 @@
../submodules/AdvancedSlimePaper/core/src

View File

@@ -8,5 +8,9 @@
# To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId: # To import classes from the vanilla Minecraft jar use `minecraft` as the artifactId:
# minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter # minecraft net.minecraft.world.level.entity.LevelEntityGetterAdapter
# minecraft net/minecraft/world/level/entity/LevelEntityGetter.java # minecraft net/minecraft/world/level/entity/LevelEntityGetter.java
minecraft net.minecraft.network.chat.FormattedText
minecraft net.minecraft.network.chat.contents.TranslatableContents.java ## Used in Scissors 1.19
#minecraft net/minecraft/world/ContainerHelper
#minecraft net/minecraft/network/chat/contents/NbtContents
#minecraft net/minecraft/network/chat/ComponentUtils
#minecraft net/minecraft/network/chat/contents/EntityDataSource

View File

@@ -2,7 +2,7 @@ plugins {
java java
`maven-publish` `maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.13" id("io.papermc.paperweight.patcher") version "1.5.10"
} }
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
@@ -49,6 +49,7 @@ subprojects {
repositories { repositories {
mavenCentral() mavenCentral()
maven(paperMavenPublicUrl) maven(paperMavenPublicUrl)
maven("https://repo.rapture.pw/repository/maven-releases/")
} }
} }

View File

@@ -1,8 +1,8 @@
group=me.totalfreedom.scissors group=me.totalfreedom.scissors
version=1.20.4-R0.1-SNAPSHOT version=1.20.2-R0.1-SNAPSHOT
mcVersion=1.20.4 mcVersion=1.20.2
paperRef=4445d23544e0801fb6f658de98815ce0d8c04f58 paperRef=931781c220b98dde0159c9a3c8dce06c3b2b1e13
org.gradle.caching=true org.gradle.caching=true
org.gradle.parallel=true org.gradle.parallel=true

Binary file not shown.

View File

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

17
gradlew vendored
View File

@@ -83,8 +83,7 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045 # shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -202,11 +201,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command;
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# and any embedded shellness will be escaped. # shell script including quotes and variable substitutions, so put them in
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # double quotes to make sure that they get re-expanded; and
# treated as '${Hostname}' itself on the command line. # * put everything else in single quotes, so that it's not re-expanded.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

View File

@@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Mon, 26 Dec 2022 12:08:15 -0500
Subject: [PATCH] AdvancedSlimePaper API Changes
AdvancedSlimePaper
Copyright (C) 2023 InfernalSuite
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/build.gradle.kts b/build.gradle.kts
index e827ee211e3c65dc68ac5867fd8476639df63645..4bf0c234eacc8398333fe7704acadfecff21c505 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -28,6 +28,7 @@ configurations.api {
dependencies {
// api dependencies are listed transitively to API consumers
+ api(project(":aswm-api")) // ASWM
api("com.google.guava:guava:32.1.2-jre")
api("com.google.code.gson:gson:2.10.1")
api("net.md-5:bungeecord-chat:$bungeeCordChatVersion-deprecated+build.14") // Paper

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add Scissors configuration file
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 4ff1b38eb65f97344257204cf018f176f247ed36..be766fc9c24bedcc58dac2cb1991345bf5ed17e0 100644 index d0c634629aa0b6bac0da93655dd86ad3aea0ce30..5729362a327f6cc67e86d4ebf5328fc60ed710f7 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2235,6 +2235,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2190,6 +2190,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
} }
// Paper end // Paper end

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,30 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Luna <lunahatesgogle@gmail.com>
Date: Sun, 10 Dec 2023 12:34:45 -0600 Date: Sat, 12 Mar 2022 22:22:22 -0300
Subject: [PATCH] Build changes Subject: [PATCH] Build changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..855784d7f9c2993c5d91f67c9b8cc46fe6e4147e 100644 index 79beac737c17412913983614bd478d33e3c6ed58..27d5dd68175641152cb78e6aba69890c00ef9b51 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { @@ -13,8 +13,13 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating val alsoShade: Configuration by configurations.creating
dependencies { dependencies {
- implementation(project(":paper-api")) - implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi")) - implementation(project(":paper-mojangapi"))
+ implementation(project(":aswm-core"))
+ // Scissors start + // Scissors start
+ implementation(project(":Scissors-API")) + implementation(project(":Scissors-API"))
+ implementation("io.papermc.paper:paper-mojangapi:1.20.4-R0.1-SNAPSHOT") { + implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") {
+ exclude("io.papermc.paper", "paper-api") + exclude("io.papermc.paper", "paper-api")
+ } + }
+ // Scissors end + // Scissors end
// Paper start // Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0") implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -67,11 +71,19 @@ tasks.jar { @@ -66,11 +71,19 @@ tasks.jar {
val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim()
val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\""
val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper
@@ -45,7 +46,7 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..855784d7f9c2993c5d91f67c9b8cc46f
"Implementation-Vendor" to date, // Paper "Implementation-Vendor" to date, // Paper
"Specification-Title" to "Bukkit", "Specification-Title" to "Bukkit",
"Specification-Version" to project.version, "Specification-Version" to project.version,
@@ -150,7 +162,7 @@ fun TaskContainer.registerRunTask( @@ -154,7 +167,7 @@ fun TaskContainer.registerRunTask(
name: String, name: String,
block: JavaExec.() -> Unit block: JavaExec.() -> Unit
): TaskProvider<JavaExec> = register<JavaExec>(name) { ): TaskProvider<JavaExec> = register<JavaExec>(name) {
@@ -55,7 +56,7 @@ index bcfe59b6efb628ee1e7f9d60667360d4d885fb6a..855784d7f9c2993c5d91f67c9b8cc46f
standardInput = System.`in` standardInput = System.`in`
workingDir = rootProject.layout.projectDirectory workingDir = rootProject.layout.projectDirectory
diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java diff --git a/src/main/java/com/destroystokyo/paper/Metrics.java b/src/main/java/com/destroystokyo/paper/Metrics.java
index 4b002e8b75d117b726b0de274a76d3596fce015b..a46d3f40642bbf249c2d24e689f474d07175ca09 100644 index 4b002e8b75d117b726b0de274a76d3596fce015b..87fd35ad9c7364124286fa5e9ef1d4b7efa73990 100644
--- a/src/main/java/com/destroystokyo/paper/Metrics.java --- a/src/main/java/com/destroystokyo/paper/Metrics.java
+++ b/src/main/java/com/destroystokyo/paper/Metrics.java +++ b/src/main/java/com/destroystokyo/paper/Metrics.java
@@ -593,7 +593,7 @@ public class Metrics { @@ -593,7 +593,7 @@ public class Metrics {
@@ -72,7 +73,7 @@ index 4b002e8b75d117b726b0de274a76d3596fce015b..a46d3f40642bbf249c2d24e689f474d0
if (implVersion != null) { if (implVersion != null) {
final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1); final String buildOrHash = implVersion.substring(implVersion.lastIndexOf('-') + 1);
- paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); - paperVersion = "git-Paper-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash);
+ paperVersion = "git-Scissors-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Scissors + paperVersion = "git-ScissorsASWM-%s-%s".formatted(Bukkit.getServer().getMinecraftVersion(), buildOrHash); // Scissors
} else { } else {
paperVersion = "unknown"; paperVersion = "unknown";
} }
@@ -95,28 +96,28 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..21ded7c14c56a40feaa7741131be5166
.completer(new ConsoleCommandCompleter(this.server)) .completer(new ConsoleCommandCompleter(this.server))
.option(LineReader.Option.COMPLETE_IN_WORD, true); .option(LineReader.Option.COMPLETE_IN_WORD, true);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index c8772c773f9933ed1d1debfe707af4373c458152..05b0d82114aadbb713b7e5dad94ee0fe6221856a 100644 index 3d5d79e428a7b0f1aa7d0d3911e6d61b9537e8a0..97231b3a80c248efca4a7ef644272801644386d5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1865,7 +1865,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1712,7 +1712,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
- return "Paper"; // Paper - return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
+ return "Scissors"; // Scissors + return "Scissors"; // Scissors - Scissors > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
} }
public SystemReport fillSystemReport(SystemReport details) { public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index c490a29bcf7410bc54959ee71375605964379ed5..f192db9868129bd1ee45e2b29c0c7479af33ebe1 100644 index 9c08303de2891de92e06de8a939a618b7a6f7321..43e331f2946faaf3e7e66e4a81a6b34604647c3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -266,7 +266,7 @@ import javax.annotation.Nullable; // Paper @@ -269,7 +269,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server { public final class CraftServer implements Server {
- private final String serverName = "Paper"; // Paper - private final String serverName = "Paper"; // Paper
+ private final String serverName = "Scissors"; // Scissors > // Paper + private final String serverName = "Scissors"; // Scissors // Paper
private final String serverVersion; private final String serverVersion;
private final String bukkitVersion = Versioning.getBukkitVersion(); private final String bukkitVersion = Versioning.getBukkitVersion();
private final Logger logger = Logger.getLogger("Minecraft"); private final Logger logger = Logger.getLogger("Minecraft");

View File

@@ -1,34 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 10 Dec 2023 13:11:22 -0600
Subject: [PATCH] UUID validation
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index 9067bab8ec695417d479393f07d9bc6432427d73..433e586bed53a8c17adec74b3088899c748d4be3 100644
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
@@ -20,6 +20,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.TagParser;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.ExtraCodecs;
+import net.minecraft.util.GsonHelper;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.Item;
@@ -148,7 +149,14 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
+ // Scissors start
+ UUID uUID;
+ try {
+ uUID = UUID.fromString(compoundTag.getString("id"));
+ } catch (Exception ex) {
+ return null;
+ }
+ // Scissors end
return DataResult.success(new HoverEvent.EntityTooltipInfo(entityType, uUID, component));
} catch (Exception var5) {
return DataResult.error(() -> "Failed to parse tooltip: " + var5.getMessage());

View File

@@ -0,0 +1,59 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sat, 12 Mar 2022 19:34:59 -0700
Subject: [PATCH] UUID validation
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b994b9108 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -74,7 +74,11 @@ public final class NbtUtils {
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
// Paper start - support string UUID's
if (nbt.contains("Id", Tag.TAG_STRING)) {
- uUID = UUID.fromString(nbt.getString("Id"));
+ // Scissors start - Validate String UUIDs in game profiles
+ try {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ } catch (Exception ignored) {}
+ // Scissors end
}
// Paper end
String string = nbt.getString("Name");
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
@@ -174,7 +174,14 @@ public class HoverEvent {
} else {
JsonObject jsonObject = json.getAsJsonObject();
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
+ // Scissors start
+ UUID uUID;
+ try {
+ uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
+ } catch (Exception ex) {
+ return null;
+ }
+ // Scissors end
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
}
@@ -186,7 +193,14 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
+ // Scissors start
+ UUID uUID;
+ try {
+ uUID = UUID.fromString(compoundTag.getString("id"));
+ } catch (Exception ex) {
+ return null;
+ }
+ // Scissors end
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
} catch (Exception var5) {
return null;

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com> From: Video <videogamesm12@gmail.com>
Date: Wed, 24 Jan 2024 16:28:16 -0600 Date: Sun, 13 Mar 2022 07:39:26 -0600
Subject: [PATCH] ResourceLocation validation Subject: [PATCH] ResourceLocation validation
@@ -31,10 +31,10 @@ index 2ee4ee14ab3345486dad6b24fd9a4fcc6c746b99..c5ac6cda91a81d3075f5c763e30dc009
@Override @Override
diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
index 094ab43e5a209ea848bf0994db9018281c64e08d..c6faba7da6809e24d734b7d6b0b787d20163b051 100644 index 1f55185814125c691288294d18bf1580461c8066..259d65f8e21f9cf99585d416eafdc967dddccf57 100644
--- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java --- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
+++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java
@@ -410,7 +410,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { @@ -409,7 +409,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
try { try {
this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle")), (HolderLookup) BuiltInRegistries.PARTICLE_TYPE.asLookup())); this.setParticle(ParticleArgument.readParticle(new StringReader(nbt.getString("Particle")), (HolderLookup) BuiltInRegistries.PARTICLE_TYPE.asLookup()));
} catch (CommandSyntaxException commandsyntaxexception) { } catch (CommandSyntaxException commandsyntaxexception) {
@@ -44,11 +44,11 @@ index 094ab43e5a209ea848bf0994db9018281c64e08d..c6faba7da6809e24d734b7d6b0b787d2
} }
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..cfb2ce684da0ae97a844554b5ad3d41290058f32 100644 index 73871f456a85bda1e51f54986d0e61fb629822e8..df16049a70061c7c38d72b188d054339f5434e03 100644
--- a/src/main/java/net/minecraft/world/entity/EntityType.java --- a/src/main/java/net/minecraft/world/entity/EntityType.java
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java
@@ -595,7 +595,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT @@ -589,7 +589,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
if (generation) entity.generation = true; // Paper - Don't fire sync event during generation }), (entity) -> {
entity.load(nbt); entity.load(nbt);
}, () -> { }, () -> {
- EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); - EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id"));
@@ -56,6 +56,72 @@ index 09e8445a3f8c6b3ebc852a75a9a25b41a51ba659..cfb2ce684da0ae97a844554b5ad3d412
}); });
} }
@@ -608,7 +608,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
}
public static Optional<EntityType<?>> by(CompoundTag nbt) {
- return BuiltInRegistries.ENTITY_TYPE.getOptional(new ResourceLocation(nbt.getString("id")));
+ return BuiltInRegistries.ENTITY_TYPE.getOptional(ResourceLocation.tryParse(nbt.getString("id"))); // Scissors
}
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index d28c477171c1b6888a45175075017d960464b5cd..cc46185c05a735d4443b266423215f1f7a0c7741 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -619,7 +619,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
this.setLeftHanded(nbt.getBoolean("LeftHanded"));
if (nbt.contains("DeathLootTable", 8)) {
- this.lootTable = new ResourceLocation(nbt.getString("DeathLootTable"));
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("DeathLootTable")); // Scissors
this.lootTableSeed = nbt.getLong("DeathLootTableSeed");
}
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 a18aadbf7ae83713e1f2b21553185d8000bc7699..f5ad7ddf13cbb6452c2927aef9b54eae3335b4c6 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
@@ -289,7 +289,12 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
while (iterator.hasNext()) {
String s = (String) iterator.next();
- this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
+ // Scissors start
+ final ResourceLocation rl = ResourceLocation.tryParse(s);
+ if (rl != null) {
+ this.recipesUsed.put(rl, nbttagcompound1.getInt(s));
+ }
+ // Scissors end
}
// Paper start - cook speed API
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
index 0425151e688966442340ea1cf892aff34ffe0791..244b04e0020b1bd1e7be34a1b6266a8ac75d29fc 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrushableBlockEntity.java
@@ -199,7 +199,7 @@ public class BrushableBlockEntity extends BlockEntity {
private boolean tryLoadLootTable(CompoundTag nbt) {
if (nbt.contains("LootTable", 8)) {
- this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors
this.lootTableSeed = nbt.getLong("LootTableSeed");
return true;
} else {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index 081691f9710ff1115e4308f79ed49fbc38941193..c29dfd15e147d5c4d9c9584ff7803c2a52009f0d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -46,7 +46,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
protected boolean tryLoadLootTable(CompoundTag nbt) {
this.lootableData.loadNbt(nbt); // Paper
if (nbt.contains("LootTable", 8)) {
- this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
+ this.lootTable = ResourceLocation.tryParse(nbt.getString("LootTable")); // Scissors - Validate loot tables
try { org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.lootTable); } catch (IllegalArgumentException ex) { this.lootTable = null; } // Paper - validate
this.lootTableSeed = nbt.getLong("LootTableSeed");
return false; // Paper - always load the items, table may still remain
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd6492057e 100644 index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd6492057e 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java
@@ -78,21 +144,20 @@ index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..a115a13ec911884a804800fc13f0347be1a30932 100644 index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..aa7fa17b9fb8519d8b57e27a5b422249b9b875d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
@@ -33,8 +33,15 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo @@ -33,8 +33,14 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
return null; // return empty loot table? return null; // return empty loot table?
} }
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable); - NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
- return Bukkit.getLootTable(key); - return Bukkit.getLootTable(key);
+ // Scissors start - Return a null loot table if the specified loot table is not valid + // Scissors start - Return a null loot table if the specified loot table is not valid
+ try + try {
+ {
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable); + NamespacedKey key = CraftNamespacedKey.fromMinecraft(nmsTable);
+ return Bukkit.getLootTable(key); + return Bukkit.getLootTable(key);
+ } catch (Exception exception) { + } catch (Exception ex) {
+ return null; + return null;
+ } + }
+ // Scissors end + // Scissors end
@@ -100,18 +165,17 @@ index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..a115a13ec911884a804800fc13f0347b
@Override @Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 31f62fbb54ec7b270fbd8afba7bd7c4bfafa09e3..684e69753be0398ebe57172454aba8cc45cf6502 100644 index b4e45d8e9851552f30c9c29d3d9671e1e9094c38..4e8e1a6b718d9ec8720efb648ab023e9e39f67e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -80,8 +80,15 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { @@ -80,8 +80,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob {
@Override @Override
public LootTable getLootTable() { public LootTable getLootTable() {
- NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable()); - NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
- return Bukkit.getLootTable(key); - return Bukkit.getLootTable(key);
+ // Scissors start - Return a null loot table if the specified loot table is not valid + // Scissors start - Return a null loot table if the specified loot table is not valid
+ try + try {
+ {
+ NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable()); + NamespacedKey key = CraftNamespacedKey.fromMinecraft(this.getHandle().getLootTable());
+ return Bukkit.getLootTable(key); + return Bukkit.getLootTable(key);
+ } catch (Exception ex) { + } catch (Exception ex) {

View File

@@ -1,22 +1,22 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com> From: Video <videogamesm12@gmail.com>
Date: Sun, 10 Dec 2023 16:57:48 -0600 Date: Sun, 13 Mar 2022 06:10:22 -0600
Subject: [PATCH] Fixes log spam caused by invalid entities in beehives Subject: [PATCH] Fixes log spam caused by invalid entities in beehives
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 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 d445ed0895293dd45c36226051f5809be8587ebe..b9c8b70fb0bf47ffe62cf0d082156479d07da331 100644 index 41c9f074203915c31c1ae7a160ce509c13383f84..8b4989593da43fc2fd661ac66bfe5ae1eb5e2780 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeehiveBlockEntity.java
@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag; @@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
+import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.ResourceLocation; // Scissors
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.tags.BlockTags; import net.minecraft.tags.BlockTags;
@@ -380,6 +381,13 @@ public class BeehiveBlockEntity extends BlockEntity { @@ -370,6 +371,13 @@ public class BeehiveBlockEntity extends BlockEntity {
for (int i = 0; i < nbttaglist.size(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
CompoundTag nbttagcompound1 = nbttaglist.getCompound(i); CompoundTag nbttagcompound1 = nbttaglist.getCompound(i);
@@ -27,6 +27,6 @@ index d445ed0895293dd45c36226051f5809be8587ebe..b9c8b70fb0bf47ffe62cf0d082156479
+ } + }
+ // Scissors end + // Scissors end
+ +
BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData").copy(), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks")); BeehiveBlockEntity.BeeData tileentitybeehive_hivebee = new BeehiveBlockEntity.BeeData(nbttagcompound1.getCompound("EntityData"), nbttagcompound1.getInt("TicksInHive"), nbttagcompound1.getInt("MinOccupationTicks"));
this.stored.add(tileentitybeehive_hivebee); this.stored.add(tileentitybeehive_hivebee);

View File

@@ -0,0 +1,20 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 13 Mar 2022 07:47:20 -0600
Subject: [PATCH] Removes useless spammy error logging
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index aeca803cc0434d9de9434987d6e43b70353e305b..5bd581c1a82236359c810037333590d0d9741587 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -1814,8 +1814,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
resource = CraftNamespacedKey.fromMinecraft(key);
}
} catch (IllegalArgumentException ex) {
- org.bukkit.Bukkit.getLogger().warning("Namespaced resource does not validate: " + key.toString());
- ex.printStackTrace();
+ // Scissors - Don't log errors thrown by invalid namespaces when an error is thrown
}
return resource;

View File

@@ -6,13 +6,13 @@ Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java 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 756d0434472921992c9d84597d7c9c824e93614c..77e9e106c522712a484d01bf7e7434c380de3621 100644 index 272095d7a09ab41227d741172735f66fd2798ce1..757ae1773ba35c2348483dddbb231060afafc602 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
@@ -147,7 +147,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @@ -139,7 +139,11 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { @Override
// CraftBukkit end public void remove(Entity.RemovalReason reason) {
if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) { if (!this.level().isClientSide && reason.shouldDestroy()) {
- Containers.dropContents(this.level(), (Entity) this, (Container) this); - Containers.dropContents(this.level(), (Entity) this, (Container) this);
+ // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them + // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them
+ try { + try {
@@ -21,4 +21,4 @@ index 756d0434472921992c9d84597d7c9c824e93614c..77e9e106c522712a484d01bf7e7434c3
+ // Scissors end + // Scissors end
} }
super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause super.remove(reason);

View File

@@ -5,20 +5,19 @@ Subject: [PATCH] ItemEntity - Check if items are air before calling setItem
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index c7f06c3cfb737bd17a706798bf9cf0e1af5f0cc0..4fd00227d035284688e641cb2c55a3214dcbaa38 100644 index eb0351aa12eebcefab1d1d14641fc3c60cbbcab8..cf944848cdebbb6f04f5211e00c876329e86d9cc 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -445,11 +445,15 @@ public class ItemEntity extends Entity implements TraceableEntity { @@ -425,11 +425,15 @@ public class ItemEntity extends Entity implements TraceableEntity {
CompoundTag nbttagcompound1 = nbt.getCompound("Item"); CompoundTag nbttagcompound1 = nbt.getCompound("Item");
- this.setItem(ItemStack.of(nbttagcompound1)); - this.setItem(ItemStack.of(nbttagcompound1));
- if (this.getItem().isEmpty()) { - if (this.getItem().isEmpty()) {
- this.discard(null); // CraftBukkit - add Bukkit remove cause
+ // Scissors start + // Scissors start
+ ItemStack item = ItemStack.of(nbttagcompound1); + ItemStack item = ItemStack.of(nbttagcompound1);
+ if (item.isEmpty()) { + if (item.isEmpty()) {
+ this.discard(null); this.discard();
+ return; + return;
} }

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 13 Mar 2022 21:56:29 -0600
Subject: [PATCH] Validate BlockState and SoundEvent values
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index fe4bea6af0d8734f3a5b972dce5f1e3914d6690e..0ee64be4288f59240beec26c470b78cc1aeac424 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -223,7 +223,7 @@ public final class NbtUtils {
return Blocks.AIR.defaultBlockState();
} else {
// Paper start - Validate resource location
- ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name"));
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState
Optional<? extends Holder<Block>> optional = resourceLocation != null ? blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation)) : Optional.empty();
// Paper end - Validate resource location
if (optional.isEmpty()) {

View File

@@ -6,17 +6,17 @@ Subject: [PATCH] Fixes Knowledge Books causing log spam when invalid data is
diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java diff --git a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
index 5ebc309aed545a4c22970e617519fe916a29fa3c..14a35465e41c9ecb51bea5b084e2637ebd21d295 100644 index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8cadb437db4 100644
--- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java --- a/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
+++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java +++ b/src/main/java/net/minecraft/world/item/KnowledgeBookItem.java
@@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item { @@ -40,9 +40,9 @@ public class KnowledgeBookItem extends Item {
for (int i = 0; i < listTag.size(); i++) { for(int i = 0; i < listTag.size(); ++i) {
String string = listTag.getString(i); String string = listTag.getString(i);
- Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string)); - Optional<RecipeHolder<?>> optional = recipeManager.byKey(new ResourceLocation(string));
+ Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations + Optional<RecipeHolder<?>> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations
if (!optional.isPresent()) { if (!optional.isPresent()) {
- LOGGER.error("Invalid recipe: {}", string); - LOGGER.error("Invalid recipe: {}", (Object)string);
+ // Scissors - Don't log errors caused by invalid recipes being provided + // Scissors - Don't log errors caused by invalid recipes being provided
return InteractionResultHolder.fail(itemStack); return InteractionResultHolder.fail(itemStack);
} }
@@ -25,13 +25,13 @@ index 5ebc309aed545a4c22970e617519fe916a29fa3c..14a35465e41c9ecb51bea5b084e2637e
return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide());
} else { } else {
- LOGGER.error("Tag not valid: {}", compoundTag); - LOGGER.error("Tag not valid: {}", (Object)compoundTag);
+ // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag. + // Scissors - Don't throw errors into the logs if an NBT compound isn't present or is missing the Recipes tag.
return InteractionResultHolder.fail(itemStack); return InteractionResultHolder.fail(itemStack);
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
index e904bf8b6a7d18a0e846c3b59e2d7f3d6e530e39..65b076b376bf6ab363a3eb62dfa2c96c45624957 100644 index 50fdb086ffec84edc5138737c95f08ed4757a6f3..da312b4670fc0ac07e4ab798d4793025e362783e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaKnowledgeBook.java
@@ -41,7 +41,11 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo @@ -41,7 +41,11 @@ public class CraftMetaKnowledgeBook extends CraftMetaItem implements KnowledgeBo

View File

@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Sun, 13 Mar 2022 21:56:29 -0600
Subject: [PATCH] Validate BlockState and SoundEvent values
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 82b53a7bfb37bfa1752a016a8a454c0b994b9108..b8720020f98ea26da7d3225ddfbb1d9e80be4eb1 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -231,7 +231,7 @@ public final class NbtUtils {
if (!nbt.contains("Name", 8)) {
return Blocks.AIR.defaultBlockState();
} else {
- ResourceLocation resourceLocation = new ResourceLocation(nbt.getString("Name"));
+ ResourceLocation resourceLocation = ResourceLocation.tryParse(nbt.getString("Name")); // Scissors - Validate BlockState
Optional<? extends Holder<Block>> optional = blockLookup.get(ResourceKey.create(Registries.BLOCK, resourceLocation));
if (optional.isEmpty()) {
return Blocks.AIR.defaultBlockState();
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index 8affdd74769aed9aa92a76ba539cd9d27208827c..23e480535bfb4071cde84fc400c2e6acb129e1ae 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -541,7 +541,7 @@ public abstract class AbstractArrow extends Projectile {
this.setCritArrow(nbt.getBoolean("crit"));
this.setPierceLevel(nbt.getByte("PierceLevel"));
if (nbt.contains("SoundEvent", 8)) {
- this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(new ResourceLocation(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent());
+ this.soundEvent = (SoundEvent) BuiltInRegistries.SOUND_EVENT.getOptional(ResourceLocation.tryParse(nbt.getString("SoundEvent"))).orElse(this.getDefaultHitGroundSoundEvent()); // Scissors - Validate SoundEvents before trying to play them
}
this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow"));

View File

@@ -1,27 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Luna <lunahatesgogle@gmail.com>
Date: Mon, 15 Apr 2024 22:26:14 -0500 Date: Sun, 20 Mar 2022 09:31:16 -0300
Subject: [PATCH] Do not log invalid items in HoverEvent and ItemFrame Subject: [PATCH] Do not log invalid items in HoverEvent and ItemFrame
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index 433e586bed53a8c17adec74b3088899c748d4be3..a82b4e39c3160114aded3f33c85fad2e95065b72 100644 index c0633f9553fb5aa52e8ffc863159521d09cb3bd5..7449a024265c42f28a6c9a1ed8d8f4b9e3096aac 100644
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java --- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java +++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
@@ -261,7 +261,7 @@ public class HoverEvent { @@ -314,7 +314,7 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString()); CompoundTag compoundTag = TagParser.parseTag(string);
return DataResult.success(new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag))); return new HoverEvent.ItemStackInfo(item, i, compoundTag);
} catch (CommandSyntaxException var2) { } catch (CommandSyntaxException var6) {
- return DataResult.error(() -> "Failed to parse item tag: " + var2.getMessage()); - HoverEvent.LOGGER.warn("Failed to parse tag: {}", string, var6);
+ return null; + // Scissors - Ignore invalid items
} }
} }
@@ -328,7 +328,7 @@ public class HoverEvent {
CompoundTag compoundTag = TagParser.parseTag(text.getString());
return new HoverEvent.ItemStackInfo(ItemStack.of(compoundTag));
} catch (CommandSyntaxException var2) {
- HoverEvent.LOGGER.warn("Failed to parse item tag: {}", text, var2);
+ // Scissors - Ignore invalid items
return null;
}
} }
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index c34701f95580e4cf45fe086115563127432a28c5..fc7547381a5dd7c0aae352c0cae72a980953b98f 100644 index 759ecd79534a7706f7d4a63eb9dacbefcfe54674..9afda54ad70d446672749506822c6abd729b8f1b 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -436,7 +436,7 @@ public class ItemFrame extends HangingEntity { @@ -441,7 +441,7 @@ public class ItemFrame extends HangingEntity {
ItemStack itemstack = ItemStack.of(nbttagcompound1); ItemStack itemstack = ItemStack.of(nbttagcompound1);
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {

View File

@@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Telesphoreo <me@telesphoreo.me>
Date: Tue, 23 Jan 2024 19:01:02 -0600 Date: Sat, 26 Mar 2022 21:51:07 -0500
Subject: [PATCH] Change version fetcher to AMG Subject: [PATCH] Change version fetcher to AMG
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..48dd50d0e443a59835e92616874c9856c7cbc401 100644 index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..bc5ed619e05f24f3ad50a6a81306d120869f57a1 100644
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java --- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java +++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
@@ -4,6 +4,7 @@ import com.destroystokyo.paper.util.VersionFetcher; @@ -4,11 +4,13 @@ import com.destroystokyo.paper.util.VersionFetcher;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.io.Resources; import com.google.common.io.Resources;
import com.google.gson.*; import com.google.gson.*;
@@ -16,12 +16,14 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..48dd50d0e443a59835e92616874c9856
import net.kyori.adventure.text.Component; import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
@@ -16,11 +17,12 @@ import java.io.*; import net.kyori.adventure.text.format.TextDecoration;
import java.net.HttpURLConnection; import net.kyori.adventure.text.TextComponent;
import java.net.URL;
import java.util.stream.StreamSupport;
+import org.bukkit.Bukkit; // Scissors +import org.bukkit.Bukkit; // Scissors
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -19,8 +21,8 @@ import java.util.stream.StreamSupport;
public class PaperVersionFetcher implements VersionFetcher { public class PaperVersionFetcher implements VersionFetcher {
private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end private static final java.util.regex.Pattern VER_PATTERN = java.util.regex.Pattern.compile("^([0-9\\.]*)\\-.*R"); // R is an anchor, will always give '-R' at end
- private static final String GITHUB_BRANCH_NAME = "master"; - private static final String GITHUB_BRANCH_NAME = "master";
@@ -75,15 +77,15 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..48dd50d0e443a59835e92616874c9856
switch (distance) { switch (distance) {
case -1: case -1:
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index c0538206a53f0e6d9b54bddde0259b89ac73d675..5ebb80ed81d9bbd4c69a14ccd0be6c67de2fcf0d 100644 index c737c5d62407337d3db2899cfc01713a058a6467..54891c5d7ca19a4fdab74a8729814a6fecee3fda 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -315,7 +315,7 @@ public class Main { @@ -301,7 +301,7 @@ public class Main {
if (buildDate.before(deadline.getTime())) { if (buildDate.before(deadline.getTime())) {
// Paper start - This is some stupid bullshit // Paper start - This is some stupid bullshit
System.err.println("*** Warning, you've not updated in a while! ***"); System.err.println("*** Warning, you've not updated in a while! ***");
- System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper - System.err.println("*** Please download a new build as per instructions from https://papermc.io/downloads/paper ***"); // Paper
+ System.err.println("*** Please download a new build as per instructions from https://ci.scissors.gg/job/Scissors ***"); // Paper + System.err.println("*** Please download a new build from https://ci.scissors.gg/job/Scissors ***"); // Scissors > // Paper
//System.err.println("*** Server will start in 20 seconds ***"); //System.err.println("*** Server will start in 20 seconds ***");
//Thread.sleep(TimeUnit.SECONDS.toMillis(20)); //Thread.sleep(TimeUnit.SECONDS.toMillis(20));
// Paper end // Paper End

View File

@@ -1,14 +1,14 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Video <videogamesm12@gmail.com>
Date: Mon, 15 Apr 2024 22:36:13 -0500 Date: Mon, 28 Mar 2022 13:19:43 -0600
Subject: [PATCH] Better handling of invalid JSON components Subject: [PATCH] Better handling of invalid JSON components
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
index e028353e0261310afc42ca0454b723d9f1ffc131..ed8810319db2ce754245193a62ea7a9a32ac13ec 100644 index 8240bb085b619f257f8c0a25775e0b15068e440f..c80d58dc9cb9171d51ff0a0596bb27bf161c3c83 100644
--- a/src/main/java/io/papermc/paper/util/MCUtil.java --- a/src/main/java/io/papermc/paper/util/MCUtil.java
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -675,12 +675,6 @@ public final class MCUtil { @@ -659,12 +659,6 @@ public final class MCUtil {
return null; return null;
} }
String string = compound.getString(key); String string = compound.getString(key);
@@ -19,15 +19,23 @@ index e028353e0261310afc42ca0454b723d9f1ffc131..ed8810319db2ce754245193a62ea7a9a
- } - }
- -
- return null; - return null;
+ return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string); // Scissors + return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string);
} }
} }
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ae84d06564b2560e13404f6d89f88ad71dbc2cc6 100644 index b540ce21c65ad52ad7e94d2ca2b3926c0875bee1..9cb6fa8e35c89f73e7c95dbe219a4bf6d00b60a9 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java --- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java +++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -315,6 +315,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> { @@ -26,6 +26,7 @@ import java.util.List;
return json == null ? null : Serializer.deserialize(json); import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.Nullable;
+import net.minecraft.ChatFormatting; // Scissors
import net.minecraft.Util;
import net.minecraft.network.chat.contents.BlockDataSource;
import net.minecraft.network.chat.contents.DataSource;
@@ -522,6 +523,26 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
return GsonHelper.toStableString(Serializer.toJsonTree(text));
} }
+ // Scissors start + // Scissors start
@@ -50,15 +58,42 @@ index d3a80d0a23be762c05931ae8001d98e43cab2b4a..ae84d06564b2560e13404f6d89f88ad7
+ } + }
+ // Scissors end + // Scissors end
+ +
@Nullable public static JsonElement toJsonTree(Component text) {
public static MutableComponent fromJsonLenient(String json) { return Component.Serializer.GSON.toJsonTree(text);
JsonReader jsonreader = new JsonReader(new StringReader(json)); }
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
index a82b4e39c3160114aded3f33c85fad2e95065b72..e1f15ac481ab598e420ad79bcf289251d9f1c99a 100644 index 7449a024265c42f28a6c9a1ed8d8f4b9e3096aac..487c68abc3eb5c18dc7fee762b2164001283cab7 100644
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java --- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java +++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
@@ -147,7 +147,7 @@ public class HoverEvent { @@ -79,7 +79,7 @@ public class HoverEvent {
public static DataResult<HoverEvent.EntityTooltipInfo> legacyCreate(Component text) { if (jsonElement != null) {
return action.deserialize(jsonElement);
} else {
- Component component = Component.Serializer.fromJson(json.get("value"));
+ Component component = Component.Serializer.fromJsonSafe(json.get("value")); // Scissors - Use safer method for getting Components from JSON
return component != null ? action.deserializeFromLegacy(component) : null;
}
}
@@ -94,7 +94,7 @@ public class HoverEvent {
}
public static class Action<T> {
- public static final HoverEvent.Action<Component> SHOW_TEXT = new HoverEvent.Action<>("show_text", true, Component.Serializer::fromJson, Component.Serializer::toJsonTree, Function.identity());
+ public static final HoverEvent.Action<Component> SHOW_TEXT = new HoverEvent.Action<>("show_text", true, Component.Serializer::fromJsonSafe, Component.Serializer::toJsonTree, Function.identity()); // Scissors - Use safer method for getting Components from JSON
public static final HoverEvent.Action<HoverEvent.ItemStackInfo> SHOW_ITEM = new HoverEvent.Action<>("show_item", true, HoverEvent.ItemStackInfo::create, HoverEvent.ItemStackInfo::serialize, HoverEvent.ItemStackInfo::create);
public static final HoverEvent.Action<HoverEvent.EntityTooltipInfo> SHOW_ENTITY = new HoverEvent.Action<>("show_entity", true, HoverEvent.EntityTooltipInfo::create, HoverEvent.EntityTooltipInfo::serialize, HoverEvent.EntityTooltipInfo::create);
private static final Map<String, HoverEvent.Action<?>> LOOKUP = Stream.of(SHOW_TEXT, SHOW_ITEM, SHOW_ENTITY).collect(ImmutableMap.toImmutableMap(HoverEvent.Action::getName, (action) -> {
@@ -182,7 +182,7 @@ public class HoverEvent {
return null;
}
// Scissors end
- Component component = Component.Serializer.fromJson(jsonObject.get("name"));
+ Component component = Component.Serializer.fromJsonSafe(jsonObject.get("name")); // Scissors - Use safer method for getting Components from JSON
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
}
}
@@ -191,7 +191,7 @@ public class HoverEvent {
public static HoverEvent.EntityTooltipInfo create(Component text) {
try { try {
CompoundTag compoundTag = TagParser.parseTag(text.getString()); CompoundTag compoundTag = TagParser.parseTag(text.getString());
- Component component = Component.Serializer.fromJson(compoundTag.getString("name")); - Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
@@ -67,30 +102,39 @@ index a82b4e39c3160114aded3f33c85fad2e95065b72..e1f15ac481ab598e420ad79bcf289251
// Scissors start // Scissors start
UUID uUID; UUID uUID;
diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
index c5673657ca6332147a5cbd2f4107fee13b9b7f47..3fec6f3e0adef6e2094157ef9040c7c6dc41a6c2 100644 index 97a2657bc98d41c3c1e376b266d2c85f685acc88..9d20f3f1af8e663a8c13714c8928d4a91653daa4 100644
--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java --- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
+++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java
@@ -124,10 +124,10 @@ public class NbtContents implements ComponentContents { @@ -8,6 +8,7 @@ import java.util.Optional;
); import java.util.stream.Collectors;
return stream.flatMap(text -> { import java.util.stream.Stream;
import javax.annotation.Nullable;
+import net.kyori.adventure.text.TextComponent; // Scissors
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.arguments.NbtPathArgument;
import net.minecraft.nbt.Tag;
@@ -107,10 +108,10 @@ public class NbtContents implements ComponentContents {
Component component = DataFixUtils.orElse(ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR);
return stream.flatMap((text) -> {
try { try {
- MutableComponent mutableComponent = Component.Serializer.fromJson(text); - MutableComponent mutableComponent = Component.Serializer.fromJson(text);
+ MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text); // Scissors + MutableComponent mutableComponent = Component.Serializer.fromJsonSafe(text); // Scissors
return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth)); return Stream.of(ComponentUtils.updateForEntity(source, mutableComponent, sender, depth));
} catch (Exception var5x) { } catch (Exception var5) {
- LOGGER.warn("Failed to parse component: {}", text, var5x); - LOGGER.warn("Failed to parse component: {}", text, var5);
+ // Scissors - don't log + // Scissors - don't log
return Stream.of(); return Stream.of();
} }
}).reduce((accumulator, current) -> accumulator.append(component).append(current)).orElseGet(Component::empty); }).reduce((accumulator, current) -> {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 637478fd8a284e6833cf8f5fa17ccf9d73d1dd3f..2ecf2d8ff546ed097cb3b547db22d28a31d29ec4 100644 index 1e05fca2a2ba6e2c0b641b6e27585520889cd8a6..3bf0c06f5042e9ff5572714dfc6a641a01a65978 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2545,11 +2545,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2503,12 +2503,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
this.setRot(this.getYRot(), this.getXRot());
if (nbt.contains("CustomName", 8)) { if (nbt.contains("CustomName", 8)) {
String s = nbt.getString("CustomName"); String s = nbt.getString("CustomName");
-
- try { - try {
- this.setCustomName(Component.Serializer.fromJson(s)); - this.setCustomName(Component.Serializer.fromJson(s));
- } catch (Exception exception) { - } catch (Exception exception) {
@@ -101,10 +145,10 @@ index 637478fd8a284e6833cf8f5fa17ccf9d73d1dd3f..2ecf2d8ff546ed097cb3b547db22d28a
this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible")); this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible"));
diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
index 7eb1c28886741bdfe7985d16b6824f3e85ffae50..a6b7ff2e50c9700589428cc7d61b5ef9f9082ea8 100644 index 4def212655cea0fd998b52e924f8b671d6aeb559..4359fb5997f8a207c52a09aa61a9431fa3ff550e 100644
--- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java --- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
+++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java +++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java
@@ -41,7 +41,7 @@ public class ScoreboardSaveData extends SavedData { @@ -38,7 +38,7 @@ public class ScoreboardSaveData extends SavedData {
CompoundTag compoundTag = nbt.getCompound(i); CompoundTag compoundTag = nbt.getCompound(i);
String string = compoundTag.getString("Name"); String string = compoundTag.getString("Name");
PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string); PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string);
@@ -113,7 +157,7 @@ index 7eb1c28886741bdfe7985d16b6824f3e85ffae50..a6b7ff2e50c9700589428cc7d61b5ef9
if (component != null) { if (component != null) {
playerTeam.setDisplayName(component); playerTeam.setDisplayName(component);
} }
@@ -59,14 +59,14 @@ public class ScoreboardSaveData extends SavedData { @@ -56,14 +56,14 @@ public class ScoreboardSaveData extends SavedData {
} }
if (compoundTag.contains("MemberNamePrefix", 8)) { if (compoundTag.contains("MemberNamePrefix", 8)) {
@@ -137,5 +181,5 @@ index 7eb1c28886741bdfe7985d16b6824f3e85ffae50..a6b7ff2e50c9700589428cc7d61b5ef9
- Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName")); - Component component = Component.Serializer.fromJson(compoundTag.getString("DisplayName"));
+ Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON + Component component = Component.Serializer.fromJsonSafe(compoundTag.getString("DisplayName")); // Scissors - Use safer method for getting Components from JSON
ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType")); ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType"));
boolean bl = compoundTag.getBoolean("display_auto_update"); this.scoreboard.addObjective(string2, objectiveCriteria, component, renderType);
NumberFormat numberFormat = NumberFormatTypes.CODEC.parse(NbtOps.INSTANCE, compoundTag.get("format")).result().orElse(null); }

View File

@@ -1,32 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ayunami2000 <spwilliamsiam@gmail.com> From: ayunami2000 <spwilliamsiam@gmail.com>
Date: Thu, 25 Jan 2024 23:48:51 -0600 Date: Mon, 28 Mar 2022 17:02:21 -0400
Subject: [PATCH] Block server-side chunkbans Subject: [PATCH] Block server-side chunkbans
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db74d40266 100644 index d364bd57b1675c8b21d781c2bc16c3e65800455c..f2e7585630ff724f966c7bcedc17e502d786870d 100644
--- a/src/main/java/net/minecraft/network/PacketEncoder.java --- a/src/main/java/net/minecraft/network/PacketEncoder.java
+++ b/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java
@@ -7,8 +7,17 @@ import io.netty.handler.codec.MessageToByteEncoder; @@ -7,8 +7,16 @@ import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.util.Attribute; import io.netty.util.Attribute;
import io.netty.util.AttributeKey; import io.netty.util.AttributeKey;
import java.io.IOException; import java.io.IOException;
+import java.util.Collections; +import java.util.Collections; // Scissors
+ +import net.minecraft.ChatFormatting; // Scissors
+import net.minecraft.ChatFormatting; +import net.minecraft.core.NonNullList; // Scissors
+import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; // Scissors
+import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; // Scissors
+import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.SignedMessageBody; // Scissors
+import net.minecraft.network.chat.SignedMessageBody;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
+import net.minecraft.network.protocol.game.*; +import net.minecraft.network.protocol.game.*; // Scissors
import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.util.profiling.jfr.JvmProfiler;
+import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ItemStack; // Scissors
import org.slf4j.Logger; import org.slf4j.Logger;
public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
@@ -19,6 +28,23 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -19,6 +27,23 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
this.codecKey = protocolKey; this.codecKey = protocolKey;
} }
@@ -50,12 +49,12 @@ index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db
protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception { protected void encode(ChannelHandlerContext channelHandlerContext, Packet<?> packet, ByteBuf byteBuf) throws Exception {
Attribute<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey); Attribute<ConnectionProtocol.CodecData<?>> attribute = channelHandlerContext.channel().attr(this.codecKey);
ConnectionProtocol.CodecData<?> codecData = attribute.get(); ConnectionProtocol.CodecData<?> codecData = attribute.get();
@@ -34,45 +60,58 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { @@ -34,46 +59,59 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> {
throw new IOException("Can't serialize unregistered packet"); throw new IOException("Can't serialize unregistered packet");
} else { } else {
FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf);
- friendlyByteBuf.writeVarInt(i); - friendlyByteBuf.writeVarInt(i);
- friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - adventure; set player's locale - friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper
+ // Scissors start + // Scissors start
+ int k; + int k;
@@ -63,7 +62,7 @@ index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db
- int j = friendlyByteBuf.writerIndex(); - int j = friendlyByteBuf.writerIndex();
- packet.write(friendlyByteBuf); - packet.write(friendlyByteBuf);
- int k = friendlyByteBuf.writerIndex() - j; - int k = friendlyByteBuf.writerIndex() - j;
- if (false && k > 8388608) { // Paper - Handle large packets disconnecting client; disable - if (false && k > 8388608) { // Paper - disable
- throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet); - throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet);
- } - }
- -
@@ -74,10 +73,7 @@ index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db
- String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName()); - String packetName = io.papermc.paper.util.ObfHelper.INSTANCE.deobfClassName(packet.getClass().getName());
- if (packetName.contains(".")) { - if (packetName.contains(".")) {
- packetName = packetName.substring(packetName.lastIndexOf(".") + 1); - packetName = packetName.substring(packetName.lastIndexOf(".") + 1);
+ packet = capPacket(packet, i); - }
+ if (packet == null) {
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
}
- -
- LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13); - LOGGER.error("Packet encoding of packet {} (ID: {}) threw (skippable? {})", packetName, i, packet.isSkippable(), var13);
- // Paper end - // Paper end
@@ -87,16 +83,20 @@ index 96d5448019d53ac3575e209c1c5c223a62a2638d..d0cfc4fc00d45c91380d2d794ca816db
- -
- throw var13; - throw var13;
- } finally { - } finally {
- // Paper start - Handle large packets disconnecting client - // Paper start
- int packetLength = friendlyByteBuf.readableBytes(); - int packetLength = friendlyByteBuf.readableBytes();
- if (packetLength > MAX_PACKET_SIZE) { - if (packetLength > MAX_PACKET_SIZE) {
- throw new PacketTooLargeException(packet, this.codecKey, packetLength); - throw new PacketTooLargeException(packet, this.codecKey, packetLength);
- } + packet = capPacket(packet, i);
- // Paper end - Handle large packets disconnecting client + if (packet == null) {
+ throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet));
}
- // Paper end
- ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); - ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
+ friendlyByteBuf.clear(); + friendlyByteBuf.clear();
+ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); + k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i);
} }
+ JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); + JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k);
+ ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); + ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
+ // Scissors end + // Scissors end
@@ -153,12 +153,12 @@ index 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f30
this.type = blockEntityType; this.type = blockEntityType;
this.tag = nbt.isEmpty() ? null : nbt; this.tag = nbt.isEmpty() ? null : nbt;
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 76bde683d193b37e563a67c1c7b9bdcf17d64524..185aa88ff28e6f3e3314abe19dff88609a47334e 100644 index 51e24105facfe71ce9f2757c6c881a21b58dacfd..5692fbae221fb01d32d92edc7bea0f6312e24e1c 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData { @@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData {
} }
// Paper end - Handle oversized block entities in chunks // Paper end
+ // Scissors start + // Scissors start
+ public void clearNBT() { + public void clearNBT() {
@@ -171,10 +171,10 @@ index 76bde683d193b37e563a67c1c7b9bdcf17d64524..185aa88ff28e6f3e3314abe19dff8860
@Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkPacketData(LevelChunk chunk) { this(chunk, null); } @Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkPacketData(LevelChunk chunk) { this(chunk, null); }
public ClientboundLevelChunkPacketData(LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) { public ClientboundLevelChunkPacketData(LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo<net.minecraft.world.level.block.state.BlockState> chunkPacketInfo) {
@@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData { @@ -58,6 +65,7 @@ public class ClientboundLevelChunkPacketData {
int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks int totalTileEntities = 0; // Paper
for (Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) { for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
+ if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size + if (this.extraPackets.size() > 50) break; // Scissors - Limit extraPackets size
// Paper start - Handle oversized block entities in chunks // Paper start
if (++totalTileEntities > TE_LIMIT) { if (++totalTileEntities > TE_LIMIT) {
var packet = entry2.getValue().getUpdatePacket(); var packet = entry2.getValue().getUpdatePacket();

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Reject oversized components from updating
diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51d1d5f868 100644 index 7daca712816a79cc4a30b084afbd3d07b5d3755f..a7e04eb4284e7d5148e1c7b991620d666785ec70 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java
@@ -38,8 +38,9 @@ public class ComponentUtils { @@ -38,8 +38,9 @@ public class ComponentUtils {
@@ -17,7 +17,7 @@ index 3365aed2b67ae0e4dd0410f5190ba474f146139b..43b62a07b040b1d7d76dc8f940f35b51
- return text.copy(); - return text.copy();
+ result = text.copy(); // Scissors + result = text.copy(); // Scissors
} else { } else {
// Paper start - adventure; pass actual vanilla component // Paper start
if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) { if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) {
@@ -52,8 +53,9 @@ public class ComponentUtils { @@ -52,8 +53,9 @@ public class ComponentUtils {
mutableComponent.append(updateForEntity(source, component, sender, depth + 1)); mutableComponent.append(updateForEntity(source, component, sender, depth + 1));

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add Scissors configuration file & command
diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java
index 7620c72a4c243cbeea245203ce03a97cbfa7d922..a05a348c299a68a61fabcbdcc689a89a81d1301f 100644 index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..f83b2c4298bd1a5f65487f64bd6a11fb190a622d 100644
--- a/src/main/java/co/aikar/timings/TimingsExport.java --- a/src/main/java/co/aikar/timings/TimingsExport.java
+++ b/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java
@@ -25,6 +25,7 @@ package co.aikar.timings; @@ -25,6 +25,7 @@ package co.aikar.timings;
@@ -16,7 +16,7 @@ index 7620c72a4c243cbeea245203ce03a97cbfa7d922..a05a348c299a68a61fabcbdcc689a89a
import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
@@ -240,7 +241,8 @@ public class TimingsExport extends Thread { @@ -242,7 +243,8 @@ public class TimingsExport extends Thread {
parent.put("config", createObject( parent.put("config", createObject(
pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)),
pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)),
@@ -414,24 +414,24 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b
+} +}
+ +
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index bc391d27399d8c22e78735ca39aa8ab45efb6413..ce5d500ff4642e646a84c09dcff07375b9d80176 100644 index ec268189b19b6fa5c4521f96ce211a531db35ec5..343cb72710ef100cf7e4de1e081cfdc2744aab46 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -130,6 +130,7 @@ public class Main { @@ -144,6 +144,7 @@ public class Main {
// Paper start - load config files early for access below if needed // Paper start - load config files for access below if needed
org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings")); org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("bukkit-settings"));
org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings"));
+ org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors - TODO Change this + org.bukkit.configuration.file.YamlConfiguration scissorsConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("scissors-settings")); // Scissors - TODO Change this
// Paper end - load config files early for access below if needed // Paper end
if (optionset.has("initSettings")) { // CraftBukkit if (optionset.has("initSettings")) { // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 68d268b6fff126e8645b6deec3fb549ea2286b77..5cb58e351d38b7214e2002bf608512024744f0ee 100644 index 1c9742ad81f04052d2c3bc18c7636f45b2fc5160..e2cb86f0323d91fa10ecf6cdf1db2e28405798a8 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // Paper - init PaperBrigadierProvider // Paper end
+ // Scissors start + // Scissors start
+ try { + try {
@@ -447,10 +447,10 @@ index 68d268b6fff126e8645b6deec3fb549ea2286b77..5cb58e351d38b7214e2002bf60851202
this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setFlightAllowed(dedicatedserverproperties.allowFlight);
this.setMotd(dedicatedserverproperties.motd); this.setMotd(dedicatedserverproperties.motd);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d0898642f 100644 index 903df63725faeaa160609edddf9f5c54144945e6..058780b420c9207119f4bb889f602bd94199d7fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1053,6 +1053,7 @@ public final class CraftServer implements Server { @@ -1040,6 +1040,7 @@ public final class CraftServer implements Server {
} }
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
@@ -458,7 +458,7 @@ index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d
this.console.paperConfigurations.reloadConfigs(this.console); this.console.paperConfigurations.reloadConfigs(this.console);
for (ServerLevel world : this.console.getAllLevels()) { for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
@@ -1084,6 +1085,7 @@ public final class CraftServer implements Server { @@ -1071,6 +1072,7 @@ public final class CraftServer implements Server {
this.reloadData(); this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@@ -466,7 +466,7 @@ index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
@@ -3028,6 +3030,14 @@ public final class CraftServer implements Server { @@ -2978,6 +2980,14 @@ public final class CraftServer implements Server {
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
} }
@@ -482,7 +482,7 @@ index f192db9868129bd1ee45e2b29c0c7479af33ebe1..1233d9b15d86079b2710e167ada03a4d
public void restart() { public void restart() {
org.spigotmc.RestartCommand.restart(); org.spigotmc.RestartCommand.restart();
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 8d626fadcd4743b6472a2954d2b1b2ec89669814..c0538206a53f0e6d9b54bddde0259b89ac73d675 100644 index 54891c5d7ca19a4fdab74a8729814a6fecee3fda..05db4799fddfbd8045c967520db99a75ba807697 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -181,6 +181,20 @@ public class Main { @@ -181,6 +181,20 @@ public class Main {

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
index 5cd0fbac267f9c69c5de4c200a95860f5c56d42e..f2ccf2af05524be91eb0f4855cb8006dea2aede4 100644 index ed6e5060901c348c4f56a573c23e2000d8f2fb72..5cdf1e6fcdc9e2bd821f40ec9bf95cf03f03179a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
@@ -47,6 +47,7 @@ import net.minecraft.nbt.NbtIo; @@ -46,6 +46,7 @@ import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.StringTag; import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
@@ -17,10 +17,10 @@ index 5cd0fbac267f9c69c5de4c200a95860f5c56d42e..f2ccf2af05524be91eb0f4855cb8006d
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.EnumUtils;
@@ -488,7 +489,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -487,7 +488,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
String attributeName = org.bukkit.craftbukkit.attribute.CraftAttributeMap.convertIfNeeded(entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT)); // Paper String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT)); // Paper
- if (attributeName == null || attributeName.isEmpty()) { - if (attributeName == null || attributeName.isEmpty()) {
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors + if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
continue; continue;

View File

@@ -1,30 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com> From: Video <videogamesm12@gmail.com>
Date: Sun, 10 Dec 2023 17:39:52 -0600 Date: Sat, 9 Apr 2022 13:00:27 -0600
Subject: [PATCH] Don't query player data in the `nbt` component Subject: [PATCH] Don't query player data in the `nbt` component
diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java diff --git a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
index 2750702cff35762bc817ffbe5bf81631e86bc49b..8714c3be77490a87aa6df0ff36a87557c6b99e25 100644 index 8a6799b50062c1b7b141ee1568dc523f9ee7ecfd..80e7b0889235288b60d813a569daecb7e08e108e 100644
--- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java --- a/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
+++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java +++ b/src/main/java/net/minecraft/network/chat/contents/EntityDataSource.java
@@ -8,12 +8,15 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; @@ -1,5 +1,6 @@
package net.minecraft.network.chat.contents;
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import java.util.List; import java.util.List;
import java.util.stream.Stream; @@ -11,6 +12,7 @@ import net.minecraft.commands.arguments.selector.EntitySelector;
import javax.annotation.Nullable;
+
+import me.totalfreedom.scissors.ScissorsConfig;
import net.minecraft.advancements.critereon.NbtPredicate;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.arguments.selector.EntitySelector;
import net.minecraft.commands.arguments.selector.EntitySelectorParser; import net.minecraft.commands.arguments.selector.EntitySelectorParser;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.player.Player; +import net.minecraft.world.entity.player.Player; // Scissors
public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource { public record EntityDataSource(String selectorPattern, @Nullable EntitySelector compiledSelector) implements DataSource {
public static final MapCodec<EntityDataSource> SUB_CODEC = RecordCodecBuilder.mapCodec( public EntityDataSource(String rawPath) {
@@ -39,7 +42,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector @@ -31,7 +33,11 @@ public record EntityDataSource(String selectorPattern, @Nullable EntitySelector
public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException { public Stream<CompoundTag> getData(CommandSourceStack source) throws CommandSyntaxException {
if (this.compiledSelector != null) { if (this.compiledSelector != null) {
List<? extends Entity> list = this.compiledSelector.findEntities(source); List<? extends Entity> list = this.compiledSelector.findEntities(source);

View File

@@ -5,32 +5,32 @@ Subject: [PATCH] Limit string tag visitors to 1024 elements
diff --git a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java diff --git a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
index b45bb4ddf6b586ba1285db230e0bc3d1b5e447e8..4a46935cac263325a87a1b0bf32302839a75516e 100644 index e07cc7970955ce240754cfe424d768c2bba0241a..a4f41bb4ec6cb20f782668c714229b61415cfdfb 100644
--- a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java --- a/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
+++ b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java +++ b/src/main/java/net/minecraft/nbt/SnbtPrinterTagVisitor.java
@@ -89,6 +89,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor { @@ -89,6 +89,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
public void visitByteArray(ByteArrayTag element) { public void visitByteArray(ByteArrayTag element) {
StringBuilder stringBuilder = new StringBuilder("[").append("B").append(";"); StringBuilder stringBuilder = (new StringBuilder("[")).append("B").append(";");
byte[] bs = element.getAsByteArray(); byte[] bs = element.getAsByteArray();
+ if (bs.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors + if (bs.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
for (int i = 0; i < bs.length; i++) { for(int i = 0; i < bs.length; ++i) {
stringBuilder.append(" ").append(bs[i]).append("B"); stringBuilder.append(" ").append((int)bs[i]).append("B");
@@ -105,6 +106,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor { @@ -105,6 +106,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
public void visitIntArray(IntArrayTag element) { public void visitIntArray(IntArrayTag element) {
StringBuilder stringBuilder = new StringBuilder("[").append("I").append(";"); StringBuilder stringBuilder = (new StringBuilder("[")).append("I").append(";");
int[] is = element.getAsIntArray(); int[] is = element.getAsIntArray();
+ if (is.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors + if (is.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
for (int i = 0; i < is.length; i++) { for(int i = 0; i < is.length; ++i) {
stringBuilder.append(" ").append(is[i]); stringBuilder.append(" ").append(is[i]);
@@ -122,6 +124,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor { @@ -122,6 +124,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
String string = "L"; String string = "L";
StringBuilder stringBuilder = new StringBuilder("[").append("L").append(";"); StringBuilder stringBuilder = (new StringBuilder("[")).append("L").append(";");
long[] ls = element.getAsLongArray(); long[] ls = element.getAsLongArray();
+ if (ls.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors + if (ls.length > 1024) { this.result = stringBuilder.append("]").toString(); return; } // Scissors
for (int i = 0; i < ls.length; i++) { for(int i = 0; i < ls.length; ++i) {
stringBuilder.append(" ").append(ls[i]).append("L"); stringBuilder.append(" ").append(ls[i]).append("L");
@@ -136,7 +139,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor { @@ -136,7 +139,7 @@ public class SnbtPrinterTagVisitor implements TagVisitor {
@@ -51,7 +51,7 @@ index b45bb4ddf6b586ba1285db230e0bc3d1b5e447e8..4a46935cac263325a87a1b0bf3230283
} else { } else {
StringBuilder stringBuilder = new StringBuilder("{"); StringBuilder stringBuilder = new StringBuilder("{");
diff --git a/src/main/java/net/minecraft/nbt/StringTagVisitor.java b/src/main/java/net/minecraft/nbt/StringTagVisitor.java diff --git a/src/main/java/net/minecraft/nbt/StringTagVisitor.java b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f769517b33058a 100644 index a687a0f17df30126d53a1e3a669dc6d157c23ed5..2c50f41dd8034af16fcceca75eeb6c7a9940e327 100644
--- a/src/main/java/net/minecraft/nbt/StringTagVisitor.java --- a/src/main/java/net/minecraft/nbt/StringTagVisitor.java
+++ b/src/main/java/net/minecraft/nbt/StringTagVisitor.java +++ b/src/main/java/net/minecraft/nbt/StringTagVisitor.java
@@ -53,6 +53,7 @@ public class StringTagVisitor implements TagVisitor { @@ -53,6 +53,7 @@ public class StringTagVisitor implements TagVisitor {
@@ -60,7 +60,7 @@ index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f76951
byte[] bs = element.getAsByteArray(); byte[] bs = element.getAsByteArray();
+ if (bs.length > 1024) { this.builder.append(']'); return; } // Scissors + if (bs.length > 1024) { this.builder.append(']'); return; } // Scissors
for (int i = 0; i < bs.length; i++) { for(int i = 0; i < bs.length; ++i) {
if (i != 0) { if (i != 0) {
@@ -69,6 +70,7 @@ public class StringTagVisitor implements TagVisitor { @@ -69,6 +70,7 @@ public class StringTagVisitor implements TagVisitor {
public void visitIntArray(IntArrayTag element) { public void visitIntArray(IntArrayTag element) {
@@ -68,7 +68,7 @@ index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f76951
int[] is = element.getAsIntArray(); int[] is = element.getAsIntArray();
+ if (is.length > 1024) { this.builder.append(']'); return; } // Scissors + if (is.length > 1024) { this.builder.append(']'); return; } // Scissors
for (int i = 0; i < is.length; i++) { for(int i = 0; i < is.length; ++i) {
if (i != 0) { if (i != 0) {
@@ -85,6 +87,7 @@ public class StringTagVisitor implements TagVisitor { @@ -85,6 +87,7 @@ public class StringTagVisitor implements TagVisitor {
public void visitLongArray(LongArrayTag element) { public void visitLongArray(LongArrayTag element) {
@@ -76,7 +76,7 @@ index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f76951
long[] ls = element.getAsLongArray(); long[] ls = element.getAsLongArray();
+ if (ls.length > 1024) { this.builder.append(']'); return; } // Scissors + if (ls.length > 1024) { this.builder.append(']'); return; } // Scissors
for (int i = 0; i < ls.length; i++) { for(int i = 0; i < ls.length; ++i) {
if (i != 0) { if (i != 0) {
@@ -100,6 +103,7 @@ public class StringTagVisitor implements TagVisitor { @@ -100,6 +103,7 @@ public class StringTagVisitor implements TagVisitor {
@Override @Override
@@ -84,7 +84,7 @@ index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f76951
this.builder.append('['); this.builder.append('[');
+ if (element.size() > 1024) { this.builder.append(']'); return; } // Scissors + if (element.size() > 1024) { this.builder.append(']'); return; } // Scissors
for (int i = 0; i < element.size(); i++) { for(int i = 0; i < element.size(); ++i) {
if (i != 0) { if (i != 0) {
@@ -116,6 +120,7 @@ public class StringTagVisitor implements TagVisitor { @@ -116,6 +120,7 @@ public class StringTagVisitor implements TagVisitor {
public void visitCompound(CompoundTag compound) { public void visitCompound(CompoundTag compound) {
@@ -95,7 +95,7 @@ index d8892641d5671fa100aeb43d42ebb6103a2d280c..d10242ecd6f8442e1af3f4cd13f76951
for(String string : list) { for(String string : list) {
diff --git a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java diff --git a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006c15cee41 100644 index 149def3da0b92f64e4fc04630965dce44884f938..c9d753f37bd65e35f8a4e2eb5c6fe8f74d5d1606 100644
--- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java --- a/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
+++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java +++ b/src/main/java/net/minecraft/nbt/TextComponentTagVisitor.java
@@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor { @@ -97,6 +97,7 @@ public class TextComponentTagVisitor implements TagVisitor {
@@ -104,15 +104,15 @@ index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006
byte[] bs = element.getAsByteArray(); byte[] bs = element.getAsByteArray();
+ if (bs.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors + if (bs.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
for (int i = 0; i < bs.length; i++) { for(int i = 0; i < bs.length; ++i) {
MutableComponent mutableComponent2 = Component.literal(String.valueOf(bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER); MutableComponent mutableComponent2 = Component.literal(String.valueOf((int)bs[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
@@ -115,6 +116,7 @@ public class TextComponentTagVisitor implements TagVisitor { @@ -115,6 +116,7 @@ public class TextComponentTagVisitor implements TagVisitor {
Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE); Component component = Component.literal("I").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
MutableComponent mutableComponent = Component.literal("[").append(component).append(";"); MutableComponent mutableComponent = Component.literal("[").append(component).append(";");
int[] is = element.getAsIntArray(); int[] is = element.getAsIntArray();
+ if (is.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors + if (is.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
for (int i = 0; i < is.length; i++) { for(int i = 0; i < is.length; ++i) {
mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER)); mutableComponent.append(" ").append(Component.literal(String.valueOf(is[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER));
@@ -132,6 +134,7 @@ public class TextComponentTagVisitor implements TagVisitor { @@ -132,6 +134,7 @@ public class TextComponentTagVisitor implements TagVisitor {
Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE); Component component = Component.literal("L").withStyle(SYNTAX_HIGHLIGHTING_NUMBER_TYPE);
@@ -120,7 +120,7 @@ index 4e238ae29347c5e976ff0d506e94972df0aa7362..9776b9741a7ec46c603b2c2bccd5f006
long[] ls = element.getAsLongArray(); long[] ls = element.getAsLongArray();
+ if (ls.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors + if (ls.length > 1024) { this.result = mutableComponent.append("]"); return; } // Scissors
for (int i = 0; i < ls.length; i++) { for(int i = 0; i < ls.length; ++i) {
Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER); Component component2 = Component.literal(String.valueOf(ls[i])).withStyle(SYNTAX_HIGHLIGHTING_NUMBER);
@@ -147,7 +150,7 @@ public class TextComponentTagVisitor implements TagVisitor { @@ -147,7 +150,7 @@ public class TextComponentTagVisitor implements TagVisitor {

View File

@@ -1,11 +1,11 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Allink <arclicious@vivaldi.net>
Date: Sat, 24 Feb 2024 15:32:48 -0600 Date: Mon, 18 Apr 2022 16:55:19 +0100
Subject: [PATCH] Fix negative death times Subject: [PATCH] Fix negative death times
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e9bb7feb591032904516d1b9374f486d8a7d066c..60961c54e870148b5c649045e7347ca1064b6bde 100644 index b95f88d5e5b4785ee063695fd81935636a0588d1..168b002377e258f84a3bb86dd8e4a5f42060e3e0 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -629,7 +629,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -629,7 +629,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -15,5 +15,5 @@ index e9bb7feb591032904516d1b9374f486d8a7d066c..60961c54e870148b5c649045e7347ca1
- if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) { - if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved()) { // Scissors + if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved()) { // Scissors
this.level().broadcastEntityEvent(this, (byte) 60); this.level().broadcastEntityEvent(this, (byte) 60);
this.remove(Entity.RemovalReason.KILLED, EntityRemoveEvent.Cause.DEATH); // CraftBukkit - add Bukkit remove cause this.remove(Entity.RemovalReason.KILLED);
} }

View File

@@ -6,7 +6,7 @@ Subject: [PATCH] Limit amount of vehicle collision checks to 3 and discard
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b05463fc6f 100644 index 44a6118d3bd67a95180f750c17967561946e2e87..8aece67eba8d6b558bc2441b8b8e599f86e12e4f 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair; @@ -8,6 +8,7 @@ import com.mojang.datafixers.util.Pair;
@@ -17,15 +17,15 @@ index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b0
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.BlockUtil; import net.minecraft.BlockUtil;
import net.minecraft.Util; import net.minecraft.Util;
@@ -104,6 +105,7 @@ public abstract class AbstractMinecart extends VehicleEntity { @@ -111,6 +112,7 @@ public abstract class AbstractMinecart extends Entity {
private double flyingX = 0.95; private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision
private double flyingY = 0.95; private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision
private double flyingZ = 0.95; private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision
+ private long lastLargeCollision = 0L; // Scissors - Add a collision debounce + private long lastLargeCollision = 0L; // Scissors - Add a collision debounce
public double maxSpeed = 0.4D; public double maxSpeed = 0.4D;
// CraftBukkit end // CraftBukkit end
@@ -384,8 +386,8 @@ public abstract class AbstractMinecart extends VehicleEntity { @@ -432,8 +434,8 @@ public abstract class AbstractMinecart extends Entity {
if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) { if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this)); List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this));
@@ -36,14 +36,14 @@ index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b0
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@@ -414,6 +416,14 @@ public abstract class AbstractMinecart extends VehicleEntity { @@ -462,6 +464,14 @@ public abstract class AbstractMinecart extends Entity {
entity.push(this); entity.push(this);
} }
} }
+ +
+ // Scissors start - Add a collision debounce + // Scissors start - Add a collision debounce
+ if (list.size() > 15) { + if (list.size() > 15) {
+ this.discard(null); + this.discard();
+ } else if (list.size() > 3) { + } else if (list.size() > 3) {
+ lastLargeCollision = System.currentTimeMillis(); + lastLargeCollision = System.currentTimeMillis();
+ } + }
@@ -52,7 +52,7 @@ index d514ec1e4cbdc579c3a61533998437903afdc8b6..7ee1f3552b81bff834c6f414e611e8b0
} else { } else {
Iterator iterator1 = this.level().getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); Iterator iterator1 = this.level().getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator();
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index db6aa75d642f4a7258f197933671907faf79c8f2..e4490494a865e129c69d7df3742f61860763a8d8 100644 index 5c07da62c82bc70138f6cb5007629d6974be69ac..301a72dffd4ac58333d987e85d22136498d2d82a 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator; @@ -5,6 +5,7 @@ import com.google.common.collect.UnmodifiableIterator;
@@ -63,7 +63,7 @@ index db6aa75d642f4a7258f197933671907faf79c8f2..e4490494a865e129c69d7df3742f6186
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.BlockUtil; import net.minecraft.BlockUtil;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@@ -108,6 +109,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> { @@ -112,6 +113,7 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
public double unoccupiedDeceleration = -1; public double unoccupiedDeceleration = -1;
public boolean landBoats = false; public boolean landBoats = false;
// CraftBukkit end // CraftBukkit end
@@ -71,7 +71,7 @@ index db6aa75d642f4a7258f197933671907faf79c8f2..e4490494a865e129c69d7df3742f6186
public Boat(EntityType<? extends Boat> type, Level world) { public Boat(EntityType<? extends Boat> type, Level world) {
super(type, world); super(type, world);
@@ -408,9 +410,9 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> { @@ -465,9 +467,9 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
this.checkInsideBlocks(); this.checkInsideBlocks();
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this)); List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this));
@@ -83,14 +83,14 @@ index db6aa75d642f4a7258f197933671907faf79c8f2..e4490494a865e129c69d7df3742f6186
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@@ -423,6 +425,14 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> { @@ -480,6 +482,14 @@ public class Boat extends Entity implements VariantHolder<Boat.Type> {
} }
} }
} }
+ +
+ // Scissors start - Add collision debounce + // Scissors start - Add collision debounce
+ if (list.size() > 15) { + if (list.size() > 15) {
+ this.discard(null); + this.discard();
+ } else if (list.size() > 3) { + } else if (list.size() > 3) {
+ lastLargeCollision = System.currentTimeMillis(); + lastLargeCollision = System.currentTimeMillis();
+ } + }

View File

@@ -1,36 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Allink <arclicious@vivaldi.net>
Date: Mon, 15 Apr 2024 22:49:31 -0500 Date: Mon, 18 Apr 2022 03:56:09 +0100
Subject: [PATCH] Reset large tags Subject: [PATCH] Reset large tags
diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java diff --git a/src/main/java/net/minecraft/world/ContainerHelper.java b/src/main/java/net/minecraft/world/ContainerHelper.java
index 4105bb71b1f1614b3e91478b40b85add94a9257b..52d2a8fd6e16c8d85f2544ffdb9ed4d18b298e1c 100644 index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee14f6dfb7 100644
--- a/src/main/java/net/minecraft/world/ContainerHelper.java --- a/src/main/java/net/minecraft/world/ContainerHelper.java
+++ b/src/main/java/net/minecraft/world/ContainerHelper.java +++ b/src/main/java/net/minecraft/world/ContainerHelper.java
@@ -2,6 +2,8 @@ package net.minecraft.world; @@ -2,6 +2,7 @@ package net.minecraft.world;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
+
+import me.totalfreedom.scissors.NbtUtility; // Scissors +import me.totalfreedom.scissors.NbtUtility; // Scissors
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
@@ -22,10 +24,12 @@ public class ContainerHelper { @@ -22,10 +23,12 @@ public class ContainerHelper {
public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) { public static CompoundTag saveAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks, boolean setIfEmpty) {
ListTag listTag = new ListTag(); ListTag listTag = new ListTag();
+ long total = 0; // Scissors + long total = 0; // Scissors
for (int i = 0; i < stacks.size(); i++) { for(int i = 0; i < stacks.size(); ++i) {
ItemStack itemStack = stacks.get(i); ItemStack itemStack = stacks.get(i);
if (!itemStack.isEmpty()) { if (!itemStack.isEmpty()) {
+ total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors + total += NbtUtility.getTagSize(itemStack.getTag()); // Scissors
CompoundTag compoundTag = new CompoundTag(); CompoundTag compoundTag = new CompoundTag();
compoundTag.putByte("Slot", (byte)i); compoundTag.putByte("Slot", (byte)i);
itemStack.save(compoundTag); itemStack.save(compoundTag);
@@ -33,7 +37,7 @@ public class ContainerHelper { @@ -33,7 +36,7 @@ public class ContainerHelper {
} }
} }
@@ -39,13 +38,13 @@ index 4105bb71b1f1614b3e91478b40b85add94a9257b..52d2a8fd6e16c8d85f2544ffdb9ed4d1
nbt.put("Items", listTag); nbt.put("Items", listTag);
} }
@@ -42,11 +46,19 @@ public class ContainerHelper { @@ -42,11 +45,19 @@ public class ContainerHelper {
public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) { public static void loadAllItems(CompoundTag nbt, NonNullList<ItemStack> stacks) {
ListTag listTag = nbt.getList("Items", 10); ListTag listTag = nbt.getList("Items", 10);
+ long total = 0; // Scissors - Account for items inside containers + long total = 0; // Scissors - Account for items inside containers
for (int i = 0; i < listTag.size(); i++) { for(int i = 0; i < listTag.size(); ++i) {
CompoundTag compoundTag = listTag.getCompound(i); CompoundTag compoundTag = listTag.getCompound(i);
int j = compoundTag.getByte("Slot") & 255; int j = compoundTag.getByte("Slot") & 255;
if (j >= 0 && j < stacks.size()) { if (j >= 0 && j < stacks.size()) {
@@ -60,19 +59,18 @@ index 4105bb71b1f1614b3e91478b40b85add94a9257b..52d2a8fd6e16c8d85f2544ffdb9ed4d1
} }
} }
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 1ad126d992d95062a3db08374db7a927f23a0cac..6af963d383293a4a6f8d517e2dc179ab70744b31 100644 index d0f7baa80cb7d0883304abe2ed990c258a0d92b6..bedd53797391005d70dcdd61c5ed6d56a32fee5c 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -23,6 +23,8 @@ import java.util.function.Predicate; @@ -21,6 +21,7 @@ import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.NbtUtility; // Scissors
+import me.totalfreedom.scissors.NbtUtility;
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.advancements.CriteriaTriggers;
@@ -278,6 +280,12 @@ public final class ItemStack { @@ -254,6 +255,12 @@ public final class ItemStack {
// CraftBukkit - break into own method // CraftBukkit - break into own method
private void load(CompoundTag nbttagcompound) { private void load(CompoundTag nbttagcompound) {
@@ -85,7 +83,7 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..6af963d383293a4a6f8d517e2dc179ab
this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id"))); this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
this.count = nbttagcompound.getByte("Count"); this.count = nbttagcompound.getByte("Count");
if (nbttagcompound.contains("tag", 10)) { if (nbttagcompound.contains("tag", 10)) {
@@ -585,7 +593,11 @@ public final class ItemStack { @@ -563,7 +570,11 @@ public final class ItemStack {
nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
nbt.putByte("Count", (byte) this.count); nbt.putByte("Count", (byte) this.count);
if (this.tag != null) { if (this.tag != null) {
@@ -98,7 +96,7 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..6af963d383293a4a6f8d517e2dc179ab
} }
return nbt; return nbt;
@@ -919,6 +931,7 @@ public final class ItemStack { @@ -893,6 +904,7 @@ public final class ItemStack {
// Paper end // Paper end
public void setTag(@Nullable CompoundTag nbt) { public void setTag(@Nullable CompoundTag nbt) {
@@ -107,19 +105,18 @@ index 1ad126d992d95062a3db08374db7a927f23a0cac..6af963d383293a4a6f8d517e2dc179ab
this.processEnchantOrder(this.tag); // Paper this.processEnchantOrder(this.tag); // Paper
if (this.getItem().canBeDepleted()) { if (this.getItem().canBeDepleted()) {
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 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 89d06253b00604114e543ebbe12a9993ae95dc41..d0af3a9b956b37126811080d65474eacd76bc083 100644 index f5ad7ddf13cbb6452c2927aef9b54eae3335b4c6..041e3c8fb7c9ca69a7c7c1c952ed9915a75d7752 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
@@ -9,6 +9,8 @@ import java.util.Iterator; @@ -9,6 +9,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.NbtUtility; // Scissors
+import me.totalfreedom.scissors.NbtUtility;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@@ -213,6 +215,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit @@ -212,6 +213,17 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
public List<ItemStack> getContents() { public List<ItemStack> getContents() {
@@ -138,13 +135,13 @@ index 89d06253b00604114e543ebbe12a9993ae95dc41..d0af3a9b956b37126811080d65474eac
} }
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 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 416aa989ebb18a8741cc9d605a1180ab830f6643..af7ed06c083161212784f746290129a17523575a 100644 index 416aa989ebb18a8741cc9d605a1180ab830f6643..a9a8c9e68e5b767dec2c26495685da88e0caa627 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BarrelBlockEntity.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
package net.minecraft.world.level.block.entity; package net.minecraft.world.level.block.entity;
+import me.totalfreedom.scissors.NbtUtility; +import me.totalfreedom.scissors.NbtUtility; // Scissors
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
@@ -167,19 +164,18 @@ index 416aa989ebb18a8741cc9d605a1180ab830f6643..af7ed06c083161212784f746290129a1
} }
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 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 9bb542ce3a8c52e1688bb1f66fc916dd23a5fd10..d8386aa10dc1616c4da87bc8078548d13bff5bdf 100644 index c57efcb9a79337ec791e4e8f6671612f0a82b441..2cbb8170953cb555411db8c171a3d1d91eb799bb 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
@@ -3,6 +3,8 @@ package net.minecraft.world.level.block.entity; @@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.NbtUtility; // Scissors
+import me.totalfreedom.scissors.NbtUtility;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
@@ -73,6 +75,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements @@ -73,6 +74,17 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
} }
public List<ItemStack> getContents() { public List<ItemStack> getContents() {
@@ -198,13 +194,13 @@ index 9bb542ce3a8c52e1688bb1f66fc916dd23a5fd10..d8386aa10dc1616c4da87bc8078548d1
} }
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 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 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..2cf4a854a40aabbfff2f6ee4fb9e36e8d466afd5 100644 index a71414397bd45ee7bcacfeef0041d80dfa25f114..f51abf1722e98d7ce9e616d84472d847e597eafb 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
package net.minecraft.world.level.block.entity; package net.minecraft.world.level.block.entity;
+import me.totalfreedom.scissors.NbtUtility; +import me.totalfreedom.scissors.NbtUtility; // Scissors
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
@@ -227,13 +223,13 @@ index 9b1243d96e0694c62fc9e82e9be540bce0d2b3ad..2cf4a854a40aabbfff2f6ee4fb9e36e8
} }
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 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 881379681c39230a00b3a1f11cd87498984396c7..8e1ef455c1b563844c416021c478b2a34b90c418 100644 index 881379681c39230a00b3a1f11cd87498984396c7..d0513b72cdaec3b67b9341d251367b193bafa40c 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
package net.minecraft.world.level.block.entity; package net.minecraft.world.level.block.entity;
+import me.totalfreedom.scissors.NbtUtility; +import me.totalfreedom.scissors.NbtUtility; // Scissors
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@@ -256,19 +252,18 @@ index 881379681c39230a00b3a1f11cd87498984396c7..8e1ef455c1b563844c416021c478b2a3
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index cdb739df2a285032d25d84f4464f202a7a3fa578..69845474c207220c0146891be90e3232ac8a3547 100644 index d4dcf7fe26474ae07374e7761d823bc5c8b54f97..7352183f7eaa1ddcd028e53f4b66a1c34e32b988 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -6,6 +6,8 @@ import java.util.function.BooleanSupplier; @@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.NbtUtility; // Scissors
+import me.totalfreedom.scissors.NbtUtility;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
@@ -57,6 +59,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen @@ -56,6 +57,17 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
private int maxStack = MAX_STACK; private int maxStack = MAX_STACK;
public List<ItemStack> getContents() { public List<ItemStack> getContents() {
@@ -287,19 +282,18 @@ index cdb739df2a285032d25d84f4464f202a7a3fa578..69845474c207220c0146891be90e3232
} }
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 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 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..c37f0f12283f528d16fd0450075eab1974ba5057 100644 index 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..9f12fbcd8d0c75de1d8c06bed2c64a0acdc877c9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
@@ -4,6 +4,8 @@ import java.util.Iterator; @@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.NbtUtility; // Scissors
+import me.totalfreedom.scissors.NbtUtility;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList; import net.minecraft.core.NonNullList;
@@ -61,6 +63,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl @@ -61,6 +62,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl
public boolean opened; public boolean opened;
public List<ItemStack> getContents() { public List<ItemStack> getContents() {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Don't log invalid teams to console
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 60961c54e870148b5c649045e7347ca1064b6bde..0ce25857188029335d0afd0a9f0c22b79d4b0b69 100644 index 168b002377e258f84a3bb86dd8e4a5f42060e3e0..065d2c1543832190bd8bdcd4b553542115c07e64 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -869,7 +869,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -861,7 +861,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam); boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam);
if (!flag) { if (!flag) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index eaad15a4d201356c34c1a09c7fbe5c35f76a2176..e166411e05287d97ea7c9d35b19d4ae3106401c3 100644 index 66cf0a6cd1525ecf2615809210a26d55f445d07d..74fb79d4ea11f88f2c0de65b492a5fecc49684f1 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java --- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -280,6 +280,13 @@ public abstract class HangingEntity extends Entity { @@ -270,6 +270,13 @@ public abstract class HangingEntity extends Entity {
public void readAdditionalSaveData(CompoundTag nbt) { public void readAdditionalSaveData(CompoundTag nbt) {
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ")); BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));

View File

@@ -1,35 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net> From: Allink <arclicious@vivaldi.net>
Date: Sun, 10 Dec 2023 18:11:55 -0600 Date: Mon, 4 Jul 2022 22:12:19 +0100
Subject: [PATCH] Add MasterBlockFireEvent Subject: [PATCH] Add MasterBlockFireEvent
diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java diff --git a/src/main/java/net/minecraft/world/level/block/CommandBlock.java b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead72509dc67b8 100644 index 2e7c03b00bc941b86df6a7f1b2b188c9f0aede22..0ae03d3934ad7b2b38afa45a65c7753dcbe796d2 100644
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java --- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
@@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils; @@ -1,5 +1,6 @@
import com.mojang.serialization.Codec; package net.minecraft.world.level.block;
import com.mojang.serialization.MapCodec;
import com.mojang.serialization.codecs.RecordCodecBuilder; +import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; import com.mojang.logging.LogUtils;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; @@ -25,6 +26,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
@@ -28,6 +29,7 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
+import org.bukkit.Location; +import org.bukkit.Location; // Scissors
import org.slf4j.Logger; import org.slf4j.Logger;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
@@ -130,6 +132,14 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock { @@ -117,6 +119,15 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
} }
private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) { private void execute(BlockState state, Level world, BlockPos pos, BaseCommandBlock executor, boolean hasCommand) {
+ // Scissors start - Add master block fire event + // Scissors start - Add master block fire event
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); + final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()));
+
+ if (!event.callEvent()) + if (!event.callEvent())
+ { + {
+ return; + return;
@@ -40,27 +40,26 @@ index 7ef14e4441a329c680a5dfe4bfb5033ffcb8f9d5..eff5bdf00b0aa7a9925ff59a62ead725
executor.performCommand(world); executor.performCommand(world);
} else { } else {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d5437f3929dd 100644 index 182e16c1d968707a11329150d71b7d01df6c6e52..8582a9369cffe0eebeb82a81fc413d0bf4ad28ed 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java
@@ -2,6 +2,8 @@ package net.minecraft.world.level.block.entity; @@ -2,6 +2,7 @@ package net.minecraft.world.level.block.entity;
import java.util.Arrays; import java.util.Arrays;
import java.util.Optional; import java.util.Optional;
+ +import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder; import net.minecraft.core.Holder;
import net.minecraft.core.Registry; import net.minecraft.core.Registry;
@@ -17,6 +19,7 @@ import net.minecraft.world.level.block.JigsawBlock; @@ -17,6 +18,7 @@ import net.minecraft.world.level.block.JigsawBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement; import net.minecraft.world.level.levelgen.structure.pools.JigsawPlacement;
import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool;
+import org.bukkit.Location; +import org.bukkit.Location; // Scissors
public class JigsawBlockEntity extends BlockEntity { public class JigsawBlockEntity extends BlockEntity {
public static final String TARGET = "target"; public static final String TARGET = "target";
@@ -134,6 +137,16 @@ public class JigsawBlockEntity extends BlockEntity { @@ -107,6 +109,16 @@ public class JigsawBlockEntity extends BlockEntity {
} }
public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) { public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) {
@@ -78,27 +77,26 @@ index 447b0359922011fe12b1bb9628d23a47c9d7dc89..0d6be671e1512074ae1265fe93a5d543
Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL); Registry<StructureTemplatePool> registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL);
// Paper start - Replace getHolderOrThrow with a null check // Paper start - Replace getHolderOrThrow with a null check
diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dbac6c2b229 100644 index e8ecced687261861953899a3bea162dbc03977b4..30720203173b23ccdbb0789f7e2adbbe180c7c69 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/StructureBlockEntity.java
@@ -5,6 +5,8 @@ import java.util.Objects; @@ -5,6 +5,7 @@ import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.event.block.MasterBlockFireEvent; // Scissors
+import me.totalfreedom.scissors.event.block.MasterBlockFireEvent;
import net.minecraft.ResourceLocationException; import net.minecraft.ResourceLocationException;
import net.minecraft.Util; import net.minecraft.Util;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@@ -29,6 +31,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce @@ -29,6 +30,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.BlockRotProce
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
+import org.bukkit.Location; +import org.bukkit.Location; // Scissors
public class StructureBlockEntity extends BlockEntity { public class StructureBlockEntity extends BlockEntity {
private static final int SCAN_CORNER_BLOCKS_RANGE = 5; private static final int SCAN_CORNER_BLOCKS_RANGE = 5;
@@ -259,7 +262,7 @@ public class StructureBlockEntity extends BlockEntity { @@ -264,7 +266,7 @@ public class StructureBlockEntity extends BlockEntity {
return false; return false;
} else { } else {
BlockPos blockPos = this.getBlockPos(); BlockPos blockPos = this.getBlockPos();
@@ -107,10 +105,10 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80); BlockPos blockPos2 = new BlockPos(blockPos.getX() - 80, this.level.getMinBuildHeight(), blockPos.getZ() - 80);
BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80); BlockPos blockPos3 = new BlockPos(blockPos.getX() + 80, this.level.getMaxBuildHeight() - 1, blockPos.getZ() + 80);
Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3); Stream<BlockPos> stream = this.getRelatedCorners(blockPos2, blockPos3);
@@ -316,6 +319,16 @@ public class StructureBlockEntity extends BlockEntity { @@ -321,6 +323,16 @@ public class StructureBlockEntity extends BlockEntity {
if (this.structureName == null) {
return false; public boolean saveStructure(boolean interactive) {
} else { if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) {
+ // Scissors start - Add master block fire event + // Scissors start - Add master block fire event
+ final BlockPos pos = this.getBlockPos(); + final BlockPos pos = this.getBlockPos();
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ())); + final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), pos.getX(), pos.getY(), pos.getZ()));
@@ -124,10 +122,10 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
BlockPos blockPos = this.getBlockPos().offset(this.structurePos); BlockPos blockPos = this.getBlockPos().offset(this.structurePos);
ServerLevel serverLevel = (ServerLevel)this.level; ServerLevel serverLevel = (ServerLevel)this.level;
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager(); StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();
@@ -367,6 +380,16 @@ public class StructureBlockEntity extends BlockEntity { @@ -358,6 +370,16 @@ public class StructureBlockEntity extends BlockEntity {
if (structureTemplate == null) {
return false; public boolean loadStructure(ServerLevel world, boolean interactive) {
} else { if (this.mode == StructureMode.LOAD && this.structureName != null) {
+ // Scissors start - Add master block fire event + // Scissors start - Add master block fire event
+ final BlockPos blockPos = this.getBlockPos(); + final BlockPos blockPos = this.getBlockPos();
+ final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ())); + final MasterBlockFireEvent event = new MasterBlockFireEvent(new Location(this.getLevel().getWorld(), blockPos.getX(), blockPos.getY(), blockPos.getZ()));
@@ -138,10 +136,10 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
+ } + }
+ // Scissors end + // Scissors end
+ +
this.loadStructureInfo(structureTemplate); StructureTemplateManager structureTemplateManager = world.getStructureManager();
return true;
} Optional<StructureTemplate> optional;
@@ -407,6 +430,15 @@ public class StructureBlockEntity extends BlockEntity { @@ -403,6 +425,16 @@ public class StructureBlockEntity extends BlockEntity {
} }
public void unloadStructure() { public void unloadStructure() {
@@ -154,6 +152,7 @@ index 29c59e4a1283ac211b18b953ed6c03834a2587bd..fb385cd66226200ed0b8439cb6659dba
+ return; + return;
+ } + }
+ // Scissors end + // Scissors end
+
if (this.structureName != null) { if (this.structureName != null) {
ServerLevel serverLevel = (ServerLevel)this.level; ServerLevel serverLevel = (ServerLevel)this.level;
StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager(); StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager();

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add spectator teleport event
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 860d33ac56680babd87358b1d7d2216dac3f7865..a60f594b3d7c8c30344f5e888e4309b8f75fdeaf 100644 index 65bb221993147a558995b36fb835f7b82e0eb4bd..4ea2c551d924f976a8de9e2ae521544f323fbec4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@@ -15,7 +15,7 @@ index 860d33ac56680babd87358b1d7d2216dac3f7865..a60f594b3d7c8c30344f5e888e4309b8
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.primitives.Floats; import com.google.common.primitives.Floats;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@@ -2033,6 +2034,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2006,6 +2007,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Entity entity = packet.getEntity(worldserver); Entity entity = packet.getEntity(worldserver);
if (entity != null) { if (entity != null) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Prevent invalid container events
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a60f594b3d7c8c30344f5e888e4309b8f75fdeaf..cfe4f98458c1b1fd311535552b99937d1f319c0e 100644 index 4ea2c551d924f976a8de9e2ae521544f323fbec4..83ae366b4f52261e2e2b65a4183d7ca823edd315 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -29,6 +29,7 @@ import java.util.function.UnaryOperator; @@ -30,6 +30,7 @@ import java.util.function.UnaryOperator;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -16,7 +16,7 @@ index a60f594b3d7c8c30344f5e888e4309b8f75fdeaf..cfe4f98458c1b1fd311535552b99937d
import net.minecraft.ChatFormatting; import net.minecraft.ChatFormatting;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import net.minecraft.Util; import net.minecraft.Util;
@@ -2898,6 +2899,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2900,6 +2901,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return; return;
} }

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Disable running commands in books by default
diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
index 793ab8acd7445984cff2628e3f001661dc20c8e5..0e6e0d6a9c645db0121637262a6cf90172d3c385 100644 index 31911c09fe15753ae32fa39417bdc9e9de552a88..b810a5afcb2343174e37efb7dd8a36b968b07c3a 100644
--- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java --- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java
+++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java +++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java
@@ -2,6 +2,7 @@ package net.minecraft.world.item; @@ -2,6 +2,7 @@ package net.minecraft.world.item;
@@ -26,7 +26,7 @@ index 793ab8acd7445984cff2628e3f001661dc20c8e5..0e6e0d6a9c645db0121637262a6cf901
import net.minecraft.stats.Stats; import net.minecraft.stats.Stats;
import net.minecraft.util.StringUtil; import net.minecraft.util.StringUtil;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
@@ -162,9 +162,43 @@ public class WrittenBookItem extends Item { @@ -161,9 +161,43 @@ public class WrittenBookItem extends Item {
component2 = Component.literal(text); component2 = Component.literal(text);
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Validate block entity/entity tag query positions
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cfe4f98458c1b1fd311535552b99937d1f319c0e..adbb1036913ba6299f2093c84480e4147a36b344 100644 index 83ae366b4f52261e2e2b65a4183d7ca823edd315..67b5447ffcf54c54b2087df456690a9bed98fbd3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1278,7 +1278,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1262,7 +1262,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (this.player.hasPermissions(2)) { if (this.player.hasPermissions(2)) {
Entity entity = this.player.level().getEntity(packet.getEntityId()); Entity entity = this.player.level().getEntity(packet.getEntityId());
@@ -17,7 +17,7 @@ index cfe4f98458c1b1fd311535552b99937d1f319c0e..adbb1036913ba6299f2093c84480e414
CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag()); CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag());
this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound)); this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound));
@@ -1310,7 +1310,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1274,7 +1274,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) { public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@@ -1,21 +1,21 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net> From: Allink <arclicious@vivaldi.net>
Date: Tue, 23 Jan 2024 19:04:22 -0600 Date: Wed, 13 Jul 2022 12:13:22 +0100
Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions Subject: [PATCH] Fix ClickEvents on Signs bypassing permissions
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e24da8561 100644 index 38cde466714e5663cd416b6afd5d2558e139ec09..ed48eaae75e709361a260421934b6b925ae9b427 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -8,8 +8,10 @@ import java.util.Objects; @@ -8,8 +8,10 @@ import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import java.util.function.UnaryOperator; import java.util.function.UnaryOperator;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+import me.totalfreedom.scissors.ScissorsConfig; +import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import net.minecraft.commands.CommandSource; import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
+import net.minecraft.commands.Commands; +import net.minecraft.commands.Commands; // Scissors
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtOps; import net.minecraft.nbt.NbtOps;
@@ -23,23 +23,30 @@ index 927c7ea03560be0c86884cec70ee8e408e66cb07..c4bb1739ddcfd473ef788f97afa1019e
import net.minecraft.network.chat.ComponentUtils; import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer; // Scissors
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.FilteredText; import net.minecraft.server.network.FilteredText;
@@ -32,6 +35,8 @@ import net.minecraft.world.level.block.SignBlock; @@ -30,6 +33,7 @@ import net.minecraft.world.level.block.SignBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec2;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
+import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.craftbukkit.entity.CraftHumanEntity; // Scissors
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.bukkit.block.sign.Side; import org.bukkit.block.sign.Side;
import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.block.CraftBlock;
@@ -289,6 +294,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -37,6 +41,7 @@ import org.bukkit.craftbukkit.util.CraftChatMessage;
import org.bukkit.entity.Player;
import org.bukkit.event.block.SignChangeEvent;
// CraftBukkit end
+import org.bukkit.craftbukkit.CraftServer; // Scissors
public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements
@@ -291,6 +296,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
} }
player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage()); player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage());
// Paper end - Fix commands from signs not firing command events // Paper end
+ // Scissors start - Add optional permissions to command signs + // Scissors start - Add optional permissions to command signs
+ final MinecraftServer vanillaServer = player.getServer(); + final MinecraftServer vanillaServer = player.getServer();
+ final CraftServer craftServer = vanillaServer.server; + final CraftServer craftServer = vanillaServer.server;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Refuse to convert legacy messages over 1k characters
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
index 753200057e74b8e2d5274894b982e6ee946a559e..25df28c8a2061a754cb576634b63d5ca6e5011d1 100644 index 0f70be614f8f5350ad558d0ae645cdf0027e1e76..c006ac8531cf2c029fd2fac449f96736a4afed0d 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java
@@ -198,6 +198,7 @@ public final class CraftChatMessage { @@ -199,6 +199,7 @@ public final class CraftChatMessage {
} }
public static Component[] fromString(String message, boolean keepNewlines, boolean plain) { public static Component[] fromString(String message, boolean keepNewlines, boolean plain) {

View File

@@ -1,44 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net> From: Allink <arclicious@vivaldi.net>
Date: Sun, 10 Dec 2023 18:41:18 -0600 Date: Sun, 27 Nov 2022 05:14:18 +0000
Subject: [PATCH] Prevent velocity freeze Subject: [PATCH] Prevent velocity freeze
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
index 20ce474b72894a8bb3fc21018b9d79bbdc8bb14b..b5c87bb5f5d3526600520913f04cfc6614a62b81 100644 index 6c9a8f062f989db022154155e8a05b334a0510da..978fad27ad17de03d108ade2c2bfa464b7d83491 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java
@@ -1,6 +1,8 @@ @@ -1,5 +1,6 @@
package net.minecraft.world.entity.projectile; package net.minecraft.world.entity.projectile;
import javax.annotation.Nullable; +import me.totalfreedom.scissors.MathUtility; // Scissors
+
+import me.totalfreedom.scissors.MathUtility;
import net.minecraft.core.particles.ParticleOptions; import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
@@ -50,12 +52,15 @@ public abstract class AbstractHurtingProjectile extends Projectile { @@ -41,9 +42,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
// CraftBukkit end
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5); double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
- if (d6 != 0.0D) { if (d6 != 0.0D) {
- this.xPower = d3 / d6 * 0.1D; - this.xPower = d3 / d6 * 0.1D;
- this.yPower = d4 / d6 * 0.1D; - this.yPower = d4 / d6 * 0.1D;
- this.zPower = d5 / d6 * 0.1D; - this.zPower = d5 / d6 * 0.1D;
+ if (d6 != 0.0D)
+ {
+ // Scissors start - Prevent projectile velocity freeze + // Scissors start - Prevent projectile velocity freeze
+ //this.xPower = d3 / d6 * 0.1D; + //this.xPower = d3 / d6 * 0.1D;
+ //this.yPower = d4 / d6 * 0.1D; + //this.yPower = d4 / d6 * 0.1D;
+ //this.zPower = d5 / d6 * 0.1D; + //this.zPower = d5 / d6 * 0.1D;
+
+ setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d); + setPower(d3 / d6 * .1d, d4 / d6 * .1d, d5 / d6 * .1d);
}
-
+ // Scissors end + // Scissors end
} }
public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> type, LivingEntity owner, double directionX, double directionY, double directionZ, Level world) { }
@@ -167,6 +172,25 @@ public abstract class AbstractHurtingProjectile extends Projectile { @@ -141,6 +146,25 @@ public abstract class AbstractHurtingProjectile extends Projectile {
nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower})); nbt.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower}));
} }
@@ -64,7 +58,7 @@ index 20ce474b72894a8bb3fc21018b9d79bbdc8bb14b..b5c87bb5f5d3526600520913f04cfc66
@Override @Override
public void readAdditionalSaveData(CompoundTag nbt) { public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt); super.readAdditionalSaveData(nbt);
@@ -174,9 +198,13 @@ public abstract class AbstractHurtingProjectile extends Projectile { @@ -148,9 +172,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
ListTag nbttaglist = nbt.getList("power", 6); ListTag nbttaglist = nbt.getList("power", 6);
if (nbttaglist.size() == 3) { if (nbttaglist.size() == 3) {
@@ -81,7 +75,7 @@ index 20ce474b72894a8bb3fc21018b9d79bbdc8bb14b..b5c87bb5f5d3526600520913f04cfc66
} }
} }
@@ -210,9 +238,13 @@ public abstract class AbstractHurtingProjectile extends Projectile { @@ -184,9 +212,13 @@ public abstract class AbstractHurtingProjectile extends Projectile {
Vec3 vec3d = entity.getLookAngle(); Vec3 vec3d = entity.getLookAngle();
this.setDeltaMovement(vec3d); this.setDeltaMovement(vec3d);

View File

@@ -1,30 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Allink <arclicious@vivaldi.net>
Date: Mon, 15 Apr 2024 23:01:26 -0500 Date: Tue, 31 Jan 2023 23:16:52 +0000
Subject: [PATCH] Add configuration option to disable chat signatures Subject: [PATCH] Add configuration option to disable chat signatures
diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
index c87b708c368713a23a10ad97704575ee4df27891..a650bdccc7f8fe77abe2750c9939f5eb0ccfd57b 100644 index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..516c61cbb8299828b2f28d4564d08ae1829649b5 100644
--- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java --- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
+++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
package net.minecraft.network.chat; package net.minecraft.network.chat;
+import me.totalfreedom.scissors.ScissorsConfig; +import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
public interface OutgoingChatMessage { public interface OutgoingChatMessage {
@@ -46,9 +47,20 @@ public interface OutgoingChatMessage { @@ -44,10 +45,21 @@ public interface OutgoingChatMessage {
// Paper end // Paper end
PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled); PlayerChatMessage playerChatMessage = this.message.filter(filterMaskEnabled);
playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper playerChatMessage = unsigned != null ? playerChatMessage.withUnsignedContent(unsigned) : playerChatMessage; // Paper
- if (!playerChatMessage.isFullyFiltered()) { - if (!playerChatMessage.isFullyFiltered()) {
+ // Sccissors start + // Scissors start
+ if (!playerChatMessage.isFullyFiltered() && ScissorsConfig.chatSignaturesEnabled) { + if (!playerChatMessage.isFullyFiltered() && ScissorsConfig.chatSignaturesEnabled) {
sender.connection.sendPlayerChatMessage(playerChatMessage, params); sender.connection.sendPlayerChatMessage(playerChatMessage, params);
+ return; + return;
} }
+ sender.connection.sendPlayerChatMessage(new PlayerChatMessage( + sender.connection.sendPlayerChatMessage(new PlayerChatMessage(
+ SignedMessageLink.unsigned(playerChatMessage.sender()), + SignedMessageLink.unsigned(playerChatMessage.sender()),
+ null, + null,
@@ -38,48 +39,47 @@ index c87b708c368713a23a10ad97704575ee4df27891..a650bdccc7f8fe77abe2750c9939f5eb
} }
} }
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
index 0af9ed92824ccf30814eceb6a2c2e5c12661c991..c92374104b4aed2f952b250c5559ab9cc83532da 100644 index c0a80824a0307ea673805015119cc834b268f0dc..9f28f86b1b56ea55ab39f6ac988c1f47c5312c6c 100644
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java --- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java +++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
@@ -5,6 +5,8 @@ import java.time.Instant; @@ -4,6 +4,7 @@ import com.mojang.logging.LogUtils;
import java.time.Instant;
import java.util.UUID; import java.util.UUID;
import java.util.function.BooleanSupplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.ScissorsConfig; // Scissors
+import me.totalfreedom.scissors.ScissorsConfig; import net.minecraft.util.SignatureUpdater;
import net.minecraft.util.SignatureValidator; import net.minecraft.util.SignatureValidator;
import net.minecraft.util.Signer; import net.minecraft.util.Signer;
import net.minecraft.world.entity.player.ProfilePublicKey; @@ -41,7 +42,7 @@ public class SignedMessageChain {
@@ -45,7 +47,7 @@ public class SignedMessageChain {
if (!playerChatMessage.verify(signatureValidator)) { if (!playerChatMessage.verify(signatureValidator)) {
throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes
} else { } else {
- if (playerChatMessage.hasExpiredServer(Instant.now())) { - if (playerChatMessage.hasExpiredServer(Instant.now())) {
+ if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors + if (playerChatMessage.hasExpiredServer(Instant.now()) && ScissorsConfig.chatSignaturesEnabled) { // Scissors
LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content()); LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", (Object)body.content());
} }
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a 100644 index 67b5447ffcf54c54b2087df456690a9bed98fbd3..94cc122aad0e48687ea9f25cd810f07dc893acc6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
package net.minecraft.server.network; package net.minecraft.server.network;
+import me.totalfreedom.scissors.ScissorsConfig; +import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.primitives.Floats; import com.google.common.primitives.Floats;
@@ -2243,7 +2244,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2220,7 +2221,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
}
private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) {
ServerGamePacketListenerImpl.LOGGER.warn("Failed to update secure chat state for {}: '{}'", this.player.getGameProfile().getName(), exception.getComponent().getString());
- if (exception.shouldDisconnect()) { - if (exception.shouldDisconnect()) {
+ if (exception.shouldDisconnect() && ScissorsConfig.chatSignaturesEnabled) { // Scissors - Do not kick when chat signatures are disabled + if (exception.shouldDisconnect() && ScissorsConfig.chatSignaturesEnabled) { // Scissors - Do not kick when chat signatures are disabled
this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes
} else { } else {
this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED));
@@ -2291,6 +2292,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2276,6 +2277,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment); Optional<LastSeenMessages> optional = this.lastSeenMessages.applyUpdate(acknowledgment);
if (optional.isEmpty()) { if (optional.isEmpty()) {
@@ -87,7 +87,7 @@ index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
} }
@@ -2489,6 +2491,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -2484,6 +2486,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
synchronized (this.lastSeenMessages) { synchronized (this.lastSeenMessages) {
if (!this.lastSeenMessages.applyOffset(packet.offset())) { if (!this.lastSeenMessages.applyOffset(packet.offset())) {
@@ -95,7 +95,7 @@ index adbb1036913ba6299f2093c84480e4147a36b344..8d5f4f2a0589c9c34dcff0ca95b6222b
ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString());
this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes this.disconnect(ServerGamePacketListenerImpl.CHAT_VALIDATION_FAILED, org.bukkit.event.player.PlayerKickEvent.Cause.CHAT_VALIDATION_FAILED); // Paper - kick event causes
} }
@@ -3460,6 +3463,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -3462,6 +3465,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) { public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@@ -1,47 +1,49 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com> From: Luna <lunahatesgogle@gmail.com>
Date: Sun, 10 Dec 2023 18:57:50 -0600 Date: Sun, 2 Apr 2023 16:29:51 -0300
Subject: [PATCH] Patch large selector distance crash Subject: [PATCH] Patch large selector distance crash
diff --git a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java diff --git a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
index f62640152027b874d4266d868574af062bd684d7..f94385837d5ed1ef52458b73410df5fd186d66e2 100644 index 8897496323378080135127f53db004d576476c21..5f957d3241c1931f8166bc9e4960cef15679e932 100644
--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java --- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java +++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java
@@ -123,11 +123,11 @@ public interface MinMaxBounds<T extends Number> { @@ -129,9 +129,9 @@ public interface MinMaxBounds<T extends Number> {
public static record Doubles(@Override Optional<Double> min, @Override Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq)
implements MinMaxBounds<Double> { public static record Doubles(Optional<Double> min, Optional<Double> max, Optional<Double> minSq, Optional<Double> maxSq) implements MinMaxBounds<Double> {
public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty()); public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty());
- public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); - public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new);
+ public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.<Double, MinMaxBounds.Doubles>createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); // Scissors - compile fixes + public static final Codec<MinMaxBounds.Doubles> CODEC = MinMaxBounds.<Double, MinMaxBounds.Doubles>createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); // Scissors - compile fixes
- private Doubles(Optional<Double> min, Optional<Double> max) { - private Doubles(Optional<Double> optional, Optional<Double> optional2) {
+ public Doubles(Optional<Double> min, Optional<Double> max) { + public Doubles(Optional<Double> optional, Optional<Double> optional2) { // Scissors - private -> public
this(min, max, squareOpt(min), squareOpt(max)); this(optional, optional2, squareOpt(optional), squareOpt(optional2));
- } }
+ } // Scissors - private -> public
private static MinMaxBounds.Doubles create(StringReader reader, Optional<Double> min, Optional<Double> max) throws CommandSyntaxException { @@ -202,7 +202,7 @@ public interface MinMaxBounds<T extends Number> {
if (min.isPresent() && max.isPresent() && min.get() > max.get()) {
@@ -179,7 +179,7 @@ public interface MinMaxBounds<T extends Number> { public static record Ints(Optional<Integer> min, Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq) implements MinMaxBounds<Integer> {
public static record Ints(@Override Optional<Integer> min, @Override Optional<Integer> max, Optional<Long> minSq, Optional<Long> maxSq)
implements MinMaxBounds<Integer> {
public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty()); public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty());
- public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new); - public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new);
+ public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.<Integer, MinMaxBounds.Ints>createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes + public static final Codec<MinMaxBounds.Ints> CODEC = MinMaxBounds.<Integer, MinMaxBounds.Ints>createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes
private Ints(Optional<Integer> min, Optional<Integer> max) { private Ints(Optional<Integer> optional, Optional<Integer> optional2) {
this(min, max, min.map(i -> i.longValue() * i.longValue()), squareOpt(max)); this(optional, optional2, optional.map((integer) -> {
diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
index 676a1499747b071515479130875157263d3a8352..6a65850101b8ea348a4bfeaeca805a39987b06fc 100644 index 73c15a0c56a103ba4e62f0a51af8d42566b07245..6cb3e86f2d661a55536b782729f768ef72163223 100644
--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -10,6 +10,8 @@ import java.util.function.BiConsumer; @@ -5,11 +5,13 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.Optional; // Scissors
import java.util.UUID;
import java.util.function.BiConsumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import javax.annotation.Nullable; import javax.annotation.Nullable;
+ +import me.totalfreedom.scissors.MathUtility; // Scissors
+import me.totalfreedom.scissors.MathUtility;
import net.minecraft.advancements.critereon.MinMaxBounds; import net.minecraft.advancements.critereon.MinMaxBounds;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.arguments.EntityArgument; import net.minecraft.commands.arguments.EntityArgument;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Patch invalid entity rotation log spam
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2ecf2d8ff546ed097cb3b547db22d28a31d29ec4..36b1a1cc66b9852d3b10c09cbf39262f51996663 100644 index e8845d6ec1bcba6df2eb8e1af0d658b10299831a..015d5e9b6de5f1fb466e1801bdf5fb430ba91f35 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4751,7 +4751,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -4696,7 +4696,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void setXRot(float pitch) { public void setXRot(float pitch) {
if (!Float.isFinite(pitch)) { if (!Float.isFinite(pitch)) {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Limit sculk catalyst cursor positions
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
index 01e13e6d3ebd84cff0019f56efff16747420dc95..d4058bc31ca291cbc95eeef594fc35e1ff6a3dde 100644 index de90a216321f7d82310a0d1c915fefe64360534c..7e52f6c26234cf6fa092151d51c0c6b70dc22ca8 100644
--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java --- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
+++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java +++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java
@@ -181,7 +181,7 @@ public class SculkSpreader { @@ -181,7 +181,7 @@ public class SculkSpreader {

View File

@@ -5,21 +5,21 @@ Subject: [PATCH] Limit map decorations
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
index 02e3d1c9c18952ba53507f7b6887fd3c81af33a9..61573844b236838fd219526ea35df8c7b0c94026 100644 index 81f3e64d94fa17e45411e5c1641d9c5a2fe3d2e2..bcf6e2ce9f00d1688a5fa00ec055a57389346922 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java
@@ -63,7 +63,8 @@ public class ClientboundMapItemDataPacket implements Packet<ClientGamePacketList @@ -65,7 +65,8 @@ public class ClientboundMapItemDataPacket implements Packet<ClientGamePacketList
b.writeByte(icon.x()); b.writeByte(icon.x());
b.writeByte(icon.y()); b.writeByte(icon.y());
b.writeByte(icon.rot() & 15); b.writeByte(icon.rot() & 15);
- b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent); - b.writeNullable(icon.name(), FriendlyByteBuf::writeComponent);
+ final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors + final boolean passedNameCap = icon.name() == null || icon.name().getString().length() <= 32; // Scissors
+ b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors + b.writeNullable(passedNameCap ? icon.name() : null, FriendlyByteBuf::writeComponent); // Scissors
})); });
});
if (this.colorPatch != null) { if (this.colorPatch != null) {
buf.writeByte(this.colorPatch.width);
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 45269115e63cfc3bd7dc740a5694e2cc7c35bcb1..85ea95f55fd6177748edf921e2380142d93b8b06 100644 index e4c4948e076cd64686dfd16ae0568fafc1437140..eff53c21b18574750b691b784fb1688885d4ace7 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -361,6 +361,11 @@ public class MapItemSavedData extends SavedData { @@ -361,6 +361,11 @@ public class MapItemSavedData extends SavedData {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Prevent player banning using duplicate UUIDs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 502bdc726b7890b00ee36871d905dea44e8719e3..1fbc8b372271bb4cd4375ca6b6b1d7e7961094fb 100644 index 3f26fdcc5cbf0a684ad724ab8c042d0053cc187e..c6f36a6b967aeb6ffdf5b099b2692e038401dc79 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1667,7 +1667,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1664,7 +1664,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
if (entity != null) { if (entity != null) {
ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID());
entity.unRide(); entity.unRide();
@@ -17,7 +17,7 @@ index 502bdc726b7890b00ee36871d905dea44e8719e3..1fbc8b372271bb4cd4375ca6b6b1d7e7
+ if (entity instanceof ServerPlayer serverPlayer) { + if (entity instanceof ServerPlayer serverPlayer) {
+ this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED); + this.removePlayerImmediately(serverPlayer, Entity.RemovalReason.DISCARDED);
+ } else { + } else {
+ entity.discard(null); + entity.discard();
+ } + }
+ // Scissors end + // Scissors end
} }

View File

@@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Mon, 29 May 2023 19:34:50 -0300
Subject: [PATCH] Fix component extra empty array exploit
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index 9cb6fa8e35c89f73e7c95dbe219a4bf6d00b60a9..fa6151a2361684426bdd3bf3b433fe4dbd0cf47b 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -266,6 +266,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
if (!jsonelement.isJsonObject()) {
if (jsonelement.isJsonArray()) {
JsonArray jsonarray = jsonelement.getAsJsonArray();
+ if (jsonarray.size() <= 0) throw new JsonParseException("Unexpected empty array of components"); // Scissors
ichatmutablecomponent = null;
Iterator iterator = jsonarray.iterator();

View File

@@ -0,0 +1,125 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Wed, 31 May 2023 18:14:00 -0300
Subject: [PATCH] Add depth limit to Component deserializer
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index fa6151a2361684426bdd3bf3b433fe4dbd0cf47b..4dd93e02f2b18e5c75be14ff8f052220ca69f427 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.Nullable;
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import net.minecraft.ChatFormatting; // Scissors
import net.minecraft.Util;
import net.minecraft.network.chat.contents.BlockDataSource;
@@ -44,6 +45,7 @@ import net.minecraft.util.GsonHelper;
import net.minecraft.util.LowerCaseEnumTypeAdapterFactory;
// CraftBukkit start
import com.google.common.collect.Streams;
+import java.util.regex.Pattern; // Scissors
import java.util.stream.Stream;
// CraftBukkit end
@@ -254,10 +256,16 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
throw new IllegalStateException("Couldn't get field 'lineStart' for JsonReader", nosuchfieldexception);
}
});
+ private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s"); // Scissors
public Serializer() {}
- public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ // Scissors start
+ private MutableComponent deserialize(JsonElement jsonelement, JsonDeserializationContext jsondeserializationcontext, int depth) throws JsonParseException {
+ if (depth > ScissorsConfig.componentDepthLimit) {
+ throw new JsonParseException("Depth limit exceeded");
+ }
+ // Scissors end
if (jsonelement.isJsonPrimitive()) {
return Component.literal(jsonelement.getAsString());
} else {
@@ -273,7 +281,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
while (iterator.hasNext()) {
JsonElement jsonelement1 = (JsonElement) iterator.next();
- MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext);
+ MutableComponent ichatmutablecomponent1 = this.deserialize(jsonelement1, jsondeserializationcontext, depth + 1); // Scissors
if (ichatmutablecomponent == null) {
ichatmutablecomponent = ichatmutablecomponent1;
@@ -297,12 +305,17 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
s = GsonHelper.getAsString(jsonobject, "translate");
String s1 = GsonHelper.getAsString(jsonobject, "fallback", (String) null);
+ // Scissors start - Penalize depth for placeholders in translate & fallback
+ long translate_placeholders = PLACEHOLDER_PATTERN.matcher(s).results().count();
+ long fallback_placeholders = s1 != null ? PLACEHOLDER_PATTERN.matcher(s1).results().count() : 0;
+ int penalty = (int)Math.max(translate_placeholders, fallback_placeholders) * 12;
+ // Scissors end
if (jsonobject.has("with")) {
JsonArray jsonarray1 = GsonHelper.getAsJsonArray(jsonobject, "with");
Object[] aobject = new Object[jsonarray1.size()];
for (int i = 0; i < aobject.length; ++i) {
- aobject[i] = Serializer.unwrapTextArgument(this.deserialize(jsonarray1.get(i), type, jsondeserializationcontext));
+ aobject[i] = Serializer.unwrapTextArgument(this.deserialize(jsonarray1.get(i), jsondeserializationcontext, depth + 1 + penalty)); // Scissors
}
ichatmutablecomponent = Component.translatableWithFallback(s, s1, aobject);
@@ -318,7 +331,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
ichatmutablecomponent = Component.score(GsonHelper.getAsString(jsonobject1, "name"), GsonHelper.getAsString(jsonobject1, "objective"));
} else if (jsonobject.has("selector")) {
- Optional<Component> optional = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
+ Optional<Component> optional = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1); // Scissors
ichatmutablecomponent = Component.selector(GsonHelper.getAsString(jsonobject, "selector"), optional);
} else if (jsonobject.has("keybind")) {
@@ -329,7 +342,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
}
s = GsonHelper.getAsString(jsonobject, "nbt");
- Optional<Component> optional1 = this.parseSeparator(type, jsondeserializationcontext, jsonobject);
+ Optional<Component> optional1 = this.parseSeparator(jsondeserializationcontext, jsonobject, depth + 1); // Scissors
boolean flag = GsonHelper.getAsBoolean(jsonobject, "interpret", false);
Object object;
@@ -356,7 +369,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
}
for (int j = 0; j < jsonarray2.size(); ++j) {
- ichatmutablecomponent.append((Component) this.deserialize(jsonarray2.get(j), type, jsondeserializationcontext));
+ ichatmutablecomponent.append((Component) this.deserialize(jsonarray2.get(j), jsondeserializationcontext, depth + 1)); // Scissors
}
}
@@ -366,6 +379,12 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
}
}
+ // Scissors start
+ public MutableComponent deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException {
+ return this.deserialize(jsonelement, jsondeserializationcontext, 1);
+ }
+ // Scissors end
+
private static Object unwrapTextArgument(Object text) {
if (text instanceof Component) {
Component ichatbasecomponent = (Component) text;
@@ -384,8 +403,10 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
return text;
}
- private Optional<Component> parseSeparator(Type type, JsonDeserializationContext context, JsonObject json) {
- return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), type, context)) : Optional.empty();
+ // Scissors start
+ private Optional<Component> parseSeparator(JsonDeserializationContext context, JsonObject json, int depth) {
+ return json.has("separator") ? Optional.of(this.deserialize(json.get("separator"), context, depth + 1)) : Optional.empty();
+ // Scissors end
}
private void serializeStyle(Style style, JsonObject json, JsonSerializationContext context) {

View File

@@ -1,6 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Allink <arclicious@vivaldi.net>
Date: Mon, 15 Apr 2024 23:27:16 -0500 Date: Fri, 2 Jun 2023 20:55:18 +0100
Subject: [PATCH] Implement command block events Subject: [PATCH] Implement command block events
@@ -18,36 +18,36 @@ index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400
private final boolean trackOutput; private final boolean trackOutput;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc798e431c6a 100644 index 94cc122aad0e48687ea9f25cd810f07dc893acc6..bcb195b1e40f562d0cd5ecca236ebba87150d236 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
package net.minecraft.server.network; package net.minecraft.server.network;
import me.totalfreedom.scissors.ScissorsConfig; import me.totalfreedom.scissors.ScissorsConfig; // Scissors
+import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent; +import me.totalfreedom.scissors.event.block.CommandBlockPlayerEditEvent; // Scissors
+import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent; +import me.totalfreedom.scissors.event.block.CommandMinecartPlayerEditEvent; // Scissors
import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.primitives.Floats; import com.google.common.primitives.Floats;
@@ -155,6 +157,7 @@ import net.minecraft.world.entity.player.Inventory; @@ -154,6 +156,7 @@ import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.ProfilePublicKey; import net.minecraft.world.entity.player.ProfilePublicKey;
import net.minecraft.world.entity.projectile.AbstractArrow; import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.vehicle.Boat; import net.minecraft.world.entity.vehicle.Boat;
+import net.minecraft.world.entity.vehicle.MinecartCommandBlock; +import net.minecraft.world.entity.vehicle.MinecartCommandBlock; // Scissors
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.inventory.AnvilMenu; import net.minecraft.world.item.BucketItem;
import net.minecraft.world.inventory.BeaconMenu; import net.minecraft.world.item.Item;
@@ -189,6 +192,8 @@ import net.minecraft.world.phys.Vec3; @@ -181,6 +184,8 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp; import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
+import org.bukkit.craftbukkit.block.CraftCommandBlock; +import org.bukkit.craftbukkit.block.CraftCommandBlock; // Scissors
+import org.bukkit.craftbukkit.entity.CraftMinecartCommand; +import org.bukkit.craftbukkit.entity.CraftMinecartCommand; // Scissors
import org.slf4j.Logger; import org.slf4j.Logger;
// CraftBukkit start // CraftBukkit start
@@ -905,6 +910,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -893,6 +898,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity); this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity);
} }
@@ -64,7 +64,7 @@ index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc79
commandblocklistenerabstract.setCommand(s); commandblocklistenerabstract.setCommand(s);
commandblocklistenerabstract.setTrackOutput(flag); commandblocklistenerabstract.setTrackOutput(flag);
if (!flag) { if (!flag) {
@@ -936,7 +951,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -924,7 +939,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level());
if (commandblocklistenerabstract != null) { if (commandblocklistenerabstract != null) {
@@ -79,6 +79,7 @@ index 88c98ba7673808819b8f85876f22743bc3a4f471..f96c0c5007d9e1d86bfe27518815dc79
+ +
+ command = event.getNewCommand(); + command = event.getNewCommand();
+ commandblocklistenerabstract.setCommand(command); + commandblocklistenerabstract.setCommand(command);
+
+ // Scissors end + // Scissors end
commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput()); commandblocklistenerabstract.setTrackOutput(packet.isTrackOutput());
if (!packet.isTrackOutput()) { if (!packet.isTrackOutput()) {

View File

@@ -1,17 +1,17 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me> From: Allink <arclicious@vivaldi.net>
Date: Mon, 15 Apr 2024 23:40:27 -0500 Date: Fri, 2 Jun 2023 22:13:54 +0100
Subject: [PATCH] Add depth limit to SNBT Subject: [PATCH] Add depth limit to SNBT
diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java
index c77860a141064aea6a0b510bb44d35fea90aee42..3be3dd61b8a27b3a8ca3c72ae5ffa2ea8fa00231 100644 index ee012f1ef1ff7f2adf76d1690dbd5611af7deb4d..d79723047317c24c53fb85c423de8dd9f84891ac 100644
--- a/src/main/java/net/minecraft/nbt/TagParser.java --- a/src/main/java/net/minecraft/nbt/TagParser.java
+++ b/src/main/java/net/minecraft/nbt/TagParser.java +++ b/src/main/java/net/minecraft/nbt/TagParser.java
@@ -184,9 +184,47 @@ public class TagParser { @@ -179,9 +179,56 @@ public class TagParser {
}
this.expect('}'); this.expect('}');
this.depth--; // Paper
- return compoundTag; - return compoundTag;
+ return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag; // Scissors - Add depth limit to SNBT + return exceedsDepthLimit(compoundTag) ? new CompoundTag() : compoundTag; // Scissors - Add depth limit to SNBT
} }
@@ -21,30 +21,39 @@ index c77860a141064aea6a0b510bb44d35fea90aee42..3be3dd61b8a27b3a8ca3c72ae5ffa2ea
+ return this.exceedsDepthLimit(0, tag); + return this.exceedsDepthLimit(0, tag);
+ } + }
+ +
+ private boolean exceedsDepthLimit(long depth, Tag tag) { + private boolean exceedsDepthLimit(long depth, Tag tag)
+ if (depth > 256) { + {
+ if (depth > 256)
+ {
+ return true; + return true;
+ } + }
+ +
+ if (tag instanceof ListTag listTag) { + if (tag instanceof ListTag listTag)
+ for (Tag childTag : listTag) { + {
+ for (Tag childTag : listTag)
+ {
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag); + boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
+ +
+ if (returnValue) { + if (returnValue)
+ {
+ return true; + return true;
+ } + }
+ } + }
+ } else if (tag instanceof CompoundTag compoundTag) { + } else if (tag instanceof CompoundTag compoundTag)
+ for (String key : compoundTag.getAllKeys()) { + {
+ for (String key: compoundTag.getAllKeys())
+ {
+ Tag childTag = compoundTag.get(key); + Tag childTag = compoundTag.get(key);
+ +
+ if (childTag == null) { + if (childTag == null)
+ {
+ continue; + continue;
+ } + }
+ +
+ boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag); + boolean returnValue = this.exceedsDepthLimit(depth + 1, childTag);
+ +
+ if (returnValue) { + if (returnValue)
+ {
+ return true; + return true;
+ } + }
+ } + }
@@ -57,45 +66,45 @@ index c77860a141064aea6a0b510bb44d35fea90aee42..3be3dd61b8a27b3a8ca3c72ae5ffa2ea
private Tag readListTag() throws CommandSyntaxException { private Tag readListTag() throws CommandSyntaxException {
this.expect('['); this.expect('[');
this.reader.skipWhitespace(); this.reader.skipWhitespace();
@@ -220,7 +258,7 @@ public class TagParser { @@ -213,7 +260,7 @@ public class TagParser {
}
this.expect(']'); this.expect(']');
this.depth--; // Paper
- return listTag; - return listTag;
+ return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT + return exceedsDepthLimit(listTag) ? new ListTag() : listTag; // Scissors - Add depth limit to SNBT
} }
} }
@@ -245,7 +283,7 @@ public class TagParser { @@ -238,7 +285,7 @@ public class TagParser {
} }
private <T extends Number> List<T> readArray(TagType<?> arrayTypeReader, TagType<?> typeReader) throws CommandSyntaxException { private <T extends Number> List<T> readArray(TagType<?> arrayTypeReader, TagType<?> typeReader) throws CommandSyntaxException {
- List<T> list = Lists.newArrayList(); - List<T> list = Lists.newArrayList();
+ List<Number> list = Lists.newArrayList(); // Scissors - List<T> -> List<Number> + List<Number> list = Lists.newArrayList(); // Scissors - List<T> -> List<Number>
while (this.reader.peek() != ']') { while(true) {
int i = this.reader.getCursor(); if (this.reader.peek() != ']') {
@@ -257,11 +295,11 @@ public class TagParser { @@ -251,11 +298,11 @@ public class TagParser {
} }
if (typeReader == ByteTag.TYPE) { if (typeReader == ByteTag.TYPE) {
- list.add((T)(Byte)((NumericTag)tag).getAsByte()); // Paper - decompile fix - list.add((T)((NumericTag)tag).getAsByte());
+ list.add(((NumericTag)tag).getAsByte()); // Scissors - Remove (T) cast + list.add(((NumericTag)tag).getAsByte()); // Scissors - Remove (T) cast
} else if (typeReader == LongTag.TYPE) { } else if (typeReader == LongTag.TYPE) {
- list.add((T)(Long)((NumericTag)tag).getAsLong()); // Paper - decompile fix - list.add((T)((NumericTag)tag).getAsLong());
+ list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast + list.add(((NumericTag)tag).getAsLong()); // Scissors - Remove (T) cast
} else { } else {
- list.add((T)(Integer)((NumericTag)tag).getAsInt()); // Paper - decompile fix - list.add((T)((NumericTag)tag).getAsInt());
+ list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast + list.add(((NumericTag)tag).getAsInt()); // Scissors - Remove (T) cast
} }
if (!this.hasElementSeparator()) { if (this.hasElementSeparator()) {
@@ -274,7 +312,7 @@ public class TagParser { @@ -267,7 +314,7 @@ public class TagParser {
} }
this.expect(']'); this.expect(']');
- return list; - return list;
+ return (List<T>) list; // Scissors - Cast to List<T> + return (List<T>) list; // Scissors - Cast to List<T>
} }
}
private boolean hasElementSeparator() {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Limit beacon effectRange
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index 4b81b0180dfc96fc6a88646838a886ca5b5d301b..63ea77b3e965ff18571492d511ef7c1082441f9d 100644 index f13943db6f2fb923c52dcf9e8bf7000041d0a362..2fdcc47dd6a813d5f7a32dc58ca67b6b965c8749 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -87,7 +87,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -87,7 +87,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
@@ -20,7 +20,7 @@ index 4b81b0180dfc96fc6a88646838a886ca5b5d301b..63ea77b3e965ff18571492d511ef7c10
@@ -456,6 +456,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name @@ -456,6 +456,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name
this.lockKey = LockCode.fromTag(nbt); this.lockKey = LockCode.fromTag(nbt);
this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper - Custom beacon ranges this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper
+ if (this.effectRange > 256) this.effectRange = 256; // Scissors + if (this.effectRange > 256) this.effectRange = 256; // Scissors
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Don't log on too many chained updates
diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java 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..ecdcf4cf8650270ce7595905ce9d498eee520dcd 100644 index 598dc0d3a2b9387e76d7e4e19e54c4573a24bc54..9eed28bf8bc7e2fa528729cde01a535bc7040815 100644
--- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java --- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
+++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java
@@ -58,7 +58,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { @@ -56,7 +56,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater {
this.stack.push(entry); this.stack.push(entry);
} }
} else if (this.count - 1 == this.maxChainedNeighborUpdates) { } else if (this.count - 1 == this.maxChainedNeighborUpdates) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Fix packet-related lag exploits
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a..88c98ba7673808819b8f85876f22743bc3a4f471 100644 index bcb195b1e40f562d0cd5ecca236ebba87150d236..fee0a88c6ccecd71ebf63651655dec2d5097f894 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -865,7 +865,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -858,7 +858,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.sendSystemMessage(Component.translatable("advMode.notEnabled")); this.player.sendSystemMessage(Component.translatable("advMode.notEnabled"));
} else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission } else if (!this.player.canUseGameMasterBlocks() && (!this.player.isCreative() || !this.player.getBukkitEntity().hasPermission("minecraft.commandblock"))) { // Paper - command block permission
this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); this.player.sendSystemMessage(Component.translatable("advMode.notAllowed"));
@@ -17,7 +17,7 @@ index 8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a..88c98ba7673808819b8f85876f22743b
BaseCommandBlock commandblocklistenerabstract = null; BaseCommandBlock commandblocklistenerabstract = null;
CommandBlockEntity tileentitycommand = null; CommandBlockEntity tileentitycommand = null;
BlockPos blockposition = packet.getPos(); BlockPos blockposition = packet.getPos();
@@ -1013,7 +1013,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1025,7 +1025,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) { public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -26,7 +26,7 @@ index 8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a..88c98ba7673808819b8f85876f22743b
BlockPos blockposition = packet.getPos(); BlockPos blockposition = packet.getPos();
BlockState iblockdata = this.player.level().getBlockState(blockposition); BlockState iblockdata = this.player.level().getBlockState(blockposition);
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
@@ -1071,7 +1071,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1083,7 +1083,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) { public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
@@ -35,7 +35,7 @@ index 8d5f4f2a0589c9c34dcff0ca95b6222b90f7d09a..88c98ba7673808819b8f85876f22743b
BlockPos blockposition = packet.getPos(); BlockPos blockposition = packet.getPos();
BlockState iblockdata = this.player.level().getBlockState(blockposition); BlockState iblockdata = this.player.level().getBlockState(blockposition);
BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
@@ -1096,7 +1096,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -1106,7 +1106,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override @Override
public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) { public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());

View File

@@ -1,117 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Focusvity <nathan.curran10012@gmail.com>
Date: Mon, 5 Feb 2024 19:39:23 +1100
Subject: [PATCH] Add depth limit to Component deserialization
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index ae84d06564b2560e13404f6d89f88ad71dbc2cc6..df3c03aeaee5c12c5d57584535c9c7aa01be7dd3 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -3,9 +3,11 @@ package net.minecraft.network.chat;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
+import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import com.google.gson.JsonSerializationContext;
@@ -13,6 +15,7 @@ import com.google.gson.JsonSerializer;
import com.google.gson.stream.JsonReader;
import com.mojang.brigadier.Message;
import com.mojang.serialization.JsonOps;
+
import java.io.StringReader;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -23,6 +26,9 @@ import java.util.List;
import java.util.Optional;
import java.util.UUID;
import javax.annotation.Nullable;
+
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
+import net.minecraft.ChatFormatting;
import net.minecraft.Util;
import net.minecraft.network.chat.contents.DataSource;
import net.minecraft.network.chat.contents.KeybindContents;
@@ -33,8 +39,10 @@ import net.minecraft.network.chat.contents.SelectorContents;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.FormattedCharSequence;
+import net.minecraft.util.GsonHelper;
import net.minecraft.world.level.ChunkPos;
// CraftBukkit start
+import java.util.regex.Pattern; // Scissors
import java.util.stream.Stream;
// CraftBukkit end
@@ -284,10 +292,65 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
public static class Serializer {
private static final Gson GSON = (new GsonBuilder()).disableHtmlEscaping().create();
+ private static final Pattern PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s"); // Scissors
private Serializer() {}
+ // Scissors start
+ static int depthChecker(int depth) {
+ depth = depth + 1;
+ if (depth > ScissorsConfig.componentDepthLimit) {
+ throw new JsonParseException("Depth limit exceeded");
+ }
+ return depth;
+ }
+
+ static int getPenalty(String string) {
+ if (PLACEHOLDER_PATTERN.matcher(string).find()) {
+ long translate_placeholders = PLACEHOLDER_PATTERN.matcher(string).results().count();
+ return (int) translate_placeholders * 12;
+ }
+ return 0;
+ }
+
static MutableComponent deserialize(JsonElement json) {
+ int depth = 1;
+ if (!json.isJsonPrimitive()) {
+ if (!json.isJsonObject()) {
+ if (json.isJsonArray()) {
+ JsonArray jsonArray = json.getAsJsonArray();
+ if (jsonArray.size() <= 0) throw new JsonParseException("Unexpected empty array of components");
+
+ for (JsonElement ignored : jsonArray) {
+ depth = depthChecker(depth);
+ }
+ }
+ } else {
+ JsonObject jsonObject = json.getAsJsonObject();
+ if (jsonObject.has("translate")) {
+ String s = GsonHelper.getAsString(jsonObject, "translate");
+ int penalty = getPenalty(s);
+ depth = depthChecker(depth + penalty);
+
+ if (jsonObject.has("with")) {
+ String s1 = GsonHelper.getAsJsonArray(jsonObject, "with").toString();
+ penalty = getPenalty(s1);
+ depth = depthChecker(depth + penalty);
+ }
+ }
+
+ if (jsonObject.has("extra")) {
+ JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject, "extra");
+ if (jsonArray.size() <= 0) throw new JsonParseException("Unexpected empty array of components");
+
+ for (JsonElement ignored : jsonArray) {
+ depth = depthChecker(depth);
+ }
+ }
+ }
+ }
+ // Scissors end
+
return (MutableComponent) Util.getOrThrow(ComponentSerialization.CODEC.parse(JsonOps.INSTANCE, json), JsonParseException::new);
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Limit save data for Bees and Vexes
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index f9521a6e115f0c975a7885b024c99eae300b63bf..c1598d0caee40a7d73af549b31b61ee7aae77315 100644 index 9a7956befc346e1b58f064213800fd099a052fc6..2ebedd806bafc6ff7c4bf5a962ead50ce2ad1a8a 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -234,8 +234,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -227,8 +227,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override @Override
public void readAdditionalSaveData(CompoundTag nbt) { public void readAdditionalSaveData(CompoundTag nbt) {
this.hivePos = null; this.hivePos = null;
@@ -24,7 +24,7 @@ index f9521a6e115f0c975a7885b024c99eae300b63bf..c1598d0caee40a7d73af549b31b61ee7
this.savedFlowerPos = null; this.savedFlowerPos = null;
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java
index f443006c1e32feee97b32312814e2447a50c45e2..ad418449f5ffd4bcceb5834b1385dc69259f3a21 100644 index 90e577b1a89b02c38daff2845a63dafe5ed929e1..1a2b6ee032ab6952634c9f596820db3e7374fb50 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vex.java --- a/src/main/java/net/minecraft/world/entity/monster/Vex.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java
@@ -118,8 +118,12 @@ public class Vex extends Monster implements TraceableEntity { @@ -118,8 +118,12 @@ public class Vex extends Monster implements TraceableEntity {

View File

@@ -1,66 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Focusvity <nathan.curran10012@gmail.com>
Date: Sun, 11 Feb 2024 19:44:20 +1100
Subject: [PATCH] Add depth limit to updateCustomBlockEntityTag
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java
index 8d2c0accadaf0c5d28e7db6e62a05f6c619cf02f..75d31897711cf5917bc6f8082edddbb502c46a95 100644
--- a/src/main/java/net/minecraft/world/item/BlockItem.java
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java
@@ -4,12 +4,19 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
+// Scissors start
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+// Scissors end
import java.util.stream.Stream;
import javax.annotation.Nullable;
+
+import me.totalfreedom.scissors.ScissorsConfig; // Scissors
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
+import net.minecraft.nbt.Tag; // Scissors
import net.minecraft.network.chat.Component;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
@@ -240,6 +247,35 @@ public class BlockItem extends Item {
if (nbttagcompound != null) {
BlockEntity tileentity = world.getBlockEntity(pos);
+ // Scissors start
+ if (nbttagcompound.contains("CustomName")) {
+ String customName = nbttagcompound.getString("CustomName");
+ Pattern EXTRA_PATTERN = Pattern.compile("\"extra\":(\\[(.*?)\\{|\\[\\{)");
+ Matcher matcher = EXTRA_PATTERN.matcher(customName);
+ if (matcher.find()) {
+ String matcherString = matcher.group();
+ int penalty = (matcherString.startsWith("\"extra\":[{") ? (int) matcher.results().count() : matcher.group().replace("\"extra\":", "").replace("{", "").length()) * 12;
+ if (penalty > ScissorsConfig.componentDepthLimit) {
+ return false;
+ }
+ }
+ }
+
+ for (Tag tag : nbttagcompound.tags.values()) {
+ if (tag instanceof CompoundTag compoundTag && compoundTag.contains("messages")) {
+ ListTag messagesList = compoundTag.getList("messages", 8);
+ Pattern TRANSLATE_PLACEHOLDER_PATTERN = Pattern.compile("%[0-9]+\\$s");
+ Matcher matcher = TRANSLATE_PLACEHOLDER_PATTERN.matcher(messagesList.toString());
+ if (matcher.find()) {
+ int penalty = (int) matcher.results().count() * 12;
+ if (penalty > ScissorsConfig.componentDepthLimit) {
+ return false;
+ }
+ }
+ }
+ }
+ // Scissors end
+
if (tileentity != null) {
if (!world.isClientSide && tileentity.onlyOpCanSetNbt() && (player == null || !(player.canUseGameMasterBlocks() || (player.getAbilities().instabuild && player.getBukkitEntity().hasPermission("minecraft.nbt.place"))))) { // Spigot - add permission
return false;

View File

@@ -5,31 +5,28 @@ Subject: [PATCH] Mute invalid attributes
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 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 b99a080ab27e24d8131fda931ca70d6d271bb01c..f88b31d9bfc8b332230fa318ba2c1de14d5cc9be 100644 index 7204b973c3ad9239e82355513f6d538107102e48..2463444778f19f937b18173798c04d9d9788a824 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -135,7 +135,10 @@ public class AttributeMap { @@ -147,7 +147,7 @@ public class AttributeMap {
if (attributeInstance != null) {
attributeInstance.load(compoundTag);
} }
- }, () -> LOGGER.warn("Ignoring unknown attribute '{}'", string));
+ }, () -> {
+ }, () -> { - LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string);
+ // LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string); // Scissors - Mute invalid attributes + // LOGGER.warn("Ignoring unknown attribute '{}'", (Object)string); // Scissors - Mute invalid attributes
+ }); });
}
} }
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
index a38e91552ead256bd8dd3b74794d742555681c2d..116af10e6e2467a3e3b0095c4968a79ebb4a19d6 100644 index a7380ce6dcbf64ad8a51dd047d178ae887518041..cb015941e5ea4618bd0964f4aa66a9f0fceb27a1 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeModifier.java
@@ -90,7 +90,7 @@ public class AttributeModifier { @@ -92,7 +92,7 @@ public class AttributeModifier {
AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation")); AttributeModifier.Operation operation = AttributeModifier.Operation.fromValue(nbt.getInt("Operation"));
return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation); return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation);
} catch (Exception var3) { } catch (Exception var3) {
- LOGGER.warn("Unable to create attribute: {}", var3.getMessage()); - LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage());
+ // LOGGER.warn("Unable to create attribute: {}", var3.getMessage()); // Scissors - Mute invalid attributes + // LOGGER.warn("Unable to create attribute: {}", (Object)var3.getMessage()); // Scissors - Mute invalid attributes
return null; return null;
} }
} }

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Mute invalid Enderdragon phases
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
index 1b1a210a86121049e507a497649727a99452c0a2..a8bcadbf64d5034b172427e16b1468b4c91c4518 100644 index bca131e9c428e2cb073ae2ef517dda12f73a5dcd..b9d603c82b12299e94c31928b36c9517834cff62 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonChargePlayerPhase.java
@@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance { @@ -20,7 +20,7 @@ public class DragonChargePlayerPhase extends AbstractDragonPhaseInstance {
@@ -18,10 +18,10 @@ index 1b1a210a86121049e507a497649727a99452c0a2..a8bcadbf64d5034b172427e16b1468b4
} else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) { } else if (this.timeSinceCharge > 0 && this.timeSinceCharge++ >= 10) {
this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN);
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
index 13f60a16f07c50a278b158d64180009020a4dca6..289361cbaad2ca6392ee66627becb8f973bb1e54 100644 index a3456b35db4e938f91d6bc32d4d202a011bf13c4..aad0b066e4fd63195aa117c5a03f64846bf46fbd 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
@@ -31,7 +31,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { @@ -32,7 +32,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
@Override @Override
public void doServerTick() { public void doServerTick() {
if (this.attackTarget == null) { if (this.attackTarget == null) {

View File

@@ -0,0 +1,53 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Fri, 28 Jul 2023 19:33:23 -0300
Subject: [PATCH] Don't return null Components in the Component codec
Found by Sk8kman
diff --git a/src/main/java/net/minecraft/util/ExtraCodecs.java b/src/main/java/net/minecraft/util/ExtraCodecs.java
index 607f32b856c6c1fb81d3f1604f3bf3fb240d713f..5afdc9d93e696568cc8a263ab0142fbac258e874 100644
--- a/src/main/java/net/minecraft/util/ExtraCodecs.java
+++ b/src/main/java/net/minecraft/util/ExtraCodecs.java
@@ -70,7 +70,10 @@ public class ExtraCodecs {
public static final Codec<Component> COMPONENT = adaptJsonSerializer(Component.Serializer::fromJson, Component.Serializer::toJsonTree);
public static final Codec<Component> FLAT_COMPONENT = Codec.STRING.flatXmap((json) -> {
try {
- return DataResult.success(Component.Serializer.fromJson(json));
+ // Scissors start
+ final Component component = Component.Serializer.fromJson(json);
+ return DataResult.success(component != null ? component : Component.empty());
+ // Scissors end
} catch (JsonParseException var2) {
return DataResult.error(var2::getMessage);
}
@@ -233,7 +236,10 @@ public class ExtraCodecs {
public static <T> Codec<T> adaptJsonSerializer(Function<JsonElement, T> deserializer, Function<T, JsonElement> serializer) {
return JSON.flatXmap((json) -> {
try {
- return DataResult.success(deserializer.apply(json));
+ // Scissors start
+ final T value = deserializer.apply(json);
+ return DataResult.success(value != null ? value : (T)Component.empty());
+ // Scissors end
} catch (JsonParseException var3) {
return DataResult.error(var3::getMessage);
}
@@ -260,7 +266,7 @@ public class ExtraCodecs {
}, (pair) -> {
return ImmutableList.of(leftFunction.apply(pair), rightFunction.apply(pair));
});
- Codec<I> codec3 = RecordCodecBuilder.<Pair>create((instance) -> {
+ Codec<I> codec3 = RecordCodecBuilder.<Pair<P,P>>create((instance) -> { // Scissors - Decompile error
return instance.group(codec.fieldOf(leftFieldName).forGetter(Pair::getFirst), codec.fieldOf(rightFieldName).forGetter(Pair::getSecond)).apply(instance, Pair::of);
}).comapFlatMap((pair) -> {
return combineFunction.apply((P)pair.getFirst(), (P)pair.getSecond());
@@ -286,7 +292,7 @@ public class ExtraCodecs {
Optional<Pair<A, T>> optional = dataResult.resultOrPartial(mutableObject::setValue);
return optional.isPresent() ? dataResult : DataResult.error(() -> {
return "(" + (String)mutableObject.getValue() + " -> using default)";
- }, Pair.of(object, object));
+ }, (Pair<A, T>) Pair.of(object, object)); // Scissors - Decompile error
}
public <T> DataResult<T> coApply(DynamicOps<T> dynamicOps, A objectx, DataResult<T> dataResult) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add length limit to note block sound
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
index 6f52256bfb668aee7fd1628c1c0c7b3434b847a6..74f1227ecf664cf0d4f62d6f9c3e65ffc07b146e 100644 index 238b6cd88cb24ca63770db607f2241fcd7210574..ec02597810a4022112ddf31928eb6976e6ac5371 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java
@@ -113,7 +113,7 @@ public class SkullBlockEntity extends BlockEntity { @@ -92,7 +92,7 @@ public class SkullBlockEntity extends BlockEntity {
} }
if (nbt.contains("note_block_sound", 8)) { if (nbt.contains("note_block_sound", 8)) {

View File

@@ -7,4 +7,4 @@ pluginManagement {
rootProject.name = "Scissors" rootProject.name = "Scissors"
include("Scissors-API", "Scissors-Server") include("aswm-api", "aswm-core", "Scissors-API", "Scissors-Server")