Swap some nullable annotations (#10960)

This commit is contained in:
Lulu13022002 2024-06-24 00:42:44 +02:00 committed by GitHub
parent 1d3fc0ee68
commit b99d071a36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 102 additions and 53 deletions

View file

@ -1009,10 +1009,10 @@ index 5467e4a74b70ff57b49d9e6bc686c493178f8511..01d104d91de9e1319d27e39d3f474318
public boolean isRolling() {
return this.getHandle().isRolling();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..8338effd39b1709dbe578e247710a8e58d83e3aa 100644
index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..83e77c6d287d8e239d2f55f3e9f19ef74946be7c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@@ -44,5 +44,25 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
@@ -44,5 +44,17 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
public void setShouldBurnInDay(boolean shouldBurnInDay) {
getHandle().setShouldBurnInDay(shouldBurnInDay);
}
@ -1020,21 +1020,13 @@ index 9304e201db1ec96d0916aa8ea781f3e4bc7991e6..8338effd39b1709dbe578e247710a8e5
+ @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
}