diff --git a/patches/unapplied/server/Add-ArmorStand-Item-Meta.patch b/patches/server/Add-ArmorStand-Item-Meta.patch similarity index 84% rename from patches/unapplied/server/Add-ArmorStand-Item-Meta.patch rename to patches/server/Add-ArmorStand-Item-Meta.patch index e83134d329..3091f124f1 100644 --- a/patches/unapplied/server/Add-ArmorStand-Item-Meta.patch +++ b/patches/server/Add-ArmorStand-Item-Meta.patch @@ -19,11 +19,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ import org.bukkit.Material; import org.bukkit.configuration.serialization.DelegateDeserialization; - @DelegateDeserialization(CraftMetaItem.SerializableMeta.class) + @DelegateDeserialization(SerializableMeta.class) -public class CraftMetaArmorStand extends CraftMetaItem { +public class CraftMetaArmorStand extends CraftMetaItem implements com.destroystokyo.paper.inventory.meta.ArmorStandMeta { // Paper - static final ItemMetaKey ENTITY_TAG = new ItemMetaKey("EntityTag", "entity-tag"); + static final ItemMetaKeyType ENTITY_TAG = new ItemMetaKeyType<>(DataComponents.ENTITY_DATA, "entity-tag"); + // Paper start + static final ItemMetaKey INVISIBLE = new ItemMetaKey("Invisible", "invisible"); + static final ItemMetaKey NO_BASE_PLATE = new ItemMetaKey("NoBasePlate", "no-base-plate"); @@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem { - if (tag.contains(CraftMetaArmorStand.ENTITY_TAG.NBT)) { - this.entityTag = tag.getCompound(CraftMetaArmorStand.ENTITY_TAG.NBT).copy(); + getOrEmpty(tag, CraftMetaArmorStand.ENTITY_TAG).ifPresent((nbt) -> { + this.entityTag = nbt.copyTag(); + // Paper start + if (entityTag.contains(INVISIBLE.NBT)) { + invisible = entityTag.getBoolean(INVISIBLE.NBT); @@ -79,7 +79,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + marker = entityTag.getBoolean(MARKER.NBT); + } + // Paper end - } + }); } CraftMetaArmorStand(Map map) { @@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem { - void applyToItem(CompoundTag tag) { + void applyToItem(CraftMetaItem.Applicator tag) { super.applyToItem(tag); + // Paper start @@ -124,7 +124,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end if (this.entityTag != null) { - tag.put(CraftMetaArmorStand.ENTITY_TAG.NBT, this.entityTag); + tag.put(CraftMetaArmorStand.ENTITY_TAG, CustomData.of(this.entityTag)); } @@ -0,0 +0,0 @@ public class CraftMetaArmorStand extends CraftMetaItem { } @@ -254,25 +254,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } -diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - CraftMetaCrossbow.CHARGED.NBT, - CraftMetaCrossbow.CHARGED_PROJECTILES.NBT, - CraftMetaSuspiciousStew.EFFECTS.NBT, -+ // Paper start -+ CraftMetaArmorStand.ENTITY_TAG.NBT, -+ CraftMetaArmorStand.INVISIBLE.NBT, -+ CraftMetaArmorStand.NO_BASE_PLATE.NBT, -+ CraftMetaArmorStand.SHOW_ARMS.NBT, -+ CraftMetaArmorStand.SMALL.NBT, -+ CraftMetaArmorStand.MARKER.NBT, -+ // Paper end - CraftMetaCompass.LODESTONE_DIMENSION.NBT, - CraftMetaCompass.LODESTONE_POS.NBT, - CraftMetaCompass.LODESTONE_TRACKED.NBT, diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java diff --git a/patches/unapplied/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch b/patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch similarity index 90% rename from patches/unapplied/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch rename to patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch index a277eeacae..6fabb6da6a 100644 --- a/patches/unapplied/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch +++ b/patches/server/Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch @@ -12,7 +12,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } } @@ -102,14 +102,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java @@ -0,0 +0,0 @@ public class SonicBoom extends Behavior { - target.hurt(world.damageSources().sonicBoom(entity), 10.0F); - double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); - double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); -- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); -+ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + if (target.hurt(world.damageSources().sonicBoom(entity), 10.0F)) { + double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); + double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); +- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); ++ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + } }); } - } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -183,14 +183,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - if (target instanceof LivingEntity) { - ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit - } else { -- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F)); -+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent - } + if (target instanceof LivingEntity) { + ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit + } else { +- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F)); ++ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + } - this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java diff --git a/patches/unapplied/server/Add-EntityTeleportEndGatewayEvent.patch b/patches/server/Add-EntityTeleportEndGatewayEvent.patch similarity index 100% rename from patches/unapplied/server/Add-EntityTeleportEndGatewayEvent.patch rename to patches/server/Add-EntityTeleportEndGatewayEvent.patch diff --git a/patches/unapplied/server/Add-PlayerAdvancementCriterionGrantEvent.patch b/patches/server/Add-PlayerAdvancementCriterionGrantEvent.patch similarity index 100% rename from patches/unapplied/server/Add-PlayerAdvancementCriterionGrantEvent.patch rename to patches/server/Add-PlayerAdvancementCriterionGrantEvent.patch diff --git a/patches/unapplied/server/Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch similarity index 100% rename from patches/unapplied/server/Add-config-to-disable-ender-dragon-legacy-check.patch rename to patches/server/Add-config-to-disable-ender-dragon-legacy-check.patch diff --git a/patches/unapplied/server/Add-more-fields-to-AsyncPreLoginEvent.patch b/patches/server/Add-more-fields-to-AsyncPreLoginEvent.patch similarity index 96% rename from patches/unapplied/server/Add-more-fields-to-AsyncPreLoginEvent.patch rename to patches/server/Add-more-fields-to-AsyncPreLoginEvent.patch index a57052ffb1..ffc0fac477 100644 --- a/patches/unapplied/server/Add-more-fields-to-AsyncPreLoginEvent.patch +++ b/patches/server/Add-more-fields-to-AsyncPreLoginEvent.patch @@ -39,11 +39,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 java.util.UUID uniqueId = gameprofile.getId(); final org.bukkit.craftbukkit.CraftServer server = ServerLoginPacketListenerImpl.this.server.server; -- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); +- AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, this.transferred); + // Paper start - Add more fields to AsyncPlayerPreLoginEvent + final InetAddress rawAddress = ((InetSocketAddress) this.connection.channel.remoteAddress()).getAddress(); + com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName); -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, this.connection.hostname); ++ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, this.transferred, profile, this.connection.hostname); server.getPluginManager().callEvent(asyncEvent); + profile = asyncEvent.getPlayerProfile(); + profile.complete(); diff --git a/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch b/patches/server/Add-openSign-method-to-HumanEntity.patch similarity index 100% rename from patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch rename to patches/server/Add-openSign-method-to-HumanEntity.patch diff --git a/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch b/patches/server/Block-Enderpearl-Travel-Exploit.patch similarity index 100% rename from patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch rename to patches/server/Block-Enderpearl-Travel-Exploit.patch diff --git a/patches/unapplied/server/Call-PaperServerListPingEvent-for-legacy-pings.patch b/patches/server/Call-PaperServerListPingEvent-for-legacy-pings.patch similarity index 100% rename from patches/unapplied/server/Call-PaperServerListPingEvent-for-legacy-pings.patch rename to patches/server/Call-PaperServerListPingEvent-for-legacy-pings.patch diff --git a/patches/unapplied/server/Configurable-LootPool-luck-formula.patch b/patches/server/Configurable-LootPool-luck-formula.patch similarity index 100% rename from patches/unapplied/server/Configurable-LootPool-luck-formula.patch rename to patches/server/Configurable-LootPool-luck-formula.patch diff --git a/patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch b/patches/server/Configurable-sprint-interruption-on-attack.patch similarity index 75% rename from patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch rename to patches/server/Configurable-sprint-interruption-on-attack.patch index caa8a4210b..3591ef99c5 100644 --- a/patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch +++ b/patches/server/Configurable-sprint-interruption-on-attack.patch @@ -10,15 +10,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - } + } - this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); -- this.setSprinting(false); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D)); + // Paper start - Configurable sprint interruption on attack + if (!this.level().paperConfig().misc.disableSprintInterruptionOnAttack) { -+ this.setSprinting(false); -+ } + this.setSprinting(false); + } + // Paper end - Configurable sprint interruption on attack - } ++ } - if (flag3) { + if (flag3) { + float f4 = 1.0F + EnchantmentHelper.getSweepingDamageRatio(this) * f; diff --git a/patches/unapplied/server/Disable-Explicit-Network-Manager-Flushing.patch b/patches/server/Disable-Explicit-Network-Manager-Flushing.patch similarity index 100% rename from patches/unapplied/server/Disable-Explicit-Network-Manager-Flushing.patch rename to patches/server/Disable-Explicit-Network-Manager-Flushing.patch diff --git a/patches/unapplied/server/EnderDragon-Events.patch b/patches/server/EnderDragon-Events.patch similarity index 100% rename from patches/unapplied/server/EnderDragon-Events.patch rename to patches/server/EnderDragon-Events.patch diff --git a/patches/unapplied/server/Enderman.teleportRandomly.patch b/patches/server/Enderman.teleportRandomly.patch similarity index 100% rename from patches/unapplied/server/Enderman.teleportRandomly.patch rename to patches/server/Enderman.teleportRandomly.patch diff --git a/patches/unapplied/server/EndermanAttackPlayerEvent.patch b/patches/server/EndermanAttackPlayerEvent.patch similarity index 100% rename from patches/unapplied/server/EndermanAttackPlayerEvent.patch rename to patches/server/EndermanAttackPlayerEvent.patch diff --git a/patches/unapplied/server/EndermanEscapeEvent.patch b/patches/server/EndermanEscapeEvent.patch similarity index 100% rename from patches/unapplied/server/EndermanEscapeEvent.patch rename to patches/server/EndermanEscapeEvent.patch diff --git a/patches/unapplied/server/Expand-Explosions-API.patch b/patches/server/Expand-Explosions-API.patch similarity index 79% rename from patches/unapplied/server/Expand-Explosions-API.patch rename to patches/server/Expand-Explosions-API.patch index 40d8483691..27001e63b4 100644 --- a/patches/unapplied/server/Expand-Explosions-API.patch +++ b/patches/server/Expand-Explosions-API.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World { - public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) { - return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? net.minecraft.world.level.Level.ExplosionInteraction.MOB : net.minecraft.world.level.Level.ExplosionInteraction.NONE).wasCanceled; + + return !this.world.explode(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, explosionType).wasCanceled; } + // Paper start + @Override diff --git a/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch similarity index 95% rename from patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch rename to patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch index fe1725e81d..146931d502 100644 --- a/patches/unapplied/server/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/server/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -42,12 +42,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { + // Paper start - Particle API -+ spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, force); ++ this.spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, force); + } + @Override + public void spawnParticle(Particle particle, List receivers, Player sender, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { + // Paper end - Particle API - particle = CraftParticle.convertLegacy(particle); data = CraftParticle.convertLegacy(data); if (data != null) { Preconditions.checkArgument(particle.getDataType().isInstance(data), "data (%s) should be %s", data.getClass(), particle.getDataType()); diff --git a/patches/unapplied/server/Extend-Player-Interact-cancellation.patch b/patches/server/Extend-Player-Interact-cancellation.patch similarity index 92% rename from patches/unapplied/server/Extend-Player-Interact-cancellation.patch rename to patches/server/Extend-Player-Interact-cancellation.patch index d49552be56..1dddd2921c 100644 --- a/patches/unapplied/server/Extend-Player-Interact-cancellation.patch +++ b/patches/server/Extend-Player-Interact-cancellation.patch @@ -23,5 +23,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper end - extend Player Interact cancellation player.getBukkitEntity().updateInventory(); // SPIGOT-2867 - enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS; + return (event.useItemInHand() != Event.Result.ALLOW) ? InteractionResult.SUCCESS : InteractionResult.PASS; } else if (this.gameModeForPlayer == GameType.SPECTATOR) { diff --git a/patches/unapplied/server/Fill-Profile-Property-Events.patch b/patches/server/Fill-Profile-Property-Events.patch similarity index 65% rename from patches/unapplied/server/Fill-Profile-Property-Events.patch rename to patches/server/Fill-Profile-Property-Events.patch index 703fd5bbab..40f98b4d2f 100644 --- a/patches/unapplied/server/Fill-Profile-Property-Events.patch +++ b/patches/server/Fill-Profile-Property-Events.patch @@ -45,16 +45,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public @Nullable ProfileResult fetchProfile(final UUID profileId, final boolean requireSecure) { return super.fetchProfile(profileId, requireSecure); } -diff --git a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -+++ b/src/main/java/net/minecraft/world/level/block/entity/SkullBlockEntity.java -@@ -0,0 +0,0 @@ public class SkullBlockEntity extends BlockEntity { - return apiServices.profileCache().getAsync(name).thenApplyAsync((optional) -> { - if (optional.isPresent() && !booleansupplier.getAsBoolean()) { - UUID uuid = ((GameProfile) optional.get()).getId(); -- ProfileResult profileresult = apiServices.sessionService().fetchProfile(uuid, true); -+ ProfileResult profileresult = apiServices.sessionService() instanceof com.destroystokyo.paper.profile.PaperMinecraftSessionService paperMinecraftSessionService ? paperMinecraftSessionService.fetchProfile(optional.get(), true) : apiServices.sessionService().fetchProfile(uuid, true); // Paper - FillProfileEvent - - return profileresult != null ? Optional.ofNullable(profileresult.profile()) : optional; - } else { diff --git a/patches/unapplied/server/Fix-CraftEntity-hashCode.patch b/patches/server/Fix-CraftEntity-hashCode.patch similarity index 100% rename from patches/unapplied/server/Fix-CraftEntity-hashCode.patch rename to patches/server/Fix-CraftEntity-hashCode.patch diff --git a/patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch similarity index 100% rename from patches/unapplied/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch rename to patches/server/Fix-exploit-that-allowed-colored-signs-to-be-created.patch diff --git a/patches/unapplied/server/Flag-to-disable-the-channel-limit.patch b/patches/server/Flag-to-disable-the-channel-limit.patch similarity index 100% rename from patches/unapplied/server/Flag-to-disable-the-channel-limit.patch rename to patches/server/Flag-to-disable-the-channel-limit.patch diff --git a/patches/unapplied/server/Implement-World.getEntity-UUID-API.patch b/patches/server/Implement-World.getEntity-UUID-API.patch similarity index 100% rename from patches/unapplied/server/Implement-World.getEntity-UUID-API.patch rename to patches/server/Implement-World.getEntity-UUID-API.patch diff --git a/patches/unapplied/server/Implement-extended-PaperServerListPingEvent.patch b/patches/server/Implement-extended-PaperServerListPingEvent.patch similarity index 100% rename from patches/unapplied/server/Implement-extended-PaperServerListPingEvent.patch rename to patches/server/Implement-extended-PaperServerListPingEvent.patch diff --git a/patches/unapplied/server/Improve-EntityShootBowEvent.patch b/patches/server/Improve-EntityShootBowEvent.patch similarity index 100% rename from patches/unapplied/server/Improve-EntityShootBowEvent.patch rename to patches/server/Improve-EntityShootBowEvent.patch diff --git a/patches/unapplied/server/Improved-Async-Task-Scheduler.patch b/patches/server/Improved-Async-Task-Scheduler.patch similarity index 100% rename from patches/unapplied/server/Improved-Async-Task-Scheduler.patch rename to patches/server/Improved-Async-Task-Scheduler.patch diff --git a/patches/unapplied/server/InventoryCloseEvent-Reason-API.patch b/patches/server/InventoryCloseEvent-Reason-API.patch similarity index 100% rename from patches/unapplied/server/InventoryCloseEvent-Reason-API.patch rename to patches/server/InventoryCloseEvent-Reason-API.patch diff --git a/patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch b/patches/server/ItemStack-getMaxItemUseDuration.patch similarity index 95% rename from patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch rename to patches/server/ItemStack-getMaxItemUseDuration.patch index 798951e6f3..daa6a1125b 100644 --- a/patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch +++ b/patches/server/ItemStack-getMaxItemUseDuration.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { - return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getItem().getMaxStackSize(); + return (this.handle == null) ? Material.AIR.getMaxStackSize() : this.handle.getMaxStackSize(); } + // Paper start diff --git a/patches/unapplied/server/LivingEntity-Active-Item-API.patch b/patches/server/LivingEntity-Active-Item-API.patch similarity index 100% rename from patches/unapplied/server/LivingEntity-Active-Item-API.patch rename to patches/server/LivingEntity-Active-Item-API.patch diff --git a/patches/unapplied/server/Make-legacy-ping-handler-more-reliable.patch b/patches/server/Make-legacy-ping-handler-more-reliable.patch similarity index 100% rename from patches/unapplied/server/Make-legacy-ping-handler-more-reliable.patch rename to patches/server/Make-legacy-ping-handler-more-reliable.patch diff --git a/patches/unapplied/server/Make-shield-blocking-delay-configurable.patch b/patches/server/Make-shield-blocking-delay-configurable.patch similarity index 100% rename from patches/unapplied/server/Make-shield-blocking-delay-configurable.patch rename to patches/server/Make-shield-blocking-delay-configurable.patch diff --git a/patches/unapplied/server/Player.setPlayerProfile-API.patch b/patches/server/Player.setPlayerProfile-API.patch similarity index 98% rename from patches/unapplied/server/Player.setPlayerProfile-API.patch rename to patches/server/Player.setPlayerProfile-API.patch index 0d023c5d15..9c2f282668 100644 --- a/patches/unapplied/server/Player.setPlayerProfile-API.patch +++ b/patches/server/Player.setPlayerProfile-API.patch @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 final InetAddress rawAddress = ((InetSocketAddress) this.connection.channel.remoteAddress()).getAddress(); - com.destroystokyo.paper.profile.PlayerProfile profile = org.bukkit.Bukkit.createProfile(uniqueId, playerName); + com.destroystokyo.paper.profile.PlayerProfile profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile); // Paper - setPlayerProfileAPI - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, profile, this.connection.hostname); + AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, rawAddress, uniqueId, this.transferred, profile, this.connection.hostname); server.getPluginManager().callEvent(asyncEvent); profile = asyncEvent.getPlayerProfile(); - profile.complete(); @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - @Override public InetSocketAddress getAddress() { - if (this.getHandle().connection == null) return null; + if (this.getHandle().connection.protocol() == null) return null; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private void untrackAndHideEntity(org.bukkit.entity.Entity entity) { @@ -224,8 +224,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java @@ -0,0 +0,0 @@ public class Commodore { - return; } + // Paper end - Rewrite plugins + // Paper start - Rewrite plugins + if ((owner.equals("org/bukkit/OfflinePlayer") || owner.equals("org/bukkit/entity/Player")) && name.equals("getPlayerProfile") && desc.equals("()Lorg/bukkit/profile/PlayerProfile;")) { diff --git a/patches/unapplied/server/PlayerElytraBoostEvent.patch b/patches/server/PlayerElytraBoostEvent.patch similarity index 88% rename from patches/unapplied/server/PlayerElytraBoostEvent.patch rename to patches/server/PlayerElytraBoostEvent.patch index e9dd2a4715..d8b81b08eb 100644 --- a/patches/unapplied/server/PlayerElytraBoostEvent.patch +++ b/patches/server/PlayerElytraBoostEvent.patch @@ -8,25 +8,25 @@ diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item { +@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item implements ProjectileItem { if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper - world.addFreshEntity(fireworkRocketEntity); -- if (!user.getAbilities().instabuild) { +- itemStack.consume(1, user); +- user.awardStat(Stats.ITEM_USED.get(this)); + // Paper start - PlayerElytraBoostEvent + com.destroystokyo.paper.event.player.PlayerElytraBoostEvent event = new com.destroystokyo.paper.event.player.PlayerElytraBoostEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Firework) fireworkRocketEntity.getBukkitEntity(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand)); + if (event.callEvent() && world.addFreshEntity(fireworkRocketEntity)) { + user.awardStat(Stats.ITEM_USED.get(this)); -+ if (event.shouldConsume() && !user.getAbilities().instabuild) { - itemStack.shrink(1); ++ if (event.shouldConsume() && !user.hasInfiniteMaterials()) { ++ itemStack.shrink(1); + } else ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } else if (user instanceof net.minecraft.server.level.ServerPlayer) { + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + // Paper end - PlayerElytraBoostEvent - } - -- user.awardStat(Stats.ITEM_USED.get(this)); ++ } ++ + // user.awardStat(Stats.ITEM_USED.get(this)); // Paper - PlayerElytraBoostEvent; move up } diff --git a/patches/unapplied/server/PlayerLaunchProjectileEvent.patch b/patches/server/PlayerLaunchProjectileEvent.patch similarity index 90% rename from patches/unapplied/server/PlayerLaunchProjectileEvent.patch rename to patches/server/PlayerLaunchProjectileEvent.patch index 0fc93f9899..71471ef512 100644 --- a/patches/unapplied/server/PlayerLaunchProjectileEvent.patch +++ b/patches/server/PlayerLaunchProjectileEvent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/item/EggItem.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/EggItem.java +++ b/src/main/java/net/minecraft/world/item/EggItem.java -@@ -0,0 +0,0 @@ public class EggItem extends Item { +@@ -0,0 +0,0 @@ public class EggItem extends Item implements ProjectileItem { entityegg.setItem(itemstack); entityegg.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F); @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - PlayerLaunchProjectileEvent + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityegg.getBukkitEntity()); + if (event.callEvent() && world.addFreshEntity(entityegg)) { -+ if (event.shouldConsume() && !user.getAbilities().instabuild) { -+ itemstack.shrink(1); ++ if (event.shouldConsume()) { ++ itemstack.consume(1, user); + } else if (user instanceof net.minecraft.server.level.ServerPlayer) { + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } @@ -38,13 +38,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /* // Paper start - PlayerLaunchProjectileEvent; moved up user.awardStat(Stats.ITEM_USED.get(this)); - if (!user.getAbilities().instabuild) { - itemstack.shrink(1); - } + itemstack.consume(1, user); + */ // Paper end - PlayerLaunchProjectileEvent - return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } + diff --git a/src/main/java/net/minecraft/world/item/EnderpearlItem.java b/src/main/java/net/minecraft/world/item/EnderpearlItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/EnderpearlItem.java @@ -57,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - PlayerLaunchProjectileEvent + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entityenderpearl.getBukkitEntity()); + if (event.callEvent() && world.addFreshEntity(entityenderpearl)) { -+ if (event.shouldConsume() && !user.getAbilities().instabuild) { -+ itemstack.shrink(1); ++ if (event.shouldConsume()) { ++ itemstack.consume(1, user); + } else if (user instanceof net.minecraft.server.level.ServerPlayer) { + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } @@ -79,19 +77,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENDER_PEARL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); user.getCooldowns().addCooldown(this, 20); // CraftBukkit end -@@ -0,0 +0,0 @@ public class EnderpearlItem extends Item { - if (!user.getAbilities().instabuild) { - itemstack.shrink(1); - } -+ */ // Paper end - PlayerLaunchProjectileEvent; moved up + user.awardStat(Stats.ITEM_USED.get(this)); + itemstack.consume(1, user); ++ */ // Paper end - PlayerLaunchProjectileEvent; moved up return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } + } diff --git a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java +++ b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -@@ -0,0 +0,0 @@ public class ExperienceBottleItem extends Item { +@@ -0,0 +0,0 @@ public class ExperienceBottleItem extends Item implements ProjectileItem { @Override public InteractionResultHolder use(Level world, Player user, InteractionHand hand) { ItemStack itemStack = user.getItemInHand(hand); @@ -114,8 +111,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - PlayerLaunchProjectileEvent + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownExperienceBottle.getBukkitEntity()); + if (event.callEvent() && world.addFreshEntity(thrownExperienceBottle)) { -+ if (event.shouldConsume() && !user.getAbilities().instabuild) { -+ itemStack.shrink(1); ++ if (event.shouldConsume()) { ++ itemStack.consume(1, user); + } else if (user instanceof net.minecraft.server.level.ServerPlayer) { + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } @@ -142,18 +139,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /* // Paper start - PlayerLaunchProjectileEvent; moved up user.awardStat(Stats.ITEM_USED.get(this)); - if (!user.getAbilities().instabuild) { - itemStack.shrink(1); - } + itemStack.consume(1, user); + */ // Paper end - PlayerLaunchProjectileEvent - return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } + diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item { +@@ -0,0 +0,0 @@ public class FireworkRocketItem extends Item implements ProjectileItem { itemStack ); fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper @@ -198,22 +193,22 @@ diff --git a/src/main/java/net/minecraft/world/item/SnowballItem.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/SnowballItem.java +++ b/src/main/java/net/minecraft/world/item/SnowballItem.java -@@ -0,0 +0,0 @@ public class SnowballItem extends Item { +@@ -0,0 +0,0 @@ public class SnowballItem extends Item implements ProjectileItem { entitysnowball.setItem(itemstack); entitysnowball.shootFromRotation(user, user.getXRot(), user.getYRot(), 0.0F, 1.5F, 1.0F); - if (world.addFreshEntity(entitysnowball)) { -- if (!user.getAbilities().instabuild) { +- itemstack.consume(1, user); + // Paper start - PlayerLaunchProjectileEvent + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity()); + if (event.callEvent() && world.addFreshEntity(entitysnowball)) { + user.awardStat(Stats.ITEM_USED.get(this)); -+ if (event.shouldConsume() && !user.getAbilities().instabuild) { ++ if (event.shouldConsume()) { + // Paper end - PlayerLaunchProjectileEvent - itemstack.shrink(1); ++ itemstack.consume(1, user); + } else if (user instanceof net.minecraft.server.level.ServerPlayer) { // Paper - PlayerLaunchProjectileEvent + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); // Paper - PlayerLaunchProjectileEvent - } ++ } world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); - } else if (user instanceof net.minecraft.server.level.ServerPlayer) { @@ -225,16 +220,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -+ /* // Paper start - PlayerLaunchProjectileEvent; moved up - user.awardStat(Stats.ITEM_USED.get(this)); - // CraftBukkit start - moved up - /* -@@ -0,0 +0,0 @@ public class SnowballItem extends Item { - itemstack.shrink(1); - } - */ -+ // Paper end - PlayerLaunchProjectileEvent - +- user.awardStat(Stats.ITEM_USED.get(this)); ++ // user.awardStat(Stats.ITEM_USED.get(this)); // Paper - PlayerLaunchProjectileEvent; moved up + // itemstack.consume(1, entityhuman); // CraftBukkit - moved up return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/SplashPotionItem.java b/src/main/java/net/minecraft/world/item/SplashPotionItem.java @@ -267,7 +255,7 @@ diff --git a/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java b/s index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java +++ b/src/main/java/net/minecraft/world/item/ThrowablePotionItem.java -@@ -0,0 +0,0 @@ public class ThrowablePotionItem extends PotionItem { +@@ -0,0 +0,0 @@ public class ThrowablePotionItem extends PotionItem implements ProjectileItem { ThrownPotion thrownPotion = new ThrownPotion(world, user); thrownPotion.setItem(itemStack); thrownPotion.shootFromRotation(user, user.getXRot(), user.getYRot(), -20.0F, 0.5F, 1.0F); @@ -275,8 +263,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - PlayerLaunchProjectileEvent + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) user.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemStack), (org.bukkit.entity.Projectile) thrownPotion.getBukkitEntity()); + if (event.callEvent() && world.addFreshEntity(thrownPotion)) { -+ if (event.shouldConsume() && !user.getAbilities().instabuild) { -+ itemStack.shrink(1); ++ if (event.shouldConsume()) { ++ itemStack.consume(1, user); + } else if (user instanceof net.minecraft.server.level.ServerPlayer) { + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } @@ -293,18 +281,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + /* // Paper start - PlayerLaunchProjectileEvent; moved up user.awardStat(Stats.ITEM_USED.get(this)); - if (!user.getAbilities().instabuild) { - itemStack.shrink(1); - } + itemStack.consume(1, user); + */ // Paper end - return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } + diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java -@@ -0,0 +0,0 @@ public class TridentItem extends Item implements Vanishable { +@@ -0,0 +0,0 @@ public class TridentItem extends Item implements ProjectileItem { } // CraftBukkit start @@ -320,16 +306,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + if (event.shouldConsume()) { // Paper - PlayerLaunchProjectileEvent - stack.hurtAndBreak(1, entityhuman, (entityhuman1) -> { - entityhuman1.broadcastBreakEvent(user.getUsedItemHand()); - }); + stack.hurtAndBreak(1, entityhuman, LivingEntity.getSlotForHand(user.getUsedItemHand())); + } // Paper - PlayerLaunchProjectileEvent entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved // CraftBukkit end world.playSound((Player) null, (Entity) entitythrowntrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F); -- if (!entityhuman.getAbilities().instabuild) { -+ if (event.shouldConsume() && !entityhuman.getAbilities().instabuild) { // Paper - PlayerLaunchProjectileEvent +- if (!entityhuman.hasInfiniteMaterials()) { ++ if (event.shouldConsume() && !entityhuman.hasInfiniteMaterials()) { entityhuman.getInventory().removeItem(stack); } // CraftBukkit start - SPIGOT-5458 also need in this branch :( diff --git a/patches/unapplied/server/PlayerReadyArrowEvent.patch b/patches/server/PlayerReadyArrowEvent.patch similarity index 100% rename from patches/unapplied/server/PlayerReadyArrowEvent.patch rename to patches/server/PlayerReadyArrowEvent.patch diff --git a/patches/unapplied/server/PreCreatureSpawnEvent.patch b/patches/server/PreCreatureSpawnEvent.patch similarity index 83% rename from patches/unapplied/server/PreCreatureSpawnEvent.patch rename to patches/server/PreCreatureSpawnEvent.patch index 63c2be0d2b..555309bd9e 100644 --- a/patches/unapplied/server/PreCreatureSpawnEvent.patch +++ b/patches/server/PreCreatureSpawnEvent.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + break; + } + // Paper end - PreCreatureSpawnEvent - T t0 = entitytypes.create(worldserver, (CompoundTag) null, null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error + T t0 = entitytypes.create(worldserver, (Consumer) null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -0,0 +0,0 @@ public class EntityType implements FeatureElement, EntityTypeT @Nullable - public T spawn(ServerLevel worldserver, @Nullable CompoundTag nbttagcompound, @Nullable Consumer consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { + public T spawn(ServerLevel worldserver, @Nullable Consumer consumer, BlockPos blockposition, MobSpawnType enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { // CraftBukkit end + // Paper start - PreCreatureSpawnEvent + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( @@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } + // Paper end - PreCreatureSpawnEvent - T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1); + T t0 = this.create(worldserver, consumer, blockposition, enummobspawn, flag, flag1); if (t0 != null) { diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java @@ -148,6 +148,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - PreCreatureSpawnEvent EntityType entitytypes = spawnEntry.type; +- return entitytypes.getCategory() == MobCategory.MISC ? false : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? false : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)))) : false)); + // Paper start - PreCreatureSpawnEvent + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + io.papermc.paper.util.MCUtil.toLocation(world, pos), @@ -160,21 +161,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return PreSpawnStatus.CANCELLED; + } + // Paper end - PreCreatureSpawnEvent - if (entitytypes.getCategory() == MobCategory.MISC) { -- return false; -+ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent - } else if (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance())) { -- return false; -+ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent - } else if (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos)) { - SpawnPlacements.Type entitypositiontypes_surface = SpawnPlacements.getPlacementType(entitytypes); - -- return !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D))); -+ boolean isValid = !NaturalSpawner.isSpawnPositionOk(entitypositiontypes_surface, world, pos, entitytypes) ? false : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? false : world.noCollision(entitytypes.getAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D))); // Paper - PreCreatureSpawnEvent -+ return isValid ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent - } else { -- return false; -+ return PreSpawnStatus.FAIL; // Paper - PreCreatureSpawnEvent - } ++ ++ return entitytypes.getCategory() == MobCategory.MISC ? PreSpawnStatus.FAIL : (!entitytypes.canSpawnFarFromPlayer() && squaredDistance > (double) (entitytypes.getCategory().getDespawnDistance() * entitytypes.getCategory().getDespawnDistance()) ? PreSpawnStatus.FAIL : (entitytypes.canSummon() && NaturalSpawner.canSpawnMobAt(world, structureAccessor, chunkGenerator, group, spawnEntry, pos) ? (!SpawnPlacements.isSpawnPositionOk(entitytypes, world, pos) ? PreSpawnStatus.FAIL : (!SpawnPlacements.checkSpawnRules(entitytypes, world, MobSpawnType.NATURAL, pos, world.random) ? PreSpawnStatus.FAIL : world.noCollision(entitytypes.getSpawnAABB((double) pos.getX() + 0.5D, (double) pos.getY(), (double) pos.getZ() + 0.5D)) ? PreSpawnStatus.SUCCESS : PreSpawnStatus.FAIL)) : PreSpawnStatus.FAIL)); // Paper - PreCreatureSpawnEvent } + @Nullable diff --git a/patches/unapplied/server/Print-Error-details-when-failing-to-save-player-data.patch b/patches/server/Print-Error-details-when-failing-to-save-player-data.patch similarity index 100% rename from patches/unapplied/server/Print-Error-details-when-failing-to-save-player-data.patch rename to patches/server/Print-Error-details-when-failing-to-save-player-data.patch diff --git a/patches/unapplied/server/RangedEntity-API.patch b/patches/server/RangedEntity-API.patch similarity index 100% rename from patches/unapplied/server/RangedEntity-API.patch rename to patches/server/RangedEntity-API.patch diff --git a/patches/unapplied/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch b/patches/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch similarity index 100% rename from patches/unapplied/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch rename to patches/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch diff --git a/patches/unapplied/server/Tameable-getOwnerUniqueId-API.patch b/patches/server/Tameable-getOwnerUniqueId-API.patch similarity index 100% rename from patches/unapplied/server/Tameable-getOwnerUniqueId-API.patch rename to patches/server/Tameable-getOwnerUniqueId-API.patch diff --git a/patches/unapplied/server/Toggleable-player-crits.patch b/patches/server/Toggleable-player-crits.patch similarity index 50% rename from patches/unapplied/server/Toggleable-player-crits.patch rename to patches/server/Toggleable-player-crits.patch index 73d2d8062c..9c994bd2ed 100644 --- a/patches/unapplied/server/Toggleable-player-crits.patch +++ b/patches/server/Toggleable-player-crits.patch @@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { + f += this.getItemInHand(InteractionHand.MAIN_HAND).getItem().getAttackDamageBonus(this, f); + boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting(); - boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity; - -+ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits - flag2 = flag2 && !this.isSprinting(); - if (flag2) { - f *= 1.5F; ++ flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits + if (flag2) { + f *= 1.5F; + } diff --git a/patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch similarity index 100% rename from patches/unapplied/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch rename to patches/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch diff --git a/patches/unapplied/server/Vex-get-setSummoner-API.patch b/patches/server/Vex-get-setSummoner-API.patch similarity index 100% rename from patches/unapplied/server/Vex-get-setSummoner-API.patch rename to patches/server/Vex-get-setSummoner-API.patch diff --git a/patches/unapplied/server/WitchConsumePotionEvent.patch b/patches/server/WitchConsumePotionEvent.patch similarity index 58% rename from patches/unapplied/server/WitchConsumePotionEvent.patch rename to patches/server/WitchConsumePotionEvent.patch index 80e3b0064a..22079ab3e8 100644 --- a/patches/unapplied/server/WitchConsumePotionEvent.patch +++ b/patches/server/WitchConsumePotionEvent.patch @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); - if (itemstack.is(Items.POTION)) { -- List list = PotionUtils.getMobEffects(itemstack); -+ // Paper start - WitchConsumePotionEvent + PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS); ++ // Paper start - WitchConsumePotionEvent ++ if (itemstack.is(Items.POTION)) { + com.destroystokyo.paper.event.entity.WitchConsumePotionEvent event = new com.destroystokyo.paper.event.entity.WitchConsumePotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); -+ -+ List list = event.callEvent() ? PotionUtils.getMobEffects(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion())) : null; -+ // Paper end - WitchConsumePotionEvent ++ potioncontents = event.callEvent() ? org.bukkit.craftbukkit.inventory.CraftItemStack.unwrap(event.getPotion()).get(DataComponents.POTION_CONTENTS) : null; ++ } ++ // Paper end - WitchConsumePotionEvent - if (list != null) { - Iterator iterator = list.iterator(); + if (itemstack.is(Items.POTION) && potioncontents != null) { + potioncontents.forEachEffect((effect) -> this.addEffect(effect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK)); // CraftBukkit diff --git a/patches/unapplied/server/WitchReadyPotionEvent.patch b/patches/server/WitchReadyPotionEvent.patch similarity index 91% rename from patches/unapplied/server/WitchReadyPotionEvent.patch rename to patches/server/WitchReadyPotionEvent.patch index 3408edb19c..8d4ba04685 100644 --- a/patches/unapplied/server/WitchReadyPotionEvent.patch +++ b/patches/server/WitchReadyPotionEvent.patch @@ -11,10 +11,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { } - if (potionregistry != null) { -- this.setItemSlot(EquipmentSlot.MAINHAND, PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry)); + if (holder != null) { +- this.setItemSlot(EquipmentSlot.MAINHAND, PotionContents.createItemStack(Items.POTION, holder)); + // Paper start -+ ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry); ++ ItemStack potion = PotionContents.createItemStack(Items.POTION, holder); + potion = org.bukkit.craftbukkit.event.CraftEventFactory.handleWitchReadyPotionEvent(this, potion); + this.setItemSlot(EquipmentSlot.MAINHAND, potion); + // Paper end diff --git a/patches/unapplied/server/WitchThrowPotionEvent.patch b/patches/server/WitchThrowPotionEvent.patch similarity index 85% rename from patches/unapplied/server/WitchThrowPotionEvent.patch rename to patches/server/WitchThrowPotionEvent.patch index 0b6a361cdd..7333fb1e0b 100644 --- a/patches/unapplied/server/WitchThrowPotionEvent.patch +++ b/patches/server/WitchThrowPotionEvent.patch @@ -10,11 +10,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/Witch.java +++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java @@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob { - potionregistry = Potions.WEAKNESS; + holder = Potions.WEAKNESS; } + // Paper start - WitchThrowPotionEvent -+ ItemStack potion = PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry); ++ ItemStack potion = PotionContents.createItemStack(Items.SPLASH_POTION, holder); + com.destroystokyo.paper.event.entity.WitchThrowPotionEvent event = new com.destroystokyo.paper.event.entity.WitchThrowPotionEvent((org.bukkit.entity.Witch) this.getBukkitEntity(), (org.bukkit.entity.LivingEntity) target.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); + if (!event.callEvent()) { + return; @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + potion = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion()); ThrownPotion entitypotion = new ThrownPotion(this.level(), this); - -- entitypotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry)); +- entitypotion.setItem(PotionContents.createItemStack(Items.SPLASH_POTION, holder)); + entitypotion.setItem(potion); + // Paper end - WitchThrowPotionEvent entitypotion.setXRot(entitypotion.getXRot() - -20.0F); diff --git a/patches/unapplied/server/add-more-information-to-Entity.toString.patch b/patches/server/add-more-information-to-Entity.toString.patch similarity index 95% rename from patches/unapplied/server/add-more-information-to-Entity.toString.patch rename to patches/server/add-more-information-to-Entity.toString.patch index 0aab1f846d..dae89bf42a 100644 --- a/patches/unapplied/server/add-more-information-to-Entity.toString.patch +++ b/patches/server/add-more-information-to-Entity.toString.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public String toString() { String s = this.level() == null ? "~NULL~" : this.level().toString(); diff --git a/patches/unapplied/server/getPlayerUniqueId-API.patch b/patches/server/getPlayerUniqueId-API.patch similarity index 100% rename from patches/unapplied/server/getPlayerUniqueId-API.patch rename to patches/server/getPlayerUniqueId-API.patch