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

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

本文整理了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

  1. @Override
  2. public boolean canBlockSeeTheSky( final int x, final int y, final int z )
  3. {
  4. if( this.range( x, y, z ) )
  5. {
  6. return this.getWorld().canBlockSeeSky( new BlockPos( x, y, z ) );
  7. }
  8. return false;
  9. }

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

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

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

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

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

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

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

  1. @Override
  2. public boolean canBlockSeeSky(BlockPos pos) {
  3. return getActualWorld().canBlockSeeSky(pos);
  4. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. protected boolean checkCanSeeSun() {
  2. BlockPos blockPos = getPos().up();
  3. if(!getWorld().canBlockSeeSky(blockPos))
  4. return false;
  5. return !getWorld().isRaining() && getWorld().isDaytime();
  6. }

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

  1. @Override
  2. public void onBihourlyTick() {
  3. World world = animal.world;
  4. boolean dayTime = world.isDaytime();
  5. boolean isRaining = world.isRaining();
  6. boolean isOutside = world.canBlockSeeSky(new BlockPos(animal));
  7. boolean isOutsideInSun = !isRaining && isOutside && dayTime && HFApi.calendar.getDate(world).getSeason() != Season.WINTER;
  8. if (isOutsideInSun && wasOutsideInSun) {
  9. affectHappiness(type.getRelationshipBonus(AnimalAction.OUTSIDE));
  10. }
  11. //Mark the past value
  12. wasOutsideInSun = isOutsideInSun;
  13. }

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

  1. @Override
  2. public void updateTick(World world, BlockPos blockPos, IBlockState blockState, Random random) {
  3. if(random.nextInt(CHANCE_HARDEN) == 0 &&
  4. isSourceBlock(world, blockPos) &&
  5. (!(world.isRaining() && ObfuscationHelpers.isRainingEnabled(world.getBiome(blockPos)))
  6. || !world.canBlockSeeSky(blockPos))
  7. && !isWaterInArea(world, blockPos)) {
  8. world.setBlockState(blockPos, HardenedBlood.getInstance().getDefaultState(), MinecraftHelpers.BLOCK_NOTIFY_CLIENT);
  9. } else {
  10. super.updateTick(world, blockPos, blockState, random);
  11. }
  12. world.scheduleUpdate(blockPos, this, tickRate(world));
  13. }

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

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

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

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

相关文章

World类方法