diff --git a/gradle.properties b/gradle.properties index ff9c4a2..a1287d5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,8 +1,8 @@ group=me.totalfreedom.scissors -version=1.19.4-R0.1-SNAPSHOT +version=1.20-R0.1-SNAPSHOT -mcVersion=1.19.4 -paperRef=bc4a6647c99ae98c52c1c81597834be8fec6aa0d +mcVersion=1.20 +paperRef=8ce5219e074e4ab0dc3ecb8c3f7ff9fdc4b527f8 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/server/0001-Build-changes.patch b/patches/server/0001-Build-changes.patch index 5987ebd..e686ecd 100644 --- a/patches/server/0001-Build-changes.patch +++ b/patches/server/0001-Build-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Build changes diff --git a/build.gradle.kts b/build.gradle.kts -index 4f2fa65ade89c5703451dad4f80eeef162b277d1..9c1dc30f351b62bf7f527afed9da0021b4234aaf 100644 +index a3a76b9b7efa773117d2ee1ce53ef784b09b277d..fad5e021f1282cd478f6ce484edbc135494b81b3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,8 +7,10 @@ plugins { @@ -15,7 +15,7 @@ index 4f2fa65ade89c5703451dad4f80eeef162b277d1..9c1dc30f351b62bf7f527afed9da0021 - implementation(project(":paper-api")) - implementation(project(":paper-mojangapi")) + implementation(project(":Scissors-API")) -+ implementation("io.papermc.paper:paper-mojangapi:1.19.4-R0.1-SNAPSHOT") { ++ implementation("io.papermc.paper:paper-mojangapi:1.20-R0.1-SNAPSHOT") { + exclude("io.papermc.paper", "paper-api") + } // Paper start @@ -51,10 +51,10 @@ index 4f2fa65ade89c5703451dad4f80eeef162b277d1..9c1dc30f351b62bf7f527afed9da0021 standardInput = System.`in` workingDir = rootProject.layout.projectDirectory diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9f15d9dbdfa74a0640b1a2b4ff695609d4758a4c..c048169628a53462baf2e418136459719b2ac709 100644 +index fb82bb52f219e7683fe1d3c0fb3acbe2251de8d4..0f9928bf68f8bc5abfe02f41c98c63888987d9b9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1682,7 +1682,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop -Date: Sun, 13 Mar 2022 08:14:44 -0600 +From: Telesphoreo +Date: Thu, 8 Jun 2023 19:19:37 -0500 Subject: [PATCH] Ignore errors thrown when trying to remove minecart entities with content in them diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -index b8fb7b5a347298ada16bc8b818edf1863e3f6040..7ec912bfec20d6b5d91f23341c4e9e3188d1236b 100644 +index 272095d7a09ab41227d741172735f66fd2798ce1..ea966ea94062be3ed9b6b2c460a316378c016fa7 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java @@ -139,7 +139,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme @Override public void remove(Entity.RemovalReason reason) { - if (!this.level.isClientSide && reason.shouldDestroy()) { -- Containers.dropContents(this.level, (Entity) this, (Container) this); + if (!this.level().isClientSide && reason.shouldDestroy()) { +- Containers.dropContents(this.level(), (Entity) this, (Container) this); + // Scissors start - Ignore errors thrown when trying to remove minecart entities with content in them + try { -+ Containers.dropContents(this.level, (Entity) this, (Container) this); ++ Containers.dropContents(this.level(), (Entity) this, (Container) this); + } catch (Exception ignored) { + } + // Scissors end diff --git a/patches/server/0008-ItemEntity-Check-if-items-are-air-before-calling-set.patch b/patches/server/0008-ItemEntity-Check-if-items-are-air-before-calling-set.patch index 2e15036..bfeca6d 100644 --- a/patches/server/0008-ItemEntity-Check-if-items-are-air-before-calling-set.patch +++ b/patches/server/0008-ItemEntity-Check-if-items-are-air-before-calling-set.patch @@ -5,10 +5,10 @@ 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 d47b3ac633e7936d30abfda6fc46c2c7412d76fe..1b4d21b5960ef09bada7c707fc5ba4e5cc39630c 100644 +index 3d41dbe0285f8fec8adae1e93010cf464df9b08c..7ee2c5beaaca9deb61589074f55e4004d1dd76b5 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -416,11 +416,15 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -420,11 +420,15 @@ public class ItemEntity extends Entity implements TraceableEntity { CompoundTag nbttagcompound1 = nbt.getCompound("Item"); diff --git a/patches/server/0012-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch b/patches/server/0012-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch index 3b283a4..8a25621 100644 --- a/patches/server/0012-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch +++ b/patches/server/0012-Do-not-log-invalid-items-in-HoverEvent-and-ItemFrame.patch @@ -27,10 +27,10 @@ index c0633f9553fb5aa52e8ffc863159521d09cb3bd5..7449a024265c42f28a6c9a1ed8d8f4b9 } } diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index 30aec9dff249ae629b22318e52902361a9fa4099..f87a58097889720cbc6510345696e03722b4f0a8 100644 +index 955316687e2e29ad75a0052317a7b0f89034c82a..2537c48d1269d8ea51222412b2eeaac26a7dc4d4 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -@@ -432,7 +432,7 @@ public class ItemFrame extends HangingEntity { +@@ -431,7 +431,7 @@ public class ItemFrame extends HangingEntity { ItemStack itemstack = ItemStack.of(nbttagcompound1); if (itemstack.isEmpty()) { diff --git a/patches/server/0013-Even-more-resource-location-validation.patch b/patches/server/0013-Even-more-resource-location-validation.patch index 89b16bd..874c66a 100644 --- a/patches/server/0013-Even-more-resource-location-validation.patch +++ b/patches/server/0013-Even-more-resource-location-validation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Even more resource location validation diff --git a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java -index 168b60fda38a7172f4473017ccc42447b36faab2..9f01b0f18bf656a7ab62f07cc98aaded96432665 100644 +index db3cddf8b227453c9b08e481b21101c5d2e0472d..77ae3bc5fd6cf34aae7bd3baa563f3e23e57de26 100644 --- a/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java +++ b/src/main/java/net/minecraft/world/entity/AreaEffectCloud.java @@ -145,7 +145,7 @@ public class AreaEffectCloud extends Entity implements TraceableEntity { @@ -18,7 +18,7 @@ index 168b60fda38a7172f4473017ccc42447b36faab2..9f01b0f18bf656a7ab62f07cc98aaded // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index ceacc0d383e2ee674783d3c0a7df0a951595faca..32b2558fca4642373f7794449e89bfe275c5cf0d 100644 +index 9afc81ccb237c3655d64cdbe8a0db9a4d7791043..ffcb77755b28bcdb3eae981fc735e6dde664bb6e 100644 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -588,7 +588,7 @@ public class EntityType implements FeatureElement, EntityTypeT @@ -40,10 +40,10 @@ index ceacc0d383e2ee674783d3c0a7df0a951595faca..32b2558fca4642373f7794449e89bfe2 @Nullable diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 02cb6b8c1d59855ff4a8aad3024fe12007eca0ee..9a64944c6769ced4d82b8edbbc045b870a256cb9 100644 +index e2a25c29ec74147b3e66aa0b3deb85a8f6ee53a5..b0c953ad8275740679c847e348b311de93d64965 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -615,7 +615,7 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -618,7 +618,7 @@ public abstract class Mob extends LivingEntity implements Targeting { this.setLeftHanded(nbt.getBoolean("LeftHanded")); if (nbt.contains("DeathLootTable", 8)) { diff --git a/patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch b/patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch index 9eb8cb2..c2614b0 100644 --- a/patches/server/0015-Prevent-attributes-with-invalid-namespaces-from-bein.patch +++ b/patches/server/0015-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 e3d5ded703be73343d821f329175710609dc388f..7c04bab95a49c527831949c9618ab96320b1b7ad 100644 +index af5a1111a06789e1401f8c60bb4c8838587f2376..bfcdc18f9b06023a5c461e06abbb93eea32bcdba 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; @@ -15,9 +15,9 @@ index e3d5ded703be73343d821f329175710609dc388f..7c04bab95a49c527831949c9618ab963 import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.BlockItem; + import net.minecraft.world.level.block.state.BlockState; import org.apache.commons.lang.Validate; - import org.apache.commons.lang3.EnumUtils; -@@ -484,7 +485,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -485,7 +486,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/0020-Fix-negative-death-times.patch b/patches/server/0020-Fix-negative-death-times.patch index 44a3a2a..dfdcc3a 100644 --- a/patches/server/0020-Fix-negative-death-times.patch +++ b/patches/server/0020-Fix-negative-death-times.patch @@ -1,19 +1,19 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Telesphoreo -Date: Sat, 10 Dec 2022 23:23:52 -0600 +Date: Thu, 8 Jun 2023 19:24:05 -0500 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 e9d3e34520b706627205e0d5b17b25e09f198e7e..36b1fcc106909aa7305d63bb4710b4330cb9bc6a 100644 +index 67627bbf84f5aab2872f636b1dcb6728c8494147..468f64afb7e9b3ef579205d3beea025deb31b460 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -612,7 +612,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -630,7 +630,7 @@ public abstract class LivingEntity extends Entity implements Attackable { protected void tickDeath() { ++this.deathTime; -- if (this.deathTime >= 20 && !this.level.isClientSide() && !this.isRemoved()) { -+ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level.isClientSide() && !this.isRemoved()) { - this.level.broadcastEntityEvent(this, (byte) 60); +- if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) { ++ if ((this.deathTime >= 20 || this.deathTime <= 0) && !this.level().isClientSide() && !this.isRemoved()) { + this.level().broadcastEntityEvent(this, (byte) 60); this.remove(Entity.RemovalReason.KILLED); } diff --git a/patches/server/0022-Validate-coordinates-before-attempting-to-get-block-.patch b/patches/server/0022-Validate-coordinates-before-attempting-to-get-block-.patch index dc35266..061a1e9 100644 --- a/patches/server/0022-Validate-coordinates-before-attempting-to-get-block-.patch +++ b/patches/server/0022-Validate-coordinates-before-attempting-to-get-block-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Validate coordinates before attempting to get block entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index aa287d7f37f38d938d195114408cb6dbda59063d..80384bf470da2da2d6214a9d3429c8556aa18320 100644 +index 1288f651fa83d5ab99a88858f52a6d3212284df0..61f6b51b9d868ae6bd79185cc066976a094da8ce 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1922,6 +1922,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1920,6 +1920,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic } // Spigot end @@ -27,27 +27,27 @@ index aa287d7f37f38d938d195114408cb6dbda59063d..80384bf470da2da2d6214a9d3429c855 + @Override public void handleUseItemOn(ServerboundUseItemOnPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); -@@ -3345,17 +3357,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); +@@ -3344,17 +3356,24 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic if (!itemstack.isEmpty() && nbttagcompound != null && nbttagcompound.contains("x") && nbttagcompound.contains("y") && nbttagcompound.contains("z") && this.player.getBukkitEntity().hasPermission("minecraft.nbt.copy")) { // Spigot BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); -- if (this.player.level.isLoaded(blockposition)) { +- if (this.player.level().isLoaded(blockposition)) { - // Paper start - BlockEntity tileentity = null; -- if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) { -- tileentity = this.player.level.getBlockEntity(blockposition); +- if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.serverLevel().isLoadedAndInBounds(blockposition)) { +- tileentity = this.player.level().getBlockEntity(blockposition); - } - // Paper end -+ if (this.player.level.isLoaded(blockposition)) ++ if (this.player.level().isLoaded(blockposition)) + { + // Scissors start - Validate coordinates and whether the player can reach them + if (Level.isInSpawnableBounds(blockposition) && !isOutsideOfReach(blockposition.getX(), blockposition.getY(), blockposition.getZ())) + { + BlockEntity tileentity = null; -+ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.getLevel().isLoadedAndInBounds(blockposition)) ++ if (this.player.distanceToSqr(blockposition.getX(), blockposition.getY(), blockposition.getZ()) < 32 * 32 && this.player.serverLevel().isLoadedAndInBounds(blockposition)) + { -+ tileentity = this.player.level.getBlockEntity(blockposition); ++ tileentity = this.player.level().getBlockEntity(blockposition); + } + // Paper end diff --git a/patches/server/0023-Reset-large-tags.patch b/patches/server/0023-Reset-large-tags.patch index e34986c..94a7665 100644 --- a/patches/server/0023-Reset-large-tags.patch +++ b/patches/server/0023-Reset-large-tags.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reset large tags diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c..135c1c3013bd75673a8352b9386679195eb681d3 100644 +index 103ad5f373a59fadb4783892579f3e681a8fd596..ab1065ce7b626ad242905dbbfec98839fd0cd9c6 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -20,6 +20,7 @@ import java.util.function.Predicate; +@@ -21,6 +21,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nullable; @@ -16,7 +16,7 @@ index a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c..135c1c3013bd75673a8352b938667919 import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.advancements.CriteriaTriggers; -@@ -258,6 +259,12 @@ public final class ItemStack { +@@ -253,6 +254,12 @@ public final class ItemStack { // CraftBukkit - break into own method private void load(CompoundTag nbttagcompound) { @@ -29,7 +29,7 @@ index a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c..135c1c3013bd75673a8352b938667919 this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id"))); this.count = nbttagcompound.getByte("Count"); if (nbttagcompound.contains("tag", 10)) { -@@ -538,7 +545,11 @@ public final class ItemStack { +@@ -546,7 +553,11 @@ public final class ItemStack { nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString()); nbt.putByte("Count", (byte) this.count); if (this.tag != null) { @@ -42,7 +42,7 @@ index a7533d18fe6148d7bfd3106b9cdcb6fa3347cf7c..135c1c3013bd75673a8352b938667919 } return nbt; -@@ -874,6 +885,9 @@ public final class ItemStack { +@@ -876,6 +887,9 @@ public final class ItemStack { // Paper end public void setTag(@Nullable CompoundTag nbt) { diff --git a/patches/server/0025-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch b/patches/server/0025-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch index 648f54b..778d24b 100644 --- a/patches/server/0025-Limit-amount-of-vehicle-collision-checks-to-3-and-di.patch +++ b/patches/server/0025-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 ee4f924afe15c9a4d96af7a55b357076c7b28501..939e4ef5a2fcedce6dfc08f1ee618bb9f21226ef 100644 +index 9948a28dae4edba877c13ef0156be5ff58df3fa2..93f359c71659c0b2fdf25b1c76c072bf9209db2a 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 ee4f924afe15c9a4d96af7a55b357076c7b28501..939e4ef5a2fcedce6dfc08f1ee618bb9 import javax.annotation.Nullable; import net.minecraft.BlockUtil; import net.minecraft.Util; -@@ -106,6 +107,7 @@ public abstract class AbstractMinecart extends Entity { +@@ -107,6 +108,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,9 +25,9 @@ index ee4f924afe15c9a4d96af7a55b357076c7b28501..939e4ef5a2fcedce6dfc08f1ee618bb9 public double maxSpeed = 0.4D; // CraftBukkit end -@@ -432,8 +434,10 @@ public abstract class AbstractMinecart extends Entity { +@@ -434,8 +436,10 @@ 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)); + 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) { @@ -38,7 +38,7 @@ index ee4f924afe15c9a4d96af7a55b357076c7b28501..939e4ef5a2fcedce6dfc08f1ee618bb9 Entity entity = (Entity) list.get(l); if (!(entity instanceof Player) && !(entity instanceof IronGolem) && !(entity instanceof AbstractMinecart) && !this.isVehicle() && !entity.isPassenger()) { -@@ -460,6 +464,16 @@ public abstract class AbstractMinecart extends Entity { +@@ -462,6 +466,16 @@ public abstract class AbstractMinecart extends Entity { entity.push(this); } } @@ -54,9 +54,9 @@ index ee4f924afe15c9a4d96af7a55b357076c7b28501..939e4ef5a2fcedce6dfc08f1ee618bb9 + } } } else { - Iterator iterator = this.level.getEntities(this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); + Iterator iterator = 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 12e3209c5246ede89daaf8455fe70b4a517e12f6..a1480258f3713ea32dc0a2f6c651fd95924214da 100644 +index 35aeba4e8430e6419caa9db4a0b931a994228618..11b337298ac824adce04cf0608f8f960e59640c9 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; @@ -77,12 +77,12 @@ index 12e3209c5246ede89daaf8455fe70b4a517e12f6..a1480258f3713ea32dc0a2f6c651fd95 super(type, world); @@ -421,10 +423,12 @@ 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)); + List list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, -0.009999999776482582D, 0.20000000298023224D), EntitySelector.pushableBy(this)); - if (!list.isEmpty()) { + // Scissors - Add collision debounce + if (!list.isEmpty() && (System.currentTimeMillis() - lastLargeCollision) >= TimeUnit.SECONDS.toMillis(5)) { // Using TimeUnit for better code readability - boolean flag = !this.level.isClientSide && !(this.getControllingPassenger() instanceof Player); + boolean flag = !this.level().isClientSide && !(this.getControllingPassenger() instanceof Player); - for (int j = 0; j < list.size(); ++j) { + // Scissors - Limit amount of vehicle collision checks to 3 maximum diff --git a/patches/server/0027-Better-handling-of-invalid-JSON-components.patch b/patches/server/0026-Better-handling-of-invalid-JSON-components.patch similarity index 98% rename from patches/server/0027-Better-handling-of-invalid-JSON-components.patch rename to patches/server/0026-Better-handling-of-invalid-JSON-components.patch index f8e4359..02dfd6e 100644 --- a/patches/server/0027-Better-handling-of-invalid-JSON-components.patch +++ b/patches/server/0026-Better-handling-of-invalid-JSON-components.patch @@ -110,10 +110,10 @@ index 97a2657bc98d41c3c1e376b266d2c85f685acc88..7b6476455e095eed15c92797ce3a3e11 } }).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 280ee1838106201f5e3ba7753caced6d030f7e55..ade4ed2f219d32050a372283eaebe75f9014ec78 100644 +index 92202262eff01ae3bbeff0e6ebdcf26ad613c169..38c027c0fbddf58136b7d67eb7156403a79de4d1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2354,12 +2354,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2473,12 +2473,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"); @@ -128,7 +128,7 @@ index 280ee1838106201f5e3ba7753caced6d030f7e55..ade4ed2f219d32050a372283eaebe75f this.setCustomNameVisible(nbt.getBoolean("CustomNameVisible")); 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 ef740d1ad6352ca4af299001a081b720bc472d2e..f2325c0c475bb465f5275f78c71949648a860d0c 100644 +index 59246e24558569f7f50b4d4d508616798091c888..5005a0ad5f703727ea9c618ae4b769a77d5655b5 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 @@ -410,7 +410,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name diff --git a/patches/server/0028-Reject-oversized-components-from-updating.patch b/patches/server/0027-Reject-oversized-components-from-updating.patch similarity index 94% rename from patches/server/0028-Reject-oversized-components-from-updating.patch rename to patches/server/0027-Reject-oversized-components-from-updating.patch index 25959f1..9156930 100644 --- a/patches/server/0028-Reject-oversized-components-from-updating.patch +++ b/patches/server/0027-Reject-oversized-components-from-updating.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reject oversized components from updating diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index 9d0d5a44c5948bde037165147d18aaabe21ce50a..c42b8b4daa1ffa6f3ae89b35056edbf61ae47283 100644 +index 584a58659fae6ba3d8b53858890bc6ec509ffb0e..0dcee5b53740126e0886058dacc43e447836b8d8 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java @@ -39,8 +39,10 @@ public class ComponentUtils { diff --git a/patches/server/0030-Add-MasterBlockFireEvent.patch b/patches/server/0028-Add-MasterBlockFireEvent.patch similarity index 100% rename from patches/server/0030-Add-MasterBlockFireEvent.patch rename to patches/server/0028-Add-MasterBlockFireEvent.patch diff --git a/patches/server/0026-Don-t-log-invalid-teams-to-console.patch b/patches/server/0029-Don-t-log-invalid-teams-to-console.patch similarity index 75% rename from patches/server/0026-Don-t-log-invalid-teams-to-console.patch rename to patches/server/0029-Don-t-log-invalid-teams-to-console.patch index 235ca71..7d908ad 100644 --- a/patches/server/0026-Don-t-log-invalid-teams-to-console.patch +++ b/patches/server/0029-Don-t-log-invalid-teams-to-console.patch @@ -1,15 +1,15 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Allink -Date: Tue, 17 May 2022 05:57:52 +0100 +From: Telesphoreo +Date: Thu, 8 Jun 2023 19:32:11 -0500 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 36b1fcc106909aa7305d63bb4710b4330cb9bc6a..795ebbea0c0100cd05661caad74ed2ae1a32e045 100644 +index 468f64afb7e9b3ef579205d3beea025deb31b460..71a32f8dfdf043f55f092225a13884ae8935e67c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -844,7 +844,9 @@ public abstract class LivingEntity extends Entity implements Attackable { - boolean flag = scoreboardteam != null && this.level.getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam); +@@ -862,7 +862,9 @@ public abstract class LivingEntity extends Entity implements Attackable { + boolean flag = scoreboardteam != null && this.level().getScoreboard().addPlayerToTeam(this.getStringUUID(), scoreboardteam); if (!flag) { - LivingEntity.LOGGER.warn("Unable to add mob to team \"{}\" (that team probably doesn't exist)", s); diff --git a/patches/server/0029-Block-server-side-chunkbans.patch b/patches/server/0030-Block-server-side-chunkbans.patch similarity index 74% rename from patches/server/0029-Block-server-side-chunkbans.patch rename to patches/server/0030-Block-server-side-chunkbans.patch index a2fb0d1..0bb04b3 100644 --- a/patches/server/0029-Block-server-side-chunkbans.patch +++ b/patches/server/0030-Block-server-side-chunkbans.patch @@ -1,18 +1,19 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ayunami2000 -Date: Fri, 17 Jun 2022 15:28:43 -0500 +From: Telesphoreo +Date: Thu, 8 Jun 2023 19:41:10 -0500 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..d9ed02aa0dcec82bdf9d42c224694773b9307cfe 100644 +index fbfadeb83719b81f42724e79c59e92ed88fdece7..bcb9d99359fb3e03c86d7429d9bcfe63b6c0f5d5 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java -@@ -6,9 +6,26 @@ import io.netty.channel.ChannelHandlerContext; +@@ -6,9 +6,18 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToByteEncoder; import io.papermc.paper.adventure.PaperAdventure; // Paper import java.io.IOException; +import java.util.Collections; ++ +import net.minecraft.ChatFormatting; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; @@ -20,22 +21,13 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..d9ed02aa0dcec82bdf9d42c224694773 +import net.minecraft.network.chat.SignedMessageBody; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketFlow; -+import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; -+import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket; -+import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket; -+import net.minecraft.network.protocol.game.ClientboundDisguisedChatPacket; -+import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; -+import net.minecraft.network.protocol.game.ClientboundMapItemDataPacket; -+import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; -+import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; -+import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; -+import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; ++import net.minecraft.network.protocol.game.*; import net.minecraft.util.profiling.jfr.JvmProfiler; +import net.minecraft.world.item.ItemStack; import org.slf4j.Logger; public class PacketEncoder extends MessageToByteEncoder> { -@@ -19,6 +36,23 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -19,6 +28,23 @@ public class PacketEncoder extends MessageToByteEncoder> { this.flow = side; } @@ -59,13 +51,13 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..d9ed02aa0dcec82bdf9d42c224694773 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 +67,87 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -33,38 +59,66 @@ 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 -- + + // Scissors start + int k; try { @@ -107,46 +99,26 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..d9ed02aa0dcec82bdf9d42c224694773 } + // Scissors start -+ private static Packet capPacket(Packet packet, int i) -+ { -+ if (packet instanceof ClientboundBlockEntityDataPacket blockEntityDataPacket) -+ { ++ private static Packet capPacket(Packet packet, int i) { ++ if (packet instanceof ClientboundBlockEntityDataPacket blockEntityDataPacket) { + packet = new ClientboundBlockEntityDataPacket(blockEntityDataPacket.getPos(), blockEntityDataPacket.getType(), new CompoundTag()); -+ } -+ else if (packet instanceof ClientboundLevelChunkPacketData chunkPacket) -+ { ++ } else if (packet instanceof ClientboundLevelChunkPacketData chunkPacket) { + chunkPacket.clearNBT(); -+ } -+ else if (packet instanceof ClientboundSetEntityDataPacket) -+ { ++ } else if (packet instanceof ClientboundSetEntityDataPacket) { + return null; // Skip -+ } -+ else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) -+ { ++ } else if (packet instanceof ClientboundContainerSetContentPacket containerSetContentPacket) { + packet = new ClientboundContainerSetContentPacket(containerSetContentPacket.getContainerId(), containerSetContentPacket.getStateId(), NonNullList.create(), ItemStack.EMPTY); -+ } -+ else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) -+ { ++ } else if (packet instanceof ClientboundSetEquipmentPacket setEquipmentPacket) { + packet = new ClientboundSetEquipmentPacket(setEquipmentPacket.getEntity(), Collections.emptyList()); -+ } -+ else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket) -+ { ++ } else if (packet instanceof ClientboundContainerSetSlotPacket containerSetSlotPacket) { + packet = new ClientboundContainerSetSlotPacket(containerSetSlotPacket.getContainerId(), containerSetSlotPacket.getStateId(), containerSetSlotPacket.getSlot(), ItemStack.EMPTY); -+ } -+ else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) -+ { ++ } else if (packet instanceof ClientboundMapItemDataPacket mapItemDataPacket) { + packet = new ClientboundMapItemDataPacket(mapItemDataPacket.getMapId(), mapItemDataPacket.getScale(), mapItemDataPacket.isLocked(), null, null); -+ } -+ else if (packet instanceof ClientboundSystemChatPacket) -+ { ++ } else if (packet instanceof ClientboundSystemChatPacket) { + return null; -+ } -+ else if (packet instanceof ClientboundDisguisedChatPacket) -+ { ++ } else if (packet instanceof ClientboundDisguisedChatPacket) { + return null; -+ } -+ else if (packet instanceof ClientboundPlayerChatPacket playerChatPacket) -+ { ++ } else if (packet instanceof ClientboundPlayerChatPacket playerChatPacket) { + final SignedMessageBody.Packed body = playerChatPacket.body(); + packet = new ClientboundPlayerChatPacket(playerChatPacket.sender(), // Not sending this packet results in a kick when someone says something. + playerChatPacket.index(), @@ -156,9 +128,7 @@ index fbfadeb83719b81f42724e79c59e92ed88fdece7..d9ed02aa0dcec82bdf9d42c224694773 + playerChatPacket.filterMask(), + playerChatPacket.chatType() + ); -+ } -+ else -+ { ++ } else { + LOGGER.error("Packet with ID {} was too large and was not caught. Please report this to the Scissors developers.", i); + return null; + } @@ -184,21 +154,20 @@ 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 f3fa2678796c33f3a408a02a1995ad117eac9169..c8dd976240aa4f640bb2d223d472f81fdd8dcf7c 100644 +index bd439aef96aeecb9c72b5f50d748d231cccbc970..fda495bfefac4c3b147f5f6b6eb18ad5d103fef2 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,14 @@ public class ClientboundLevelChunkPacketData { +@@ -33,6 +33,13 @@ public class ClientboundLevelChunkPacketData { } // Paper end + // Scissors start -+ public void clearNBT() -+ { ++ public void clearNBT() { + this.blockEntitiesData.clear(); + this.extraPackets.clear(); + } + // Scissors end + - // Paper start - Anti-Xray - Add chunk packet info - @Deprecated @io.papermc.paper.annotation.DoNotUse public ClientboundLevelChunkPacketData(LevelChunk chunk) { this(chunk, null); } - public ClientboundLevelChunkPacketData(LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo) { + public ClientboundLevelChunkPacketData(LevelChunk chunk) { + this.heightmaps = new CompoundTag(); + diff --git a/patches/server/0031-Add-spectator-teleport-event.patch b/patches/server/0031-Add-spectator-teleport-event.patch index c141749..132c004 100644 --- a/patches/server/0031-Add-spectator-teleport-event.patch +++ b/patches/server/0031-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 80384bf470da2da2d6214a9d3429c8556aa18320..cf0bd9aba6de16e8061d5f8b4268969fe812fa37 100644 +index 61f6b51b9d868ae6bd79185cc066976a094da8ce..2807dbb730974ca4d3a7c7fd1358e2438628bc50 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 @@ @@ -15,7 +15,7 @@ index 80384bf470da2da2d6214a9d3429c8556aa18320..cf0bd9aba6de16e8061d5f8b4268969f import com.google.common.collect.Lists; import com.google.common.primitives.Floats; import com.mojang.brigadier.ParseResults; -@@ -2068,6 +2069,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2066,6 +2067,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic Entity entity = packet.getEntity(worldserver); if (entity != null) { diff --git a/patches/server/0032-Prevent-invalid-container-events.patch b/patches/server/0032-Prevent-invalid-container-events.patch index 8ab9bf8..599f074 100644 --- a/patches/server/0032-Prevent-invalid-container-events.patch +++ b/patches/server/0032-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 cf0bd9aba6de16e8061d5f8b4268969fe812fa37..f5f94b7a7f7055dd9dfeb0da161de3553b8e7d38 100644 +index 2807dbb730974ca4d3a7c7fd1358e2438628bc50..37fcbdcddaa6cbfd6ae37d70cffab957c90f4e07 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -30,6 +30,8 @@ import java.util.function.UnaryOperator; @@ -17,15 +17,15 @@ index cf0bd9aba6de16e8061d5f8b4268969fe812fa37..f5f94b7a7f7055dd9dfeb0da161de355 import net.minecraft.ChatFormatting; import net.minecraft.CrashReport; import net.minecraft.CrashReportCategory; -@@ -2987,6 +2989,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2985,6 +2987,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic public void handleContainerClick(ServerboundContainerClickPacket packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.isImmobile()) return; // CraftBukkit + this.player.resetLastActionTime(); if (this.player.containerMenu.containerId == packet.getContainerId() && this.player.containerMenu.stillValid(this.player)) { // CraftBukkit boolean cancelled = this.player.isSpectator(); // CraftBukkit - see below if -@@ -3008,6 +3011,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -3006,6 +3009,18 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic return; } diff --git a/patches/server/0033-Validate-block-entity-tag-query-positions.patch b/patches/server/0033-Validate-block-entity-tag-query-positions.patch index 74a868c..b357139 100644 --- a/patches/server/0033-Validate-block-entity-tag-query-positions.patch +++ b/patches/server/0033-Validate-block-entity-tag-query-positions.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Validate block 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 f5f94b7a7f7055dd9dfeb0da161de3553b8e7d38..5c347c8ff0eb3eb500a7bd49d61fb19925d780ce 100644 +index 37fcbdcddaa6cbfd6ae37d70cffab957c90f4e07..01f88bf2f4872884a9c4c2d1d5f1369c61fb0ebf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1372,7 +1372,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -1375,7 +1375,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleBlockEntityTagQuery(ServerboundBlockEntityTagQuery packet) { - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); - if (this.player.hasPermissions(2)) { + if (this.player.hasPermissions(2) && Level.isInSpawnableBounds(packet.getPos())) { // Scissors - Validate block entity tag query positions - BlockEntity tileentity = this.player.getLevel().getBlockEntity(packet.getPos()); + BlockEntity tileentity = this.player.level().getBlockEntity(packet.getPos()); CompoundTag nbttagcompound = tileentity != null ? tileentity.saveWithoutMetadata() : null; diff --git a/patches/server/0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch b/patches/server/0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch index 6a1df72..4d674ea 100644 --- a/patches/server/0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch +++ b/patches/server/0035-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -index f7d031e9a5aa533d78a49ed6147dd47dd0f27f01..68bd4f64e85f26071640b219bb91b868f8e8aded 100644 +index 66cf0a6cd1525ecf2615809210a26d55f445d07d..b645a6cc8321c116dbee3990d2bbd83234110f13 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -@@ -271,6 +271,13 @@ public abstract class HangingEntity extends Entity { +@@ -270,6 +270,13 @@ public abstract class HangingEntity extends Entity { public void readAdditionalSaveData(CompoundTag nbt) { BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ")); diff --git a/patches/server/0037-Add-Scissors-configuration-file-command.patch b/patches/server/0037-Add-Scissors-configuration-file-command.patch index 73b497c..e11be29 100644 --- a/patches/server/0037-Add-Scissors-configuration-file-command.patch +++ b/patches/server/0037-Add-Scissors-configuration-file-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Scissors configuration file & command diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index c07eb451a576811a39021f6f97103c77488fd001..b91d3ddf586a103770d63cdcf7ec590f95ee388f 100644 +index a2f71a6d1a9e98133dff6cd0f625da9435a8af14..f83b2c4298bd1a5f65487f64bd6a11fb190a622d 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -25,6 +25,7 @@ package co.aikar.timings; @@ -453,7 +453,7 @@ index 74cf1c043beef03cfd5adf481414a5ee78bef2a6..182f68359a7a8c0b331acd103ed3952e } } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index cdbf10339a8e8846a8c364de483a0ccd95cd225a..3863684cdf3d613c39935e9f46fd4e7066f95eab 100644 +index dae36c6452ccd57a436dd918547b64d59957ab0a..d450cf3cf8ab5cbb5d32a28ee2e4a6717941adef 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -136,6 +136,7 @@ public class Main { @@ -465,7 +465,7 @@ index cdbf10339a8e8846a8c364de483a0ccd95cd225a..3863684cdf3d613c39935e9f46fd4e70 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 a7e133f3495e9132a5fdae2c24f225e7b026295a..16f0daad2456ce23f8d73389f62aac9f10235100 100644 +index 7f0b8cdae07e7e4745a099242a4f0c5914be8667..ac218f02b4799dd4117b0de663e9a073d76be05b 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 @@ -486,7 +486,7 @@ index a7e133f3495e9132a5fdae2c24f225e7b026295a..16f0daad2456ce23f8d73389f62aac9f this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setMotd(dedicatedserverproperties.motd); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 5c347c8ff0eb3eb500a7bd49d61fb19925d780ce..2549ff41d1d63ba0dbdaee3e526a44f953945b6d 100644 +index 01f88bf2f4872884a9c4c2d1d5f1369c61fb0ebf..a2b96f7b1e98586017dbbf28a73446196738ee99 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 @@ @@ -496,7 +496,7 @@ index 5c347c8ff0eb3eb500a7bd49d61fb19925d780ce..2549ff41d1d63ba0dbdaee3e526a44f9 import me.totalfreedom.scissors.event.player.SpectatorTeleportEvent; import com.google.common.collect.Lists; import com.google.common.primitives.Floats; -@@ -2377,6 +2378,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2375,6 +2376,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic Optional optional = this.lastSeenMessages.applyUpdate(acknowledgment); if (optional.isEmpty()) { @@ -509,7 +509,7 @@ index 5c347c8ff0eb3eb500a7bd49d61fb19925d780ce..2549ff41d1d63ba0dbdaee3e526a44f9 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 } -@@ -2609,11 +2616,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -2607,11 +2614,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @Override public void handleChatAck(ServerboundChatAckPacket packet) { LastSeenMessagesValidator lastseenmessagesvalidator = this.lastSeenMessages; @@ -608,12 +608,12 @@ index 31911c09fe15753ae32fa39417bdc9e9de552a88..97ce45c6e44b1400b8d60b5239761703 @Override public boolean isFoil(ItemStack stack) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index 4da4edae517a0efec6e03a719ec47b700509dab1..837b20be528bc33f62c0c675d90afebd0a781b6f 100644 +index 80695b2698d2904cec2c54ebe0ef880d95ed9583..9facb07939972ee40875b9a30dde11ba40002778 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -4,8 +4,11 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; +@@ -8,8 +8,11 @@ import java.util.Objects; import java.util.UUID; - import java.util.function.Function; + import java.util.function.UnaryOperator; import javax.annotation.Nullable; + +import me.totalfreedom.scissors.ScissorsConfig; @@ -622,48 +622,55 @@ index 4da4edae517a0efec6e03a719ec47b700509dab1..837b20be528bc33f62c0c675d90afebd +import net.minecraft.commands.Commands; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; - import net.minecraft.network.chat.ClickEvent; -@@ -15,6 +18,7 @@ import net.minecraft.network.chat.ComponentUtils; - import net.minecraft.network.chat.MutableComponent; + import net.minecraft.nbt.NbtOps; +@@ -19,6 +22,7 @@ import net.minecraft.network.chat.Component; + import net.minecraft.network.chat.ComponentUtils; import net.minecraft.network.chat.Style; import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; - import net.minecraft.util.FormattedCharSequence; -@@ -24,6 +28,8 @@ import net.minecraft.world.item.DyeColor; + import net.minecraft.server.network.FilteredText; +@@ -30,13 +34,14 @@ import net.minecraft.world.level.block.SignBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec2; import net.minecraft.world.phys.Vec3; ++import org.bukkit.craftbukkit.entity.CraftHumanEntity; + import org.slf4j.Logger; + import org.bukkit.block.sign.Side; + import org.bukkit.craftbukkit.block.CraftBlock; +-import org.bukkit.craftbukkit.util.CraftChatMessage; + import org.bukkit.entity.Player; + import org.bukkit.event.block.SignChangeEvent; + // CraftBukkit end +import org.bukkit.craftbukkit.CraftServer; -+import org.bukkit.craftbukkit.entity.CraftPlayer; public class SignBlockEntity extends BlockEntity implements CommandSource { // CraftBukkit - implements - private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper -@@ -272,6 +278,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C + +@@ -285,6 +290,21 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C } - player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage()); + player.getServer().getCommands().performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage()); // Paper end + // Scissors start - Add optional permissions to command signs + final MinecraftServer vanillaServer = player.getServer(); + final CraftServer craftServer = vanillaServer.server; -+ final CraftPlayer craftPlayer = player.getBukkitEntity(); ++ final CraftHumanEntity craftPlayer = player.getBukkitEntity(); + final Commands commands = vanillaServer.getCommands(); + + if (ScissorsConfig.commandSignsBypassPermissions) + { -+ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle()), event.getMessage()); ++ commands.performPrefixedCommand(this.createCommandSourceStack(((org.bukkit.craftbukkit.entity.CraftPlayer) event.getPlayer()).getHandle(), world, pos), event.getMessage()); + } + else + { + craftServer.dispatchCommand(craftPlayer, command.substring(1)); + } + // Scissors end + flag1 = true; } } - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c5e22893b1a570e582fc4d0c36a04470639411d9..bf3f6253aa1f90c39d63119dd3140dae6a85217a 100644 +index 777b727a360683a72cef8c06ab7ab1439d69ac0a..852831cfbcfe969f3cb6080ff923a04b1467e1b4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -978,6 +978,7 @@ public final class CraftServer implements Server { @@ -682,7 +689,7 @@ index c5e22893b1a570e582fc4d0c36a04470639411d9..bf3f6253aa1f90c39d63119dd3140dae this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2763,6 +2765,12 @@ public final class CraftServer implements Server { +@@ -2759,6 +2761,12 @@ public final class CraftServer implements Server { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -696,7 +703,7 @@ index c5e22893b1a570e582fc4d0c36a04470639411d9..bf3f6253aa1f90c39d63119dd3140dae 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 1fe26cb620e8b550790c3e110e2a1180cf0838fd..6305c9cf0cec52bee5a327ba3dd1531a8198eec4 100644 +index 0fb3a648ee6bd6cb88515770bcfc70e368313527..5bbfcfe68dace755fe6ec4bc94965d216d998382 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -180,9 +180,27 @@ public class Main { diff --git a/patches/server/0038-Patch-invalid-entity-rotation-log-spam.patch b/patches/server/0038-Patch-invalid-entity-rotation-log-spam.patch index 22ebe5c..b284815 100644 --- a/patches/server/0038-Patch-invalid-entity-rotation-log-spam.patch +++ b/patches/server/0038-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 ade4ed2f219d32050a372283eaebe75f9014ec78..deb54926662b2872f40d688db2756faadbf6aa6e 100644 +index 38c027c0fbddf58136b7d67eb7156403a79de4d1..ff3940a0d552140cae820fbed16bfb5e69507822 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4482,7 +4482,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4615,7 +4615,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void setYRot(float yaw) { if (!Float.isFinite(yaw)) { @@ -19,7 +19,7 @@ index ade4ed2f219d32050a372283eaebe75f9014ec78..deb54926662b2872f40d688db2756faa } else { this.yRot = yaw; } -@@ -4494,7 +4496,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -4627,7 +4629,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { public void setXRot(float pitch) { if (!Float.isFinite(pitch)) { diff --git a/patches/server/0042-Limit-map-decoration-count.patch b/patches/server/0042-Limit-map-decoration-count.patch index 830b1d3..db74dae 100644 --- a/patches/server/0042-Limit-map-decoration-count.patch +++ b/patches/server/0042-Limit-map-decoration-count.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Limit map decoration count 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 25a64250ce57fe4cd90f8b95d1e003d961662152..60e013d418b1aa8c154ca9474186191aa5c9041d 100644 +index 3b12030b49b1c539684d75ca3896eb498400ef99..a1f042e5329343489cf30e436a8f553d39e5a6e4 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 -@@ -356,6 +356,12 @@ public class MapItemSavedData extends SavedData { +@@ -354,6 +354,12 @@ 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) { diff --git a/patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch b/patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch index ddd93b7..049979c 100644 --- a/patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch +++ b/patches/server/0043-Prevent-player-banning-using-duplicate-UUIDs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent player banning using duplicate UUIDs diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 45804711255f04110e9509df8d60900314aa10b7..b1fd209b2893d2d6bfc2ae552c7919ab8abda695 100644 +index 2ac23779222369ace69f1e3f7fb12184865b7a43..05c8e4e30b2dce565e84f4c09b3f27244f8c0451 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1468,7 +1468,14 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1610,7 +1610,14 @@ public class ServerLevel extends Level implements WorldGenLevel { if (entity != null) { ServerLevel.LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID().toString()); entity.unRide(); diff --git a/patches/server/0044-Don-t-warn-on-duplicate-entity-UUIDs.patch b/patches/server/0044-Don-t-warn-on-duplicate-entity-UUIDs.patch index 512497e..e81fb3d 100644 --- a/patches/server/0044-Don-t-warn-on-duplicate-entity-UUIDs.patch +++ b/patches/server/0044-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 61c170555c8854b102c640b0b6a615f9f732edbf..29f46a137584a5f52f3c30b4c352d58ca61488a3 100644 +index 82ccaf612548a7dbab7e5aeffb6eb8db84367477..5147c5860f0b485ecb82fa06336939d5bb54057d 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 -@@ -366,7 +366,7 @@ public final class EntityLookup implements LevelEntityGetter { +@@ -367,7 +367,7 @@ public final class EntityLookup implements LevelEntityGetter { return false; } if (this.entityByUUID.containsKey(entity.getUUID())) { diff --git a/patches/server/0049-Implement-command-block-events.patch b/patches/server/0049-Implement-command-block-events.patch index fd6708e..f6af8ac 100644 --- a/patches/server/0049-Implement-command-block-events.patch +++ b/patches/server/0049-Implement-command-block-events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement command block events diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2549ff41d1d63ba0dbdaee3e526a44f953945b6d..2748949301ce9b2c3b098dd2a7d2caee331980a7 100644 +index a2b96f7b1e98586017dbbf28a73446196738ee99..0227e2c7197c3684677f76ff7f0fe0acc21b6c14 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 @@ @@ -33,8 +33,8 @@ index 2549ff41d1d63ba0dbdaee3e526a44f953945b6d..2748949301ce9b2c3b098dd2a7d2caee import org.slf4j.Logger; // CraftBukkit start -@@ -994,6 +998,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - this.player.level.getChunkAt(blockposition).setBlockEntity(tileentity); +@@ -1001,6 +1005,21 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + this.player.level().getChunkAt(blockposition).setBlockEntity(tileentity); } + // Scissors start - Implement command block events @@ -55,8 +55,8 @@ index 2549ff41d1d63ba0dbdaee3e526a44f953945b6d..2748949301ce9b2c3b098dd2a7d2caee commandblocklistenerabstract.setCommand(s); commandblocklistenerabstract.setTrackOutput(flag); if (!flag) { -@@ -1025,7 +1044,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic - BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level); +@@ -1032,7 +1051,27 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic + BaseCommandBlock commandblocklistenerabstract = packet.getCommandBlock(this.player.level()); if (commandblocklistenerabstract != null) { - commandblocklistenerabstract.setCommand(packet.getCommand());