Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
0fa2a949ae
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: 8503c3c9 #621: Add HumanEntity#getItemInUse and Material#getSlipperiness 248deb09 #622: Add methods to check if item is the breed item for an entity 2ce691d8 Clarify Player#breakBlock only works for blocks in the same world 5dcdd48e SPIGOT-6514: Small Dripleaf block data is missing half property cc9610b7 #619: Add Player#breakBlock() 862bc475 Fix bad merge of SPIGOT-6502 fix 989bb0c1 Downgrade SnakeYAML due to issues with comments parsing 1dff62ae Fix inverted visual fire docs CraftBukkit Changes: 40caacc8 SPIGOT-6526: World entities are not populated when plugin onEnable is called c9a92ad0 SPIGOT-6536: Marker position not set on spawn 20d3e57c #855: Add HumanEntity#getItemInUse and Material#getSlipperiness d9c69b44 SPIGOT-6529: Fix BundleMeta#setItems 8bd43be5 SPIGOT-6535: PlayerGameModeChangeEvent event incorrectly reports old gamemode 4ece3ff3 #856: Add methods to check if item is the breed item for an entity dd4bec5f Add additional validation to Player#breakBlock bc835ae6 SPIGOT-6532: Fix Entity#setGlowing 384e116e Restore 1.16.5 behaviour of InventoryDragEvent being called even when a single item is 'dragged' to its own slot b42e708c Fix new map colors rendering as transparent cfe7fecf SPIGOT-6524: Inventory desync when InventoryClickEvent is cancelled eeae1b19 SPIGOT-6522: ItemStack on cursor is always AIR 7490724d Fix missing PlayerEditBookEvent 06875f76 SPIGOT-6513: Placing ItemStack in Inventory causes InventoryAction.NOTHING 27835bde SPIGOT-6519: Fix end gateway teleports 4ac634ad SPIGOT-6515: "Un-waterlogging" throws UnsupportedOperationException in some cases da425fa2 SPIGOT-6518: Anvils falling onto dripstone can sometimes crash server 50530da9 SPIGOT-6514: Small Dripleaf block data is missing half property 6fdecf20 #853: Implement Player#breakBlock() 4db9c49f SPIGOT-6510: Bukkit#createMap throws NullPointerException 89e2b127 SPIGOT-6517: Spider jockey crash on dripstone cbf2f678 SPIGOT-6508: Rename conflicted getServer 74575d48 SPIGOT-6506: Fix crash with custom inventories a3df386f Fix NPE with Entity.getNearbyEntities d747f8ed Fix NPE with World.getNearbyEntities 4d2c7800 Fix second usage of worldGenSettings just in case 5182f923 SPIGOT-6504: Fix generating fresh worlds Spigot Changes: 66f9d3c1 Rebuild patches 191e4971 Rebuild patches a09c0bb6 Restore Spigot experience merging
97 Zeilen
4.1 KiB
Diff
97 Zeilen
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 73277b04a45444edce02cce3e033741ebaf2ad0c..075bbc75d2e33be3a42c6c3ec279eeeba6408333 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
|
@@ -1953,20 +1953,44 @@ public abstract class Player extends LivingEntity {
|
|
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public Entity releaseLeftShoulderEntity() {
|
|
+ Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityLeft());
|
|
+ if (entity != null) {
|
|
+ this.setShoulderEntityLeft(new CompoundTag());
|
|
+ }
|
|
+ return entity;
|
|
+ }
|
|
+
|
|
+ public Entity releaseRightShoulderEntity() {
|
|
+ Entity entity = this.spawnEntityFromShoulder0(this.getShoulderEntityRight());
|
|
+ if (entity != null) {
|
|
+ this.setShoulderEntityRight(new CompoundTag());
|
|
+ }
|
|
+ return entity;
|
|
+ }
|
|
+ // Paper - maintain old signature
|
|
private boolean spawnEntityFromShoulder(CompoundTag nbttagcompound) { // CraftBukkit void->boolean
|
|
- if (!this.level.isClientSide && !nbttagcompound.isEmpty()) {
|
|
+ return spawnEntityFromShoulder0(nbttagcompound) != null;
|
|
+ }
|
|
+
|
|
+ // Paper - return entity
|
|
+ private Entity spawnEntityFromShoulder0(@Nullable CompoundTag nbttagcompound) {
|
|
+ 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).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
|
- }).orElse(true); // CraftBukkit
|
|
+ boolean addedToWorld = ((ServerLevel) this.level).addEntitySerialized(entity, CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY); // CraftBukkit
|
|
+ return addedToWorld ? entity : null;
|
|
+ }).orElse(null); // CraftBukkit // Paper - false -> 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 2db149bf57c561d7f8f49341fbefafb5d3ecab54..bddfc12e8cf896bee5fb518ddacdca434456c6bb 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
|
|
@@ -500,6 +500,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
|
this.getHandle().getCooldowns().addCooldown(CraftMagicNumbers.getItem(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;
|