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


Java World.getLight方法代码示例

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


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

示例1: generateTree

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean generateTree(World worldIn, Random rand, BlockPos pos) {
	filler.leaf = leaf;
	// Check light levels
	if(worldIn.getLight(pos)<7){
		return false;
	}
	// Check height of trunk
	int h = rand.nextInt(heightVar) + height;
	for(int y = 0; y<h; y++){
		if(!checkBlockAt(worldIn,pos.add(0,h,0))){
			return false;
		}
	}
	// Place central trunk
	for(int y = 0; y<h; y++){
		fill(worldIn, pos.add(0, y, 0));
	}
	filler.fillLeaves(worldIn, pos.add(0,h-1,0), rand);
	
	return false;
}
 
开发者ID:trigg,项目名称:Firma,代码行数:23,代码来源:TreeGeneric.java

示例2: generateTree

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean generateTree(World worldIn, Random rand, BlockPos pos) {
	filler.leaf = leaf;
	if(worldIn.getLight(pos)<7){
		return false;
	}
	// Check height of trunk
	int h = rand.nextInt(4) + 4;
	for(int y = 0; y<h; y++){
		if(!checkBlockAt(worldIn,pos.add(0,h,0))){
			return false;
		}
	}
	// Place central trunk
	for(int y = 0; y<h; y++){
		fill(worldIn, pos.add(0, y, 0));
		if(y>1){
			filler.fillLeaves(worldIn, pos.add(0,y,0), rand);				
		}
	}
	return true;
}
 
开发者ID:trigg,项目名称:Firma,代码行数:23,代码来源:TreeCedar.java

示例3: draw

import net.minecraft.world.World; //导入方法依赖的package包/类
private static void draw(World world, double dx, double dy, double dz, Entity entity, ScarfNode prime, ArrayList<ScarfNode> nodes) {
	TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/wool_colored_white");
	//TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
	Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
	ScarfNode lastNode = prime;
	for(ScarfNode node : nodes) {
		//TODO: Swap out sprites each segment?
		
		float x1 = (float)(node.x-dx);
		float x2 = (float)(lastNode.x-dx);
		float y1 = (float)(node.y-dy);
		float y2 = (float)(lastNode.y-dy);
		float z1 = (float)(node.z-dz);
		float z2 = (float)(lastNode.z-dz);
		
		float light1 = world.getLight(new BlockPos((int)node.x, (int)node.y, (int)node.z)) / 15f;
		float light2 = world.getLight(new BlockPos((int)lastNode.x, (int)lastNode.y, (int)lastNode.z)) / 15f;
		
		ribbon(x1, y1, z1, x2, y2, z2, 0.25f, sprite, node.r, node.g, node.b, light1, light2);
		ribbon(x2, y2, z2, x1, y1, z1, 0.25f, sprite, node.r, node.g, node.b, light2, light1);
		lastNode = node;
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:24,代码来源:LayerScarf.java

示例4: generateTree

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean generateTree(World w, Random rand, BlockPos pos) {
	filler.leaf=leaf;
	// Check light levels
	if(w.getLight(pos)<7){
		return false;
	}
	int h = 5 + rand.nextInt(height);
	// Check height of trunk
	for(int y = 0; y<h; y++){
		if(!checkBlockAt(w,pos.add(0,y,0))){
			return false;
		}
	}
	for(int y = 0; y < h; y++){
		fill(w,pos.add(0,y,0));
	}
	for(int branch = 0; branch < 5; branch++){
		float incx = rand.nextFloat()*2f-1f;
		float incz = rand.nextFloat()*2f-1f;
		float den = Math.abs(incx)+Math.abs(incz);
		incx /= den;
		incz /= den;
		float incy = rand.nextFloat()/4f;
		float x=0,y=0,z=0;
		for(int bc = 0; bc < 5; bc++){
			x+=incx; y+=incy; z+=incz;
			BlockPos p = pos.add(x, y+h, z);
			fill(w,p);
			filler.fillLeaves(w, p, rand);
		}
	}
	return true;
}
 
开发者ID:trigg,项目名称:Firma,代码行数:35,代码来源:TreeWillow.java

示例5: generateTree

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean generateTree(World w, Random rand, BlockPos pos) {
	filler.leaf=leaf;
	// Check light levels
	if(w.getLight(pos)<7){
		return false;
	}
	// Check height of trunk
	int h = 3+rand.nextInt(height);
	for(int y = 0; y<h; y++){
		if(!checkBlockAt(w,pos.add(0,y,0))){
			return false;
		}
	}
	for(int y = 0; y < h; y++){
		fill(w,pos.add(0,y,0));
	}
	for(int branch = 0; branch < 5; branch++){
		float incx = rand.nextFloat()-.5f;
		float incz = rand.nextFloat()-.5f;
		float incy = rand.nextFloat()*0.5f + 0.5f;
		float x=0,y=0,z=0;
		for(int bc = 0; bc < 5; bc++){
			x+=incx; y+=incy; z+=incz;
			BlockPos p = pos.add(x, y+h, z);
			fill(w,p);
			filler.fillLeaves(w, p, rand);
		}
	}
	return true;
}
 
开发者ID:trigg,项目名称:Firma,代码行数:32,代码来源:TreeFir.java

示例6: canBlockStay

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    if (pos.getY() >= 0 && pos.getY() < 256)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.down());
        return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock()));
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:BlockMushroom.java

示例7: canBlockStay

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    if (pos.getY() >= 0 && pos.getY() < 256)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.down());
        return iblockstate.getBlock() == Blocks.MYCELIUM ? true : (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canSustainBush(iblockstate));
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:BlockMushroom.java

示例8: canBlockStay

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    if (pos.getY() >= 0 && pos.getY() < 256)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.down());
        return iblockstate.getBlock() == Blocks.MYCELIUM ? true : (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this));
    }
    else
    {
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:BlockMushroom.java

示例9: canBlockStay

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockCrops.java

示例10: canBlockStay

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canSustainBush(worldIn.getBlockState(pos.down()));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:BlockCrops.java

示例11: canBlockStay

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    IBlockState soil = worldIn.getBlockState(pos.down());
    return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:6,代码来源:BlockCrops.java

示例12: matches

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean matches(World world, BlockPos pos) {
    return world.getLight(pos.up()) >= this.level || world.canSeeSky(pos.up());
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:5,代码来源:BlockQuery.java

示例13: canBlockStay

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

      IBlockState soil = worldIn.getBlockState(pos.down());
      return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
      
  }
 
开发者ID:Bedrockbreaker,项目名称:rtap,代码行数:7,代码来源:cropPeppers.java


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