本文整理汇总了Java中org.bukkit.material.Torch.setFacingDirection方法的典型用法代码示例。如果您正苦于以下问题:Java Torch.setFacingDirection方法的具体用法?Java Torch.setFacingDirection怎么用?Java Torch.setFacingDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.material.Torch
的用法示例。
在下文中一共展示了Torch.setFacingDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: placeBlock
import org.bukkit.material.Torch; //导入方法依赖的package包/类
private void placeBlock(Block worldBlock, BlockDef block)
{
if (block.face == null && block.metadata == 0)
{
worldBlock.setType(block.material);
}
else
{
//I would prefer to do this without depreciated method and the weird torch hack,
//but the bukkit/spigot API seems to be buggy. If I set the block type with setType and then
//set the direction, attachable blocks will for some reason pop off, even if I
//tell setType to disable physics updates.
if (block.face != null)
{
Torch torch = new Torch();
torch.setFacingDirection(block.face);
worldBlock.setTypeIdAndData(block.material.getId(), torch.getData(), true);
}
else
{
worldBlock.setTypeIdAndData(block.material.getId(), block.metadata, true);
}
}
}
示例2: addLightToWall
import org.bukkit.material.Torch; //导入方法依赖的package包/类
public void addLightToWall(int x, int y, int z,BlockFace dir) {
World w = Castle.getInstance().getWorld();
Block b = w.getBlockAt(x, y, z);
// a hack. Creating a torch will cause it
// to drop, unless there's something under it.
// Even when it's attached to a wall.
// Madness.
Block bunder = w.getBlockAt(x, y-1, z);
if(canOverwrite(bunder) && canOverwrite(b)){
bunder.setType(Material.DIRT);
Torch t = new Torch(Material.TORCH);
t.setFacingDirection(dir);
b.setType(Material.TORCH);
b.setData(t.getData());
bunder.setType(Material.AIR);
}
}