diff options
author | Noah van der Aa <[email protected]> | 2024-10-24 00:08:29 +0200 |
---|---|---|
committer | Noah van der Aa <[email protected]> | 2024-10-24 00:08:29 +0200 |
commit | 4baf9ab44d4377dc9bcb9c1ce4b8a08f2a4b2dd3 (patch) | |
tree | cc068d85966c837a4a6f76784383a22fee582488 /patches/unapplied | |
parent | d52e2d241da502ffc14b2097e9b6d784a01e899b (diff) | |
download | Paper-4baf9ab44d4377dc9bcb9c1ce4b8a08f2a4b2dd3.tar.gz Paper-4baf9ab44d4377dc9bcb9c1ce4b8a08f2a4b2dd3.zip |
MOOOOOOOOOOORE
Diffstat (limited to 'patches/unapplied')
26 files changed, 0 insertions, 1878 deletions
diff --git a/patches/unapplied/server/0766-check-global-player-list-where-appropriate.patch b/patches/unapplied/server/0766-check-global-player-list-where-appropriate.patch deleted file mode 100644 index f777294a49..0000000000 --- a/patches/unapplied/server/0766-check-global-player-list-where-appropriate.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Tue, 22 Nov 2022 13:16:01 -0800 -Subject: [PATCH] check global player list where appropriate - -Makes certain entities check all players when searching for a player -instead of just checking players in their world. - -diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 4bf6281a75597072b19658208e4447c4d1ee8ba2..688f9f13ae06337250e2e9ac2ddf9ad90d049f9b 100644 ---- a/src/main/java/net/minecraft/server/level/ServerLevel.java -+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -2302,4 +2302,12 @@ public class ServerLevel extends Level implements WorldGenLevel { - entity.updateDynamicGameEventListener(DynamicGameEventListener::move); - } - } -+ -+ // Paper start - check global player list where appropriate -+ @Override -+ @Nullable -+ public Player getGlobalPlayerByUUID(UUID uuid) { -+ return this.server.getPlayerList().getPlayer(uuid); -+ } -+ // Paper end - check global player list where appropriate - } -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e6d20887572817099cb863515978d3f06926be3d..f662a791e8cb045903a0de29778e5f30892fb766 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3723,7 +3723,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - public void onItemPickup(ItemEntity item) { -- Entity entity = item.getOwner(); -+ Entity entity = item.thrower != null ? this.level().getGlobalPlayerByUUID(item.thrower) : null; // Paper - check global player list where appropriate - - if (entity instanceof ServerPlayer) { - CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this); -diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -index f8c733961015ace508bfe14fd61d5188ca9d551b..e0dabbf6d7a87b8722769c78ef0d2ba4353ed2cb 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -269,7 +269,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { - entityvillager.finalizeSpawn(world, world.getCurrentDifficultyAt(entityvillager.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null); - entityvillager.refreshBrain(world); - if (this.conversionStarter != null) { -- Player entityhuman = world.getPlayerByUUID(this.conversionStarter); -+ Player entityhuman = world.getGlobalPlayerByUUID(this.conversionStarter); // Paper - check global player list where appropriate - - if (entityhuman instanceof ServerPlayer) { - CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer) entityhuman, this, entityvillager); -diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index d465fb01af4c8610f83ecb9c68b83127cf7e95ae..bd20bea7f76a7307f1698fb2dfef37125032d166 100644 ---- a/src/main/java/net/minecraft/world/level/EntityGetter.java -+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -237,4 +237,11 @@ public interface EntityGetter { - - return null; - } -+ -+ // Paper start - check global player list where appropriate -+ @Nullable -+ default Player getGlobalPlayerByUUID(UUID uuid) { -+ return this.getPlayerByUUID(uuid); -+ } -+ // Paper end - check global player list where appropriate - } -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index dd86f5ec5b2051aeea4e19ff97146362b1e8d019..0c6561e53db1b82f70dec00729d4d8a70c8fd4a1 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -@@ -105,6 +105,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi - - @Nullable - public static ServerPlayer tryGetPlayer(@Nullable Entity entity) { -+ // Paper start - check global player list where appropriate; ensure level is the same for sculk events -+ final ServerPlayer player = tryGetPlayer0(entity); -+ return player != null && player.level() == entity.level() ? player : null; -+ } -+ @Nullable -+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) { -+ // Paper end - check global player list where appropriate - if (entity instanceof ServerPlayer) { - return (ServerPlayer)entity; - } else { diff --git a/patches/unapplied/server/0767-Fix-async-entity-add-due-to-fungus-trees.patch b/patches/unapplied/server/0767-Fix-async-entity-add-due-to-fungus-trees.patch deleted file mode 100644 index 2a7830d952..0000000000 --- a/patches/unapplied/server/0767-Fix-async-entity-add-due-to-fungus-trees.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Fri, 18 Mar 2022 21:30:00 -0700 -Subject: [PATCH] Fix async entity add due to fungus trees - - -diff --git a/src/main/java/net/minecraft/server/level/WorldGenRegion.java b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -index 13229388ddce668061a34c787ab9586d41854d8a..682c8cfbd917c086072f1756861a340800ea40da 100644 ---- a/src/main/java/net/minecraft/server/level/WorldGenRegion.java -+++ b/src/main/java/net/minecraft/server/level/WorldGenRegion.java -@@ -237,6 +237,7 @@ public class WorldGenRegion implements WorldGenLevel { - if (iblockdata.isAir()) { - return false; - } else { -+ if (drop) LOGGER.warn("Potential async entity add during worldgen", new Throwable()); // Paper - Fix async entity add due to fungus trees; log when this happens - if (false) { // CraftBukkit - SPIGOT-6833: Do not drop during world generation - BlockEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(pos) : null; - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index 3c1937b43b6834ae0ffdd8d22ac32a776bc7fb64..a14d3e6c43b94c543790571b13808713444a239f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -@@ -261,10 +261,10 @@ public abstract class CraftRegionAccessor implements RegionAccessor { - ((ChorusFlowerBlock) Blocks.CHORUS_FLOWER).generatePlant(access, pos, random, 8); - return true; - case CRIMSON_FUNGUS: -- gen = TreeFeatures.CRIMSON_FUNGUS_PLANTED; -+ gen = this.isNormalWorld() ? TreeFeatures.CRIMSON_FUNGUS_PLANTED : TreeFeatures.CRIMSON_FUNGUS; // Paper - Fix async entity add due to fungus trees; if world gen, don't use planted version - break; - case WARPED_FUNGUS: -- gen = TreeFeatures.WARPED_FUNGUS_PLANTED; -+ gen = this.isNormalWorld() ? TreeFeatures.WARPED_FUNGUS_PLANTED : TreeFeatures.WARPED_FUNGUS; // Paper - Fix async entity add due to fungus trees; if world gen, don't use planted version - break; - case AZALEA: - gen = TreeFeatures.AZALEA_TREE; diff --git a/patches/unapplied/server/0768-ItemStack-damage-API.patch b/patches/unapplied/server/0768-ItemStack-damage-API.patch deleted file mode 100644 index 1233d5fea9..0000000000 --- a/patches/unapplied/server/0768-ItemStack-damage-API.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Sun, 8 May 2022 13:35:45 -0700 -Subject: [PATCH] ItemStack damage API - -Adds methods notify clients about item breaks and -to simulate damage done to an itemstack and all -the logic associated with damaging them - -== AT == -public net.minecraft.world.entity.LivingEntity entityEventForEquipmentBreak(Lnet/minecraft/world/entity/EquipmentSlot;)B - -diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index bee59df6a8f30416f94c1a4fbd5e2629336e842f..e64cc91b416bbbefe6aadf1c6b685346cf258ab4 100644 ---- a/src/main/java/net/minecraft/world/item/ItemStack.java -+++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -647,8 +647,13 @@ public final class ItemStack implements DataComponentHolder { - } - - public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback) { // Paper - Add EntityDamageItemEvent -+ // Paper start - add param to skip infinite mats check -+ this.hurtAndBreak(amount, world, player, breakCallback, false); -+ } -+ public void hurtAndBreak(int amount, ServerLevel world, @Nullable LivingEntity player, Consumer<Item> breakCallback, boolean force) { -+ // Paper end - add param to skip infinite mats check - if (this.isDamageableItem()) { -- if (player == null || !player.hasInfiniteMaterials()) { -+ if (player == null || !player.hasInfiniteMaterials() || force) { // Paper - if (amount > 0) { - int originalDamage = amount; // Paper - Expand PlayerItemDamageEvent - amount = EnchantmentHelper.processDurabilityChange(world, this, amount); -@@ -704,6 +709,11 @@ public final class ItemStack implements DataComponentHolder { - } - - public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot) { -+ // Paper start - add param to skip infinite mats check -+ this.hurtAndBreak(amount, entity, slot, false); -+ } -+ public void hurtAndBreak(int amount, LivingEntity entity, EquipmentSlot slot, boolean force) { -+ // Paper end - add param to skip infinite mats check - Level world = entity.level(); - - if (world instanceof ServerLevel worldserver) { -@@ -716,8 +726,8 @@ public final class ItemStack implements DataComponentHolder { - } - - this.hurtAndBreak(amount, worldserver, entity, (item) -> { // Paper - Add EntityDamageItemEvent -- entity.onEquippedItemBroken(item, slot); -- }); -+ if (slot != null) entity.onEquippedItemBroken(item, slot); // Paper - itemstack damage API - do not process entity related callbacks when damaging from API -+ }, force); // Paper - itemstack damage API - } - - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 2a7fffa71106327d0ffee632408d45faaec76702..2332f40fed84510741e63073aaf0a18aab85303e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1135,4 +1135,48 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - this.getHandle().knockback(strength, directionX, directionZ); - }; - // Paper end - knockback API -+ -+ // Paper start - ItemStack damage API -+ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot) { -+ this.getHandle().level().broadcastEntityEvent(this.getHandle(), net.minecraft.world.entity.LivingEntity.entityEventForEquipmentBreak(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot))); -+ } -+ -+ @Override -+ public void broadcastSlotBreak(final org.bukkit.inventory.EquipmentSlot slot, final Collection<org.bukkit.entity.Player> players) { -+ if (players.isEmpty()) { -+ return; -+ } -+ final net.minecraft.network.protocol.game.ClientboundEntityEventPacket packet = new net.minecraft.network.protocol.game.ClientboundEntityEventPacket( -+ this.getHandle(), -+ net.minecraft.world.entity.LivingEntity.entityEventForEquipmentBreak(org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot)) -+ ); -+ players.forEach(player -> ((CraftPlayer) player).getHandle().connection.send(packet)); -+ } -+ -+ @Override -+ public ItemStack damageItemStack(ItemStack stack, final int amount) { -+ final net.minecraft.world.item.ItemStack nmsStack; -+ if (stack instanceof final CraftItemStack craftItemStack) { -+ if (craftItemStack.handle == null || craftItemStack.handle.isEmpty()) { -+ return stack; -+ } -+ nmsStack = craftItemStack.handle; -+ } else { -+ nmsStack = CraftItemStack.asNMSCopy(stack); -+ stack = CraftItemStack.asCraftMirror(nmsStack); // mirror to capture changes in hurt logic & events -+ } -+ this.damageItemStack0(nmsStack, amount, null); -+ return stack; -+ } -+ -+ @Override -+ public void damageItemStack(final org.bukkit.inventory.EquipmentSlot slot, final int amount) { -+ final net.minecraft.world.entity.EquipmentSlot nmsSlot = org.bukkit.craftbukkit.CraftEquipmentSlot.getNMS(slot); -+ this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot); -+ } -+ -+ private void damageItemStack0(final net.minecraft.world.item.ItemStack nmsStack, final int amount, final net.minecraft.world.entity.EquipmentSlot slot) { -+ nmsStack.hurtAndBreak(amount, this.getHandle(), slot, true); -+ } -+ // Paper end - ItemStack damage API - } diff --git a/patches/unapplied/server/0769-Friction-API.patch b/patches/unapplied/server/0769-Friction-API.patch deleted file mode 100644 index dc735c46bb..0000000000 --- a/patches/unapplied/server/0769-Friction-API.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa <[email protected]> -Date: Wed, 15 Sep 2021 20:44:22 +0200 -Subject: [PATCH] Friction API - - -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f662a791e8cb045903a0de29778e5f30892fb766..2bb61084b628582ded44926d7697ee26d0bb1e8e 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -285,6 +285,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - public boolean bukkitPickUpLoot; - public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper - public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event -+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API - - @Override - public float getBukkitYaw() { -@@ -706,7 +707,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - - public boolean shouldDiscardFriction() { -- return this.discardFriction; -+ return !this.frictionState.toBooleanOrElse(!this.discardFriction); // Paper - Friction API - } - - public void setDiscardFriction(boolean noDrag) { -@@ -774,6 +775,11 @@ public abstract class LivingEntity extends Entity implements Attackable { - - @Override - public void addAdditionalSaveData(CompoundTag nbt) { -+ // Paper start - Friction API -+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) { -+ nbt.putString("Paper.FrictionState", this.frictionState.toString()); -+ } -+ // Paper end - Friction API - nbt.putFloat("Health", this.getHealth()); - nbt.putShort("HurtTime", (short) this.hurtTime); - nbt.putInt("HurtByTimestamp", this.lastHurtByMobTimestamp); -@@ -817,6 +823,16 @@ public abstract class LivingEntity extends Entity implements Attackable { - } - this.internalSetAbsorptionAmount(absorptionAmount); - // Paper end - Check for NaN -+ // Paper start - Friction API -+ if (nbt.contains("Paper.FrictionState")) { -+ String fs = nbt.getString("Paper.FrictionState"); -+ try { -+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs); -+ } catch (Exception ignored) { -+ LOGGER.error("Unknown friction state " + fs + " for " + this); -+ } -+ } -+ // Paper end - Friction API - if (nbt.contains("attributes", 9) && this.level() != null && !this.level().isClientSide) { - this.getAttributes().load(nbt.getList("attributes", 10)); - } -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 446c319524183d6a1b4d0e6f0613a8db690677da..cbfb07bdf8d5e2e5a462835184be2d47e59d506c 100644 ---- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -63,6 +63,7 @@ public class ItemEntity extends Entity implements TraceableEntity { - private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit - public boolean canMobPickup = true; // Paper - Item#canEntityPickup - private int despawnRate = -1; // Paper - Alternative item-despawn-rate -+ public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API - - public ItemEntity(EntityType<? extends ItemEntity> type, Level world) { - super(type, world); -@@ -185,7 +186,11 @@ public class ItemEntity extends Entity implements TraceableEntity { - this.move(MoverType.SELF, this.getDeltaMovement()); - float f = 0.98F; - -- if (this.onGround()) { -+ // Paper start - Friction API -+ if (frictionState == net.kyori.adventure.util.TriState.FALSE) { -+ f = 1F; -+ } else if (this.onGround()) { -+ // Paper end - Friction API - f = this.level().getBlockState(this.getBlockPosBelowThatAffectsMyMovement()).getBlock().getFriction() * 0.98F; - } - -@@ -393,6 +398,11 @@ public class ItemEntity extends Entity implements TraceableEntity { - - @Override - public void addAdditionalSaveData(CompoundTag nbt) { -+ // Paper start - Friction API -+ if (this.frictionState != net.kyori.adventure.util.TriState.NOT_SET) { -+ nbt.putString("Paper.FrictionState", this.frictionState.toString()); -+ } -+ // Paper end - Friction API - nbt.putShort("Health", (short) this.health); - nbt.putShort("Age", (short) this.age); - nbt.putShort("PickupDelay", (short) this.pickupDelay); -@@ -435,6 +445,17 @@ public class ItemEntity extends Entity implements TraceableEntity { - this.setItem(ItemStack.EMPTY); - } - -+ // Paper start - Friction API -+ if (nbt.contains("Paper.FrictionState")) { -+ String fs = nbt.getString("Paper.FrictionState"); -+ try { -+ frictionState = net.kyori.adventure.util.TriState.valueOf(fs); -+ } catch (Exception ignored) { -+ com.mojang.logging.LogUtils.getLogger().error("Unknown friction state " + fs + " for " + this); -+ } -+ } -+ // Paper end - Friction API -+ - if (this.getItem().isEmpty()) { - this.discard(null); // CraftBukkit - add Bukkit remove cause - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java -index 1a291dd8a287db30e71dcb315599fc4b038764c4..30d62ee4d5cd2ddacb8783b5bbbf475d592b3e02 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java -@@ -99,6 +99,18 @@ public class CraftItem extends CraftEntity implements Item { - this.getHandle().age = willAge ? 0 : NO_AGE_TIME; - } - -+ @org.jetbrains.annotations.NotNull -+ @Override -+ public net.kyori.adventure.util.TriState getFrictionState() { -+ return this.getHandle().frictionState; -+ } -+ -+ @Override -+ public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) { -+ java.util.Objects.requireNonNull(state, "state may not be null"); -+ this.getHandle().frictionState = state; -+ } -+ - @Override - public int getHealth() { - return this.getHandle().health; -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 2332f40fed84510741e63073aaf0a18aab85303e..516ea1ec9ae5069c3c0e4708f62164a91960b627 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -1179,4 +1179,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { - nmsStack.hurtAndBreak(amount, this.getHandle(), slot, true); - } - // Paper end - ItemStack damage API -+ // Paper start - friction API -+ @org.jetbrains.annotations.NotNull -+ @Override -+ public net.kyori.adventure.util.TriState getFrictionState() { -+ return this.getHandle().frictionState; -+ } -+ -+ @Override -+ public void setFrictionState(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState state) { -+ java.util.Objects.requireNonNull(state, "state may not be null"); -+ this.getHandle().frictionState = state; -+ } -+ // Paper end - friction API - } diff --git a/patches/unapplied/server/0770-Ability-to-control-player-s-insomnia-and-phantoms.patch b/patches/unapplied/server/0770-Ability-to-control-player-s-insomnia-and-phantoms.patch deleted file mode 100644 index 03be2495a7..0000000000 --- a/patches/unapplied/server/0770-Ability-to-control-player-s-insomnia-and-phantoms.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jan Villim <[email protected]> -Date: Sat, 22 Jan 2022 17:56:19 +0100 -Subject: [PATCH] Ability to control player's insomnia and phantoms - - -diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java -index 302decdccd37c5579473c8fc33adda3956be7603..dca7b99e97f21bf6cfae6ee69eeac95d0bcf6863 100644 ---- a/src/main/java/net/minecraft/world/entity/EntitySelector.java -+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java -@@ -28,7 +28,18 @@ public final class EntitySelector { - return !entity.isSpectator(); - }; - public static final Predicate<Entity> CAN_BE_COLLIDED_WITH = EntitySelector.NO_SPECTATORS.and(Entity::canBeCollidedWith); -- public static Predicate<Player> IS_INSOMNIAC = (player) -> net.minecraft.util.Mth.clamp(((net.minecraft.server.level.ServerPlayer) player).getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper - Add phantom creative and insomniac controls -+ // Paper start - Ability to control player's insomnia and phantoms -+ public static Predicate<Player> IS_INSOMNIAC = (player) -> { -+ net.minecraft.server.level.ServerPlayer serverPlayer = (net.minecraft.server.level.ServerPlayer) player; -+ int playerInsomniaTicks = serverPlayer.level().paperConfig().entities.behavior.playerInsomniaStartTicks; -+ -+ if (playerInsomniaTicks <= 0) { -+ return false; -+ } -+ -+ return net.minecraft.util.Mth.clamp(serverPlayer.getStats().getValue(net.minecraft.stats.Stats.CUSTOM.get(net.minecraft.stats.Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= playerInsomniaTicks; -+ }; -+ // Paper end - Ability to control player's insomnia and phantoms - - private EntitySelector() {} - // Paper start - Affects Spawning API -diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -index f74d41e57570a40cd5ce4da3076f3210b6594a63..1b1b475ca27e799e251d6f8a8c9fe1a4fd8bae83 100644 ---- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java -@@ -32,13 +32,22 @@ public class PhantomSpawner implements CustomSpawner { - } else if (!world.getGameRules().getBoolean(GameRules.RULE_DOINSOMNIA)) { - return 0; - } else { -+ // Paper start - Ability to control player's insomnia and phantoms -+ if (world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds <= 0) { -+ return 0; -+ } -+ // Paper end - Ability to control player's insomnia and phantoms - RandomSource randomsource = world.random; - - --this.nextTick; - if (this.nextTick > 0) { - return 0; - } else { -- this.nextTick += (60 + randomsource.nextInt(60)) * 20; -+ // Paper start - Ability to control player's insomnia and phantoms -+ int spawnAttemptMinSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMinSeconds; -+ int spawnAttemptMaxSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds; -+ this.nextTick += (spawnAttemptMinSeconds + randomsource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20; -+ // Paper end - Ability to control player's insomnia and phantoms - if (world.getSkyDarken() < 5 && world.dimensionType().hasSkyLight()) { - return 0; - } else { -@@ -59,7 +68,7 @@ public class PhantomSpawner implements CustomSpawner { - int j = Mth.clamp(serverstatisticmanager.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE); - boolean flag2 = true; - -- if (randomsource.nextInt(j) >= 72000) { -+ if (randomsource.nextInt(j) >= world.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper - Ability to control player's insomnia and phantoms - BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21)); - BlockState iblockdata = world.getBlockState(blockposition1); - FluidState fluid = world.getFluidState(blockposition1); diff --git a/patches/unapplied/server/0771-Fix-premature-player-kicks-on-shutdown.patch b/patches/unapplied/server/0771-Fix-premature-player-kicks-on-shutdown.patch deleted file mode 100644 index 034840341e..0000000000 --- a/patches/unapplied/server/0771-Fix-premature-player-kicks-on-shutdown.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder <[email protected]> -Date: Thu, 11 Apr 2024 16:37:44 +0100 -Subject: [PATCH] Fix premature player kicks on shutdown - -When the server is stopping, the default execution handler method will throw a -RejectedExecutionException in order to prevent further execution, this causes -us to lose the actual kick reason. To mitigate this, we'll use a seperate marked -class in order to gracefully ignore these. - -diff --git a/src/main/java/io/papermc/paper/util/ServerStopRejectedExecutionException.java b/src/main/java/io/papermc/paper/util/ServerStopRejectedExecutionException.java -new file mode 100644 -index 0000000000000000000000000000000000000000..2c5cd77103c5a33d4349ab6b9ee2d8378bb60eb4 ---- /dev/null -+++ b/src/main/java/io/papermc/paper/util/ServerStopRejectedExecutionException.java -@@ -0,0 +1,20 @@ -+package io.papermc.paper.util; -+ -+import java.util.concurrent.RejectedExecutionException; -+ -+public class ServerStopRejectedExecutionException extends RejectedExecutionException { -+ public ServerStopRejectedExecutionException() { -+ } -+ -+ public ServerStopRejectedExecutionException(final String message) { -+ super(message); -+ } -+ -+ public ServerStopRejectedExecutionException(final String message, final Throwable cause) { -+ super(message, cause); -+ } -+ -+ public ServerStopRejectedExecutionException(final Throwable cause) { -+ super(cause); -+ } -+} -diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java -index 4d9f1fc884050993287adfa4578a87da710623fb..a8dfe7a4b3d01bf75587be078f471d1ef1d7a667 100644 ---- a/src/main/java/net/minecraft/network/Connection.java -+++ b/src/main/java/net/minecraft/network/Connection.java -@@ -285,6 +285,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { - Connection.genericsFtw(packet, packetlistener); - } catch (RunningOnDifferentThreadException cancelledpackethandleexception) { - ; -+ } catch (io.papermc.paper.util.ServerStopRejectedExecutionException ignored) { // Paper - do not prematurely disconnect players on stop - } catch (RejectedExecutionException rejectedexecutionexception) { - this.disconnect((Component) Component.translatable("multiplayer.disconnect.server_shutdown")); - } catch (ClassCastException classcastexception) { -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bef05e09c654794405832ad75c3471f63399dfee..2cc22a9a5483c62cdf64870f5ce62b33018bef06 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2091,7 +2091,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa - @Override - public void executeIfPossible(Runnable runnable) { - if (this.isStopped()) { -- throw new RejectedExecutionException("Server already shutting down"); -+ throw new io.papermc.paper.util.ServerStopRejectedExecutionException("Server already shutting down"); // Paper - do not prematurely disconnect players on stop - } else { - super.executeIfPossible(runnable); - } diff --git a/patches/unapplied/server/0772-Sync-offhand-slot-in-menus.patch b/patches/unapplied/server/0772-Sync-offhand-slot-in-menus.patch deleted file mode 100644 index f613fba84b..0000000000 --- a/patches/unapplied/server/0772-Sync-offhand-slot-in-menus.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Fri, 14 Jan 2022 10:20:40 -0800 -Subject: [PATCH] Sync offhand slot in menus - -Menus don't add slots for the offhand, so on sendAllDataToRemote calls the -offhand slot isn't sent. This is not correct because you *can* put stuff into the offhand -by pressing the offhand swap item - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3dbaa3c6b75a0f8bfdef42d210f2ac6f560cde3d..96dff63230e8cda1f5e548d914c119bd64b5ac33 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -321,6 +321,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { - - } - -+ // Paper start - Sync offhand slot in menus -+ @Override -+ public void sendOffHandSlotChange() { -+ ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(ServerPlayer.this.inventoryMenu.containerId, ServerPlayer.this.inventoryMenu.incrementStateId(), net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT, ServerPlayer.this.inventoryMenu.getSlot(net.minecraft.world.inventory.InventoryMenu.SHIELD_SLOT).getItem().copy())); -+ } -+ // Paper end - Sync offhand slot in menus -+ - @Override - public void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack) { - ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(handler.containerId, handler.incrementStateId(), slot, stack)); -diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index f7b9849819c185cd89533aca1f6d34398ffc1077..0e380151b038e2133013eb7d73621cf247b5b954 100644 ---- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -200,6 +200,7 @@ public abstract class AbstractContainerMenu { - - if (this.synchronizer != null) { - this.synchronizer.sendInitialData(this, this.remoteSlots, this.remoteCarried, this.remoteDataSlots.toIntArray()); -+ this.synchronizer.sendOffHandSlotChange(); // Paper - Sync offhand slot in menus; update player's offhand since the offhand slot is not added to the slots for menus but can be changed by swapping from a menu slot - } - - } -diff --git a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java -index ff4fa86f9408e83e505f7e27692d3423f8570c48..a45ef5fcffc05e4e30801b73e82d29c6dbf5b8fd 100644 ---- a/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java -+++ b/src/main/java/net/minecraft/world/inventory/ContainerSynchronizer.java -@@ -6,6 +6,7 @@ import net.minecraft.world.item.ItemStack; - public interface ContainerSynchronizer { - void sendInitialData(AbstractContainerMenu handler, NonNullList<ItemStack> stacks, ItemStack cursorStack, int[] properties); - -+ default void sendOffHandSlotChange() {} // Paper - Sync offhand slot in menus - void sendSlotChange(AbstractContainerMenu handler, int slot, ItemStack stack); - - void sendCarriedChange(AbstractContainerMenu handler, ItemStack stack); diff --git a/patches/unapplied/server/0773-Player-Entity-Tracking-Events.patch b/patches/unapplied/server/0773-Player-Entity-Tracking-Events.patch deleted file mode 100644 index 62b6d04022..0000000000 --- a/patches/unapplied/server/0773-Player-Entity-Tracking-Events.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Yannick Lamprecht <[email protected]> -Date: Wed, 30 Mar 2022 18:16:52 +0200 -Subject: [PATCH] Player Entity Tracking Events - - -diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 61fda6927f060cdf8bcfddaaa08bbbe2c514c630..dca6087dc4e1c177c3dfdae01f140cf80c179803 100644 ---- a/src/main/java/net/minecraft/server/level/ChunkMap.java -+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java -@@ -1533,7 +1533,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - // CraftBukkit end - if (flag) { - if (this.seenBy.add(player.connection)) { -+ // Paper start - entity tracking events -+ if (io.papermc.paper.event.player.PlayerTrackEntityEvent.getHandlerList().getRegisteredListeners().length == 0 || new io.papermc.paper.event.player.PlayerTrackEntityEvent(player.getBukkitEntity(), this.entity.getBukkitEntity()).callEvent()) { - this.serverEntity.addPairing(player); -+ } -+ // Paper end - entity tracking events - } - } else if (this.seenBy.remove(player.connection)) { - this.serverEntity.removePairing(player); -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3170f7246f55799fd5783e747920940ab33c3e40..d5df4ddb33600479e6edb93a18db9400ffc6c699 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3870,7 +3870,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - - public void startSeenByPlayer(ServerPlayer player) {} - -- public void stopSeenByPlayer(ServerPlayer player) {} -+ // Paper start - entity tracking events -+ public void stopSeenByPlayer(ServerPlayer player) { -+ // Since this event cannot be cancelled, we should call it here to catch all "un-tracks" -+ if (io.papermc.paper.event.player.PlayerUntrackEntityEvent.getHandlerList().getRegisteredListeners().length > 0) { -+ new io.papermc.paper.event.player.PlayerUntrackEntityEvent(player.getBukkitEntity(), this.getBukkitEntity()).callEvent(); -+ } -+ } -+ // Paper end - entity tracking events - - public float rotate(Rotation rotation) { - float f = Mth.wrapDegrees(this.getYRot()); diff --git a/patches/unapplied/server/0774-Limit-pet-look-distance.patch b/patches/unapplied/server/0774-Limit-pet-look-distance.patch deleted file mode 100644 index 983f861539..0000000000 --- a/patches/unapplied/server/0774-Limit-pet-look-distance.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Noah van der Aa <[email protected]> -Date: Tue, 6 Dec 2022 18:45:54 +0100 -Subject: [PATCH] Limit pet look distance - - -diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java -index bf9ad63343fa07105f217625bb81ed637a7f7f7e..15d7be9ed4a973044dd4399db46aaa244730b836 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java -+++ b/src/main/java/net/minecraft/world/entity/ai/goal/FollowOwnerGoal.java -@@ -72,7 +72,7 @@ public class FollowOwnerGoal extends Goal { - public void tick() { - boolean bl = this.tamable.shouldTryTeleportToOwner(); - if (!bl) { -- this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float)this.tamable.getMaxHeadXRot()); -+ if (this.tamable.distanceToSqr(this.owner) <= 16 * 16) this.tamable.getLookControl().setLookAt(this.owner, 10.0F, (float)this.tamable.getMaxHeadXRot()); // Paper - Limit pet look distance - } - - if (--this.timeToRecalcPath <= 0) { diff --git a/patches/unapplied/server/0775-fix-Instruments.patch b/patches/unapplied/server/0775-fix-Instruments.patch deleted file mode 100644 index 41359cbf13..0000000000 --- a/patches/unapplied/server/0775-fix-Instruments.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Fri, 9 Dec 2022 01:47:23 -0800 -Subject: [PATCH] fix Instruments - -properly handle Player#playNote - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 922ec82d566fd5ac0b40ed95629e63be3d1bf264..111b90f97f631369acfb76278da26de94a4740bf 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -768,7 +768,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - Sound instrumentSound = instrument.getSound(); - if (instrumentSound == null) return; - -- float pitch = note.getPitch(); -+ // Paper start - use correct pitch (modeled off of NoteBlock) -+ final net.minecraft.world.level.block.state.properties.NoteBlockInstrument noteBlockInstrument = CraftBlockData.toNMS(instrument, net.minecraft.world.level.block.state.properties.NoteBlockInstrument.class); -+ final float pitch = noteBlockInstrument.isTunable() ? note.getPitch() : 1.0f; -+ // Paper end - this.getHandle().connection.send(new ClientboundSoundPacket(CraftSound.bukkitToMinecraftHolder(instrumentSound), net.minecraft.sounds.SoundSource.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, pitch, this.getHandle().getRandom().nextLong())); - } - -diff --git a/src/test/java/io/papermc/paper/block/InstrumentSoundTest.java b/src/test/java/io/papermc/paper/block/InstrumentSoundTest.java -new file mode 100644 -index 0000000000000000000000000000000000000000..cd718ed01ba5d448cdf0a2b6a39dc7ef2337f70d ---- /dev/null -+++ b/src/test/java/io/papermc/paper/block/InstrumentSoundTest.java -@@ -0,0 +1,28 @@ -+package io.papermc.paper.block; -+ -+import java.util.Arrays; -+import java.util.stream.Stream; -+import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; -+import org.bukkit.Instrument; -+import org.bukkit.craftbukkit.CraftSound; -+import org.bukkit.craftbukkit.block.data.CraftBlockData; -+import org.bukkit.support.environment.AllFeatures; -+import org.junit.jupiter.params.ParameterizedTest; -+import org.junit.jupiter.params.provider.MethodSource; -+ -+import static org.junit.jupiter.api.Assertions.assertEquals; -+ -+@AllFeatures -+class InstrumentSoundTest { -+ -+ static Stream<Instrument> bukkitInstruments() { -+ return Arrays.stream(Instrument.values()).filter(i -> i.getSound() != null); -+ } -+ -+ @ParameterizedTest -+ @MethodSource("bukkitInstruments") -+ void checkInstrumentSound(final Instrument bukkit) { -+ final NoteBlockInstrument nms = CraftBlockData.toNMS(bukkit, NoteBlockInstrument.class); -+ assertEquals(nms.getSoundEvent(), CraftSound.bukkitToMinecraftHolder(bukkit.getSound())); -+ } -+} diff --git a/patches/unapplied/server/0776-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch b/patches/unapplied/server/0776-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch deleted file mode 100644 index 420107d5c3..0000000000 --- a/patches/unapplied/server/0776-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf <[email protected]> -Date: Mon, 6 Jul 2020 20:46:50 -0700 -Subject: [PATCH] Improve inlining for some hot BlockBehavior and FluidState - methods - - -diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 46dd499c2023ec482ae7204d2894fb4100d9233b..a8bec3c405732e5863cf717b1fe948d00837bed2 100644 ---- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -907,15 +907,15 @@ public abstract class BlockBehaviour implements FeatureElement { - return this.shapeExceedsCube; // Paper - moved into shape cache init - } - -- public boolean useShapeForLightOcclusion() { -+ public final boolean useShapeForLightOcclusion() { // Paper - Perf: Final for inlining - return this.useShapeForLightOcclusion; - } - -- public int getLightEmission() { -+ public final int getLightEmission() { // Paper - Perf: Final for inlining - return this.lightEmission; - } - -- public boolean isAir() { -+ public final boolean isAir() { // Paper - Perf: Final for inlining - return this.isAir; - } - -@@ -999,7 +999,7 @@ public abstract class BlockBehaviour implements FeatureElement { - } - } - -- public boolean canOcclude() { -+ public final boolean canOcclude() { // Paper - Perf: Final for inlining - return this.canOcclude; - } - -@@ -1215,11 +1215,11 @@ public abstract class BlockBehaviour implements FeatureElement { - return this.getBlock().builtInRegistryHolder().is(key); - } - -- public FluidState getFluidState() { -+ public final FluidState getFluidState() { // Paper - Perf: Final for inlining - return this.fluidState; - } - -- public boolean isRandomlyTicking() { -+ public final boolean isRandomlyTicking() { // Paper - Perf: Final for inlining - return this.isRandomlyTicking; - } - -diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java -index 42370e5e6628ebf8216c01521af859706b08834b..14bb12d2a0066e8b020f2e0e670a7a5c74633623 100644 ---- a/src/main/java/net/minecraft/world/level/material/FluidState.java -+++ b/src/main/java/net/minecraft/world/level/material/FluidState.java -@@ -25,9 +25,11 @@ public final class FluidState extends StateHolder<Fluid, FluidState> { - public static final Codec<FluidState> CODEC = codec(BuiltInRegistries.FLUID.byNameCodec(), Fluid::defaultFluidState).stable(); - public static final int AMOUNT_MAX = 9; - public static final int AMOUNT_FULL = 8; -+ protected final boolean isEmpty; // Paper - Perf: moved from isEmpty() - - public FluidState(Fluid fluid, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<FluidState> codec) { - super(fluid, propertyMap, codec); -+ this.isEmpty = fluid.isEmpty(); // Paper - Perf: moved from isEmpty() - } - - public Fluid getType() { -@@ -43,7 +45,7 @@ public final class FluidState extends StateHolder<Fluid, FluidState> { - } - - public boolean isEmpty() { -- return this.getType().isEmpty(); -+ return this.isEmpty; // Paper - Perf: moved into constructor - } - - public float getHeight(BlockGetter world, BlockPos pos) { diff --git a/patches/unapplied/server/0777-Fix-inconsistencies-in-dispense-events-regarding-sta.patch b/patches/unapplied/server/0777-Fix-inconsistencies-in-dispense-events-regarding-sta.patch deleted file mode 100644 index 8b797606ed..0000000000 --- a/patches/unapplied/server/0777-Fix-inconsistencies-in-dispense-events-regarding-sta.patch +++ /dev/null @@ -1,456 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Sun, 11 Dec 2022 23:47:22 -0800 -Subject: [PATCH] Fix inconsistencies in dispense events regarding stack size - -The javadocs for BlockDispenseEvent suggest the ItemStack is a single -item which is being dispensed. Before this fix, sometimes it was the whole -stack before a single item had been taken. This fixes that so the stack size -is always 1. - -diff --git a/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -index 90e1914599b43c8bf813596b3b428d8be3bac1b5..6df0db8b4cdab23494ea34236949ece4989110a3 100644 ---- a/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java -@@ -58,7 +58,7 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { - - // Object object = this.isChestBoat ? new ChestBoat(worldserver, d1, d2 + d4, d3) : new EntityBoat(worldserver, d1, d2 + d4, d3); - // CraftBukkit start -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink at end and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -68,12 +68,13 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -89,8 +90,7 @@ public class BoatDispenseItemBehavior extends DefaultDispenseItemBehavior { - EntityType.createDefaultStackConfig(worldserver, stack, (Player) null).accept(object); - ((Boat) object).setVariant(this.type); - ((Boat) object).setYRot(enumdirection.toYRot()); -- if (!worldserver.addFreshEntity((Entity) object)) stack.grow(1); // CraftBukkit -- // itemstack.shrink(1); // CraftBukkit - handled during event processing -+ if (worldserver.addFreshEntity((Entity) object) && shrink) stack.shrink(1); // Paper - if entity add was successful and supposed to shrink - return stack; - } - -diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -index fb80b00b34ae5a4b1491c618a7fe1bdbbde0de9b..96db0b1041a4c0f054d4f3f2bdced960b119664e 100644 ---- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -110,7 +110,7 @@ public interface DispenseItemBehavior { - - // CraftBukkit start - ServerLevel worldserver = pointer.level(); -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -120,12 +120,13 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -142,7 +143,7 @@ public interface DispenseItemBehavior { - return ItemStack.EMPTY; - } - -- // itemstack.shrink(1); // Handled during event processing -+ if (shrink) stack.shrink(1); // Paper - actually handle here - // CraftBukkit end - pointer.level().gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, pointer.pos()); - return stack; -@@ -164,7 +165,7 @@ public interface DispenseItemBehavior { - ServerLevel worldserver = pointer.level(); - - // CraftBukkit start -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -174,12 +175,13 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -196,7 +198,7 @@ public interface DispenseItemBehavior { - ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false); - - if (entityarmorstand != null) { -- // itemstack.shrink(1); // CraftBukkit - Handled during event processing -+ if (shrink) stack.shrink(1); // Paper - actually handle here - } - - return stack; -@@ -216,7 +218,7 @@ public interface DispenseItemBehavior { - - if (!list.isEmpty()) { - // CraftBukkit start -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - ServerLevel world = pointer.level(); - org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -@@ -227,12 +229,13 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -243,6 +246,7 @@ public interface DispenseItemBehavior { - } - ((Saddleable) list.get(0)).equipSaddle(itemstack1, SoundSource.BLOCKS); - // CraftBukkit end -+ if (shrink) stack.shrink(1); // Paper - actually handle here - this.setSuccess(true); - return stack; - } else { -@@ -270,7 +274,7 @@ public interface DispenseItemBehavior { - } while (!entityhorseabstract.isBodyArmorItem(stack) || entityhorseabstract.isWearingBodyArmor() || !entityhorseabstract.isTamed()); - - // CraftBukkit start -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - ServerLevel world = pointer.level(); - org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -@@ -281,12 +285,13 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -296,6 +301,7 @@ public interface DispenseItemBehavior { - } - } - -+ if (shrink) stack.shrink(1); // Paper - shrink here - entityhorseabstract.setBodyArmorItem(CraftItemStack.asNMSCopy(event.getItem())); - // CraftBukkit end - this.setSuccess(true); -@@ -342,7 +348,7 @@ public interface DispenseItemBehavior { - entityhorsechestedabstract = (AbstractChestedHorse) iterator1.next(); - // CraftBukkit start - } while (!entityhorsechestedabstract.isTamed()); -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below - ServerLevel world = pointer.level(); - org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -@@ -353,10 +359,13 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -+ // stack.grow(1); // Paper - shrink below (this was actually missing and should be here, added it commented out to be consistent) - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -368,7 +377,7 @@ public interface DispenseItemBehavior { - entityhorsechestedabstract.getSlot(499).set(CraftItemStack.asNMSCopy(event.getItem())); - // CraftBukkit end - -- // itemstack.shrink(1); // CraftBukkit - handled above -+ if (shrink) stack.shrink(1); // Paper - actually handle here - this.setSuccess(true); - return stack; - } -@@ -413,7 +422,7 @@ public interface DispenseItemBehavior { - if (willEmptyContentsSolidBucketItem || willEmptyBucketItem) { - // Paper end - correctly check if the bucket place will succeed - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); - if (!DispenserBlock.eventFired) { -@@ -475,7 +484,7 @@ public interface DispenseItemBehavior { - - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); - if (!DispenserBlock.eventFired) { -@@ -513,7 +522,7 @@ public interface DispenseItemBehavior { - - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); - if (!DispenserBlock.eventFired) { -@@ -575,7 +584,7 @@ public interface DispenseItemBehavior { - BlockPos blockposition = pointer.pos().relative((Direction) pointer.state().getValue(DispenserBlock.FACING)); - // CraftBukkit start - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); - if (!DispenserBlock.eventFired) { -@@ -641,7 +650,7 @@ public interface DispenseItemBehavior { - // CraftBukkit start - // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); - -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink at end and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -651,12 +660,13 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -672,7 +682,7 @@ public interface DispenseItemBehavior { - worldserver.addFreshEntity(entitytntprimed); - worldserver.playSound((Player) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); - worldserver.gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, blockposition); -- // itemstack.shrink(1); // CraftBukkit - handled above -+ if (shrink) stack.shrink(1); // Paper - actually handle here - return stack; - } - }); -@@ -699,7 +709,7 @@ public interface DispenseItemBehavior { - - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); - if (!DispenserBlock.eventFired) { -@@ -748,7 +758,7 @@ public interface DispenseItemBehavior { - - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); - if (!DispenserBlock.eventFired) { -@@ -810,7 +820,7 @@ public interface DispenseItemBehavior { - - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - only single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); - if (!DispenserBlock.eventFired) { -diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -index 1b1c54ce8f187b968352d4aad05821ece182e20b..985954030654d521291cccbfc3ca49b67ee4357d 100644 ---- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java -@@ -40,7 +40,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - - // CraftBukkit start - // this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -50,12 +50,13 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -69,7 +70,7 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { - ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); - // CraftBukkit end - worldserver.addFreshEntity(iprojectile); -- // itemstack.shrink(1); // CraftBukkit - Handled during event processing -+ if (shrink) stack.shrink(1); // Paper - actually handle here - return stack; - } - -diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -index 445560d94086452ca4fbaf7792ff2b04c3ed3b73..f32f8d5cb22feb885a53d3b56c04ad4219d2bafa 100644 ---- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java -@@ -38,7 +38,7 @@ public class ShearsDispenseItemBehavior extends OptionalDispenseItemBehavior { - ServerLevel worldserver = pointer.level(); - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(worldserver, pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); // Paper - ignore stack size on damageable items - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); - if (!DispenserBlock.eventFired) { -diff --git a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -index f84987c36a16df19286d6f1badfb1ffb9cc7e770..6f2adf2334e35e8a617a4ced0c1af2abf32bbd8d 100644 ---- a/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/ShulkerBoxDispenseBehavior.java -@@ -34,7 +34,7 @@ public class ShulkerBoxDispenseBehavior extends OptionalDispenseItemBehavior { - - // CraftBukkit start - org.bukkit.block.Block bukkitBlock = CraftBlock.at(pointer.level(), pointer.pos()); -- CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack.copyWithCount(1)); // Paper - single item in event - - BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); - if (!DispenserBlock.eventFired) { -diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java -index d481ec2eace5fca7f80f6d9254121afd680e7309..fb518f87cc4ccd810fb32cade2fdd7e09ab0abfc 100644 ---- a/src/main/java/net/minecraft/world/item/ArmorItem.java -+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java -@@ -55,7 +55,7 @@ public class ArmorItem extends Item implements Equipable { - } else { - LivingEntity entityliving = (LivingEntity) list.get(0); - EquipmentSlot enumitemslot = entityliving.getEquipmentSlotForItem(armor); -- ItemStack itemstack1 = armor.split(1); -+ ItemStack itemstack1 = armor.copyWithCount(1); // Paper - shrink below and single item in event - // CraftBukkit start - Level world = pointer.level(); - org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); -@@ -67,12 +67,13 @@ public class ArmorItem extends Item implements Equipable { - } - - if (event.isCancelled()) { -- armor.grow(1); -+ // armor.grow(1); // Paper - shrink below - return false; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- armor.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -89,6 +90,7 @@ public class ArmorItem extends Item implements Equipable { - ((Mob) entityliving).setPersistenceRequired(); - } - -+ if (shrink) armor.shrink(1); // Paper - return true; - } - } -diff --git a/src/main/java/net/minecraft/world/item/MinecartItem.java b/src/main/java/net/minecraft/world/item/MinecartItem.java -index 727319e86aa77b5a67b4c4f03b1e9aba9fe6bcde..66074445d3908b9bb1c8d70e1e27d057720ec8e5 100644 ---- a/src/main/java/net/minecraft/world/item/MinecartItem.java -+++ b/src/main/java/net/minecraft/world/item/MinecartItem.java -@@ -66,7 +66,7 @@ public class MinecartItem extends Item { - - // CraftBukkit start - // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type); -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - org.bukkit.block.Block block2 = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -76,12 +76,13 @@ public class MinecartItem extends Item { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -94,8 +95,7 @@ public class MinecartItem extends Item { - itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); - AbstractMinecart entityminecartabstract = AbstractMinecart.createMinecart(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((MinecartItem) itemstack1.getItem()).type, itemstack1, (Player) null); - -- if (!worldserver.addFreshEntity(entityminecartabstract)) stack.grow(1); -- // itemstack.shrink(1); // CraftBukkit - handled during event processing -+ if (worldserver.addFreshEntity(entityminecartabstract) && shrink) stack.shrink(1); // Paper - actually handle here - // CraftBukkit end - return stack; - } diff --git a/patches/unapplied/server/0778-Add-BlockLockCheckEvent.patch b/patches/unapplied/server/0778-Add-BlockLockCheckEvent.patch deleted file mode 100644 index 31fba739ae..0000000000 --- a/patches/unapplied/server/0778-Add-BlockLockCheckEvent.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Sat, 21 May 2022 20:59:45 -0700 -Subject: [PATCH] Add BlockLockCheckEvent - - -diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..2ddf349fde5b310ec3f74baee1f3d33e09d5286c 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -@@ -73,17 +73,44 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co - protected abstract Component getDefaultName(); - - public boolean canOpen(Player player) { -- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()); -+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this); // Paper - Add BlockLockCheckEvent - } - -+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Add BlockLockCheckEvent - public static boolean canUnlock(Player player, LockCode lock, Component containerName) { -+ // Paper start - Add BlockLockCheckEvent -+ return canUnlock(player, lock, containerName, null); -+ } -+ public static boolean canUnlock(Player player, LockCode lock, Component containerName, @Nullable BlockEntity blockEntity) { -+ if (player instanceof net.minecraft.server.level.ServerPlayer serverPlayer && blockEntity != null && blockEntity.getLevel() != null && blockEntity.getLevel().getBlockEntity(blockEntity.getBlockPos()) == blockEntity) { -+ final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); -+ net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(containerName)); -+ net.kyori.adventure.sound.Sound lockedSound = net.kyori.adventure.sound.Sound.sound(org.bukkit.Sound.BLOCK_CHEST_LOCKED, net.kyori.adventure.sound.Sound.Source.BLOCK, 1.0F, 1.0F); -+ final io.papermc.paper.event.block.BlockLockCheckEvent event = new io.papermc.paper.event.block.BlockLockCheckEvent(block, serverPlayer.getBukkitEntity(), lockedMessage, lockedSound); -+ event.callEvent(); -+ if (event.getResult() == org.bukkit.event.Event.Result.ALLOW) { -+ return true; -+ } else if (event.getResult() == org.bukkit.event.Event.Result.DENY || (!player.isSpectator() && !lock.unlocksWith(event.isUsingCustomKeyItemStack() ? org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getKeyItem()) : player.getMainHandItem()))) { -+ if (event.getLockedMessage() != null) { -+ event.getPlayer().sendActionBar(event.getLockedMessage()); -+ } -+ if (event.getLockedSound() != null) { -+ event.getPlayer().playSound(event.getLockedSound()); -+ } -+ return false; -+ } else { -+ return true; -+ } -+ } else { // logic below is replaced by logic above -+ // Paper end - Add BlockLockCheckEvent - if (!player.isSpectator() && !lock.unlocksWith(player.getMainHandItem())) { -- player.displayClientMessage(Component.translatable("container.isLocked", containerName), true); -+ player.displayClientMessage(Component.translatable("container.isLocked", containerName), true); // Paper - diff on change - player.playNotifySound(SoundEvents.CHEST_LOCKED, SoundSource.BLOCKS, 1.0F, 1.0F); - return false; - } else { - return true; - } -+ } // Paper - Add BlockLockCheckEvent - } - - protected abstract NonNullList<ItemStack> getItems(); -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 f8d432ef21e59796da4b11c9748ba151c54e5e04..b6633ca1ee73ef0f8a220992a2e0424e67dd9758 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 -@@ -472,7 +472,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name - @Nullable - @Override - public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory, Player player) { -- return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName()) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null; -+ return BaseContainerBlockEntity.canUnlock(player, this.lockKey, this.getDisplayName(), this) ? new BeaconMenu(syncId, playerInventory, this.dataAccess, ContainerLevelAccess.create(this.level, this.getBlockPos())) : null; // Paper - Add BlockLockCheckEvent - } - - @Override diff --git a/patches/unapplied/server/0779-Add-Sneaking-API-for-Entities.patch b/patches/unapplied/server/0779-Add-Sneaking-API-for-Entities.patch deleted file mode 100644 index aaee22c056..0000000000 --- a/patches/unapplied/server/0779-Add-Sneaking-API-for-Entities.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: dawon <[email protected]> -Date: Wed, 19 Oct 2022 23:31:53 +0200 -Subject: [PATCH] Add Sneaking API for Entities - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index f950102a324d07aeba260bfa82fe88728f2362e5..ac513d3162a0794f226abc80bff21c799fe5802c 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -874,6 +874,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - return Pose.values()[this.getHandle().getPose().ordinal()]; - } - -+ // Paper start -+ @Override -+ public void setSneaking(boolean sneak) { -+ this.getHandle().setShiftKeyDown(sneak); -+ } -+ -+ @Override -+ public boolean isSneaking() { -+ return this.getHandle().isShiftKeyDown(); -+ } -+ // Paper end -+ - @Override - public SpawnCategory getSpawnCategory() { - return CraftSpawnCategory.toBukkit(this.getHandle().getType().getCategory()); diff --git a/patches/unapplied/server/0780-Improve-logging-and-errors.patch b/patches/unapplied/server/0780-Improve-logging-and-errors.patch deleted file mode 100644 index d2ccc7abed..0000000000 --- a/patches/unapplied/server/0780-Improve-logging-and-errors.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Wed, 14 Dec 2022 15:52:11 -0800 -Subject: [PATCH] Improve logging and errors - -Co-authored-by: Jason Penilla <[email protected]> - -diff --git a/src/main/java/net/minecraft/advancements/AdvancementTree.java b/src/main/java/net/minecraft/advancements/AdvancementTree.java -index 2665170b8391a77d6b3fb7ae7b5ccfc0be65acd7..e00d4e0896c0163c43d79af63338de67c7cb0dc4 100644 ---- a/src/main/java/net/minecraft/advancements/AdvancementTree.java -+++ b/src/main/java/net/minecraft/advancements/AdvancementTree.java -@@ -35,7 +35,7 @@ public class AdvancementTree { - this.remove(advancementnode1); - } - -- AdvancementTree.LOGGER.info("Forgot about advancement {}", advancement.holder()); -+ AdvancementTree.LOGGER.debug("Forgot about advancement {}", advancement.holder()); // Paper - Improve logging and errors - this.nodes.remove(advancement.holder().id()); - if (advancement.parent() == null) { - this.roots.remove(advancement); -@@ -77,7 +77,7 @@ public class AdvancementTree { - } - } - -- // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload -+ // AdvancementTree.LOGGER.info("Loaded {} advancements", this.nodes.size()); // CraftBukkit - moved to AdvancementDataWorld#reload // Paper - Improve logging and errors; you say it was moved... but it wasn't :) it should be moved however, since this is called when the API creates an advancement - } - - private boolean tryInsert(AdvancementHolder advancement) { -diff --git a/src/main/java/net/minecraft/server/ServerAdvancementManager.java b/src/main/java/net/minecraft/server/ServerAdvancementManager.java -index 3255578c8c37d977bb6e89d27194a4dbff822014..2172e23b22b411fe79e930128bd43ac07becb620 100644 ---- a/src/main/java/net/minecraft/server/ServerAdvancementManager.java -+++ b/src/main/java/net/minecraft/server/ServerAdvancementManager.java -@@ -69,6 +69,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener { - AdvancementTree advancementtree = new AdvancementTree(); - - advancementtree.addAll(this.advancements.values()); -+ LOGGER.info("Loaded {} advancements", advancementtree.nodes().size()); // Paper - Improve logging and errors; moved from AdvancementTree#addAll - Iterator iterator = advancementtree.roots().iterator(); - - while (iterator.hasNext()) { -diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index aa39bdb0a4ba8fedf5052ea9700afa7d4d2a4300..b4af03c4bdd1ce0861f36c3b75fc7e89d701c46a 100644 ---- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -@@ -282,6 +282,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface - DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); - DedicatedServer.LOGGER.warn("The exception was: {}", ioexception.toString()); - DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); -+ if (true) throw new IllegalStateException("Failed to bind to port", ioexception); // Paper - Propagate failed to bind to port error - return false; - } - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 28808ffc6e486f7dc01be370c9eb249dc1f7ea46..6b869ff834af1e02f55683b3399d40bee0518bf1 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3398,7 +3398,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - - this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); - } catch (ProfilePublicKey.ValidationException profilepublickey_b) { -- ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); -+ // ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); // Paper - Improve logging and errors - this.disconnect(profilepublickey_b.getComponent(), profilepublickey_b.kickCause); // Paper - kick event causes - } - -diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java -index ed1d3d30404dfc6303e746f31295b6b1aa40f204..8d7565eda4536e8aa42dd3dcbcfac38cbf16020a 100644 ---- a/src/main/java/net/minecraft/server/packs/PathPackResources.java -+++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java -@@ -103,6 +103,12 @@ public class PathPackResources extends AbstractPackResources { - try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) { - for (Path path2 : directoryStream) { - String string = path2.getFileName().toString(); -+ // Paper start - Improve logging and errors -+ if (!Files.isDirectory(path2)) { -+ LOGGER.error("Invalid directory entry: {} in {}.", string, this.root, new java.nio.file.NotDirectoryException(string)); -+ continue; -+ } -+ // Paper end - Improve logging and errors - if (ResourceLocation.isValidNamespace(string)) { - set.add(string); - } else { -diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -index 3270bb6fe1c8b08411e6cad14d48cec886085ee7..407f3c1938b5b5d893b09705fe4930dbdafa3c8e 100644 ---- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -+++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java -@@ -79,7 +79,7 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - this.byType = LinkedHashMultimap.create(builder.build()); - this.byName = Maps.newHashMap(com_google_common_collect_immutablemap_builder.build()); - // CraftBukkit end -- RecipeManager.LOGGER.info("Loaded {} recipes", this.byType.size()); -+ RecipeManager.LOGGER.info("Loaded {} recipes", this.byName.size()); // Paper - Improve logging and errors; log correct number of recipes - } - - // CraftBukkit start -diff --git a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java -index b2812cc8d35074fdcff88beef088d9f63ebbe1a8..dc591702d1ad41209bb80e8d05f4ca11f20816f2 100644 ---- a/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java -+++ b/src/main/java/org/bukkit/craftbukkit/legacy/CraftLegacy.java -@@ -44,6 +44,7 @@ import org.bukkit.material.MaterialData; - */ - @Deprecated - public final class CraftLegacy { -+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper - Improve logging and errors - - private static final Map<Byte, Material> SPAWN_EGGS = new HashMap<>(); - private static final Set<String> whitelistedStates = new HashSet<>(Arrays.asList("explode", "check_decay", "decayable", "facing")); -@@ -264,7 +265,7 @@ public final class CraftLegacy { - } - - static { -- System.err.println("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); -+ LOGGER.warn("Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!"); // Paper - Improve logging and errors; doesn't need to be an error - if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDebugging()) { - new Exception().printStackTrace(); - } diff --git a/patches/unapplied/server/0781-Improve-PortalEvents.patch b/patches/unapplied/server/0781-Improve-PortalEvents.patch deleted file mode 100644 index 641c38d3db..0000000000 --- a/patches/unapplied/server/0781-Improve-PortalEvents.patch +++ /dev/null @@ -1,118 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Thu, 15 Dec 2022 10:33:39 -0800 -Subject: [PATCH] Improve PortalEvents - - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 96dff63230e8cda1f5e548d914c119bd64b5ac33..7270b6fa96bae937663c0fea77887e21fbd0eb57 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -1340,7 +1340,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { - } - // CraftBukkit start - Location enter = this.getBukkitEntity().getLocation(); -- Location exit = (worldserver == null) ? null : CraftLocation.toBukkit(teleportTarget.pos(), worldserver.getWorld(), teleportTarget.yRot(), teleportTarget.xRot()); -+ Location exit =/* (worldserver == null) ? null : // Paper - always non-null */CraftLocation.toBukkit(teleportTarget.pos(), worldserver.getWorld(), teleportTarget.yRot(), teleportTarget.xRot()); - PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, teleportTarget.cause()); - Bukkit.getServer().getPluginManager().callEvent(tpEvent); - if (tpEvent.isCancelled() || tpEvent.getTo() == null) { -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d5df4ddb33600479e6edb93a18db9400ffc6c699..9958be86d769b9fd17b6d24d0c4f1e96b65dfb08 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -3529,7 +3529,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); - Location enter = bukkitEntity.getLocation(); - -- EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius); -+ // Paper start -+ final org.bukkit.PortalType portalType = switch (cause) { -+ case END_PORTAL -> org.bukkit.PortalType.ENDER; -+ case NETHER_PORTAL -> org.bukkit.PortalType.NETHER; -+ case END_GATEWAY -> org.bukkit.PortalType.END_GATEWAY; // not actually used yet -+ default -> org.bukkit.PortalType.CUSTOM; -+ }; -+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius, true, creationRadius, portalType); -+ // Paper end - event.getEntity().getServer().getPluginManager().callEvent(event); - if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !entity.isAlive()) { - return null; -diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -index 11486419dd98a013c7387d3d73f322a95a18c574..3f5bb5c9ceb5b31fcc9ef0a7a6157e1e1cb2a09f 100644 ---- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java -@@ -92,6 +92,10 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal { - protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { - if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (entity.canUsePortal(false)) { -+ // Paper start - call EntityPortalEnterEvent -+ org.bukkit.event.entity.EntityPortalEnterEvent event = new org.bukkit.event.entity.EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.END_GATEWAY); // Paper - add portal type -+ if (!event.callEvent()) return; -+ // Paper end - call EntityPortalEnterEvent - BlockEntity tileentity = world.getBlockEntity(pos); - - if (!world.isClientSide && tileentity instanceof TheEndGatewayBlockEntity) { -diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -index 28fba1448309805fc3d687de6bc8454d2c85fcd3..a35a426cc7778a51523f26057b5d61b8a3e23d5d 100644 ---- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java -@@ -66,8 +66,9 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { - if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (entity.canUsePortal(false) && Shapes.joinIsNotEmpty(Shapes.create(entity.getBoundingBox().move((double) (-pos.getX()), (double) (-pos.getY()), (double) (-pos.getZ()))), state.getShape(world, pos), BooleanOp.AND)) { - // CraftBukkit start - Entity in portal -- EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); -+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.ENDER); // Paper - add portal type - world.getCraftServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) return; // Paper - make cancellable - // CraftBukkit end - if (!world.isClientSide && world.dimension() == Level.END && entity instanceof ServerPlayer) { - ServerPlayer entityplayer = (ServerPlayer) entity; -@@ -90,7 +91,7 @@ public class EndPortalBlock extends BaseEntityBlock implements Portal { - ServerLevel worldserver1 = world.getServer().getLevel(resourcekey); - - if (worldserver1 == null) { -- return new DimensionTransition(PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit- always fire event in case plugins wish to change it -+ return null; // Paper - keep previous behavior of not firing PlayerTeleportEvent if the target world doesn't exist - } else { - boolean flag = resourcekey == Level.END; - BlockPos blockposition1 = flag ? ServerLevel.END_SPAWN_POINT : worldserver1.getSharedSpawnPos(); -diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index 417a9ab28d247d5fbb3f1097fdeccab7ad2a793b..0fdbcab175b51a8b77646e0e4a267d987b133a35 100644 ---- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -@@ -110,8 +110,9 @@ public class NetherPortalBlock extends Block implements Portal { - if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - if (entity.canUsePortal(false)) { - // CraftBukkit start - Entity in portal -- EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); -+ EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()), org.bukkit.PortalType.NETHER); // Paper - add portal type - world.getCraftServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) return; // Paper - make cancellable - // CraftBukkit end - entity.setAsInsidePortal(this, pos); - } -@@ -143,7 +144,7 @@ public class NetherPortalBlock extends Block implements Portal { - // Paper end - Add EntityPortalReadyEvent - - if (worldserver1 == null) { -- return new DimensionTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it -+ return null; // Paper - keep previous behavior of not firing PlayerTeleportEvent if the target world doesn't exist - } else { - boolean flag = worldserver1.getTypeKey() == LevelStem.NETHER; - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java -index 788f79dc38012595b385ee6a449daa0bccf0079a..36c8735312c885eb153f4ffdf0f2a5495e9c9f65 100644 ---- a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java -+++ b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java -@@ -15,9 +15,7 @@ public record DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, fl - this(newLevel, pos, speed, yRot, xRot, missingRespawnBlock, postDimensionTransition, PlayerTeleportEvent.TeleportCause.UNKNOWN); - } - -- public DimensionTransition(PlayerTeleportEvent.TeleportCause cause) { -- this(null, Vec3.ZERO, Vec3.ZERO, 0.0F, 0.0F, false, DO_NOTHING, cause); -- } -+ // Paper - remove unused constructor (for safety) - // CraftBukkit end - - public static final DimensionTransition.PostDimensionTransition DO_NOTHING = (entity) -> { diff --git a/patches/unapplied/server/0782-Add-config-option-for-spider-worldborder-climbing.patch b/patches/unapplied/server/0782-Add-config-option-for-spider-worldborder-climbing.patch deleted file mode 100644 index 71e3939753..0000000000 --- a/patches/unapplied/server/0782-Add-config-option-for-spider-worldborder-climbing.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath <[email protected]> -Date: Thu, 27 Oct 2022 15:35:47 +0200 -Subject: [PATCH] Add config option for spider worldborder climbing - - -diff --git a/src/main/java/net/minecraft/world/entity/monster/Spider.java b/src/main/java/net/minecraft/world/entity/monster/Spider.java -index c80019f0c9f814c5259b4d3ec2d8a85669dc728f..f91ea9ac5a0d0d3bae5d1eb0c409f4f9c4e5a62b 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Spider.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Spider.java -@@ -82,7 +82,7 @@ public class Spider extends Monster { - public void tick() { - super.tick(); - if (!this.level().isClientSide) { -- this.setClimbing(this.horizontalCollision); -+ this.setClimbing(this.horizontalCollision && (this.level().paperConfig().entities.behavior.allowSpiderWorldBorderClimbing || !(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.isCollidingWithBorder(this.level().getWorldBorder(), this.getBoundingBox().inflate(ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_EPSILON)) && this.level().getWorldBorder().isInsideCloseToBorder(this, this.getBoundingBox())))); // Paper - Add config option for spider worldborder climbing (Inflate by +EPSILON as collision will just barely place us outside border) - } - - } diff --git a/patches/unapplied/server/0783-Add-missing-SpigotConfig-logCommands-check.patch b/patches/unapplied/server/0783-Add-missing-SpigotConfig-logCommands-check.patch deleted file mode 100644 index 9c86e0000a..0000000000 --- a/patches/unapplied/server/0783-Add-missing-SpigotConfig-logCommands-check.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NonSwag <[email protected]> -Date: Thu, 8 Dec 2022 20:25:05 +0100 -Subject: [PATCH] Add missing SpigotConfig logCommands check - -Co-authored-by: david <[email protected]> - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 6b869ff834af1e02f55683b3399d40bee0518bf1..a2a7d499a68841ecd76ba029298094993a82bf39 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2057,7 +2057,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - private void performUnsignedChatCommand(String command) { - // CraftBukkit start - String command1 = "/" + command; -+ if (org.spigotmc.SpigotConfig.logCommands) { // Paper - Add missing SpigotConfig logCommands check - ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command1); -+ } - - PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command1, new LazyPlayerSet(this.server)); - this.cserver.getPluginManager().callEvent(event); -@@ -2097,7 +2099,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - private void performSignedChatCommand(ServerboundChatCommandSignedPacket packet, LastSeenMessages lastSeenMessages) { - // CraftBukkit start - String command = "/" + packet.command(); -+ if (org.spigotmc.SpigotConfig.logCommands) { // Paper - Add missing SpigotConfig logCommands check - ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command); -+ } // Paper - Add missing SpigotConfig logCommands check - - PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command, new LazyPlayerSet(this.server)); - this.cserver.getPluginManager().callEvent(event); diff --git a/patches/unapplied/server/0784-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch b/patches/unapplied/server/0784-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch deleted file mode 100644 index 581ad00ec1..0000000000 --- a/patches/unapplied/server/0784-Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NonSwag <[email protected]> -Date: Tue, 6 Dec 2022 23:04:21 +0100 -Subject: [PATCH] Fix NPE on Allay#stopDancing while not dancing - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java -index 1d04df8752af74ae73231922041d09df9d7492bb..c64918175ec08d20cde2bda9e0cac8b474385fe0 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAllay.java -@@ -78,7 +78,7 @@ public class CraftAllay extends CraftCreature implements org.bukkit.entity.Allay - public void stopDancing() { - this.getHandle().forceDancing = false; - this.getHandle().jukeboxPos = null; -- this.getHandle().setJukeboxPlaying(null, false); -+ this.getHandle().setDancing(false); // Paper - Directly modify set dancing to avoid NPE - } - - @Override diff --git a/patches/unapplied/server/0785-Flying-Fall-Damage.patch b/patches/unapplied/server/0785-Flying-Fall-Damage.patch deleted file mode 100644 index cee20a07da..0000000000 --- a/patches/unapplied/server/0785-Flying-Fall-Damage.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: TreyRuffy <[email protected]> -Date: Fri, 27 May 2022 02:26:08 -0600 -Subject: [PATCH] Flying Fall Damage - - -diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index ad334f149fe1b44d4ebe48489dcd2811ff1b5cd0..950ce40d268d89ff3c503116081db6c9ccd65329 100644 ---- a/src/main/java/net/minecraft/world/entity/player/Player.java -+++ b/src/main/java/net/minecraft/world/entity/player/Player.java -@@ -196,6 +196,7 @@ public abstract class Player extends LivingEntity { - private boolean ignoreFallDamageFromCurrentImpulse; - private int currentImpulseContextResetGraceTime; - public boolean affectsSpawning = true; // Paper - Affects Spawning API -+ public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage - - // CraftBukkit start - public boolean fauxSleeping; -@@ -1693,7 +1694,7 @@ public abstract class Player extends LivingEntity { - - @Override - public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) { -- if (this.abilities.mayfly) { -+ if (this.abilities.mayfly && !this.flyingFallDamage.toBooleanOrElse(false)) { // Paper - flying fall damage - return false; - } else { - if (fallDistance >= 2.0F) { -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 111b90f97f631369acfb76278da26de94a4740bf..fdf6c3f1f8f79dd20e1363ef472f97fe98c9799e 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2581,6 +2581,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - this.getHandle().onUpdateAbilities(); - } - -+ // Paper start - flying fall damage -+ @Override -+ public void setFlyingFallDamage(@NotNull net.kyori.adventure.util.TriState flyingFallDamage) { -+ getHandle().flyingFallDamage = flyingFallDamage; -+ } -+ -+ @NotNull -+ @Override -+ public net.kyori.adventure.util.TriState hasFlyingFallDamage() { -+ return getHandle().flyingFallDamage; -+ } -+ // Paper end - flying fall damage -+ - @Override - public int getNoDamageTicks() { - if (this.getHandle().spawnInvulnerableTime > 0) { diff --git a/patches/unapplied/server/0786-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/unapplied/server/0786-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch deleted file mode 100644 index 80118a6499..0000000000 --- a/patches/unapplied/server/0786-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: SoSeDiK <[email protected]> -Date: Tue, 11 Oct 2022 23:30:32 +0300 -Subject: [PATCH] Expose pre-collision moving velocity to - VehicleBlockCollisionEvent - - -diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 303f3656be5e9049cd195030c457df9a7c718b66..34e175b28f7c9120b58fc8e2b65ca978c7f301b5 100644 ---- a/src/main/java/net/minecraft/world/entity/Entity.java -+++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -942,6 +942,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - public void move(MoverType movementType, Vec3 movement) { -+ final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity - if (this.noPhysics) { - this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); - } else { -@@ -1026,7 +1027,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - if (!bl.getType().isAir()) { -- VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl); -+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl, org.bukkit.craftbukkit.util.CraftVector.toBukkit(originalMovement)); // Paper - Expose pre-collision velocity - this.level.getCraftServer().getPluginManager().callEvent(event); - } - } diff --git a/patches/unapplied/server/0787-config-for-disabling-entity-tag-tags.patch b/patches/unapplied/server/0787-config-for-disabling-entity-tag-tags.patch deleted file mode 100644 index aabc1e1a31..0000000000 --- a/patches/unapplied/server/0787-config-for-disabling-entity-tag-tags.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Wed, 15 Sep 2021 14:52:42 -0700 -Subject: [PATCH] config for disabling entity tag tags - - -diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java -index c0062c8f83641ff30e79a309c0bb9930ba4b422a..5fb3279342506611882b5780cfbee0371919c93c 100644 ---- a/src/main/java/net/minecraft/world/entity/EntityType.java -+++ b/src/main/java/net/minecraft/world/entity/EntityType.java -@@ -502,6 +502,16 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT - - if (minecraftserver != null && entity != null) { - if (world.isClientSide || !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) { -+ // Paper start - filter out protected tags -+ if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { -+ nbt = nbt.update((compound) -> { -+ for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { -+ tag.remove(compound); -+ } -+ }); -+ } -+ // Paper end - filter out protected tags -+ - nbt.loadInto(entity); - } - } diff --git a/patches/unapplied/server/0788-Use-single-player-info-update-packet-on-join.patch b/patches/unapplied/server/0788-Use-single-player-info-update-packet-on-join.patch deleted file mode 100644 index bbf8785310..0000000000 --- a/patches/unapplied/server/0788-Use-single-player-info-update-packet-on-join.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic <[email protected]> -Date: Sun, 8 Jan 2023 17:38:28 -0800 -Subject: [PATCH] Use single player info update packet on join - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a2a7d499a68841ecd76ba029298094993a82bf39..a6f58438badb0bdeab67706f4a8e519b202623fe 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3436,7 +3436,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); - this.chatMessageChain.append(() -> { - this.player.setChatSession(session); -- this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player))); -+ this.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT), List.of(this.player)), this.player); // Paper - Use single player info update packet on join - }); - } - -diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 38b9ab369e25e4b718418375f76e782283b48411..bd67245393f512264db774e0b855db0ce925a3f4 100644 ---- a/src/main/java/net/minecraft/server/players/PlayerList.java -+++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -361,6 +361,7 @@ public abstract class PlayerList { - // CraftBukkit start - sendAll above replaced with this loop - ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player)); - -+ final List<ServerPlayer> onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - Use single player info update packet on join - for (int i = 0; i < this.players.size(); ++i) { - ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i); - -@@ -368,12 +369,17 @@ public abstract class PlayerList { - entityplayer1.connection.send(packet); - } - -- if (!bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { -+ if (entityplayer1 == player || !bukkitPlayer.canSee(entityplayer1.getBukkitEntity())) { // Paper - Use single player info update packet on join; Don't include joining player - continue; - } - -- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1))); -+ onlinePlayers.add(entityplayer1); // Paper - Use single player info update packet on join - } -+ // Paper start - Use single player info update packet on join -+ if (!onlinePlayers.isEmpty()) { -+ player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers)); -+ } -+ // Paper end - Use single player info update packet on join - player.sentListPacket = true; - player.supressTrackerForLogin = false; // Paper - Fire PlayerJoinEvent when Player is actually ready - ((ServerLevel)player.level()).getChunkSource().chunkMap.addEntity(player); // Paper - Fire PlayerJoinEvent when Player is actually ready; track entity now diff --git a/patches/unapplied/server/0789-Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/unapplied/server/0789-Correctly-shrink-items-during-EntityResurrectEvent.patch deleted file mode 100644 index e7b31c3642..0000000000 --- a/patches/unapplied/server/0789-Correctly-shrink-items-during-EntityResurrectEvent.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Bjarne Koll <[email protected]> -Date: Tue, 10 Jan 2023 21:06:42 +0100 -Subject: [PATCH] Correctly shrink items during EntityResurrectEvent - -The EntityResurrectEvent logic is supposed to locate a totem of undying -in any of the interaction slots of the player inventory and then, if the -called EntityResurrectEvent is not cancelled, shrink that item by 1, -usually reducing it to zero. - -For this, the logic iterates over the items in the interaction slots and -breaks out the loop if a totem of undying was found. -However, even if no totem of undying was found, the iteration item stack -variable remains as a refernce to the last interaction slot probed. - -Plugins uncancelling a EntityResurrectEvent, which is published -pre-cancelled to listeners if no totem of undying could be found, -would hence cause the server logic to shrink completely unrelated items -found in, at the writing of this patch, the players off hand slot. - -This patch corrects this behaviour by only shrinking the item if a totem -of undying was found and the event was called uncancelled. - -diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2bb61084b628582ded44926d7697ee26d0bb1e8e..9e58a85a7de53b17fa149ae0b4951baa351d99db 100644 ---- a/src/main/java/net/minecraft/world/entity/LivingEntity.java -+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1632,7 +1632,7 @@ public abstract class LivingEntity extends Entity implements Attackable { - this.level().getCraftServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { -- if (!itemstack1.isEmpty()) { -+ if (!itemstack1.isEmpty() && itemstack != null) { // Paper - only reduce item if actual totem was found - itemstack1.shrink(1); - } - if (itemstack != null && this instanceof ServerPlayer) { diff --git a/patches/unapplied/server/0790-Win-Screen-API.patch b/patches/unapplied/server/0790-Win-Screen-API.patch deleted file mode 100644 index 567b2236d9..0000000000 --- a/patches/unapplied/server/0790-Win-Screen-API.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Lama06 <[email protected]> -Date: Sat, 21 Jan 2023 13:53:23 +0100 -Subject: [PATCH] Win Screen API - -== AT == -public net.minecraft.server.level.ServerPlayer seenCredits - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index fdf6c3f1f8f79dd20e1363ef472f97fe98c9799e..06a3ccb90f23fc357e5cbc6e9173baab4b218955 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1305,6 +1305,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - this.getHandle().connection.send(packet); - } - -+ // Paper start -+ @Override -+ public void showWinScreen() { -+ if (getHandle().connection == null) return; -+ var packet = new ClientboundGameEventPacket(ClientboundGameEventPacket.WIN_GAME, 1); -+ getHandle().connection.send(packet); -+ } -+ -+ @Override -+ public boolean hasSeenWinScreen() { -+ return getHandle().seenCredits; -+ } -+ -+ @Override -+ public void setHasSeenWinScreen(boolean hasSeenWinScreen) { -+ getHandle().seenCredits = hasSeenWinScreen; -+ } -+ // Paper end -+ - @Override - public void setRotation(float yaw, float pitch) { - // Paper start - Teleport API diff --git a/patches/unapplied/server/0791-Remove-CraftItemStack-setAmount-null-assignment.patch b/patches/unapplied/server/0791-Remove-CraftItemStack-setAmount-null-assignment.patch deleted file mode 100644 index 5b5c421ff2..0000000000 --- a/patches/unapplied/server/0791-Remove-CraftItemStack-setAmount-null-assignment.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Josh Roy <[email protected]> -Date: Mon, 23 Jan 2023 19:19:01 -0500 -Subject: [PATCH] Remove CraftItemStack#setAmount null assignment - -This creates a problem with Paper's item serialization -api where deserialized items, which are internally -created as a CraftItemStack, will be completely lost if -#setAmount(0) is invoked (since the underlying handle -is set to null), while a regular Bukkit ItemStack -simply sets the amount field to zero, retaining the -item's data. - -Vanilla treats items with zero amounts the same as items -with less than zero amounts, so this code doesn't create -a problem with operations on the vanilla ItemStack. - -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 08178a88ba7d0881a6c2843eef24a846cf07adb4..4d29c34e221b749b6972c7ed79ac1f86da999ed7 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -186,7 +186,7 @@ public final class CraftItemStack extends ItemStack { - } - - this.handle.setCount(amount); -- if (amount == 0) { -+ if (false && amount == 0) { // Paper - remove CraftItemStack#setAmount null assignment - this.handle = null; - } - } |