本文整理匯總了Java中net.minecraft.block.Block.getLightValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Block.getLightValue方法的具體用法?Java Block.getLightValue怎麽用?Java Block.getLightValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.getLightValue方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLightLevel
import net.minecraft.block.Block; //導入方法依賴的package包/類
public static int getLightLevel(ItemStack p_getLightLevel_0_)
{
if (p_getLightLevel_0_ == null)
{
return 0;
}
else
{
Item item = p_getLightLevel_0_.getItem();
if (item instanceof ItemBlock)
{
ItemBlock itemblock = (ItemBlock)item;
Block block = itemblock.getBlock();
if (block != null)
{
return block.getLightValue();
}
}
return item == Items.lava_bucket ? Blocks.lava.getLightValue() : (item != Items.blaze_rod && item != Items.blaze_powder ? (item == Items.glowstone_dust ? 8 : (item == Items.prismarine_crystals ? 8 : (item == Items.magma_cream ? 8 : (item == Items.nether_star ? Blocks.beacon.getLightValue() / 2 : 0)))) : 10);
}
}
示例2: getLightLevel
import net.minecraft.block.Block; //導入方法依賴的package包/類
public static int getLightLevel(ItemStack p_getLightLevel_0_)
{
if (p_getLightLevel_0_ == null)
{
return 0;
}
else
{
Item item = p_getLightLevel_0_.getItem();
if (item instanceof ItemBlock)
{
ItemBlock itemblock = (ItemBlock)item;
Block block = itemblock.getBlock();
if (block != null)
{
return block.getLightValue(block.getDefaultState());
}
}
return item == Items.LAVA_BUCKET ? Blocks.LAVA.getLightValue(Blocks.LAVA.getDefaultState()) : (item != Items.BLAZE_ROD && item != Items.BLAZE_POWDER ? (item == Items.GLOWSTONE_DUST ? 8 : (item == Items.PRISMARINE_CRYSTALS ? 8 : (item == Items.MAGMA_CREAM ? 8 : (item == Items.NETHER_STAR ? Blocks.BEACON.getLightValue(Blocks.BEACON.getDefaultState()) / 2 : 0)))) : 10);
}
}
示例3: setBlockState
import net.minecraft.block.Block; //導入方法依賴的package包/類
/**
* Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to
* clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client
* world. Flags can be added together.
*/
public boolean setBlockState(BlockPos pos, IBlockState newState, int flags)
{
if (!this.isValid(pos))
{
return false;
}
else if (!this.isRemote && this.worldInfo.getTerrainType() == WorldType.DEBUG_WORLD)
{
return false;
}
else
{
Chunk chunk = this.getChunkFromBlockCoords(pos);
Block block = newState.getBlock();
IBlockState iblockstate = chunk.setBlockState(pos, newState);
if (iblockstate == null)
{
return false;
}
else
{
Block block1 = iblockstate.getBlock();
if (block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue())
{
this.theProfiler.startSection("checkLight");
this.checkLight(pos);
this.theProfiler.endSection();
}
if ((flags & 2) != 0 && (!this.isRemote || (flags & 4) == 0) && chunk.isPopulated())
{
this.markBlockForUpdate(pos);
}
if (!this.isRemote && (flags & 1) != 0)
{
this.notifyNeighborsRespectDebug(pos, iblockstate.getBlock());
if (block.hasComparatorInputOverride())
{
this.updateComparatorOutputLevel(pos, block);
}
}
return true;
}
}
}
示例4: getRawLight
import net.minecraft.block.Block; //導入方法依賴的package包/類
/**
* gets the light level at the supplied position
*/
private int getRawLight(BlockPos pos, EnumSkyBlock lightType)
{
if (lightType == EnumSkyBlock.SKY && this.canSeeSky(pos))
{
return 15;
}
else
{
Block block = this.getBlockState(pos).getBlock();
int i = lightType == EnumSkyBlock.SKY ? 0 : block.getLightValue();
int j = block.getLightOpacity();
if (j >= 15 && block.getLightValue() > 0)
{
j = 1;
}
if (j < 1)
{
j = 1;
}
if (j >= 15)
{
return 0;
}
else if (i >= 14)
{
return i;
}
else
{
for (EnumFacing enumfacing : EnumFacing.values())
{
BlockPos blockpos = pos.offset(enumfacing);
int k = this.getLightFor(lightType, blockpos) - j;
if (k > i)
{
i = k;
}
if (i >= 14)
{
return i;
}
}
return i;
}
}
}
示例5: getBlockLight
import net.minecraft.block.Block; //導入方法依賴的package包/類
@Deprecated
public static int getBlockLight(Block block) {
return block == null ? 0 : block.getLightValue(null);
}