You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.7 KiB
Java
68 lines
1.7 KiB
Java
package net.minecraft.block;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import java.util.Random;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.init.Items;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.util.IIcon;
|
|
|
|
public class BlockMelon extends Block
|
|
{
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon field_150201_a;
|
|
private static final String __OBFID = "CL_00000267";
|
|
|
|
protected BlockMelon()
|
|
{
|
|
super(Material.gourd);
|
|
this.setCreativeTab(CreativeTabs.tabBlock);
|
|
}
|
|
|
|
/**
|
|
* Gets the block's texture. Args: side, meta
|
|
*/
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(int side, int meta)
|
|
{
|
|
return side != 1 && side != 0 ? this.blockIcon : this.field_150201_a;
|
|
}
|
|
|
|
public Item getItemDropped(int meta, Random random, int fortune)
|
|
{
|
|
return Items.melon;
|
|
}
|
|
|
|
/**
|
|
* Returns the quantity of items to drop on block destruction.
|
|
*/
|
|
public int quantityDropped(Random random)
|
|
{
|
|
return 3 + random.nextInt(5);
|
|
}
|
|
|
|
/**
|
|
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
|
|
*/
|
|
public int quantityDroppedWithBonus(int maxBonus, Random random)
|
|
{
|
|
int j = this.quantityDropped(random) + random.nextInt(1 + maxBonus);
|
|
|
|
if (j > 9)
|
|
{
|
|
j = 9;
|
|
}
|
|
|
|
return j;
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister reg)
|
|
{
|
|
this.blockIcon = reg.registerIcon(this.getTextureName() + "_side");
|
|
this.field_150201_a = reg.registerIcon(this.getTextureName() + "_top");
|
|
}
|
|
} |