本文整理汇总了Java中org.bukkit.block.Block.getLightLevel方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getLightLevel方法的具体用法?Java Block.getLightLevel怎么用?Java Block.getLightLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.block.Block
的用法示例。
在下文中一共展示了Block.getLightLevel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CraftBlockState
import org.bukkit.block.Block; //导入方法依赖的package包/类
public CraftBlockState(final Block block) {
this.world = (CraftWorld) block.getWorld();
this.x = block.getX();
this.y = block.getY();
this.z = block.getZ();
this.type = block.getTypeId();
this.light = block.getLightLevel();
this.chunk = (CraftChunk) block.getChunk();
this.flag = 3;
// Cauldron start - save TE data
TileEntity te = world.getHandle().getTileEntity(x, y, z);
if (te != null)
{
nbt = new NBTTagCompound();
te.writeToNBT(nbt);
}
else nbt = null;
// Cauldron end
createData(block.getData());
}
示例2: averageLightLevel
import org.bukkit.block.Block; //导入方法依赖的package包/类
/**
* Get the average light level of all empty (air) blocks in the Cuboid. Returns 0
* if there are no empty blocks.
*
* @return the average light level of this Cuboid
*/
public byte averageLightLevel() {
long total = 0;
int n = 0;
for (Block b : this) {
if (b.isEmpty()) {
total += b.getLightLevel();
++n;
}
}
return n > 0 ? (byte) (total / n) : 0;
}
示例3: getAverageLightLevel
import org.bukkit.block.Block; //导入方法依赖的package包/类
/**
* Get the average light level of all empty (air) blocks in the Cuboid.
* Returns 0 if there are no empty blocks.
*
* @return The average light level of this Cuboid
*/
public byte getAverageLightLevel() {
long total = 0;
int n = 0;
for (Block b : this) {
if (b.isEmpty()) {
total += b.getLightLevel();
++n;
}
}
return n > 0 ? (byte) (total / n) : 0;
}
示例4: getAverageLightLevel
import org.bukkit.block.Block; //导入方法依赖的package包/类
/**
* Get the average light level of all empty (air) blocks in the Cuboid. Returns 0 if there are no empty blocks.
*
* @return The average light level of this Cuboid
*/
public byte getAverageLightLevel() {
long total = 0;
int n = 0;
for (Block b : this) {
if (b.isEmpty()) {
total += b.getLightLevel();
++n;
}
}
return n > 0 ? (byte) (total / n) : 0;
}
示例5: setBed
import org.bukkit.block.Block; //导入方法依赖的package包/类
public void setBed(Block bed){
light=bed.getLightLevel();
}