net.minecraft.world.World.getLightFromNeighbors()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中net.minecraft.world.World.getLightFromNeighbors()方法的一些代码示例,展示了World.getLightFromNeighbors()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getLightFromNeighbors()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getLightFromNeighbors

World.getLightFromNeighbors介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public int getWeakPower( final IBlockState state, final IBlockAccess w, final BlockPos pos, final EnumFacing side )
{
  if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
  {
    return ( (World) w ).getLightFromNeighbors( pos ) - 6;
  }
  return 0;
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public int getLightFromNeighbors(@Nonnull BlockPos pos) {
 return wrapped.getLightFromNeighbors(pos);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private boolean doWork()
{
  if( this.isOutput() )
  {
    return false;
  }
  final TileEntity te = this.getTile();
  final World w = te.getWorld();
  final int newLevel = w.getLightFromNeighbors( te.getPos().offset( this.getSide().getFacing() ) );
  if( this.lastValue != newLevel && this.getProxy().isActive() )
  {
    this.lastValue = newLevel;
    try
    {
      for( final PartP2PLight out : this.getOutputs() )
      {
        out.setLightLevel( this.lastValue );
      }
    }
    catch( final GridAccessException e )
    {
      // :P
    }
    return true;
  }
  return false;
}

代码示例来源:origin: amadornes/MCMultiPart

@Override
public int getLightFromNeighbors(BlockPos pos) {
  return getActualWorld().getLightFromNeighbors(pos);
}

代码示例来源:origin: SonarSonic/Calculator

@Override
public void updateTick(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull 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);
    }
  }
}

代码示例来源:origin: ForestryMC/ForestryMC

@Override
public int getBlockLightValue() {
  BlockPos topCenter = getTopCenterCoord();
  return world.getLightFromNeighbors(topCenter.up());
}

代码示例来源:origin: ForestryMC/ForestryMC

@Override
public int getBlockLightValue() {
  return world.getLightFromNeighbors(getPosition().up());
}

代码示例来源:origin: ForestryMC/ForestryMC

@Override
public int getBlockLightValue() {
  return world.getLightFromNeighbors(getPos().up());
}

代码示例来源:origin: jabelar/ExampleMod-1.12

@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)
    {
      grow(worldIn, rand, pos, state);
    }
  }
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
  if (!world.isRemote) {
    super.updateTick(world, pos, state, rand);
    if (world.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) {
      this.grow(world, pos, state, rand);
    }
  }
}

代码示例来源:origin: vadis365/TheErebus

public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
  if (!world.isRemote) {
    super.updateTick(world, pos, state, rand);
    if (world.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) {
      grow(world, rand, pos, state);
    }
  }
}

代码示例来源:origin: GregTechCE/GregTech

@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
  if (!worldIn.isRemote) {
    super.updateTick(worldIn, pos, state, rand);
    if (!worldIn.isAreaLoaded(pos, 1))
      return;
    if (worldIn.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) {
      this.grow(worldIn, rand, pos, state);
    }
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
  if (blockpos.getY() >= 120 || blockpos.getY() <= 20)
    return false;
  else {
    int lightValue = world.getLightFromNeighbors(blockpos);
    if (rand.nextBoolean())
      return false;
    return lightValue > rand.nextInt(7) ? false : isNotColliding() && super.getCanSpawnHere();
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
  if (blockpos.getY() >= 120 || blockpos.getY() <= 20)
    return false;
  else {
    int lightValue = world.getLightFromNeighbors(blockpos);
    if (rand.nextBoolean())
      return false;
    return lightValue > rand.nextInt(4) ? false : isNotColliding() && super.getCanSpawnHere();
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
  if (blockpos.getY() > 100)
    return false;
  else {
    int lightValue = world.getLightFromNeighbors(blockpos);
    return lightValue > rand.nextInt(7) ? false : isNotColliding() && super.getCanSpawnHere();
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
  if (blockpos.getY() > 100)
    return false;
  else {
    int lightValue = world.getLightFromNeighbors(blockpos);
    return lightValue > rand.nextInt(7) ? false : isNotColliding() && super.getCanSpawnHere();
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public boolean getCanSpawnHere() {
  BlockPos blockpos = new BlockPos(posX, getEntityBoundingBox().minY, posZ);
  if (blockpos.getY() > 100)
    return false;
  else {
    int lightValue = world.getLightFromNeighbors(blockpos);
    return lightValue > rand.nextInt(7) ? false : isNotColliding() && super.getCanSpawnHere();
  }
}

代码示例来源:origin: vadis365/TheErebus

@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
  if (!world.isRemote) {
    super.updateTick(world, pos, state, rand);
    if (world.getLightFromNeighbors(pos.up()) >= 9 && rand.nextInt(7) == 0) {
      if(this != EnumWood.BAMBOO.getSapling())
        grow(world, pos, state, rand);
      else
        world.setBlockState(pos, EnumWood.BAMBOO.getLog().getDefaultState(), 3);
    }
  }
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
  super.updateTick(world, pos, state, rand);
  if (world.getLightFromNeighbors(pos.up()) >= 9) {
    int i = state.getValue(this.getAgeProperty());
    if (i < this.getMaxAge()) {
      float f = getGrowthChance(this, world, pos);
      if (rand.nextInt((int) (25.0F / f) + 1) == 0) {
        world.setBlockState(pos, state.withProperty(this.getAgeProperty(), i + 1), 2);
      }
    }
  }
}

代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft

@Override
public boolean canGenerateTree(World world, BlockPos pos, Tree treeType)
{
  // Check if there is soil beneath
  if (!BlocksTFC.isSoil(world.getBlockState(pos.down())))
    return false;
  // Check the position for liquids, etc.
  if (world.getBlockState(pos).getMaterial().isLiquid() || !world.getBlockState(pos).getMaterial().isReplaceable())
    if (!(world.getBlockState(pos) instanceof BlockSapling))
      return false;
  // Check if there is sufficient light level
  return world.getLightFromNeighbors(pos) >= 7;
}

相关文章

微信公众号

最新文章

更多

World类方法