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

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

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

World.canBlockSeeSky介绍

暂无

代码示例

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

@Override
public boolean canBlockSeeTheSky( final int x, final int y, final int z )
{
  if( this.range( x, y, z ) )
  {
    return this.getWorld().canBlockSeeSky( new BlockPos( x, y, z ) );
  }
  return false;
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
protected boolean isPositionAcceptable(World world, BlockPos pos) {
  return !world.canBlockSeeSky(pos);
}

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

@Override
public boolean canBlockSeeSky(@Nonnull BlockPos pos) {
 return wrapped.canBlockSeeSky(pos);
}

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

static boolean canSeeSun(World world, BlockPos pos) {
 return world.canBlockSeeSky(pos.up());
}

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

@Override
public boolean canBlockSeeSky(BlockPos pos) {
  return getActualWorld().canBlockSeeSky(pos);
}

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

@Override
public boolean canBlockSeeTheSky() {
  BlockPos topCenter = getTopCenterCoord();
  return world.canBlockSeeSky(topCenter.add(0, 2, 0));
}

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

@Override
public boolean getCanSpawnHere() {
 return world.canBlockSeeSky(BlockCoord.get(this)) && super.getCanSpawnHere();
}

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

@Override
public boolean canBlockSeeTheSky() {
  return world.canBlockSeeSky(getPosition().up());
}

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

@Override
public boolean canBlockSeeTheSky() {
  return world.canBlockSeeSky(getPos().up());
}

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

private static boolean convertToMycelium(World world, IBlockState blockState, BlockPos pos) {
  Block block = blockState.getBlock();
  if (block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos)) {
    world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
    return true;
  }
  return false;
}

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

@Override
  protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) {
    if (world.rand.nextInt(100) < 1 && world.canBlockSeeSky(position)) {
      world.spawnEntity(new EntitySmallFireball(world, position.getX(), position.getY() + 64, position.getZ(), 0.0, -0.6, 0.0));
    }
    return storedData;
  }
},

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

@Override
  protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) {
    if (world.rand.nextInt(100) < 1 && world.canBlockSeeSky(position) && world instanceof WorldServer) {
      world.addWeatherEffect(new EntityBeeLightning(world, position.getX(), position.getY(), position.getZ()));
    }
    return storedData;
  }
},

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

public static float getHeightAdjustedTemp(World world, BlockPos pos)
{
  float temp = adjustTempByHeight(pos.getY(), getTemp(world, pos));
  if (temp <= 0 || !world.canBlockSeeSky(pos)) return temp;
  return temp - (temp * (0.25f * (1 - (world.getLight(pos) / 15f))));
}

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

public static float getHeightAdjustedBiomeTemp(World world, BlockPos pos)
{
  float temp = adjustTempByHeight(pos.getY(), getAverageBiomeTemp(world, pos));
  if (temp <= 0 || !world.canBlockSeeSky(pos)) return temp;
  return temp - (temp * (0.25f * (1 - (world.getLight(pos) / 15f))));
}

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

@Override
  protected IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing, World world, BlockPos position) {
    if (world.rand.nextInt((this == ExtraBeesEffect.FIREWORKS) ? 8 : 12) < 1) {
      final FireworkCreator.Firework firework = new FireworkCreator.Firework();
      final EntityFireworkRocket var11 = new EntityFireworkRocket(world, position.getX(), position.getY(), position.getZ(), firework.getFirework());
      if (world.canBlockSeeSky(position)) {
        world.spawnEntity(var11);
      }
    }
    return storedData;
  }
},

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

protected boolean checkCanSeeSun() {
  BlockPos blockPos = getPos().up();
  if(!getWorld().canBlockSeeSky(blockPos))
    return false;
  return !getWorld().isRaining() && getWorld().isDaytime();
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

@Override
public void onBihourlyTick() {
  World world = animal.world;
  boolean dayTime = world.isDaytime();
  boolean isRaining = world.isRaining();
  boolean isOutside = world.canBlockSeeSky(new BlockPos(animal));
  boolean isOutsideInSun = !isRaining && isOutside && dayTime && HFApi.calendar.getDate(world).getSeason() != Season.WINTER;
  if (isOutsideInSun && wasOutsideInSun) {
    affectHappiness(type.getRelationshipBonus(AnimalAction.OUTSIDE));
  }
  //Mark the past value
  wasOutsideInSun = isOutsideInSun;
}

代码示例来源:origin: CyclopsMC/EvilCraft

@Override
public void updateTick(World world, BlockPos blockPos, IBlockState blockState, Random random) {
  if(random.nextInt(CHANCE_HARDEN) == 0 &&
      isSourceBlock(world, blockPos) &&
      (!(world.isRaining() && ObfuscationHelpers.isRainingEnabled(world.getBiome(blockPos)))
          || !world.canBlockSeeSky(blockPos))
      && !isWaterInArea(world, blockPos)) {
    world.setBlockState(blockPos, HardenedBlood.getInstance().getDefaultState(), MinecraftHelpers.BLOCK_NOTIFY_CLIENT);
  } else {
    super.updateTick(world, blockPos, blockState, random);
  }
  world.scheduleUpdate(blockPos, this, tickRate(world));
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

public static boolean isRainingAt(World world, BlockPos pos) {
    Biome biome = world.getBiome(pos);
    Weather weather = HFApi.calendar.getWeather(world);
    return (weather.isRain() || (weather.isSnow() && biome.isHighHumidity())) && world.canBlockSeeSky(pos) && world.getPrecipitationHeight(pos).getY() <= pos.getY() && world.getBiome(pos).canRain();
  }
}

代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets

public static void updateSolarPanelAddon(TurretBase base) {
  OMEnergyStorage storage = (OMEnergyStorage) base.getCapability(CapabilityEnergy.ENERGY, EnumFacing.DOWN);
  if (!hasSolarPanelAddon(base) || storage == null) {
    return;
  }
  if (base.getWorld().isDaytime() && !base.getWorld().isRaining() && base.getWorld().canBlockSeeSky(base.getPos().up(2))) {
    storage.receiveEnergy(OMTConfig.MISCELLANEOUS.solarPanelAddonGen, false);
  }
}

相关文章

微信公众号

最新文章

更多

World类方法