mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
tons of patches (#5835)
This commit is contained in:
31
patches/server/Item-Rarity-API.patch
Normal file
31
patches/server/Item-Rarity-API.patch
Normal file
@@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Fri, 12 Mar 2021 17:09:42 -0800
|
||||
Subject: [PATCH] Item Rarity API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||
public int nextEntityId() {
|
||||
return net.minecraft.world.entity.Entity.nextEntityId();
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.inventory.ItemRarity getItemRarity(org.bukkit.Material material) {
|
||||
+ Item item = getItem(material);
|
||||
+ if (item == null) {
|
||||
+ throw new IllegalArgumentException(material + " is not an item, and rarity does not apply to blocks");
|
||||
+ }
|
||||
+ return io.papermc.paper.inventory.ItemRarity.values()[item.rarity.ordinal()];
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public io.papermc.paper.inventory.ItemRarity getItemStackRarity(org.bukkit.inventory.ItemStack itemStack) {
|
||||
+ return io.papermc.paper.inventory.ItemRarity.values()[getItem(itemStack.getType()).getRarity(CraftItemStack.asNMSCopy(itemStack)).ordinal()];
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
/**
|
Reference in New Issue
Block a user