use of net.minecraft.server.v1_16_R2.ItemStack in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_8_R3 method dropItemAsPlayer.
@Override
public void dropItemAsPlayer(HumanEntity humanEntity, org.bukkit.inventory.ItemStack bukkitItem) {
EntityHuman entityHuman = ((CraftHumanEntity) humanEntity).getHandle();
ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
entityHuman.drop(itemStack, false);
}
use of net.minecraft.server.v1_16_R2.ItemStack in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_8_R3 method getChestName.
@Override
public String getChestName(org.bukkit.inventory.ItemStack itemStack) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tagCompound = nmsItem.getTag();
return tagCompound == null || !tagCompound.hasKey("chest-name") ? null : tagCompound.getString("chest-name");
}
use of net.minecraft.server.v1_16_R2.ItemStack in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_12_R1 method getChestName.
@Override
public String getChestName(org.bukkit.inventory.ItemStack itemStack) {
ItemStack nmsItem = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tagCompound = nmsItem.getTag();
return tagCompound == null || !tagCompound.hasKey("chest-name") ? null : tagCompound.getString("chest-name");
}
use of net.minecraft.server.v1_16_R2.ItemStack in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_12_R1 method deserialzeItem.
@Override
public org.bukkit.inventory.ItemStack deserialzeItem(String serialized) {
if (serialized.isEmpty())
return new org.bukkit.inventory.ItemStack(Material.AIR);
byte[] buff;
if (serialized.toCharArray()[0] == '*') {
buff = Base64.getDecoder().decode(serialized.substring(1));
} else {
buff = new BigInteger(serialized, 32).toByteArray();
}
ByteArrayInputStream inputStream = new ByteArrayInputStream(buff);
try {
NBTTagCompound nbtTagCompoundRoot = NBTCompressedStreamTools.a(new DataInputStream(inputStream));
ItemStack nmsItem = new ItemStack(nbtTagCompoundRoot);
return CraftItemStack.asBukkitCopy(nmsItem);
} catch (Exception ex) {
return null;
}
}
use of net.minecraft.server.v1_16_R2.ItemStack in project WildChests by BG-Software-LLC.
the class NMSAdapter_v1_12_R1 method dropItemAsPlayer.
@Override
public void dropItemAsPlayer(HumanEntity humanEntity, org.bukkit.inventory.ItemStack bukkitItem) {
EntityHuman entityHuman = ((CraftHumanEntity) humanEntity).getHandle();
ItemStack itemStack = CraftItemStack.asNMSCopy(bukkitItem);
entityHuman.drop(itemStack, false);
}
Aggregations