From 72923817d65cca649fb7c63a2872a94d93f6a7c1 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 14 Mar 2023 15:13:41 -0700 Subject: [PATCH] fix some compile errors --- build.gradle.kts | 2 +- ...3-Expose-LivingEntity-hurt-direction.patch | 27 +++++++++++++- ...-add-isDeeplySleeping-to-HumanEntity.patch | 8 ++-- patches/api/0374-Add-Player-getFishHook.patch | 4 +- ...-swingHand-EquipmentSlot-convenience.patch | 6 +-- .../api/0392-Add-entity-knockback-API.patch | 4 +- patches/api/0399-ItemStack-damage-API.patch | 4 +- .../api/0414-Add-Entity-Body-Yaw-API.patch | 4 +- patches/server/0006-MC-Dev-fixes.patch | 13 +++++++ .../0041-Disable-explosion-knockback.patch | 4 +- .../server/0143-Basic-PlayerProfile-API.patch | 4 +- .../server/0169-AsyncTabCompleteEvent.patch | 6 +-- ...Prevent-rayTrace-from-loading-chunks.patch | 4 +- ...7-Expose-LivingEntity-hurt-direction.patch | 37 +++++++++++++++++-- ...-add-isDeeplySleeping-to-HumanEntity.patch | 7 ++-- .../server/0619-More-Enchantment-API.patch | 4 +- ...t-lookup-fluid-state-when-raytracing.patch | 4 +- ...14-Do-not-run-raytrace-logic-for-AIR.patch | 4 +- .../0754-Add-player-health-update-API.patch | 10 ++--- .../server/0858-Add-Player-getFishHook.patch | 4 +- patches/server/0945-Flying-Fall-Damage.patch | 6 +-- ...Fix-force-opening-enchantment-tables.patch | 4 +- ...ity-drop-not-updating-the-client-inv.patch | 4 +- 23 files changed, 119 insertions(+), 55 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f358c8b36a..4edd557e5d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -133,7 +133,7 @@ allprojects { tasks.collectAtsFromPatches { // Uncomment while updating for a new Minecraft version - extraPatchDir.set(layout.projectDirectory.dir("patches/unapplied/server")) + // extraPatchDir.set(layout.projectDirectory.dir("patches/unapplied/server")) } tasks.register("printMinecraftVersion") { diff --git a/patches/api/0233-Expose-LivingEntity-hurt-direction.patch b/patches/api/0233-Expose-LivingEntity-hurt-direction.patch index 92baefbb10..2be48d7780 100644 --- a/patches/api/0233-Expose-LivingEntity-hurt-direction.patch +++ b/patches/api/0233-Expose-LivingEntity-hurt-direction.patch @@ -4,11 +4,32 @@ Date: Sun, 13 Dec 2020 05:32:12 +0200 Subject: [PATCH] Expose LivingEntity hurt direction +diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java +index b0de996c7cbfc36a3f749091068a70885b009832..b21325401f59a02c0fb52d203e90b0f6207b556f 100644 +--- a/src/main/java/org/bukkit/entity/HumanEntity.java ++++ b/src/main/java/org/bukkit/entity/HumanEntity.java +@@ -348,6 +348,16 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + */ + public void setCooldown(@NotNull Material material, int ticks); + ++ // Paper start ++ /** ++ * Sets player hurt direction ++ * ++ * @param hurtDirection hurt direction ++ */ ++ @Override ++ void setHurtDirection(float hurtDirection); ++ // Paper end ++ + /** + * Get the sleep ticks of the player. This value may be capped. + * diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index b09c9eb92c069f76e0fba4a08ed0a5c66ced3a40..cc61e030f1bdb4d1ef52a0a1ae4983f95d2460fd 100644 +index b09c9eb92c069f76e0fba4a08ed0a5c66ced3a40..16536dae04b020de43f9e13ff32c659b9e6cab0c 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -995,5 +995,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -995,5 +995,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param quantity quantity of item */ void playPickupItemAnimation(@NotNull Item item, int quantity); @@ -24,7 +45,9 @@ index b09c9eb92c069f76e0fba4a08ed0a5c66ced3a40..cc61e030f1bdb4d1ef52a0a1ae4983f9 + * Sets player hurt direction + * + * @param hurtDirection hurt direction ++ * @deprecated use {@link Player#setHurtDirection(float)} + */ ++ @Deprecated + void setHurtDirection(float hurtDirection); // Paper end } diff --git a/patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch b/patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch index 6519681c65..55b6ed4860 100644 --- a/patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/api/0272-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,12 +5,12 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index b0de996c7cbfc36a3f749091068a70885b009832..a82eee24439989bb0180e3d0b1cc33f277d5305b 100644 +index b21325401f59a02c0fb52d203e90b0f6207b556f..399ea8a6f4fbd9d6bf04853d2d6b21a5e352a7fd 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -348,6 +348,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - */ - public void setCooldown(@NotNull Material material, int ticks); +@@ -358,6 +358,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + void setHurtDirection(float hurtDirection); + // Paper end + // Paper start + /** diff --git a/patches/api/0374-Add-Player-getFishHook.patch b/patches/api/0374-Add-Player-getFishHook.patch index e1bc389488..cbedf28c68 100644 --- a/patches/api/0374-Add-Player-getFishHook.patch +++ b/patches/api/0374-Add-Player-getFishHook.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#getFishHook diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index a82eee24439989bb0180e3d0b1cc33f277d5305b..127c82c36bd37ef61385a758785bffc6ec1f4b5c 100644 +index 399ea8a6f4fbd9d6bf04853d2d6b21a5e352a7fd..f17ef44bc02e97ff084e5abfde8d6c6822f00d62 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -376,6 +376,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -386,6 +386,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder @Nullable public Location getPotentialBedLocation(); // Paper end diff --git a/patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch index cb116f6d63..a3ca91d1fe 100644 --- a/patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch +++ b/patches/api/0391-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 27187efdbcf1cf20a53175f1177c16dc40acab3c..aa2c3c4648844908b2699f6f220393f98836ed5d 100644 +index 4febec3623b936cf40daba6196392ebce4b8d5a8..c689003cbec3936a8e02829f0fdfa0e7989df6ee 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1052,5 +1052,23 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource - * @param hurtDirection hurt direction +@@ -1054,5 +1054,23 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ + @Deprecated void setHurtDirection(float hurtDirection); + + /** diff --git a/patches/api/0392-Add-entity-knockback-API.patch b/patches/api/0392-Add-entity-knockback-API.patch index 4f7f54130d..8e317abb42 100644 --- a/patches/api/0392-Add-entity-knockback-API.patch +++ b/patches/api/0392-Add-entity-knockback-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add entity knockback API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index aa2c3c4648844908b2699f6f220393f98836ed5d..f5a4160afb75549dd56a237cf99ec733efef9b4c 100644 +index c689003cbec3936a8e02829f0fdfa0e7989df6ee..454376eada83adc3c7c83a7b720500f998f5593d 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1070,5 +1070,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1072,5 +1072,17 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource this.swingOffHand(); } } diff --git a/patches/api/0399-ItemStack-damage-API.patch b/patches/api/0399-ItemStack-damage-API.patch index 27cedcf655..25ee0fdd86 100644 --- a/patches/api/0399-ItemStack-damage-API.patch +++ b/patches/api/0399-ItemStack-damage-API.patch @@ -8,10 +8,10 @@ to simulate damage done to an itemstack and all the logic associated with damaging them diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f5a4160afb75549dd56a237cf99ec733efef9b4c..efcf093bc908a3a5711a06e579503100514f57aa 100644 +index 454376eada83adc3c7c83a7b720500f998f5593d..329ca07b6e166729d33446c4cd1ae19e09b7f444 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1082,5 +1082,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1084,5 +1084,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param directionZ The relative z position of the knockback source direction */ void knockback(double strength, double directionX, double directionZ); diff --git a/patches/api/0414-Add-Entity-Body-Yaw-API.patch b/patches/api/0414-Add-Entity-Body-Yaw-API.patch index ffe913f4aa..4542de2788 100644 --- a/patches/api/0414-Add-Entity-Body-Yaw-API.patch +++ b/patches/api/0414-Add-Entity-Body-Yaw-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Entity Body Yaw API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index df91f612978dcea83a99f8403820cea1ab462c06..d045f41d929c6101060caf3a9fb48c8ffc036f16 100644 +index 3f35fc2e2311c6c568afd2ed9896584e1ebb716f..059dfc40edc6c52f95a30e9ac72f45b6aaf5f9a8 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -1129,5 +1129,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -1131,5 +1131,21 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param amount the amount of damage to do */ void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount); diff --git a/patches/server/0006-MC-Dev-fixes.patch b/patches/server/0006-MC-Dev-fixes.patch index 1f1f827aa2..92b19f7969 100644 --- a/patches/server/0006-MC-Dev-fixes.patch +++ b/patches/server/0006-MC-Dev-fixes.patch @@ -52,6 +52,19 @@ index 396d065805853318b0fed98b64b2e1ab0a022e51..a969cd46694ce3094b4a65cf188677d3 return registry; } +diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java +index c4c1fc4e082d4d35327735e0704ada4e96195db2..a30fa3d54b70ab63d24dd67a69f39742335aff1e 100644 +--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java ++++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java +@@ -335,7 +335,7 @@ public enum ConnectionProtocol implements BundlerInfo.Provider { + + public void listAllPackets(Consumer>> consumer) { + this.classToId.keySet().stream().filter((type) -> { +- return type != BundleDelimiterPacket.class; ++ return !type.equals(BundleDelimiterPacket.class); // Paper - fix of some kind + }).forEach(consumer); + this.extraClasses.forEach(consumer); + } diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java index 9ff8afe750bc469c11c70b2f44c8a78887a8cd00..ea30dad0134644a8ad292a892450404203f3535e 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java diff --git a/patches/server/0041-Disable-explosion-knockback.patch b/patches/server/0041-Disable-explosion-knockback.patch index 8729cc73c2..aef40b8672 100644 --- a/patches/server/0041-Disable-explosion-knockback.patch +++ b/patches/server/0041-Disable-explosion-knockback.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Disable explosion knockback diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index aa34f59f7ffaa40fb43b6784361c0f7edb0461c5..38495e221f0b0584ec8fcd04cd6cd98c2cfa9d10 100644 +index aa34f59f7ffaa40fb43b6784361c0f7edb0461c5..4dcaaa2c10966b975d612de8453af7a7f1c32b16 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1405,10 +1405,12 @@ public abstract class LivingEntity extends Entity implements Attackable { } } -+ boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.isExplosion() && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback ++ boolean knockbackCancelled = level.paperConfig().environment.disableExplosionKnockback && source.is(DamageTypeTags.IS_EXPLOSION) && this instanceof net.minecraft.world.entity.player.Player; // Paper - Disable explosion knockback if (flag1) { if (flag) { this.level.broadcastEntityEvent(this, (byte) 29); diff --git a/patches/server/0143-Basic-PlayerProfile-API.patch b/patches/server/0143-Basic-PlayerProfile-API.patch index 77f0133203..e8d4892776 100644 --- a/patches/server/0143-Basic-PlayerProfile-API.patch +++ b/patches/server/0143-Basic-PlayerProfile-API.patch @@ -631,7 +631,7 @@ index 4038bb76339d43f18770624bd7fecc79b8d7f2a9..2456edc11b29a92b1648937cd3dd6a9a String s1 = name.toLowerCase(Locale.ROOT); GameProfileCache.GameProfileInfo usercache_usercacheentry = (GameProfileCache.GameProfileInfo) this.profilesByName.get(s1); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 39e51bbc941b7381c901304d69758b2bca2f02d1..3b110b947b13f1d3bec1e48e1abf530c425bb043 100644 +index 39e51bbc941b7381c901304d69758b2bca2f02d1..21ca43d22bd9d09bdb03107eec568eb9208ea948 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -252,6 +252,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -680,7 +680,7 @@ index 39e51bbc941b7381c901304d69758b2bca2f02d1..3b110b947b13f1d3bec1e48e1abf530c + Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null); + if (player == null) return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name); + -+ if (Objects.equals(uuid, player.getUniqueId()) && Objects.equals(name, player.getName())) { ++ if (java.util.Objects.equals(uuid, player.getUniqueId()) && java.util.Objects.equals(name, player.getName())) { + return new com.destroystokyo.paper.profile.CraftPlayerProfile((CraftPlayer) player); + } + diff --git a/patches/server/0169-AsyncTabCompleteEvent.patch b/patches/server/0169-AsyncTabCompleteEvent.patch index 5ebf4a098b..544db3c891 100644 --- a/patches/server/0169-AsyncTabCompleteEvent.patch +++ b/patches/server/0169-AsyncTabCompleteEvent.patch @@ -16,7 +16,7 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e2e640149913db7951d5c90c084bdb24f9257e8b..2985032eb3e97653f96fdbc7a4e986b0f9f15983 100644 +index bc72f5380c49c0d389e53d270165d4108a3bb901..ec1aa8d5fbfdafc35948a04f4d8d65e879853ff0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -778,12 +778,16 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic @@ -91,7 +91,7 @@ index e2e640149913db7951d5c90c084bdb24f9257e8b..2985032eb3e97653f96fdbc7a4e986b0 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3b110b947b13f1d3bec1e48e1abf530c425bb043..60eded2e31c5f353980e574e863e3ad0397c57b1 100644 +index 21ca43d22bd9d09bdb03107eec568eb9208ea948..f3d3d5c4a3668000be67128a5b7bd953e5bc2c48 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2095,7 +2095,7 @@ public final class CraftServer implements Server { @@ -99,7 +99,7 @@ index 3b110b947b13f1d3bec1e48e1abf530c425bb043..60eded2e31c5f353980e574e863e3ad0 } - TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers); -+ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? io.papermc.paper.util.MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), new BlockPos(pos)) : null); // Paper ++ TabCompleteEvent tabEvent = new TabCompleteEvent(player, message, offers, message.startsWith("/") || forceCommand, pos != null ? io.papermc.paper.util.MCUtil.toLocation(((CraftWorld) player.getWorld()).getHandle(), BlockPos.containing(pos)) : null); // Paper this.getPluginManager().callEvent(tabEvent); return tabEvent.isCancelled() ? Collections.EMPTY_LIST : tabEvent.getCompletions(); diff --git a/patches/server/0285-Prevent-rayTrace-from-loading-chunks.patch b/patches/server/0285-Prevent-rayTrace-from-loading-chunks.patch index f8dd056a7d..c3321b949b 100644 --- a/patches/server/0285-Prevent-rayTrace-from-loading-chunks.patch +++ b/patches/server/0285-Prevent-rayTrace-from-loading-chunks.patch @@ -7,7 +7,7 @@ ray tracing into an unloaded chunk should be treated as a miss this saves a ton of lag for when AI tries to raytrace near unloaded chunks. diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index 42e05380a875c52cd6e1cb337958b431a751698b..411d6c3466337c8322dbbba1a10c3e205bff3c63 100644 +index 42e05380a875c52cd6e1cb337958b431a751698b..5ed0dbed49db210e54cf2ece3e8605feb956bc69 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -75,7 +75,15 @@ public interface BlockGetter extends LevelHeightAccessor { @@ -21,7 +21,7 @@ index 42e05380a875c52cd6e1cb337958b431a751698b..411d6c3466337c8322dbbba1a10c3e20 + // copied the last function parameter (listed below) + Vec3 vec3d = raytrace1.getFrom().subtract(raytrace1.getTo()); + -+ return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), new BlockPos(raytrace1.getTo())); ++ return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo())); + } + // Paper end FluidState fluid = this.getFluidState(blockposition); diff --git a/patches/server/0517-Expose-LivingEntity-hurt-direction.patch b/patches/server/0517-Expose-LivingEntity-hurt-direction.patch index 90df709901..738222a620 100644 --- a/patches/server/0517-Expose-LivingEntity-hurt-direction.patch +++ b/patches/server/0517-Expose-LivingEntity-hurt-direction.patch @@ -4,8 +4,39 @@ Date: Sun, 13 Dec 2020 05:32:05 +0200 Subject: [PATCH] Expose LivingEntity hurt direction +diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java +index a7dc305297d1a17291ffff40fe6c3bd7b8cc6bdb..ddaeedbcce43f29cfc9f8a438a7304e8f0b2430e 100644 +--- a/src/main/java/net/minecraft/world/entity/player/Player.java ++++ b/src/main/java/net/minecraft/world/entity/player/Player.java +@@ -181,7 +181,7 @@ public abstract class Player extends LivingEntity { + private Optional lastDeathLocation; + @Nullable + public FishingHook fishing; +- protected float hurtDir; ++ public float hurtDir; // Paper - protected -> public + // Paper start + public boolean affectsSpawning = true; + // Paper end +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +index 0117277db8402a1673c317673811c17d02edc4c9..539708d5d806c757305bee754d9a4f0de49a742f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +@@ -125,6 +125,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { + } + } + ++ // Paper start ++ @Override ++ public void setHurtDirection(float hurtDirection) { ++ this.getHandle().hurtDir = hurtDirection; ++ } ++ // Paper end ++ + @Override + public int getSleepTicks() { + return this.getHandle().sleepCounter; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a95825e88ba31c255292451532d18a23c8d502cb..bec679a287ac26b6413b9d0b90a6758b905ecde6 100644 +index a95825e88ba31c255292451532d18a23c8d502cb..7204d2b542d8454fe12cce1ff049363045d4f5e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -913,5 +913,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -15,12 +46,12 @@ index a95825e88ba31c255292451532d18a23c8d502cb..bec679a287ac26b6413b9d0b90a6758b + + @Override + public float getHurtDirection() { -+ return getHandle().hurtDir; ++ return this.getHandle().getHurtDir(); + } + + @Override + public void setHurtDirection(float hurtDirection) { -+ getHandle().hurtDir = hurtDirection; ++ throw new UnsupportedOperationException("Cannot set the hurt direction on a non player"); + } // Paper end } diff --git a/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch b/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch index 8235d20096..912cccddf2 100644 --- a/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch +++ b/patches/server/0594-add-isDeeplySleeping-to-HumanEntity.patch @@ -5,15 +5,14 @@ Subject: [PATCH] add isDeeplySleeping to HumanEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 0117277db8402a1673c317673811c17d02edc4c9..73d8f4af09689eb549047bf1fa79254cc7736158 100644 +index 539708d5d806c757305bee754d9a4f0de49a742f..dd25a8d27e780969425a38e5a83ab1528c6f6089 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -125,6 +125,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - } +@@ -132,6 +132,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } + // Paper end + // Paper start -+ @Override + public boolean isDeeplySleeping() { + return getHandle().isSleepingLongEnough(); + } diff --git a/patches/server/0619-More-Enchantment-API.patch b/patches/server/0619-More-Enchantment-API.patch index df85d12776..ed087b154b 100644 --- a/patches/server/0619-More-Enchantment-API.patch +++ b/patches/server/0619-More-Enchantment-API.patch @@ -66,12 +66,12 @@ index 57decf4156f176ebcc988478c17856cbc555c5e4..3d0ce0803e1da8a2681a3cb41096ac94 public net.minecraft.world.item.enchantment.Enchantment getHandle() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 44df0768689309cc492c101f97cafcd59081809d..d896d7089baa9c7975fc8785093e9ffd43beae39 100644 +index 37148ccf704dd8e5aa7d9ab100e6df142e822255..b38d72e921c4705cae72eb65113b36c87e4250fd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -930,5 +930,21 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setHurtDirection(float hurtDirection) { - getHandle().hurtDir = hurtDirection; + throw new UnsupportedOperationException("Cannot set the hurt direction on a non player"); } + + public static MobType fromBukkitEntityCategory(EntityCategory entityCategory) { diff --git a/patches/server/0711-Don-t-lookup-fluid-state-when-raytracing.patch b/patches/server/0711-Don-t-lookup-fluid-state-when-raytracing.patch index 6fe79e146a..4729a1cc96 100644 --- a/patches/server/0711-Don-t-lookup-fluid-state-when-raytracing.patch +++ b/patches/server/0711-Don-t-lookup-fluid-state-when-raytracing.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Don't lookup fluid state when raytracing Just use the iblockdata already retrieved, removes a getType call. diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index 411d6c3466337c8322dbbba1a10c3e205bff3c63..576a53fbb46d4e4a590725e25eebee015e81ecad 100644 +index 5ed0dbed49db210e54cf2ece3e8605feb956bc69..77386f6c4932df80f91fc01358014239ffea43ba 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -84,7 +84,7 @@ public interface BlockGetter extends LevelHeightAccessor { - return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), new BlockPos(raytrace1.getTo())); + return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo())); } // Paper end - FluidState fluid = this.getFluidState(blockposition); diff --git a/patches/server/0714-Do-not-run-raytrace-logic-for-AIR.patch b/patches/server/0714-Do-not-run-raytrace-logic-for-AIR.patch index 75a039eae5..6c36a9552b 100644 --- a/patches/server/0714-Do-not-run-raytrace-logic-for-AIR.patch +++ b/patches/server/0714-Do-not-run-raytrace-logic-for-AIR.patch @@ -9,11 +9,11 @@ easy win. The remaining problems with this function are mostly with the block getting itself. diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java -index 576a53fbb46d4e4a590725e25eebee015e81ecad..64db14a5070229d38f453269c36f1199721b87fb 100644 +index 77386f6c4932df80f91fc01358014239ffea43ba..2ee9e8e3c1a28c1823de8e1fe421cc1f3e72f384 100644 --- a/src/main/java/net/minecraft/world/level/BlockGetter.java +++ b/src/main/java/net/minecraft/world/level/BlockGetter.java @@ -84,6 +84,7 @@ public interface BlockGetter extends LevelHeightAccessor { - return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), new BlockPos(raytrace1.getTo())); + return BlockHitResult.miss(raytrace1.getTo(), Direction.getNearest(vec3d.x, vec3d.y, vec3d.z), BlockPos.containing(raytrace1.getTo())); } // Paper end + if (iblockdata.isAir()) return null; // Paper - optimise air cases diff --git a/patches/server/0754-Add-player-health-update-API.patch b/patches/server/0754-Add-player-health-update-API.patch index 93686070ed..f0db4bf525 100644 --- a/patches/server/0754-Add-player-health-update-API.patch +++ b/patches/server/0754-Add-player-health-update-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add player health update API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 8f88d8a6f05d0f021608a035a39354ad480150f4..c1c8b73f91655e2a3a6d4706559a31dc5f5fecc3 100644 +index 8f88d8a6f05d0f021608a035a39354ad480150f4..3a870ba7c66340ac47e6f6445cf99542d41415c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2334,9 +2334,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -22,18 +22,16 @@ index 8f88d8a6f05d0f021608a035a39354ad480150f4..c1c8b73f91655e2a3a6d4706559a31dc if (this.getHandle().queueHealthUpdatePacket) { this.getHandle().queuedHealthUpdatePacket = packet; } else { -@@ -2344,7 +2346,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } +@@ -2345,6 +2347,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end } -- -+ + + @Override + public void sendHealthUpdate() { + this.sendHealthUpdate(this.getScaledHealth(), this.getHandle().getFoodData().getFoodLevel(), this.getHandle().getFoodData().getSaturationLevel()); + } + // Paper end -+ ++ public void injectScaledMaxHealth(Collection collection, boolean force) { if (!this.scaledHealth && !force) { return; diff --git a/patches/server/0858-Add-Player-getFishHook.patch b/patches/server/0858-Add-Player-getFishHook.patch index 5870dbdcdc..54986e6ae0 100644 --- a/patches/server/0858-Add-Player-getFishHook.patch +++ b/patches/server/0858-Add-Player-getFishHook.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Player#getFishHook diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 73d8f4af09689eb549047bf1fa79254cc7736158..d69c05223fca71fc5e282095d02bc39fee7ec757 100644 +index dd25a8d27e780969425a38e5a83ab1528c6f6089..e54833a19fb0d8e530fce202d998287c02961b35 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -153,6 +153,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -159,6 +159,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { return new Location(worldServer.getWorld(), bed.getX(), bed.getY(), bed.getZ()); } // Paper end diff --git a/patches/server/0945-Flying-Fall-Damage.patch b/patches/server/0945-Flying-Fall-Damage.patch index 207613f606..a50b9caea9 100644 --- a/patches/server/0945-Flying-Fall-Damage.patch +++ b/patches/server/0945-Flying-Fall-Damage.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Flying Fall Damage diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java -index 11c6fc510ae03005060782a675ed1cd370a07596..922dd1f4bc5975aa1a3cdc76fa2979c68c9df1dc 100644 +index 48e116d3b3c1629c8cd6e2e8daa43afa40e5ff4c..2b02800666b358159c8ecb63208a14855f90657b 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -184,6 +184,7 @@ public abstract class Player extends LivingEntity { - protected float hurtDir; + public float hurtDir; // Paper - protected -> public // Paper start public boolean affectsSpawning = true; + public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; @@ -26,7 +26,7 @@ index 11c6fc510ae03005060782a675ed1cd370a07596..922dd1f4bc5975aa1a3cdc76fa2979c6 } else { if (fallDistance >= 2.0F) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c3c4bc73310993f3a92d8aa171289fc61da8949f..974509844a004690f52b751f23dd1159bfa23b62 100644 +index a63060b91aa5cee9f4c6bf141fc2ae6d8a77a0fe..d06f2b6313eadf196b2e1fdc2310e4fd6c50321a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2281,6 +2281,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0952-Fix-force-opening-enchantment-tables.patch b/patches/server/0952-Fix-force-opening-enchantment-tables.patch index 8f0bd48367..425f04f634 100644 --- a/patches/server/0952-Fix-force-opening-enchantment-tables.patch +++ b/patches/server/0952-Fix-force-opening-enchantment-tables.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix force-opening enchantment tables diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index d69c05223fca71fc5e282095d02bc39fee7ec757..11a06cd0a9cee01107941a2294fbcb493a11ab63 100644 +index e54833a19fb0d8e530fce202d998287c02961b35..1eb7a9732a270bd501e22a36230fe49b02a91fba 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -396,7 +396,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -402,7 +402,18 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // If there isn't an enchant table we can force create one, won't be very useful though. BlockPos pos = new BlockPos(location.getBlockX(), location.getBlockY(), location.getBlockZ()); diff --git a/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch b/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch index 824266cdb6..9e2c1a3e4b 100644 --- a/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch +++ b/patches/server/0958-Fix-HumanEntity-drop-not-updating-the-client-inv.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Fix HumanEntity#drop not updating the client inv public net.minecraft.server.level.ServerPlayer containerSynchronizer diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 11a06cd0a9cee01107941a2294fbcb493a11ab63..e54574c60c5cbc4e083c4ca11e0b7dd49bd03478 100644 +index 1eb7a9732a270bd501e22a36230fe49b02a91fba..06efb7230f56ed1f5440b40f7032573ec817cef8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -749,8 +749,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -755,8 +755,15 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // Paper end @Override public boolean dropItem(boolean dropAll) {