Last active
May 18, 2019 04:26
-
-
Save dealingwith/5b2f5f8e38d9e210753be85713cfe6e4 to your computer and use it in GitHub Desktop.
Showing the diff of a simple Minecraft block and one that drops items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BlockDropper extends Block | |
{ | |
public BlockDropper() | |
{ | |
super(Material.ROCK); | |
this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS); // the block will appear on the Blocks tab in creative | |
this.setHardness(0.5f); | |
} | |
@SideOnly(Side.CLIENT) | |
public BlockRenderLayer getBlockLayer() | |
{ | |
return BlockRenderLayer.SOLID; | |
} | |
@Override | |
public boolean isOpaqueCube(IBlockState iBlockState) { | |
return true; | |
} | |
@Override | |
public boolean isFullCube(IBlockState iBlockState) { | |
return true; | |
} | |
@Override | |
public EnumBlockRenderType getRenderType(IBlockState iBlockState) { | |
return EnumBlockRenderType.MODEL; | |
} | |
@Override | |
public Item getItemDropped(IBlockState state, Random rand, int fortune) | |
{ | |
return Items.COOKIE; | |
} | |
@Override | |
public int quantityDropped(Random random) { | |
return random.nextInt(4) + 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment