本文整理汇总了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);
}
}
}
}
示例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));
}
}
}
示例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);
}
}
}
}
示例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));
}
}
}
}
}
}
示例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());
}
}
}
}
}
示例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());
}
}
}
}
}
}
示例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));
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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));
}
}
示例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());
}
}
}
}
}
}
示例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());
}
}
}
}
}
}
示例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);
}
}
}
示例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);
}
示例15: canAdvance
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
return world.getLightFromNeighbors(pos) >= 13;
}