Java 类org.bukkit.material.Door 实例源码

项目:BlockLocker    文件:CompleteDoor.java   
private static BlockFace getFaceToRightDoor(Block bottomHalfDoorBlock) {
    Door door = asDoorMaterialOrNull(bottomHalfDoorBlock);
    if (door == null) {
        throw new RuntimeException("Block " + bottomHalfDoorBlock + " is not a door");
    }

    switch (door.getFacing()) {
        case WEST:
            return BlockFace.SOUTH;
        case NORTH:
            return BlockFace.WEST;
        case EAST:
            return BlockFace.NORTH;
        case SOUTH:
            return BlockFace.EAST;
        default:
            throw new RuntimeException("Invalid facing for door: " + door);
    }
}
项目:BlockLocker    文件:CompleteDoor.java   
/**
 * Opens or closes the door. If the door has been destroyed after creating
 *
 * @param open
 *            Whether the door must be opened (true) or closed (false).
 * @param soundAction
 *            Whether a sound must be played.
 */
public void setOpen(boolean open, SoundCondition soundAction) {
    Door leftDoor = asDoorMaterialOrNull(bottomLeftBlock);
    if (leftDoor != null) {
        // Sound effect
        playSound(bottomLeftBlock, open, soundAction);

        // Don't play sound for other half
        soundAction = SoundCondition.NEVER;

        // Door toggle
        leftDoor.setOpen(open);
        BlockData.set(bottomLeftBlock, leftDoor);
    }

    Door rightDoor = asDoorMaterialOrNull(bottomRightBlock);
    if (rightDoor != null) {
        // Sound effect
        playSound(bottomRightBlock, open, soundAction);

        // Door toggle
        rightDoor.setOpen(open);
        BlockData.set(bottomRightBlock, rightDoor);
    }
}
项目:modules-extra    文件:UseDoor.java   
@Override
public Text translateAction(User user)
{
    // TODO plurals
    @SuppressWarnings("deprecation") boolean open = this.newBlock.as(Door.class).isOpen();
    if (open)
    {
        return user.getTranslation(POSITIVE, "{user} opened the {name#block}", this.player.name,
                                   this.oldBlock.name());
    }
    else
    {
        return user.getTranslation(POSITIVE, "{user} closed the {name#block}", this.player.name,
                                   this.oldBlock.name());
    }
}
项目:remote-entities-nxt    文件:DoorOpenChecker.java   
@Override
public void checkMove(MoveData inData)
{
    if(inData.isValid())
        return;

    if(inData.getAboveBlock().getType() == Material.FENCE_GATE)
    {
        Gate g = (Gate)inData.getAboveBlock().getState().getData();
        if(g.isOpen())
            inData.setValid(true);
    }
    else if(inData.getAboveBlock().getType() == Material.WOOD_DOOR || (!this.m_ironDoor && inData.getAboveBlock().getType() == Material.IRON_DOOR_BLOCK))
    {
        Door d = (Door)inData.getAboveBlock().getState().getData();
        if(d.isOpen())
            inData.setValid(true);
    }
}
项目:EndHQ-Libraries    文件:DoorOpenChecker.java   
@Override
public void checkMove(MoveData inData)
{
    if(inData.isValid())
        return;

    if(inData.getAboveBlock().getType() == Material.FENCE_GATE)
    {
        Gate g = (Gate)inData.getAboveBlock().getState().getData();
        if(g.isOpen())
            inData.setValid(true);
    }
    else if(inData.getAboveBlock().getType() == Material.WOOD_DOOR || (!this.m_ironDoor && inData.getAboveBlock().getType() == Material.IRON_DOOR_BLOCK))
    {
        Door d = (Door)inData.getAboveBlock().getState().getData();
        if(d.isOpen())
            inData.setValid(true);
    }
}
项目:Transport-Pipes    文件:HitboxUtils.java   
/**
 * checks if this block would give a reaction if you click on it without
 * shifting, e.g. opening a chest or switching a lever
 */
public static boolean isInteractiveBlock(Block b) {
    if (b == null || b.getState() == null) {
        return false;
    }
    if (b.getType() == Material.WORKBENCH || b.getType() == Material.ENCHANTMENT_TABLE || b.getType() == Material.ANVIL || b.getType() == Material.BREWING_STAND || b.getState() instanceof InventoryHolder || b.getState() instanceof NoteBlock) {
        return true;
    }
    if (b.getState().getData() instanceof Button || b.getState().getData() instanceof Lever || b.getState().getData() instanceof Door || b.getState().getData() instanceof TrapDoor || b.getState().getData() instanceof Gate || b.getState().getData() instanceof Comparator) {
        if (b.getType() != Material.IRON_DOOR && b.getType() != Material.IRON_DOOR_BLOCK && b.getType() != Material.IRON_TRAPDOOR) {
            return true;
        }
    }
    return false;
}
项目:BlockLocker    文件:CompleteDoor.java   
private static Door asDoorMaterialOrNull(Block nullableBlock) {
    if (nullableBlock == null) {
        return null;
    }
    MaterialData materialData = BlockData.get(nullableBlock);
    if (materialData instanceof Door) {
        return (Door) materialData;
    }
    return null;
}
项目:BlockLocker    文件:CompleteDoor.java   
private static Hinge getHinge(Block topHalfDoorBlock) {
    Door door = asDoorMaterialOrNull(topHalfDoorBlock);
    if (door != null) {
        return door.getHinge() == false ? Hinge.LEFT : Hinge.RIGHT;
    }
    return Hinge.UNKNOWN;
}
项目:BlockLocker    文件:CompleteDoor.java   
private static boolean isTopHalf(Block doorBlock) {
    Door door = asDoorMaterialOrNull(doorBlock);
    if (door != null) {
        return door.isTopHalf();
    }
    return false;
}
项目:BlockLocker    文件:CompleteDoor.java   
/**
 * Gets whether the door is currently open. The result is undefined if the
 * door is half-open, half-closed.
 * 
 * @return True if the door is currently open, false otherwise.
 */
public boolean isOpen() {
    MaterialData materialData = null;
    if (bottomRightBlock != null) {
        materialData = BlockData.get(bottomRightBlock);
    }
    if (bottomLeftBlock != null) {
        materialData = BlockData.get(bottomLeftBlock);
    }
    return (materialData instanceof Door) && ((Door) materialData).isOpen();
}
项目:BedrockAPI    文件:Door.java   
public Door() {
}
项目:BedrockAPI    文件:Door.java   
@Deprecated public Door(int type) {
}
项目:BedrockAPI    文件:Door.java   
public Door(Material type) {
}
项目:BedrockAPI    文件:Door.java   
@Deprecated public Door(int type, byte data) {
}
项目:BedrockAPI    文件:Door.java   
@Deprecated public Door(Material type, byte data) {
}
项目:BedrockAPI    文件:Door.java   
public Door clone() {
    return null;
}