本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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());
}
示例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()));
}
示例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);
}
示例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());
}
示例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);
}