本文整理汇总了Java中org.bukkit.material.Bed.isHeadOfBed方法的典型用法代码示例。如果您正苦于以下问题:Java Bed.isHeadOfBed方法的具体用法?Java Bed.isHeadOfBed怎么用?Java Bed.isHeadOfBed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.material.Bed
的用法示例。
在下文中一共展示了Bed.isHeadOfBed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dropTargetBlock
import org.bukkit.material.Bed; //导入方法依赖的package包/类
private void dropTargetBlock(Block targetBlock) {
if (targetBlock.getType().equals(Material.BED_BLOCK)) {
Block bedHead;
Block bedFeet;
Bed bedBlock = (Bed) targetBlock.getState().getData();
if (!bedBlock.isHeadOfBed()) {
bedFeet = targetBlock;
bedHead = Utils.getBedNeighbor(bedFeet);
} else {
bedHead = targetBlock;
bedFeet = Utils.getBedNeighbor(bedHead);
}
if (!BedwarsRel.getInstance().getCurrentVersion().startsWith("v1_12")) {
bedFeet.setType(Material.AIR);
} else {
bedHead.setType(Material.AIR);
}
} else {
targetBlock.setType(Material.AIR);
}
}
示例2: adjustBlockForDoubleBlocks
import org.bukkit.material.Bed; //导入方法依赖的package包/类
/**
* Only the bottom half of doors and the feet of a bed is logged!
*
* @param blockState the blockstate to adjust
*
* @return the adjusted blockstate
*/
public static BlockState adjustBlockForDoubleBlocks(BlockState blockState)
{
if (blockState.getType() == Material.WOODEN_DOOR || blockState.getType() == Material.IRON_DOOR_BLOCK)
{
if (blockState.getRawData() == 8 || blockState.getRawData() == 9)
{
if (blockState.getRawData() == 9)
{
blockState = blockState.getBlock().getRelative(BlockFace.DOWN).getState();
blockState.setRawData((byte)(blockState.getRawData() + 8));
return blockState;
}
return blockState.getBlock().getRelative(BlockFace.DOWN).getState();
}
else
{
if (blockState.getBlock().getRelative(BlockFace.UP).getState().getRawData() == 9)
{
blockState.setRawData((byte)(blockState.getRawData() + 8));
}
}
}
else if (blockState.getData() instanceof Bed)
{
Bed bed = (Bed)blockState.getData();
if (bed.isHeadOfBed())
{
return blockState.getBlock().getRelative(bed.getFacing().getOppositeFace()).getState();
}
}
return blockState;
}