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


Java Torch.setFacingDirection方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:OpenRedstoneEngineers,项目名称:autoprogram-plugin,代码行数:25,代码来源:ProgParser.java

示例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);
	}
}
 
开发者ID:jimfinnis,项目名称:Gorm,代码行数:22,代码来源:Castle.java


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