本文整理匯總了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();
}