diff --git a/patches/api/Add-more-Witch-API.patch b/patches/api/Add-more-Witch-API.patch index 68b4b88b34..30caec73a6 100644 --- a/patches/api/Add-more-Witch-API.patch +++ b/patches/api/Add-more-Witch-API.patch @@ -48,7 +48,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @return The potion the witch is drinking + */ -+ @Nullable ItemStack getDrinkingPotion(); ++ @org.jetbrains.annotations.NotNull ++ ItemStack getDrinkingPotion(); + + /** + * Set the potion the Witch should drink diff --git a/patches/api/Add-villager-reputation-API.patch b/patches/api/Add-villager-reputation-API.patch index 70828a1a04..e1391e6d61 100644 --- a/patches/api/Add-villager-reputation-API.patch +++ b/patches/api/Add-villager-reputation-API.patch @@ -135,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param uniqueId The {@link UUID} of the player to get the reputation of. + * @return The player's copied reputation with this villager. + */ -+ @Nullable ++ @NotNull + public com.destroystokyo.paper.entity.villager.Reputation getReputation(@NotNull UUID uniqueId); + + /** diff --git a/patches/api/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch b/patches/api/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch index 7798907f76..6e6c50260d 100644 --- a/patches/api/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch +++ b/patches/api/EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return this.shouldConsumeItem(); + } + -+ @NotNull @Deprecated ++ @Nullable @Deprecated + public ItemStack getArrowItem() { + return this.getConsumable(); + } diff --git a/patches/api/Fix-Spigot-annotation-mistakes.patch b/patches/api/Fix-Spigot-annotation-mistakes.patch index 4bc451792a..737d2fa2bc 100644 --- a/patches/api/Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/Fix-Spigot-annotation-mistakes.patch @@ -795,6 +795,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Contract("null -> null") @Nullable public static EntityType fromName(@Nullable String name) { +diff --git a/src/main/java/org/bukkit/entity/ItemDisplay.java b/src/main/java/org/bukkit/entity/ItemDisplay.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/ItemDisplay.java ++++ b/src/main/java/org/bukkit/entity/ItemDisplay.java +@@ -0,0 +0,0 @@ public interface ItemDisplay extends Display { + * + * @return the displayed item stack + */ +- @Nullable ++ @NotNull // Paper + ItemStack getItemStack(); + + /** diff --git a/src/main/java/org/bukkit/entity/LightningStrike.java b/src/main/java/org/bukkit/entity/LightningStrike.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/LightningStrike.java @@ -885,6 +898,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Deprecated // Paper public MaterialData getDisplayBlock(); + /** +diff --git a/src/main/java/org/bukkit/entity/OminousItemSpawner.java b/src/main/java/org/bukkit/entity/OminousItemSpawner.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/OminousItemSpawner.java ++++ b/src/main/java/org/bukkit/entity/OminousItemSpawner.java +@@ -0,0 +0,0 @@ public interface OminousItemSpawner extends Entity { + * + * @return the item + */ +- @Nullable ++ @org.jetbrains.annotations.NotNull // Paper + ItemStack getItem(); + /** diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -939,6 +965,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -@Deprecated +@Deprecated(forRemoval = true) // Paper public interface SplashPotion extends ThrownPotion { } +diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/ZombieVillager.java ++++ b/src/main/java/org/bukkit/entity/ZombieVillager.java +@@ -0,0 +0,0 @@ public interface ZombieVillager extends Zombie { + * Sets the villager profession of this zombie. + */ + @Override +- void setVillagerProfession(@Nullable Villager.Profession profession); ++ void setVillagerProfession(@NotNull Villager.Profession profession); // Paper + + /** + * Returns the villager profession of this zombie. + * +- * @return the profession or null ++ * @return the profession + */ + @Override +- @Nullable ++ @NotNull // Paper + Villager.Profession getVillagerProfession(); + + /** diff --git a/src/main/java/org/bukkit/entity/memory/MemoryKey.java b/src/main/java/org/bukkit/entity/memory/MemoryKey.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/memory/MemoryKey.java diff --git a/patches/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch index e529e80968..08bc2d33bd 100644 --- a/patches/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -1020,21 +1020,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public org.bukkit.Location getAnchorLocation() { + net.minecraft.core.BlockPos pos = this.getHandle().anchorPoint; -+ if (pos == null) { -+ return null; -+ } -+ + return io.papermc.paper.util.MCUtil.toLocation(this.getHandle().level(), pos); + } + + @Override + public void setAnchorLocation(org.bukkit.Location location) { -+ net.minecraft.core.BlockPos pos = null; -+ if (location != null) { -+ pos = io.papermc.paper.util.MCUtil.toBlockPosition(location); -+ } -+ -+ this.getHandle().anchorPoint = pos; ++ com.google.common.base.Preconditions.checkArgument(location != null, "location cannot be null"); ++ this.getHandle().anchorPoint = io.papermc.paper.util.MCUtil.toBlockPosition(location); + } // Paper end } diff --git a/patches/server/More-Projectile-API.patch b/patches/server/More-Projectile-API.patch index 5000c2e60a..71c17f03c7 100644 --- a/patches/server/More-Projectile-API.patch +++ b/patches/server/More-Projectile-API.patch @@ -589,29 +589,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super(server, entity); } -- @Override ++ // Paper - moved to AbstractProjectile ++ ++ @Override ++ public org.bukkit.entity.Entity getTarget() { ++ return this.getHandle().getTarget() != null ? this.getHandle().getTarget().getBukkitEntity() : null; ++ } ++ + @Override - public ProjectileSource getShooter() { - return this.getHandle().projectileSource; -- } -- -- @Override ++ public void setTarget(org.bukkit.entity.Entity target) { ++ Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation"); ++ ++ this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle()); + } + + @Override - public void setShooter(ProjectileSource shooter) { - if (shooter instanceof Entity) { - this.getHandle().setOwner(((CraftEntity) shooter).getHandle()); - } else { - this.getHandle().setOwner(null); -- } -- this.getHandle().projectileSource = shooter; -- } -+ // Paper - moved to AbstractProjectile - - @Override - public org.bukkit.entity.Entity getTarget() { -@@ -0,0 +0,0 @@ public class CraftShulkerBullet extends AbstractProjectile implements ShulkerBul - this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle()); - } - -+ @Override + public org.bukkit.util.Vector getTargetDelta() { + net.minecraft.world.entity.projectile.ShulkerBullet bullet = this.getHandle(); + return new org.bukkit.util.Vector(bullet.targetDeltaX, bullet.targetDeltaY, bullet.targetDeltaZ); @@ -627,27 +626,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public org.bukkit.block.BlockFace getCurrentMovementDirection() { -+ return org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(this.getHandle().currentMoveDirection); -+ } -+ -+ @Override ++ net.minecraft.core.Direction dir = this.getHandle().currentMoveDirection; ++ if (dir == null) { ++ return null; // random dir + } +- this.getHandle().projectileSource = shooter; ++ return org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(dir); + } + + @Override +- public org.bukkit.entity.Entity getTarget() { +- return this.getHandle().getTarget() != null ? this.getHandle().getTarget().getBukkitEntity() : null; + public void setCurrentMovementDirection(org.bukkit.block.BlockFace movementDirection) { + this.getHandle().currentMoveDirection = org.bukkit.craftbukkit.block.CraftBlock.blockFaceToNotch(movementDirection); -+ } -+ -+ @Override + } + + @Override +- public void setTarget(org.bukkit.entity.Entity target) { +- Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation"); + public int getFlightSteps() { + return this.getHandle().flightSteps; + } -+ + +- this.getHandle().setTarget(target == null ? null : ((CraftEntity) target).getHandle()); + @Override + public void setFlightSteps(int steps) { + this.getHandle().flightSteps = steps; -+ } -+ + } + @Override - public String toString() { - return "CraftShulkerBullet"; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java