當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。