Use MONSTER_EGG in SpawnEggRefl

This commit is contained in:
md678685 2018-08-19 21:16:16 +01:00
parent b27a6b5b8e
commit c37d516980
2 changed files with 7 additions and 3 deletions

View File

@ -18,5 +18,10 @@
<artifactId>NMSProvider</artifactId>
<version>2.15.0</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -79,8 +79,7 @@ public class SpawnEggRefl {
*/
@SuppressWarnings("deprecation")
public ItemStack toItemStack(int amount) throws Exception {
// TODO: Get off of the deprecated LEGACY material.
ItemStack item = new ItemStack(Material.LEGACY_MONSTER_EGG, amount);
ItemStack item = new ItemStack(Material.MONSTER_EGG, amount);
Class<?> craftItemStackClass = ReflUtil.getOBCClass("inventory.CraftItemStack");
Method asNMSCopyMethod = ReflUtil.getMethodCached(craftItemStackClass, "asNMSCopy", ItemStack.class);
@ -123,7 +122,7 @@ public class SpawnEggRefl {
public static SpawnEggRefl fromItemStack(ItemStack item) throws Exception {
if (item == 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");
Class<?> NMSItemStackClass = ReflUtil.getNMSClass("ItemStack");