mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-10 18:38:18 +01:00
Use MONSTER_EGG in SpawnEggRefl
This commit is contained in:
parent
cdba518bae
commit
692e0adde4
@ -18,5 +18,10 @@
|
|||||||
<artifactId>NMSProvider</artifactId>
|
<artifactId>NMSProvider</artifactId>
|
||||||
<version>2.15.0</version>
|
<version>2.15.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@ -79,8 +79,7 @@ public class SpawnEggRefl {
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public ItemStack toItemStack(int amount) throws Exception {
|
public ItemStack toItemStack(int amount) throws Exception {
|
||||||
// TODO: Get off of the deprecated LEGACY material.
|
ItemStack item = new ItemStack(Material.MONSTER_EGG, amount);
|
||||||
ItemStack item = new ItemStack(Material.LEGACY_MONSTER_EGG, amount);
|
|
||||||
|
|
||||||
Class<?> craftItemStackClass = ReflUtil.getOBCClass("inventory.CraftItemStack");
|
Class<?> craftItemStackClass = ReflUtil.getOBCClass("inventory.CraftItemStack");
|
||||||
Method asNMSCopyMethod = ReflUtil.getMethodCached(craftItemStackClass, "asNMSCopy", ItemStack.class);
|
Method asNMSCopyMethod = ReflUtil.getMethodCached(craftItemStackClass, "asNMSCopy", ItemStack.class);
|
||||||
@ -123,7 +122,7 @@ public class SpawnEggRefl {
|
|||||||
public static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
|
public static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
|
||||||
if (item == null)
|
if (item == null)
|
||||||
throw new IllegalArgumentException("Item cannot be null");
|
throw new IllegalArgumentException("Item cannot be null");
|
||||||
if (item.getType() != Material.LEGACY_MONSTER_EGG)
|
if (item.getType() != Material.MONSTER_EGG)
|
||||||
throw new IllegalArgumentException("Item is not a monster egg");
|
throw new IllegalArgumentException("Item is not a monster egg");
|
||||||
|
|
||||||
Class<?> NMSItemStackClass = ReflUtil.getNMSClass("ItemStack");
|
Class<?> NMSItemStackClass = ReflUtil.getNMSClass("ItemStack");
|
||||||
|
Loading…
Reference in New Issue
Block a user