More patches for 1.14
Chunk related stuff will need to be revisted later
This commit is contained in:
@@ -5,13 +5,13 @@ Subject: [PATCH] Shoulder Entities Release API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 23e7cdfe88..298012f37c 100644
|
||||
index 5df763d92..0f8100a05 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ public Entity releaseLeftShoulderEntity() {
|
||||
+ Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityLeft());
|
||||
@@ -20,9 +20,7 @@ index 23e7cdfe88..298012f37c 100644
|
||||
+ }
|
||||
+ return entity;
|
||||
+ }
|
||||
|
||||
- private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean
|
||||
- if (!this.world.isClientSide && !nbttagcompound.isEmpty()) {
|
||||
+
|
||||
+ public Entity releaseRightShoulderEntity() {
|
||||
+ Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityRight());
|
||||
+ if (entity != null) {
|
||||
@@ -31,38 +29,37 @@ index 23e7cdfe88..298012f37c 100644
|
||||
+ return entity;
|
||||
+ }
|
||||
+
|
||||
+ // Paper - incase any plugins used NMS to call this... old method signature to avoid other diff
|
||||
+ private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) {
|
||||
+ // Paper - maintain old signature
|
||||
private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean
|
||||
- if (!this.world.isClientSide && !nbttagcompound.isEmpty()) {
|
||||
+ return spawnEntityFromShoulder0(nbttagcompound) != null;
|
||||
+ }
|
||||
+ // Paper - Moved to new method that now returns entity, and properly null checks
|
||||
+ private Entity spawnEntityFromShoulder0(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean - Paper - return Entity
|
||||
+ if (!this.world.isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) { // Paper - null check
|
||||
Entity entity = EntityTypes.a(nbttagcompound, this.world);
|
||||
+ if (entity == null) { // Paper - null check
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ // Paper - return entity
|
||||
+ private Entity spawnEntityFromShoulder0(@Nullable NBTTagCompound nbttagcompound) {
|
||||
+ if (!this.world.isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) {
|
||||
return EntityTypes.a(nbttagcompound, this.world).map((entity) -> { // CraftBukkit
|
||||
if (entity instanceof EntityTameableAnimal) {
|
||||
((EntityTameableAnimal) entity).setOwnerUUID(this.uniqueID);
|
||||
}
|
||||
|
||||
if (entity instanceof EntityTameableAnimal) {
|
||||
((EntityTameableAnimal) entity).setOwnerUUID(this.uniqueID);
|
||||
}
|
||||
|
||||
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
|
||||
- return this.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
||||
+ if (this.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY)) { // CraftBukkit
|
||||
+ return entity;
|
||||
+ }
|
||||
entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ);
|
||||
- return ((WorldServer) this.world).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
||||
- }).orElse(true); // CraftBukkit
|
||||
+ boolean addedToWorld = ((WorldServer) this.world).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
||||
+ return addedToWorld ? entity : null;
|
||||
+ }).orElse(null); // CraftBukkit // Paper - false -> null
|
||||
}
|
||||
|
||||
- return true; // CraftBukkit
|
||||
+ return null;
|
||||
+ return null; // Paper - return null
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
public abstract boolean isSpectator();
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
index 79d1255676..d5dbc4ca81 100644
|
||||
index a7b495c7a..c2b6e792a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
|
||||
Reference in New Issue
Block a user