本文整理汇总了Java中net.minecraft.world.World.getLightFor方法的典型用法代码示例。如果您正苦于以下问题:Java World.getLightFor方法的具体用法?Java World.getLightFor怎么用?Java World.getLightFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getLightFor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePower
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updatePower(World worldIn, BlockPos pos)
{
if (!worldIn.provider.getHasNoSky())
{
IBlockState iblockstate = worldIn.getBlockState(pos);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
f = f + (f1 - f) * 0.2F;
i = Math.round((float)i * MathHelper.cos(f));
i = MathHelper.clamp_int(i, 0, 15);
if (this.inverted)
{
i = 15 - i;
}
if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
{
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
}
}
}
示例2: trySpread
import net.minecraft.world.World; //导入方法依赖的package包/类
private void trySpread(World world, BlockPos pos) {
for (EnumFacing face : EnumFacing.HORIZONTALS) {
BlockPos looppos = pos.offset(face);
if (world.getLightFor(EnumSkyBlock.BLOCK, looppos) > 5) continue;
if (world.isAirBlock(looppos) && (world.getBlockState(looppos.down()).getBlock() == Blocks.DIRT || world.getBlockState(looppos.down()).getBlock() == Blocks.FARMLAND)) {
if (world.rand.nextInt(2) == 0) {
if (world.getBlockState(looppos.down()).getBlock() == Blocks.DIRT)
world.setBlockState(looppos.down(), Blocks.FARMLAND.getDefaultState(), 3);
else
world.setBlockState(looppos, UCBlocks.cropDevilsnare.getDefaultState(), 3);
break;
}
}
}
}
示例3: func_189916_b
import net.minecraft.world.World; //导入方法依赖的package包/类
protected int func_189916_b(World p_189916_1_, int p_189916_2_, int p_189916_3_, int p_189916_4_, StructureBoundingBox p_189916_5_)
{
int i = this.getXWithOffset(p_189916_2_, p_189916_4_);
int j = this.getYWithOffset(p_189916_3_ + 1);
int k = this.getZWithOffset(p_189916_2_, p_189916_4_);
BlockPos blockpos = new BlockPos(i, j, k);
return !p_189916_5_.isVecInside(blockpos) ? EnumSkyBlock.SKY.defaultLightValue : p_189916_1_.getLightFor(EnumSkyBlock.SKY, blockpos);
}
示例4: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11)
{
this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockToAir(pos);
}
}
示例5: onArmorTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
if (world.isRemote)
return;
int upgradelevel = NBTUtils.getInt(itemStack, ItemGeneric.TAG_UPGRADE, -1);
int sunlight = world.getLightFor(EnumSkyBlock.SKY, player.getPosition().add(0, player.getEyeHeight(), 0));
if (sunlight <= 3 && upgradelevel == 10) {
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 30));
}
}
示例6: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11)
{
worldIn.setBlockToAir(pos);
}
}
示例7: updatePower
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updatePower(World worldIn, BlockPos pos)
{
if (!worldIn.provider.getHasNoSky())
{
IBlockState iblockstate = worldIn.getBlockState(pos);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
if (this.inverted)
{
i = 15 - i;
}
if (i > 0 && !this.inverted)
{
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
f = f + (f1 - f) * 0.2F;
i = Math.round((float)i * MathHelper.cos(f));
}
i = MathHelper.clamp_int(i, 0, 15);
if (((Integer)iblockstate.getValue(POWER)).intValue() != i)
{
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
}
}
}
示例8: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11 - this.getLightOpacity())
{
if (worldIn.provider.doesWaterVaporize())
{
worldIn.setBlockToAir(pos);
}
else
{
this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockState(pos, Blocks.water.getDefaultState());
}
}
}
示例9: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > content.maxLight)
{
worldIn.setBlockToAir(pos);
}
}
示例10: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
if (world.getLightFor(EnumSkyBlock.BLOCK, pos) > 5 && this.getAge(state) >= getMaxAge()) {
int deage = Math.max(world.getLightFor(EnumSkyBlock.BLOCK, pos) - 7, 0);
if (!world.isRemote)
world.setBlockState(pos, this.withAge(this.getAge(state) - deage), 2);
return;
}
if (this.getAge(state) >= getMaxAge())
this.trySpread(world, pos);
super.updateTick(world, pos, state, rand);
}
示例11: canAdvance
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
int sunlight = world.getLightFor(EnumSkyBlock.SKY, pos);
return sunlight == 0;
}