Java Code Examples for net.minecraft.world.World.isRainingAt()

The following are Jave code examples for showing how to use isRainingAt() of the net.minecraft.world.World class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Backmemed   File: BlockFarmland.java   Source Code and License Vote up 6 votes
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    int i = ((Integer)state.getValue(MOISTURE)).intValue();

    if (!this.hasWater(worldIn, pos) && !worldIn.isRainingAt(pos.up()))
    {
        if (i > 0)
        {
            worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(i - 1)), 2);
        }
        else if (!this.hasCrops(worldIn, pos))
        {
            this.func_190970_b(worldIn, pos);
        }
    }
    else if (i < 7)
    {
        worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(7)), 2);
    }
}
 
Example 2
Project: CustomWorldGen   File: BlockFarmland.java   Source Code and License Vote up 6 votes
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    int i = ((Integer)state.getValue(MOISTURE)).intValue();

    if (!this.hasWater(worldIn, pos) && !worldIn.isRainingAt(pos.up()))
    {
        if (i > 0)
        {
            worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(i - 1)), 2);
        }
        else if (!this.hasCrops(worldIn, pos))
        {
            worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
        }
    }
    else if (i < 7)
    {
        worldIn.setBlockState(pos, state.withProperty(MOISTURE, Integer.valueOf(7)), 2);
    }
}
 
Example 3
Project: Zombe-Modpack   File: BlockFire.java   Source Code and License Vote up 5 votes
private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age)
{
    int i = this.getFlammability(worldIn.getBlockState(pos).getBlock());

    if (random.nextInt(chance) < i)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (random.nextInt(age + 10) < 5 && !worldIn.isRainingAt(pos))
        {
            int j = age + random.nextInt(5) / 4;

            if (j > 15)
            {
                j = 15;
            }

            worldIn.setBlockState(pos, this.getDefaultState().withProperty(AGE, Integer.valueOf(j)), 3);
        }
        else
        {
            worldIn.setBlockToAir(pos);
        }

        if (iblockstate.getBlock() == Blocks.TNT)
        {
            Blocks.TNT.onBlockDestroyedByPlayer(worldIn, pos, iblockstate.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
        }
    }
}
 
Example 4
Project: Backmemed   File: BlockFire.java   Source Code and License Vote up 5 votes
private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age)
{
    int i = this.getFlammability(worldIn.getBlockState(pos).getBlock());

    if (random.nextInt(chance) < i)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (random.nextInt(age + 10) < 5 && !worldIn.isRainingAt(pos))
        {
            int j = age + random.nextInt(5) / 4;

            if (j > 15)
            {
                j = 15;
            }

            worldIn.setBlockState(pos, this.getDefaultState().withProperty(AGE, Integer.valueOf(j)), 3);
        }
        else
        {
            worldIn.setBlockToAir(pos);
        }

        if (iblockstate.getBlock() == Blocks.TNT)
        {
            Blocks.TNT.onBlockDestroyedByPlayer(worldIn, pos, iblockstate.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
        }
    }
}
 
Example 5
Project: Backmemed   File: BlockLeaves.java   Source Code and License Vote up 5 votes
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (worldIn.isRainingAt(pos.up()) && !worldIn.getBlockState(pos.down()).isFullyOpaque() && rand.nextInt(15) == 1)
    {
        double d0 = (double)((float)pos.getX() + rand.nextFloat());
        double d1 = (double)pos.getY() - 0.05D;
        double d2 = (double)((float)pos.getZ() + rand.nextFloat());
        worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 6
Project: CustomWorldGen   File: BlockFire.java   Source Code and License Vote up 5 votes
private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face)
{
    int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face);

    if (random.nextInt(chance) < i)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (random.nextInt(age + 10) < 5 && !worldIn.isRainingAt(pos))
        {
            int j = age + random.nextInt(5) / 4;

            if (j > 15)
            {
                j = 15;
            }

            worldIn.setBlockState(pos, this.getDefaultState().withProperty(AGE, Integer.valueOf(j)), 3);
        }
        else
        {
            worldIn.setBlockToAir(pos);
        }

        if (iblockstate.getBlock() == Blocks.TNT)
        {
            Blocks.TNT.onBlockDestroyedByPlayer(worldIn, pos, iblockstate.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true)));
        }
    }
}
 
Example 7
Project: CustomWorldGen   File: BlockLeaves.java   Source Code and License Vote up 5 votes
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (worldIn.isRainingAt(pos.up()) && !worldIn.getBlockState(pos.down()).isFullyOpaque() && rand.nextInt(15) == 1)
    {
        double d0 = (double)((float)pos.getX() + rand.nextFloat());
        double d1 = (double)pos.getY() - 0.05D;
        double d2 = (double)((float)pos.getZ() + rand.nextFloat());
        worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
Example 8
Project: Got-Wood   File: SpecialFire.java   Source Code and License Vote up 4 votes
protected boolean canDie(World worldIn, BlockPos pos)
{
    return worldIn.isRainingAt(pos) || worldIn.isRainingAt(pos.west()) || worldIn.isRainingAt(pos.east()) || worldIn.isRainingAt(pos.north()) || worldIn.isRainingAt(pos.south());
}
 
Example 9
Project: Got-Wood   File: BlockSpecialFire.java   Source Code and License Vote up 4 votes
@Override
protected boolean canDie(World worldIn, BlockPos pos) {
	return worldIn.isRainingAt(pos) || worldIn.isRainingAt(pos.west()) || worldIn.isRainingAt(pos.east()) || worldIn.isRainingAt(pos.north()) || worldIn.isRainingAt(pos.south());
}
 
Example 10
Project: Zombe-Modpack   File: BlockFire.java   Source Code and License Vote up 4 votes
protected boolean canDie(World worldIn, BlockPos pos)
{
    return worldIn.isRainingAt(pos) || worldIn.isRainingAt(pos.west()) || worldIn.isRainingAt(pos.east()) || worldIn.isRainingAt(pos.north()) || worldIn.isRainingAt(pos.south());
}
 
Example 11
Project: Backmemed   File: BlockFire.java   Source Code and License Vote up 4 votes
protected boolean canDie(World worldIn, BlockPos pos)
{
    return worldIn.isRainingAt(pos) || worldIn.isRainingAt(pos.west()) || worldIn.isRainingAt(pos.east()) || worldIn.isRainingAt(pos.north()) || worldIn.isRainingAt(pos.south());
}
 
Example 12
Project: CustomWorldGen   File: BlockFire.java   Source Code and License Vote up 4 votes
protected boolean canDie(World worldIn, BlockPos pos)
{
    return worldIn.isRainingAt(pos) || worldIn.isRainingAt(pos.west()) || worldIn.isRainingAt(pos.east()) || worldIn.isRainingAt(pos.north()) || worldIn.isRainingAt(pos.south());
}