Search in sources :

Example 1 with GlowBanner

use of net.glowstone.block.state.GlowBanner in project Glowstone by GlowstoneMC.

the class BlockBanner method getDrops.

@Override
public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) {
    GlowBanner state = (GlowBanner) block.getState();
    ItemStack drop = new ItemStack(Material.BANNER, 1);
    BannerMeta meta = (BannerMeta) drop.getItemMeta();
    meta.setPatterns(state.getPatterns());
    drop.setItemMeta(meta);
    drop.setDurability(state.getBaseColor().getDyeData());
    return Arrays.asList(drop);
}
Also used : BannerMeta(org.bukkit.inventory.meta.BannerMeta) GlowBanner(net.glowstone.block.state.GlowBanner) ItemStack(org.bukkit.inventory.ItemStack)

Example 2 with GlowBanner

use of net.glowstone.block.state.GlowBanner in project Glowstone by GlowstoneMC.

the class BlockBanner method afterPlace.

@Override
public void afterPlace(GlowPlayer player, GlowBlock block, ItemStack holding, GlowBlockState oldState) {
    GlowBanner banner = (GlowBanner) block.getState();
    banner.setBaseColor(DyeColor.getByDyeData((byte) holding.getDurability()));
    BannerMeta meta = (BannerMeta) holding.getItemMeta();
    meta.setPatterns(meta.getPatterns());
    banner.update();
}
Also used : BannerMeta(org.bukkit.inventory.meta.BannerMeta) GlowBanner(net.glowstone.block.state.GlowBanner)

Aggregations

GlowBanner (net.glowstone.block.state.GlowBanner)2 BannerMeta (org.bukkit.inventory.meta.BannerMeta)2 ItemStack (org.bukkit.inventory.ItemStack)1