Package net.glowstone.block

Examples of net.glowstone.block.GlowBlockState


     * @param z the z-coordinate of this block
     * @param type the new type of this block
     * @param data the new data value of this block
     */
    public void setTypeAndRawData(World world, int x, int y, int z, Material type, int data) {
        final GlowBlockState state = (GlowBlockState) world.getBlockAt(x, y, z).getState();
        state.setType(type);
        state.setRawData((byte) data);
        blockStateMap.put(world.getBlockAt(x, y, z).getLocation(), state);
    }
View Full Code Here


            //revert(player, target);
            return;
        }

        // grab states and update block
        GlowBlockState oldState = target.getState(), newState = target.getState();
        placeBlock(player, newState, face, holding, clickedLoc);
        newState.update(true);

        // call blockPlace event
        BlockPlaceEvent event = new BlockPlaceEvent(target, oldState, against, holding, player, canBuild);
        EventFactory.callEvent(event);
        if (event.isCancelled() || !event.canBuild()) {
            oldState.update(true);
            return;
        }

        // play a sound effect
        // todo: vary sound effect based on block type
View Full Code Here

*/
public class BlockOpenable extends BlockType {

    @Override
    public boolean blockInteract(GlowPlayer player, GlowBlock block, BlockFace face, Vector clickedLoc) {
        GlowBlockState blockState = block.getState();
        MaterialData materialData = blockState.getData();
        if (materialData instanceof Openable) {
            Openable toOpen = (Openable) materialData;
            boolean wasOpen = toOpen.isOpen();
            toOpen.setOpen(!wasOpen);

            if (wasOpen) {
                onClosed(player, block, face, clickedLoc, blockState, materialData);
            } else {
                onOpened(player, block, face, clickedLoc, blockState, materialData);
            }

            blockState.update(true);
            return true;
        } else {
            warnMaterialData(Openable.class, materialData);
            return false;
        }
View Full Code Here

TOP

Related Classes of net.glowstone.block.GlowBlockState

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.