本文整理汇总了Java中net.minecraft.block.Block.getLightOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getLightOpacity方法的具体用法?Java Block.getLightOpacity怎么用?Java Block.getLightOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.getLightOpacity方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: canBlockSeeSky
import net.minecraft.block.Block; //导入方法依赖的package包/类
public boolean canBlockSeeSky(BlockPos pos)
{
if (pos.getY() >= this.func_181545_F())
{
return this.canSeeSky(pos);
}
else
{
BlockPos blockpos = new BlockPos(pos.getX(), this.func_181545_F(), pos.getZ());
if (!this.canSeeSky(blockpos))
{
return false;
}
else
{
for (blockpos = blockpos.down(); blockpos.getY() > pos.getY(); blockpos = blockpos.down())
{
Block block = this.getBlockState(blockpos).getBlock();
if (block.getLightOpacity() > 0 && !block.getMaterial().isLiquid())
{
return false;
}
}
return true;
}
}
}
示例2: generateHeightMap
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Generates the height map for a chunk from scratch
*/
protected void generateHeightMap()
{
int i = this.getTopFilledSegment();
this.heightMapMinimum = Integer.MAX_VALUE;
for (int j = 0; j < 16; ++j)
{
for (int k = 0; k < 16; ++k)
{
this.precipitationHeightMap[j + (k << 4)] = -999;
for (int l = i + 16; l > 0; --l)
{
Block block = this.getBlock0(j, l - 1, k);
if (block.getLightOpacity() != 0)
{
this.heightMap[k << 4 | j] = l;
if (l < this.heightMapMinimum)
{
this.heightMapMinimum = l;
}
break;
}
}
}
}
this.isModified = true;
}
示例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: updateSegments
import net.minecraft.block.Block; //导入方法依赖的package包/类
private void updateSegments() {
int x = xCoord;
int y = yCoord;
int z = zCoord;
segments.clear();
TileEntityNewBeacon.BeamSegment beamsegment = new TileEntityNewBeacon.BeamSegment(EntitySheep.fleeceColorTable[0]);
segments.add(beamsegment);
boolean flag = true;
for (int i = y + 1; i < worldObj.getActualHeight(); i++) {
Block iblockstate = worldObj.getBlock(x, i, z);
float[] colours;
if (iblockstate == Blocks.stained_glass)
colours = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(x, i, z)];
else {
if (iblockstate != Blocks.stained_glass_pane) {
if (iblockstate.getLightOpacity() >= 15) {
segments.clear();
break;
}
beamsegment.func_177262_a();
continue;
}
colours = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(x, i, z)];
}
if (!flag)
colours = new float[] { (beamsegment.func_177263_b()[0] + colours[0]) / 2.0F, (beamsegment.func_177263_b()[1] + colours[1]) / 2.0F, (beamsegment.func_177263_b()[2] + colours[2]) / 2.0F };
if (Arrays.equals(colours, beamsegment.func_177263_b()))
beamsegment.func_177262_a();
else {
beamsegment = new TileEntityNewBeacon.BeamSegment(colours);
segments.add(beamsegment);
}
flag = false;
}
}
示例6: getBlockOpacity
import net.minecraft.block.Block; //导入方法依赖的package包/类
@Deprecated
public static int getBlockOpacity(Block block) {
return block == null ? 0 : block.getLightOpacity(null);
}