Search in sources :

Example 6 with ItemTable

use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.

the class BlockButton method extraUpdate.

private void extraUpdate(GlowBlock block) {
    Button button = (Button) block.getState().getData();
    ItemTable itemTable = ItemTable.instance();
    GlowBlock target = block.getRelative(button.getAttachedFace());
    if (target.getType().isSolid()) {
        for (BlockFace face2 : ADJACENT) {
            GlowBlock target2 = target.getRelative(face2);
            BlockType notifyType = itemTable.getBlock(target2.getTypeId());
            if (notifyType != null) {
                if (target2.getFace(block) == null) {
                    notifyType.onNearBlockChanged(target2, BlockFace.SELF, block, block.getType(), block.getData(), block.getType(), block.getData());
                }
                notifyType.onRedstoneUpdate(target2);
            }
        }
    }
}
Also used : GlowBlock(net.glowstone.block.GlowBlock) Button(org.bukkit.material.Button) ItemTable(net.glowstone.block.ItemTable) BlockFace(org.bukkit.block.BlockFace)

Example 7 with ItemTable

use of net.glowstone.block.ItemTable in project Glowstone by GlowstoneMC.

the class BlockRedstone method extraUpdate.

private void extraUpdate(GlowBlock block) {
    ItemTable itemTable = ItemTable.instance();
    for (BlockFace face : calculateConnections(block)) {
        GlowBlock target = block.getRelative(face);
        if (target.getType().isSolid()) {
            for (BlockFace face2 : ADJACENT) {
                GlowBlock target2 = target.getRelative(face2);
                BlockType notifyType = itemTable.getBlock(target2.getTypeId());
                if (notifyType != null) {
                    if (target2.getFace(block) == null) {
                        notifyType.onNearBlockChanged(target2, BlockFace.SELF, block, block.getType(), block.getData(), block.getType(), block.getData());
                    }
                    notifyType.onRedstoneUpdate(target2);
                }
            }
        }
    }
}
Also used : GlowBlock(net.glowstone.block.GlowBlock) ItemTable(net.glowstone.block.ItemTable) BlockFace(org.bukkit.block.BlockFace)

Aggregations

GlowBlock (net.glowstone.block.GlowBlock)7 ItemTable (net.glowstone.block.ItemTable)7 BlockFace (org.bukkit.block.BlockFace)5 BlockType (net.glowstone.block.blocktype.BlockType)2 Block (org.bukkit.block.Block)1 Button (org.bukkit.material.Button)1 Diode (org.bukkit.material.Diode)1 Lever (org.bukkit.material.Lever)1