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

The following examples show how to use net.minecraft.init.Items#PUMPKIN_SEEDS . 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 check out the related API usage on the sidebar.
Example 1
@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 2
Source Project: EmergingTechnology   File: PlantHelper.java    License: MIT License 5 votes vote down vote up
public static IBlockState getBlockStateFromItemStackForPlanting(ItemStack itemStack, World world, BlockPos pos) {

        if (itemStack.getItem() == Items.WHEAT_SEEDS) {
            return Blocks.WHEAT.getDefaultState();
        }
        if (itemStack.getItem() == Items.POTATO) {
            return Blocks.POTATOES.getDefaultState();
        }
        if (itemStack.getItem() == Items.CARROT) {
            return Blocks.CARROTS.getDefaultState();
        }
        if (itemStack.getItem() == Items.BEETROOT_SEEDS) {
            return Blocks.BEETROOTS.getDefaultState();
        }
        if (itemStack.getItem() == Items.REEDS) {
            return Blocks.REEDS.getDefaultState();
        }
        if (itemStack.getItem() == Items.PUMPKIN_SEEDS) {
            return Blocks.PUMPKIN_STEM.getDefaultState();
        }
        if (itemStack.getItem() == Items.MELON_SEEDS) {
            return Blocks.MELON_STEM.getDefaultState();
        }

        if (itemStack.getItem() instanceof IPlantable) {
            return ((IPlantable) itemStack.getItem()).getPlant(world, pos);
        }

        return null;
    }
 
Example 3
private boolean canBeReplanted(BlockPos pos)
{
	Item item = plants.get(pos);
	
	if(item == Items.WHEAT_SEEDS || item == Items.CARROT
		|| item == Items.POTATO || item == Items.BEETROOT_SEEDS
		|| item == Items.PUMPKIN_SEEDS || item == Items.MELON_SEEDS)
		return BlockUtils.getBlock(pos.down()) instanceof BlockFarmland;
	
	if(item == Items.NETHER_WART)
		return BlockUtils.getBlock(pos.down()) instanceof BlockSoulSand;
	
	return false;
}
 
Example 4
@Override
public boolean isBreedingItem(ItemStack stack) {
	return stack.getItem() == Items.WHEAT_SEEDS || stack.getItem() == Items.BEETROOT_SEEDS || stack.getItem() == Items.MELON_SEEDS || stack.getItem() == Items.PUMPKIN_SEEDS;
}
 
Example 5
private boolean matches(ItemStack stack) {
	return stack.getItem() == Items.PUMPKIN_SEEDS || stack.getItem() == Items.MELON_SEEDS;
}