Search in sources :

Example 1 with GlowBanner

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

the class BlockBanner method getDrops.

@NotNull
@Override
public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) {
    GlowBanner state = (GlowBanner) block.getState();
    ItemStack drop = new ItemStack(Material.LEGACY_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.entity.state.GlowBanner) ItemStack(org.bukkit.inventory.ItemStack) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with GlowBanner

use of net.glowstone.block.entity.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.entity.state.GlowBanner)

Aggregations

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