mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
ItemStack.asBukkitStack(null) should return Air. Fixes BUKKIT-3170
This commit is contained in:
parent
0f4c206f9b
commit
d20d4dc43a
@ -1,10 +1,9 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.EntityItemFrame;
|
||||
import net.minecraft.server.ItemStack;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import org.bukkit.Rotation;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
@ -26,8 +25,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
||||
}
|
||||
|
||||
public org.bukkit.inventory.ItemStack getItem() {
|
||||
ItemStack i = getHandle().i();
|
||||
return i == null ? new org.bukkit.inventory.ItemStack(Material.AIR) : CraftItemStack.asBukkitStack(i);
|
||||
return CraftItemStack.asBukkitStack(getHandle().i());
|
||||
}
|
||||
|
||||
public Rotation getRotation() {
|
||||
|
@ -242,6 +242,9 @@ public class CraftItemStack extends ItemStack {
|
||||
* Copies the NMS stack to return as a strictly-Bukkit stack
|
||||
*/
|
||||
public static ItemStack asBukkitStack(net.minecraft.server.ItemStack original) {
|
||||
if (original == null) {
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
ItemStack stack = new ItemStack(original.id, original.count, (short) original.getData());
|
||||
stack.addUnsafeEnchantments(getEnchantments(original));
|
||||
return stack;
|
||||
|
Loading…
Reference in New Issue
Block a user