summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/block/BlockFallenLeaves.java
blob: 56c6ff730c157894f235bf76cd3ceea2808b951b (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package jp.plusplus.fbs.block;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;

import java.util.Random;

/**
 * Created by plusplus_F on 2015/08/24.
 * 落ち葉
 */
public class BlockFallenLeaves extends BlockBase {
    IIcon icon;

    public BlockFallenLeaves() {
        super(Material.ground);
        setBlockTextureName("fallenLeaves");
        setBlockName("fallenLeaves");
        setHardness(0.2F);
        setLightOpacity(1);
        setStepSound(Block.soundTypeGrass);
    }

    @SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister register) {
        blockIcon = register.registerIcon(getTextureName()+"Top");
        icon=register.registerIcon(getTextureName()+"Side");
    }

    @SideOnly(Side.CLIENT)
    public IIcon getIcon(int side, int meta) {
        if(side==0) return Blocks.dirt.getIcon(0,0);
        if(side==1) return blockIcon;
        return icon;
    }

    @Override
    public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
        return Item.getItemFromBlock(Blocks.dirt);
    }

    @Override
    public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
        return plantable.getPlantType(world, x,y+1,z)== EnumPlantType.Plains;
    }
}