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


Java World.getLightFromNeighbors方法代码示例

本文整理汇总了Java中net.minecraft.world.World.getLightFromNeighbors方法的典型用法代码示例。如果您正苦于以下问题:Java World.getLightFromNeighbors方法的具体用法?Java World.getLightFromNeighbors怎么用?Java World.getLightFromNeighbors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.World的用法示例。


在下文中一共展示了World.getLightFromNeighbors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    super.updateTick(worldIn, pos, state, rand);

    if (worldIn.getLightFromNeighbors(pos.up()) >= 1)
    {
        int i = state.getValue(AGE);

        if (i < 2)
        {
            float f = getGrowthChance(this, worldIn, pos);

            if (rand.nextInt((int)(25.0F / f) + 1) == 0)
            {
                worldIn.setBlockState(pos, state.withProperty(AGE, i + 1), 2);
            }
        }
    }
}
 
开发者ID:BenjaminSutter,项目名称:genera,代码行数:20,代码来源:BlockGeneraCrop.java

示例2: checkHighplant

import net.minecraft.world.World; //导入方法依赖的package包/类
private void checkHighplant(World world, BlockPos pos, IBlockState state, int age) {
	
	int chanceByHeight = Math.round(pos.getY() / 16);
	
	if (world.getLightFromNeighbors(pos.up()) >= 9) {
		if (age < ((BlockCrops)state.getBlock()).getMaxAge() && world.rand.nextInt(16 - chanceByHeight) == 0) {
			world.setBlockState(pos, ((BlockCrops)state.getBlock()).withAge(age + 1));
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:11,代码来源:Collis.java

示例3: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    super.updateTick(worldIn, pos, state, rand);

    if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
    {
        int i = ((Integer)state.getValue(AGE)).intValue();

        if (i < 7)
        {
            float f = getGrowthChance(this, worldIn, pos);

            if (rand.nextInt((int)(25.0F / f) + 1) == 0)
            {
                worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2);
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:BlockCrops.java

示例4: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
   {
       if (!worldIn.isRemote)
       {
           if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2)
           {
               worldIn.setBlockState(pos,Util.getDirt(state));
           }
           else
           {
               if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
               {
                   for (int i = 0; i < 4; ++i)
                   {
                       BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);

                       if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos))
                       {
                           return;
                       }

                       IBlockState iblockstate = worldIn.getBlockState(blockpos.up());
                       IBlockState iblockstate1 = worldIn.getBlockState(blockpos);

                       if (Util.isDirt(iblockstate1.getBlock()) && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2)
                       {
                           worldIn.setBlockState(blockpos, Util.getGrass(iblockstate1));
                       }
                   }
               }
           }
       }
   }
 
开发者ID:trigg,项目名称:Firma,代码行数:35,代码来源:SparseGrassBlock.java

示例5: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	super.updateTick(worldIn, pos, state, rand);

	if (worldIn.getLightFromNeighbors(pos.up()) >= 9) {
		float f = BlockCrops.getGrowthChance(this, worldIn, pos);

		if (rand.nextInt((int) (25.0F / f) + 1) == 0) {
			int i = ((Integer) state.getValue(AGE)).intValue();

			if (i < 7) {
				state = state.withProperty(AGE, Integer.valueOf(i + 1));
				worldIn.setBlockState(pos, state, 2);
			} else {
				for (Object enumfacing0 : EnumFacing.Plane.HORIZONTAL) {
					EnumFacing enumfacing = (EnumFacing) enumfacing0;
					if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() == this.crop) {
						return;
					}
				}

				pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand));
				Block block = worldIn.getBlockState(pos.down()).getBlock();

				if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air
						&& (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass)) {
					worldIn.setBlockState(pos, this.crop.getDefaultState());
				}
			}
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:32,代码来源:BlockStem.java

示例6: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
        {
            worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
        }
        else
        {
            if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
            {
                for (int i = 0; i < 4; ++i)
                {
                    BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);
                    Block block = worldIn.getBlockState(blockpos.up()).getBlock();
                    IBlockState iblockstate = worldIn.getBlockState(blockpos);

                    if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
                    {
                        worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState());
                    }
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:BlockGrass.java

示例7: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if ((rand.nextInt(3) == 0 || this.countNeighbors(worldIn, pos) < 4) && worldIn.getLightFromNeighbors(pos) > 11 - ((Integer)state.getValue(AGE)).intValue() - state.getLightOpacity())
    {
        this.slightlyMelt(worldIn, pos, state, rand, true);
    }
    else
    {
        worldIn.scheduleUpdate(pos, this, MathHelper.getInt(rand, 20, 40));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:BlockFrostedIce.java

示例8: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random random) {
    if (!world.isRemote) {
        checkAndDropBlock(world, pos, state);
        if (world.getLightFromNeighbors(pos.up()) >= 9 && random.nextInt(7) == 0) {
            grow(world, pos, state, random);
        }
    }
}
 
开发者ID:Boethie,项目名称:Genesis,代码行数:10,代码来源:BlockGenesisSapling.java

示例9: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
	if (!worldIn.isRemote) {
		super.updateTick(worldIn, pos, state, rand);

		if (worldIn.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) {
			this.grow(worldIn, pos, state, rand);
		}
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:11,代码来源:BlockWoodSapling.java

示例10: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if ((rand.nextInt(3) == 0 || this.countNeighbors(worldIn, pos) < 4) && worldIn.getLightFromNeighbors(pos) > 11 - ((Integer)state.getValue(AGE)).intValue() - state.getLightOpacity())
    {
        this.slightlyMelt(worldIn, pos, state, rand, true);
    }
    else
    {
        worldIn.scheduleUpdate(pos, this, MathHelper.getRandomIntegerInRange(rand, 20, 40));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:BlockFrostedIce.java

示例11: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
        {
            worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
        }
        else
        {
            if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
            {
                for (int i = 0; i < 4; ++i)
                {
                    BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);
                    IBlockState iblockstate = worldIn.getBlockState(blockpos);
                    Block block = worldIn.getBlockState(blockpos.up()).getBlock();

                    if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
                    {
                        worldIn.setBlockState(blockpos, this.getDefaultState());
                    }
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:BlockMycelium.java

示例12: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2)
        {
            worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
        }
        else
        {
            if (worldIn.getLightFromNeighbors(pos.up()) >= 9)
            {
                for (int i = 0; i < 4; ++i)
                {
                    BlockPos blockpos = pos.add(rand.nextInt(3) - 1, rand.nextInt(5) - 3, rand.nextInt(3) - 1);

                    if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos))
                    {
                        return;
                    }

                    IBlockState iblockstate = worldIn.getBlockState(blockpos.up());
                    IBlockState iblockstate1 = worldIn.getBlockState(blockpos);

                    if (iblockstate1.getBlock() == Blocks.DIRT && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2)
                    {
                        worldIn.setBlockState(blockpos, UCBlocks.oldGrass.getDefaultState());
                    }
                }
            }
        }
    }
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:35,代码来源:BlockOldGrass.java

示例13: updateTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!worldIn.isRemote)
    {
        super.updateTick(worldIn, pos, state, rand);

        if (worldIn.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0)
        {
            this.grow(worldIn, pos, state, rand);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:BlockSapling.java

示例14: renderShadow

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha,
 * partialTickTime
 */
private void renderShadow(Entity entityIn, double x, double y, double z, float shadowAlpha, float partialTicks)
{
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 771);
    this.renderManager.renderEngine.bindTexture(shadowTextures);
    World world = this.getWorldFromRenderManager();
    GlStateManager.depthMask(false);
    float f = this.shadowSize;

    if (entityIn instanceof EntityLiving)
    {
        EntityLiving entityliving = (EntityLiving)entityIn;
        f *= entityliving.getRenderSizeModifier();

        if (entityliving.isChild())
        {
            f *= 0.5F;
        }
    }

    double d5 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
    double d0 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
    double d1 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
    int i = MathHelper.floor_double(d5 - (double)f);
    int j = MathHelper.floor_double(d5 + (double)f);
    int k = MathHelper.floor_double(d0 - (double)f);
    int l = MathHelper.floor_double(d0);
    int i1 = MathHelper.floor_double(d1 - (double)f);
    int j1 = MathHelper.floor_double(d1 + (double)f);
    double d2 = x - d5;
    double d3 = y - d0;
    double d4 = z - d1;
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);

    for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1)))
    {
        Block block = world.getBlockState(blockpos.down()).getBlock();

        if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3)
        {
            this.func_180549_a(block, x, y, z, blockpos, shadowAlpha, f, d2, d3, d4);
        }
    }

    tessellator.draw();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:56,代码来源:Render.java

示例15: canAdvance

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {

	return world.getLightFromNeighbors(pos) >= 13;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:6,代码来源:GrowthSteps.java


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