当前位置: 首页>>代码示例>>Java>>正文


Java Door类代码示例

本文整理汇总了Java中org.bukkit.material.Door的典型用法代码示例。如果您正苦于以下问题:Java Door类的具体用法?Java Door怎么用?Java Door使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Door类属于org.bukkit.material包,在下文中一共展示了Door类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFaceToRightDoor

import org.bukkit.material.Door; //导入依赖的package包/类
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);
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:20,代码来源:CompleteDoor.java

示例2: setOpen

import org.bukkit.material.Door; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:33,代码来源:CompleteDoor.java

示例3: translateAction

import org.bukkit.material.Door; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:17,代码来源:UseDoor.java

示例4: checkMove

import org.bukkit.material.Door; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:kumpelblase2,项目名称:remote-entities-nxt,代码行数:20,代码来源:DoorOpenChecker.java

示例5: isInteractiveBlock

import org.bukkit.material.Door; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:RoboTricker,项目名称:Transport-Pipes,代码行数:19,代码来源:HitboxUtils.java

示例6: asDoorMaterialOrNull

import org.bukkit.material.Door; //导入依赖的package包/类
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;
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:11,代码来源:CompleteDoor.java

示例7: getHinge

import org.bukkit.material.Door; //导入依赖的package包/类
private static Hinge getHinge(Block topHalfDoorBlock) {
    Door door = asDoorMaterialOrNull(topHalfDoorBlock);
    if (door != null) {
        return door.getHinge() == false ? Hinge.LEFT : Hinge.RIGHT;
    }
    return Hinge.UNKNOWN;
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:8,代码来源:CompleteDoor.java

示例8: isTopHalf

import org.bukkit.material.Door; //导入依赖的package包/类
private static boolean isTopHalf(Block doorBlock) {
    Door door = asDoorMaterialOrNull(doorBlock);
    if (door != null) {
        return door.isTopHalf();
    }
    return false;
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:8,代码来源:CompleteDoor.java

示例9: isOpen

import org.bukkit.material.Door; //导入依赖的package包/类
/**
 * 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();
}
 
开发者ID:rutgerkok,项目名称:BlockLocker,代码行数:17,代码来源:CompleteDoor.java

示例10: Door

import org.bukkit.material.Door; //导入依赖的package包/类
public Door() {
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:3,代码来源:Door.java

示例11: clone

import org.bukkit.material.Door; //导入依赖的package包/类
public Door clone() {
	return null;
}
 
开发者ID:deathcap,项目名称:BedrockAPI,代码行数:4,代码来源:Door.java


注:本文中的org.bukkit.material.Door类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。