当前位置: 首页>>代码示例>>Java>>正文


Java World.getLightFor方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:BlockDaylightDetector.java

示例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;
			}
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:17,代码来源:DevilSnare.java

示例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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:StructureComponent.java

示例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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:BlockSnowBlock.java

示例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));
}
  }
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:13,代码来源:Item3DGlasses.java

示例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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:BlockSnow.java

示例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);
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:BlockDaylightDetector.java

示例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());
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:BlockIce.java

示例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);
    }
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:9,代码来源:BlockSnow.java

示例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);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:15,代码来源:DevilSnare.java

示例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;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:7,代码来源:GrowthSteps.java


注:本文中的net.minecraft.world.World.getLightFor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。