use of net.minecraft.server.v1_8_R3.ItemStack in project Denizen-For-Bukkit by DenizenScript.
the class Particle_v1_8_R3 method playFor.
@Override
public <T> void playFor(Player player, Location location, int count, Vector offset, double extra, T data) {
int[] dataArray;
if (data instanceof ItemStack) {
dataArray = new int[] { ((ItemStack) data).getType().getId(), ((ItemStack) data).getDurability() };
} else if (data instanceof MaterialData) {
dataArray = new int[] { ((MaterialData) data).getItemTypeId() + (((MaterialData) data).getData() << 12) };
}
PacketHelper_v1_8_R3.sendPacket(player, new PacketPlayOutWorldParticles(particle, true, (float) location.getX(), (float) location.getY(), (float) location.getZ(), (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), (float) extra, count));
}
use of net.minecraft.server.v1_8_R3.ItemStack in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_8_R3 method setSkullSkin.
@Override
public ItemStack setSkullSkin(ItemStack itemStack, PlayerProfile playerProfile) {
GameProfile gameProfile = new GameProfile(playerProfile.getUniqueId(), playerProfile.getName());
if (playerProfile.hasTexture()) {
gameProfile.getProperties().get("textures").clear();
if (playerProfile.getTextureSignature() != null) {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture(), playerProfile.getTextureSignature()));
} else {
gameProfile.getProperties().put("textures", new Property("textures", playerProfile.getTexture()));
}
}
net.minecraft.server.v1_8_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
tag.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameProfile));
nmsItemStack.setTag(tag);
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.minecraft.server.v1_8_R3.ItemStack in project Denizen-For-Bukkit by DenizenScript.
the class ItemHelper_v1_8_R3 method addNbtData.
@Override
public ItemStack addNbtData(ItemStack itemStack, String key, Tag value) {
net.minecraft.server.v1_8_R3.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound tag = nmsItemStack.hasTag() ? nmsItemStack.getTag() : new NBTTagCompound();
CompoundTag compound = CompoundTag_v1_8_R3.fromNMSTag(tag).createBuilder().put(key, value).build();
nmsItemStack.setTag(((CompoundTag_v1_8_R3) compound).toNMSTag());
return CraftItemStack.asBukkitCopy(nmsItemStack);
}
use of net.minecraft.server.v1_8_R3.ItemStack in project MyPet by xXKeyleXx.
the class IconMenuInventory method update.
@Override
public void update(IconMenu menu) {
for (int slot = 0; slot < size; slot++) {
IconMenuItem menuItem = menu.getOption(slot);
if (menuItem != null) {
ItemStack item = createItemStack(menuItem);
minecraftInventory.setItem(slot, item);
} else {
minecraftInventory.setItem(slot, ItemStack.a);
}
}
}
use of net.minecraft.server.v1_8_R3.ItemStack in project MyPet by xXKeyleXx.
the class EntityMyBlaze method handlePlayerInteraction.
public boolean handlePlayerInteraction(EntityHuman entityhuman) {
if (super.handlePlayerInteraction(entityhuman)) {
return true;
}
ItemStack itemStack = entityhuman.inventory.getItemInHand();
if (getOwner().equals(entityhuman) && itemStack != null && canUseItem()) {
if (getMyPet().isOnFire() && itemStack.getItem() == Items.GLASS_BOTTLE && itemStack.getData() == 0 && getOwner().getPlayer().isSneaking()) {
getMyPet().setOnFire(false);
makeSound("random.fizz", 1.0F, 1.0F);
if (!entityhuman.abilities.canInstantlyBuild) {
if (--itemStack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Items.GLASS_BOTTLE));
} else {
if (!entityhuman.inventory.pickup(new ItemStack(Items.GLASS_BOTTLE))) {
entityhuman.drop(new ItemStack(Items.GLASS_BOTTLE), true);
}
}
}
return true;
} else if (!getMyPet().isOnFire() && itemStack.getItem() == Items.FLINT_AND_STEEL && getOwner().getPlayer().isSneaking()) {
getMyPet().setOnFire(true);
makeSound("fire.ignite", 1.0F, 1.0F);
if (!entityhuman.abilities.canInstantlyBuild) {
itemStack.damage(1, entityhuman);
}
return true;
}
}
return false;
}
Aggregations