Java Code Examples for net.minecraft.init.Items#WHEAT

The following examples show how to use net.minecraft.init.Items#WHEAT . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: TofuCraftReload   File: EntityTofunian.java    License: MIT License 6 votes vote down vote up
private boolean hasEnoughItems(int multiplier) {
    boolean flag = this.getTofuProfession() == TofuProfession.TOFUCOOK;

    for (int i = 0; i < this.getVillagerInventory().getSizeInventory(); ++i) {
        ItemStack itemstack = this.getVillagerInventory().getStackInSlot(i);

        if (!itemstack.isEmpty()) {
            if (itemstack.getItem() == Items.BREAD && itemstack.getCount() >= 3 * multiplier || itemstack.getItem() == Items.POTATO && itemstack.getCount() >= 12 * multiplier || itemstack.getItem() == Items.CARROT && itemstack.getCount() >= 12 * multiplier || itemstack.getItem() == Items.BEETROOT && itemstack.getCount() >= 12 * multiplier || itemstack.getItem() == ItemLoader.foodset && itemstack.getCount() >= 12 * multiplier || itemstack.getItem() == ItemLoader.soybeans && itemstack.getCount() >= 12 * multiplier) {
                return true;
            }

            if (itemstack.getItem() == ItemLoader.tofu_food && itemstack.getCount() >= 14 * multiplier) {
                return true;
            }

            if (flag && itemstack.getItem() == Items.WHEAT && itemstack.getCount() >= 9 * multiplier || flag && itemstack.getItem() == ItemLoader.rice && itemstack.getCount() >= 9 * multiplier) {
                return true;
            }
        }
    }

    return false;
}
 
Example 2
@Override
public ItemStack getLootItem(Random rand, int level) {
	
	if(rand.nextInt(20) == 0) return new ItemStack(Items.CARROT, 1);
	if(rand.nextInt(20) == 0) return new ItemStack(Items.POTATO, 1);

	switch(rand.nextInt(8)){
	case 0: return new ItemStack(Items.WHEAT_SEEDS, rand.nextInt(8) + 1);
	case 1: return new ItemStack(Items.PUMPKIN_SEEDS, rand.nextInt(8) + 1);
	case 2: return new ItemStack(Items.MELON_SEEDS, rand.nextInt(8) + 1);		
	case 3: return new ItemStack(Items.WHEAT, rand.nextInt(8) + 1);
	case 4: return new ItemStack(Blocks.TORCH, 10 + rand.nextInt(10));
	case 5: return new ItemStack(Items.PAPER, rand.nextInt(8) + 1);
	case 6:	return new ItemStack(Items.BOOK, rand.nextInt(4) + 1);
	case 7:	return new ItemStack(Blocks.SAPLING, rand.nextInt(4) + 1, rand.nextInt(4));
	default: return new ItemStack(Items.STICK, 1);
	}
}
 
Example 3
Source Project: TofuCraftReload   File: EntityTofuCow.java    License: MIT License 4 votes vote down vote up
@Override
public boolean isBreedingItem(ItemStack stack) {
    return stack.getItem() == Items.WHEAT || stack.getItem() == Item.getItemFromBlock(BlockLoader.yubaGrass);
}