mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) Upstream has released updates that appears 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: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
126 lines
3.8 KiB
Diff
126 lines
3.8 KiB
Diff
From 10036e2271d95fe3aad4c1f99ce26ce01983a28e Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 19 Dec 2017 16:28:32 -0500
|
|
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
|
|
|
|
Adds lots of information about why this orb exists.
|
|
|
|
Replaces isFromBottle() with logic that persists entity reloads too.
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/ExperienceOrb.java b/src/main/java/org/bukkit/entity/ExperienceOrb.java
|
|
index c286edfd8..dec70bbfa 100644
|
|
--- a/src/main/java/org/bukkit/entity/ExperienceOrb.java
|
|
+++ b/src/main/java/org/bukkit/entity/ExperienceOrb.java
|
|
@@ -1,5 +1,8 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable; // Paper
|
|
+
|
|
/**
|
|
* Represents an Experience Orb.
|
|
*/
|
|
@@ -18,4 +21,99 @@ public interface ExperienceOrb extends Entity {
|
|
* @param value Amount of experience
|
|
*/
|
|
public void setExperience(int value);
|
|
+
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Check if this orb was spawned from a {@link ThrownExpBottle}
|
|
+ *
|
|
+ * @return if orb was spawned from a bottle
|
|
+ * @deprecated Use getSpawnReason() == EXP_BOTTLE
|
|
+ */
|
|
+ @Deprecated
|
|
+ default boolean isFromBottle() {
|
|
+ return getSpawnReason() == SpawnReason.EXP_BOTTLE;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Reasons for why this Experience Orb was spawned
|
|
+ */
|
|
+ enum SpawnReason {
|
|
+ /**
|
|
+ * Spawned by a player dying
|
|
+ */
|
|
+ PLAYER_DEATH,
|
|
+ /**
|
|
+ * Spawned by an entity dying after being damaged by a player
|
|
+ */
|
|
+ ENTITY_DEATH,
|
|
+ /**
|
|
+ * Spawned by player using a furnace
|
|
+ */
|
|
+ FURNACE,
|
|
+ /**
|
|
+ * Spawned by player breeding animals
|
|
+ */
|
|
+ BREED,
|
|
+ /**
|
|
+ * Spawned by player trading with a villager
|
|
+ */
|
|
+ VILLAGER_TRADE,
|
|
+ /**
|
|
+ * Spawned by player fishing
|
|
+ */
|
|
+ FISHING,
|
|
+ /**
|
|
+ * Spawned by player breaking a block that gives experience points such as Diamond Ore
|
|
+ */
|
|
+ BLOCK_BREAK,
|
|
+ /**
|
|
+ * Spawned by Bukkit API
|
|
+ */
|
|
+ CUSTOM,
|
|
+ /**
|
|
+ * Spawned by a player throwing an experience points bottle
|
|
+ */
|
|
+ EXP_BOTTLE,
|
|
+ /**
|
|
+ * Spawned by a player using a grindstone
|
|
+ */
|
|
+ GRINDSTONE,
|
|
+ /**
|
|
+ * We do not know why it was spawned
|
|
+ */
|
|
+ UNKNOWN
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * If this experience orb was triggered to be spawned by
|
|
+ * an entity such as a player, due to events such as killing entity,
|
|
+ * breaking blocks, smelting in a furnace, etc, this will return the UUID
|
|
+ * of the entity that triggered this orb to drop.
|
|
+ *
|
|
+ * In the case of an entity being killed, this will be the killers UUID.
|
|
+ *
|
|
+ * @return UUID of the player that triggered this orb to drop, or null if unknown/no triggering entity
|
|
+ */
|
|
+ @Nullable java.util.UUID getTriggerEntityId();
|
|
+
|
|
+ /**
|
|
+ * If this experience orb was spawned in relation to another
|
|
+ * entity, such as a player or other living entity death, or breeding,
|
|
+ * return the source entity UUID.
|
|
+ *
|
|
+ * In the case of breeding, this will be the new baby entities UUID.
|
|
+ * In the case of an entity being killed, this will be the dead entities UUID.
|
|
+ *
|
|
+ * @return The UUID of the entity that sourced this experience orb
|
|
+ */
|
|
+ @Nullable java.util.UUID getSourceEntityId();
|
|
+
|
|
+ /**
|
|
+ * Gets the reason that this experience orb was spawned. For any case that we
|
|
+ * do not know, such as orbs spawned before this API was added, UNKNOWN is returned.
|
|
+ * @return The reason for this orb being spawned.
|
|
+ */
|
|
+ @NotNull
|
|
+ SpawnReason getSpawnReason();
|
|
+ // Paper end
|
|
}
|
|
--
|
|
2.21.0
|
|
|