Add missing rarity method on ItemStack (#5594)
This commit is contained in:
parent
aeb6e7dd25
commit
f50171f3bb
|
@ -86,3 +86,23 @@ index fafc4d63b6202b00a133c50cd38dec54db9b3576..6db8c3bae9c9bb10eedf8102b3ac4c6e
|
||||||
+ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
|
+ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(ItemStack itemStack);
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
|
index 58f99e3ebac9a01ebffe4d208e16cbee474d4aa3..3c64c6ef397af102a3e085fe6b77a888d5c3de84 100644
|
||||||
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||||
|
@@ -842,5 +842,15 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor
|
||||||
|
ItemMeta itemMeta = getItemMeta();
|
||||||
|
return itemMeta != null && itemMeta.hasItemFlag(flag);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Gets the item rarity of the itemstack. The rarity can change based on enchantements.
|
||||||
|
+ *
|
||||||
|
+ * @return the itemstack rarity
|
||||||
|
+ */
|
||||||
|
+ @NotNull
|
||||||
|
+ public io.papermc.paper.inventory.ItemRarity getRarity() {
|
||||||
|
+ return Bukkit.getUnsafe().getItemStackRarity(this);
|
||||||
|
+ }
|
||||||
|
// Paper end
|
||||||
|
}
|
||||||
|
|
|
@ -46,10 +46,10 @@ index 62d8b53c024888aa43b8fddf8a475dfb8284a4cc..2a61c24dd26edf4c72e977c6024fe233
|
||||||
this.die();
|
this.die();
|
||||||
return;
|
return;
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
||||||
index ac3709c8158d42ccafd457cfa44a16dc8c9eb949..d9765da72c614260fdba47e7d1add4145991f97c 100644
|
index 3fdafc0ff0c4148ec844dbdc1455d17cdcb4a75a..0d26250887f80d0c250bcd6bc7de303362427d3e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java
|
||||||
@@ -682,6 +682,7 @@ public abstract class BlockBase {
|
@@ -683,6 +683,7 @@ public abstract class BlockBase {
|
||||||
return this.getBlock().a(tag) && predicate.test(this);
|
return this.getBlock().a(tag) && predicate.test(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue