diff --git a/gradle.properties b/gradle.properties index a5f3c52..83a3fde 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group=me.totalfreedom.scissors -version=1.20.1-R0.1-SNAPSHOT +version=1.20.2-R0.1-SNAPSHOT -mcVersion=1.20.1 -paperRef=773dd724469bae89d0c2075edc3d1ddc8d5b0b18 +mcVersion=1.20.2 +paperRef=4b0bc74c90582f2d52d720c795228130545cd103 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/api/0001-AdvancedSlimePaper-API-Changes.patch b/patches/api/0001-AdvancedSlimePaper-API-Changes.patch index 4163d76..ec2f41d 100644 --- a/patches/api/0001-AdvancedSlimePaper-API-Changes.patch +++ b/patches/api/0001-AdvancedSlimePaper-API-Changes.patch @@ -20,7 +20,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/build.gradle.kts b/build.gradle.kts -index 8045f92ffdfb4164bcbef99c41359590c45f9006..51e49260927f6840c3640275ff26e7398ec72b89 100644 +index 639651972fddce4dff63a0f0a7e566a15b9e2dd6..ae9ef9db7cf7e246c3a437891856a33402e5dbb6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,6 +27,7 @@ configurations.api { @@ -28,6 +28,6 @@ index 8045f92ffdfb4164bcbef99c41359590c45f9006..51e49260927f6840c3640275ff26e739 dependencies { // api dependencies are listed transitively to API consumers + api(project(":aswm-api")) // ASWM - api("com.google.guava:guava:31.1-jre") - api("com.google.code.gson:gson:2.10") + 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 diff --git a/patches/server/0002-Build-changes.patch b/patches/server/0002-Build-changes.patch index 8c7eefb..a5eb427 100644 --- a/patches/server/0002-Build-changes.patch +++ b/patches/server/0002-Build-changes.patch @@ -5,25 +5,25 @@ Subject: [PATCH] Build changes diff --git a/build.gradle.kts b/build.gradle.kts -index 2143180a92ec6d0c0eba5559dd5497291348fdfa..91c9a0239b8a4d821dd83ea32d971a0a63e5929a 100644 +index a79461457ea19339f47572c70705d655ebc55276..1ac1484fa13e1aadf6dfc964e7797534e2231950 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -14,8 +14,12 @@ val alsoShade: Configuration by configurations.creating +@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) { + val alsoShade: Configuration by configurations.creating dependencies { - implementation(project(":aswm-core")) - implementation(project(":paper-api")) - implementation(project(":paper-mojangapi")) + // Scissors start + implementation(project(":Scissors-API")) -+ implementation("io.papermc.paper:paper-mojangapi:1.20.1-R0.1-SNAPSHOT") { ++ implementation("io.papermc.paper:paper-mojangapi:1.20.2-R0.1-SNAPSHOT") { + exclude("io.papermc.paper", "paper-api") + } + // Scissors end // Paper start implementation("org.jline:jline-terminal-jansi:3.21.0") implementation("net.minecrell:terminalconsoleappender:1.3.0") -@@ -69,11 +73,19 @@ tasks.jar { +@@ -66,11 +70,19 @@ tasks.jar { val gitHash = git("rev-parse", "--short=7", "HEAD").getText().trim() val implementationVersion = System.getenv("BUILD_NUMBER") ?: "\"$gitHash\"" val date = git("show", "-s", "--format=%ci", gitHash).getText().trim() // Paper @@ -45,7 +45,7 @@ index 2143180a92ec6d0c0eba5559dd5497291348fdfa..91c9a0239b8a4d821dd83ea32d971a0a "Implementation-Vendor" to date, // Paper "Specification-Title" to "Bukkit", "Specification-Version" to project.version, -@@ -150,7 +162,7 @@ fun TaskContainer.registerRunTask( +@@ -154,7 +166,7 @@ fun TaskContainer.registerRunTask( name: String, block: JavaExec.() -> Unit ): TaskProvider = register(name) { @@ -95,10 +95,10 @@ index c5d5648f4ca603ef2b1df723b58f9caf4dd3c722..21ded7c14c56a40feaa7741131be5166 .completer(new ConsoleCommandCompleter(this.server)) .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 -index e62ebbb2e69df4a79b87cac542482ca913681b02..f0eb2e518cf618dfec7af602d8a77ce4bbf4389e 100644 +index 97745f0bab8d82d397c6c2a5775aed92bca0a034..2f511b9c5f48773c17a659c00a94ba3df82edf93 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1695,7 +1695,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements FeatureElement, EntityTypeT +@@ -589,7 +589,7 @@ public class EntityType implements FeatureElement, EntityTypeT }), (entity) -> { entity.load(nbt); }, () -> { @@ -56,7 +56,7 @@ index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..7b0aed8ed3a150b7c10fa246bb0b5192 }); } -@@ -607,7 +607,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -608,7 +608,7 @@ public class EntityType implements FeatureElement, EntityTypeT } public static Optional> by(CompoundTag nbt) { @@ -66,10 +66,10 @@ index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..7b0aed8ed3a150b7c10fa246bb0b5192 @Nullable diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..0bb87ca2556ca41e0b14503d3ae62e0fc133a209 100644 +index d28c477171c1b6888a45175075017d960464b5cd..cc46185c05a735d4443b266423215f1f7a0c7741 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -618,7 +618,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -619,7 +619,7 @@ public abstract class Mob extends LivingEntity implements Targeting { this.setLeftHanded(nbt.getBoolean("LeftHanded")); if (nbt.contains("DeathLootTable", 8)) { @@ -79,7 +79,7 @@ index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..0bb87ca2556ca41e0b14503d3ae62e0f } 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 448fa4f4f200430d6ce3051763c7ceb697696146..40e59b8db83aec1143e3c394427e916beea7c01f 100644 +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 @@ -109,19 +109,6 @@ index 0425151e688966442340ea1cf892aff34ffe0791..244b04e0020b1bd1e7be34a1b6266a8a this.lootTableSeed = nbt.getLong("LootTableSeed"); return true; } else { -diff --git a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -index 6f9286db4e5786464fb0b49dc125e1228ab7ae93..8d91accb0d5e8afa3957d816bd71681b4198ee6e 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/DecoratedPotBlockEntity.java -@@ -90,7 +90,7 @@ public class DecoratedPotBlockEntity extends BlockEntity { - return Items.BRICK; - } else { - Tag tag = list.get(index); -- return BuiltInRegistries.ITEM.get(new ResourceLocation(tag.getAsString())); -+ return BuiltInRegistries.ITEM.get(ResourceLocation.tryParse(tag.getAsString())); // Scissors - } - } - } 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 @@ -136,10 +123,10 @@ index 081691f9710ff1115e4308f79ed49fbc38941193..c29dfd15e147d5c4d9c9584ff7803c2a 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 -index e49eece9bff3a53469673d03a7bbf8f9cf8776b8..a49f32e9649155b6af4b1f236e4e8142d730e7e8 100644 +index 5b9ccbd767630abfee648a4653f33d8ac625bd0c..05830258ba0f7d19b1d86c0d8c85df8ffc94dfce 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -@@ -30,8 +30,14 @@ public abstract class CraftLootable +@@ -34,8 +34,14 @@ public abstract class CraftLootable return null; } @@ -178,7 +165,7 @@ index 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf1 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index 18b9b0dc70f6872a9d71c120bcd2edca531b0ac4..4732fff6d1198e5fc4875b4d4523aa2d152817ea 100644 +index 153e4c88c168097eb4a78650e7c9c120bec202a3..4d6af55197bb6933daac50fc638f9c23fe652f39 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java @@ -80,8 +80,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { diff --git a/patches/server/0006-Fixes-log-spam-caused-by-invalid-entities-in-beehive.patch b/patches/server/0004-Fixes-log-spam-caused-by-invalid-entities-in-beehive.patch similarity index 100% rename from patches/server/0006-Fixes-log-spam-caused-by-invalid-entities-in-beehive.patch rename to patches/server/0004-Fixes-log-spam-caused-by-invalid-entities-in-beehive.patch diff --git a/patches/server/0005-Fixes-the-Blank-SkullOwner-exploit.patch b/patches/server/0005-Fixes-the-Blank-SkullOwner-exploit.patch deleted file mode 100644 index a8453c6..0000000 --- a/patches/server/0005-Fixes-the-Blank-SkullOwner-exploit.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Video -Date: Sun, 13 Mar 2022 03:01:29 -0600 -Subject: [PATCH] Fixes the Blank SkullOwner exploit - - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 47c8148e6413c51ffdd30082bfb37a7fb8a73a71..48fce864be2a92c9665b9eeb85e3193eaed4133d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -11,6 +11,7 @@ import net.minecraft.nbt.CompoundTag; - import net.minecraft.nbt.NbtUtils; - import net.minecraft.resources.ResourceLocation; - import net.minecraft.world.level.block.entity.SkullBlockEntity; -+import org.apache.commons.lang3.StringUtils; // Scissors - import org.bukkit.Bukkit; - import org.bukkit.Material; - import org.bukkit.NamespacedKey; -@@ -74,7 +75,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { - try { // Paper - Ignore invalid game profiles - if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) { - this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT))); -- } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) { -+ } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !StringUtils.isBlank(tag.getString(SKULL_OWNER.NBT))) { // Scissors - this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT))); - } - } catch (Exception ignored) {} // Paper diff --git a/patches/server/0007-Removes-useless-spammy-error-logging.patch b/patches/server/0005-Removes-useless-spammy-error-logging.patch similarity index 85% rename from patches/server/0007-Removes-useless-spammy-error-logging.patch rename to patches/server/0005-Removes-useless-spammy-error-logging.patch index 26a8737..7a963b9 100644 --- a/patches/server/0007-Removes-useless-spammy-error-logging.patch +++ b/patches/server/0005-Removes-useless-spammy-error-logging.patch @@ -5,10 +5,10 @@ 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 3df1822b55358a9bdf41bcacd5b7fecfd8f05dfa..f9741039dada19391e80d9623f2d8cabc1089506 100644 +index aeca803cc0434d9de9434987d6e43b70353e305b..5bd581c1a82236359c810037333590d0d9741587 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1813,8 +1813,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1814,8 +1814,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { resource = CraftNamespacedKey.fromMinecraft(key); } } catch (IllegalArgumentException ex) { diff --git a/patches/server/0008-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch b/patches/server/0006-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch similarity index 100% rename from patches/server/0008-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch rename to patches/server/0006-Ignore-errors-thrown-when-trying-to-remove-minecart-.patch diff --git a/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch b/patches/server/0007-ItemEntity-Check-if-items-are-air-before-calling-set.patch similarity index 91% rename from patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch rename to patches/server/0007-ItemEntity-Check-if-items-are-air-before-calling-set.patch index 15dc434..8c8d0c8 100644 --- a/patches/server/0009-ItemEntity-Check-if-items-are-air-before-calling-set.patch +++ b/patches/server/0007-ItemEntity-Check-if-items-are-air-before-calling-set.patch @@ -5,7 +5,7 @@ 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 -index 52196431a6538872755344859a0454a0e50c3b6e..2312881cdd925ec538fff3df7cdc7e04770453eb 100644 +index eb0351aa12eebcefab1d1d14641fc3c60cbbcab8..cf944848cdebbb6f04f5211e00c876329e86d9cc 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java @@ -425,11 +425,15 @@ public class ItemEntity extends Entity implements TraceableEntity { diff --git a/patches/server/0010-Fixes-Knowledge-Books-causing-log-spam-when-invalid-.patch b/patches/server/0008-Fixes-Knowledge-Books-causing-log-spam-when-invalid-.patch similarity index 86% rename from patches/server/0010-Fixes-Knowledge-Books-causing-log-spam-when-invalid-.patch rename to patches/server/0008-Fixes-Knowledge-Books-causing-log-spam-when-invalid-.patch index d23b1ce..dd2c69f 100644 --- a/patches/server/0010-Fixes-Knowledge-Books-causing-log-spam-when-invalid-.patch +++ b/patches/server/0008-Fixes-Knowledge-Books-causing-log-spam-when-invalid-.patch @@ -6,15 +6,15 @@ 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 -index b79f4ce38a42e4dba8ebdfc97dadc531b7245c7a..9c49be7c53a1f2a8c203341b8ded9cd222d0c178 100644 +index 37f37be56bab171df442b980ff46ff325daae283..deade19d16a7d6870171b9a60806a8cadb437db4 100644 --- a/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 { for(int i = 0; i < listTag.size(); ++i) { String string = listTag.getString(i); -- Optional> optional = recipeManager.byKey(new ResourceLocation(string)); -+ Optional> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations +- Optional> optional = recipeManager.byKey(new ResourceLocation(string)); ++ Optional> optional = recipeManager.byKey(ResourceLocation.tryParse(string)); // Scissors - Validate resource locations if (!optional.isPresent()) { - LOGGER.error("Invalid recipe: {}", (Object)string); + // Scissors - Don't log errors caused by invalid recipes being provided diff --git a/patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch b/patches/server/0009-Validate-BlockState-and-SoundEvent-values.patch similarity index 89% rename from patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch rename to patches/server/0009-Validate-BlockState-and-SoundEvent-values.patch index 14ecb46..7bf1fcb 100644 --- a/patches/server/0011-Validate-BlockState-and-SoundEvent-values.patch +++ b/patches/server/0009-Validate-BlockState-and-SoundEvent-values.patch @@ -5,10 +5,10 @@ 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 efa800402413202d190926610d8264dfbf5019e7..1b3229128771adb85a7d007989891ef073a80278 100644 +index 82b53a7bfb37bfa1752a016a8a454c0b994b9108..b8720020f98ea26da7d3225ddfbb1d9e80be4eb1 100644 --- a/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -234,7 +234,7 @@ public final class NbtUtils { +@@ -231,7 +231,7 @@ public final class NbtUtils { if (!nbt.contains("Name", 8)) { return Blocks.AIR.defaultBlockState(); } else { @@ -18,7 +18,7 @@ index efa800402413202d190926610d8264dfbf5019e7..1b3229128771adb85a7d007989891ef0 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 fa885337085348308604e50049ecc5bb52023884..366f70bfe6559e4d43844473a2c080c3ec52a4fc 100644 +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 { diff --git a/patches/server/0012-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch b/patches/server/0010-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch similarity index 100% rename from patches/server/0012-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch rename to patches/server/0010-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch diff --git a/patches/server/0013-Change-version-fetcher-to-AMG.patch b/patches/server/0011-Change-version-fetcher-to-AMG.patch similarity index 98% rename from patches/server/0013-Change-version-fetcher-to-AMG.patch rename to patches/server/0011-Change-version-fetcher-to-AMG.patch index 37552db..291a3c2 100644 --- a/patches/server/0013-Change-version-fetcher-to-AMG.patch +++ b/patches/server/0011-Change-version-fetcher-to-AMG.patch @@ -77,7 +77,7 @@ index 9d687da5bdf398bb3f6c84cdf1249a7213d09f2e..bc5ed619e05f24f3ad50a6a81306d120 switch (distance) { case -1: diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 7c29d92362a82330440dff151bcf421f15c68f71..d1c8671ba5ca95c425e4c679445d55c4bbba217e 100644 +index e7746952417a3ca4ea97103e38568db42039f717..e3c230fd2a054a8cb60328c9309410a2f53dad26 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -300,7 +300,7 @@ public class Main { diff --git a/patches/server/0014-Better-handling-of-invalid-JSON-components.patch b/patches/server/0012-Better-handling-of-invalid-JSON-components.patch similarity index 86% rename from patches/server/0014-Better-handling-of-invalid-JSON-components.patch rename to patches/server/0012-Better-handling-of-invalid-JSON-components.patch index 937898e..4c578ba 100644 --- a/patches/server/0014-Better-handling-of-invalid-JSON-components.patch +++ b/patches/server/0012-Better-handling-of-invalid-JSON-components.patch @@ -5,26 +5,25 @@ 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 -index c69088a2ec374b2d236fec61e267f42afa2967b1..7ca1ece926b0ef4598d4fa913b96d1e7a0e5bba4 100644 +index d02546b18cb689724887b4e85e8d32a18828a4ad..f8ffd6a52ad8c13eb13f51afe3a864cd3595d7eb 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -559,13 +559,7 @@ public final class MCUtil { +@@ -655,12 +655,6 @@ public final class MCUtil { return null; } String string = compound.getString(key); - try { -- return Component.Serializer.fromJson(string); +- return net.minecraft.network.chat.Component.Serializer.fromJson(string); - } catch (com.google.gson.JsonParseException e) { - org.bukkit.Bukkit.getLogger().warning("Unable to parse " + key + " from " + compound +": " + e.getMessage()); - } - - return null; -+ return Component.Serializer.fromJsonSafe(string); ++ return net.minecraft.network.chat.Component.Serializer.fromJsonSafe(string); } - - public static ChunkStatus getChunkStatus(ChunkHolder chunk) { + } diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java -index 37fc353c3e59dd5af2fd6c58ac084fb0e6e155d7..2873ed7c443ed8c8c57a8b1d3e444d229f10f07b 100644 +index b540ce21c65ad52ad7e94d2ca2b3926c0875bee1..9cb6fa8e35c89f73e7c95dbe219a4bf6d00b60a9 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; @@ -128,10 +127,10 @@ index 97a2657bc98d41c3c1e376b266d2c85f685acc88..9d20f3f1af8e663a8c13714c8928d4a9 } }).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 -index e8485fb900b25e911a858678a833852731cb2ace..842f8af14b2bd694a48ee6573d98e6cfcf910e16 100644 +index f20ae9153b7098980ce6c0e75fcbbb4da652661b..7f5b2787482f52114c62f8b9d19755f3baeaefa0 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2487,12 +2487,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2470,12 +2470,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { this.setRot(this.getYRot(), this.getXRot()); if (nbt.contains("CustomName", 8)) { String s = nbt.getString("CustomName"); @@ -146,10 +145,10 @@ index e8485fb900b25e911a858678a833852731cb2ace..842f8af14b2bd694a48ee6573d98e6cf 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 -index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1a2417616 100644 +index 4def212655cea0fd998b52e924f8b671d6aeb559..4359fb5997f8a207c52a09aa61a9431fa3ff550e 100644 --- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java +++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java -@@ -35,7 +35,7 @@ public class ScoreboardSaveData extends SavedData { +@@ -38,7 +38,7 @@ public class ScoreboardSaveData extends SavedData { CompoundTag compoundTag = nbt.getCompound(i); String string = compoundTag.getString("Name"); PlayerTeam playerTeam = this.scoreboard.addPlayerTeam(string); @@ -158,7 +157,7 @@ index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1 if (component != null) { playerTeam.setDisplayName(component); } -@@ -53,14 +53,14 @@ public class ScoreboardSaveData extends SavedData { +@@ -56,14 +56,14 @@ public class ScoreboardSaveData extends SavedData { } if (compoundTag.contains("MemberNamePrefix", 8)) { @@ -175,12 +174,12 @@ index 2be7a697f08045b974579e6942b38571e744efac..84ec21c38bb44db1e9ff26c01d5c8af1 if (component3 != null) { playerTeam.setPlayerSuffix(component3); } -@@ -115,7 +115,7 @@ public class ScoreboardSaveData extends SavedData { - CompoundTag compoundTag = nbt.getCompound(i); - ObjectiveCriteria.byName(compoundTag.getString("CriteriaName")).ifPresent((criterion) -> { - String string = compoundTag.getString("Name"); -- 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 - ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType")); - this.scoreboard.addObjective(string, criterion, component, renderType); +@@ -123,7 +123,7 @@ public class ScoreboardSaveData extends SavedData { + return ObjectiveCriteria.DUMMY; }); + String string2 = compoundTag.getString("Name"); +- 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 + ObjectiveCriteria.RenderType renderType = ObjectiveCriteria.RenderType.byId(compoundTag.getString("RenderType")); + this.scoreboard.addObjective(string2, objectiveCriteria, component, renderType); + } diff --git a/patches/server/0015-Block-server-side-chunkbans.patch b/patches/server/0013-Block-server-side-chunkbans.patch similarity index 77% rename from patches/server/0015-Block-server-side-chunkbans.patch rename to patches/server/0013-Block-server-side-chunkbans.patch index 013e808..ee6f6ac 100644 --- a/patches/server/0015-Block-server-side-chunkbans.patch +++ b/patches/server/0013-Block-server-side-chunkbans.patch @@ -5,12 +5,12 @@ 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 -index fbfadeb83719b81f42724e79c59e92ed88fdece7..7de21c9bcc1f3c556790da62f96cc44995e877b2 100644 +index 45b4f1c295eda2fcc5067a4b21de247218ef117f..f2e7585630ff724f966c7bcedc17e502d786870d 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -6,9 +6,17 @@ import io.netty.channel.ChannelHandlerContext; - import io.netty.handler.codec.MessageToByteEncoder; - import io.papermc.paper.adventure.PaperAdventure; // Paper +@@ -7,8 +7,16 @@ import io.netty.handler.codec.MessageToByteEncoder; + import io.netty.util.Attribute; + import io.netty.util.AttributeKey; import java.io.IOException; +import java.util.Collections; // Scissors +import net.minecraft.ChatFormatting; // Scissors @@ -19,7 +19,6 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..7de21c9bcc1f3c556790da62f96cc449 +import net.minecraft.network.chat.Component; // Scissors +import net.minecraft.network.chat.SignedMessageBody; // Scissors import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.protocol.game.*; // Scissors import net.minecraft.util.profiling.jfr.JvmProfiler; +import net.minecraft.world.item.ItemStack; // Scissors @@ -27,20 +26,20 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..7de21c9bcc1f3c556790da62f96cc449 public class PacketEncoder extends MessageToByteEncoder> { @@ -19,6 +27,23 @@ public class PacketEncoder extends MessageToByteEncoder> { - this.flow = side; + this.codecKey = protocolKey; } + // Scissors start -+ private static int tryWrite(Packet packet, FriendlyByteBuf friendlyByteBuf, ChannelHandlerContext channelHandlerContext, int i) { ++ private int tryWrite(Packet packet, FriendlyByteBuf friendlyByteBuf, ChannelHandlerContext channelHandlerContext, int i) { + friendlyByteBuf.writeVarInt(i); -+ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); ++ friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + + int j = friendlyByteBuf.writerIndex(); + packet.write(friendlyByteBuf); + int k = friendlyByteBuf.writerIndex() - j; + int packetLength = friendlyByteBuf.readableBytes(); -+ if (k > 8388608 || packetLength > MAX_PACKET_SIZE) { -+ throw new SkipPacketException(new IllegalArgumentException("Packet too big (is " + k + "): " + packet)); ++ if (packetLength > MAX_PACKET_SIZE) { ++ throw new PacketTooLargeException(packet, this.codecKey, packetLength); + } + + return k; @@ -48,14 +47,14 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..7de21c9bcc1f3c556790da62f96cc449 + // Scissors end + protected void encode(ChannelHandlerContext channelHandlerContext, Packet packet, ByteBuf byteBuf) throws Exception { - ConnectionProtocol connectionProtocol = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get(); - if (connectionProtocol == null) { -@@ -33,38 +58,59 @@ public class PacketEncoder extends MessageToByteEncoder> { + Attribute> attribute = channelHandlerContext.channel().attr(this.codecKey); + ConnectionProtocol.CodecData codecData = attribute.get(); +@@ -34,39 +59,59 @@ public class PacketEncoder extends MessageToByteEncoder> { throw new IOException("Can't serialize unregistered packet"); } else { FriendlyByteBuf friendlyByteBuf = new FriendlyByteBuf(byteBuf); - friendlyByteBuf.writeVarInt(i); -- friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper +- friendlyByteBuf.adventure$locale = channelHandlerContext.channel().attr(io.papermc.paper.adventure.PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + // Scissors start + int k; @@ -65,33 +64,34 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..7de21c9bcc1f3c556790da62f96cc449 - int k = friendlyByteBuf.writerIndex() - j; - if (false && k > 8388608) { // Paper - disable - throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet); -- } else { -- int l = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get().getId(); -- JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k); - } -+ k = tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); - } catch (Throwable var10) { -- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var10); // Paper - Give proper error message +- +- JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); ++ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); + } catch (Throwable var13) { +- LOGGER.error("Packet encoding of packet ID {} threw (skippable? {})", i, packet.isSkippable(), var13); // Paper - Give proper error message - if (packet.isSkippable()) { -- throw new SkipPacketException(var10); -- } else { -- throw var10; +- throw new SkipPacketException(var13); + packet = capPacket(packet, i); + if (packet == null) { + throw new SkipPacketException(new IllegalArgumentException("Packet too big: " + packet)); } +- +- throw var13; +- } finally { +- // Paper start +- int packetLength = friendlyByteBuf.readableBytes(); +- if (packetLength > MAX_PACKET_SIZE) { +- throw new PacketTooLargeException(packet, this.codecKey, packetLength); +- } +- // Paper end +- ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); + friendlyByteBuf.clear(); -+ k = tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); ++ k = this.tryWrite(packet, friendlyByteBuf, channelHandlerContext, i); } -- // Paper start -- int packetLength = friendlyByteBuf.readableBytes(); -- if (packetLength > MAX_PACKET_SIZE) { -- throw new PacketTooLargeException(packet, packetLength); -- } -- // Paper end -+ int l = channelHandlerContext.channel().attr(Connection.ATTRIBUTE_PROTOCOL).get().getId(); -+ JvmProfiler.INSTANCE.onPacketSent(l, i, channelHandlerContext.channel().remoteAddress(), k); ++ JvmProfiler.INSTANCE.onPacketSent(codecData.protocol(), i, channelHandlerContext.channel().remoteAddress(), k); ++ ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); + // Scissors end } } @@ -146,7 +146,7 @@ index 3944852921335c78a04a9dc301882ab5b152b1ed..96ee53c7cc862e059328c5cdf5e07f30 this.type = blockEntityType; 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 -index 39b879f21f958dbd91ab0f74e5d4f3c74928fc33..688287c637a0d4b28d630b7304a3c2cf339bdf54 100644 +index 51e24105facfe71ce9f2757c6c881a21b58dacfd..5692fbae221fb01d32d92edc7bea0f6312e24e1c 100644 --- a/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 { diff --git a/patches/server/0016-Reject-oversized-components-from-updating.patch b/patches/server/0014-Reject-oversized-components-from-updating.patch similarity index 89% rename from patches/server/0016-Reject-oversized-components-from-updating.patch rename to patches/server/0014-Reject-oversized-components-from-updating.patch index 140079f..62ee5c6 100644 --- a/patches/server/0016-Reject-oversized-components-from-updating.patch +++ b/patches/server/0014-Reject-oversized-components-from-updating.patch @@ -5,10 +5,10 @@ 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 -index 584a58659fae6ba3d8b53858890bc6ec509ffb0e..54a7dae26854d320d9e53f63eb411a85a2d78159 100644 +index 7daca712816a79cc4a30b084afbd3d07b5d3755f..a7e04eb4284e7d5148e1c7b991620d666785ec70 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -@@ -39,8 +39,9 @@ public class ComponentUtils { +@@ -38,8 +38,9 @@ public class ComponentUtils { } public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException { @@ -19,7 +19,7 @@ index 584a58659fae6ba3d8b53858890bc6ec509ffb0e..54a7dae26854d320d9e53f63eb411a85 } else { // Paper start if (text instanceof io.papermc.paper.adventure.AdventureComponent adventureComponent) { -@@ -53,8 +54,9 @@ public class ComponentUtils { +@@ -52,8 +53,9 @@ public class ComponentUtils { mutableComponent.append(updateForEntity(source, component, sender, depth + 1)); } diff --git a/patches/server/0017-Add-Scissors-configuration-file-command.patch b/patches/server/0015-Add-Scissors-configuration-file-command.patch similarity index 97% rename from patches/server/0017-Add-Scissors-configuration-file-command.patch rename to patches/server/0015-Add-Scissors-configuration-file-command.patch index 3cad371..f2a7c3d 100644 --- a/patches/server/0017-Add-Scissors-configuration-file-command.patch +++ b/patches/server/0015-Add-Scissors-configuration-file-command.patch @@ -414,10 +414,10 @@ index 0000000000000000000000000000000000000000..8cd2848aa6b06c5efbe797ed2d75ff4b +} + diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..641fe69cb2131413654c39a32a73c62e2bc092f6 100644 +index ec268189b19b6fa5c4521f96ce211a531db35ec5..343cb72710ef100cf7e4de1e081cfdc2744aab46 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -147,6 +147,7 @@ public class Main { +@@ -144,6 +144,7 @@ public class Main { // 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 spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionset.valueOf("spigot-settings")); @@ -426,7 +426,7 @@ index a7ebf851a65231074c89a24f30de4ac2fb5b63e4..641fe69cb2131413654c39a32a73c62e 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 -index c49802c936ae8e3f4dc1badd98414d96714ecd60..c9725f2df7a66eba3d5994a2b4b16b07ff0f696d 100644 +index dbccbcb9b44e4efacdf53c2d161115cc20b36cff..c3eb9eef724fa04ede965c5875b948c829fafb5d 100644 --- a/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 @@ -447,10 +447,10 @@ index c49802c936ae8e3f4dc1badd98414d96714ecd60..c9725f2df7a66eba3d5994a2b4b16b07 this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setMotd(dedicatedserverproperties.motd); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 26937b8dd0411b0c96e461c57eeee6ae8595211e..bf8ade78a771b0295811f48cba96aeb05a39524e 100644 +index f7c3b65e0d6c76189aea00232b33722c4363d7dd..8b872a406752a72d49ff029e2586d4ac17d7be1f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1036,6 +1036,7 @@ public final class CraftServer implements Server { +@@ -1038,6 +1038,7 @@ public final class CraftServer implements Server { } org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot @@ -458,7 +458,7 @@ index 26937b8dd0411b0c96e461c57eeee6ae8595211e..bf8ade78a771b0295811f48cba96aeb0 this.console.paperConfigurations.reloadConfigs(this.console); for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty -@@ -1067,6 +1068,7 @@ public final class CraftServer implements Server { +@@ -1069,6 +1070,7 @@ public final class CraftServer implements Server { this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper @@ -466,7 +466,7 @@ index 26937b8dd0411b0c96e461c57eeee6ae8595211e..bf8ade78a771b0295811f48cba96aeb0 this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2912,6 +2914,14 @@ public final class CraftServer implements Server { +@@ -2914,6 +2916,14 @@ public final class CraftServer implements Server { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -482,7 +482,7 @@ index 26937b8dd0411b0c96e461c57eeee6ae8595211e..bf8ade78a771b0295811f48cba96aeb0 public void 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 -index d1c8671ba5ca95c425e4c679445d55c4bbba217e..3be40632c70f5a7994ada3e61616dca632cef2da 100644 +index ebec18e919885f9220693a8a419d239e8cddd567..544698c044d9eef57abccfbd41cbfdd6873e4f55 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -180,6 +180,20 @@ public class Main { diff --git a/patches/server/0018-Prevent-attributes-with-invalid-namespaces-from-bein.patch b/patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch similarity index 90% rename from patches/server/0018-Prevent-attributes-with-invalid-namespaces-from-bein.patch rename to patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch index 365cd35..5cf9b5b 100644 --- a/patches/server/0018-Prevent-attributes-with-invalid-namespaces-from-bein.patch +++ b/patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch @@ -6,7 +6,7 @@ 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 -index f9741039dada19391e80d9623f2d8cabc1089506..38238d9e6d464990caf10557997c6ca88ee100c0 100644 +index 5bd581c1a82236359c810037333590d0d9741587..35d640654ec483b98eeddb4887107a07f93f57aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -46,6 +46,7 @@ import net.minecraft.nbt.NbtIo; @@ -17,7 +17,7 @@ index f9741039dada19391e80d9623f2d8cabc1089506..38238d9e6d464990caf10557997c6ca8 import net.minecraft.world.item.BlockItem; import net.minecraft.world.level.block.state.BlockState; import org.apache.commons.lang3.EnumUtils; -@@ -486,7 +487,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -487,7 +488,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper diff --git a/patches/server/0019-Don-t-query-player-data-in-the-nbt-component.patch b/patches/server/0017-Don-t-query-player-data-in-the-nbt-component.patch similarity index 100% rename from patches/server/0019-Don-t-query-player-data-in-the-nbt-component.patch rename to patches/server/0017-Don-t-query-player-data-in-the-nbt-component.patch diff --git a/patches/server/0020-Limit-string-tag-visitors-to-1024-elements.patch b/patches/server/0018-Limit-string-tag-visitors-to-1024-elements.patch similarity index 100% rename from patches/server/0020-Limit-string-tag-visitors-to-1024-elements.patch rename to patches/server/0018-Limit-string-tag-visitors-to-1024-elements.patch diff --git a/patches/server/0019-Fixes-creative-killing-potion-effects-and-certain-po.patch b/patches/server/0019-Fixes-creative-killing-potion-effects-and-certain-po.patch new file mode 100644 index 0000000..8e64224 --- /dev/null +++ b/patches/server/0019-Fixes-creative-killing-potion-effects-and-certain-po.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Video +Date: Mon, 11 Apr 2022 13:33:52 -0600 +Subject: [PATCH] Fixes creative-killing potion effects and certain potion + effect overflows + + +diff --git a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java +index 1c7794de5f0a7238b944c9473e2cc9d011ef2306..9c594c504611b9da5fcd119284b2dcb4b59d3bf4 100644 +--- a/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java ++++ b/src/main/java/net/minecraft/world/effect/HealOrHarmMobEffect.java +@@ -16,6 +16,11 @@ class HealOrHarmMobEffect extends InstantenousMobEffect { + @Override + public void applyEffectTick(LivingEntity entity, int amplifier) { + super.applyEffectTick(entity, amplifier); ++ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't. ++ if (entity instanceof net.minecraft.world.entity.player.Player player && (player.isCreative() || player.isInvulnerable())) return; ++ amplifier = Math.min(Math.abs(amplifier), 124); ++ // Scissors end ++ + if (this.isHarm == entity.isInvertedHealAndHarm()) { + entity.heal((float) Math.max(4 << amplifier, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit + } else { +@@ -27,6 +32,10 @@ class HealOrHarmMobEffect extends InstantenousMobEffect { + @Override + public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) { + int j; ++ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't. ++ if (target instanceof net.minecraft.world.entity.player.Player player && (player.isCreative() || player.isInvulnerable())) return; ++ amplifier = Math.min(Math.abs(amplifier), 124); ++ // Scissors end + + if (this.isHarm == target.isInvertedHealAndHarm()) { + j = (int) (proximity * (double) (4 << amplifier) + 0.5D); diff --git a/patches/server/0022-Fix-negative-death-times.patch b/patches/server/0020-Fix-negative-death-times.patch similarity index 90% rename from patches/server/0022-Fix-negative-death-times.patch rename to patches/server/0020-Fix-negative-death-times.patch index 61c8bd3..69c0571 100644 --- a/patches/server/0022-Fix-negative-death-times.patch +++ b/patches/server/0020-Fix-negative-death-times.patch @@ -5,7 +5,7 @@ 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 -index e11d7283662834047b2ff81a2fd25a4263792deb..4bd7eea49a0720063db2a8ed10f53bd19e9499ad 100644 +index b95f88d5e5b4785ee063695fd81935636a0588d1..168b002377e258f84a3bb86dd8e4a5f42060e3e0 100644 --- a/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 { diff --git a/patches/server/0021-Fixes-creative-killing-potion-effects-and-certain-po.patch b/patches/server/0021-Fixes-creative-killing-potion-effects-and-certain-po.patch deleted file mode 100644 index 9e4a7ab..0000000 --- a/patches/server/0021-Fixes-creative-killing-potion-effects-and-certain-po.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Video -Date: Mon, 11 Apr 2022 13:33:52 -0600 -Subject: [PATCH] Fixes creative-killing potion effects and certain potion - effect overflows - - -diff --git a/src/main/java/net/minecraft/world/effect/MobEffect.java b/src/main/java/net/minecraft/world/effect/MobEffect.java -index 53cc6befb752affcfec65e18365f6d369448d407..181f5aa262689617ff3ad766dae485c36b88c9aa 100644 ---- a/src/main/java/net/minecraft/world/effect/MobEffect.java -+++ b/src/main/java/net/minecraft/world/effect/MobEffect.java -@@ -57,6 +57,7 @@ public class MobEffect { - } - - public void applyEffectTick(LivingEntity entity, int amplifier) { -+ boolean god = entity instanceof Player player && (player.isCreative() || player.isInvulnerable()); // Scissors - if (this == MobEffects.REGENERATION) { - if (entity.getHealth() < entity.getMaxHealth()) { - entity.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit -@@ -83,17 +84,31 @@ public class MobEffect { - // CraftBukkit end - } - } else if ((this != MobEffects.HEAL || entity.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entity.isInvertedHealAndHarm())) { -- if (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm()) { -+ // Scissors start -+ amplifier = Math.min(Math.abs(amplifier), 124); -+ if (!god && (this == MobEffects.HARM && !entity.isInvertedHealAndHarm() || this == MobEffects.HEAL && entity.isInvertedHealAndHarm())) { -+ // Scissors end - entity.hurt(entity.damageSources().magic(), (float) (6 << amplifier)); - } - } else { -- entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit -+ // Scissors start -+ if (!god) { -+ amplifier = Math.min(Math.abs(amplifier), 124); -+ entity.heal((float) Math.max(4 << amplifier, 0), RegainReason.MAGIC); // CraftBukkit -+ } -+ // Scissors end - } - - } - - public void applyInstantenousEffect(@Nullable Entity source, @Nullable Entity attacker, LivingEntity target, int amplifier, double proximity) { - int j; -+ // Scissors start - Don't apply any healing/harming effects for Creative/Invulnerable players and cap the amplifier for those who aren't. -+ if (target instanceof Player player && (player.isCreative() || player.isInvulnerable())) { -+ return; -+ } -+ amplifier = Math.min(Math.abs(amplifier), 124); -+ // Scissors end - - if ((this != MobEffects.HEAL || target.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !target.isInvertedHealAndHarm())) { - if ((this != MobEffects.HARM || target.isInvertedHealAndHarm()) && (this != MobEffects.HEAL || !target.isInvertedHealAndHarm())) { diff --git a/patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch b/patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch similarity index 72% rename from patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch rename to patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch index 23e7718..2eba0c0 100644 --- a/patches/server/0023-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch +++ b/patches/server/0021-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch @@ -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 -index 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce032ece6b 100644 +index 44a6118d3bd67a95180f750c17967561946e2e87..8aece67eba8d6b558bc2441b8b8e599f86e12e4f 100644 --- a/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; @@ -17,7 +17,7 @@ index 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce import javax.annotation.Nullable; import net.minecraft.BlockUtil; import net.minecraft.Util; -@@ -107,6 +108,7 @@ public abstract class AbstractMinecart extends Entity { +@@ -111,6 +112,7 @@ public abstract class AbstractMinecart extends Entity { private double flyingX = 0.949999988079071D; // Paper - restore vanilla precision private double flyingY = 0.949999988079071D; // Paper - restore vanilla precision private double flyingZ = 0.949999988079071D; // Paper - restore vanilla precision @@ -25,20 +25,18 @@ index 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce public double maxSpeed = 0.4D; // CraftBukkit end -@@ -434,8 +436,10 @@ public abstract class AbstractMinecart extends Entity { +@@ -432,8 +434,8 @@ public abstract class AbstractMinecart extends Entity { if (this.getMinecartType() == AbstractMinecart.Type.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) { List list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), EntitySelector.pushableBy(this)); - if (!list.isEmpty()) { -- for (int l = 0; l < list.size(); ++l) { -+ // Scissors start -+ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability -+ for (int l = 0; l < Math.min(3, list.size()); ++l) { -+ // Scissors end - Entity entity = (Entity) list.get(l); +- Iterator iterator = list.iterator(); ++ if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Scissors - add collision debounce, using TimeUnit for better code readability ++ Iterator iterator = list.size() <= 15 ? list.iterator() : list.subList(0, 15).iterator(); // Scissors - if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) { -@@ -462,6 +466,14 @@ public abstract class AbstractMinecart extends Entity { + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); +@@ -462,6 +464,14 @@ public abstract class AbstractMinecart extends Entity { entity.push(this); } } @@ -52,9 +50,9 @@ index 9948a28dae4edba877c13ef0156be5ff58df3fa2..9e25d4a3384d0157b99f7bd4d5f7edce + // Scissors end } } else { - Iterator iterator = 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 -index 35aeba4e8430e6419caa9db4a0b931a994228618..289eb39b15a283b0d9dbc33823f3a73f87202907 100644 +index 5c07da62c82bc70138f6cb5007629d6974be69ac..301a72dffd4ac58333d987e85d22136498d2d82a 100644 --- a/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; @@ -65,7 +63,7 @@ index 35aeba4e8430e6419caa9db4a0b931a994228618..289eb39b15a283b0d9dbc33823f3a73f import javax.annotation.Nullable; import net.minecraft.BlockUtil; import net.minecraft.core.BlockPos; -@@ -109,6 +110,7 @@ public class Boat extends Entity implements VariantHolder { +@@ -112,6 +113,7 @@ public class Boat extends Entity implements VariantHolder { public double unoccupiedDeceleration = -1; public boolean landBoats = false; // CraftBukkit end @@ -73,20 +71,19 @@ index 35aeba4e8430e6419caa9db4a0b931a994228618..289eb39b15a283b0d9dbc33823f3a73f public Boat(EntityType type, Level world) { super(type, world); -@@ -421,10 +423,10 @@ public class Boat extends Entity implements VariantHolder { +@@ -465,9 +467,9 @@ public class Boat extends Entity implements VariantHolder { this.checkInsideBlocks(); List list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this)); - if (!list.isEmpty()) { + if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Scissors - add collision debounce, using TimeUnit for better code readability boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player); +- Iterator iterator = list.iterator(); ++ Iterator iterator = list.size() <= 15 ? list.iterator() : list.subList(0, 15).iterator(); // Scissors -- for (int j = 0; j < list.size(); ++j) { -+ for (int j = 0; j < Math.min(3, list.size()); ++j) { // Scissors - Limit amount of vehicle collision checks to 3 maximum - Entity entity = (Entity) list.get(j); - - if (!entity.hasPassenger((Entity) this)) { -@@ -435,6 +437,14 @@ public class Boat extends Entity implements VariantHolder { + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); +@@ -480,6 +482,14 @@ public class Boat extends Entity implements VariantHolder { } } } diff --git a/patches/server/0024-Add-custom-classes-used-by-Scissors.patch b/patches/server/0022-Add-custom-classes-used-by-Scissors.patch similarity index 100% rename from patches/server/0024-Add-custom-classes-used-by-Scissors.patch rename to patches/server/0022-Add-custom-classes-used-by-Scissors.patch diff --git a/patches/server/0025-Reset-large-tags.patch b/patches/server/0023-Reset-large-tags.patch similarity index 95% rename from patches/server/0025-Reset-large-tags.patch rename to patches/server/0023-Reset-large-tags.patch index ec6657d..15a1805 100644 --- a/patches/server/0025-Reset-large-tags.patch +++ b/patches/server/0023-Reset-large-tags.patch @@ -59,7 +59,7 @@ index 4092c7a8c2b0d9d26e6f4d97386735236300d132..04c47cf1a920ae6c356449df801227ee } } diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..8c5fe0166a5442a2fa4f212d7c53343c937f53f1 100644 +index 4697df75fdee2023c41260bed211e3e3d90d2b9b..1ddf7ca63fee0849f3a41f230e0fd7ab636ff05c 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -21,6 +21,7 @@ import java.util.function.Predicate; @@ -70,7 +70,7 @@ index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..8c5fe0166a5442a2fa4f212d7c53343c import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.advancements.CriteriaTriggers; -@@ -253,6 +254,12 @@ public final class ItemStack { +@@ -254,6 +255,12 @@ public final class ItemStack { // CraftBukkit - break into own method private void load(CompoundTag nbttagcompound) { @@ -83,7 +83,7 @@ index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..8c5fe0166a5442a2fa4f212d7c53343c this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id"))); this.count = nbttagcompound.getByte("Count"); if (nbttagcompound.contains("tag", 10)) { -@@ -556,7 +563,11 @@ public final class ItemStack { +@@ -561,7 +568,11 @@ public final class ItemStack { nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); nbt.putByte("Count", (byte) this.count); if (this.tag != null) { @@ -96,7 +96,7 @@ index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..8c5fe0166a5442a2fa4f212d7c53343c } return nbt; -@@ -886,6 +897,7 @@ public final class ItemStack { +@@ -891,6 +902,7 @@ public final class ItemStack { // Paper end public void setTag(@Nullable CompoundTag nbt) { @@ -105,7 +105,7 @@ index d138660e459b2d09ba9dd7ae2bf3da499d9ae25c..8c5fe0166a5442a2fa4f212d7c53343c this.processEnchantOrder(this.tag); // Paper 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 -index 40e59b8db83aec1143e3c394427e916beea7c01f..f292aa0016e6f741b36ddc1417f6f63d248f987f 100644 +index f5ad7ddf13cbb6452c2927aef9b54eae3335b4c6..041e3c8fb7c9ca69a7c7c1c952ed9915a75d7752 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 @@ -9,6 +9,7 @@ import java.util.Iterator; @@ -252,7 +252,7 @@ index 881379681c39230a00b3a1f11cd87498984396c7..d0513b72cdaec3b67b9341d251367b19 } 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 b11f51762ca289d99eaa49e66e31e58595bcea4e..06adfdc61f1064c1ec0db34632a8740fc09a1782 100644 +index 1d9b23c6e458caddc2c738164e6c079cd85d3ce9..9bf6bcdae4c3f1cfd769d47dedd6cba140a80e09 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier; @@ -282,10 +282,10 @@ index b11f51762ca289d99eaa49e66e31e58595bcea4e..06adfdc61f1064c1ec0db34632a8740f } 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 b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..db3a4a8cd19da9775bb0884c33494f1e8591b1fa 100644 +index 1fa22445a4ecc8c08dbcf0cc6bd39dc5003604c4..9f12fbcd8d0c75de1d8c06bed2c64a0acdc877c9 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -@@ -3,6 +3,7 @@ package net.minecraft.world.level.block.entity; +@@ -4,6 +4,7 @@ import java.util.Iterator; import java.util.List; import java.util.stream.IntStream; import javax.annotation.Nullable; @@ -293,7 +293,7 @@ index b7686fd63b7c5d88c3a12ec4ee9bc01a17f997e0..db3a4a8cd19da9775bb0884c33494f1e import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; -@@ -60,6 +61,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl +@@ -61,6 +62,17 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl public boolean opened; public List getContents() { diff --git a/patches/server/0026-Don-t-log-invalid-teams-to-console.patch b/patches/server/0024-Don-t-log-invalid-teams-to-console.patch similarity index 91% rename from patches/server/0026-Don-t-log-invalid-teams-to-console.patch rename to patches/server/0024-Don-t-log-invalid-teams-to-console.patch index 5f0933c..c9d51fa 100644 --- a/patches/server/0026-Don-t-log-invalid-teams-to-console.patch +++ b/patches/server/0024-Don-t-log-invalid-teams-to-console.patch @@ -5,7 +5,7 @@ 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 -index 4bd7eea49a0720063db2a8ed10f53bd19e9499ad..953c2702880b358c0da4b8117c77b76bae849271 100644 +index 168b002377e258f84a3bb86dd8e4a5f42060e3e0..065d2c1543832190bd8bdcd4b553542115c07e64 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -861,7 +861,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0027-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch b/patches/server/0025-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch similarity index 100% rename from patches/server/0027-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch rename to patches/server/0025-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch diff --git a/patches/server/0028-Add-MasterBlockFireEvent.patch b/patches/server/0026-Add-MasterBlockFireEvent.patch similarity index 97% rename from patches/server/0028-Add-MasterBlockFireEvent.patch rename to patches/server/0026-Add-MasterBlockFireEvent.patch index 02eb901..b90aea3 100644 --- a/patches/server/0028-Add-MasterBlockFireEvent.patch +++ b/patches/server/0026-Add-MasterBlockFireEvent.patch @@ -77,7 +77,7 @@ index 182e16c1d968707a11329150d71b7d01df6c6e52..8582a9369cffe0eebeb82a81fc413d0b Registry registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL); // 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 -index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616fd3f73eb 100644 +index e8ecced687261861953899a3bea162dbc03977b4..30720203173b23ccdbb0789f7e2adbbe180c7c69 100644 --- a/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,7 @@ import java.util.Objects; @@ -107,7 +107,7 @@ index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616 Stream stream = this.getRelatedCorners(blockPos2, blockPos3); @@ -321,6 +323,16 @@ public class StructureBlockEntity extends BlockEntity { - public boolean saveStructure(boolean bl) { + public boolean saveStructure(boolean interactive) { if (this.mode == StructureMode.SAVE && !this.level.isClientSide && this.structureName != null) { + // Scissors start - Add master block fire event + final BlockPos pos = this.getBlockPos(); @@ -124,7 +124,7 @@ index 9792bf3ee083f571f1f4089d30beb586839f5f6b..fa6592cdc916d3578fccc6c0075eb616 StructureTemplateManager structureTemplateManager = serverLevel.getStructureManager(); @@ -358,6 +370,16 @@ public class StructureBlockEntity extends BlockEntity { - public boolean loadStructure(ServerLevel world, boolean bl) { + public boolean loadStructure(ServerLevel world, boolean interactive) { if (this.mode == StructureMode.LOAD && this.structureName != null) { + // Scissors start - Add master block fire event + final BlockPos blockPos = this.getBlockPos(); diff --git a/patches/server/0029-Add-spectator-teleport-event.patch b/patches/server/0027-Add-spectator-teleport-event.patch similarity index 83% rename from patches/server/0029-Add-spectator-teleport-event.patch rename to patches/server/0027-Add-spectator-teleport-event.patch index b51d312..be1985b 100644 --- a/patches/server/0029-Add-spectator-teleport-event.patch +++ b/patches/server/0027-Add-spectator-teleport-event.patch @@ -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 -index 3c0651fa5a5db880202c9a3805a6455269c5f16d..d7ddd44fb9b571850515edc6ee2e6801092f6446 100644 +index 34fcdeb0f4039f1fc6c4c8c593cc615560af1ba2..40166e794ad1f2d2555bd47a442771db5bee79f9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,5 +1,6 @@ @@ -14,19 +14,17 @@ index 3c0651fa5a5db880202c9a3805a6455269c5f16d..d7ddd44fb9b571850515edc6ee2e6801 +import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import com.google.common.collect.Lists; import com.google.common.primitives.Floats; - import com.mojang.brigadier.ParseResults; -@@ -2113,6 +2114,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + import com.mojang.authlib.GameProfile; +@@ -2005,6 +2006,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Entity entity = packet.getEntity(worldserver); if (entity != null) { + // Scissors start - Add spectator teleport event + final SpectatorTeleportEvent event = new SpectatorTeleportEvent(this.player.getBukkitEntity(), entity.getBukkitEntity()); -+ -+ if(!event.callEvent()) { ++ if (!event.callEvent()) { + return; + } + // Scissors end -+ this.player.teleportTo(worldserver, entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.SPECTATE); // CraftBukkit return; } diff --git a/patches/server/0030-Prevent-invalid-container-events.patch b/patches/server/0028-Prevent-invalid-container-events.patch similarity index 85% rename from patches/server/0030-Prevent-invalid-container-events.patch rename to patches/server/0028-Prevent-invalid-container-events.patch index 5f46b67..4f63dd6 100644 --- a/patches/server/0030-Prevent-invalid-container-events.patch +++ b/patches/server/0028-Prevent-invalid-container-events.patch @@ -5,7 +5,7 @@ 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 -index bf7cf2108c0273552a41a9734dfd66b6a68a24d4..1c102fa91711ed595626633e127c89a83ed6b6c5 100644 +index 40166e794ad1f2d2555bd47a442771db5bee79f9..0c878b99574b0e27f1463069f66d24bdecb01647 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -30,6 +30,7 @@ import java.util.function.UnaryOperator; @@ -14,9 +14,9 @@ index bf7cf2108c0273552a41a9734dfd66b6a68a24d4..1c102fa91711ed595626633e127c89a8 import javax.annotation.Nullable; +import net.kyori.adventure.text.format.NamedTextColor; // Scissors import net.minecraft.ChatFormatting; - import net.minecraft.CrashReport; - import net.minecraft.CrashReportCategory; -@@ -3037,6 +3038,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + import net.minecraft.SharedConstants; + import net.minecraft.Util; +@@ -2899,6 +2900,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } diff --git a/patches/server/0031-Disable-running-commands-in-books-by-default.patch b/patches/server/0029-Disable-running-commands-in-books-by-default.patch similarity index 100% rename from patches/server/0031-Disable-running-commands-in-books-by-default.patch rename to patches/server/0029-Disable-running-commands-in-books-by-default.patch diff --git a/patches/server/0032-Validate-block-entity-entity-tag-query-positions.patch b/patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch similarity index 86% rename from patches/server/0032-Validate-block-entity-entity-tag-query-positions.patch rename to patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch index bb50463..5f019ed 100644 --- a/patches/server/0032-Validate-block-entity-entity-tag-query-positions.patch +++ b/patches/server/0030-Validate-block-entity-entity-tag-query-positions.patch @@ -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 -index 3c4825e295eefc7fcd628ba804fcc7dd5f160f28..280ebeee9bfae3059b6681873fa5633a9e929161 100644 +index 0c878b99574b0e27f1463069f66d24bdecb01647..51331ad3f295b55631adcb6f47e34d0b03bd148a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1376,7 +1376,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1261,7 +1261,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.player.hasPermissions(2)) { Entity entity = this.player.level().getEntity(packet.getEntityId()); @@ -17,7 +17,7 @@ index 3c4825e295eefc7fcd628ba804fcc7dd5f160f28..280ebeee9bfae3059b6681873fa5633a CompoundTag nbttagcompound = entity.saveWithoutId(new CompoundTag()); this.player.connection.send(new ClientboundTagQueryPacket(packet.getTransactionId(), nbttagcompound)); -@@ -1388,7 +1388,10 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1273,7 +1273,10 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0033-Fix-ClickEvents-on-Signs-bypassing-permissions.patch b/patches/server/0031-Fix-ClickEvents-on-Signs-bypassing-permissions.patch similarity index 100% rename from patches/server/0033-Fix-ClickEvents-on-Signs-bypassing-permissions.patch rename to patches/server/0031-Fix-ClickEvents-on-Signs-bypassing-permissions.patch diff --git a/patches/server/0034-Refuse-to-convert-legacy-messages-over-1k-characters.patch b/patches/server/0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch similarity index 100% rename from patches/server/0034-Refuse-to-convert-legacy-messages-over-1k-characters.patch rename to patches/server/0032-Refuse-to-convert-legacy-messages-over-1k-characters.patch diff --git a/patches/server/0035-Prevent-velocity-freeze.patch b/patches/server/0033-Prevent-velocity-freeze.patch similarity index 100% rename from patches/server/0035-Prevent-velocity-freeze.patch rename to patches/server/0033-Prevent-velocity-freeze.patch diff --git a/patches/server/0036-Add-configuration-option-to-disable-chat-signatures.patch b/patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch similarity index 92% rename from patches/server/0036-Add-configuration-option-to-disable-chat-signatures.patch rename to patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch index d931082..cf1b8a7 100644 --- a/patches/server/0036-Add-configuration-option-to-disable-chat-signatures.patch +++ b/patches/server/0034-Add-configuration-option-to-disable-chat-signatures.patch @@ -60,7 +60,7 @@ index c0a80824a0307ea673805015119cc834b268f0dc..9f28f86b1b56ea55ab39f6ac988c1f47 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 562289bbe08b8d8e75436ad94cfc02e7c0e95d2e..a98134b3b59e194c03bb8110652a9208263c420d 100644 +index 51331ad3f295b55631adcb6f47e34d0b03bd148a..19f573a1f62280bd9b67a4027962fcb7de6d2514 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,5 +1,6 @@ @@ -70,7 +70,7 @@ index 562289bbe08b8d8e75436ad94cfc02e7c0e95d2e..a98134b3b59e194c03bb8110652a9208 import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import com.google.common.collect.Lists; import com.google.common.primitives.Floats; -@@ -2368,7 +2369,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2219,7 +2220,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } private void handleMessageDecodeFailure(SignedMessageChain.DecodeException exception) { @@ -79,7 +79,7 @@ index 562289bbe08b8d8e75436ad94cfc02e7c0e95d2e..a98134b3b59e194c03bb8110652a9208 this.disconnect(exception.getComponent(), exception.kickCause); // Paper - kick event causes } else { this.player.sendSystemMessage(exception.getComponent().copy().withStyle(ChatFormatting.RED)); -@@ -2424,6 +2425,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2275,6 +2276,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Optional optional = this.lastSeenMessages.applyUpdate(acknowledgment); if (optional.isEmpty()) { @@ -87,7 +87,7 @@ index 562289bbe08b8d8e75436ad94cfc02e7c0e95d2e..a98134b3b59e194c03bb8110652a9208 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 } -@@ -2632,6 +2634,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2483,6 +2485,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl synchronized (this.lastSeenMessages) { if (!this.lastSeenMessages.applyOffset(packet.offset())) { @@ -95,7 +95,7 @@ index 562289bbe08b8d8e75436ad94cfc02e7c0e95d2e..a98134b3b59e194c03bb8110652a9208 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 } -@@ -3673,6 +3676,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3455,6 +3458,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleChatSessionUpdate(ServerboundChatSessionUpdatePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0035-Patch-large-selector-distance-crash.patch b/patches/server/0035-Patch-large-selector-distance-crash.patch new file mode 100644 index 0000000..6dd8079 --- /dev/null +++ b/patches/server/0035-Patch-large-selector-distance-crash.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luna +Date: Sun, 2 Apr 2023 16:29:51 -0300 +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 +index 8897496323378080135127f53db004d576476c21..5f957d3241c1931f8166bc9e4960cef15679e932 100644 +--- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java ++++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java +@@ -129,9 +129,9 @@ public interface MinMaxBounds { + + public static record Doubles(Optional min, Optional max, Optional minSq, Optional maxSq) implements MinMaxBounds { + public static final MinMaxBounds.Doubles ANY = new MinMaxBounds.Doubles(Optional.empty(), Optional.empty()); +- public static final Codec CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); ++ public static final Codec CODEC = MinMaxBounds.createCodec(Codec.DOUBLE, MinMaxBounds.Doubles::new); // Scissors - compile fixes + +- private Doubles(Optional optional, Optional optional2) { ++ public Doubles(Optional optional, Optional optional2) { // Scissors - private -> public + this(optional, optional2, squareOpt(optional), squareOpt(optional2)); + } + +@@ -202,7 +202,7 @@ public interface MinMaxBounds { + + public static record Ints(Optional min, Optional max, Optional minSq, Optional maxSq) implements MinMaxBounds { + public static final MinMaxBounds.Ints ANY = new MinMaxBounds.Ints(Optional.empty(), Optional.empty()); +- public static final Codec CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new); ++ public static final Codec CODEC = MinMaxBounds.createCodec(Codec.INT, MinMaxBounds.Ints::new); // Scissors - compile fixes + + private Ints(Optional optional, Optional optional2) { + 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 +index 73c15a0c56a103ba4e62f0a51af8d42566b07245..6cb3e86f2d661a55536b782729f768ef72163223 100644 +--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java ++++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java +@@ -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.Predicate; + import javax.annotation.Nullable; ++import me.totalfreedom.scissors.MathUtility; // Scissors + import net.minecraft.advancements.critereon.MinMaxBounds; + import net.minecraft.commands.CommandSourceStack; + import net.minecraft.commands.arguments.EntityArgument; +@@ -60,9 +62,26 @@ public class EntitySelector { + this.includesEntities = includesNonPlayers; + this.worldLimited = localWorldOnly; + this.predicate = basePredicate; +- this.range = distance; ++ // Scissors start - Patch large selector distance crash ++ this.range = new MinMaxBounds.Doubles( ++ distance.min().map(min -> Math.min(min, 1024)), ++ distance.max().map(max -> Math.min(max, 1024)) ++ ); + this.position = positionOffset; +- this.aabb = box; ++ if (box != null) { ++ this.aabb = new AABB( ++ MathUtility.clampDouble(box.minX, -1024, 1025), ++ MathUtility.clampDouble(box.minY, -1024, 1025), ++ MathUtility.clampDouble(box.minZ, -1024, 1025), ++ MathUtility.clampDouble(box.maxX, -1024, 1025), ++ MathUtility.clampDouble(box.maxY, -1024, 1025), ++ MathUtility.clampDouble(box.maxZ, -1024, 1025), ++ false ++ ); ++ } else { ++ this.aabb = null; ++ } ++ // Scissors end + this.order = sorter; + this.currentEntity = senderOnly; + this.playerName = playerName; diff --git a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch similarity index 83% rename from patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch rename to patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch index 4e9445c..cd2b1bf 100644 --- a/patches/server/0037-Patch-invalid-entity-rotation-log-spam.patch +++ b/patches/server/0036-Patch-invalid-entity-rotation-log-spam.patch @@ -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 -index 842f8af14b2bd694a48ee6573d98e6cfcf910e16..e9e98f09e13d7f21333450d892cdc80b0667c915 100644 +index 7f5b2787482f52114c62f8b9d19755f3baeaefa0..759ca876613e334805aa041f049b2f556a0e92a2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4617,7 +4617,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4658,7 +4658,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void setXRot(float pitch) { if (!Float.isFinite(pitch)) { diff --git a/patches/server/0039-Limit-sculk-catalyst-cursor-positions.patch b/patches/server/0037-Limit-sculk-catalyst-cursor-positions.patch similarity index 100% rename from patches/server/0039-Limit-sculk-catalyst-cursor-positions.patch rename to patches/server/0037-Limit-sculk-catalyst-cursor-positions.patch diff --git a/patches/server/0038-Limit-map-decorations.patch b/patches/server/0038-Limit-map-decorations.patch new file mode 100644 index 0000000..310eaa6 --- /dev/null +++ b/patches/server/0038-Limit-map-decorations.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luna +Date: Fri, 28 Apr 2023 16:29:23 -0300 +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 +index 81f3e64d94fa17e45411e5c1641d9c5a2fe3d2e2..bcf6e2ce9f00d1688a5fa00ec055a57389346922 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundMapItemDataPacket.java +@@ -65,7 +65,8 @@ public class ClientboundMapItemDataPacket implements Packet 32) { ++ return; ++ } ++ // Scissors end + int i = 1 << this.scale; + float f = (float) (x - (double) this.centerX) / (float) i; + float f1 = (float) (z - (double) this.centerZ) / (float) i; diff --git a/patches/server/0038-Patch-large-selector-distance-crash.patch b/patches/server/0038-Patch-large-selector-distance-crash.patch deleted file mode 100644 index 034c00b..0000000 --- a/patches/server/0038-Patch-large-selector-distance-crash.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Luna -Date: Sun, 2 Apr 2023 16:29:51 -0300 -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 -index 60d32afe2eecdfebdc91531ca3672f8f130ac30e..73b0f516f80ef810379860ea74697a3429c646e5 100644 ---- a/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java -+++ b/src/main/java/net/minecraft/advancements/critereon/MinMaxBounds.java -@@ -177,7 +177,7 @@ public abstract class MinMaxBounds { - return value == null ? null : value * value; - } - -- private Doubles(@Nullable Double min, @Nullable Double max) { -+ public Doubles(@Nullable Double min, @Nullable Double max) { // Scissors - private -> public - super(min, max); - this.minSq = squareOpt(min); - this.maxSq = squareOpt(max); -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 f25b9330e068c7d9e12cb57a7761cfef9ebaf7bc..e8cf963f0190438bbf65f827d144775ab0b02b63 100644 ---- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java -+++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelector.java -@@ -10,6 +10,7 @@ import java.util.function.BiConsumer; - import java.util.function.Function; - import java.util.function.Predicate; - import javax.annotation.Nullable; -+import me.totalfreedom.scissors.MathUtility; // Scissors - import net.minecraft.advancements.critereon.MinMaxBounds; - import net.minecraft.commands.CommandSourceStack; - import net.minecraft.commands.arguments.EntityArgument; -@@ -60,9 +61,27 @@ public class EntitySelector { - this.includesEntities = includesNonPlayers; - this.worldLimited = localWorldOnly; - this.predicate = basePredicate; -- this.range = distance; -+ -+ // Scissors start - Patch large selector distance crash -+ this.range = new MinMaxBounds.Doubles( -+ distance.getMin() != null ? Math.min(distance.getMin(), 1024) : null, -+ distance.getMax() != null ? Math.min(distance.getMax(), 1024) : null -+ ); - this.position = positionOffset; -- this.aabb = box; -+ if (box != null) { -+ this.aabb = new AABB( -+ MathUtility.clampDouble(box.minX, -1024, 1025), -+ MathUtility.clampDouble(box.minY, -1024, 1025), -+ MathUtility.clampDouble(box.minZ, -1024, 1025), -+ MathUtility.clampDouble(box.maxX, -1024, 1025), -+ MathUtility.clampDouble(box.maxY, -1024, 1025), -+ MathUtility.clampDouble(box.maxZ, -1024, 1025), -+ false -+ ); -+ } else { -+ this.aabb = null; -+ } -+ // Scissors end - this.order = sorter; - this.currentEntity = senderOnly; - this.playerName = playerName; diff --git a/patches/server/0041-Prevent-player-banning-using-duplicate-UUIDs.patch b/patches/server/0039-Prevent-player-banning-using-duplicate-UUIDs.patch similarity index 84% rename from patches/server/0041-Prevent-player-banning-using-duplicate-UUIDs.patch rename to patches/server/0039-Prevent-player-banning-using-duplicate-UUIDs.patch index 0a4ca52..5338b82 100644 --- a/patches/server/0041-Prevent-player-banning-using-duplicate-UUIDs.patch +++ b/patches/server/0039-Prevent-player-banning-using-duplicate-UUIDs.patch @@ -5,12 +5,12 @@ 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 -index 20099425babf5325005d11bf25faa783e3bc2715..cf02fc7199c893db66bebba6051bc10dbff859ac 100644 +index 17610196db7a1c6feb2cf74a02479a8691aa323f..70c52e2293d64d32fdcebbcd0678e0c80d35fbb8 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1628,7 +1628,13 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1644,7 +1644,13 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity != null) { - ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID().toString()); + ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); entity.unRide(); - this.removePlayerImmediately((ServerPlayer) entity, Entity.RemovalReason.DISCARDED); + // Scissors start - Prevent player banning using duplicate UUIDs diff --git a/patches/server/0042-Don-t-warn-on-duplicate-entity-UUIDs.patch b/patches/server/0040-Don-t-warn-on-duplicate-entity-UUIDs.patch similarity index 86% rename from patches/server/0042-Don-t-warn-on-duplicate-entity-UUIDs.patch rename to patches/server/0040-Don-t-warn-on-duplicate-entity-UUIDs.patch index 615307e..6667b27 100644 --- a/patches/server/0042-Don-t-warn-on-duplicate-entity-UUIDs.patch +++ b/patches/server/0040-Don-t-warn-on-duplicate-entity-UUIDs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't warn on duplicate entity UUIDs diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java -index ff7198a03ab0da79c98513f4a1507e854484f4c2..e7060fce4ba3583cf5be5f6503fd861a24704d6d 100644 +index 15ee41452992714108efe53b708b5a4e1da7c1ff..5054dce35127cb0132431021578c345fcbb1f92a 100644 --- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java +++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java -@@ -372,7 +372,7 @@ public final class EntityLookup implements LevelEntityGetter { +@@ -415,7 +415,7 @@ public final class EntityLookup implements LevelEntityGetter { return false; } if (this.entityByUUID.containsKey(entity.getUUID())) { diff --git a/patches/server/0040-Limit-map-decorations.patch b/patches/server/0040-Limit-map-decorations.patch deleted file mode 100644 index d6e1c17..0000000 --- a/patches/server/0040-Limit-map-decorations.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Luna -Date: Fri, 28 Apr 2023 16:29:23 -0300 -Subject: [PATCH] Limit map decorations - - -diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java -index 347d2914f9560a3ee8cea59444bc0dfbb7cf3456..b6a38b1458957bd444fea439fa81d2976ffb86e0 100644 ---- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java -+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapDecoration.java -@@ -2,6 +2,7 @@ package net.minecraft.world.level.saveddata.maps; - - import java.util.Objects; - import javax.annotation.Nullable; -+import net.minecraft.ChatFormatting; // Scissors - import net.minecraft.network.chat.Component; - import net.minecraft.util.Mth; - -@@ -14,6 +15,11 @@ public class MapDecoration { - private final Component name; - - public MapDecoration(MapDecoration.Type type, byte x, byte z, byte rotation, @Nullable Component text) { -+ // Scissors start - Limit decoration text length -+ if (text != null && text.getString().length() > 32) { -+ text = null; -+ } -+ // Scissors end - this.type = type; - this.x = x; - this.y = z; -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 50713f03c783c63f93710d986d94af544be0615a..feaf252eda57739fe012b865db8c03476a5b4d1a 100644 ---- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -354,6 +354,11 @@ public class MapItemSavedData extends SavedData { - } - - private void addDecoration(MapDecoration.Type type, @Nullable LevelAccessor world, String key, double x, double z, double rotation, @Nullable Component text) { -+ // Scissors start - Limit decoration count -+ if (this.decorations.size() > 32) { -+ return; -+ } -+ // Scissors end - int i = 1 << this.scale; - float f = (float) (x - (double) this.centerX) / (float) i; - float f1 = (float) (z - (double) this.centerZ) / (float) i; diff --git a/patches/server/0043-Fix-component-extra-empty-array-exploit.patch b/patches/server/0041-Fix-component-extra-empty-array-exploit.patch similarity index 91% rename from patches/server/0043-Fix-component-extra-empty-array-exploit.patch rename to patches/server/0041-Fix-component-extra-empty-array-exploit.patch index b506470..df0a0c3 100644 --- a/patches/server/0043-Fix-component-extra-empty-array-exploit.patch +++ b/patches/server/0041-Fix-component-extra-empty-array-exploit.patch @@ -5,7 +5,7 @@ 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 2873ed7c443ed8c8c57a8b1d3e444d229f10f07b..a2149452ee461002ea74189c5aa49cddd943d0cf 100644 +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 { diff --git a/patches/server/0044-Add-depth-limit-to-Component-deserializer.patch b/patches/server/0042-Add-depth-limit-to-Component-deserializer.patch similarity index 98% rename from patches/server/0044-Add-depth-limit-to-Component-deserializer.patch rename to patches/server/0042-Add-depth-limit-to-Component-deserializer.patch index c05b2a1..c8d87de 100644 --- a/patches/server/0044-Add-depth-limit-to-Component-deserializer.patch +++ b/patches/server/0042-Add-depth-limit-to-Component-deserializer.patch @@ -5,7 +5,7 @@ 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 a2149452ee461002ea74189c5aa49cddd943d0cf..f1d1501211a923c0ccab6b5982887c3a9262889b 100644 +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; diff --git a/patches/server/0045-Implement-command-block-events.patch b/patches/server/0043-Implement-command-block-events.patch similarity index 91% rename from patches/server/0045-Implement-command-block-events.patch rename to patches/server/0043-Implement-command-block-events.patch index cb22ef3..4c96b62 100644 --- a/patches/server/0045-Implement-command-block-events.patch +++ b/patches/server/0043-Implement-command-block-events.patch @@ -18,7 +18,7 @@ index c99fc118013cb3d4043638e2001a8297e79ddf9c..cdaa81e1f2167b29ec01cc25e51a8400 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 -index 08390409bbaf9f3ae8260ab36ea5e0580e93b3e3..e2f7cef0edf2775083eb87b1cb5984ec8b25c76f 100644 +index 19f573a1f62280bd9b67a4027962fcb7de6d2514..f5cdac55c8cbe334b96c5a0b2c34f216109120d3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1,6 +1,8 @@ @@ -30,7 +30,7 @@ index 08390409bbaf9f3ae8260ab36ea5e0580e93b3e3..e2f7cef0edf2775083eb87b1cb5984ec import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; // Scissors import com.google.common.collect.Lists; import com.google.common.primitives.Floats; -@@ -159,6 +161,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.projectile.AbstractArrow; import net.minecraft.world.entity.vehicle.Boat; @@ -38,7 +38,7 @@ index 08390409bbaf9f3ae8260ab36ea5e0580e93b3e3..e2f7cef0edf2775083eb87b1cb5984ec import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.Item; -@@ -187,6 +190,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.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; @@ -47,7 +47,7 @@ index 08390409bbaf9f3ae8260ab36ea5e0580e93b3e3..e2f7cef0edf2775083eb87b1cb5984ec import org.slf4j.Logger; // CraftBukkit start -@@ -1007,6 +1012,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -892,6 +897,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity); } @@ -64,7 +64,7 @@ index 08390409bbaf9f3ae8260ab36ea5e0580e93b3e3..e2f7cef0edf2775083eb87b1cb5984ec commandblocklistenerabstract.setCommand(s); commandblocklistenerabstract.setTrackOutput(flag); if (!flag) { -@@ -1038,7 +1053,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -923,7 +938,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); if (commandblocklistenerabstract != null) { diff --git a/patches/server/0046-Add-depth-limit-to-SNBT.patch b/patches/server/0044-Add-depth-limit-to-SNBT.patch similarity index 91% rename from patches/server/0046-Add-depth-limit-to-SNBT.patch rename to patches/server/0044-Add-depth-limit-to-SNBT.patch index 1120102..dd5f315 100644 --- a/patches/server/0046-Add-depth-limit-to-SNBT.patch +++ b/patches/server/0044-Add-depth-limit-to-SNBT.patch @@ -5,10 +5,10 @@ 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 -index fbfe810e8be6cb159742f7fd85e7491b9cefa4dc..b70bafe2766efcbcce00287e6511a588560564a6 100644 +index ee012f1ef1ff7f2adf76d1690dbd5611af7deb4d..d79723047317c24c53fb85c423de8dd9f84891ac 100644 --- a/src/main/java/net/minecraft/nbt/TagParser.java +++ b/src/main/java/net/minecraft/nbt/TagParser.java -@@ -169,9 +169,56 @@ public class TagParser { +@@ -179,9 +179,56 @@ public class TagParser { } this.expect('}'); @@ -66,7 +66,7 @@ index fbfe810e8be6cb159742f7fd85e7491b9cefa4dc..b70bafe2766efcbcce00287e6511a588 private Tag readListTag() throws CommandSyntaxException { this.expect('['); this.reader.skipWhitespace(); -@@ -203,7 +250,7 @@ public class TagParser { +@@ -213,7 +260,7 @@ public class TagParser { } this.expect(']'); @@ -75,7 +75,7 @@ index fbfe810e8be6cb159742f7fd85e7491b9cefa4dc..b70bafe2766efcbcce00287e6511a588 } } -@@ -228,7 +275,7 @@ public class TagParser { +@@ -238,7 +285,7 @@ public class TagParser { } private List readArray(TagType arrayTypeReader, TagType typeReader) throws CommandSyntaxException { @@ -84,7 +84,7 @@ index fbfe810e8be6cb159742f7fd85e7491b9cefa4dc..b70bafe2766efcbcce00287e6511a588 while(true) { if (this.reader.peek() != ']') { -@@ -241,11 +288,11 @@ public class TagParser { +@@ -251,11 +298,11 @@ public class TagParser { } if (typeReader == ByteTag.TYPE) { @@ -99,7 +99,7 @@ index fbfe810e8be6cb159742f7fd85e7491b9cefa4dc..b70bafe2766efcbcce00287e6511a588 } if (this.hasElementSeparator()) { -@@ -257,7 +304,7 @@ public class TagParser { +@@ -267,7 +314,7 @@ public class TagParser { } this.expect(']'); diff --git a/patches/server/0047-Limit-beacon-effectRange.patch b/patches/server/0045-Limit-beacon-effectRange.patch similarity index 83% rename from patches/server/0047-Limit-beacon-effectRange.patch rename to patches/server/0045-Limit-beacon-effectRange.patch index a273b57..46ad5b9 100644 --- a/patches/server/0047-Limit-beacon-effectRange.patch +++ b/patches/server/0045-Limit-beacon-effectRange.patch @@ -5,10 +5,10 @@ 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 -index 5c951ef93fe4cf4f085df86b0cefc02bc2610ab9..1d08e3a9493154e075a289d2eb9a8772289534af 100644 +index f13943db6f2fb923c52dcf9e8bf7000041d0a362..2fdcc47dd6a813d5f7a32dc58ca67b6b965c8749 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -83,7 +83,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name +@@ -87,7 +87,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name private double effectRange = -1; public double getEffectRange() { @@ -17,7 +17,7 @@ index 5c951ef93fe4cf4f085df86b0cefc02bc2610ab9..1d08e3a9493154e075a289d2eb9a8772 return this.levels * 10 + 10; } else { return effectRange; -@@ -428,6 +428,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.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper diff --git a/patches/server/0048-Improve-validation-of-ResourceLocations.patch b/patches/server/0046-Improve-validation-of-ResourceLocations.patch similarity index 100% rename from patches/server/0048-Improve-validation-of-ResourceLocations.patch rename to patches/server/0046-Improve-validation-of-ResourceLocations.patch diff --git a/patches/server/0049-Don-t-log-on-too-many-chained-updates.patch b/patches/server/0047-Don-t-log-on-too-many-chained-updates.patch similarity index 90% rename from patches/server/0049-Don-t-log-on-too-many-chained-updates.patch rename to patches/server/0047-Don-t-log-on-too-many-chained-updates.patch index e4fc6de..51e1ab4 100644 --- a/patches/server/0049-Don-t-log-on-too-many-chained-updates.patch +++ b/patches/server/0047-Don-t-log-on-too-many-chained-updates.patch @@ -5,7 +5,7 @@ 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 -index ec81be70cd6f92bbf9011395cb361f0ce54c5ad0..97da1db83dca24759b52fc2d0a360187dbef86f1 100644 +index 598dc0d3a2b9387e76d7e4e19e54c4573a24bc54..9eed28bf8bc7e2fa528729cde01a535bc7040815 100644 --- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java @@ -56,7 +56,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { diff --git a/patches/server/0050-Fix-packet-related-lag-exploits.patch b/patches/server/0048-Fix-packet-related-lag-exploits.patch similarity index 85% rename from patches/server/0050-Fix-packet-related-lag-exploits.patch rename to patches/server/0048-Fix-packet-related-lag-exploits.patch index 9f76e4f..80be59d 100644 --- a/patches/server/0050-Fix-packet-related-lag-exploits.patch +++ b/patches/server/0048-Fix-packet-related-lag-exploits.patch @@ -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 -index e2f7cef0edf2775083eb87b1cb5984ec8b25c76f..c645e05ec6c309448460c7e983931b9dc79a7f7e 100644 +index f5cdac55c8cbe334b96c5a0b2c34f216109120d3..78f9e0587f35ed8034fd2c275e0e06abae90e0e6 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -972,7 +972,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -857,7 +857,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl 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 this.player.sendSystemMessage(Component.translatable("advMode.notAllowed")); @@ -17,7 +17,7 @@ index e2f7cef0edf2775083eb87b1cb5984ec8b25c76f..c645e05ec6c309448460c7e983931b9d BaseCommandBlock commandblocklistenerabstract = null; CommandBlockEntity tileentitycommand = null; BlockPos blockposition = packet.getPos(); -@@ -1139,7 +1139,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1024,7 +1024,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSetStructureBlock(ServerboundSetStructureBlockPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -26,7 +26,7 @@ index e2f7cef0edf2775083eb87b1cb5984ec8b25c76f..c645e05ec6c309448460c7e983931b9d BlockPos blockposition = packet.getPos(); BlockState iblockdata = this.player.level().getBlockState(blockposition); BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); -@@ -1197,7 +1197,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1082,7 +1082,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSetJigsawBlock(ServerboundSetJigsawBlockPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); @@ -35,7 +35,7 @@ index e2f7cef0edf2775083eb87b1cb5984ec8b25c76f..c645e05ec6c309448460c7e983931b9d BlockPos blockposition = packet.getPos(); BlockState iblockdata = this.player.level().getBlockState(blockposition); BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); -@@ -1220,7 +1220,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1105,7 +1105,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleJigsawGenerate(ServerboundJigsawGeneratePacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0051-Limit-save-data-for-Bees-and-Vexes.patch b/patches/server/0049-Limit-save-data-for-Bees-and-Vexes.patch similarity index 92% rename from patches/server/0051-Limit-save-data-for-Bees-and-Vexes.patch rename to patches/server/0049-Limit-save-data-for-Bees-and-Vexes.patch index 022bf2b..a3d10c6 100644 --- a/patches/server/0051-Limit-save-data-for-Bees-and-Vexes.patch +++ b/patches/server/0049-Limit-save-data-for-Bees-and-Vexes.patch @@ -5,7 +5,7 @@ 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 -index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..4a8383d48da4fcf39ec528a00cd09417f8d08c57 100644 +index 9a7956befc346e1b58f064213800fd099a052fc6..2ebedd806bafc6ff7c4bf5a962ead50ce2ad1a8a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -227,8 +227,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @@ -24,7 +24,7 @@ index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..4a8383d48da4fcf39ec528a00cd09417 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 -index 65cb385ab294e362d666a6d03c4496cdc3b64890..42c3e946e51f6dcb100078969a4fb46c77f42b2d 100644 +index 90e577b1a89b02c38daff2845a63dafe5ed929e1..1a2b6ee032ab6952634c9f596820db3e7374fb50 100644 --- a/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 { diff --git a/patches/server/0052-Mute-invalid-attributes.patch b/patches/server/0050-Mute-invalid-attributes.patch similarity index 84% rename from patches/server/0052-Mute-invalid-attributes.patch rename to patches/server/0050-Mute-invalid-attributes.patch index 15899dd..0da0a1c 100644 --- a/patches/server/0052-Mute-invalid-attributes.patch +++ b/patches/server/0050-Mute-invalid-attributes.patch @@ -5,10 +5,10 @@ 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 -index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..d304612325d6c70a4100582d6c0fbfeecd8716d1 100644 +index 7204b973c3ad9239e82355513f6d538107102e48..2463444778f19f937b18173798c04d9d9788a824 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -145,7 +145,7 @@ public class AttributeMap { +@@ -147,7 +147,7 @@ public class AttributeMap { } }, () -> { @@ -18,10 +18,10 @@ index dd1102d5291ef6f18e82400a6d8a0a376cc071e9..d304612325d6c70a4100582d6c0fbfee } 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 8de09eea46c27db9d8c472e84f768976769d1b0b..c8d05d35368e0cf593bcc3589b6c108a901bdc22 100644 +index a7380ce6dcbf64ad8a51dd047d178ae887518041..cb015941e5ea4618bd0964f4aa66a9f0fceb27a1 100644 --- a/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")); return new AttributeModifier(uUID, nbt.getString("Name"), nbt.getDouble("Amount"), operation); } catch (Exception var3) { diff --git a/patches/server/0053-Mute-invalid-Enderdragon-phases.patch b/patches/server/0051-Mute-invalid-Enderdragon-phases.patch similarity index 100% rename from patches/server/0053-Mute-invalid-Enderdragon-phases.patch rename to patches/server/0051-Mute-invalid-Enderdragon-phases.patch diff --git a/patches/server/0055-Don-t-return-null-Components-in-the-Component-codec.patch b/patches/server/0052-Don-t-return-null-Components-in-the-Component-codec.patch similarity index 63% rename from patches/server/0055-Don-t-return-null-Components-in-the-Component-codec.patch rename to patches/server/0052-Don-t-return-null-Components-in-the-Component-codec.patch index 31e2c5a..52f7bb2 100644 --- a/patches/server/0055-Don-t-return-null-Components-in-the-Component-codec.patch +++ b/patches/server/0052-Don-t-return-null-Components-in-the-Component-codec.patch @@ -6,23 +6,11 @@ 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 066d423dc908080157586555ba01053a2477d570..aa6e5de37ce69c9bc6b8e1e0b5ab0ee918fc27e2 100644 +index 607f32b856c6c1fb81d3f1604f3bf3fb240d713f..5afdc9d93e696568cc8a263ab0142fbac258e874 100644 --- a/src/main/java/net/minecraft/util/ExtraCodecs.java +++ b/src/main/java/net/minecraft/util/ExtraCodecs.java -@@ -62,7 +62,10 @@ public class ExtraCodecs { - }); - public static final Codec COMPONENT = JSON.flatXmap((element) -> { - try { -- return DataResult.success(Component.Serializer.fromJson(element)); -+ // Scissors start -+ final Component component = Component.Serializer.fromJson(element); -+ return DataResult.success(component != null ? component : Component.empty()); -+ // Scissors end - } catch (JsonParseException var2) { - return DataResult.error(var2::getMessage); - } -@@ -75,7 +78,10 @@ public class ExtraCodecs { - }); +@@ -70,7 +70,10 @@ public class ExtraCodecs { + public static final Codec COMPONENT = adaptJsonSerializer(Component.Serializer::fromJson, Component.Serializer::toJsonTree); public static final Codec FLAT_COMPONENT = Codec.STRING.flatXmap((json) -> { try { - return DataResult.success(Component.Serializer.fromJson(json)); @@ -33,7 +21,19 @@ index 066d423dc908080157586555ba01053a2477d570..aa6e5de37ce69c9bc6b8e1e0b5ab0ee9 } catch (JsonParseException var2) { return DataResult.error(var2::getMessage); } -@@ -246,7 +252,7 @@ public class ExtraCodecs { +@@ -233,7 +236,10 @@ public class ExtraCodecs { + public static Codec adaptJsonSerializer(Function deserializer, Function 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)); }); @@ -42,7 +42,7 @@ index 066d423dc908080157586555ba01053a2477d570..aa6e5de37ce69c9bc6b8e1e0b5ab0ee9 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()); -@@ -278,7 +284,7 @@ public class ExtraCodecs { +@@ -286,7 +292,7 @@ public class ExtraCodecs { Optional> optional = dataResult.resultOrPartial(mutableObject::setValue); return optional.isPresent() ? dataResult : DataResult.error(() -> { return "(" + (String)mutableObject.getValue() + " -> using default)"; @@ -51,12 +51,3 @@ index 066d423dc908080157586555ba01053a2477d570..aa6e5de37ce69c9bc6b8e1e0b5ab0ee9 } public DataResult coApply(DynamicOps dynamicOps, A objectx, DataResult dataResult) { -@@ -565,7 +571,7 @@ public class ExtraCodecs { - - static record LazyInitializedCodec(Supplier> delegate) implements Codec { - LazyInitializedCodec { -- supplier = Suppliers.memoize(supplier::get); -+ delegate = Suppliers.memoize(delegate::get); // Scissors - Decompile error - } - - public DataResult> decode(DynamicOps dynamicOps, T object) { diff --git a/patches/server/0054-Add-length-limit-to-note-block-sound.patch b/patches/server/0053-Add-length-limit-to-note-block-sound.patch similarity index 85% rename from patches/server/0054-Add-length-limit-to-note-block-sound.patch rename to patches/server/0053-Add-length-limit-to-note-block-sound.patch index 46c6329..161c66c 100644 --- a/patches/server/0054-Add-length-limit-to-note-block-sound.patch +++ b/patches/server/0053-Add-length-limit-to-note-block-sound.patch @@ -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 -index a2fc2c0437999dd09f080eafe8ea466b16cdf57b..0dcf1d7e041477fe31dce4b4ee707399520d30f2 100644 +index 238b6cd88cb24ca63770db607f2241fcd7210574..ec02597810a4022112ddf31928eb6976e6ac5371 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -@@ -80,7 +80,7 @@ public class SkullBlockEntity extends BlockEntity { +@@ -92,7 +92,7 @@ public class SkullBlockEntity extends BlockEntity { } if (nbt.contains("note_block_sound", 8)) { diff --git a/submodules/AdvancedSlimePaper b/submodules/AdvancedSlimePaper index 59df833..b085096 160000 --- a/submodules/AdvancedSlimePaper +++ b/submodules/AdvancedSlimePaper @@ -1 +1 @@ -Subproject commit 59df833a4e0eec263b2429c8f238a563cc4e87f9 +Subproject commit b08509639bfb280a47859a462d99e3970097bad9