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

The following examples show how to use net.minecraft.init.Items#WHEAT . 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 check out the related API usage on the sidebar.
Example 1
Source File: EntityTofunian.java    From TofuCraftReload with 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
Source File: ItemSupply.java    From minecraft-roguelike with GNU General Public License v3.0 6 votes vote down vote up
@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 File: EntityTofuCow.java    From TofuCraftReload with 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);
}