CustomBlockTexture.java 文件源码

java
阅读 31 收藏 0 点赞 0 评论 0

项目:SuperiorCraft 作者:
public ArmorStand placeBlock(Location l) {
    ArmorStand block = (ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
    block.setSmall(true);
    block.setGravity(false);
    block.setCustomName("CustomBlock");
    block.setCustomNameVisible(false);
    block.setInvulnerable(true);
    block.setVisible(false);
    block.setMarker(true);
    block.setSilent(true);

    ItemStack a = new ItemStack(Material.LEATHER_BOOTS);
    a.setDurability((short) primary.getTexture());
    LeatherArmorMeta am = (LeatherArmorMeta) a.getItemMeta();
    am.setColor(primary.getColor());
    am.setUnbreakable(true);
    if (primary.isGlowing()) {
        am.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
    }
    a.setItemMeta(am);
    block.setHelmet(a);

    if (secondary != null) {
        ItemStack b = new ItemStack(Material.LEATHER_BOOTS);
        b.setDurability((short) secondary.getTexture());
        LeatherArmorMeta bm = (LeatherArmorMeta) b.getItemMeta();
        bm.setColor(secondary.getColor());
        bm.setUnbreakable(true);
        if (secondary.isGlowing()) {
            System.out.println("H");
            bm.addEnchant(Enchantment.PROTECTION_ENVIRONMENTAL, 3, true);
        }
        b.setItemMeta(bm);
        block.getEquipment().setItemInMainHand(b);
    }

    return block;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号