Java Code Examples for net.minecraft.world.World#isRaining()
The following examples show how to use
net.minecraft.world.World#isRaining() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockSaltPan.java From TofuCraftReload with MIT License | 6 votes |
private float calcAdaptation(World world, BlockPos pos) { Biome biome = world.getBiome(pos); boolean isUnderTheSun = world.canBlockSeeSky(pos); boolean isRaining = world.isRaining(); boolean isDaytime = world.getWorldTime() % 24000 < 12000; float humidity = biome.getRainfall(); float temperature = biome.getTemperature(pos); float rate; if (!isUnderTheSun || isRaining) { rate = 0.0F; } else { rate = isDaytime ? 2.0F : 1.0F; rate *= humidity < 0.2D ? 4.0D : humidity < 0.7D ? 2.0D : humidity < 0.9 ? 1.0D : 0.5D; rate *= temperature < 0.0D ? 1.0D : temperature < 0.6D ? 1.5D : temperature < 1.0D ? 2.0D : 4.0D; } return rate; }
Example 2
Source File: BlockTorchTFC.java From TFC2 with GNU General Public License v3.0 | 6 votes |
@Override public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if (!worldIn.isRemote && this.isOn) { if (TFCOptions.torchBurnTime != 0 && worldIn.getTileEntity(pos) instanceof TileTorch) { TileTorch te = (TileTorch) worldIn.getTileEntity(pos); boolean timerExpired = Timekeeper.getInstance().getTotalHours() > te.getTimer() + TFCOptions.torchBurnTime; boolean isWet = worldIn.isRaining() && worldIn.canBlockSeeSky(pos); if (timerExpired || isWet) { int meta = this.getMetaFromState(state); worldIn.setBlockState(pos, TFCBlocks.TorchOff.getStateFromMeta(meta), 3); } } } }
Example 3
Source File: CoverSolarPanel.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
private boolean canSeeSunClearly(World world, BlockPos blockPos) { if (!world.canSeeSky(blockPos)) { return false; } if (world.isRaining()) { Biome biome = world.getBiome(blockPos); if (biome.canRain() || biome.getEnableSnow()) { return false; } } return world.isDaytime(); }
Example 4
Source File: NEIServerUtils.java From NotEnoughItems with MIT License | 5 votes |
public static void toggleRaining(World world, boolean notify) { boolean raining = !world.isRaining(); if (!raining)//turn off { ((WorldServer) world).provider.resetRainAndThunder(); } else { world.getWorldInfo().setRaining(!isRaining(world)); } if (notify) { ServerUtils.sendChatToAll(new TextComponentTranslation("nei.chat.rain." + (raining ? "on" : "off"))); } }
Example 5
Source File: BlockElectricMushroom.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if(!world.isRemote && Configuration.electricPlantsSpawnLightning && world.isRaining() && world.getBiome(pos) == AdvancedRocketryBiomes.stormLandsBiome) { int lightningX = pos.getX() + rand.nextInt(24) - 12; int lightningZ = pos.getZ() + rand.nextInt(24) - 12; BlockPos lightning = new BlockPos(lightningX, 0, lightningZ ); lightning = world.getTopSolidOrLiquidBlock(lightning); world.addWeatherEffect(new EntityLightningBolt(world, lightning.getX(), lightning.getY(), lightning.getZ(), true)); } }
Example 6
Source File: NEIServerUtils.java From NotEnoughItems with MIT License | 5 votes |
public static void toggleRaining(World world, boolean notify) { boolean raining = !world.isRaining(); if (!raining)//turn off ((WorldServer) world).provider.resetRainAndThunder(); else world.getWorldInfo().setRaining(!isRaining(world)); if (notify) ServerUtils.sendChatToAll(new ChatComponentTranslation("nei.chat.rain." + (raining ? "on" : "off"))); }
Example 7
Source File: BlockRainPlant.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void executeFullGrownEffect(World world, int x, int y, int z, Random rand){ if(!world.isRemote && world.isRaining()) { ItemStack seed = new ItemStack(Itemss.plasticPlant, 1, ItemPlasticPlants.RAIN_PLANT_DAMAGE); EntityItem plant = new EntityItem(world, x + rand.nextInt(16) - 8, 128, z + rand.nextInt(16) - 8, seed); plant.lifespan = 300; ItemPlasticPlants.markInactive(plant); world.spawnEntityInWorld(plant); world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) - 2, 3); } }
Example 8
Source File: WorldRainingSensor.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText){ return world.isRaining() ? 15 : 0; }
Example 9
Source File: TurtleUpgradeSensor.java From OpenPeripheral-Addons with MIT License | 4 votes |
@Override public int getSensorRange() { final World world = getWorld(); return (world.isRaining() && world.isThundering())? Config.sensorRangeInStorm : Config.sensorRange; }
Example 10
Source File: TileEntitySensor.java From OpenPeripheral-Addons with MIT License | 4 votes |
@Override public int getSensorRange() { final World world = getWorld(); return (world.isRaining() && world.isThundering())? Config.sensorRangeInStorm : Config.sensorRange; }