summaryrefslogtreecommitdiff
path: root/src/main/java/blocks/BlockLigniteOre.java
blob: 3782c20b02299ee5737cd5c355689300519ac1f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package blocks;

import blocks.category.BasicBlockOre;
import main.ZCompression;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import java.util.Random;

public class BlockLigniteOre extends BasicBlockOre {

    public BlockLigniteOre() {
        super("lignite_ore", Material.ROCK, 4.0f, 5.0f,1);
    }

    @Override
    public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
        Random rand = world instanceof World  ? ((World) world).rand : new Random();
        int r = RANDOM.nextInt(11);
        if(r > 7) {
            return MathHelper.getRandomIntegerInRange(rand, 0, 10) + fortune;
        }
        else return 0;
    }

    @Override
    public int quantityDropped(IBlockState state, int fortune, Random random) {
       return MathHelper.getRandomIntegerInRange(random, 1, 3 + fortune);
    }

    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        return ZCompression.lignite;
    }
}