From 7409d8fed7a3e26b39fb4875540083a407241bd9 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 7 Jun 2023 21:54:11 +0200 Subject: [PATCH] More more more more more work --- ...o-change-PlayerProfile-in-AsyncPreLoginEven.patch | 0 ...config-to-disable-ender-dragon-legacy-check.patch | 8 ++++---- .../server/Add-openSign-method-to-HumanEntity.patch | 5 ++--- ...awning-Item-entities-with-World.spawnEntity.patch | 0 .../server/Block-Enderpearl-Travel-Exploit.patch | 4 ++-- ...l-PaperServerListPingEvent-for-legacy-pings.patch | 0 ...figurable-Alternative-LootPool-Luck-Formula.patch | 0 .../Configurable-sprint-interruption-on-attack.patch | 0 .../Disable-Explicit-Network-Manager-Flushing.patch | 0 .../server/Enderman.teleportRandomly.patch | 2 +- .../server/EndermanAttackPlayerEvent.patch | 2 +- .../{unapplied => }/server/EndermanEscapeEvent.patch | 6 +++--- .../server/Expand-Explosions-API.patch | 0 ...and-World.spawnParticle-API-and-add-Builder.patch | 0 .../server/Fix-CraftEntity-hashCode.patch | 0 .../server/Flag-to-disable-the-channel-limit.patch | 0 ...-EntityKnockbackByEntityEvent-and-EntityPus.patch | 6 +++--- .../Implement-EntityTeleportEndGatewayEvent.patch | 0 .../server/Implement-World.getEntity-UUID-API.patch | 0 ...Implement-extended-PaperServerListPingEvent.patch | 0 .../server/Improve-EntityShootBowEvent.patch | 10 +++++----- .../server/Improved-Async-Task-Scheduler.patch | 0 .../server/InventoryCloseEvent-Reason-API.patch | 12 ++++++------ .../server/ItemStack-getMaxItemUseDuration.patch | 0 .../LivingEntity-Hand-Raised-Item-Use-API.patch | 0 .../Make-legacy-ping-handler-more-reliable.patch | 0 .../Make-shield-blocking-delay-configurable.patch | 0 .../server/Player.setPlayerProfile-API.patch | 6 +++--- .../server/PlayerReadyArrowEvent.patch | 0 ...ent-Frosted-Ice-from-loading-holding-chunks.patch | 0 ...or-details-when-failing-to-save-player-data.patch | 0 .../{unapplied => }/server/RangedEntity-API.patch | 0 ...layer-inventory-when-cancelling-PlayerInter.patch | 0 ...t-Ignited-flag-on-cancel-of-Explosion-Event.patch | 0 .../server/Vex-get-setSummoner-API.patch | 0 .../server/WitchConsumePotionEvent.patch | 0 .../server/WitchReadyPotionEvent.patch | 0 .../server/WitchThrowPotionEvent.patch | 2 +- .../server/getPlayerUniqueId-API.patch | 0 39 files changed, 31 insertions(+), 32 deletions(-) rename patches/{unapplied => }/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch (100%) rename patches/{unapplied => }/server/Add-config-to-disable-ender-dragon-legacy-check.patch (78%) rename patches/{unapplied => }/server/Add-openSign-method-to-HumanEntity.patch (92%) rename patches/{unapplied => }/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch (100%) rename patches/{unapplied => }/server/Block-Enderpearl-Travel-Exploit.patch (87%) rename patches/{unapplied => }/server/Call-PaperServerListPingEvent-for-legacy-pings.patch (100%) rename patches/{unapplied => }/server/Configurable-Alternative-LootPool-Luck-Formula.patch (100%) rename patches/{unapplied => }/server/Configurable-sprint-interruption-on-attack.patch (100%) rename patches/{unapplied => }/server/Disable-Explicit-Network-Manager-Flushing.patch (100%) rename patches/{unapplied => }/server/Enderman.teleportRandomly.patch (96%) rename patches/{unapplied => }/server/EndermanAttackPlayerEvent.patch (96%) rename patches/{unapplied => }/server/EndermanEscapeEvent.patch (86%) rename patches/{unapplied => }/server/Expand-Explosions-API.patch (100%) rename patches/{unapplied => }/server/Expand-World.spawnParticle-API-and-add-Builder.patch (100%) rename patches/{unapplied => }/server/Fix-CraftEntity-hashCode.patch (100%) rename patches/{unapplied => }/server/Flag-to-disable-the-channel-limit.patch (100%) rename patches/{unapplied => }/server/Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch (98%) rename patches/{unapplied => }/server/Implement-EntityTeleportEndGatewayEvent.patch (100%) rename patches/{unapplied => }/server/Implement-World.getEntity-UUID-API.patch (100%) rename patches/{unapplied => }/server/Implement-extended-PaperServerListPingEvent.patch (100%) rename patches/{unapplied => }/server/Improve-EntityShootBowEvent.patch (92%) rename patches/{unapplied => }/server/Improved-Async-Task-Scheduler.patch (100%) rename patches/{unapplied => }/server/InventoryCloseEvent-Reason-API.patch (96%) rename patches/{unapplied => }/server/ItemStack-getMaxItemUseDuration.patch (100%) rename patches/{unapplied => }/server/LivingEntity-Hand-Raised-Item-Use-API.patch (100%) rename patches/{unapplied => }/server/Make-legacy-ping-handler-more-reliable.patch (100%) rename patches/{unapplied => }/server/Make-shield-blocking-delay-configurable.patch (100%) rename patches/{unapplied => }/server/Player.setPlayerProfile-API.patch (98%) rename patches/{unapplied => }/server/PlayerReadyArrowEvent.patch (100%) rename patches/{unapplied => }/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch (100%) rename patches/{unapplied => }/server/Print-Error-details-when-failing-to-save-player-data.patch (100%) rename patches/{unapplied => }/server/RangedEntity-API.patch (100%) rename patches/{unapplied => }/server/Refresh-player-inventory-when-cancelling-PlayerInter.patch (100%) rename patches/{unapplied => }/server/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch (100%) rename patches/{unapplied => }/server/Vex-get-setSummoner-API.patch (100%) rename patches/{unapplied => }/server/WitchConsumePotionEvent.patch (100%) rename patches/{unapplied => }/server/WitchReadyPotionEvent.patch (100%) rename patches/{unapplied => }/server/WitchThrowPotionEvent.patch (99%) rename patches/{unapplied => }/server/getPlayerUniqueId-API.patch (100%) diff --git a/patches/unapplied/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch similarity index 100% rename from patches/unapplied/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to patches/server/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.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 78% 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 index 39aa7357be..b869e8a0b0 100644 --- 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 @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -0,0 +0,0 @@ public class EndDragonFight { - private List respawnCrystals; + } - public EndDragonFight(ServerLevel world, long gatewaysSeed, CompoundTag nbt) { + public EndDragonFight(ServerLevel world, long gatewaysSeed, EndDragonFight.Data data, BlockPos origin) { + // Paper start + this.needsStateScanning = world.paperConfig().entities.spawning.scanForLegacyEnderDragon; + if (!this.needsStateScanning) this.dragonKilled = true; + // Paper end this.level = world; - if (nbt.contains("NeedsStateScanning")) { - this.needsStateScanning = nbt.getBoolean("NeedsStateScanning"); + this.origin = origin; + this.validPlayer = EntitySelector.ENTITY_STILL_ALIVE.and(EntitySelector.withinDistance((double)origin.getX(), (double)(128 + origin.getY()), (double)origin.getZ(), 192.0D)); diff --git a/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch b/patches/server/Add-openSign-method-to-HumanEntity.patch similarity index 92% rename from patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch rename to patches/server/Add-openSign-method-to-HumanEntity.patch index 10ec2d4578..648852211d 100644 --- a/patches/unapplied/server/Add-openSign-method-to-HumanEntity.patch +++ b/patches/server/Add-openSign-method-to-HumanEntity.patch @@ -20,10 +20,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Preconditions.checkArgument(sign.getWorld() == player.getWorld(), "Sign must be in same world as Player"); SignBlockEntity handle = ((CraftSign) sign).getTileEntity(); - handle.isEditable = true; -- ((CraftPlayer) player).getHandle().openTextEdit(handle); -+ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle); // Paper - change move open sign to HumanEntity +- ((CraftPlayer) player).getHandle().openTextEdit(handle, true); ++ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle, true); // Paper - change move open sign to HumanEntity } // Paper start diff --git a/patches/unapplied/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch b/patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch similarity index 100% rename from patches/unapplied/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch rename to patches/server/Allow-spawning-Item-entities-with-World.spawnEntity.patch diff --git a/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch b/patches/server/Block-Enderpearl-Travel-Exploit.patch similarity index 87% rename from patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch rename to patches/server/Block-Enderpearl-Travel-Exploit.patch index 05f60c4d8d..6e87855cfb 100644 --- a/patches/unapplied/server/Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/Block-Enderpearl-Travel-Exploit.patch @@ -37,10 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java @@ -0,0 +0,0 @@ public abstract class Projectile extends Entity implements TraceableEntity { - protected void readAdditionalSaveData(CompoundTag nbt) { if (nbt.hasUUID("Owner")) { this.ownerUUID = nbt.getUUID("Owner"); -+ if (this instanceof ThrownEnderpearl && this.level != null && this.level.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit + this.cachedOwner = null; ++ if (this instanceof ThrownEnderpearl && this.level() != null && this.level().paperConfig().fixes.disableUnloadedChunkEnderpearlExploit) { this.ownerUUID = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit } this.leftOwner = nbt.getBoolean("LeftOwner"); 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-Alternative-LootPool-Luck-Formula.patch b/patches/server/Configurable-Alternative-LootPool-Luck-Formula.patch similarity index 100% rename from patches/unapplied/server/Configurable-Alternative-LootPool-Luck-Formula.patch rename to patches/server/Configurable-Alternative-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 100% rename from patches/unapplied/server/Configurable-sprint-interruption-on-attack.patch rename to patches/server/Configurable-sprint-interruption-on-attack.patch 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/Enderman.teleportRandomly.patch b/patches/server/Enderman.teleportRandomly.patch similarity index 96% rename from patches/unapplied/server/Enderman.teleportRandomly.patch rename to patches/server/Enderman.teleportRandomly.patch index f93e16b993..c363a76a25 100644 --- a/patches/unapplied/server/Enderman.teleportRandomly.patch +++ b/patches/server/Enderman.teleportRandomly.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - protected boolean teleport() { + public boolean teleport() { // Paper - protected->public - if (!this.level.isClientSide() && this.isAlive()) { + if (!this.level().isClientSide() && this.isAlive()) { double d0 = this.getX() + (this.random.nextDouble() - 0.5D) * 64.0D; double d1 = this.getY() + (double) (this.random.nextInt(64) - 32); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java diff --git a/patches/unapplied/server/EndermanAttackPlayerEvent.patch b/patches/server/EndermanAttackPlayerEvent.patch similarity index 96% rename from patches/unapplied/server/EndermanAttackPlayerEvent.patch rename to patches/server/EndermanAttackPlayerEvent.patch index c2d177ebfa..f7000ae0ea 100644 --- a/patches/unapplied/server/EndermanAttackPlayerEvent.patch +++ b/patches/server/EndermanAttackPlayerEvent.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { - this.readPersistentAngerSaveData(this.level, nbt); + this.readPersistentAngerSaveData(this.level(), nbt); } - boolean isLookingAtMe(Player player) { diff --git a/patches/unapplied/server/EndermanEscapeEvent.patch b/patches/server/EndermanEscapeEvent.patch similarity index 86% rename from patches/unapplied/server/EndermanEscapeEvent.patch rename to patches/server/EndermanEscapeEvent.patch index 45340da13d..798d169bf7 100644 --- a/patches/unapplied/server/EndermanEscapeEvent.patch +++ b/patches/server/EndermanEscapeEvent.patch @@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean setTarget(LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { if (!super.setTarget(entityliving, reason, fireEvent)) { @@ -0,0 +0,0 @@ public class EnderMan extends Monster implements NeutralMob { - if (this.level.isDay() && this.tickCount >= this.targetChangeTime + 600) { + if (this.level().isDay() && this.tickCount >= this.targetChangeTime + 600) { float f = this.getLightLevelDependentMagicValue(); -- if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { -+ if (f > 0.5F && this.level.canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper +- if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { ++ if (f > 0.5F && this.level().canSeeSky(this.blockPosition()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(com.destroystokyo.paper.event.entity.EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper this.setTarget((LivingEntity) null); this.teleport(); } diff --git a/patches/unapplied/server/Expand-Explosions-API.patch b/patches/server/Expand-Explosions-API.patch similarity index 100% rename from patches/unapplied/server/Expand-Explosions-API.patch rename to patches/server/Expand-Explosions-API.patch 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 100% 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 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/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-EntityKnockbackByEntityEvent-and-EntityPus.patch b/patches/server/Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch similarity index 98% rename from patches/unapplied/server/Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch rename to patches/server/Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch index 8ec614d7ac..fa8decc891 100644 --- a/patches/unapplied/server/Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch +++ b/patches/server/Implement-EntityKnockbackByEntityEvent-and-EntityPus.patch @@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable { Vec3 vec3d1 = (new Vec3(x, 0.0D, z)).normalize().scale(strength); - this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); + this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + strength) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); + // Paper start - call EntityKnockbackByEntityEvent + Vec3 currentMovement = this.getDeltaMovement(); + org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMovement.x - vec3d.x, currentMovement.y - vec3d.y, currentMovement.z - vec3d.z); @@ -152,9 +152,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java @@ -0,0 +0,0 @@ public interface HoglinBase { - double j = f * (double)(attacker.level.random.nextFloat() * 0.5F + 0.2F); + double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F); Vec3 vec3 = (new Vec3(g, 0.0D, h)).normalize().scale(j).yRot(i); - double k = f * (double)attacker.level.random.nextFloat() * 0.5D; + double k = f * (double)attacker.level().random.nextFloat() * 0.5D; - target.push(vec3.x, k, vec3.z); + target.push(vec3.x, k, vec3.z, attacker); // Paper target.hurtMarked = true; diff --git a/patches/unapplied/server/Implement-EntityTeleportEndGatewayEvent.patch b/patches/server/Implement-EntityTeleportEndGatewayEvent.patch similarity index 100% rename from patches/unapplied/server/Implement-EntityTeleportEndGatewayEvent.patch rename to patches/server/Implement-EntityTeleportEndGatewayEvent.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 92% rename from patches/unapplied/server/Improve-EntityShootBowEvent.patch rename to patches/server/Improve-EntityShootBowEvent.patch index 516bb4400b..072eecaa6e 100644 --- a/patches/unapplied/server/Improve-EntityShootBowEvent.patch +++ b/patches/server/Improve-EntityShootBowEvent.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java @@ -0,0 +0,0 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo - entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); + entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); // CraftBukkit start - org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); + org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper @@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Illusioner extends SpellcasterIllager implements RangedAttackMob { double d3 = Math.sqrt(d0 * d0 + d2 * d2); - entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); + entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); + // Paper start + org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true); + if (event.isCancelled()) { @@ -37,11 +37,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + if (event.getProjectile() == entityarrow.getBukkitEntity()) { -+ this.level.addFreshEntity(entityarrow); ++ this.level().addFreshEntity(entityarrow); + } - this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); -- this.level.addFreshEntity(entityarrow); + // Paper end + this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); +- this.level().addFreshEntity(entityarrow); } @Override 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 96% rename from patches/unapplied/server/InventoryCloseEvent-Reason-API.patch rename to patches/server/InventoryCloseEvent-Reason-API.patch index b48ddb99fc..d29aa77b13 100644 --- a/patches/unapplied/server/InventoryCloseEvent-Reason-API.patch +++ b/patches/server/InventoryCloseEvent-Reason-API.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerPlayer extends Player { } // Paper end - if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) { + if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) { - this.closeContainer(); + this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.containerMenu = this.inventoryMenu; @@ -91,11 +91,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void handleContainerClose(ServerboundContainerClosePacket packet) { + // Paper start -+ handleContainerClose(packet, InventoryCloseEvent.Reason.PLAYER); ++ this.handleContainerClose(packet, InventoryCloseEvent.Reason.PLAYER); + } + public void handleContainerClose(ServerboundContainerClosePacket packet, InventoryCloseEvent.Reason reason) { + // Paper end - PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); + PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.isImmobile()) return; // CraftBukkit - CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit @@ -123,7 +123,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { this.updateIsUnderwater(); super.tick(); - if (!this.level.isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) { + if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) { - this.closeContainer(); + this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.containerMenu = this.inventoryMenu; @@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + player.connection.handleContainerClose(new ServerboundContainerClosePacket(player.containerMenu.containerId), InventoryCloseEvent.Reason.OPEN_NEW); // Paper } - CraftServer server = player.level.getCraftServer(); + CraftServer server = player.level().getCraftServer(); @@ -0,0 +0,0 @@ public class CraftEventFactory { return event; } @@ -215,6 +215,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static void handleInventoryCloseEvent(net.minecraft.world.entity.player.Player human, org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { + // Paper end + InventoryCloseEvent event = new InventoryCloseEvent(human.containerMenu.getBukkitView(), reason); // Paper - human.level.getCraftServer().getPluginManager().callEvent(event); + human.level().getCraftServer().getPluginManager().callEvent(event); human.containerMenu.transferTo(human.inventoryMenu, human.getBukkitEntity()); } diff --git a/patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch b/patches/server/ItemStack-getMaxItemUseDuration.patch similarity index 100% rename from patches/unapplied/server/ItemStack-getMaxItemUseDuration.patch rename to patches/server/ItemStack-getMaxItemUseDuration.patch diff --git a/patches/unapplied/server/LivingEntity-Hand-Raised-Item-Use-API.patch b/patches/server/LivingEntity-Hand-Raised-Item-Use-API.patch similarity index 100% rename from patches/unapplied/server/LivingEntity-Hand-Raised-Item-Use-API.patch rename to patches/server/LivingEntity-Hand-Raised-Item-Use-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 ec7a640551..82e3ec1333 100644 --- a/patches/unapplied/server/Player.setPlayerProfile-API.patch +++ b/patches/server/Player.setPlayerProfile-API.patch @@ -64,8 +64,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.biome.BiomeManager; import net.minecraft.world.level.block.entity.SignBlockEntity; + import net.minecraft.world.level.block.entity.SignText; import net.minecraft.world.level.border.BorderChangeListener; - import net.minecraft.world.level.saveddata.maps.MapDecoration; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return server.getPlayer(getUniqueId()) != null; } @@ -82,7 +82,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void untrackAndHideEntity(org.bukkit.entity.Entity entity) { // Remove this entity from the hidden player's EntityTrackerEntry -- ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap; +- ChunkMap tracker = ((ServerLevel) this.getHandle().level()).getChunkSource().chunkMap; + // Paper start Entity other = ((CraftEntity) entity).getHandle(); + unregisterEntity(other); @@ -91,7 +91,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + private void unregisterEntity(Entity other) { + // Paper end -+ ChunkMap tracker = ((ServerLevel) this.getHandle().level).getChunkSource().chunkMap; ++ ChunkMap tracker = ((ServerLevel) this.getHandle().level()).getChunkSource().chunkMap; ChunkMap.TrackedEntity entry = tracker.entityMap.get(other.getId()); if (entry != null) { entry.removePlayer(this.getHandle()); 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/Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/patches/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch similarity index 100% rename from patches/unapplied/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch rename to patches/server/Prevent-Frosted-Ice-from-loading-holding-chunks.patch 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/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 100% rename from patches/unapplied/server/WitchConsumePotionEvent.patch rename to patches/server/WitchConsumePotionEvent.patch diff --git a/patches/unapplied/server/WitchReadyPotionEvent.patch b/patches/server/WitchReadyPotionEvent.patch similarity index 100% rename from patches/unapplied/server/WitchReadyPotionEvent.patch rename to patches/server/WitchReadyPotionEvent.patch diff --git a/patches/unapplied/server/WitchThrowPotionEvent.patch b/patches/server/WitchThrowPotionEvent.patch similarity index 99% rename from patches/unapplied/server/WitchThrowPotionEvent.patch rename to patches/server/WitchThrowPotionEvent.patch index 74fc80827d..98c23bf492 100644 --- a/patches/unapplied/server/WitchThrowPotionEvent.patch +++ b/patches/server/WitchThrowPotionEvent.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + potion = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion()); - ThrownPotion entitypotion = new ThrownPotion(this.level, this); + ThrownPotion entitypotion = new ThrownPotion(this.level(), this); - - entitypotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry)); + entitypotion.setItem(potion); 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