diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ab2916cd2..f33e39e9cf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -204,7 +204,8 @@ when making and submitting changes. ## Formatting -All modifications to non-Paper files should be marked. +All modifications to non-Paper files should be marked. The one exception to this is +when modifying javadoc comments, which should not have these markers. - You need to add a comment with a short and identifiable description of the patch: `// Paper start - ` diff --git a/patches/server/Add-EntityFertilizeEggEvent.patch b/patches/server/Add-EntityFertilizeEggEvent.patch index a37fa048cf..8dbf824a87 100644 --- a/patches/server/Add-EntityFertilizeEggEvent.patch +++ b/patches/server/Add-EntityFertilizeEggEvent.patch @@ -65,9 +65,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityitem.setDefaultPickUpDelay(); - this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null); + this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null, result.getExperience()); // Paper - Add EntityFertilizeEggEvent event - if (this.spawnAtLocation(entityitem) != null) { // Paper - call EntityDropItemEvent + if (this.spawnAtLocation(entityitem) != null) { // Paper - Call EntityDropItemEvent this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F); - } // Paper + } // Paper - Call EntityDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/patches/server/Add-EntityPortalReadyEvent.patch b/patches/server/Add-EntityPortalReadyEvent.patch index c14ccbc07f..0396b1f3ea 100644 --- a/patches/server/Add-EntityPortalReadyEvent.patch +++ b/patches/server/Add-EntityPortalReadyEvent.patch @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit this.level().getProfiler().push("portal"); this.portalTime = i; -+ // Paper start ++ // Paper start - Add EntityPortalReadyEvent + io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER); + if (!event.callEvent()) { + this.portalTime = 0; + } else { + worldserver1 = event.getTargetWorld() == null ? null : ((CraftWorld) event.getTargetWorld()).getHandle(); -+ // Paper end ++ // Paper end - Add EntityPortalReadyEvent this.setPortalCooldown(); // CraftBukkit start if (this instanceof ServerPlayer) { @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { this.changeDimension(worldserver1); } -+ } // Paper ++ } // Paper - Add EntityPortalReadyEvent // CraftBukkit end this.level().getProfiler().pop(); } diff --git a/patches/server/Add-PlayerInventorySlotChangeEvent.patch b/patches/server/Add-PlayerInventorySlotChangeEvent.patch index 071e17c5d7..5802ca2e38 100644 --- a/patches/server/Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/server/Add-PlayerInventorySlotChangeEvent.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ // Paper start ++ // Paper start - Add PlayerInventorySlotChangeEvent + @Override + public void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack oldStack, ItemStack stack) { + Slot slot = handler.getSlot(slotId); @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + } -+ // Paper end ++ // Paper end - Add PlayerInventorySlotChangeEvent @Override public void dataChanged(AbstractContainerMenu handler, int property, int value) {} @@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ContainerListener icrafting = (ContainerListener) iterator.next(); - icrafting.slotChanged(this, slot, itemstack2); -+ icrafting.slotChanged(this, slot, itemstack1, itemstack2); // Paper ++ icrafting.slotChanged(this, slot, itemstack1, itemstack2); // Paper - Add PlayerInventorySlotChangeEvent } } @@ -55,11 +55,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public interface ContainerListener { void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack stack); -+ // Paper start ++ // Paper start - Add PlayerInventorySlotChangeEvent + default void slotChanged(AbstractContainerMenu handler, int slotId, ItemStack oldStack, ItemStack stack) { + slotChanged(handler, slotId, stack); + } -+ // Paper end ++ // Paper end - Add PlayerInventorySlotChangeEvent + void dataChanged(AbstractContainerMenu handler, int property, int value); } diff --git a/patches/server/Add-Velocity-IP-Forwarding-Support.patch b/patches/server/Add-Velocity-IP-Forwarding-Support.patch index f719acf4c1..424526d9f8 100644 --- a/patches/server/Add-Velocity-IP-Forwarding-Support.patch +++ b/patches/server/Add-Velocity-IP-Forwarding-Support.patch @@ -37,6 +37,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.ProfilePublicKey; + ++/** ++ * While Velocity supports BungeeCord-style IP forwarding, it is not secure. Users ++ * have a lot of problems setting up firewalls or setting up plugins like IPWhitelist. ++ * Further, the BungeeCord IP forwarding protocol still retains essentially its original ++ * form, when there is brand-new support for custom login plugin messages in 1.13. ++ *

++ * Velocity's modern IP forwarding uses an HMAC-SHA256 code to ensure authenticity ++ * of messages, is packed into a binary format that is smaller than BungeeCord's ++ * forwarding, and is integrated into the Minecraft login process by using the 1.13 ++ * login plugin message packet. ++ */ +public class VelocityProxy { + private static final int SUPPORTED_FORWARDING_VERSION = 1; + public static final int MODERN_FORWARDING_WITH_KEY = 2; @@ -102,11 +113,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP); // CraftBukkit end -+ // Paper start ++ // Paper start - Add Velocity IP Forwarding Support + boolean usingProxy = org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled; + String proxyFlavor = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "Velocity" : "BungeeCord"; + String proxyLink = (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) ? "https://docs.papermc.io/velocity/security" : "http://www.spigotmc.org/wiki/firewall-guide/"; -+ // Paper end ++ // Paper end - Add Velocity IP Forwarding Support if (!this.usesAuthentication()) { DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); @@ -114,11 +125,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (org.spigotmc.SpigotConfig.bungee) { - DedicatedServer.LOGGER.warn("Whilst this makes it possible to use BungeeCord, unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); - DedicatedServer.LOGGER.warn("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information."); -+ // Paper start ++ // Paper start - Add Velocity IP Forwarding Support + if (usingProxy) { + DedicatedServer.LOGGER.warn("Whilst this makes it possible to use " + proxyFlavor + ", unless access to your server is properly restricted, it also opens up the ability for hackers to connect with any username they choose."); + DedicatedServer.LOGGER.warn("Please see " + proxyLink + " for further information."); -+ // Paper end ++ // Paper end - Add Velocity IP Forwarding Support } else { DedicatedServer.LOGGER.warn("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose."); } @@ -130,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final String serverId; private ServerPlayer player; // CraftBukkit public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding -+ private int velocityLoginMessageId = -1; // Paper - Velocity support ++ private int velocityLoginMessageId = -1; // Paper - Add Velocity IP Forwarding Support public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { this.state = ServerLoginPacketListenerImpl.State.HELLO; @@ -138,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.state = ServerLoginPacketListenerImpl.State.KEY; this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge)); } else { -+ // Paper start - Velocity support ++ // Paper start - Add Velocity IP Forwarding Support + if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { + this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); + net.minecraft.network.FriendlyByteBuf buf = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.buffer()); @@ -147,7 +158,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.connection.send(packet1); + return; + } -+ // Paper end ++ // Paper end - Add Velocity IP Forwarding Support // CraftBukkit start // Paper start - Cache authenticator threads authenticatorPool.execute(new Runnable() { @@ -155,12 +166,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start private GameProfile callPlayerPreLoginEvents(GameProfile gameprofile) throws Exception { // Paper - Add more fields to AsyncPlayerPreLoginEvent -+ // Paper start - Velocity support ++ // Paper start - Add Velocity IP Forwarding Support + if (ServerLoginPacketListenerImpl.this.velocityLoginMessageId == -1 && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { + disconnect("This server requires you to connect with Velocity."); + return gameprofile; + } -+ // Paper end - Velocity support ++ // Paper end - Add Velocity IP Forwarding Support String playerName = gameprofile.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress(); java.util.UUID uniqueId = gameprofile.getId(); @@ -168,7 +179,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket packet) { -+ // Paper start - Velocity support ++ // Paper start - Add Velocity IP Forwarding Support + if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled && packet.transactionId() == this.velocityLoginMessageId) { + ServerboundCustomQueryAnswerPacket.QueryAnswerPayload payload = (ServerboundCustomQueryAnswerPacket.QueryAnswerPayload)packet.payload(); + if (payload == null) { @@ -212,7 +223,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + return; + } -+ // Paper end ++ // Paper end - Add Velocity IP Forwarding Support this.disconnect(ServerLoginPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY); } @@ -225,7 +236,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public long getConnectionThrottle() { // Spigot Start - Automatically set connection throttle for bungee configurations - if (org.spigotmc.SpigotConfig.bungee) { -+ if (org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { // Paper - Velocity support ++ if (org.spigotmc.SpigotConfig.bungee || io.papermc.paper.configuration.GlobalConfiguration.get().proxies.velocity.enabled) { // Paper - Add Velocity IP Forwarding Support return -1; } else { return this.configuration.getInt("settings.connection-throttle"); diff --git a/patches/server/Add-and-fix-missing-BlockFadeEvents.patch b/patches/server/Add-and-fix-missing-BlockFadeEvents.patch index e5e7572192..8524a6b2e1 100644 --- a/patches/server/Add-and-fix-missing-BlockFadeEvents.patch +++ b/patches/server/Add-and-fix-missing-BlockFadeEvents.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, Blocks.AIR.defaultBlockState()).isCancelled()) { + return; + } -+ // Paper end ++ // Paper end - Call BlockFadeEvent this.destroyBlock(world, pos); world.playSound((Player)null, pos, SoundEvents.FROGSPAWN_HATCH, SoundSource.BLOCKS, 1.0F, 1.0F); this.spawnTadpoles(world, pos, random); @@ -46,13 +46,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.getHatchLevel(state) == 2; } -+ // Paper start ++ // Paper start - Call BlockFadeEvent + private void rescheduleTick(ServerLevel world, BlockPos pos) { + int baseDelay = hatchBoost(world, pos) ? BOOSTED_HATCH_TIME_TICKS : REGULAR_HATCH_TIME_TICKS; + world.scheduleTick(pos, this, (baseDelay / 3) + world.random.nextInt(RANDOM_HATCH_OFFSET_TICKS)); + // reschedule to avoid being stuck here and behave like the other calls (see #onPlace) + } -+ // Paper end ++ // Paper end - Call BlockFadeEvent + @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { @@ -65,7 +65,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + rescheduleTick(world, pos); + return; + } -+ // Paper end ++ // Paper end - Call BlockFadeEvent world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); world.destroyBlock(pos, false); Sniffer sniffer = EntityType.SNIFFER.create(world); diff --git a/patches/server/Add-option-for-strict-advancement-dimension-checks.patch b/patches/server/Add-option-for-strict-advancement-dimension-checks.patch index 012d0179d9..07277af7ed 100644 --- a/patches/server/Add-option-for-strict-advancement-dimension-checks.patch +++ b/patches/server/Add-option-for-strict-advancement-dimension-checks.patch @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.position.isPresent() && !this.position.get().matches(x, y, z)) { return false; - } else if (this.dimension.isPresent() && this.dimension.get() != world.dimension()) { -+ } else if (this.dimension.isPresent() && this.dimension.get() != (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck ? world.dimension() : org.bukkit.craftbukkit.util.CraftDimensionUtil.getMainDimensionKey(world))) { // Paper ++ } else if (this.dimension.isPresent() && this.dimension.get() != (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck ? world.dimension() : org.bukkit.craftbukkit.util.CraftDimensionUtil.getMainDimensionKey(world))) { // Paper - Add option for strict advancement dimension checks return false; } else { BlockPos blockPos = BlockPos.containing(x, y, z); @@ -31,12 +31,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ResourceKey maindimensionkey = CraftDimensionUtil.getMainDimensionKey(origin); ResourceKey maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level()); -+ // Paper start - config for strict advancement checks for dimensions ++ // Paper start - Add option for strict advancement dimension checks + if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.strictAdvancementDimensionCheck) { + maindimensionkey = resourcekey; + maindimensionkey1 = resourcekey1; + } -+ // Paper end ++ // Paper end - Add option for strict advancement dimension checks CriteriaTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1); if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) { CriteriaTriggers.CHANGED_DIMENSION.trigger(this, resourcekey, resourcekey1); diff --git a/patches/server/Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/Add-various-missing-EntityDropItemEvent-calls.patch index 2f7a8c573c..402a1e40a0 100644 --- a/patches/server/Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/Add-various-missing-EntityDropItemEvent-calls.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe entityitem.setDefaultPickUpDelay(); -+ // Paper start ++ // Paper start - Call EntityDropItemEvent + return this.spawnAtLocation(entityitem); + } + } + @Nullable + public ItemEntity spawnAtLocation(ItemEntity entityitem) { + { -+ // Paper end ++ // Paper end - Call EntityDropItemEvent // CraftBukkit start EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); Bukkit.getPluginManager().callEvent(event); @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityitem.setDeltaMovement((double) (0.3F * -Mth.sin(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.cos(f1) * f2), (double) (0.3F * Mth.sin(Dolphin.this.getXRot() * 0.017453292F) * 1.5F), (double) (0.3F * Mth.cos(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.sin(f1) * f2)); - Dolphin.this.level().addFreshEntity(entityitem); -+ Dolphin.this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent ++ Dolphin.this.spawnAtLocation(entityitem); // Paper - Call EntityDropItemEvent } } } @@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityitem.setThrower(this); this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F); - this.level().addFreshEntity(entityitem); -+ this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent ++ this.spawnAtLocation(entityitem); // Paper - Call EntityDropItemEvent } } @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), stack); - this.level().addFreshEntity(entityitem); -+ this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent ++ this.spawnAtLocation(entityitem); // Paper - Call EntityDropItemEvent } @Override @@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.level().addFreshEntity(entityitem); - return true; -+ return this.spawnAtLocation(entityitem) != null; // Paper - call EntityDropItemEvent by calling spawnAtLocation. ++ return this.spawnAtLocation(entityitem) != null; // Paper - Call EntityDropItemEvent } } @@ -79,10 +79,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityitem.setDefaultPickUpDelay(); this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob) null); -+ if (this.spawnAtLocation(entityitem) != null) { // Paper - call EntityDropItemEvent ++ if (this.spawnAtLocation(entityitem) != null) { // Paper - Call EntityDropItemEvent this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F); - world.addFreshEntity(entityitem); -+ } // Paper ++ } // Paper - Call EntityDropItemEvent } @Override diff --git a/patches/server/Call-BlockPhysicsEvent-more-often.patch b/patches/server/Call-BlockPhysicsEvent-more-often.patch index 9ddf222308..10c630f87f 100644 --- a/patches/server/Call-BlockPhysicsEvent-more-often.patch +++ b/patches/server/Call-BlockPhysicsEvent-more-often.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPos blockPos = this.sourcePos.relative(NeighborUpdater.UPDATE_ORDER[this.idx++]); BlockState blockState = world.getBlockState(blockPos); - NeighborUpdater.executeUpdate(world, blockState, blockPos, this.sourceBlock, this.sourcePos, false); -+ // Paper start ++ // Paper start - Call BlockPhysicsEvent + try { + boolean cancelled = false; + org.bukkit.craftbukkit.CraftWorld cworld = world.getWorld(); @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } catch (StackOverflowError ex) { + world.lastPhysicsProblem = new BlockPos(blockPos); + } -+ // Paper end ++ // Paper end - Call BlockPhysicsEvent if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) { ++this.idx; } diff --git a/patches/server/Configure-sniffer-egg-hatch-time.patch b/patches/server/Configure-sniffer-egg-hatch-time.patch index e0941e0d4d..c4575078ee 100644 --- a/patches/server/Configure-sniffer-egg-hatch-time.patch +++ b/patches/server/Configure-sniffer-egg-hatch-time.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java @@ -0,0 +0,0 @@ public class SnifferEggBlock extends Block { - // Paper start + // Paper start - Call BlockFadeEvent private void rescheduleTick(ServerLevel world, BlockPos pos) { - int baseDelay = hatchBoost(world, pos) ? BOOSTED_HATCH_TIME_TICKS : REGULAR_HATCH_TIME_TICKS; + int baseDelay = hatchBoost(world, pos) ? world.paperConfig().entities.sniffer.boostedHatchTime.or(BOOSTED_HATCH_TIME_TICKS) : world.paperConfig().entities.sniffer.hatchTime.or(REGULAR_HATCH_TIME_TICKS); // Paper - Configure sniffer egg hatch time diff --git a/patches/server/Correctly-handle-interactions-with-items-on-cooldown.patch b/patches/server/Correctly-handle-interactions-with-items-on-cooldown.patch index 38d0aa07c4..4836faddf8 100644 --- a/patches/server/Correctly-handle-interactions-with-items-on-cooldown.patch +++ b/patches/server/Correctly-handle-interactions-with-items-on-cooldown.patch @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, hand, hitResult.getLocation()); -+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, cancelledItem, hand, hitResult.getLocation()); // Paper ++ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, blockposition, hitResult.getDirection(), stack, cancelledBlock, cancelledItem, hand, hitResult.getLocation()); // Paper - correctly handle items on cooldown this.firedInteract = true; this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactPosition = blockposition.immutable(); diff --git a/patches/server/Detect-headless-JREs.patch b/patches/server/Detect-headless-JREs.patch index cbec3434ec..0a149225c3 100644 --- a/patches/server/Detect-headless-JREs.patch +++ b/patches/server/Detect-headless-JREs.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } -+ // Paper start - Warn on headless ++ // Paper start - Detect headless JRE + String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck(); + if (awtException != null) { + Main.LOGGER.error("You are using a headless JRE distribution."); @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Main.LOGGER.error(awtException); + return; + } -+ // Paper end ++ // Paper end - Detect headless JRE + org.spigotmc.SpigotConfig.disabledAdvancements = spigotConfiguration.getStringList("advancements.disabled"); // Paper - fix SPIGOT-5885, must be set early in init // Paper start - fix SPIGOT-5824 diff --git a/patches/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch b/patches/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch index cb95e3ee62..86c1ef6e6c 100644 --- a/patches/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch +++ b/patches/server/Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static void ifChunkExists(LevelReader world, @Nullable SectionPos sectionPos, Consumer dispatcherConsumer) { if (sectionPos != null) { - ChunkAccess chunkAccess = world.getChunk(sectionPos.x(), sectionPos.z(), ChunkStatus.FULL, false); -+ ChunkAccess chunkAccess = world.getChunkIfLoadedImmediately(sectionPos.getX(), sectionPos.getZ()); // Paper - can cause sync loads while completing a chunk, resulting in deadlock ++ ChunkAccess chunkAccess = world.getChunkIfLoadedImmediately(sectionPos.getX(), sectionPos.getZ()); // Paper - Perf: can cause sync loads while completing a chunk, resulting in deadlock if (chunkAccess != null) { dispatcherConsumer.accept(chunkAccess.getListenerRegistry(sectionPos.y())); } diff --git a/patches/server/Don-t-broadcast-messages-to-command-blocks.patch b/patches/server/Don-t-broadcast-messages-to-command-blocks.patch index f63658a2f4..37468d002c 100644 --- a/patches/server/Don-t-broadcast-messages-to-command-blocks.patch +++ b/patches/server/Don-t-broadcast-messages-to-command-blocks.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void sendSystemMessage(Component message) { if (this.trackOutput) { -+ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper ++ org.spigotmc.AsyncCatcher.catchOp("sendSystemMessage to a command block"); // Paper - Don't broadcast messages to command blocks SimpleDateFormat simpledateformat = BaseCommandBlock.TIME_FORMAT; Date date = new Date(); @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Set recipients = new HashSet<>(); for (Permissible permissible : this.getPluginManager().getPermissionSubscriptions(permission)) { - if (permissible instanceof CommandSender && permissible.hasPermission(permission)) { -+ if (permissible instanceof CommandSender && !(permissible instanceof org.bukkit.command.BlockCommandSender) && permissible.hasPermission(permission)) { // Paper - don't broadcast to BlockCommandSender (specifically Command Blocks) ++ if (permissible instanceof CommandSender && !(permissible instanceof org.bukkit.command.BlockCommandSender) && permissible.hasPermission(permission)) { // Paper - Don't broadcast messages to command blocks recipients.add((CommandSender) permissible); } } diff --git a/patches/server/Don-t-use-level-random-in-entity-constructors.patch b/patches/server/Don-t-use-level-random-in-entity-constructors.patch index 1ecf707d9c..846bd36ab1 100644 --- a/patches/server/Don-t-use-level-random-in-entity-constructors.patch +++ b/patches/server/Don-t-use-level-random-in-entity-constructors.patch @@ -17,12 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ItemEntity(Level world, double x, double y, double z, ItemStack stack) { - this(world, x, y, z, stack, world.random.nextDouble() * 0.2D - 0.1D, 0.2D, world.random.nextDouble() * 0.2D - 0.1D); -+ // Paper start - don't use world random in entity constructor ++ // Paper start - Don't use level random in entity constructors (to make them thread-safe) + this(EntityType.ITEM, world); + this.setPos(x, y, z); + this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D); + this.setItem(stack); -+ // Paper end ++ // Paper end - Don't use level random in entity constructors } public ItemEntity(Level world, double x, double y, double z, ItemStack stack, double velocityX, double velocityY, double velocityZ) { @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this(EntityType.TNT, world); this.setPos(x, y, z); - double d3 = world.random.nextDouble() * 6.2831854820251465D; -+ double d3 = this.random.nextDouble() * 6.2831854820251465D; // Paper - don't use world random in entity constructor ++ double d3 = this.random.nextDouble() * 6.2831854820251465D; // Paper - Don't use level random in entity constructors this.setDeltaMovement(-Math.sin(d3) * 0.02D, 0.20000000298023224D, -Math.cos(d3) * 0.02D); this.setFuse(80); diff --git a/patches/server/Dont-resend-blocks-on-interactions.patch b/patches/server/Dont-resend-blocks-on-interactions.patch index 503a6c2767..6f52d9166b 100644 --- a/patches/server/Dont-resend-blocks-on-interactions.patch +++ b/patches/server/Dont-resend-blocks-on-interactions.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); + // this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos)); // Paper - Don't resync blocks // Update any tile entity data for this block - capturedBlockEntity = true; // Paper - send block entity after predicting + capturedBlockEntity = true; // Paper - Send block entities after destroy prediction return; @@ -0,0 +0,0 @@ public class ServerPlayerGameMode { // Spigot start - handle debug stick left click for non-creative @@ -102,7 +102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - Don't resync blocks // Update any tile entity data for this block - if (!captureSentBlockEntities) { // Paper - Toggle this location for capturing as this is used for api + if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction @@ -0,0 +0,0 @@ public class ServerPlayerGameMode { if (event.useInteractedBlock() == Event.Result.DENY) { // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. diff --git a/patches/server/EntityPickupItemEvent-fixes.patch b/patches/server/EntityPickupItemEvent-fixes.patch index a51631d5ef..582b58e1ce 100644 --- a/patches/server/EntityPickupItemEvent-fixes.patch +++ b/patches/server/EntityPickupItemEvent-fixes.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected void pickUpItem(ItemEntity item) { - this.onItemPickup(item); -+ // this.onItemPickup(item); // Paper - call in PiglinAi#pickUpItem after EntityPickupItemEvent is fired ++ // this.onItemPickup(item); // Paper - EntityPickupItemEvent fixes; call in PiglinAi#pickUpItem after EntityPickupItemEvent is fired PiglinAi.pickUpItem(this, item); } @@ -33,16 +33,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - if (drop.getItem().is(Items.GOLD_NUGGET) && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled()) { -+ // Paper start - fix event firing twice ++ // Paper start - EntityPickupItemEvent fixes; fix event firing twice + if (drop.getItem().is(Items.GOLD_NUGGET) /* && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled() */) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, 0, false).isCancelled()) return; + piglin.onItemPickup(drop); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification -+ // Paper end ++ // Paper end - EntityPickupItemEvent fixes piglin.take(drop, drop.getItem().getCount()); itemstack = drop.getItem(); drop.discard(); } else if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(piglin, drop, drop.getItem().getCount() - 1, false).isCancelled()) { -+ piglin.onItemPickup(drop); // Paper - moved from Piglin#pickUpItem - call prior to item entity modification ++ piglin.onItemPickup(drop); // Paper - EntityPickupItemEvent fixes; moved from Piglin#pickUpItem - call prior to item entity modification piglin.take(drop, 1); itemstack = PiglinAi.removeOneItemFromItemEntity(drop); } else { @@ -54,11 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance())) { -+ // Paper start ++ // Paper start - EntityPickupItemEvent fixes + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, item, 0, false).isCancelled()) { + return; + } -+ // Paper end ++ // Paper end - EntityPickupItemEvent fixes EquipmentSlot enumitemslot = EquipmentSlot.HEAD; ItemStack itemstack1 = this.getItemBySlot(enumitemslot); double d0 = (double) this.getEquipmentDropChance(enumitemslot); diff --git a/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch index f68b8aa347..3fcb8f64b6 100644 --- a/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch +++ b/patches/server/Fire-EntityChangeBlockEvent-in-more-places.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.powerLightningRod(); - LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition()); -+ LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition(), this); // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent ++ LightningBolt.clearCopperOnLightningStrike(this.level(), this.getStrikePosition(), this); // Paper - Call EntityChangeBlockEvent this.gameEvent(GameEvent.LIGHTNING_STRIKE); } } @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - private static void clearCopperOnLightningStrike(Level world, BlockPos pos) { -+ private static void clearCopperOnLightningStrike(Level world, BlockPos pos, Entity lightning) { // Paper - transmit LightningBolt instance to call EntityChangeBlockEvent ++ private static void clearCopperOnLightningStrike(Level world, BlockPos pos, Entity lightning) { // Paper - Call EntityChangeBlockEvent BlockState iblockdata = world.getBlockState(pos); BlockPos blockposition1; BlockState iblockdata1; @@ -32,12 +32,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (iblockdata1.getBlock() instanceof WeatheringCopper) { - world.setBlockAndUpdate(blockposition1, WeatheringCopper.getFirst(world.getBlockState(blockposition1))); -+ // Paper start - call EntityChangeBlockEvent ++ // Paper start - Call EntityChangeBlockEvent + BlockState newBlock = WeatheringCopper.getFirst(world.getBlockState(blockposition1)); + if (CraftEventFactory.callEntityChangeBlockEvent(lightning, blockposition1, newBlock)) { + world.setBlockAndUpdate(blockposition1, newBlock); + } -+ // Paper end ++ // Paper end - Call EntityChangeBlockEvent BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); int i = world.random.nextInt(3) + 3; diff --git a/patches/server/Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/Fix-a-bunch-of-vanilla-bugs.patch index 1a364d471f..ee4b94ba39 100644 --- a/patches/server/Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/Fix-a-bunch-of-vanilla-bugs.patch @@ -64,6 +64,12 @@ https://bugs.mojang.com/browse/MC-153086 https://bugs.mojang.com/browse/MC-200092 Fix yaw being ignored for a player's first spawn pos +https://bugs.mojang.com/browse/MC-158900 + Fix error when joining after tempban expired + +https://bugs.mojang.com/browse/MC-259571 + Fix last gamemode not being saved on death or reload + == AT == public net/minecraft/world/entity/Mob leashInfoTag diff --git a/patches/server/Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/Fix-plugin-loggers-on-server-shutdown.patch index 4fab2ddf6c..a60d872a7b 100644 --- a/patches/server/Fix-plugin-loggers-on-server-shutdown.patch +++ b/patches/server/Fix-plugin-loggers-on-server-shutdown.patch @@ -56,11 +56,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static boolean useJline = true; public static boolean useConsole = true; -+ // Paper start - Hijack log manager to ensure logging on shutdown ++ // Paper start - Reset loggers after shutdown + static { + System.setProperty("java.util.logging.manager", "io.papermc.paper.log.CustomLogManager"); + } -+ // Paper end ++ // Paper end - Reset loggers after shutdown + public static void main(String[] args) { // Paper start diff --git a/patches/server/Missing-eating-regain-reason.patch b/patches/server/Missing-eating-regain-reason.patch index 8bba6326db..54ac805bd0 100644 --- a/patches/server/Missing-eating-regain-reason.patch +++ b/patches/server/Missing-eating-regain-reason.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (item.isEdible() && this.isFood(itemstack) && this.getHealth() < this.getMaxHealth()) { this.usePlayerItem(player, hand, itemstack); - this.heal((float) item.getFoodProperties().getNutrition()); -+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper ++ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason return InteractionResult.CONSUME; } @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean bl = this.getHealth() < this.getMaxHealth(); if (bl) { - this.heal(2.0F); -+ this.heal(2.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper ++ this.heal(2.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason } boolean bl2 = this.isTamed() && this.getAge() == 0 && this.canFallInLove(); @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { - this.heal(f); -+ this.heal(f, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper ++ this.heal(f, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // Paper - Add missing regain reason flag = true; } diff --git a/patches/server/Missing-effect-cause.patch b/patches/server/Missing-effect-cause.patch index deddc32cb7..e549a6be63 100644 --- a/patches/server/Missing-effect-cause.patch +++ b/patches/server/Missing-effect-cause.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - player.removeEffect(MobEffects.DIG_SLOWDOWN); -+ player.removeEffect(MobEffects.DIG_SLOWDOWN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper ++ player.removeEffect(MobEffects.DIG_SLOWDOWN, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // Paper - Add missing effect cause } @Override @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { - user.removeEffect(MobEffects.POISON); -+ user.removeEffect(MobEffects.POISON, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper ++ user.removeEffect(MobEffects.POISON, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause } if (stack.isEmpty()) { @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ItemStack itemStack = super.finishUsingItem(stack, world, user); listPotionEffects(itemStack, (effect) -> { - user.addEffect(effect.createEffectInstance()); -+ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper ++ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause }); return user instanceof Player && ((Player)user).getAbilities().instabuild ? itemStack : new ItemStack(Items.BOWL); } diff --git a/patches/server/More-Teleport-API.patch b/patches/server/More-Teleport-API.patch index f650b5b00a..2f97322f81 100644 --- a/patches/server/More-Teleport-API.patch +++ b/patches/server/More-Teleport-API.patch @@ -19,12 +19,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + relativeFlags.add(org.bukkit.craftbukkit.entity.CraftPlayer.toApiRelativeFlag(relativeArgument)); + } + PlayerTeleportEvent event = new PlayerTeleportEvent(player, from.clone(), to.clone(), cause, java.util.Set.copyOf(relativeFlags)); -+ // Paper end ++ // Paper end - Teleport API this.cserver.getPluginManager().callEvent(event); if (event.isCancelled() || !to.equals(event.getTo())) { - set.clear(); // Can't relative teleport -+ // set.clear(); // Can't relative teleport // Paper - Teleport API: Now you can! ++ // set.clear(); // Can't relative teleport // Paper - Teleport API; Now you can! to = event.isCancelled() ? event.getFrom() : event.getTo(); d0 = to.getX(); d1 = to.getY(); diff --git a/patches/server/Remove-unnecessary-onTrackingStart-during-navigation.patch b/patches/server/Remove-unnecessary-onTrackingStart-during-navigation.patch index ff5247b36a..d3f8b68c78 100644 --- a/patches/server/Remove-unnecessary-onTrackingStart-during-navigation.patch +++ b/patches/server/Remove-unnecessary-onTrackingStart-during-navigation.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Mob entityinsentient = (Mob) entity; - if (ServerLevel.this.isUpdatingNavigations) { -+ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper ++ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper - Remove unnecessary onTrackingStart during navigation warning String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Mob entityinsentient = (Mob) entity; - if (ServerLevel.this.isUpdatingNavigations) { -+ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper ++ if (false && ServerLevel.this.isUpdatingNavigations) { // Paper - Remove unnecessary onTrackingStart during navigation warning String s = "onTrackingStart called during navigation iteration"; Util.logAndPauseIfInIde("onTrackingStart called during navigation iteration", new IllegalStateException("onTrackingStart called during navigation iteration")); diff --git a/patches/server/Restore-vanilla-entity-drops-behavior.patch b/patches/server/Restore-vanilla-entity-drops-behavior.patch index f64df4f3f4..09d351deea 100644 --- a/patches/server/Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/Restore-vanilla-entity-drops-behavior.patch @@ -100,7 +100,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - entityitem.setDefaultPickUpDelay(); + entityitem.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer) - // Paper start + // Paper start - Call EntityDropItemEvent return this.spawnAtLocation(entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/patches/server/Send-block-entities-after-destroy-prediction.patch b/patches/server/Send-block-entities-after-destroy-prediction.patch index ae782933e6..ad9caead43 100644 --- a/patches/server/Send-block-entities-after-destroy-prediction.patch +++ b/patches/server/Send-block-entities-after-destroy-prediction.patch @@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private BlockPos delayedDestroyPos; private int delayedTickStart; private int lastSentState; -+ public boolean captureSentBlockEntities = false; // Paper -+ public boolean capturedBlockEntity = false; // Paper ++ public boolean captureSentBlockEntities = false; // Paper - Send block entities after destroy prediction ++ public boolean capturedBlockEntity = false; // Paper - Send block entities after destroy prediction public ServerPlayerGameMode(ServerPlayer player) { this.gameModeForPlayer = GameType.DEFAULT_MODE; @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (tileentity != null) { - this.player.connection.send(tileentity.getUpdatePacket()); - } -+ capturedBlockEntity = true; // Paper - send block entity after predicting ++ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction // CraftBukkit end return; } @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (tileentity != null) { - this.player.connection.send(tileentity.getUpdatePacket()); - } -+ capturedBlockEntity = true; // Paper - send block entity after predicting ++ capturedBlockEntity = true; // Paper - Send block entities after destroy prediction return; } // CraftBukkit end @@ -47,12 +47,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Update any tile entity data for this block -+ if (!captureSentBlockEntities) { // Paper - Toggle this location for capturing as this is used for api ++ if (!captureSentBlockEntities) { // Paper - Send block entities after destroy prediction BlockEntity tileentity = this.level.getBlockEntity(pos); if (tileentity != null) { this.player.connection.send(tileentity.getUpdatePacket()); } -+ } else {capturedBlockEntity = true;} // Paper end ++ } else {capturedBlockEntity = true;} // Paper - Send block entities after destroy prediction return false; } } @@ -64,13 +64,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } // Paper end - Don't allow digging in unloaded chunks -+ // Paper start - send block entities after prediction ++ // Paper start - Send block entities after destroy prediction + this.player.gameMode.capturedBlockEntity = false; + this.player.gameMode.captureSentBlockEntities = true; -+ // Paper end - send block entities after prediction ++ // Paper end - Send block entities after destroy prediction this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence()); this.player.connection.ackBlockChangesUpTo(packet.getSequence()); -+ // Paper start - send block entities after prediction ++ // Paper start - Send block entities after destroy prediction + this.player.gameMode.captureSentBlockEntities = false; + // If a block entity was modified speedup the block change ack to avoid the block entity + // being overriden. @@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.player.connection.send(tileentity.getUpdatePacket()); + } + } -+ // Paper end - send block entities after prediction ++ // Paper end - Send block entities after destroy prediction return; default: throw new IllegalArgumentException("Invalid player action"); diff --git a/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch b/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch index 365de1d3e2..eadb2566df 100644 --- a/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch +++ b/patches/server/Warn-on-plugins-accessing-faraway-chunks.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static boolean isInWorldBoundsHorizontal(BlockPos pos) { - return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000; -+ return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000; // Dif on change ++ return pos.getX() >= -30000000 && pos.getZ() >= -30000000 && pos.getX() < 30000000 && pos.getZ() < 30000000; // Diff on change warnUnsafeChunk() } private static boolean isOutsideSpawnableHeight(int y) { diff --git a/patches/server/fix-Jigsaw-block-kicking-user.patch b/patches/server/fix-Jigsaw-block-kicking-user.patch index ddf4de687c..1ccfcd44ff 100644 --- a/patches/server/fix-Jigsaw-block-kicking-user.patch +++ b/patches/server/fix-Jigsaw-block-kicking-user.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (holder == null) { + return; + } -+ // Paper end ++ // Paper end - Replace getHolderOrThrow with a null check JigsawPlacement.generateJigsaw(world, holder, this.target, maxDepth, blockPos, keepJigsaws); } diff --git a/patches/server/use-BlockFormEvent-for-mud-converting-into-clay.patch b/patches/server/use-BlockFormEvent-for-mud-converting-into-clay.patch index 06631ea0a5..20cef258a7 100644 --- a/patches/server/use-BlockFormEvent-for-mud-converting-into-clay.patch +++ b/patches/server/use-BlockFormEvent-for-mud-converting-into-clay.patch @@ -13,13 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockState iblockdata1 = Blocks.CLAY.defaultBlockState(); - world.setBlockAndUpdate(((PointedDripstoneBlock.FluidInfo) optional.get()).pos, iblockdata1); -+ // Paper start ++ // Paper start - Call BlockFormEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, ((PointedDripstoneBlock.FluidInfo) optional.get()).pos, iblockdata1)) { Block.pushEntitiesUp(((PointedDripstoneBlock.FluidInfo) optional.get()).sourceState, iblockdata1, world, ((PointedDripstoneBlock.FluidInfo) optional.get()).pos); world.gameEvent(GameEvent.BLOCK_CHANGE, ((PointedDripstoneBlock.FluidInfo) optional.get()).pos, GameEvent.Context.of(iblockdata1)); world.levelEvent(1504, blockposition1, 0); + } -+ //Paper end ++ // Paper end - Call BlockFormEvent } else { BlockPos blockposition2 = PointedDripstoneBlock.findFillableCauldronBelowStalactiteTip(world, blockposition1, fluidtype);