mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
d1a72eac31
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 1fc1020a PR-1049: Add MenuType API 8ae2e3be PR-1055: Expand riptiding API cac68bfb SPIGOT-7890: AttributeModifier#getUniqueId() doesn't match the UUID passed to its constructor 7004fcf2 SPIGOT-7886: Fix mistake in AttributeModifier UUID shim 1ac7f950 PR-1054: Add FireworkMeta#hasPower 4cfb565f SPIGOT-7873: Add powered state for skulls CraftBukkit Changes: bbb30e7a8 SPIGOT-7894: NPE when sending tile entity update ba21e9472 SPIGOT-7895: PlayerItemBreakEvent not firing 0fb24bbe0 SPIGOT-7875: Fix PlayerItemConsumeEvent cancellation causing client-side desync 815066449 SPIGOT-7891: Can't remove second ingredient of MerchantRecipe 45c206f2c PR-1458: Add MenuType API 19c8ef9ae SPIGOT-7867: Merchant instanceof AbstractVillager always returns false 4e006d28f PR-1468: Expand riptiding API bd8aded7d Ignore checks in CraftPlayerProfile for ResolvableProfile used in profile components 8679620b5 SPIGOT-7889: Fix tool component deserialisation without speed and/or correct-for-drops 8d5222691 SPIGOT-7882, PR-1467: Fix conversion of name in Profile Component to empty if it is missing 63f91669a SPIGOT-7887: Remove duplicate ProjectileHitEvent for fireballs 7070de8c8 SPIGOT-7878: Server#getLootTable does not return null on invalid loot table 060ee6cae SPIGOT-7876: Can't kick player or disconnect player in PlayerLoginEvent when checking for cookies 7ccb86cc0 PR-1465: Add FireworkMeta#hasPower 804ad6491 SPIGOT-7873: Add powered state for skulls f9610cdcb Improve minecart movement Spigot Changes: a759b629 Rebuild patches Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
98 lines
4.1 KiB
Diff
98 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Sat, 17 Jun 2017 15:18:30 -0400
|
|
Subject: [PATCH] Shoulder Entities Release API
|
|
|
|
|
|
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 7995a4626b3ed68234d468418408b9a8e179b6f6..362d75522aaa721e9fb1d12a149d0efec1ac17b1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1995,20 +1995,45 @@ public abstract class Player extends LivingEntity {
|
|
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public Entity releaseLeftShoulderEntity() {
|
|
+ Entity entity = this.respawnEntityOnShoulder0(this.getShoulderEntityLeft());
|
|
+ if (entity != null) {
|
|
+ this.setShoulderEntityLeft(new CompoundTag());
|
|
+ }
|
|
+ return entity;
|
|
+ }
|
|
+
|
|
+ public Entity releaseRightShoulderEntity() {
|
|
+ Entity entity = this.respawnEntityOnShoulder0(this.getShoulderEntityRight());
|
|
+ if (entity != null) {
|
|
+ this.setShoulderEntityRight(new CompoundTag());
|
|
+ }
|
|
+ return entity;
|
|
+ }
|
|
+ // Paper - maintain old signature
|
|
+
|
|
private boolean respawnEntityOnShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
|
- if (!this.level().isClientSide && !nbttagcompound.isEmpty()) {
|
|
+ return this.respawnEntityOnShoulder0(nbttagcompound) != null;
|
|
+ }
|
|
+
|
|
+ // Paper - return entity
|
|
+ private Entity respawnEntityOnShoulder0(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
|
+ if (!this.level().isClientSide && nbttagcompound != null && !nbttagcompound.isEmpty()) {
|
|
return EntityType.create(nbttagcompound, this.level()).map((entity) -> { // CraftBukkit
|
|
if (entity instanceof TamableAnimal) {
|
|
((TamableAnimal) entity).setOwnerUUID(this.uuid);
|
|
}
|
|
|
|
entity.setPos(this.getX(), this.getY() + 0.699999988079071D, this.getZ());
|
|
- return ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
|
- }).orElse(true); // CraftBukkit
|
|
+ boolean addedToWorld = ((ServerLevel) this.level()).addWithUUID(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
|
+ return addedToWorld ? entity : null;
|
|
+ }).orElse(null); // CraftBukkit // Paper - true -> null
|
|
}
|
|
|
|
- return true; // CraftBukkit
|
|
+ return null; // Paper - return null
|
|
}
|
|
+ // Paper end
|
|
|
|
@Override
|
|
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 a93895a6e656c25e819354ecf5c73ff4bae83675..f0efea03165039525a98dc30c34d876972d9fe71 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
@@ -520,6 +520,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|
this.getHandle().getCooldowns().addCooldown(CraftItemType.bukkitToMinecraft(material), ticks);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public org.bukkit.entity.Entity releaseLeftShoulderEntity() {
|
|
+ if (!getHandle().getShoulderEntityLeft().isEmpty()) {
|
|
+ Entity entity = getHandle().releaseLeftShoulderEntity();
|
|
+ if (entity != null) {
|
|
+ return entity.getBukkitEntity();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return null;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public org.bukkit.entity.Entity releaseRightShoulderEntity() {
|
|
+ if (!getHandle().getShoulderEntityRight().isEmpty()) {
|
|
+ Entity entity = getHandle().releaseRightShoulderEntity();
|
|
+ if (entity != null) {
|
|
+ return entity.getBukkitEntity();
|
|
+ }
|
|
+ }
|
|
+
|
|
+ return null;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public boolean discoverRecipe(NamespacedKey recipe) {
|
|
return this.discoverRecipes(Arrays.asList(recipe)) != 0;
|