mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-26 09:42:06 -07:00
fix Phantom#setAnchorLocation(null)
This commit is contained in:
@@ -942,7 +942,7 @@
|
||||
EntityType<?> type = this.getType();
|
||||
ResourceLocation key = EntityType.getKey(type);
|
||||
- return type.canSerialize() && key != null ? key.toString() : null;
|
||||
+ return (type.canSerialize() || includeNonSaveable) && key != null ? key.toString() : null; // Paper - Raw entity serialization API
|
||||
+ return (type.canSerialize() || includeNonSaveable) ? key.toString() : null; // Paper - Raw entity serialization API
|
||||
}
|
||||
|
||||
protected abstract void readAdditionalSaveData(ValueInput input);
|
||||
|
@@ -1056,7 +1056,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
this.getHandle().registryAccess()
|
||||
);
|
||||
|
||||
tagValueOutput.putString(Entity.TAG_ID, this.getHandle().getEncodeId()); // todo NPE?
|
||||
tagValueOutput.putString(Entity.TAG_ID, this.getHandle().getEncodeId(true));
|
||||
this.getHandle().saveWithoutId(tagValueOutput);
|
||||
|
||||
return tagValueOutput.buildResult();
|
||||
|
@@ -789,6 +789,9 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
|
||||
@Override
|
||||
public void setShoulderEntityLeft(org.bukkit.entity.Entity entity) {
|
||||
if (entity != null) {
|
||||
Preconditions.checkArgument(((CraftEntity) entity).getHandle().getType().canSerialize(), "Cannot set entity of type %s as a shoulder entity", entity.getType().getKey());
|
||||
}
|
||||
this.getHandle().setShoulderEntityLeft(entity == null ? new CompoundTag() : ((CraftEntity) entity).save());
|
||||
if (entity != null) {
|
||||
entity.remove();
|
||||
@@ -812,6 +815,9 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
|
||||
@Override
|
||||
public void setShoulderEntityRight(org.bukkit.entity.Entity entity) {
|
||||
if (entity != null) {
|
||||
Preconditions.checkArgument(((CraftEntity) entity).getHandle().getType().canSerialize(), "Cannot set entity of type %s as a shoulder entity", entity.getType().getKey());
|
||||
}
|
||||
this.getHandle().setShoulderEntityRight(entity == null ? new CompoundTag() : ((CraftEntity) entity).save());
|
||||
if (entity != null) {
|
||||
entity.remove();
|
||||
|
@@ -50,7 +50,6 @@ public class CraftPhantom extends CraftMob implements Phantom, CraftEnemy {
|
||||
|
||||
@Override
|
||||
public void setAnchorLocation(Location location) {
|
||||
com.google.common.base.Preconditions.checkArgument(location != null, "location cannot be null");
|
||||
this.getHandle().anchorPoint = location == null ? null : CraftLocation.toBlockPosition(location);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user