Package net.glowstone.block.state

Examples of net.glowstone.block.state.GlowSkull


        }
    }

    @Override
    public GlowBlockState getState() {
        return new GlowSkull(block);
    }
View Full Code Here


        return new TESkull(chunk.getBlock(cx, cy, cz));
    }

    @Override
    public void afterPlace(GlowPlayer player, GlowBlock block, ItemStack holding) {
        GlowSkull skull = (GlowSkull) block.getState();
        skull.setSkullType(getType(holding.getDurability()));
        if (skull.getSkullType() == SkullType.PLAYER) {
            SkullMeta meta = (SkullMeta) holding.getItemMeta();
            if (meta != null) {
                skull.setOwner(meta.getOwner());
            }
        }
        MaterialData data = skull.getData();
        if (!(data instanceof Skull)) {
            warnMaterialData(Skull.class, data);
            return;
        }
        Skull skullData = (Skull) data;

        if (canRotate(skullData)) { // Can be rotated
            skull.setRotation(player.getFacing().getOppositeFace());
        }
        skull.update();
    }
View Full Code Here

        skull.update();
    }

    @Override
    public Collection<ItemStack> getDrops(GlowBlock block, ItemStack tool) {
        GlowSkull skull = (GlowSkull) block.getState();

        ItemStack drop = new ItemStack(Material.SKULL_ITEM, 1);
        if (skull.hasOwner()) {
            SkullMeta meta = (SkullMeta) drop.getItemMeta();
            meta.setOwner(skull.getOwner());
            drop.setItemMeta(meta);
        }
        drop.setDurability((short) skull.getSkullType().ordinal());

        return Arrays.asList(drop);
    }
View Full Code Here

TOP

Related Classes of net.glowstone.block.state.GlowSkull

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.